2009-06-06 00:04:01

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 00/15] 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(-)



2009-06-06 07:25:58

by Karl Hiramoto

[permalink] [raw]
Subject: Re: [ath9k-devel] [PATCH v2 08/15] ath9k: remove ATH9K_MODE_11B

Luis R. Rodriguez wrote:
> 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]>
> Siged-off-by: Luis R. Rodriguez <[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(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
> index 1579c94..de2c000 100644
> --- a/drivers/net/wireless/ath/ath9k/hw.c
> +++ b/drivers/net/wireless/ath/ath9k/hw.c
> @@ -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))
> diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
> index dd8508e..73d859e 100644
> --- a/drivers/net/wireless/ath/ath9k/hw.h
> +++ b/drivers/net/wireless/ath/ath9k/hw.h
> @@ -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,
> diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
> index 01586d2..980040b 100644
> --- a/drivers/net/wireless/ath/ath9k/rc.c
> +++ b/drivers/net/wireless/ath/ath9k/rc.c
> @@ -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] =
>


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




--
Karl

2009-06-06 00:04:02

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 01/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

Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/wireless/ath/ath9k/debug.h | 1 +
drivers/net/wireless/ath/ath9k/rc.c | 41 +++++++++++++++++++++++++++----
2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index edda15b..9d72bc8 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -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
};

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index ba06e78..53cb4fb 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -741,10 +741,24 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
if (rate > (ath_rc_priv->rate_table_size - 1))
rate = ath_rc_priv->rate_table_size - 1;

- ASSERT((rate_table->info[rate].valid &&
- (ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG)) ||
- (rate_table->info[rate].valid_single_stream &&
- !(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG)));
+ if (rate_table->info[rate].valid &&
+ (ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG))
+ return rate;
+
+ if (rate_table->info[rate].valid_single_stream &&
+ !(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG));
+ return rate;
+
+ /*
+ * This should not happen, but we know it does for now... This
+ * needs a proper fix but we're still not sure how this is caused.
+ * Its not *critical* though so lets just warn when debug is enabled
+ * for configuration changes.
+ */
+#ifdef CONFIG_ATH9K_DEBUG
+ WARN_ON(sc->debug.debug_mask & ATH_DBG_RATE);
+#endif
+ rate = ath_rc_priv->valid_rate_index[0];

return rate;
}
@@ -837,13 +851,15 @@ static u8 ath_rc_rate_getidx(struct ath_softc *sc,

static void ath_rc_ratefind(struct ath_softc *sc,
struct ath_rate_priv *ath_rc_priv,
- struct ieee80211_tx_rate_control *txrc)
+ struct ieee80211_tx_rate_control *txrc,
+ struct ieee80211_sta *sta)
{
const struct ath_rate_table *rate_table;
struct sk_buff *skb = txrc->skb;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_tx_rate *rates = tx_info->control.rates;
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;
int is_probe = 0;
@@ -935,6 +951,19 @@ static void ath_rc_ratefind(struct ath_softc *sc,

/* Setup RTS/CTS */
ath_rc_rate_set_rtscts(sc, rate_table, tx_info);
+
+ /*
+ * Fine tuning for when no decent rate was found, the
+ * lowest should *not* be used under normal circumstances.
+ */
+ if (rix == ath_rc_priv->valid_rate_index[0]) {
+ DPRINTF(sc, ATH_DBG_RATE, "lowest rate being used, "
+ "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 */
+ rates[1].idx = -1;
+ }
}

static bool ath_rc_update_per(struct ath_softc *sc,
@@ -1582,7 +1611,7 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
}

/* Find tx rate for unicast frames */
- ath_rc_ratefind(sc, ath_rc_priv, txrc);
+ ath_rc_ratefind(sc, ath_rc_priv, txrc, sta);
}

static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
--
1.6.0.6


2009-06-06 03:00:16

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH v2 00/15] ath9k: few rate control cleanups

On Fri, Jun 5, 2009 at 5:03 PM, Luis R. Rodriguez<[email protected]> wrote:
> 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

2009-06-06 00:04:02

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 02/15] ath9k: cleanup try count for MRR in rate control

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]>
Signed-off-by: Luis R. Rodriguez <[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(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 9cd523f..ca14642 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -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
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index f7baa40..2270166 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -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);

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 53cb4fb..2040ee8 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -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 */
--
1.6.0.6


2009-06-08 19:15:25

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH v2 13/15] iwlwifi: use ieee80211_is_data(fc)

