Skip to contentSkip to conversation

ath9k: few rate control cleanups

PATCH Superseded Luis R. Rodriguez 4 participants 27 messages Jun 6, 2009 – Jun 9, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover ath9k: few rate control cleanups

Addressed the few comments and tested compile against PID this time and when disabling ath9k debug. This time around we just make the settings for low rate on management frames and no-ack frames a helper and let rate control algorithms use it. When we want to extend these the helper just can be lifted.

Luis R. Rodriguez (15):
ath9k: fix oops by downgrading assert in rc.c
ath9k: cleanup try count for MRR in rate control
ath9k: remove unused min rate calculation code
ath9k: remove unused stepdown when looking for the next rate
ath9k: remove pointless wrapper ath_rc_rate_getidx()
ath9k: rename ath_rc_get_nextlowervalid_txrate()
ath9k: remove unused ath_rc_isvalid_txmask()
ath9k: remove ATH9K_MODE_11B
ath9k: remap ATH9K_MODE_*
ath9k: rename ath_rc_ratefind_ht() to ath_rc_get_highest_rix()
ath9k: remove unnecessary IEEE80211_TX_CTL_NO_ACK checks
mac80211: make minstrel/pid RC use ieee80211_is_data(fc)
iwlwifi: use ieee80211_is_data(fc)
mac80211: add helper for management / no-ack frame rate decision
ath9k: remove rate control wraper

 drivers/net/wireless/ath/ath9k/ath9k.h     |    1 -
 drivers/net/wireless/ath/ath9k/debug.h     |    1 +
 drivers/net/wireless/ath/ath9k/hw.c        |    1 -
 drivers/net/wireless/ath/ath9k/hw.h        |   17 +--
 drivers/net/wireless/ath/ath9k/main.c      |    3 +-
 drivers/net/wireless/ath/ath9k/rc.c        |  194 +++++++++++-----------------
 drivers/net/wireless/iwlwifi/iwl-3945-rs.c |   22 +---
 drivers/net/wireless/iwlwifi/iwl-agn-rs.c  |   12 +--
 drivers/net/wireless/iwlwifi/iwl-sta.c     |    5 +-
 include/net/mac80211.h                     |   23 ++++
 net/mac80211/rate.c                        |   29 ++++
 net/mac80211/rc80211_minstrel.c            |   23 +---
 net/mac80211/rc80211_pid_algo.c            |   12 +--
 13 files changed, 144 insertions(+), 199 deletions(-)
#1 lore raw

PATCH v2 1/15 ath9k: fix oops by downgrading assert in rc.c

Unfortunately locking the driver rate control private area doesn't resolve this issue and in fact causes some issues. The root cause is yet undetermined. For now instead of crashing lets just downgrades the ASSERT() and only show a trace when we are debugging with ATH_DBG_CONFIG enabled. That attempt and its results can be seen here:

http://marc.info/?l=linux-wireless&m=124399166108295&w=1

The ASSERT was happening because the rate control algorithm figures it should find at least one valid dual stream or single stream rate. *Something* is causing us to not find such rate. This happens after association and only when HT is enabled AFAICT. What we are doing by downgrading the assert is informing the driver to use the lowest rate index. When this happens lets disable multi rate retry and only try on the lowest supported rate.

Traces of the ASSERT are available on this thread:

http://marc.info/?l=linux-wireless&m=124277331319024

At least one bug report (as side issue, mind you):

https://bugzilla.redhat.com/show_bug.cgi?id=503285

---
 drivers/net/wireless/ath/ath9k/debug.h |    1 +
 drivers/net/wireless/ath/ath9k/rc.c    |   41 +++++++++++++++++++++++++++----
 2 files changed, 36 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/debug.h +1 -0
index edda15b..9d72bc8 100644
@@ -30,6 +30,7 @@ enum ATH_DEBUG {
 	ATH_DBG_CONFIG		= 0x00000200,
 	ATH_DBG_FATAL		= 0x00000400,
 	ATH_DBG_PS		= 0x00000800,
+	ATH_DBG_RATE		= 0x00001000,
 	ATH_DBG_ANY		= 0xffffffff
 };
 
drivers/net/wireless/ath/ath9k/rc.c +35 -6

71 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#2 lore raw

PATCH v2 2/15 ath9k: cleanup try count for MRR in rate control

In reply to Luis R. Rodriguez

This has no functional change and just cleans up the code to be more legible and removes a useless variable for Multi Rate Retry.

For regular frames we use 2 retries for MRR segments [0-2]. For the last MRR segment [3] we use 4.

MRR[0] = 2
MRR[1] = 2
MRR[2] = 2
MRR[3] = 4

Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/ath9k.h |    1 -
 drivers/net/wireless/ath/ath9k/main.c  |    3 ++-
 drivers/net/wireless/ath/ath9k/rc.c    |   29 ++++++++++++++++++++---------
 3 files changed, 22 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -1
index 9cd523f..ca14642 100644
@@ -169,7 +169,6 @@ void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd,
 #define WME_NUM_TID             16
 #define ATH_TXBUF               512
 #define ATH_TXMAXTRY            13
-#define ATH_11N_TXMAXTRY        10
 #define ATH_MGT_TXMAXTRY        4
 #define WME_BA_BMP_SIZE         64
 #define WME_MAX_BA              WME_BA_BMP_SIZE
drivers/net/wireless/ath/ath9k/main.c +2 -1
index f7baa40..2270166 100644
@@ -1573,7 +1573,8 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 	hw->max_rates = 4;
 	hw->channel_change_time = 5000;
 	hw->max_listen_interval = 10;
-	hw->max_rate_tries = ATH_11N_TXMAXTRY;
+	/* Hardware supports 10 but we use 4 */
+	hw->max_rate_tries = 4;
 	hw->sta_data_size = sizeof(struct ath_node);
 	hw->vif_data_size = sizeof(struct ath_vif);
 
drivers/net/wireless/ath/ath9k/rc.c +20 -9
index 53cb4fb..2040ee8 100644
@@ -861,9 +861,21 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct ieee80211_supported_band *sband = txrc->sband;
 	__le16 fc = hdr->frame_control;
-	u8 try_per_rate = 0, i = 0, rix, nrix;
+	u8 try_per_rate, i = 0, rix, nrix;
 	int is_probe = 0;
 
+	/*
+	 * For Multi Rate Retry we use a different number of
+	 * retry attempt counts. This ends up looking like this:
+	 *
+	 * MRR[0] = 2
+	 * MRR[1] = 2
+	 * MRR[2] = 2
+	 * MRR[3] = 4
+	 *
+	 */
+	try_per_rate = sc->hw->max_rate_tries;
+
 	rate_table = sc->cur_rate_table;
 	rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table, &is_probe);
 	nrix = rix;
@@ -874,7 +886,6 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 		ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
 				       1, nrix, 0);
 
-		try_per_rate = (ATH_11N_TXMAXTRY/4);
 		/* Get the next tried/allowed rate. No RTS for the next series
 		 * after the probe rate
 		 */
@@ -885,7 +896,6 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 
 		tx_info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
 	} else {
-		try_per_rate = (ATH_11N_TXMAXTRY/4);
 		/* Set the choosen rate. No RTS for first series entry. */
 		ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
 				       try_per_rate, nrix, 0);
@@ -893,18 +903,19 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 
 	/* Fill in the other rates for multirate retry */
 	for ( ; i < 4; i++) {
-		u8 try_num;
 		u8 min_rate;
 
-		try_num = ((i + 1) == 4) ?
-			ATH_11N_TXMAXTRY - (try_per_rate * i) : try_per_rate ;
+		/* Use twice the number of tries for the last MRR segment. */
+		if (i + 1 == 4)
+			try_per_rate = 4;
+
 		min_rate = (((i + 1) == 4) && 0);
 
 		nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
 					  rate_table, nrix, 1, min_rate);
 		/* All other rates in the series have RTS enabled */
 		ath_rc_rate_set_series(rate_table, &rates[i], txrc,
-				       try_num, nrix, 1);
+				       try_per_rate, nrix, 1);
 	}
 
 	/*
@@ -1550,7 +1561,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
 	/*
 	 * If underrun error is seen assume it as an excessive retry only
 	 * if prefetch trigger level have reached the max (0x3f for 5416)
-	 * Adjust the long retry as if the frame was tried ATH_11N_TXMAXTRY
+	 * Adjust the long retry as if the frame was tried hw->max_rate_tries
 	 * times. This affects how ratectrl updates PER for the failed rate.
 	 */
 	if (tx_info_priv->tx.ts_flags &
@@ -1565,7 +1576,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
 		tx_status = 1;
 
 	ath_rc_tx_status(sc, ath_rc_priv, tx_info, final_ts_idx, tx_status,
-			 (is_underrun) ? ATH_11N_TXMAXTRY :
+			 (is_underrun) ? sc->hw->max_rate_tries :
 			 tx_info_priv->tx.ts_longretry);
 
 	/* Check if aggregation has to be enabled for this tid */
Signature · 1 line
1.6.0.6
#3 lore raw

PATCH v2 3/15 ath9k: remove unused min rate calculation code

In reply to Luis R. Rodriguez

This is not used, and when we need to get the lowest rate we should simply use mac80211's own rate_lowest_index(sband, sta).

Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c |   33 +++++++++------------------------
 1 files changed, 9 insertions(+), 24 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +9 -24
index 2040ee8..93e480c 100644
@@ -823,28 +823,17 @@ static void ath_rc_rate_set_rtscts(struct ath_softc *sc,
 static u8 ath_rc_rate_getidx(struct ath_softc *sc,
 			     struct ath_rate_priv *ath_rc_priv,
 			     const struct ath_rate_table *rate_table,
-			     u8 rix, u16 stepdown,
-			     u16 min_rate)
+			     u8 rix, u16 stepdown)
 {
 	u32 j;
 	u8 nextindex = 0;
 
-	if (min_rate) {
-		for (j = RATE_TABLE_SIZE; j > 0; j--) {
-			if (ath_rc_get_nextlowervalid_txrate(rate_table,
-						ath_rc_priv, rix, &nextindex))
-				rix = nextindex;
-			else
-				break;
-		}
-	} else {
-		for (j = stepdown; j > 0; j--) {
-			if (ath_rc_get_nextlowervalid_txrate(rate_table,
-						ath_rc_priv, rix, &nextindex))
-				rix = nextindex;
-			else
-				break;
-		}
+	for (j = stepdown; j > 0; j--) {
+		if (ath_rc_get_nextlowervalid_txrate(rate_table,
+					ath_rc_priv, rix, &nextindex))
+			rix = nextindex;
+		else
+			break;
 	}
 	return rix;
 }
@@ -890,7 +879,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 		 * after the probe rate
 		 */
 		nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
-					  rate_table, nrix, 1, 0);
+					  rate_table, nrix, 1);
 		ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
 				       try_per_rate, nrix, 0);
 
