Module Name: src
Committed By: dyoung
Date: Thu Apr 2 00:57:20 UTC 2009
Modified Files:
src/sys/dev/ic: rtw.c
Log Message:
Add the WEP capability to our net80211 capability flags, since we do
sort of support hardware WEP. Only change the WEP key index in a Tx
descriptor from 0 if the type of our transmit key is _WEP, not _TKIP:
i.e., only if we're really doing WEP crypto in the hardware.
Ignore a watchdog timeout on any Tx ring if we can collect some packets
from that ring. Restart both the receiver and the transmitter when a
watchdog timeout occurs instead of restarting only the transmitter.
To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/ic/rtw.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ic/rtw.c
diff -u src/sys/dev/ic/rtw.c:1.106 src/sys/dev/ic/rtw.c:1.107
--- src/sys/dev/ic/rtw.c:1.106 Wed Nov 12 12:36:11 2008
+++ src/sys/dev/ic/rtw.c Thu Apr 2 00:57:20 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: rtw.c,v 1.106 2008/11/12 12:36:11 ad Exp $ */
+/* $NetBSD: rtw.c,v 1.107 2009/04/02 00:57:20 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 David Young. All rights
* reserved.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.106 2008/11/12 12:36:11 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.107 2009/04/02 00:57:20 dyoung Exp $");
#include "bpfilter.h"
@@ -1422,7 +1422,11 @@
/* XXX reference source does not enable MULRW */
/* enable PCI Read/Write Multiple */
+#if 1
cr |= RTW_CR_MULRW;
+#else
+ cr &= ~RTW_CR_MULRW;
+#endif
/* The receive engine will always start at RDSAR. */
if (enable && (flags & ~cr & RTW_CR_RE)) {
@@ -1766,10 +1770,11 @@
}
/* Collect transmitted packets. */
-static void
+static bool
rtw_collect_txring(struct rtw_softc *sc, struct rtw_txsoft_blk *tsb,
struct rtw_txdesc_blk *tdb, int force)
{
+ bool collected = false;
int ndesc;
struct rtw_txsoft *ts;
@@ -1822,6 +1827,8 @@
break;
}
+ collected = true;
+
rtw_collect_txpkt(sc, tdb, ts, ndesc);
SIMPLEQ_REMOVE_HEAD(&tsb->tsb_dirtyq, ts_q);
SIMPLEQ_INSERT_TAIL(&tsb->tsb_freeq, ts, ts_q);
@@ -1831,6 +1838,8 @@
if (ts == NULL)
tsb->tsb_tx_timer = 0;
rtw_reset_oactive(sc);
+
+ return collected;
}
static void
@@ -3340,7 +3349,8 @@
* seem to care, since we don't activate h/w Tx
* encryption.
*/
- if (k != NULL) {
+ if (k != NULL &&
+ k->wk_cipher->ic_cipher == IEEE80211_CIPHER_WEP) {
ctl0 |= __SHIFTIN(k->wk_keyix, RTW_TXCTL0_KEYID_MASK) &
RTW_TXCTL0_KEYID_MASK;
}
@@ -3510,6 +3520,9 @@
else if (--tsb->tsb_tx_timer == 0) {
if (SIMPLEQ_EMPTY(&tsb->tsb_dirtyq))
continue;
+ else if (rtw_collect_txring(sc, tsb,
+ &sc->sc_txdesc_blk[pri], 0))
+ continue;
printf("%s: transmit timeout, priority %d\n",
ifp->if_xname, pri);
ifp->if_oerrors++;
@@ -3526,9 +3539,9 @@
* TBD Stop/restart just the broken rings?
*/
rtw_idle(&sc->sc_regs);
- rtw_io_enable(sc, RTW_CR_TE, 0);
+ rtw_io_enable(sc, RTW_CR_RE | RTW_CR_TE, 0);
rtw_txdescs_reset(sc);
- rtw_io_enable(sc, RTW_CR_TE, 1);
+ rtw_io_enable(sc, RTW_CR_RE | RTW_CR_TE, 1);
rtw_start(ifp);
}
ieee80211_watchdog(&sc->sc_ic);
@@ -3761,7 +3774,7 @@
ic->ic_phytype = IEEE80211_T_DS;
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_caps = IEEE80211_C_PMGT | IEEE80211_C_IBSS |
- IEEE80211_C_HOSTAP | IEEE80211_C_MONITOR;
+ IEEE80211_C_HOSTAP | IEEE80211_C_MONITOR | IEEE80211_C_WEP;
nrate = 0;
ic->ic_sup_rates[IEEE80211_MODE_11B].rs_rates[nrate++] =