linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] mt76: mt7915: cache sgi in wcid.
@ 2021-11-18 16:45 greearb
  2021-11-18 16:45 ` [PATCH 2/8] mt76: mt7915: allow processing TXS for 'NO_SKB' pkt-ids greearb
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: greearb @ 2021-11-18 16:45 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

Explicitly cache short_gi and he_gi in wcid, don't try to store
it in the wcid.rate object.  Slightly less confusing and less fragile
when TXS starts parsing lots of frames.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---

This is actually the first series, not that one I posted a few minutes
ago.  txs, tx overrides and other things.  Rebased on top of 5.16

 drivers/net/wireless/mediatek/mt76/mt76.h       |  5 +++++
 drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 17 +++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index e2da720a91b6..7234703b3c60 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -245,7 +245,12 @@ struct mt76_wcid {
 	struct ewma_signal rssi;
 	int inactive_count;
 
+	/* cached rate, updated from mac_sta_poll() and from TXS callback logic,
+	 * in 7915 at least.
+	 */
 	struct rate_info rate;
+	bool rate_short_gi; /* cached HT/VHT short_gi, from mac_sta_poll() */
+	u8 rate_he_gi; /* cached HE GI, from mac_sta_poll() */
 
 	u16 idx;
 	u8 hw_key_idx;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index 5fcf35f2d9fb..61ade279b35d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -206,13 +206,19 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
 			u8 offs = 24 + 2 * bw;
 
 			rate->he_gi = (val & (0x3 << offs)) >> offs;
+			msta->wcid.rate_he_gi = rate->he_gi; /* cache for later */
 		} else if (rate->flags &
 			   (RATE_INFO_FLAGS_VHT_MCS | RATE_INFO_FLAGS_MCS)) {
-			if (val & BIT(12 + bw))
+			if (val & BIT(12 + bw)) {
 				rate->flags |= RATE_INFO_FLAGS_SHORT_GI;
-			else
+				msta->wcid.rate_short_gi = 1;
+			}
+			else {
 				rate->flags &= ~RATE_INFO_FLAGS_SHORT_GI;
+				msta->wcid.rate_short_gi = 0;
+			}
 		}
+		/* TODO:  Deal with HT_MCS */
 	}
 
 	rcu_read_unlock();
@@ -1411,7 +1417,7 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,
 			goto out;
 
 		rate.flags = RATE_INFO_FLAGS_MCS;
-		if (wcid->rate.flags & RATE_INFO_FLAGS_SHORT_GI)
+		if (wcid->rate_short_gi)
 			rate.flags |= RATE_INFO_FLAGS_SHORT_GI;
 		break;
 	case MT_PHY_TYPE_VHT:
@@ -1419,6 +1425,8 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,
 			goto out;
 
 		rate.flags = RATE_INFO_FLAGS_VHT_MCS;
+		if (wcid->rate_short_gi)
+			rate.flags |= RATE_INFO_FLAGS_SHORT_GI;
 		break;
 	case MT_PHY_TYPE_HE_SU:
 	case MT_PHY_TYPE_HE_EXT_SU:
@@ -1427,11 +1435,12 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,
 		if (rate.mcs > 11)
 			goto out;
 
-		rate.he_gi = wcid->rate.he_gi;
+		rate.he_gi = wcid->rate_he_gi;
 		rate.he_dcm = FIELD_GET(MT_TX_RATE_DCM, txrate);
 		rate.flags = RATE_INFO_FLAGS_HE_MCS;
 		break;
 	default:
+		WARN_ON_ONCE(true);
 		goto out;
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-11-19  7:17 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 16:45 [PATCH 1/8] mt76: mt7915: cache sgi in wcid greearb
2021-11-18 16:45 ` [PATCH 2/8] mt76: mt7915: allow processing TXS for 'NO_SKB' pkt-ids greearb
2021-11-18 16:45 ` [PATCH 3/8] mt76: mt7915: debugfs hook to enable TXS for NO_SKB pkt-ids greearb
2021-11-18 16:45 ` [PATCH 4/8] mt76: mt7915: add note about TXSFM 0x2 greearb
2021-11-18 17:02   ` Ryder Lee
2021-11-18 17:06     ` Ben Greear
2021-11-18 16:45 ` [PATCH 5/8] mt76: mt7915: txfree status to show txcount instead of latency greearb
2021-11-18 16:45 ` [PATCH 6/8] mt76: mt7915: report tx-retries greearb
2021-11-18 17:19   ` Ryder Lee
2021-11-18 17:26     ` Ben Greear
2021-11-18 16:45 ` [PATCH 7/8] mt76: mt7915: add support for tx-overrides greearb
2021-11-19  7:16   ` kernel test robot
2021-11-18 16:45 ` [PATCH 8/8] mt76: mt7915: fix SGI reporting when using tx-overrides greearb
2021-11-18 17:06 ` [PATCH 1/8] mt76: mt7915: cache sgi in wcid Ryder Lee
2021-11-18 17:10   ` Ben Greear
2021-11-18 17:20     ` Ryder Lee

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).