@@ -903,16 +892,12 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 
 	/* Fill in the other rates for multirate retry */
 	for ( ; i < 4; i++) {
-		u8 min_rate;
-
 		/* Use twice the number of tries for the last MRR segment. */
 		if (i + 1 == 4)
 			try_per_rate = 4;
 
-		min_rate = (((i + 1) == 4) && 0);
-
 		nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
-					  rate_table, nrix, 1, min_rate);
+					  rate_table, nrix, 1);
 		/* All other rates in the series have RTS enabled */
 		ath_rc_rate_set_series(rate_table, &rates[i], txrc,
 				       try_per_rate, nrix, 1);
Signature · 1 line
1.6.0.6
#4 lore raw

PATCH v2 4/15 ath9k: remove unused stepdown when looking for the next rate

In reply to Luis R. Rodriguez

This is not used, remove this.

Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +8 -13
index 93e480c..4427094 100644
@@ -823,19 +823,14 @@ static void ath_rc_rate_set_rtscts(struct ath_softc *sc,
 static u8 ath_rc_rate_getidx(struct ath_softc *sc,
 			     struct ath_rate_priv *ath_rc_priv,
 			     const struct ath_rate_table *rate_table,
-			     u8 rix, u16 stepdown)
+			     u8 rix)
 {
-	u32 j;
 	u8 nextindex = 0;
-
-	for (j = stepdown; j > 0; j--) {
-		if (ath_rc_get_nextlowervalid_txrate(rate_table,
-					ath_rc_priv, rix, &nextindex))
-			rix = nextindex;
-		else
-			break;
-	}
-	return rix;
+	if (ath_rc_get_nextlowervalid_txrate(rate_table,
+					     ath_rc_priv, rix, &nextindex))
+		return nextindex;
+	else
+		return rix;
 }
 
 static void ath_rc_ratefind(struct ath_softc *sc,
@@ -879,7 +874,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 		 * after the probe rate
 		 */
 		nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
-					  rate_table, nrix, 1);
+					  rate_table, nrix);
 		ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
 				       try_per_rate, nrix, 0);
 
@@ -897,7 +892,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 			try_per_rate = 4;
 
 		nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
-					  rate_table, nrix, 1);
+					  rate_table, nrix);
 		/* All other rates in the series have RTS enabled */
 		ath_rc_rate_set_series(rate_table, &rates[i], txrc,
 				       try_per_rate, nrix, 1);
Signature · 1 line
1.6.0.6
#5 lore raw

PATCH v2 5/15 ath9k: remove pointless wrapper ath_rc_rate_getidx()

In reply to Luis R. Rodriguez

This is just calling another helper, so just use the other helper directly. This should make it clear that when do not find the next rate we stick to the current one.

Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c |   21 ++++-----------------
 1 files changed, 4 insertions(+), 17 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +4 -17
index 4427094..d855572 100644
@@ -820,19 +820,6 @@ static void ath_rc_rate_set_rtscts(struct ath_softc *sc,
 	tx_info->control.rts_cts_rate_idx = cix;
 }
 
-static u8 ath_rc_rate_getidx(struct ath_softc *sc,
-			     struct ath_rate_priv *ath_rc_priv,
-			     const struct ath_rate_table *rate_table,
-			     u8 rix)
-{
-	u8 nextindex = 0;
-	if (ath_rc_get_nextlowervalid_txrate(rate_table,
-					     ath_rc_priv, rix, &nextindex))
-		return nextindex;
-	else
-		return rix;
-}
-
 static void ath_rc_ratefind(struct ath_softc *sc,
 			    struct ath_rate_priv *ath_rc_priv,
 			    struct ieee80211_tx_rate_control *txrc,
@@ -873,8 +860,8 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 		/* Get the next tried/allowed rate. No RTS for the next series
 		 * after the probe rate
 		 */
-		nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
-					  rate_table, nrix);
+		ath_rc_get_nextlowervalid_txrate(rate_table, ath_rc_priv,
+						 rix, &nrix);
 		ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
 				       try_per_rate, nrix, 0);
 
@@ -891,8 +878,8 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 		if (i + 1 == 4)
 			try_per_rate = 4;
 
-		nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
-					  rate_table, nrix);
+		ath_rc_get_nextlowervalid_txrate(rate_table, ath_rc_priv,
+						 rix, &nrix);
 		/* All other rates in the series have RTS enabled */
 		ath_rc_rate_set_series(rate_table, &rates[i], txrc,
 				       try_per_rate, nrix, 1);
Signature · 1 line
1.6.0.6
#6 lore raw

PATCH v2 6/15 ath9k: rename ath_rc_get_nextlowervalid_txrate()

In reply to Luis R. Rodriguez

What this does is get us our next lower rate so call it that, ath_rc_get_lower_rix().

Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +7 -9
index d855572..2c57944 100644
@@ -501,9 +501,9 @@ static int ath_rc_valid_phyrate(u32 phy, u32 capflag, int ignore_cw)
 }
 
 static inline int
-ath_rc_get_nextlowervalid_txrate(const struct ath_rate_table *rate_table,
-				 struct ath_rate_priv *ath_rc_priv,
-				 u8 cur_valid_txrate, u8 *next_idx)
+ath_rc_get_lower_rix(const struct ath_rate_table *rate_table,
+		     struct ath_rate_priv *ath_rc_priv,
+		     u8 cur_valid_txrate, u8 *next_idx)
 {
 	int8_t i;
 
@@ -860,8 +860,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 		/* Get the next tried/allowed rate. No RTS for the next series
 		 * after the probe rate
 		 */
-		ath_rc_get_nextlowervalid_txrate(rate_table, ath_rc_priv,
-						 rix, &nrix);
+		ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &nrix);
 		ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
 				       try_per_rate, nrix, 0);
 
@@ -878,8 +877,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 		if (i + 1 == 4)
 			try_per_rate = 4;
 
-		ath_rc_get_nextlowervalid_txrate(rate_table, ath_rc_priv,
-						 rix, &nrix);
+		ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &nrix);
 		/* All other rates in the series have RTS enabled */
 		ath_rc_rate_set_series(rate_table, &rates[i], txrc,
 				       try_per_rate, nrix, 1);
