From: greearb@candelatech.com
To: linux-wireless@vger.kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Subject: [PATCH 02/12] wifi: mt76: mt7915: cache sgi in wcid.
Date: Wed, 25 Oct 2023 12:03:44 -0700 [thread overview]
Message-ID: <20231025190351.2141832-2-greearb@candelatech.com> (raw)
In-Reply-To: <20231025190351.2141832-1-greearb@candelatech.com>
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>
---
drivers/net/wireless/mediatek/mt76/mt76.h | 5 +++++
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 6 ++++--
drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 9 +++++++--
drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 9 +++++++--
4 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index ea828ba0b83a..9b30d4aab952 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -316,8 +316,13 @@ 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;
unsigned long ampdu_state;
+ 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/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
index 93402d2c2538..c080b60327b1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
@@ -657,7 +657,7 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
return false;
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:
@@ -665,6 +665,8 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
return false;
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:
@@ -673,7 +675,7 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid,
if (rate.mcs > 11)
return false;
- 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;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index 2222fb9aa103..488faeb44e76 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -202,12 +202,16 @@ 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;
+ }
}
/* get signal strength of resp frames (CTS/BA/ACK) */
@@ -2115,6 +2119,7 @@ mt7915_dfs_init_radar_specs(struct mt7915_phy *phy)
radar_specs = &jp_radar_specs;
break;
default:
+ WARN_ON_ONCE(true);
return -EINVAL;
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index 867e14f6b93a..90e738126bf7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -137,12 +137,17 @@ static void mt7921_mac_sta_poll(struct mt792x_dev *dev)
u8 offs = MT_WTBL_TXRX_RATE_G2_HE + 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(MT_WTBL_TXRX_RATE_G2 + bw))
+ if (val & BIT(MT_WTBL_TXRX_RATE_G2 + 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;
+ }
}
/* get signal strength of resp frames (CTS/BA/ACK) */
--
2.40.0
next prev parent reply other threads:[~2023-10-25 19:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 19:03 [PATCH 01/12] wifi: mt76: mt7915: print out hw revision greearb
2023-10-25 19:03 ` greearb [this message]
2023-10-25 19:03 ` [PATCH 03/12] wifi: mt76: mt7915: allow processing TXS for 'NO_SKB' pkt-ids greearb
2023-10-25 19:03 ` [PATCH 04/12] wifi: mt76: mt7915: debugfs hook to enable TXS for NO_SKB pkt-ids greearb
2023-10-25 19:03 ` [PATCH 05/12] wifi: mt76: mt7915: report tx-retries greearb
2023-10-25 19:03 ` [PATCH 06/12] wifi: mt76: mt7915: add support for tx-overrides greearb
2023-10-25 19:03 ` [PATCH 07/12] wifi: mt76: mt7915: support enabling rx group-5 status greearb
2023-10-25 19:03 ` [PATCH 08/12] wifi: mt76: mt7915: use nss for calculating rx-chains greearb
2023-10-25 19:03 ` [PATCH 09/12] wifi: mt76: mt7915: ethtool group-5 rx stats information 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=20231025190351.2141832-2-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).