linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: greearb@candelatech.com
To: linux-wireless@vger.kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Subject: [PATCH v5 04/11] mt76: mt7915:  allow processing TXS for 'NO_SKB' pkt-ids
Date: Wed,  4 Aug 2021 06:44:58 -0700	[thread overview]
Message-ID: <20210804134505.3208-4-greearb@candelatech.com> (raw)
In-Reply-To: <20210804134505.3208-1-greearb@candelatech.com>

From: Ben Greear <greearb@candelatech.com>

This will let us update stats and wcid.rate for every TXS
callback we receive for a particular wcid.

For now, the TXS is not requested for NO_SKB frames, however.
That will be allowed in next patch.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 .../net/wireless/mediatek/mt76/mt7915/mac.c    | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index 6f92e207680f..2228dad71657 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -1047,6 +1047,7 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi,
 	txwi[4] = 0;
 
 	val = FIELD_PREP(MT_TXD5_PID, pid);
+	/* NOTE:  mt7916 does NOT request TXS for 'NO_SKB' frames by default. */
 	if (pid >= MT_PACKET_ID_FIRST)
 		val |= MT_TXD5_TX_STATUS_HOST;
 	txwi[5] = cpu_to_le32(val);
@@ -1430,10 +1431,16 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,
 	 * paired with TXS data.  This is normal datapath.
 	 */
 	struct rate_info *rate = &wcid->rate;
-	struct sk_buff *skb;
+	struct sk_buff *skb = NULL;
+	bool check_status;
 
-	mt76_tx_status_lock(mdev, &list);
-	skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list);
+	check_status = ((pid >= MT_PACKET_ID_FIRST) ||
+			time_after(jiffies, mdev->next_status_jiffies));
+
+	if (check_status) {
+		mt76_tx_status_lock(mdev, &list);
+		skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list);
+	}
 
 	memset(rate, 0, sizeof(*rate));
 
@@ -1447,7 +1454,8 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,
 	if (skb)
 		mt76_tx_status_skb_done(mdev, skb, &list, wcid);
 
-	mt76_tx_status_unlock(mdev, &list);
+	if (check_status)
+		mt76_tx_status_unlock(mdev, &list);
 }
 
 static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)
@@ -1469,7 +1477,7 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)
 	txs = le32_to_cpu(txs_data[3]);
 	pid = FIELD_GET(MT_TXS3_PID, txs);
 
-	if (pid < MT_PACKET_ID_FIRST)
+	if (pid < MT_PACKET_ID_NO_SKB)
 		return;
 
 	if (wcidx >= MT7915_WTBL_SIZE)
-- 
2.20.1


  parent reply	other threads:[~2021-08-04 13:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 13:44 [PATCH v5 01/11] mt76: add hash lookup for skb on TXS status_list greearb
2021-08-04 13:44 ` [PATCH v5 02/11] mt76: mt7915: fix potential NPE in TXS processing greearb
2021-08-04 13:44 ` [PATCH v5 03/11] mt76: mt7915: move TXS parsing to its own method greearb
2021-08-04 13:44 ` greearb [this message]
2021-08-13 17:13   ` [PATCH v5 04/11] mt76: mt7915: allow processing TXS for 'NO_SKB' pkt-ids Felix Fietkau
2021-08-04 13:44 ` [PATCH v5 05/11] mt76: mt7915: debugfs hook to enable TXS for NO_SKB pkt-ids greearb
2021-08-13 17:16   ` Felix Fietkau
2021-08-19 16:06   ` Kalle Valo
2021-08-19 16:08     ` Ben Greear
2021-10-11  9:28       ` Kalle Valo
2021-10-11 14:12         ` Ben Greear
2021-08-04 13:45 ` [PATCH v5 06/11] mt76: mt7915: add note about TXSFM 0x2 greearb
2021-08-04 13:45 ` [PATCH v5 07/11] mt76: mt7915: add support for tx-overrides greearb
2021-08-19 15:08   ` Kalle Valo
2021-08-19 16:16     ` Ben Greear
2021-08-04 13:45 ` [PATCH v5 08/11] mt76: mt7915: fix SGI reporting when using tx-overrides greearb
2021-08-04 13:45 ` [PATCH v5 09/11] mt76: mt7915: txfree status to show txcount instead of latency greearb
2021-08-04 13:45 ` [PATCH v5 10/11] mt76: mt7915: report tx-retries greearb
2021-08-04 13:45 ` [PATCH v5 11/11] mt76: mt7915: add a missing HT flag for GI parsing greearb
2021-08-13 16:50 ` [PATCH v5 01/11] mt76: add hash lookup for skb on TXS status_list Felix Fietkau
2021-08-13 17:28   ` Ben Greear
2021-08-13 17:46     ` Felix Fietkau
2021-08-13 18:01       ` Ben Greear

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=20210804134505.3208-4-greearb@candelatech.com \
    --to=greearb@candelatech.com \
    --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;
as well as URLs for NNTP newsgroup(s).