2009/6/8 Gábor Stefanik <[email protected]>:
> On Sat, Jun 6, 2009 at 2:03 AM, Luis R. Rodriguez<[email protected]> wrote:
>> Cc: Zhu Yi <[email protected]>
>> Cc: Reinette Chatre <[email protected]>
>> Cc: [email protected]
>> Signed-off-by: Luis R. Rodriguez <[email protected]>
>> ---
>>  drivers/net/wireless/iwlwifi/iwl-3945-rs.c |    7 +++----
>>  drivers/net/wireless/iwlwifi/iwl-sta.c     |    5 ++---
>>  2 files changed, 5 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
>> index 5eb538d..bd2f709 100644
>> --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
>> +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
>> @@ -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 ||
>
> 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

2009-06-08 17:51:28

by Reinette Chatre

[permalink] [raw]
Subject: Re: [PATCH v2 13/15] iwlwifi: use ieee80211_is_data(fc)

Hi Luis,

On Fri, 2009-06-05 at 17:03 -0700, Luis R. Rodriguez wrote:
> Cc: Zhu Yi <[email protected]>
> Cc: Reinette Chatre <[email protected]>
> Cc: [email protected]
> Signed-off-by: Luis R. Rodriguez <[email protected]>
> ---
> drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 7 +++----
> drivers/net/wireless/iwlwifi/iwl-sta.c | 5 ++---
> 2 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> index 5eb538d..bd2f709 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> @@ -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)
> diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
> index 2addf73..afa1633 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-sta.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
> @@ -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) {


Acked-by: Reinette Chatre <[email protected]>

Thank you

Reinette



2009-06-06 00:04:02

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 13/15] iwlwifi: use ieee80211_is_data(fc)

Cc: Zhu Yi <[email protected]>
Cc: Reinette Chatre <[email protected]>
Cc: [email protected]
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 7 +++----
drivers/net/wireless/iwlwifi/iwl-sta.c | 5 ++---
2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 5eb538d..bd2f709 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -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)
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 2addf73..afa1633 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -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


2009-06-06 00:04:02

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 15/15] ath9k: remove rate control wraper

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

Cc: Derek Smithies <[email protected]>
Cc: Chittajit Mitra <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/wireless/ath/ath9k/rc.c | 24 +++++++-----------------
1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 9199ce9..a921d75 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -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)
{
--
1.6.0.6


2009-06-08 21:58:20

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH v2 14/15] mac80211: add helper for management / no-ack frame rate decision

On Mon, Jun 08, 2009 at 01:28:22PM -0700, reinette chatre wrote:
> Hi Luis,
>
> On Fri, 2009-06-05 at 17:03 -0700, Luis R. Rodriguez wrote:
> > 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: [email protected]
> > Cc: Gabor Juhos <[email protected]>
> > Cc: Felix Fietkau <[email protected]>
> > Cc: Derek Smithies <[email protected]>
> > Cc: Chittajit Mitra <[email protected]>
> > Signed-off-by: Luis R. Rodriguez <[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(-)
> >
> > diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
> > index d8d2152..9199ce9 100644
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> > index bd2f709..8bd496f 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> > +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> > @@ -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;
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
> > index ff20e50..7a3e4dd 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
> > +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
> > @@ -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;
>
>
> 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.

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

2009-06-08 15:58:10

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH v2 11/15] ath9k: remove unnecessary IEEE80211_TX_CTL_NO_ACK checks

On Sun, Jun 07, 2009 at 11:25:31AM -0700, G?bor Stefanik wrote:
> On Sat, Jun 6, 2009 at 2:03 AM, Luis R. Rodriguez<[email protected]> wrote:
> > 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]>
> > Signed-off-by: Luis R. Rodriguez <[email protected]>
> > ---
> > drivers/net/wireless/ath/ath9k/rc.c | 6 ++----
> > 1 files changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
> > index 9907f2f..d8d2152 100644
> > --- a/drivers/net/wireless/ath/ath9k/rc.c
> > +++ b/drivers/net/wireless/ath/ath9k/rc.c
> > @@ -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
> >
> > --
> > 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