@@ -1177,8 +1175,8 @@ static void ath_rc_update_ht(struct ath_softc *sc,
 	if (ath_rc_priv->state[tx_rate].per >= 55 && tx_rate > 0 &&
 	    rate_table->info[tx_rate].ratekbps <=
 	    rate_table->info[ath_rc_priv->rate_max_phy].ratekbps) {
-		ath_rc_get_nextlowervalid_txrate(rate_table, ath_rc_priv,
-				 (u8)tx_rate, &ath_rc_priv->rate_max_phy);
+		ath_rc_get_lower_rix(rate_table, ath_rc_priv,
+				     (u8)tx_rate, &ath_rc_priv->rate_max_phy);
 
 		/* Don't probe for a little while. */
 		ath_rc_priv->probe_time = now_msec;
Signature · 1 line
1.6.0.6
#7 lore raw

PATCH v2 7/15 ath9k: remove unused ath_rc_isvalid_txmask()

In reply to Luis R. Rodriguez
Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +0 -7
index 2c57944..01586d2 100644
@@ -454,13 +454,6 @@ static inline void ath_rc_set_valid_txmask(struct ath_rate_priv *ath_rc_priv,
 	ath_rc_priv->valid_rate_index[index] = valid_tx_rate ? 1 : 0;
 }
 
-static inline int ath_rc_isvalid_txmask(struct ath_rate_priv *ath_rc_priv,
-					u8 index)
-{
-	ASSERT(index <= ath_rc_priv->rate_table_size);
-	return ath_rc_priv->valid_rate_index[index];
-}
-
 static inline
 int ath_rc_get_nextvalid_txrate(const struct ath_rate_table *rate_table,
 				struct ath_rate_priv *ath_rc_priv,
Signature · 1 line
1.6.0.6
#8 lore raw

PATCH v2 8/15 ath9k: remove ATH9K_MODE_11B

In reply to Luis R. Rodriguez

This saves us 2733 bytes.

   text    data     bss     dec     hex filename
 252265    3628    1584  257477   3edc5 ath9k-has-b-rate.ko
 249905    3628    1584  255117   3e48d ath9k.ko
Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/hw.c |    1 -
 drivers/net/wireless/ath/ath9k/hw.h |    1 -
 drivers/net/wireless/ath/ath9k/rc.c |   23 -----------------------
 3 files changed, 0 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +0 -1
index 1579c94..de2c000 100644
@@ -3294,7 +3294,6 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah)
 	}
 
 	if (eeval & AR5416_OPFLAGS_11G) {
-		set_bit(ATH9K_MODE_11B, pCap->wireless_modes);
 		set_bit(ATH9K_MODE_11G, pCap->wireless_modes);
 		if (ah->config.ht_enable) {
 			if (!(eeval & AR5416_OPFLAGS_N_2G_HT20))
drivers/net/wireless/ath/ath9k/hw.h +0 -1
index dd8508e..73d859e 100644
@@ -113,7 +113,6 @@
 
 enum wireless_mode {
 	ATH9K_MODE_11A = 0,
-	ATH9K_MODE_11B = 2,
 	ATH9K_MODE_11G = 3,
 	ATH9K_MODE_11NA_HT20 = 6,
 	ATH9K_MODE_11NG_HT20 = 7,
drivers/net/wireless/ath/ath9k/rc.c +0 -23
index 01586d2..980040b 100644
@@ -380,27 +380,6 @@ static const struct ath_rate_table ar5416_11g_ratetable = {
 	0,   /* Phy rates allowed initially */
 };
 
-static const struct ath_rate_table ar5416_11b_ratetable = {
-	4,
-	{
-		{ VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */
-			900, 0x1b,  0x00, (0x80|2),
-			0, 0, 1, 0, 0 },
-		{ VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */
-			1800, 0x1a, 0x04, (0x80|4),
-			1, 1, 1, 1, 0 },
-		{ VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */
-			4300, 0x19, 0x04, (0x80|11),
-			1, 2, 2, 2, 0 },
-		{ VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */
-			7100, 0x18, 0x04, (0x80|22),
-			1, 4, 100, 3, 0 },
-	},
-	100, /* probe interval */
-	100, /* rssi reduce interval */
-	0,   /* Phy rates allowed initially */
-};
-
 static inline int8_t median(int8_t a, int8_t b, int8_t c)
 {
 	if (a >= b) {
@@ -1723,8 +1702,6 @@ static struct rate_control_ops ath_rate_ops = {
 
 void ath_rate_attach(struct ath_softc *sc)
 {
-	sc->hw_rate_table[ATH9K_MODE_11B] =
-		&ar5416_11b_ratetable;
 	sc->hw_rate_table[ATH9K_MODE_11A] =
 		&ar5416_11a_ratetable;
 	sc->hw_rate_table[ATH9K_MODE_11G] =
Signature · 1 line
1.6.0.6
#9 lore raw

PATCH v2 8/15 ath9k: remove ATH9K_MODE_11B

Quoted 73 lines · Luis R. Rodriguez

This saves us 2733 bytes.

   text    data     bss     dec     hex filename
 252265    3628    1584  257477   3edc5 ath9k-has-b-rate.ko
 249905    3628    1584  255117   3e48d ath9k.ko
Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/hw.c |    1 -
 drivers/net/wireless/ath/ath9k/hw.h |    1 -
 drivers/net/wireless/ath/ath9k/rc.c |   23 -----------------------
 3 files changed, 0 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +0 -1
index 1579c94..de2c000 100644
@@ -3294,7 +3294,6 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah)
 	}
 
 	if (eeval & AR5416_OPFLAGS_11G) {
-		set_bit(ATH9K_MODE_11B, pCap->wireless_modes);
 		set_bit(ATH9K_MODE_11G, pCap->wireless_modes);
 		if (ah->config.ht_enable) {
 			if (!(eeval & AR5416_OPFLAGS_N_2G_HT20))
drivers/net/wireless/ath/ath9k/hw.h +0 -1
index dd8508e..73d859e 100644
@@ -113,7 +113,6 @@
 
 enum wireless_mode {
 	ATH9K_MODE_11A = 0,
-	ATH9K_MODE_11B = 2,
 	ATH9K_MODE_11G = 3,
 	ATH9K_MODE_11NA_HT20 = 6,
 	ATH9K_MODE_11NG_HT20 = 7,
drivers/net/wireless/ath/ath9k/rc.c +0 -21
index 01586d2..980040b 100644
@@ -380,27 +380,6 @@ static const struct ath_rate_table ar5416_11g_ratetable = {
 	0,   /* Phy rates allowed initially */
 };
 
-static const struct ath_rate_table ar5416_11b_ratetable = {
-	4,
-	{
-		{ VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */
-			900, 0x1b,  0x00, (0x80|2),
-			0, 0, 1, 0, 0 },
-		{ VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */
-			1800, 0x1a, 0x04, (0x80|4),
-			1, 1, 1, 1, 0 },
-		{ VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */
-			4300, 0x19, 0x04, (0x80|11),
-			1, 2, 2, 2, 0 },
-		{ VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */
-			7100, 0x18, 0x04, (0x80|22),
-			1, 4, 100, 3, 0 },
-	},
-	100, /* probe interval */
-	100, /* rssi reduce interval */
-	0,   /* Phy rates allowed initially */
-};
-
 static inline int8_t median(int8_t a, int8_t b, int8_t c)
 {
 	if (a >= b) {

drivers/net/wireless/ath/ath9k/rc.c static struct rate_control_ops ath_rate_ops = { · line 1707

Quoted 8 lines
drivers/net/wireless/ath/ath9k/rc.c +0 -2
@@ -1723,8 +1702,6 @@ static struct rate_control_ops ath_rate_ops = {
 
 void ath_rate_attach(struct ath_softc *sc)
 {
-	sc->hw_rate_table[ATH9K_MODE_11B] =
-		&ar5416_11b_ratetable;
 	sc->hw_rate_table[ATH9K_MODE_11A] =
 		&ar5416_11a_ratetable;
 	sc->hw_rate_table[ATH9K_MODE_11G] =

Does this mean that 802.11b will not work anymore? A lot of legacy equipment that only supports B is still arround.

--
Karl

#10 lore raw

PATCH v2 8/15 ath9k: remove ATH9K_MODE_11B

Quoted 74 lines · Karl Hiramoto
Quoted 73 lines · Luis R. Rodriguez

This saves us 2733 bytes.

   text    data     bss     dec     hex filename
 252265    3628    1584  257477   3edc5 ath9k-has-b-rate.ko
 249905    3628    1584  255117   3e48d ath9k.ko
Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/hw.c |    1 -
 drivers/net/wireless/ath/ath9k/hw.h |    1 -
 drivers/net/wireless/ath/ath9k/rc.c |   23 -----------------------
 3 files changed, 0 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +0 -1
index 1579c94..de2c000 100644
@@ -3294,7 +3294,6 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah)
      }
 
      if (eeval & AR5416_OPFLAGS_11G) {
-             set_bit(ATH9K_MODE_11B, pCap->wireless_modes);
              set_bit(ATH9K_MODE_11G, pCap->wireless_modes);
              if (ah->config.ht_enable) {
                      if (!(eeval & AR5416_OPFLAGS_N_2G_HT20))
drivers/net/wireless/ath/ath9k/hw.h +0 -1
index dd8508e..73d859e 100644
@@ -113,7 +113,6 @@
 
 enum wireless_mode {
      ATH9K_MODE_11A = 0,
-     ATH9K_MODE_11B = 2,
      ATH9K_MODE_11G = 3,
      ATH9K_MODE_11NA_HT20 = 6,
      ATH9K_MODE_11NG_HT20 = 7,
drivers/net/wireless/ath/ath9k/rc.c +0 -21
index 01586d2..980040b 100644
@@ -380,27 +380,6 @@ static const struct ath_rate_table ar5416_11g_ratetable = {
      0,   /* Phy rates allowed initially */
 };
 
-static const struct ath_rate_table ar5416_11b_ratetable = {
-     4,
-     {
-             { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */
-                     900, 0x1b,  0x00, (0x80|2),
-                     0, 0, 1, 0, 0 },
-             { VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */
-                     1800, 0x1a, 0x04, (0x80|4),
-                     1, 1, 1, 1, 0 },
-             { VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */
-                     4300, 0x19, 0x04, (0x80|11),
-                     1, 2, 2, 2, 0 },
-             { VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */
-                     7100, 0x18, 0x04, (0x80|22),
-                     1, 4, 100, 3, 0 },
-     },
-     100, /* probe interval */
-     100, /* rssi reduce interval */
-     0,   /* Phy rates allowed initially */
-};
-
 static inline int8_t median(int8_t a, int8_t b, int8_t c)
 {
      if (a >= b) {
@@ -1723,8 +1702,6 @@ static struct rate_control_ops ath_rate_ops = {
 
Quoted 12 lines

drivers/net/wireless/ath/ath9k/rc.c static struct rate_control_ops ath_rate_ops = { · line 1707

Quoted 8 lines
drivers/net/wireless/ath/ath9k/rc.c +0 -2
 void ath_rate_attach(struct ath_softc *sc)
 {
-     sc->hw_rate_table[ATH9K_MODE_11B] =
-             &ar5416_11b_ratetable;
      sc->hw_rate_table[ATH9K_MODE_11A] =
              &ar5416_11a_ratetable;
      sc->hw_rate_table[ATH9K_MODE_11G] =

Does this mean that 802.11b will not work anymore? A lot of legacy equipment that only supports B is still arround.

11b rates are in the 11g rate table. AFAICT this was just legacy code which was present due to support of old 11b only cards.

Luis

#11 lore raw

PATCH v2 9/15 ath9k: remap ATH9K_MODE_*

In reply to Luis R. Rodriguez

There are a lot of gaps here.

Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/hw.h |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath9k/hw.h +8 -8
index 73d859e..08eb5ae 100644
@@ -113,14 +113,14 @@
 
 enum wireless_mode {
 	ATH9K_MODE_11A = 0,
-	ATH9K_MODE_11G = 3,
-	ATH9K_MODE_11NA_HT20 = 6,
-	ATH9K_MODE_11NG_HT20 = 7,
-	ATH9K_MODE_11NA_HT40PLUS = 8,
-	ATH9K_MODE_11NA_HT40MINUS = 9,
-	ATH9K_MODE_11NG_HT40PLUS = 10,
-	ATH9K_MODE_11NG_HT40MINUS = 11,
-	ATH9K_MODE_MAX
+	ATH9K_MODE_11G,
+	ATH9K_MODE_11NA_HT20,
+	ATH9K_MODE_11NG_HT20,
+	ATH9K_MODE_11NA_HT40PLUS,
+	ATH9K_MODE_11NA_HT40MINUS,
+	ATH9K_MODE_11NG_HT40PLUS,
+	ATH9K_MODE_11NG_HT40MINUS,
+	ATH9K_MODE_MAX,
 };
 
 enum ath9k_hw_caps {
Signature · 1 line
1.6.0.6
#12 lore raw

PATCH v2 10/15 ath9k: rename ath_rc_ratefind_ht() to ath_rc_get_highest_rix()

In reply to Luis R. Rodriguez

The purpose is to find the highest rate we can use.

Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +7 -6
index 980040b..9907f2f 100644
@@ -601,10 +601,11 @@ static u8 ath_rc_setvalid_htrates(struct ath_rate_priv *ath_rc_priv,
 	return hi;
 }
 
-static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
-			     struct ath_rate_priv *ath_rc_priv,
-			     const struct ath_rate_table *rate_table,
-			     int *is_probing)
+/* Finds the highest rate index we can use */
+static u8 ath_rc_get_highest_rix(struct ath_softc *sc,
+			         struct ath_rate_priv *ath_rc_priv,
+				 const struct ath_rate_table *rate_table,
+				 int *is_probing)
 {
 	u32 dt, best_thruput, this_thruput, now_msec;
 	u8 rate, next_rate, best_rate, maxindex, minindex;
@@ -820,7 +821,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 	try_per_rate = sc->hw->max_rate_tries;
 
 	rate_table = sc->cur_rate_table;
-	rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table, &is_probe);
+	rix = ath_rc_get_highest_rix(sc, ath_rc_priv, rate_table, &is_probe);
 	nrix = rix;
 
 	if (is_probe) {
@@ -909,7 +910,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 			"disabling MRR\n");
 		rates[0].idx = rate_lowest_index(sband, sta);
 		rates[0].count = 4;
-		/* Disable MRR when ath_rc_ratefind_ht() found rate 0 */
+		/* Disable MRR when ath_rc_get_highest_rix() found rate 0 */
 		rates[1].idx = -1;
 	}
 }
Signature · 1 line
1.6.0.6
#13 lore raw

PATCH v2 11/15 ath9k: remove unnecessary IEEE80211_TX_CTL_NO_ACK checks

In reply to Luis R. Rodriguez

We check for this condition early on in our mac80211 get_rate() callback ath_get_rate(), so remove this check later down the path.

Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +2 -4
index 9907f2f..d8d2152 100644
@@ -783,7 +783,6 @@ static void ath_rc_rate_set_rtscts(struct ath_softc *sc,
 	 * just CTS.  Note that this is only done for OFDM/HT unicast frames.
 	 */
 	if ((sc->sc_flags & SC_OP_PROTECT_ENABLE) &&
-	    !(tx_info->flags & IEEE80211_TX_CTL_NO_ACK) &&
 	    (rate_table->info[rix].phy == WLAN_RC_PHY_OFDM ||
 	     WLAN_RC_PHY_HT(rate_table->info[rix].phy))) {
 		rates[0].flags |= IEEE80211_TX_RC_USE_CTS_PROTECT;
@@ -890,9 +889,8 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 	 *
 	 * FIXME: Fix duration
 	 */
-	if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK) &&
-	    (ieee80211_has_morefrags(fc) ||
-	     (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG))) {
+	if (ieee80211_has_morefrags(fc) ||
+	    (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG)) {
 		rates[1].count = rates[2].count = rates[3].count = 0;
 		rates[1].idx = rates[2].idx = rates[3].idx = 0;
 		rates[0].count = ATH_TXMAXTRY;
Signature · 1 line
1.6.0.6
#14 lore raw

PATCH v2 11/15 ath9k: remove unnecessary IEEE80211_TX_CTL_NO_ACK checks

Quoted 37 lines · Luis R. Rodriguez

We check for this condition early on in our mac80211 get_rate() callback ath_get_rate(), so remove this check later down the path.

Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>

---
?drivers/net/wireless/ath/ath9k/rc.c | ? ?6 ++---- ?1 files changed, 2 insertions(+), 4 deletions(-)

drivers/net/wireless/ath/ath9k/rc.c +0 -0
index 9907f2f..d8d2152 100644
@@ -783,7 +783,6 @@ static void ath_rc_rate_set_rtscts(struct ath_softc *sc,

? ? ? ? * just CTS. ?Note that this is only done for OFDM/HT unicast frames. ? ? ? ? */
? ? ? ?if ((sc->sc_flags & SC_OP_PROTECT_ENABLE) &&
- ? ? ? ? ? !(tx_info->flags & IEEE80211_TX_CTL_NO_ACK) &&
? ? ? ? ? ?(rate_table->info[rix].phy == WLAN_RC_PHY_OFDM ||
? ? ? ? ? ? WLAN_RC_PHY_HT(rate_table->info[rix].phy))) {
? ? ? ? ? ? ? ?rates[0].flags |= IEEE80211_TX_RC_USE_CTS_PROTECT;

drivers/net/wireless/ath/ath9k/rc.c +0 -0
@@ -890,9 +889,8 @@ static void ath_rc_ratefind(struct ath_softc *sc,

? ? ? ? *
? ? ? ? * FIXME: Fix duration
? ? ? ? */
- ? ? ? if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK) &&
- ? ? ? ? ? (ieee80211_has_morefrags(fc) ||
- ? ? ? ? ? ?(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG))) {
+ ? ? ? if (ieee80211_has_morefrags(fc) ||
+ ? ? ? ? ? (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG)) { ? ? ? ? ? ? ? ?rates[1].count = rates[2].count = rates[3].count = 0; ? ? ? ? ? ? ? ?rates[1].idx = rates[2].idx = rates[3].idx = 0; ? ? ? ? ? ? ? ?rates[0].count = ATH_TXMAXTRY;
--
1.6.0.6

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

Is this a side effect of my NO_ACK retry count patchset accepted earlier?

Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
#15 lore raw

PATCH v2 11/15 ath9k: remove unnecessary IEEE80211_TX_CTL_NO_ACK checks

Quoted 38 lines · Gábor Stefanik
Quoted 37 lines · Luis R. Rodriguez

We check for this condition early on in our mac80211 get_rate() callback ath_get_rate(), so remove this check later down the path.

Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +2 -5
index 9907f2f..d8d2152 100644
@@ -783,7 +783,6 @@ static void ath_rc_rate_set_rtscts(struct ath_softc *sc,
        * just CTS.  Note that this is only done for OFDM/HT unicast frames.
        */
       if ((sc->sc_flags & SC_OP_PROTECT_ENABLE) &&
-           !(tx_info->flags & IEEE80211_TX_CTL_NO_ACK) &&
           (rate_table->info[rix].phy == WLAN_RC_PHY_OFDM ||
            WLAN_RC_PHY_HT(rate_table->info[rix].phy))) {
               rates[0].flags |= IEEE80211_TX_RC_USE_CTS_PROTECT;
@@ -890,9 +889,8 @@ static void ath_rc_ratefind(struct ath_softc *sc,
        *
        * FIXME: Fix duration
        */
-       if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK) &&
-           (ieee80211_has_morefrags(fc) ||
-            (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG))) {
+       if (ieee80211_has_morefrags(fc) ||
+           (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG)) {
               rates[1].count = rates[2].count = rates[3].count = 0;
               rates[1].idx = rates[2].idx = rates[3].idx = 0;
               rates[0].count = ATH_TXMAXTRY;
--

1.6.0.6

Quoted 7 lines
Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Is this a side effect of my NO_ACK retry count patchset accepted earlier?

Yes.

Luis

#16 lore raw

PATCH v2 12/15 mac80211: make minstrel/pid RC use ieee80211_is_data(fc)

In reply to Luis R. Rodriguez
Cc Felix Fietkau <[email protected]>
Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 net/mac80211/rc80211_minstrel.c |    7 +++----
 net/mac80211/rc80211_pid_algo.c |    7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)
net/mac80211/rc80211_minstrel.c +3 -4
index 0a11515..0e1db92 100644
@@ -75,12 +75,11 @@ use_low_rate(struct sk_buff *skb)
 {
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-	u16 fc;
+	__le16 fc;
 
-	fc = le16_to_cpu(hdr->frame_control);
+	fc = hdr->frame_control;
 
-	return ((info->flags & IEEE80211_TX_CTL_NO_ACK) ||
-		(fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA);
+	return ((info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc));
 }
 
 
net/mac80211/rc80211_pid_algo.c +3 -4
index a0bef76..5496077 100644
@@ -280,7 +280,7 @@ rate_control_pid_get_rate(void *priv, struct ieee80211_sta *sta,
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct rc_pid_sta_info *spinfo = priv_sta;
 	int rateidx;
-	u16 fc;
+	__le16 fc;
 
 	if (txrc->rts)
 		info->control.rates[0].count =
@@ -290,9 +290,8 @@ rate_control_pid_get_rate(void *priv, struct ieee80211_sta *sta,
 			txrc->hw->conf.short_frame_max_tx_count;
 
 	/* Send management frames and NO_ACK data using lowest rate. */
-	fc = le16_to_cpu(hdr->frame_control);
-	if (!sta || !spinfo ||
-	    (fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
+	fc = hdr->frame_control;
+	if (!sta || !spinfo || !ieee80211_is_data(fc) ||
 	    info->flags & IEEE80211_TX_CTL_NO_ACK) {
 		info->control.rates[0].idx = rate_lowest_index(sband, sta);
 		if (info->flags & IEEE80211_TX_CTL_NO_ACK)
Signature · 1 line
1.6.0.6
#17 lore raw

PATCH v2 13/15 iwlwifi: use ieee80211_is_data(fc)

In reply to Luis R. Rodriguez
Cc Zhu Yi <[email protected]>
Cc Reinette Chatre <[email protected]>
Cc ipw3945-devel at lists.sourceforge.net
---
 drivers/net/wireless/iwlwifi/iwl-3945-rs.c |    7 +++----
 drivers/net/wireless/iwlwifi/iwl-sta.c     |    5 ++---
 2 files changed, 5 insertions(+), 7 deletions(-)
drivers/net/wireless/iwlwifi/iwl-3945-rs.c +3 -4
index 5eb538d..bd2f709 100644
@@ -673,7 +673,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 	s8 scale_action = 0;
 	unsigned long flags;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
-	u16 fc;
+	__le16 fc;
 	u16 rate_mask = 0;
 	s8 max_rate_idx = -1;
 	struct iwl_priv *priv = (struct iwl_priv *)priv_r;
@@ -685,9 +685,8 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 		rate_mask = sta->supp_rates[sband->band];
 
 	/* Send management frames and NO_ACK data using lowest rate. */
-	fc = le16_to_cpu(hdr->frame_control);
-	if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
-	    info->flags & IEEE80211_TX_CTL_NO_ACK ||
+	fc = hdr->frame_control;
+	if (!ieee80211_is_data(fc) || info->flags & IEEE80211_TX_CTL_NO_ACK ||
 	    !sta || !priv_sta) {
 		IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
 		if (!rate_mask)
drivers/net/wireless/iwlwifi/iwl-sta.c +2 -3
index 2addf73..afa1633 100644
@@ -1044,11 +1044,10 @@ EXPORT_SYMBOL(iwl_rxon_add_station);
 int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
 {
 	int sta_id;
-	u16 fc = le16_to_cpu(hdr->frame_control);
+	__le16 fc = hdr->frame_control;
 
 	/* If this frame is broadcast or management, use broadcast station id */
-	if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) ||
-	    is_multicast_ether_addr(hdr->addr1))
+	if (!ieee80211_is_data(fc) ||  is_multicast_ether_addr(hdr->addr1))
 		return priv->hw_params.bcast_sta_id;
 
 	switch (priv->iw_mode) {
Signature · 1 line
1.6.0.6
#18 lore raw

PATCH v2 13/15 iwlwifi: use ieee80211_is_data(fc)

Hi Luis,

Quoted 42 lines · Luis R. Rodriguez
---
 drivers/net/wireless/iwlwifi/iwl-3945-rs.c |    7 +++----
 drivers/net/wireless/iwlwifi/iwl-sta.c     |    5 ++---
 2 files changed, 5 insertions(+), 7 deletions(-)
drivers/net/wireless/iwlwifi/iwl-3945-rs.c +3 -4
index 5eb538d..bd2f709 100644
@@ -673,7 +673,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 	s8 scale_action = 0;
 	unsigned long flags;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
-	u16 fc;
+	__le16 fc;
 	u16 rate_mask = 0;
 	s8 max_rate_idx = -1;
 	struct iwl_priv *priv = (struct iwl_priv *)priv_r;
@@ -685,9 +685,8 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 		rate_mask = sta->supp_rates[sband->band];
 
 	/* Send management frames and NO_ACK data using lowest rate. */
-	fc = le16_to_cpu(hdr->frame_control);
-	if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
-	    info->flags & IEEE80211_TX_CTL_NO_ACK ||
+	fc = hdr->frame_control;
+	if (!ieee80211_is_data(fc) || info->flags & IEEE80211_TX_CTL_NO_ACK ||
 	    !sta || !priv_sta) {
 		IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
 		if (!rate_mask)
drivers/net/wireless/iwlwifi/iwl-sta.c +0 -0
index 2addf73..afa1633 100644
@@ -1044,11 +1044,10 @@ EXPORT_SYMBOL(iwl_rxon_add_station);
 int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
 {
 	int sta_id;

drivers/net/wireless/iwlwifi/iwl-sta.c EXPORT_SYMBOL(iwl_rxon_add_station); · line 1053

Quoted 10 lines
drivers/net/wireless/iwlwifi/iwl-sta.c +2 -3
-	u16 fc = le16_to_cpu(hdr->frame_control);
+	__le16 fc = hdr->frame_control;
 
 	/* If this frame is broadcast or management, use broadcast station id */
-	if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) ||
-	    is_multicast_ether_addr(hdr->addr1))
+	if (!ieee80211_is_data(fc) ||  is_multicast_ether_addr(hdr->addr1))
 		return priv->hw_params.bcast_sta_id;
 
 	switch (priv->iw_mode) {

Thank you

Reinette

#19 lore raw

PATCH v2 13/15 iwlwifi: use ieee80211_is_data(fc)

In reply to Luis R. Rodriguez
Quoted 25 lines · Luis R. Rodriguez
Cc Zhu Yi <[email protected]>
Cc Reinette Chatre <[email protected]>
Cc ipw3945-devel at lists.sourceforge.net

---
?drivers/net/wireless/iwlwifi/iwl-3945-rs.c | ? ?7 +++---- ?drivers/net/wireless/iwlwifi/iwl-sta.c ? ? | ? ?5 ++--- ?2 files changed, 5 insertions(+), 7 deletions(-)

drivers/net/wireless/iwlwifi/iwl-3945-rs.c +1 -1
index 5eb538d..bd2f709 100644
@@ -673,7 +673,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 ? ? ? ?s8 scale_action = 0;
 ? ? ? ?unsigned long flags;
 ? ? ? ?struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- ? ? ? u16 fc;
+ ? ? ? __le16 fc;
 ? ? ? ?u16 rate_mask = 0;
 ? ? ? ?s8 max_rate_idx = -1;
 ? ? ? ?struct iwl_priv *priv = (struct iwl_priv *)priv_r;
@@ -685,9 +685,8 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 ? ? ? ? ? ? ? ?rate_mask = sta->supp_rates[sband->band];
 
Quoted 6 lines

? ? ? ?/* Send management frames and NO_ACK data using lowest rate. */
- ? ? ? fc = le16_to_cpu(hdr->frame_control);
- ? ? ? if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
- ? ? ? ? ? info->flags & IEEE80211_TX_CTL_NO_ACK ||
+ ? ? ? fc = hdr->frame_control;
+ ? ? ? if (!ieee80211_is_data(fc) || info->flags & IEEE80211_TX_CTL_NO_ACK ||

iwl-agn-rs.c also needs this change I think...

Quoted 29 lines

? ? ? ? ? ?!sta || !priv_sta) {
? ? ? ? ? ? ? ?IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n"); ? ? ? ? ? ? ? ?if (!rate_mask)

drivers/net/wireless/iwlwifi/iwl-sta.c +1 -1
index 2addf73..afa1633 100644
@@ -1044,11 +1044,10 @@ EXPORT_SYMBOL(iwl_rxon_add_station);
 ?int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
 ?{
 ? ? ? ?int sta_id;
- ? ? ? u16 fc = le16_to_cpu(hdr->frame_control);
+ ? ? ? __le16 fc = hdr->frame_control;
 

? ? ? ?/* If this frame is broadcast or management, use broadcast station id */
- ? ? ? if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) ||
- ? ? ? ? ? is_multicast_ether_addr(hdr->addr1))
+ ? ? ? if (!ieee80211_is_data(fc) || ?is_multicast_ether_addr(hdr->addr1)) ? ? ? ? ? ? ? ?return priv->hw_params.bcast_sta_id;

? ? ? ?switch (priv->iw_mode) {
--
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
#20 lore raw

PATCH v2 13/15 iwlwifi: use ieee80211_is_data(fc)

2009/6/8 G?bor Stefanik <[email protected]>:

Quoted 26 lines · Luis R. Rodriguez
Quoted 25 lines
Cc Zhu Yi <[email protected]>
Cc Reinette Chatre <[email protected]>
Cc ipw3945-devel at lists.sourceforge.net

---
?drivers/net/wireless/iwlwifi/iwl-3945-rs.c | ? ?7 +++---- ?drivers/net/wireless/iwlwifi/iwl-sta.c ? ? | ? ?5 ++--- ?2 files changed, 5 insertions(+), 7 deletions(-)

drivers/net/wireless/iwlwifi/iwl-3945-rs.c +1 -1
index 5eb538d..bd2f709 100644
@@ -673,7 +673,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 ? ? ? ?s8 scale_action = 0;
 ? ? ? ?unsigned long flags;
 ? ? ? ?struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- ? ? ? u16 fc;
+ ? ? ? __le16 fc;
 ? ? ? ?u16 rate_mask = 0;
 ? ? ? ?s8 max_rate_idx = -1;
 ? ? ? ?struct iwl_priv *priv = (struct iwl_priv *)priv_r;
@@ -685,9 +685,8 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 ? ? ? ? ? ? ? ?rate_mask = sta->supp_rates[sband->band];
 
Quoted 8 lines
Quoted 6 lines

? ? ? ?/* Send management frames and NO_ACK data using lowest rate. */
- ? ? ? fc = le16_to_cpu(hdr->frame_control);
- ? ? ? if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
- ? ? ? ? ? info->flags & IEEE80211_TX_CTL_NO_ACK ||
+ ? ? ? fc = hdr->frame_control;
+ ? ? ? if (!ieee80211_is_data(fc) || info->flags & IEEE80211_TX_CTL_NO_ACK ||

iwl-agn-rs.c also needs this change I think...

You are right, but in my later patch "mac80211: add helper for management / no-ack frame rate decision" we just nuke this in favor for the helper. The goal of this intermediary patch was just to make the changes for that other patch easier to read.

Please let me know if such a change is required in this intermediary patch. It gets nuked in the end.

Luis

#21 lore raw

PATCH v2 13/15 iwlwifi: use ieee80211_is_data(fc)

2009/6/8 Luis R. Rodriguez <[email protected]>:

Quoted 36 lines

2009/6/8 G?bor Stefanik <[email protected]>:

Quoted 26 lines · Luis R. Rodriguez
Quoted 25 lines
Cc Zhu Yi <[email protected]>
Cc Reinette Chatre <[email protected]>
Cc ipw3945-devel at lists.sourceforge.net

---
?drivers/net/wireless/iwlwifi/iwl-3945-rs.c | ? ?7 +++---- ?drivers/net/wireless/iwlwifi/iwl-sta.c ? ? | ? ?5 ++--- ?2 files changed, 5 insertions(+), 7 deletions(-)

drivers/net/wireless/iwlwifi/iwl-3945-rs.c +1 -1
index 5eb538d..bd2f709 100644
@@ -673,7 +673,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 ? ? ? ?s8 scale_action = 0;
 ? ? ? ?unsigned long flags;
 ? ? ? ?struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- ? ? ? u16 fc;
+ ? ? ? __le16 fc;
 ? ? ? ?u16 rate_mask = 0;
 ? ? ? ?s8 max_rate_idx = -1;
 ? ? ? ?struct iwl_priv *priv = (struct iwl_priv *)priv_r;
@@ -685,9 +685,8 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 ? ? ? ? ? ? ? ?rate_mask = sta->supp_rates[sband->band];
 
Quoted 8 lines
Quoted 6 lines

? ? ? ?/* Send management frames and NO_ACK data using lowest rate. */
- ? ? ? fc = le16_to_cpu(hdr->frame_control);
- ? ? ? if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
- ? ? ? ? ? info->flags & IEEE80211_TX_CTL_NO_ACK ||
+ ? ? ? fc = hdr->frame_control;
+ ? ? ? if (!ieee80211_is_data(fc) || info->flags & IEEE80211_TX_CTL_NO_ACK ||

iwl-agn-rs.c also needs this change I think...

Quoted 7 lines

You are right, but in my later patch "mac80211: add helper for management / no-ack frame rate decision" we just nuke this in favor for the helper. The goal of this intermediary patch was just to make the changes for that other patch easier to read.

Please let me know if such a change is required in this intermediary patch. It gets nuked in the end.

Oh I just checked and actually it was that iwl-agn-rs.c already used it.

Luis

#22 lore raw

PATCH v2 14/15 mac80211: add helper for management / no-ack frame rate decision

In reply to Luis R. Rodriguez

All current rate control algorithms agree to send management and no-ack frames at the lowest rate. They also agree to do this when sta and the private rate control data is NULL. We add a hlper to mac80211 for this and simplify the rate control algorithm code.

Developers wishing to make enhancements to rate control algorithms are for broadcast/multicast can opt to not use this in their gate_rate() mac80211 callback.

Cc Zhu Yi <[email protected]>
Cc Reinette Chatre <[email protected]>
Cc ipw3945-devel at lists.sourceforge.net
Cc Gabor Juhos <[email protected]>
Cc Felix Fietkau <[email protected]>
Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c        |   14 +------------
 drivers/net/wireless/iwlwifi/iwl-3945-rs.c |   21 ++-----------------
 drivers/net/wireless/iwlwifi/iwl-agn-rs.c  |   12 +----------
 include/net/mac80211.h                     |   23 ++++++++++++++++++++++
 net/mac80211/rate.c                        |   29 ++++++++++++++++++++++++++++
 net/mac80211/rc80211_minstrel.c            |   22 +--------------------
 net/mac80211/rc80211_pid_algo.c            |   11 +---------
 7 files changed, 59 insertions(+), 73 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +1 -13
index d8d2152..9199ce9 100644
@@ -1539,23 +1539,11 @@ exit:
 static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
 			 struct ieee80211_tx_rate_control *txrc)
 {
-	struct ieee80211_supported_band *sband = txrc->sband;
-	struct sk_buff *skb = txrc->skb;
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
-	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
 	struct ath_softc *sc = priv;
 	struct ath_rate_priv *ath_rc_priv = priv_sta;
-	__le16 fc = hdr->frame_control;
 
-	/* lowest rate for management and NO_ACK frames */
-	if (!ieee80211_is_data(fc) ||
-	    tx_info->flags & IEEE80211_TX_CTL_NO_ACK || !sta) {
-		tx_info->control.rates[0].idx = rate_lowest_index(sband, sta);
-		tx_info->control.rates[0].count =
-			(tx_info->flags & IEEE80211_TX_CTL_NO_ACK) ?
-				1 : ATH_MGT_TXMAXTRY;
+	if (rate_control_send_low(sta, priv_sta, txrc))
 		return;
-	}
 
 	/* Find tx rate for unicast frames */
 	ath_rc_ratefind(sc, ath_rc_priv, txrc, sta);
drivers/net/wireless/iwlwifi/iwl-3945-rs.c +3 -18
index bd2f709..8bd496f 100644
@@ -673,7 +673,6 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 	s8 scale_action = 0;
 	unsigned long flags;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
-	__le16 fc;
 	u16 rate_mask = 0;
 	s8 max_rate_idx = -1;
 	struct iwl_priv *priv = (struct iwl_priv *)priv_r;
@@ -681,24 +680,10 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 
 	IWL_DEBUG_RATE(priv, "enter\n");
 
-	if (sta)
-		rate_mask = sta->supp_rates[sband->band];
-
-	/* Send management frames and NO_ACK data using lowest rate. */
-	fc = hdr->frame_control;
-	if (!ieee80211_is_data(fc) || info->flags & IEEE80211_TX_CTL_NO_ACK ||
-	    !sta || !priv_sta) {
-		IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
-		if (!rate_mask)
-			info->control.rates[0].idx =
-					rate_lowest_index(sband, NULL);
-		else
-			info->control.rates[0].idx =
-					rate_lowest_index(sband, sta);
-		if (info->flags & IEEE80211_TX_CTL_NO_ACK)
-			info->control.rates[0].count = 1;
+	if (rate_control_send_low(sta, priv_sta, txrc))
 		return;
-	}
+
+	rate_mask = sta->supp_rates[sband->band];
 
 	/* get user max rate if set */
 	max_rate_idx = txrc->max_rate_idx;
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +1 -11
index ff20e50..7a3e4dd 100644
@@ -2485,18 +2485,8 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
 		mask_bit = sta->supp_rates[sband->band];
 
 	/* Send management frames and NO_ACK data using lowest rate. */
-	if (!ieee80211_is_data(hdr->frame_control) ||
-	    info->flags & IEEE80211_TX_CTL_NO_ACK || !sta || !lq_sta) {
-		if (!mask_bit)
-			info->control.rates[0].idx =
-					rate_lowest_index(sband, NULL);
-		else
-			info->control.rates[0].idx =
-					rate_lowest_index(sband, sta);
-		if (info->flags & IEEE80211_TX_CTL_NO_ACK)
-			info->control.rates[0].count = 1;
+	if (rate_control_send_low(sta, priv_r, txrc))
 		return;
-	}
 
 	rate_idx  = lq_sta->last_txrate_idx;
 
include/net/mac80211.h +23 -0
index 17d61d1..210610c 100644
@@ -2087,6 +2087,29 @@ static inline int rate_supported(struct ieee80211_sta *sta,
 	return (sta == NULL || sta->supp_rates[band] & BIT(index));
 }
 
+/**
+ * rate_control_send_low - helper for drivers for management/no-ack frames
+ *
+ * Rate control algorithms that agree to use the lowest rate to
+ * send management frames and NO_ACK data with the respective hw
+ * retries should use this in the beginning of their mac80211 get_rate
+ * callback. If true is returned the rate control can simply return.
+ * If false is returned we guarantee that sta and sta and priv_sta is
+ * not null.
+ *
+ * Rate control algorithms wishing to do more intelligent selection of
+ * rate for multicast/broadcast frames may choose to not use this.
+ *
+ * @sta: &struct ieee80211_sta pointer to the target destination. Note
+ * 	that this may be null.
+ * @priv_sta: private rate control structure. This may be null.
+ * @txrc: rate control information we sholud populate for mac80211.
+ */
+bool rate_control_send_low(struct ieee80211_sta *sta,
+			   void *priv_sta,
+			   struct ieee80211_tx_rate_control *txrc);
+
+
 static inline s8
 rate_lowest_index(struct ieee80211_supported_band *sband,
 		  struct ieee80211_sta *sta)
net/mac80211/rate.c +29 -0
index 4641f00..8ac7a98 100644
@@ -198,6 +198,35 @@ static void rate_control_release(struct kref *kref)
 	kfree(ctrl_ref);
 }
 
+static bool rc_no_data_or_no_ack(struct ieee80211_tx_rate_control *txrc)
+{
+	struct sk_buff *skb = txrc->skb;
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+	__le16 fc;
+
+	fc = hdr->frame_control;
+
+	return ((info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc));
+}
+
+bool rate_control_send_low(struct ieee80211_sta *sta,
+			   void *priv_sta,
+			   struct ieee80211_tx_rate_control *txrc)
+{
+	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
+
+	if (!sta || !priv_sta || rc_no_data_or_no_ack(txrc)) {
+		info->control.rates[0].idx = rate_lowest_index(txrc->sband, sta);
+		info->control.rates[0].count =
+			(info->flags & IEEE80211_TX_CTL_NO_ACK) ?
+			1 : txrc->hw->max_rate_tries;
+		return true;
+	}
+	return false;
+}
+EXPORT_SYMBOL(rate_control_send_low);
+
 void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
 			   struct sta_info *sta,
 			   struct ieee80211_tx_rate_control *txrc)
net/mac80211/rc80211_minstrel.c +1 -21
index 0e1db92..5c1cbda 100644
@@ -70,19 +70,6 @@ rix_to_ndx(struct minstrel_sta_info *mi, int rix)
 	return i;
 }
 
-static inline bool
-use_low_rate(struct sk_buff *skb)
-{
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
-	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-	__le16 fc;
-
-	fc = hdr->frame_control;
-
-	return ((info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc));
-}
-
-
 static void
 minstrel_update_stats(struct minstrel_priv *mp, struct minstrel_sta_info *mi)
 {
@@ -228,7 +215,6 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
 		  void *priv_sta, struct ieee80211_tx_rate_control *txrc)
 {
 	struct sk_buff *skb = txrc->skb;
-	struct ieee80211_supported_band *sband = txrc->sband;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct minstrel_sta_info *mi = priv_sta;
 	struct minstrel_priv *mp = priv;
@@ -241,14 +227,8 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
 	int mrr_ndx[3];
 	int sample_rate;
 
-	if (!sta || !mi || use_low_rate(skb)) {
-		ar[0].idx = rate_lowest_index(sband, sta);
-		if (info->flags & IEEE80211_TX_CTL_NO_ACK)
-			ar[0].count = 1;
-		else
-			ar[0].count = mp->max_retry;
+	if (rate_control_send_low(sta, priv_sta, txrc))
 		return;
-	}
 
 	mrr = mp->has_mrr && !txrc->rts && !txrc->bss_conf->use_cts_prot;
 
net/mac80211/rc80211_pid_algo.c +1 -10
index 5496077..8c053be 100644
@@ -276,11 +276,9 @@ rate_control_pid_get_rate(void *priv, struct ieee80211_sta *sta,
 {
 	struct sk_buff *skb = txrc->skb;
 	struct ieee80211_supported_band *sband = txrc->sband;
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct rc_pid_sta_info *spinfo = priv_sta;
 	int rateidx;
-	__le16 fc;
 
 	if (txrc->rts)
 		info->control.rates[0].count =
@@ -290,15 +288,8 @@ rate_control_pid_get_rate(void *priv, struct ieee80211_sta *sta,
 			txrc->hw->conf.short_frame_max_tx_count;
 
 	/* Send management frames and NO_ACK data using lowest rate. */
-	fc = hdr->frame_control;
-	if (!sta || !spinfo || !ieee80211_is_data(fc) ||
-	    info->flags & IEEE80211_TX_CTL_NO_ACK) {
-		info->control.rates[0].idx = rate_lowest_index(sband, sta);
-		if (info->flags & IEEE80211_TX_CTL_NO_ACK)
-			info->control.rates[0].count = 1;
-
+	if (rate_control_send_low(sta, priv_sta, txrc))
 		return;
-	}
 
 	rateidx = spinfo->txrate_idx;
 
Signature · 1 line
1.6.0.6
#23 lore raw

PATCH v2 14/15 mac80211: add helper for management / no-ack frame rate decision

Hi Luis,

Quoted 82 lines · Luis R. Rodriguez

All current rate control algorithms agree to send management and no-ack frames at the lowest rate. They also agree to do this when sta and the private rate control data is NULL. We add a hlper to mac80211 for this and simplify the rate control algorithm code.

Developers wishing to make enhancements to rate control algorithms are for broadcast/multicast can opt to not use this in their gate_rate() mac80211 callback.

Cc Zhu Yi <[email protected]>
Cc Reinette Chatre <[email protected]>
Cc Gabor Juhos <[email protected]>
Cc Felix Fietkau <[email protected]>
Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c        |   14 +------------
 drivers/net/wireless/iwlwifi/iwl-3945-rs.c |   21 ++-----------------
 drivers/net/wireless/iwlwifi/iwl-agn-rs.c  |   12 +----------
 include/net/mac80211.h                     |   23 ++++++++++++++++++++++
 net/mac80211/rate.c                        |   29 ++++++++++++++++++++++++++++
 net/mac80211/rc80211_minstrel.c            |   22 +--------------------
 net/mac80211/rc80211_pid_algo.c            |   11 +---------
 7 files changed, 59 insertions(+), 73 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +0 -0
index d8d2152..9199ce9 100644
drivers/net/wireless/iwlwifi/iwl-3945-rs.c +3 -18
index bd2f709..8bd496f 100644
@@ -673,7 +673,6 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 	s8 scale_action = 0;
 	unsigned long flags;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
-	__le16 fc;
 	u16 rate_mask = 0;
 	s8 max_rate_idx = -1;
 	struct iwl_priv *priv = (struct iwl_priv *)priv_r;
@@ -681,24 +680,10 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 
 	IWL_DEBUG_RATE(priv, "enter\n");
 
-	if (sta)
-		rate_mask = sta->supp_rates[sband->band];
-
-	/* Send management frames and NO_ACK data using lowest rate. */
-	fc = hdr->frame_control;
-	if (!ieee80211_is_data(fc) || info->flags & IEEE80211_TX_CTL_NO_ACK ||
-	    !sta || !priv_sta) {
-		IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
-		if (!rate_mask)
-			info->control.rates[0].idx =
-					rate_lowest_index(sband, NULL);
-		else
-			info->control.rates[0].idx =
-					rate_lowest_index(sband, sta);
-		if (info->flags & IEEE80211_TX_CTL_NO_ACK)
-			info->control.rates[0].count = 1;
+	if (rate_control_send_low(sta, priv_sta, txrc))
 		return;
-	}
+
+	rate_mask = sta->supp_rates[sband->band];
 
 	/* get user max rate if set */
 	max_rate_idx = txrc->max_rate_idx;
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +0 -5
index ff20e50..7a3e4dd 100644
@@ -2485,18 +2485,8 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
 		mask_bit = sta->supp_rates[sband->band];
 
 	/* Send management frames and NO_ACK data using lowest rate. */
-	if (!ieee80211_is_data(hdr->frame_control) ||
-	    info->flags & IEEE80211_TX_CTL_NO_ACK || !sta || !lq_sta) {
-		if (!mask_bit)
-			info->control.rates[0].idx =
-					rate_lowest_index(sband, NULL);

drivers/net/wireless/iwlwifi/iwl-agn-rs.c static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, · line 2491

Quoted 10 lines
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +1 -6
-		else
-			info->control.rates[0].idx =
-					rate_lowest_index(sband, sta);
-		if (info->flags & IEEE80211_TX_CTL_NO_ACK)
-			info->control.rates[0].count = 1;
+	if (rate_control_send_low(sta, priv_r, txrc))
 		return;
-	}
 
 	rate_idx  = lq_sta->last_txrate_idx;

The iwlwifi way of computing rates is not captured in the new helper. We used to do it in the way you change it to, but run into the "rs_get_rate" WARN very often (see
http://www.kerneloops.org/searchweek.php?search=rs_get_rate and
http://www.intellinuxwireless.org/bugzilla/show_bug.cgi?id=1822 ). We submitted patch "iwlwifi: fix rs_get_rate WARN_ON()" to address that.

Changing this back will make that warning reappear.

Reinette

#24 lore raw

PATCH v2 14/15 mac80211: add helper for management / no-ack frame rate decision

Quoted 104 lines · reinette chatre

Hi Luis,

Quoted 82 lines · Luis R. Rodriguez

All current rate control algorithms agree to send management and no-ack frames at the lowest rate. They also agree to do this when sta and the private rate control data is NULL. We add a hlper to mac80211 for this and simplify the rate control algorithm code.

Developers wishing to make enhancements to rate control algorithms are for broadcast/multicast can opt to not use this in their gate_rate() mac80211 callback.

Cc Zhu Yi <[email protected]>
Cc Reinette Chatre <[email protected]>
Cc Gabor Juhos <[email protected]>
Cc Felix Fietkau <[email protected]>
Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c        |   14 +------------
 drivers/net/wireless/iwlwifi/iwl-3945-rs.c |   21 ++-----------------
 drivers/net/wireless/iwlwifi/iwl-agn-rs.c  |   12 +----------
 include/net/mac80211.h                     |   23 ++++++++++++++++++++++
 net/mac80211/rate.c                        |   29 ++++++++++++++++++++++++++++
 net/mac80211/rc80211_minstrel.c            |   22 +--------------------
 net/mac80211/rc80211_pid_algo.c            |   11 +---------
 7 files changed, 59 insertions(+), 73 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +0 -0
index d8d2152..9199ce9 100644
drivers/net/wireless/iwlwifi/iwl-3945-rs.c +3 -18
index bd2f709..8bd496f 100644
@@ -673,7 +673,6 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
      s8 scale_action = 0;
      unsigned long flags;
      struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
-     __le16 fc;
      u16 rate_mask = 0;
      s8 max_rate_idx = -1;
      struct iwl_priv *priv = (struct iwl_priv *)priv_r;
@@ -681,24 +680,10 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
 
      IWL_DEBUG_RATE(priv, "enter\n");
 
-     if (sta)
-             rate_mask = sta->supp_rates[sband->band];
-
-     /* Send management frames and NO_ACK data using lowest rate. */
-     fc = hdr->frame_control;
-     if (!ieee80211_is_data(fc) || info->flags & IEEE80211_TX_CTL_NO_ACK ||
-         !sta || !priv_sta) {
-             IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
-             if (!rate_mask)
-                     info->control.rates[0].idx =
-                                     rate_lowest_index(sband, NULL);
-             else
-                     info->control.rates[0].idx =
-                                     rate_lowest_index(sband, sta);
-             if (info->flags & IEEE80211_TX_CTL_NO_ACK)
-                     info->control.rates[0].count = 1;
+     if (rate_control_send_low(sta, priv_sta, txrc))
              return;
-     }
+
+     rate_mask = sta->supp_rates[sband->band];
 
      /* get user max rate if set */
      max_rate_idx = txrc->max_rate_idx;
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +0 -5
index ff20e50..7a3e4dd 100644
@@ -2485,18 +2485,8 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
              mask_bit = sta->supp_rates[sband->band];
 
      /* Send management frames and NO_ACK data using lowest rate. */
-     if (!ieee80211_is_data(hdr->frame_control) ||
-         info->flags & IEEE80211_TX_CTL_NO_ACK || !sta || !lq_sta) {
-             if (!mask_bit)
-                     info->control.rates[0].idx =
-                                     rate_lowest_index(sband, NULL);

drivers/net/wireless/iwlwifi/iwl-agn-rs.c static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, · line 2491

Quoted 10 lines
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +1 -6
-             else
-                     info->control.rates[0].idx =
-                                     rate_lowest_index(sband, sta);
-             if (info->flags & IEEE80211_TX_CTL_NO_ACK)
-                     info->control.rates[0].count = 1;
+     if (rate_control_send_low(sta, priv_r, txrc))
              return;
-     }
 
      rate_idx  = lq_sta->last_txrate_idx;

The iwlwifi way of computing rates is not captured in the new helper. We used to do it in the way you change it to, but run into the "rs_get_rate" WARN very often (see
http://www.kerneloops.org/searchweek.php?search=rs_get_rate and
http://www.intellinuxwireless.org/bugzilla/show_bug.cgi?id=1822 ). We submitted patch "iwlwifi: fix rs_get_rate WARN_ON()" to address that.

Quoted 1 line

Changing this back will make that warning reappear.

Point taken -- this highlights an issue we see if we apply these patches and this needs to be dealt with properly. For example if we're a STA and already associated I don't believe it makes sense to send data to the sta if the sta does not support the minimum bitrate. The issue here would be we're trying to send to the sta using a band it does not support. I'll look into this a bit further...

Luis

#25 lore raw

PATCH v2 15/15 ath9k: remove rate control wraper

In reply to Luis R. Rodriguez

After the cleanup we just use get_rate as a wrapper, skip the wrapper.

Cc Derek Smithies <[email protected]>
Cc Chittajit Mitra <[email protected]>
---
 drivers/net/wireless/ath/ath9k/rc.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)
drivers/net/wireless/ath/ath9k/rc.c +7 -17
index 9199ce9..a921d75 100644
@@ -792,11 +792,11 @@ static void ath_rc_rate_set_rtscts(struct ath_softc *sc,
 	tx_info->control.rts_cts_rate_idx = cix;
 }
 
-static void ath_rc_ratefind(struct ath_softc *sc,
-			    struct ath_rate_priv *ath_rc_priv,
-			    struct ieee80211_tx_rate_control *txrc,
-			    struct ieee80211_sta *sta)
+static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
+			 struct ieee80211_tx_rate_control *txrc)
 {
+	struct ath_softc *sc = priv;
+	struct ath_rate_priv *ath_rc_priv = priv_sta;
 	const struct ath_rate_table *rate_table;
 	struct sk_buff *skb = txrc->skb;
 	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
@@ -807,6 +807,9 @@ static void ath_rc_ratefind(struct ath_softc *sc,
 	u8 try_per_rate, i = 0, rix, nrix;
 	int is_probe = 0;
 
+	if (rate_control_send_low(sta, priv_sta, txrc))
+		return;
+
 	/*
 	 * For Multi Rate Retry we use a different number of
 	 * retry attempt counts. This ends up looking like this:
@@ -1536,19 +1539,6 @@ exit:
 	kfree(tx_info_priv);
 }
 
-static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
-			 struct ieee80211_tx_rate_control *txrc)
-{
-	struct ath_softc *sc = priv;
-	struct ath_rate_priv *ath_rc_priv = priv_sta;
-
-	if (rate_control_send_low(sta, priv_sta, txrc))
-		return;
-
-	/* Find tx rate for unicast frames */
-	ath_rc_ratefind(sc, ath_rc_priv, txrc, sta);
-}
-
 static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
                           struct ieee80211_sta *sta, void *priv_sta)
 {
Signature · 1 line
1.6.0.6
#26 lore raw

v2 cover ath9k: few rate control cleanups

In reply to Luis R. Rodriguez
Quoted 5 lines · Luis R. Rodriguez

Addressed the few comments and tested compile against PID this time and when disabling ath9k debug. This time around we just make the settings for low rate on management frames and no-ack frames a helper and let rate control algorithms use it. When we want to extend these the helper just can be lifted.

all-in-one patch available at:

http://bombadil.infradead.org/~mcgrof/patches/ath9k/2009/06-05/rc3.patch

Luis