From d4900fc37f44cd52c4bf1474f0b48a0336ec4e22 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 5 Oct 2015 10:27:04 +0200 Subject: [PATCH] tx: store aggregation starting sequence number on first tx attempt, not on initial dequeue Signed-off-by: Felix Fietkau --- tx.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tx.c b/tx.c index df46fd8d..249b3125 100644 --- a/tx.c +++ b/tx.c @@ -187,7 +187,6 @@ static struct sk_buff * mt76_txq_dequeue(struct mt76_dev *dev, struct mt76_txq *mtxq, bool ps) { struct ieee80211_txq *txq = mtxq_to_txq(mtxq); - struct ieee80211_hdr *hdr; struct sk_buff *skb; skb = skb_dequeue(&mtxq->retry_q); @@ -204,12 +203,16 @@ mt76_txq_dequeue(struct mt76_dev *dev, struct mt76_txq *mtxq, bool ps) if (!skb) return NULL; - hdr = (struct ieee80211_hdr *) skb->data; - mtxq->agg_ssn = le16_to_cpu(hdr->seq_ctrl) + 0x10; - return skb; } +static void +mt76_check_agg_ssn(struct mt76_txq *mtxq, struct sk_buff *skb) +{ + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; + mtxq->agg_ssn = le16_to_cpu(hdr->seq_ctrl) + 0x10; +} + static void mt76_queue_ps_skb(struct mt76_dev *dev, struct ieee80211_sta *sta, struct sk_buff *skb, bool last) @@ -251,6 +254,9 @@ mt76_release_buffered_frames(struct ieee80211_hw *hw, struct ieee80211_sta *sta, if (!skb) break; + if (mtxq->aggr) + mt76_check_agg_ssn(mtxq, skb); + nframes--; if (last_skb) { mt76_queue_ps_skb(dev, sta, last_skb, false); @@ -303,6 +309,10 @@ mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_queue *hwq, probe = (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE); ampdu = IEEE80211_SKB_CB(skb)->flags & IEEE80211_TX_CTL_AMPDU; limit = ampdu ? 16 : 3; + + if (ampdu) + mt76_check_agg_ssn(mtxq, skb); + idx = mt76_tx_queue_skb(dev, hwq, skb, wcid, txq->sta); if (idx < 0) @@ -331,6 +341,9 @@ mt76_txq_send_burst(struct mt76_dev *dev, struct mt76_queue *hwq, info = IEEE80211_SKB_CB(skb); info->control.rates[0] = tx_rate; + if (cur_ampdu) + mt76_check_agg_ssn(mtxq, skb); + idx = mt76_tx_queue_skb(dev, hwq, skb, wcid, txq->sta); if (idx < 0) return idx;