2009-06-06 00:04:01

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 08/15] ath9k: remove ATH9K_MODE_11B

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]>
Siged-off-by: Luis R. Rodriguez <[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(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 1579c94..de2c000 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -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))
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index dd8508e..73d859e 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -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,
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 01586d2..980040b 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -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] =
--
1.6.0.6


2009-06-06 00:04:02

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 03/15] ath9k: remove unused min rate calculation code

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]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/wireless/ath/ath9k/rc.c | 33 +++++++++------------------------
1 files changed, 9 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 2040ee8..93e480c 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -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);
--
1.6.0.6


2009-06-09 00:17:07

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH v2 13/15] iwlwifi: use ieee80211_is_data(fc)

2009/6/8 Luis R. Rodriguez <[email protected]>:
> 2009/6/8 Gábor Stefanik <[email protected]>:
>> On Sat, Jun 6, 2009 at 2:03 AM, Luis R. Rodriguez<[email protected]> wrote:
>>> Cc: Zhu Yi <[email protected]>
>>> Cc: Reinette Chatre <[email protected]>
>>> Cc: [email protected]
>>> Signed-off-by: Luis R. Rodriguez <[email protected]>
>>> ---
>>>  drivers/net/wireless/iwlwifi/iwl-3945-rs.c |    7 +++----
>>>  drivers/net/wireless/iwlwifi/iwl-sta.c     |    5 ++---
>>>  2 files changed, 5 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
>>> index 5eb538d..bd2f709 100644
>>> --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
>>> +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
>>> @@ -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 ||
>>
>> 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.

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

Luis

2009-06-08 20:21:22

by Reinette Chatre

[permalink] [raw]
Subject: Re: [PATCH v2 14/15] mac80211: add helper for management / no-ack frame rate decision

Hi Luis,

On Fri, 2009-06-05 at 17:03 -0700, Luis R. Rodriguez wrote:
> 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: [email protected]
> Cc: Gabor Juhos <[email protected]>
> Cc: Felix Fietkau <[email protected]>
> Cc: Derek Smithies <[email protected]>
> Cc: Chittajit Mitra <[email protected]>
> Signed-off-by: Luis R. Rodriguez <[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(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
> index d8d2152..9199ce9 100644
> diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> index bd2f709..8bd496f 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> @@ -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;
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
> index ff20e50..7a3e4dd 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
> @@ -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;


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



2009-06-06 00:04:02

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 12/15] mac80211: make minstrel/pid RC use ieee80211_is_data(fc)

Cc: Felix Fietkau <[email protected]>
Cc: Derek Smithies <[email protected]>
Cc: Chittajit Mitra <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
net/mac80211/rc80211_minstrel.c | 7 +++----
net/mac80211/rc80211_pid_algo.c | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 0a11515..0e1db92 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -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));
}


diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index a0bef76..5496077 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -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)
--
1.6.0.6


2009-06-06 00:03:58

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 06/15] ath9k: rename ath_rc_get_nextlowervalid_txrate()

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]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/wireless/ath/ath9k/rc.c | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index d855572..2c57944 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -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;
--
1.6.0.6


2009-06-06 00:04:01

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 07/15] ath9k: remove unused ath_rc_isvalid_txmask()

Cc: Derek Smithies <[email protected]>
Cc: Chittajit Mitra <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/wireless/ath/ath9k/rc.c | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 2c57944..01586d2 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -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,
--
1.6.0.6


2009-06-08 15:57:37

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [ath9k-devel] [PATCH v2 08/15] ath9k: remove ATH9K_MODE_11B

On Sat, Jun 06, 2009 at 12:25:49AM -0700, Karl Hiramoto wrote:
> Luis R. Rodriguez wrote:
> > 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]>
> > Siged-off-by: Luis R. Rodriguez <[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(-)
> >
> > diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
> > index 1579c94..de2c000 100644
> > --- a/drivers/net/wireless/ath/ath9k/hw.c
> > +++ b/drivers/net/wireless/ath/ath9k/hw.c
> > @@ -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))
> > diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
> > index dd8508e..73d859e 100644
> > --- a/drivers/net/wireless/ath/ath9k/hw.h
> > +++ b/drivers/net/wireless/ath/ath9k/hw.h
> > @@ -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,
> > diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
> > index 01586d2..980040b 100644
> > --- a/drivers/net/wireless/ath/ath9k/rc.c
> > +++ b/drivers/net/wireless/ath/ath9k/rc.c
> > @@ -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] =
> >
>
>
> 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

