Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Oct 2007 10:12:51 GMT
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 127305 for review
Message-ID:  <200710081012.l98ACppR000813@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=127305

Change 127305 by kevlo@kevlo_rtsl on 2007/10/08 10:12:50

	Fix a panic with my Asus WL-100G(BCM4306 chipset) device.

Affected files ...

.. //depot/projects/wifi/sys/dev/bwi/if_bwi.c#6 edit

Differences ...

==== //depot/projects/wifi/sys/dev/bwi/if_bwi.c#6 (text+ko) ====

@@ -1201,6 +1201,11 @@
 	struct bwi_softc *sc = ifp->if_softc;
 	struct ieee80211com *ic = &sc->sc_ic;
 	struct bwi_txbuf_data *tbd = &sc->sc_tx_bdata[BWI_TX_DATA_RING];
+	struct ieee80211_frame *wh;
+	struct ieee80211_node *ni;
+	struct ether_header *eh;
+	struct ieee80211_key *k;
+	struct mbuf *m;
 	int trans, idx;
 
 	BWI_LOCK(sc);
@@ -1214,17 +1219,11 @@
 	idx = tbd->tbd_idx;
 
 	while (tbd->tbd_buf[idx].tb_mbuf == NULL) {
-		struct ieee80211_frame *wh;
-		struct ieee80211_node *ni;
-		struct mbuf *m;
-
 		IF_DEQUEUE(&ic->ic_mgtq, m);
 		if (m != NULL) {
 			ni = (struct ieee80211_node *)m->m_pkthdr.rcvif;
 			m->m_pkthdr.rcvif = NULL;
 		} else {
-			struct ether_header *eh;
-
 			if (ic->ic_state != IEEE80211_S_RUN)
 				break;
 
@@ -1265,7 +1264,8 @@
 
 		wh = mtod(m, struct ieee80211_frame *);
 		if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
-			if (ieee80211_crypto_encap(ic, ni, m) == NULL) {
+			k = ieee80211_crypto_encap(ic, ni, m);
+			if (k == NULL) {
 				ieee80211_free_node(ni);
 				m_freem(m);
 				ifp->if_oerrors++;
@@ -1515,6 +1515,8 @@
 {
 	struct ifnet *ifp = ic->ic_ifp;
 	struct bwi_softc *sc = ifp->if_softc;
+	struct bwi_mac *mac;
+	struct ieee80211_node *ni;
 	int error;
 
 	BWI_LOCK(sc);
@@ -1528,7 +1530,7 @@
 	if (ic->ic_opmode == IEEE80211_M_MONITOR) {
 		/* Nothing to do */
 	} else if (nstate == IEEE80211_S_RUN) {
-		struct bwi_mac *mac;
+		ni = ic->ic_bss;
 
 		bwi_set_bssid(sc, ic->ic_bss->ni_bssid);
 
@@ -1539,10 +1541,17 @@
 		/* Initial TX power calibration */
 		bwi_mac_calibrate_txpower(mac);
 
-		/* start automatic rate control timer */
-		if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE)
-			callout_reset(&sc->sc_amrr_ch, hz / 2,
-			    bwi_amrr_timeout, sc);
+		if (ic->ic_opmode == IEEE80211_M_STA) {
+			/* fake a join to init the tx rate */
+			bwi_newassoc(ni, 1);
+		}
+
+		if (ic->ic_opmode != IEEE80211_M_MONITOR) {
+			/* start automatic rate control timer */
+			if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE)
+				callout_reset(&sc->sc_amrr_ch, hz / 2,
+				    bwi_amrr_timeout, sc);
+		}
 	} else {
 		bwi_set_bssid(sc, bwi_zero_addr);
 	}
@@ -1581,7 +1590,7 @@
 	for (i = ni->ni_rates.rs_nrates - 1;
 	     i > 0 && (ni->ni_rates.rs_rates[i] & IEEE80211_RATE_VAL) > 72;
 	     i--);
-	ni->ni_txrate = i;
+		ni->ni_txrate = i;
 }
 
 static void
@@ -3089,8 +3098,8 @@
 		if (tx_status0 & (BWI_TXSTATUS0_AMPDU | BWI_TXSTATUS0_PENDING))
 			continue;
 
-		_bwi_txeof(sc, tx_id, tx_status0 & BWI_TXSTATUS0_ACKED,
-			   data_txcnt);
+		_bwi_txeof(sc, le16toh(tx_id), tx_status0 & BWI_TXSTATUS0_ACKED,
+		    data_txcnt);
 	}
 
 	if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710081012.l98ACppR000813>