svn commit: r251202 - in user/adrian/net80211_tx/sys/dev: iwn ral

Adrian Chadd adrian at FreeBSD.org
Fri May 31 22:08:27 UTC 2013


Author: adrian
Date: Fri May 31 22:08:25 2013
New Revision: 251202
URL: http://svnweb.freebsd.org/changeset/base/251202

Log:
  Remove the direct fondling of the net80211 rate table; replace it with
  a method call.
  
  Since this is all legacy pre-11n rate fiddling, make sure we clear the
  basic rate bit before we do the lookup.
  
  Tested:
  
  * iwn(4)
  
  Not testeD:
  
  * RAL - I don't currently have any hardware for this. :(

Modified:
  user/adrian/net80211_tx/sys/dev/iwn/if_iwn.c
  user/adrian/net80211_tx/sys/dev/ral/rt2560.c
  user/adrian/net80211_tx/sys/dev/ral/rt2661.c
  user/adrian/net80211_tx/sys/dev/ral/rt2860.c

Modified: user/adrian/net80211_tx/sys/dev/iwn/if_iwn.c
==============================================================================
--- user/adrian/net80211_tx/sys/dev/iwn/if_iwn.c	Fri May 31 22:07:28 2013	(r251201)
+++ user/adrian/net80211_tx/sys/dev/iwn/if_iwn.c	Fri May 31 22:08:25 2013	(r251202)
@@ -2136,7 +2136,8 @@ iwn_newassoc(struct ieee80211_node *ni, 
 		for (i = 0; i < ni->ni_rates.rs_nrates; i++) {
 			rate = RV(ni->ni_rates.rs_rates[i]);
 			plcp = rate2plcp(rate);
-			ridx = ic->ic_rt->rateCodeToIndex[rate];
+			ridx = ieee80211_legacy_rate_lookup(ic->ic_rt,
+			    rate & IEEE80211_RATE_VAL);
 			if (ridx < IWN_RIDX_OFDM6 &&
 			    IEEE80211_IS_CHAN_2GHZ(ni->ni_chan))
 				plcp |= IWN_RFLAG_CCK;
@@ -3400,7 +3401,8 @@ iwn_tx_data(struct iwn_softc *sc, struct
 		(void) ieee80211_ratectl_rate(ni, NULL, 0);
 		rate = ni->ni_txrate;
 	}
-	ridx = ic->ic_rt->rateCodeToIndex[rate];
+	ridx = ieee80211_legacy_rate_lookup(ic->ic_rt,
+	    rate & IEEE80211_RATE_VAL);
 
 	/* Encrypt the frame if need be. */
 	if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
@@ -3637,7 +3639,8 @@ iwn_tx_data_raw(struct iwn_softc *sc, st
 
 	/* Choose a TX rate index. */
 	rate = params->ibp_rate0;
-	ridx = ic->ic_rt->rateCodeToIndex[rate];
+	ridx = ieee80211_legacy_rate_lookup(ic->ic_rt,
+	    rate & IEEE80211_RATE_VAL);
 	if (ridx == (uint8_t)-1) {
 		/* XXX fall back to mcast/mgmt rate? */
 		m_freem(m);

Modified: user/adrian/net80211_tx/sys/dev/ral/rt2560.c
==============================================================================
--- user/adrian/net80211_tx/sys/dev/ral/rt2560.c	Fri May 31 22:07:28 2013	(r251201)
+++ user/adrian/net80211_tx/sys/dev/ral/rt2560.c	Fri May 31 22:08:25 2013	(r251202)
@@ -2370,7 +2370,7 @@ rt2560_set_basicrates(struct rt2560_soft
 		if (!(rate & IEEE80211_RATE_BASIC))
 			continue;
 
-		mask |= 1 << ic->ic_rt->rateCodeToIndex[RV(rate)];
+		mask |= 1 << ieee80211_legacy_rate_lookup(ic->ic_rt, RV(rate));
 	}
 
 	RAL_WRITE(sc, RT2560_ARSP_PLCP_1, mask);

Modified: user/adrian/net80211_tx/sys/dev/ral/rt2661.c
==============================================================================
--- user/adrian/net80211_tx/sys/dev/ral/rt2661.c	Fri May 31 22:07:28 2013	(r251201)
+++ user/adrian/net80211_tx/sys/dev/ral/rt2661.c	Fri May 31 22:08:25 2013	(r251202)
@@ -1923,7 +1923,7 @@ rt2661_set_basicrates(struct rt2661_soft
 		if (!(rate & IEEE80211_RATE_BASIC))
 			continue;
 
-		mask |= 1 << ic->ic_rt->rateCodeToIndex[RV(rate)];
+		mask |= 1 << ieee80211_legacy_rate_lookup(ic->ic_rt, RV(rate));
 	}
 
 	RAL_WRITE(sc, RT2661_TXRX_CSR5, mask);

Modified: user/adrian/net80211_tx/sys/dev/ral/rt2860.c
==============================================================================
--- user/adrian/net80211_tx/sys/dev/ral/rt2860.c	Fri May 31 22:07:28 2013	(r251201)
+++ user/adrian/net80211_tx/sys/dev/ral/rt2860.c	Fri May 31 22:08:25 2013	(r251202)
@@ -1528,7 +1528,7 @@ rt2860_tx(struct rt2860_softc *sc, struc
 		tid = 0;
 	}
 	ring = &sc->txq[qid];
-	ridx = ic->ic_rt->rateCodeToIndex[rate];
+	ridx = ieee80211_legacy_rate_lookup(ic->ic_rt, rate);
 
 	/* get MCS code from rate index */
 	mcs = rt2860_rates[ridx].mcs;
@@ -1779,7 +1779,8 @@ rt2860_tx_raw(struct rt2860_softc *sc, s
 
 	/* Choose a TX rate index. */
 	rate = params->ibp_rate0;
-	ridx = ic->ic_rt->rateCodeToIndex[rate];
+	ridx = ieee80211_legacy_rate_lookup(ic->ic_rt,
+	    rate & IEEE80211_RATE_VAL);
 	if (ridx == (uint8_t)-1) {
 		/* XXX fall back to mcast/mgmt rate? */
 		m_freem(m);
@@ -2311,7 +2312,7 @@ rt2860_set_basicrates(struct rt2860_soft
 		if (!(rate & IEEE80211_RATE_BASIC))
 			continue;
 
-		mask |= 1 << ic->ic_rt->rateCodeToIndex[RV(rate)];
+		mask |= 1 << ieee80211_legacy_rate_lookup(ic->ic_rt, RV(rate));
 	}
 
 	RAL_WRITE(sc, RT2860_LEGACY_BASIC_RATE, mask);


More information about the svn-src-user mailing list