Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Feb 2008 11:29:44 GMT
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 134835 for review
Message-ID:  <200802051129.m15BTikj034894@repoman.freebsd.org>

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

Change 134835 by sephe@sephe_enigma:sam_wifi on 2008/02/05 11:29:08

	Merge rate table changes from vap branch:
	Instead of installing rate table in channel during attach, drivers are
	now responsible to get rate table when channel switching happens.
	All duration calculatoin functions are not take rate table as their
	first parameter instead of channel.
	
	Reminded by: sam

Affected files ...

.. //depot/projects/wifi/sys/dev/ral/rt2560.c#32 edit
.. //depot/projects/wifi/sys/dev/ral/rt2560var.h#10 edit
.. //depot/projects/wifi/sys/dev/ral/rt2661.c#24 edit
.. //depot/projects/wifi/sys/dev/ral/rt2661var.h#8 edit
.. //depot/projects/wifi/sys/net80211/_ieee80211.h#28 edit
.. //depot/projects/wifi/sys/net80211/ieee80211.c#61 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_phy.c#7 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_phy.h#4 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ral/rt2560.c#32 (text) ====

@@ -1481,7 +1481,7 @@
 	desc->plcp_service = 4;
 
 	len += IEEE80211_CRC_LEN;
-	if (ieee80211_rate2phytype(ic->ic_curchan, rate) == IEEE80211_T_OFDM) {
+	if (ieee80211_rate2phytype(sc->sc_currates, rate) == IEEE80211_T_OFDM) {
 		desc->flags |= htole32(RT2560_TX_OFDM);
 
 		plcp_length = len & 0xfff;
@@ -1619,7 +1619,7 @@
 	if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
 		flags |= RT2560_TX_ACK;
 
-		dur = ieee80211_ack_duration(ic->ic_curchan, rate,
+		dur = ieee80211_ack_duration(sc->sc_currates, rate,
 			ic->ic_flags);
 		*(uint16_t *)wh->i_dur = htole16(dur);
 
@@ -1804,12 +1804,12 @@
 
 		rtsrate = IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan) ? 12 : 2;
 
-		dur = ieee80211_ack_duration(ic->ic_curchan,
+		dur = ieee80211_ack_duration(sc->sc_currates,
 			rtsrate, ic->ic_flags)
-		    + ieee80211_compute_duration(ic->ic_curchan,
+		    + ieee80211_compute_duration(sc->sc_currates,
 			m0->m_pkthdr.len + IEEE80211_CRC_LEN, rate,
 			ic->ic_flags)
-		    + ieee80211_ack_duration(ic->ic_curchan,
+		    + ieee80211_ack_duration(sc->sc_currates,
 		    	rate, ic->ic_flags);
 
 		m = rt2560_get_rts(sc, wh, dur);
@@ -1916,7 +1916,7 @@
 	if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
 		flags |= RT2560_TX_ACK;
 
-		dur = ieee80211_ack_duration(ic->ic_curchan, rate,
+		dur = ieee80211_ack_duration(sc->sc_currates, rate,
 			ic->ic_flags);
 		*(uint16_t *)wh->i_dur = htole16(dur);
 	}
@@ -2222,6 +2222,7 @@
 	chan = ieee80211_chan2ieee(ic, c);
 	if (chan == 0 || chan == IEEE80211_CHAN_ANY)
 		return;
+	sc->sc_currates = ieee80211_get_ratetable(c);
 
 	if (IEEE80211_IS_CHAN_2GHZ(c))
 		power = min(sc->txpow[chan - 1], 31);

==== //depot/projects/wifi/sys/dev/ral/rt2560var.h#10 (text) ====

@@ -165,6 +165,7 @@
 #define RT2560_F_PRIO_OACTIVE	0x2
 #define RT2560_F_DATA_OACTIVE	0x4
 	int			sc_flags;
+	const struct ieee80211_rate_table *sc_currates;
 };
 
 int	rt2560_attach(device_t, int);

==== //depot/projects/wifi/sys/dev/ral/rt2661.c#24 (text) ====

@@ -1356,7 +1356,7 @@
 	desc->plcp_service = 4;
 
 	len += IEEE80211_CRC_LEN;
-	if (ieee80211_rate2phytype(ic->ic_curchan, rate) == IEEE80211_T_OFDM) {
+	if (ieee80211_rate2phytype(sc->sc_currates, rate) == IEEE80211_T_OFDM) {
 		desc->flags |= htole32(RT2661_TX_OFDM);
 
 		plcp_length = len & 0xfff;
@@ -1442,7 +1442,7 @@
 	if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
 		flags |= RT2661_TX_NEED_ACK;
 
-		dur = ieee80211_ack_duration(ic->ic_curchan,
+		dur = ieee80211_ack_duration(sc->sc_currates,
 			rate, ic->ic_flags);
 		*(uint16_t *)wh->i_dur = htole16(dur);
 
@@ -1567,12 +1567,12 @@
 
 		rtsrate = IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan) ? 12 : 2;
 
-		dur = ieee80211_ack_duration(ic->ic_curchan,
+		dur = ieee80211_ack_duration(sc->sc_currates,
 			rtsrate, ic->ic_flags)
-		    + ieee80211_compute_duration(ic->ic_curchan,
+		    + ieee80211_compute_duration(sc->sc_currates,
 			m0->m_pkthdr.len + IEEE80211_CRC_LEN, rate,
 			ic->ic_flags)
-		    + ieee80211_ack_duration(ic->ic_curchan,
+		    + ieee80211_ack_duration(sc->sc_currates,
 		    	rate, ic->ic_flags);
 
 		m = rt2661_get_rts(sc, wh, dur);
@@ -1676,7 +1676,7 @@
 	if (!noack && !IEEE80211_IS_MULTICAST(wh->i_addr1)) {
 		flags |= RT2661_TX_NEED_ACK;
 
-		dur = ieee80211_ack_duration(ic->ic_curchan, rate,
+		dur = ieee80211_ack_duration(sc->sc_currates, rate,
 			ic->ic_flags);
 		*(uint16_t *)wh->i_dur = htole16(dur);
 	}
@@ -2137,6 +2137,8 @@
 	if (chan == 0 || chan == IEEE80211_CHAN_ANY)
 		return;
 
+	sc->sc_currates = ieee80211_get_ratetable(c);
+
 	/* select the appropriate RF settings based on what EEPROM says */
 	rfprog = (sc->rfprog == 0) ? rt2661_rf5225_1 : rt2661_rf5225_2;
 

==== //depot/projects/wifi/sys/dev/ral/rt2661var.h#8 (text) ====

@@ -168,6 +168,7 @@
 	int				sc_txtap_len;
 #define                 RAL_INPUT_RUNNING       1
 	int                             sc_flags;
+	const struct ieee80211_rate_table *sc_currates;
 };
 
 int	rt2661_attach(device_t, int);

==== //depot/projects/wifi/sys/net80211/_ieee80211.h#28 (text+ko) ====

@@ -102,7 +102,6 @@
 /*
  * Channels are specified by frequency and attributes.
  */
-struct ieee80211_rate_table;
 struct ieee80211_channel {
 	uint32_t	ic_flags;	/* see below */
 	uint16_t	ic_freq;	/* setting in Mhz */
@@ -112,7 +111,6 @@
 	int8_t		ic_minpower;	/* minimum tx power in .5 dBm */
 	uint8_t		ic_state;	/* dynamic state */
 	uint8_t		ic_extieee;	/* HT40 extension channel number */
-	const struct ieee80211_rate_table *ic_rt; /* rate table */
 };
 
 #define	IEEE80211_CHAN_MAX	255

==== //depot/projects/wifi/sys/net80211/ieee80211.c#61 (text+ko) ====

@@ -182,8 +182,6 @@
 			setbit(ic->ic_modecaps, IEEE80211_MODE_11NA);
 		if (IEEE80211_IS_CHAN_HTG(c))
 			setbit(ic->ic_modecaps, IEEE80211_MODE_11NG);
-
-		ieee80211_set_ratetable(c);
 	}
 	/* initialize candidate channels to all available */
 	memcpy(ic->ic_chan_active, ic->ic_chan_avail,

==== //depot/projects/wifi/sys/net80211/ieee80211_phy.c#7 (text+ko) ====

@@ -317,10 +317,10 @@
 #undef N
 }
 
-void
-ieee80211_set_ratetable(struct ieee80211_channel *c)
+const struct ieee80211_rate_table *
+ieee80211_get_ratetable(const struct ieee80211_channel *c)
 {
-	const struct ieee80211_rate_table *rt;
+	const struct ieee80211_rate_table *rt = NULL;
 
 	/* XXX HT */
 	if (IEEE80211_IS_CHAN_HALF(c))
@@ -348,7 +348,7 @@
 		panic("%s: no rate table for channel; freq %u flags 0x%x\n",
 		      __func__, c->ic_freq, c->ic_flags);
 	}
-	c->ic_rt = rt;
+	return rt;
 }
 
 #ifdef notyet
@@ -402,9 +402,8 @@
 #endif	/* notyet */
 
 enum ieee80211_phytype
-ieee80211_rate2phytype(const struct ieee80211_channel *c, uint8_t rate)
+ieee80211_rate2phytype(const struct ieee80211_rate_table *rt, uint8_t rate)
 {
-	const struct ieee80211_rate_table *rt = c->ic_rt;
 	uint8_t rix = rt->rateCodeToIndex[rate];
 
 	KASSERT(rix != (uint8_t)-1, ("rate %d has no info", rate));
@@ -418,10 +417,9 @@
  * sent using rate, phy and short preamble setting.
  */
 uint16_t
-ieee80211_ack_duration(const struct ieee80211_channel *c,
+ieee80211_ack_duration(const struct ieee80211_rate_table *rt,
     uint8_t rate, int flags)
 {
-	const struct ieee80211_rate_table *rt = c->ic_rt;
 	uint8_t rix = rt->rateCodeToIndex[rate];
 
 	KASSERT(rix != (uint8_t)-1, ("rate %d has no info", rate));
@@ -437,10 +435,10 @@
 }
 
 uint16_t
-ieee80211_compute_duration(const struct ieee80211_channel *c,
+ieee80211_compute_duration(const struct ieee80211_rate_table *rt,
 	uint32_t frameLen, uint16_t rate, int flags)
 {
-	return ieee80211_compute_dur(c->ic_rt, frameLen, rate, flags);
+	return ieee80211_compute_dur(rt, frameLen, rate, flags);
 }
 
 /*

==== //depot/projects/wifi/sys/net80211/ieee80211_phy.h#4 (text+ko) ====

@@ -31,17 +31,19 @@
 #ifdef _KERNEL
 
 struct ieee80211_channel;
+struct ieee80211_rate_table;
 
 /* Initialization functions */
 void		ieee80211_phy_init(void);
-void		ieee80211_set_ratetable(struct ieee80211_channel *);
+const struct ieee80211_rate_table *ieee80211_get_ratetable(
+			const struct ieee80211_channel *);
 
-uint16_t	ieee80211_ack_duration(const struct ieee80211_channel *,
+uint16_t	ieee80211_ack_duration(const struct ieee80211_rate_table *,
 			uint8_t, int);
-uint16_t	ieee80211_compute_duration(const struct ieee80211_channel *,
+uint16_t	ieee80211_compute_duration(const struct ieee80211_rate_table *,
 			uint32_t, uint16_t, int);
 enum ieee80211_phytype ieee80211_rate2phytype(
-			const struct ieee80211_channel *, uint8_t);
+			const struct ieee80211_rate_table *, uint8_t);
 
 #endif	/* _KERNEL */
 



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