All of lore.kernel.org
 help / color / mirror / Atom feed
From: greearb@candelatech.com
To: linux-wireless@vger.kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Subject: [PATCH v3 06/11] mt76: mt7915:  Support parsing TXSFM 0x2.
Date: Fri, 23 Jul 2021 09:06:18 -0700	[thread overview]
Message-ID: <20210723160623.14709-6-greearb@candelatech.com> (raw)
In-Reply-To: <20210723160623.14709-1-greearb@candelatech.com>

From: Ben Greear <greearb@candelatech.com>

Add code to support this format, but I don't actually
see any of these TXS format frames on my test system.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 .../net/wireless/mediatek/mt76/mt7915/mac.c   | 24 +++++++++++--------
 .../net/wireless/mediatek/mt76/mt7915/mac.h   |  3 +++
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index d81e3cbe1aad..03c85bd0750e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -1317,13 +1317,10 @@ mt7915_mac_parse_txs(struct mt7915_dev *dev, struct mt76_wcid *wcid,
 {
 	struct ieee80211_supported_band *sband;
 	struct mt76_phy *mphy;
-	u32 txrate, txs, txs5, txs6, txs7, mode;
+	u32 txrate, txs, mode;
 	bool cck = false;
 
 	txs = le32_to_cpu(txs_data[0]);
-	txs5 = le32_to_cpu(txs_data[5]);
-	txs6 = le32_to_cpu(txs_data[6]);
-	txs7 = le32_to_cpu(txs_data[7]);
 
 	if (!(txs & MT_TXS0_ACK_ERROR_MASK))
 		info->flags |= IEEE80211_TX_STAT_ACK;
@@ -1334,10 +1331,6 @@ mt7915_mac_parse_txs(struct mt7915_dev *dev, struct mt76_wcid *wcid,
 
 	info->status.rates[0].idx = -1;
 
-	stats->tx_mpdu_attempts += FIELD_GET(MT_TXS5_F1_MPDU_TX_COUNT, txs5);
-	stats->tx_mpdu_fail += FIELD_GET(MT_TXS6_F1_MPDU_FAIL_COUNT, txs6);
-	stats->tx_mpdu_retry += FIELD_GET(MT_TXS7_F1_MPDU_RETRY_COUNT, txs7);
-
 	txrate = FIELD_GET(MT_TXS0_TX_RATE, txs);
 
 	rate->mcs = FIELD_GET(MT_TX_RATE_IDX, txrate);
@@ -1425,6 +1418,19 @@ mt7915_mac_parse_txs(struct mt7915_dev *dev, struct mt76_wcid *wcid,
 		stats->tx_bw[0]++;
 		break;
 	}
+
+	if (FIELD_GET(MT_TXS0_TXS_FORMAT, txs) == 2) {
+		/* TXSFM == 10 */
+		u32 txs5, txs6, txs7;
+
+		txs5 = le32_to_cpu(txs_data[5]);
+		txs6 = le32_to_cpu(txs_data[6]);
+		txs7 = le32_to_cpu(txs_data[7]);
+
+		stats->tx_mpdu_attempts += FIELD_GET(MT_TXS5_F1_MPDU_TX_COUNT, txs5);
+		stats->tx_mpdu_fail += FIELD_GET(MT_TXS6_F1_MPDU_FAIL_COUNT, txs6);
+		stats->tx_mpdu_retry += FIELD_GET(MT_TXS7_F1_MPDU_RETRY_COUNT, txs7);
+	}
 }
 
 static void
@@ -1476,8 +1482,6 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)
 	u8 pid;
 
 	txs = le32_to_cpu(txs_data[0]);
-	if (FIELD_GET(MT_TXS0_TXS_FORMAT, txs) > 1)
-		return;
 
 	txs = le32_to_cpu(txs_data[2]);
 	wcidx = FIELD_GET(MT_TXS2_WCID, txs);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.h b/drivers/net/wireless/mediatek/mt76/mt7915/mac.h
index ccce994dc07a..986a65badd1b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.h
@@ -347,6 +347,9 @@ struct mt7915_tx_free {
 
 #define MT_TXS4_TIMESTAMP		GENMASK(31, 0)
 
+/* The F0 variables are for TXSFM 0x0 and 0x1.  The F1 variables
+ * are for TXSFM 0x2 aka PPDU format.
+ */
 #define MT_TXS5_F0_FINAL_MPDU		BIT(31)
 #define MT_TXS5_F0_QOS			BIT(30)
 #define MT_TXS5_F0_TX_COUNT		GENMASK(29, 25)
-- 
2.20.1


  parent reply	other threads:[~2021-07-23 16:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 16:06 [PATCH v3 01/11] mt76: add hash lookup for skb on TXS status_list greearb
2021-07-23 16:06 ` [PATCH v3 02/11] mt76 - mt7915: Fix potential NPE in TXS processing greearb
2021-07-23 16:06 ` [PATCH v3 03/11] mt76 - mt7915: Move TXS parsing to its own method greearb
2021-07-23 16:06 ` [PATCH v3 04/11] mt76 - mt7915: Allow processing TXS for 'NO_SKB' pkt-ids greearb
2021-07-23 16:06 ` [PATCH v3 05/11] mt76: mt7915: debugfs hook to enable TXS for NO_SKB pkt-ids greearb
2021-07-23 16:06 ` greearb [this message]
2021-07-23 16:06 ` [PATCH v3 07/11] mt76: mt7915: Add support for tx-overrides greearb
2021-07-23 16:06 ` [PATCH v3 08/11] mt76: mt7915: Fix SGI reporting when using tx-overrides greearb
2021-07-23 16:06 ` [PATCH v3 09/11] mt76: mt7915: txfree status to show txcount instead of latency greearb
2021-07-23 16:06 ` [PATCH v3 10/11] mt76: mt7915: Report tx-retries greearb
2021-07-23 16:06 ` [PATCH v3 11/11] mt76: mt7915: add a missing HT flag for GI parsing greearb

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=20210723160623.14709-6-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.