ath9k: add a bunch of powersave handling fixes

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau 2016-08-28 13:50:09 +02:00
parent 1e72d1bf16
commit 372d0fea29
5 changed files with 241 additions and 0 deletions

View File

@ -0,0 +1,49 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Sun, 28 Aug 2016 13:13:01 +0200
Subject: [PATCH] ath9k: fix moredata bit in PS buffered frame release
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1634,6 +1634,21 @@ void ath_tx_aggr_wakeup(struct ath_softc
}
}
+static void
+ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val)
+{
+ struct ieee80211_hdr *hdr;
+ u16 mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA);
+ u16 mask_val = mask * val;
+
+ hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
+ if ((hdr->frame_control & mask) != mask_val) {
+ hdr->frame_control = (hdr->frame_control & ~mask) | mask_val;
+ dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
+ sizeof(*hdr), DMA_TO_DEVICE);
+ }
+}
+
void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
struct ieee80211_sta *sta,
u16 tids, int nframes,
@@ -1664,6 +1679,7 @@ void ath9k_release_buffered_frames(struc
if (!bf)
break;
+ ath9k_set_moredata(sc, bf, true);
list_add_tail(&bf->list, &bf_q);
ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
if (bf_isampdu(bf)) {
@@ -1687,6 +1703,9 @@ void ath9k_release_buffered_frames(struc
if (list_empty(&bf_q))
return;
+ if (!more_data)
+ ath9k_set_moredata(sc, bf_tail, false);
+
info = IEEE80211_SKB_CB(bf_tail->bf_mpdu);
info->flags |= IEEE80211_TX_STATUS_EOSP;

View File

@ -0,0 +1,22 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Sun, 28 Aug 2016 13:13:42 +0200
Subject: [PATCH] ath9k: clear potentially stale EOSP status bit in
intermediate queues
Prevents spurious ieee80211_sta_eosp calls.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -945,7 +945,8 @@ ath_tx_get_tid_subframe(struct ath_softc
bf->bf_lastbf = bf;
tx_info = IEEE80211_SKB_CB(skb);
- tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT;
+ tx_info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT |
+ IEEE80211_TX_STATUS_EOSP);
/*
* No aggregation session is running, but there may be frames

View File

@ -0,0 +1,40 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Sun, 28 Aug 2016 13:15:10 +0200
Subject: [PATCH] ath9k: release PS buffered frames as A-MPDU if enabled
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1660,10 +1660,11 @@ void ath9k_release_buffered_frames(struc
struct ath_node *an = (struct ath_node *)sta->drv_priv;
struct ath_txq *txq = sc->tx.uapsdq;
struct ieee80211_tx_info *info;
+ struct ath_frame_info *fi;
struct list_head bf_q;
struct ath_buf *bf_tail = NULL, *bf;
int sent = 0;
- int i;
+ int n, i;
INIT_LIST_HEAD(&bf_q);
for (i = 0; tids && nframes; i++, tids >>= 1) {
@@ -1683,10 +1684,15 @@ void ath9k_release_buffered_frames(struc
ath9k_set_moredata(sc, bf, true);
list_add_tail(&bf->list, &bf_q);
ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
- if (bf_isampdu(bf)) {
+ if (bf_isampdu(bf))
ath_tx_addto_baw(sc, tid, bf);
- bf->bf_state.bf_type &= ~BUF_AGGR;
+ if (bf_isaggr(bf)) {
+ fi = get_frame_info(bf->bf_mpdu);
+ n = ath_compute_num_delims(sc, tid, bf,
+ fi->framelen, true);
+ bf->bf_state.ndelim = n;
}
+
if (bf_tail)
bf_tail->bf_next = bf;

View File

@ -0,0 +1,19 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Sun, 28 Aug 2016 13:23:27 +0200
Subject: [PATCH] ath9k: report tx status on EOSP
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -86,7 +86,8 @@ static void ath_tx_status(struct ieee802
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_sta *sta = info->status.status_driver_data[0];
- if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
+ if (info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS |
+ IEEE80211_TX_STATUS_EOSP)) {
ieee80211_tx_status(hw, skb);
return;
}

View File

@ -0,0 +1,111 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Tue, 30 Aug 2016 12:44:08 +0200
Subject: [PATCH] ath9k: fix block-ack window tracking issues
Ensure that a buffer gets tracked as part of the block-ack window as
soon as it's dequeued from the tid for the first time. Ensure that
double calls to ath_tx_addto_baw (e.g. on retransmission) don't cause
any issues.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -62,7 +62,7 @@ static void ath_tx_rc_status(struct ath_
struct ath_tx_status *ts, int nframes, int nbad,
int txok);
static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
- int seqno);
+ struct ath_buf *bf);
static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
struct ath_txq *txq,
struct ath_atx_tid *tid,
@@ -300,7 +300,7 @@ static void ath_tx_flush_tid(struct ath_
}
if (fi->baw_tracked) {
- ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
+ ath_tx_update_baw(sc, tid, bf);
sendbar = true;
}
@@ -316,10 +316,15 @@ static void ath_tx_flush_tid(struct ath_
}
static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
- int seqno)
+ struct ath_buf *bf)
{
+ struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
+ u16 seqno = bf->bf_state.seqno;
int index, cindex;
+ if (!fi->baw_tracked)
+ return;
+
index = ATH_BA_INDEX(tid->seq_start, seqno);
cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
@@ -340,6 +345,9 @@ static void ath_tx_addto_baw(struct ath_
u16 seqno = bf->bf_state.seqno;
int index, cindex;
+ if (fi->baw_tracked)
+ return;
+
index = ATH_BA_INDEX(tid->seq_start, seqno);
cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
__set_bit(cindex, tid->tx_buf);
@@ -616,7 +624,7 @@ static void ath_tx_complete_aggr(struct
* complete the acked-ones/xretried ones; update
* block-ack window
*/
- ath_tx_update_baw(sc, tid, seqno);
+ ath_tx_update_baw(sc, tid, bf);
if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
memcpy(tx_info->control.rates, rates, sizeof(rates));
@@ -646,7 +654,7 @@ static void ath_tx_complete_aggr(struct
* run out of tx buf.
*/
if (!tbf) {
- ath_tx_update_baw(sc, tid, seqno);
+ ath_tx_update_baw(sc, tid, bf);
ath_tx_complete_buf(sc, bf, txq,
&bf_head, NULL, ts,
@@ -986,11 +994,14 @@ ath_tx_get_tid_subframe(struct ath_softc
INIT_LIST_HEAD(&bf_head);
list_add(&bf->list, &bf_head);
- ath_tx_update_baw(sc, tid, seqno);
+ ath_tx_update_baw(sc, tid, bf);
ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
continue;
}
+ if (bf_isampdu(bf))
+ ath_tx_addto_baw(sc, tid, bf);
+
return bf;
}
@@ -1048,8 +1059,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s
bf->bf_next = NULL;
/* link buffers of this frame to the aggregate */
- if (!fi->baw_tracked)
- ath_tx_addto_baw(sc, tid, bf);
bf->bf_state.ndelim = ndelim;
list_add_tail(&bf->list, bf_q);
@@ -1685,8 +1694,6 @@ void ath9k_release_buffered_frames(struc
ath9k_set_moredata(sc, bf, true);
list_add_tail(&bf->list, &bf_q);
ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
- if (bf_isampdu(bf))
- ath_tx_addto_baw(sc, tid, bf);
if (bf_isaggr(bf)) {
fi = get_frame_info(bf->bf_mpdu);
n = ath_compute_num_delims(sc, tid, bf,