Linux wireless drivers development
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 07/11] mt76: mt7603: notify mac80211 about buffered frames in ps queue
Date: Mon,  4 Mar 2019 09:02:30 +0100	[thread overview]
Message-ID: <20190304080234.3221-7-nbd@nbd.name> (raw)
In-Reply-To: <20190304080234.3221-1-nbd@nbd.name>

Also fix the size check for filtered powersave frames
Fixes a corner case with waking up clients

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt7603/dma.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/dma.c b/drivers/net/wireless/mediatek/mt76/mt7603/dma.c
index 72d189daad38..4606b539190f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/dma.c
@@ -24,12 +24,16 @@ static void
 mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb)
 {
 	__le32 *txd = (__le32 *)skb->data;
+	struct ieee80211_hdr *hdr;
+	struct ieee80211_sta *sta;
 	struct mt7603_sta *msta;
 	struct mt76_wcid *wcid;
+	void *priv;
 	int idx;
 	u32 val;
+	u8 tid;
 
-	if (skb->len < sizeof(MT_TXD_SIZE) + sizeof(struct ieee80211_hdr))
+	if (skb->len < MT_TXD_SIZE + sizeof(struct ieee80211_hdr))
 		goto free;
 
 	val = le32_to_cpu(txd[1]);
@@ -43,7 +47,7 @@ mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb)
 	if (!wcid)
 		goto free;
 
-	msta = container_of(wcid, struct mt7603_sta, wcid);
+	priv = msta = container_of(wcid, struct mt7603_sta, wcid);
 	val = le32_to_cpu(txd[0]);
 	skb_set_queue_mapping(skb, FIELD_GET(MT_TXD0_Q_IDX, val));
 
@@ -51,6 +55,11 @@ mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff *skb)
 	val |= FIELD_PREP(MT_TXD0_Q_IDX, MT_TX_HW_QUEUE_MGMT);
 	txd[0] = cpu_to_le32(val);
 
+	sta = container_of(priv, struct ieee80211_sta, drv_priv);
+	hdr = (struct ieee80211_hdr *) &skb->data[MT_TXD_SIZE];
+	tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK;
+	ieee80211_sta_set_buffered(sta, tid, true);
+
 	spin_lock_bh(&dev->ps_lock);
 	__skb_queue_tail(&msta->psq, skb);
 	if (skb_queue_len(&msta->psq) >= 64) {
-- 
2.17.0


  parent reply	other threads:[~2019-03-04  8:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04  8:02 [PATCH 01/11] mt76: mt76x02: reduce false positives in ED/CCA tx blocking Felix Fietkau
2019-03-04  8:02 ` [PATCH 02/11] mt76: mt7603: fix tx status HT rate validation Felix Fietkau
2019-03-04  8:02 ` [PATCH 03/11] mt76: mt76x2: fix external LNA gain settings Felix Fietkau
2019-03-04  8:02 ` [PATCH 04/11] mt76: mt76x2: fix 2.4 GHz channel " Felix Fietkau
2019-03-04  8:02 ` [PATCH 05/11] mt76: mt7603: clear ps filtering mode before releasing buffered frames Felix Fietkau
2019-03-04  8:02 ` [PATCH 06/11] mt76: mt7603: fix up hardware queue index for PS filtered packets Felix Fietkau
2019-03-04  8:02 ` Felix Fietkau [this message]
2019-03-04  8:02 ` [PATCH 08/11] mt76: mt7603: clear the service period on releasing " Felix Fietkau
2019-03-04  8:02 ` [PATCH 09/11] mt76: when releasing PS frames, end the service period if no frame was found Felix Fietkau
2019-03-04  8:02 ` [PATCH 10/11] mt76: mt76x02: disable ED/CCA by default Felix Fietkau
2019-03-04  8:02 ` [PATCH 11/11] mt76: mt7603: set moredata flag when queueing ps-filtered packets Felix Fietkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190304080234.3221-7-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox