2009-06-17 04:27:11

by Senthil Balasubramanian

[permalink] [raw]
Subject: ATH9K Bug fixes

This series address issues with Atheros hardware that supports different
TX and RX streams and also bogus RSSI report from hardware.

Senthil



2009-06-17 04:27:18

by Senthil Balasubramanian

[permalink] [raw]
Subject: [PATCH 1/1] ath9k: Handle different TX and RX streams properly.

This patch fixes an issue when the TX and RX streams are different.

Signed-off-by: Senthil Balasubramanian <[email protected]>
---
drivers/net/wireless/ath/ath9k/main.c | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 2ebd0ed..ebe559c 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -874,6 +874,7 @@ static void setup_ht_cap(struct ath_softc *sc,
{
#define ATH9K_HT_CAP_MAXRXAMPDU_65536 0x3 /* 2 ^ 16 */
#define ATH9K_HT_CAP_MPDUDENSITY_8 0x6 /* 8 usec */
+ u8 tx_streams, rx_streams;

ht_info->ht_supported = true;
ht_info->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
@@ -886,21 +887,22 @@ static void setup_ht_cap(struct ath_softc *sc,

/* set up supported mcs set */
memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
+ tx_streams = !(sc->tx_chainmask & (sc->tx_chainmask - 1)) ? 1 : 2;
+ rx_streams = !(sc->rx_chainmask & (sc->rx_chainmask - 1)) ? 1 : 2;

- switch(sc->rx_chainmask) {
- case 1:
- ht_info->mcs.rx_mask[0] = 0xff;
- break;
- case 3:
- case 5:
- case 7:
- default:
- ht_info->mcs.rx_mask[0] = 0xff;
- ht_info->mcs.rx_mask[1] = 0xff;
- break;
+ if (tx_streams != rx_streams) {
+ DPRINTF(sc, ATH_DBG_CONFIG, "TX streams %d, RX streams: %d\n",
+ tx_streams, rx_streams);
+ ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF;
+ ht_info->mcs.tx_params |= ((tx_streams - 1) <<
+ IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT);
}

- ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
+ ht_info->mcs.rx_mask[0] = 0xff;
+ if (rx_streams >= 2)
+ ht_info->mcs.rx_mask[1] = 0xff;
+
+ ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED;
}

static void ath9k_bss_assoc_info(struct ath_softc *sc,
--
1.6.0.4


2009-06-17 04:27:24

by Senthil Balasubramanian

[permalink] [raw]
Subject: [PATCH 2/2] ath9k: Fix bogus RSSI report from Hardware during RX.

The hardware may report errorneous RSSI in some cases. Detect it and
don't use them for reporting the signal strength to the stack.

Signed-off-by: Senthil Balasubramanian <[email protected]>
---
drivers/net/wireless/ath/ath9k/ath9k.h | 5 +++--
drivers/net/wireless/ath/ath9k/recv.c | 21 +++++++++++++--------
2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 3939396..93245dd 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -300,8 +300,9 @@ struct ath_tx_control {
#define ATH_TX_XRETRY 0x02
#define ATH_TX_BAR 0x04

-#define ATH_RSSI_LPF_LEN 10
-#define RSSI_LPF_THRESHOLD -20
+#define ATH_RSSI_LPF_LEN 10
+#define RSSI_LPF_THRESHOLD -20
+#define ATH9K_RSSI_BAD 0x80
#define ATH_RSSI_EP_MULTIPLIER (1<<7)
#define ATH_EP_MUL(x, mul) ((x) * (mul))
#define ATH_RSSI_IN(x) (ATH_EP_MUL((x), ATH_RSSI_EP_MULTIPLIER))
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 0f62795..889d0c9 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -147,6 +147,7 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
struct ieee80211_hw *hw;
struct ieee80211_sta *sta;
struct ath_node *an;
+ int last_rssi = ATH_RSSI_DUMMY_MARKER;


hdr = (struct ieee80211_hdr *)skb->data;
@@ -236,17 +237,21 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
sta = ieee80211_find_sta(sc->hw, hdr->addr2);
if (sta) {
an = (struct ath_node *) sta->drv_priv;
- ATH_RSSI_LPF(an->last_rssi, ds->ds_rxstat.rs_rssi);
- if (likely(an->last_rssi != ATH_RSSI_DUMMY_MARKER))
- ds->ds_rxstat.rs_rssi = ATH_EP_RND(an->last_rssi,
- ATH_RSSI_EP_MULTIPLIER);
- if (ds->ds_rxstat.rs_rssi < 0)
- ds->ds_rxstat.rs_rssi = 0;
- else if (ds->ds_rxstat.rs_rssi > 127)
- ds->ds_rxstat.rs_rssi = 127;
+ if (ds->ds_rxstat.rs_rssi != ATH9K_RSSI_BAD &&
+ !ds->ds_rxstat.rs_moreaggr)
+ ATH_RSSI_LPF(an->last_rssi, ds->ds_rxstat.rs_rssi);
+ last_rssi = an->last_rssi;
}
rcu_read_unlock();

+ if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
+ ds->ds_rxstat.rs_rssi = ATH_EP_RND(last_rssi,
+ ATH_RSSI_EP_MULTIPLIER);
+ if (ds->ds_rxstat.rs_rssi < 0)
+ ds->ds_rxstat.rs_rssi = 0;
+ else if (ds->ds_rxstat.rs_rssi > 127)
+ ds->ds_rxstat.rs_rssi = 127;
+
rx_status->mactime = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp);
rx_status->band = hw->conf.channel->band;
rx_status->freq = hw->conf.channel->center_freq;
--
1.6.0.4


2009-06-17 19:15:31

by John W. Linville

[permalink] [raw]
Subject: Re: ATH9K Bug fixes

On Wed, Jun 17, 2009 at 09:57:06AM +0530, Senthil Balasubramanian wrote:
> This series address issues with Atheros hardware that supports different
> TX and RX streams and also bogus RSSI report from hardware.

Just as the other series, these changelog entries are too terse
and vague. They are particularly terse and vague for consideration
as bugfixes for 2.6.31.

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.