2009-06-06 00:04:02

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 11/15] ath9k: remove unnecessary IEEE80211_TX_CTL_NO_ACK checks

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]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/wireless/ath/ath9k/rc.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 9907f2f..d8d2152 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -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


2009-06-07 18:25:53

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH v2 11/15] ath9k: remove unnecessary IEEE80211_TX_CTL_NO_ACK checks

On Sat, Jun 6, 2009 at 2:03 AM, Luis R. Rodriguez<[email protected]> wrote:
> 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]>
> Signed-off-by: Luis R. Rodriguez <[email protected]>
> ---
> ?drivers/net/wireless/ath/ath9k/rc.c | ? ?6 ++----
> ?1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
> index 9907f2f..d8d2152 100644
> --- a/drivers/net/wireless/ath/ath9k/rc.c
> +++ b/drivers/net/wireless/ath/ath9k/rc.c
> @@ -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
>
> --
> 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?

--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

2009-06-08 18:30:19

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH v2 13/15] iwlwifi: use ieee80211_is_data(fc)

On Sat, Jun 6, 2009 at 2:03 AM, Luis R. Rodriguez<[email protected]> wrote:
> Cc: Zhu Yi <[email protected]>
> Cc: Reinette Chatre <[email protected]>
> Cc: [email protected]
> Signed-off-by: Luis R. Rodriguez <[email protected]>
> ---
> ?drivers/net/wireless/iwlwifi/iwl-3945-rs.c | ? ?7 +++----
> ?drivers/net/wireless/iwlwifi/iwl-sta.c ? ? | ? ?5 ++---
> ?2 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> index 5eb538d..bd2f709 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
> @@ -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 ||

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

> ? ? ? ? ? ?!sta || !priv_sta) {
> ? ? ? ? ? ? ? ?IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
> ? ? ? ? ? ? ? ?if (!rate_mask)
> diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
> index 2addf73..afa1633 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-sta.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
> @@ -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 [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>



--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

2009-06-06 00:04:02

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 14/15] mac80211: add helper for management / no-ack frame rate decision

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: [email protected]
Cc: Gabor Juhos <[email protected]>
Cc: Felix Fietkau <[email protected]>
Cc: Derek Smithies <[email protected]>
Cc: Chittajit Mitra <[email protected]>
Signed-off-by: Luis R. Rodriguez <[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(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index d8d2152..9199ce9 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -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);
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index bd2f709..8bd496f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -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;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index ff20e50..7a3e4dd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -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;

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 17d61d1..210610c 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -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)
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 4641f00..8ac7a98 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -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)
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 0e1db92..5c1cbda 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -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;

diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index 5496077..8c053be 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -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;

--
1.6.0.6


2009-06-06 00:04:01

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 04/15] ath9k: remove unused stepdown when looking for the next rate

This is not used, remove this.

Cc: Derek Smithies <[email protected]>
Cc: Chittajit Mitra <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/wireless/ath/ath9k/rc.c | 21 ++++++++-------------
1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 93e480c..4427094 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -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);
--
1.6.0.6


2009-06-06 00:04:02

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 09/15] ath9k: remap ATH9K_MODE_*

There are a lot of gaps here.

Cc: Derek Smithies <[email protected]>
Cc: Chittajit Mitra <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/wireless/ath/ath9k/hw.h | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 73d859e..08eb5ae 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -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 {
--
1.6.0.6


2009-06-06 00:04:01

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 10/15] ath9k: rename ath_rc_ratefind_ht() to ath_rc_get_highest_rix()

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

Cc: Derek Smithies <[email protected]>
Cc: Chittajit Mitra <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/wireless/ath/ath9k/rc.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 980040b..9907f2f 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -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;
}
}
--
1.6.0.6


2009-06-06 00:03:57

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH v2 05/15] ath9k: remove pointless wrapper ath_rc_rate_getidx()

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]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/wireless/ath/ath9k/rc.c | 21 ++++-----------------
1 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 4427094..d855572 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -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);
--
1.6.0.6