mt76: mt7915: cache sgi in wcid.
Subsystems (2)
PATCH 1/8 mt76: mt7915: cache sgi in wcid.
From: Ben Greear <[email protected]>
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.
---
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(-)
drivers/net/wireless/mediatek/mt76/mt76.h +5 -0
@@ -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;
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +13 -4
@@ -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; }
Signature · 1 line
2.20.1
PATCH 2/8 mt76: mt7915: allow processing TXS for 'NO_SKB' pkt-ids
From: Ben Greear <[email protected]>
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.
--- .../net/wireless/mediatek/mt76/mt7915/mac.c | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +22 -16
@@ -1361,26 +1361,31 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,struct ieee80211_tx_info *info;struct sk_buff_head list;struct rate_info rate = {}; -struct sk_buff *skb; +struct sk_buff *skb =NULL ; +bool check_status;bool cck = false;u32 txrate, txs, mode; -mt76_tx_status_lock (mdev, &list); - skb =mt76_tx_status_skb_get (mdev, wcid, pid, &list); -if (!skb) - goto out_no_skb; + check_status = (pid >=MT_PACKET_ID_FIRST ); + +if (check_status) { +mt76_tx_status_lock (mdev, &list); + skb =mt76_tx_status_skb_get (mdev, wcid, pid, &list); + } txs =le32_to_cpu (txs_data[0 ]); - info =IEEE80211_SKB_CB (skb); -if (!(txs &MT_TXS0_ACK_ERROR_MASK )) - info->flags |=IEEE80211_TX_STAT_ACK ; +if (skb) { + info =IEEE80211_SKB_CB (skb); +if (!(txs &MT_TXS0_ACK_ERROR_MASK )) + info->flags |=IEEE80211_TX_STAT_ACK ; - info->status.ampdu_len =1 ; - info->status.ampdu_ack_len = !!(info->flags & -IEEE80211_TX_STAT_ACK ); + info->status.ampdu_len =1 ; + info->status.ampdu_ack_len = !!(info->flags & +IEEE80211_TX_STAT_ACK ); - info->status.rates[0 ].idx =-1 ; + info->status.rates[0 ].idx =-1 ; + } txrate =FIELD_GET (MT_TXS0_TX_RATE , txs);
@@ -1467,10 +1472,11 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid, wcid->rate = rate; out: -mt76_tx_status_skb_done (mdev, skb, &list); +if (skb) +mt76_tx_status_skb_done (mdev, skb, &list); -out_no_skb: -mt76_tx_status_unlock (mdev, &list); +if (check_status) +mt76_tx_status_unlock (mdev, &list);return !!skb; }
@@ -1494,7 +1500,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 )
Signature · 1 line
2.20.1
PATCH 3/8 mt76: mt7915: debugfs hook to enable TXS for NO_SKB pkt-ids
In reply to [email protected]From: Ben Greear <[email protected]>
This lets user turn on/off this feature. Enabling gives better tx-rate related stats, but will cause extra driver and (maybe) firmware work. Not sure if it actually affects performance or not.
--- .../wireless/mediatek/mt76/mt7915/debugfs.c | 24 +++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7915/mac.c | 3 ++- .../wireless/mediatek/mt76/mt7915/mt7915.h | 5 ++++ 3 files changed, 31 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +24 -0
@@ -190,6 +190,29 @@ mt7915_fw_util_wa_show(struct seq_file *file, void *data)DEFINE_SHOW_ATTRIBUTE (mt7915_fw_util_wa); +static int +mt7915_txs_for_no_skb_set (void *data,u64 val) +{ +struct mt7915_dev *dev = data; + + dev->txs_for_no_skb_enabled = !!val; + +return 0 ; +} + +static int +mt7915_txs_for_no_skb_get (void *data,u64 *val) +{ +struct mt7915_dev *dev = data; + + *val = dev->txs_for_no_skb_enabled; + +return 0 ; +} + +DEFINE_DEBUGFS_ATTRIBUTE (fops_txs_for_no_skb, mt7915_txs_for_no_skb_get, + mt7915_txs_for_no_skb_set,"%lld\n" ); +static void mt7915_ampdu_stat_read_phy (struct mt7915_phy *phy,struct seq_file *file)
@@ -540,6 +563,7 @@ int mt7915_init_debugfs(struct mt7915_phy *phy) &mt7915_fw_util_wm_fops);debugfs_create_file ("fw_util_wa" ,0400 , dir, dev, &mt7915_fw_util_wa_fops); +debugfs_create_file ("force_txs" ,0600 , dir, dev, &fops_txs_for_no_skb);debugfs_create_file ("implicit_txbf" ,0600 , dir, dev, &fops_implicit_txbf); debugfs_create_file("txpower_sku", 0400, dir, phy,
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +2 -1
@@ -1096,7 +1096,8 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi, txwi[4 ] =0 ; val =FIELD_PREP (MT_TXD5_PID , pid); -if (pid >=MT_PACKET_ID_FIRST ) +if (pid >=MT_PACKET_ID_FIRST || + (pid ==MT_PACKET_ID_NO_SKB && dev->txs_for_no_skb_enabled)) val |=MT_TXD5_TX_STATUS_HOST ; txwi[5 ] =cpu_to_le32 (val);
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +5 -0
@@ -254,6 +254,11 @@ struct mt7915_dev {u16 chainmask;u32 hif_idx; +/* Should we request TXS for MT_PACKET_ID_NO_SKB? Doing so gives better +* costs but causes a great deal more TXS packet processing by driver and +* creation by firmware, so may be a performance drag. +*/ +bool txs_for_no_skb_enabled;struct work_struct init_work;struct work_struct rc_work;
Signature · 1 line
2.20.1
PATCH 4/8 mt76: mt7915: add note about TXSFM 0x2
In reply to [email protected]From: Ben Greear <[email protected]>
This format needs a special command to enable, and is not enabled by default.
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/mac.h +3 -0
@@ -348,6 +348,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)
Signature · 1 line
2.20.1
Ryder Lee
maintainerRe: [PATCH 4/8] mt76: mt7915: add note about TXSFM 0x2
Quoted 16 lines · On Thu, 2021-11-18 at 08:45 -0800, [email protected] wrote:
From: Ben Greear <[email protected]>
This format needs a special command to enable, and is not enabled by default.
Signed-off-by Ben Greear <[email protected]>--- drivers/net/wireless/mediatek/mt76/mt7915/mac.h | 3 +++ 1 file changed, 3 insertions(+)drivers/net/wireless/mediatek/mt76/mt7915/mac.h +0
-0
drivers/net/wireless/mediatek/mt76/mt7915/mac.h struct mt7915_tx_free { · line 356
Quoted 9 lines
drivers/net/wireless/mediatek/mt76/mt7915/mac.h +3
-0@@ -348,6 +348,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)
Now that we don't need it why should it needs a special command.
Ryder
Re: [PATCH 4/8] mt76: mt7915: add note about TXSFM 0x2
Quoted 20 lines · Ryder Lee
Quoted 19 lines · On Thu, 2021-11-18 at 08:45 -0800, [email protected] wrote:
From: Ben Greear <[email protected]>
This format needs a special command to enable, and is not enabled by default.
Signed-off-by Ben Greear <[email protected]>--- drivers/net/wireless/mediatek/mt76/mt7915/mac.h | 3 +++ 1 file changed, 3 insertions(+)drivers/net/wireless/mediatek/mt76/mt7915/mac.h +0
-0@@ -348,6 +348,9 @@ struct mt7915_tx_free {#define MT_TXS4_TIMESTAMP GENMASK(31, 0)
Quoted 8 lines
drivers/net/wireless/mediatek/mt76/mt7915/mac.h struct mt7915_tx_free { · line 356
Quoted 6 lines
drivers/net/wireless/mediatek/mt76/mt7915/mac.h +3
-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)Now that we don't need it why should it needs a special command.
It can be hard for a new developer to the driver to understand the firmware API, so a comment could save the next person to look at this some time and trouble.
Thanks,
Ben
Quoted 3 lines
Ryder
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
PATCH 5/8 mt76: mt7915: txfree status to show txcount instead of latency
In reply to [email protected]From: Ben Greear <[email protected]>
Latency is not obviously that useful, but txcount can let us deduce retries, which may be more interesting.
--- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt7915/mac.h | 8 +++++--- drivers/net/wireless/mediatek/mt76/mt7915/regs.h | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/init.c +3 -0
@@ -401,6 +401,9 @@ static void mt7915_mac_init(struct mt7915_dev *dev)/* enable hardware de-agg */ mt76_set (dev,MT_MDP_DCR0 ,MT_MDP_DCR0_DAMSDU_EN ); +/* disable Tx latency report to enable Tx count in txfree path */ +mt76_clear (dev,MT_PLE_HOST_RPT0 ,MT_PLE_HOST_RPT0_TX_LATENCY ); +for (i =0 ; i <MT7915_WTBL_SIZE ; i++)mt7915_mac_wtbl_update (dev, i,MT_WTBL_UPDATE_ADM_COUNT_CLEAR );
drivers/net/wireless/mediatek/mt76/mt7915/mac.h +5 -3
@@ -305,13 +305,15 @@ struct mt7915_tx_free {#define MT_TX_FREE_MSDU_CNT GENMASK(9, 0)#define MT_TX_FREE_WLAN_ID GENMASK(23, 14) +/* when configured for txfree latency mode. See MT_PLE_HOST_RPT0_TX_LATENCY +* Not enabled by default now. +*/ #define MT_TX_FREE_LATENCY GENMASK(12, 0) -/* 0: success, others: dropped */ +/* when configured for txcount mode. See MT_PLE_HOST_RPT0_TX_LATENCY. */ +#define MT_TX_FREE_TXCNT GENMASK(12, 0)#define MT_TX_FREE_STATUS GENMASK(14, 13)#define MT_TX_FREE_MSDU_ID GENMASK(30, 16)#define MT_TX_FREE_PAIR BIT(31) -/* will support this field in further revision */ -#define MT_TX_FREE_RATE GENMASK(13, 0)#define MT_TXS0_FIXED_RATE BIT(31)#define MT_TXS0_BW GENMASK(30, 29)
drivers/net/wireless/mediatek/mt76/mt7915/regs.h +8 -0
@@ -22,6 +22,14 @@#define MT_PLE_BASE 0x8000#define MT_PLE (ofs) (MT_PLE_BASE + (ofs)) +/* Modify whether txfree struct returns latency or txcount. */ +#define MT_PLE_HOST_RPT0 MT_PLE(0x030) +#define MT_PLE_HOST_RPT0_TX_LATENCY BIT(3) + +#define MT_PLE_FL_Q0_CTRL MT_PLE(0x1b0) +#define MT_PLE_FL_Q1_CTRL MT_PLE(0x1b4) +#define MT_PLE_FL_Q2_CTRL MT_PLE(0x1b8) +#define MT_FL_Q_EMPTY 0x0b0#define MT_FL_Q0_CTRL 0x1b0#define MT_FL_Q2_CTRL 0x1b8
Signature · 1 line
2.20.1
PATCH 6/8 mt76: mt7915: report tx-retries
In reply to [email protected]From: Ben Greear <[email protected]>
mac80211 stack will only report tx-status for skb claiming to be ampdu heads, so lie a bit in mt7915 and set the flag so that mac80211 will record status for each skb.
mt7915 appears to report retry status on an individual per-skb manner, so that method above seems to work.
Re-constitute the txinfo status rate info so that the rix and flags is also at least close to correct. No direct way to report HE rates that way, so mac80211 might could use some tweaking in the ieee80211_tx_status_ext to take both info and status->rate into account.
--- drivers/net/wireless/mediatek/mt76/mac80211.c | 4 + drivers/net/wireless/mediatek/mt76/mt76.h | 5 + .../net/wireless/mediatek/mt76/mt7915/init.c | 1 + .../net/wireless/mediatek/mt76/mt7915/mac.c | 93 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7915/mac.h | 4 +- .../net/wireless/mediatek/mt76/mt7915/main.c | 4 + drivers/net/wireless/mediatek/mt76/tx.c | 6 +- 7 files changed, 110 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt76/mac80211.c +4 -0
@@ -1517,6 +1517,10 @@ void mt76_ethtool_worker(struct mt76_ethtool_worker_info *wi, wi->sta_count++; + data[ei++] += stats->tx_mpdu_attempts; + data[ei++] += stats->tx_mpdu_fail; + data[ei++] += stats->tx_mpdu_retry; + data[ei++] += stats->tx_mpdu_ok; data[ei++] += stats->tx_mode[MT_PHY_TYPE_CCK ]; data[ei++] += stats->tx_mode[MT_PHY_TYPE_OFDM ]; data[ei++] += stats->tx_mode[MT_PHY_TYPE_HT ];
drivers/net/wireless/mediatek/mt76/mt76.h +5 -0
@@ -785,6 +785,11 @@ enum mt76_phy_type { };struct mt76_sta_stats { +unsigned long tx_mpdu_attempts;/* counting any retries */ +unsigned long tx_mpdu_fail;/* frames that failed even after retry */ +unsigned long tx_mpdu_ok;/* frames that succeeded, +perhaps after retry */ +unsigned long tx_mpdu_retry;/* number of times frames were retried */ u64 tx_mode[__MT_PHY_TYPE_HE_MAX];u64 tx_bw[4 ];/* 20, 40, 80, 160 */ u64 tx_nss[4 ];/* 1, 2, 3, 4 */
drivers/net/wireless/mediatek/mt76/mt7915/init.c +1 -0
@@ -311,6 +311,7 @@ mt7915_init_wiphy(struct ieee80211_hw *hw)struct wiphy *wiphy = hw->wiphy; hw->queues =4 ; + hw->max_report_rates =1 ; hw->max_rx_aggregation_subframes =IEEE80211_MAX_AMPDU_BUF ; hw->max_tx_aggregation_subframes =IEEE80211_MAX_AMPDU_BUF ; hw->netdev_features =NETIF_F_RXCSUM ;
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +88 -5
141 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7915/mac.h +3 -1
@@ -300,7 +300,7 @@ struct mt7915_tx_free {__le16 ctrl;u8 txd_cnt;u8 rsv[3 ]; -__le32 info[]; +__le32 info[];/* DW3+ */ } __packed__aligned(4) ;#define MT_TX_FREE_MSDU_CNT GENMASK(9, 0)
@@ -312,6 +312,8 @@ struct mt7915_tx_free {/* when configured for txcount mode. See MT_PLE_HOST_RPT0_TX_LATENCY. */ #define MT_TX_FREE_TXCNT GENMASK(12, 0)#define MT_TX_FREE_STATUS GENMASK(14, 13) +/* 0: not MPDU, 1: MSDU is head pkt of TXD page (MPDU) */ +#define MT_TX_FREE_HEAD_OF_PAGE BIT(15)#define MT_TX_FREE_MSDU_ID GENMASK(30, 16)#define MT_TX_FREE_PAIR BIT(31)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +4 -0
@@ -1140,6 +1140,10 @@ static const char mt7915_gstrings_stats[][ETH_GSTRING_LEN] = {"rx_ba_cnt" ,/* per vif counters */ +"v_tx_mpdu_attempts" ,/* counting any retries */ +"v_tx_mpdu_fail" ,/* frames that failed even after retry */ +"v_tx_mpdu_retry" ,/* number of times frames were retried */ +"v_tx_mpdu_ok" ,/* frames that succeeded, perhaps after retry */ "v_tx_mode_cck" ,"v_tx_mode_ofdm" , "v_tx_mode_ht",
drivers/net/wireless/mediatek/mt76/tx.c +5 -1
@@ -229,6 +229,7 @@ void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *struct ieee80211_tx_status status = { .skb = skb, .free_list = free_list, + .info =IEEE80211_SKB_CB (skb), };struct mt76_wcid *wcid =NULL ;struct ieee80211_hw *hw;
@@ -236,8 +237,11 @@ void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *rcu_read_lock (); -if (wcid_idx <ARRAY_SIZE (dev->wcid)) +if (wcid_idx <ARRAY_SIZE (dev->wcid)) { wcid =rcu_dereference (dev->wcid[wcid_idx]); +if (wcid) + status.rate = &wcid->rate; + }mt76_tx_check_non_aql (dev, wcid, skb);
Signature · 1 line
2.20.1
Ryder Lee
maintainerRe: [PATCH 6/8] mt76: mt7915: report tx-retries
Quoted 158 lines · On Thu, 2021-11-18 at 08:45 -0800, [email protected] wrote:
From: Ben Greear <[email protected]>
mac80211 stack will only report tx-status for skb claiming to be ampdu heads,
so lie a bit in mt7915 and set the flag so that mac80211 will record status
for each skb.mt7915 appears to report retry status on an individual per-skb manner,
so that method above seems to work.Re-constitute the txinfo status rate info so that the rix and flags is also at least close to correct. No direct way to report HE rates that way, so mac80211 might could use some tweaking in the
ieee80211_tx_status_extto take both info andstatus->rateinto account.Signed-off-by Ben Greear <[email protected]>--- drivers/net/wireless/mediatek/mt76/mac80211.c | 4 + drivers/net/wireless/mediatek/mt76/mt76.h | 5 + .../net/wireless/mediatek/mt76/mt7915/init.c | 1 + .../net/wireless/mediatek/mt76/mt7915/mac.c | 93 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7915/mac.h | 4 +- .../net/wireless/mediatek/mt76/mt7915/main.c | 4 + drivers/net/wireless/mediatek/mt76/tx.c | 6 +- 7 files changed, 110 insertions(+), 7 deletions(-)drivers/net/wireless/mediatek/mt76/mac80211.c +4
-0@@ -1517,6 +1517,10 @@ void mt76_ethtool_worker(struct mt76_ethtool_worker_info *wi, wi->sta_count++; + data[ei++] += stats->tx_mpdu_attempts; + data[ei++] += stats->tx_mpdu_fail; + data[ei++] += stats->tx_mpdu_retry; + data[ei++] += stats->tx_mpdu_ok; data[ei++] += stats->tx_mode[MT_PHY_TYPE_CCK ]; data[ei++] += stats->tx_mode[MT_PHY_TYPE_OFDM ];drivers/net/wireless/mediatek/mt76/mac80211.c +0
-0data[ei++] += stats->tx_mode[MT_PHY_TYPE_HT ];drivers/net/wireless/mediatek/mt76/mt76.h +2
-0@@ -785,6 +785,11 @@ enum mt76_phy_type { };struct mt76_sta_stats { +unsigned long tx_mpdu_attempts;/* counting any retries */ +unsigned long tx_mpdu_fail;/* frames that failed even after retry */
drivers/net/wireless/mediatek/mt76/mt76.h +3
-0+unsigned long tx_mpdu_ok;/* frames that succeeded, +perhaps after retry */ +unsigned long tx_mpdu_retry;/* number of times frames were retried */
drivers/net/wireless/mediatek/mt76/mt76.h +0
-0u64 tx_mode[__MT_PHY_TYPE_HE_MAX];u64 tx_bw[4 ];/* 20, 40, 80, 160 */ u64 tx_nss[4 ];/* 1, 2, 3, 4 */ drivers/net/wireless/mediatek/mt76/mt7915/init.c +1
-0@@ -311,6 +311,7 @@ mt7915_init_wiphy(struct ieee80211_hw *hw)struct wiphy *wiphy = hw->wiphy; hw->queues =4 ; + hw->max_report_rates =1 ; hw->max_rx_aggregation_subframes =IEEE80211_MAX_AMPDU_BUF ; hw->max_tx_aggregation_subframes =IEEE80211_MAX_AMPDU_BUF ; hw->netdev_features =NETIF_F_RXCSUM ;drivers/net/wireless/mediatek/mt76/mt7915/mac.c +6
-1@@ -1246,17 +1246,22 @@ mt7915_txp_skb_unmap(struct mt76_dev *dev, struct mt76_txwi_cache *t)static void mt7915_txwi_free(struct mt7915_dev *dev, struct mt76_txwi_cache *t, -struct ieee80211_sta *sta,struct list_head *free_list) + struct ieee80211_sta *sta, struct list_head *free_list, + u32 tx_cnt, u32 tx_status, u32 ampdu) { struct mt76_dev *mdev = &dev->mt76;struct mt76_wcid *wcid;__le32 *txwi;u16 wcid_idx; +struct ieee80211_tx_info *info; +struct ieee80211_tx_rate *rate;mt7915_txp_skb_unmap (mdev, t);if (!t->skb) goto out; +rcu_read_lock ();/* protect wcid access */ +drivers/net/wireless/mediatek/mt76/mt7915/mac.c +15
-0txwi = (__le32 *)mt76_get_txwi_ptr (mdev, t);if (sta) { wcid = (struct mt76_wcid *)sta->drv_priv;@@ -1266,6 +1271,75 @@ mt7915_txwi_free(struct mt7915_dev *dev,struct mt76_txwi_cache *t,mt7915_tx_check_aggr (sta ,txwi ); }else { wcid_idx =FIELD_GET (MT_TXD1_WLAN_IDX ,le32_to_cpu (txwi[1 ])); + wcid =rcu_dereference (mdev->wcid[wcid_idx]); + } + + info =IEEE80211_SKB_CB (t->skb); + +/* Cannot clear all of info->status, we need the driver private +* status intact. +*/ + info->status.is_valid_ack_signal =0 ; + + rate = &info->status.rates[0 ]; + rate->idx =-1 ;/* will over-write below if we found wcid */ + info->status.rates[1 ].idx =-1 ;/* terminate rate list */ + +/* force TX_STAT_AMPDU to be set, or mac80211 will ignore status */
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +2
-0+if (ampdu || (info->flags &IEEE80211_TX_CTL_AMPDU )) { + info->flags |= IEEE80211_TX_STAT_AMPDU |
IEEE80211_TX_CTL_AMPDU;drivers/net/wireless/mediatek/mt76/mt7915/mac.c +8
-0+ info->status.ampdu_len =1 ; + } + +/* update info status based on cached wcid rate info since +* txfree path doesn't give us a lot of info. +*/ +if (wcid) { + struct mt7915_sta *msta = container_of(wcid, struct
mt7915_sta, wcid);drivers/net/wireless/mediatek/mt76/mt7915/mac.c +5
-0+struct mt76_sta_stats *stats = &msta->stats; + +if (wcid->rate.flags &RATE_INFO_FLAGS_MCS ) { + rate->flags |=IEEE80211_TX_RC_MCS ; + rate->idx = wcid->rate.mcs + wcid->rate.nss *8;
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +1
-0+ }else if (wcid->rate.flags &RATE_INFO_FLAGS_VHT_MCS ){
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +2
-0+ rate->flags |=IEEE80211_TX_RC_VHT_MCS ; + rate->idx = (wcid->rate.nss << 4) | wcid-Quoted 1 line
rate.mcs;
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +2
-0+ }else if (wcid->rate.flags &RATE_INFO_FLAGS_HE_MCS ) { + rate->idx = (wcid->rate.nss << 4) | wcid-
Quoted 1 line
Quoted 1 line
rate.mcs;
Can ieee80211_tx_rate tell HE rate apart now?
Ryder
Re: [PATCH 6/8] mt76: mt7915: report tx-retries
Quoted 21 lines · Ryder Lee
Quoted 19 lines · On Thu, 2021-11-18 at 08:45 -0800, [email protected] wrote:
From: Ben Greear <[email protected]>
mac80211 stack will only report tx-status for skb claiming to be ampdu heads,
so lie a bit in mt7915 and set the flag so that mac80211 will record status
for each skb.mt7915 appears to report retry status on an individual per-skb manner,
so that method above seems to work.Re-constitute the txinfo status rate info so that the rix and flags is also at least close to correct. No direct way to report HE rates that way, so mac80211 might could use some tweaking in the
ieee80211_tx_status_extto take both info andstatus->rateinto account.Signed-off-by Ben Greear <[email protected]>
Quoted 8 lines
Quoted 6 lines
(quoted diff) +2
-0+ rate->flags |= IEEE80211_TX_RC_VHT_MCS; + rate->idx = (wcid->rate.nss << 4) | wcid-Quoted 1 line
rate.mcs;
(quoted diff) +2
-0+ } else if (wcid->rate.flags & RATE_INFO_FLAGS_HE_MCS) { + rate->idx = (wcid->rate.nss << 4) | wcid-Quoted 1 line
rate.mcs;
Can
ieee80211_tx_ratetell HE rate apart now?
Upstream code cannot, but it has other ways of dealing with HE rates, and this patch does not break that as far as I can tell.
Thanks,
Ben
Quoted 4 lines
Ryder
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
PATCH 7/8 mt76: mt7915: add support for tx-overrides
In reply to [email protected]From: Ben Greear <[email protected]>
Allow setting fix rate on transmit without using full testmode logic.
txpower, dynbw, retry count is not currently supported. And, probably later need additional logic to not apply this txo to non-data frames and to smaller frames, to allow ARP and such to go through while also forcing test data frames to arbitrary tx-rates (rates which very well may not be received by peer.)
--- drivers/net/wireless/mediatek/mt76/mt76.h | 4 + .../wireless/mediatek/mt76/mt7915/debugfs.c | 224 ++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7915/mac.c | 98 ++++++-- .../wireless/mediatek/mt76/mt7915/mt7915.h | 2 + 4 files changed, 302 insertions(+), 26 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76.h +4 -0
@@ -577,6 +577,7 @@ struct mt76_testmode_ops {struct mt76_testmode_data {enum mt76_testmode_state state; +u8 txo_active;/* tx overrides are active */ u32 param_set[DIV_ROUND_UP (NUM_MT76_TM_ATTRS ,32 )];struct sk_buff *tx_skb;
@@ -591,6 +592,9 @@ struct mt76_testmode_data {u8 tx_rate_ldpc;u8 tx_rate_stbc;u8 tx_ltf; +u8 txbw;/* specify TX bandwidth: 0 20Mhz, 1 40Mhz, 2 80Mhz, 3 160Mhz */ +u8 tx_xmit_count;/* 0 means no-ack, 1 means one transmit, etc */ +u8 tx_dynbw;/* 0: dynamic bw disabled, 1: dynamic bw enabled */ u8 tx_antenna_mask;u8 tx_spe_idx;
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +224 -0
236 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +72 -26
142 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +2 -0
@@ -103,6 +103,8 @@ struct mt7915_sta {struct mt7915_sta_key_conf bip; +struct mt76_testmode_data test; +struct {u8 flowid_mask;struct mt7915_twt_flow flow[MT7915_MAX_STA_TWT_AGRT ];
Signature · 1 line
2.20.1
kernel test robot
build botRe: [PATCH 7/8] mt76: mt7915: add support for tx-overrides
Thank you for the patch! Yet something to improve:
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on kvalo-wireless-drivers-next/master] [also build test ERROR on v5.16-rc1 next-20211118]
[cannot apply to kvalo-wireless-drivers/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/greearb-candelatech-com/mt76-mt7915-cache-sgi-in-wcid/20211119-005421 base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master config: microblaze-buildonly-randconfig-r005-20211119 (attached as .config) compiler: microblaze-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/c742cd1ffffaeff7ab79835466b08fd5616cdce3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review greearb-candelatech-com/mt76-mt7915-cache-sgi-in-wcid/20211119-005421
git checkout c742cd1ffffaeff7ab79835466b08fd5616cdce3
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=microblaze SHELL=/bin/bash drivers/net/wireless/
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/net/wireless/mediatek/mt76/mt7915/mac.c: In function 'mt7915_mac_write_txwi_tm':
>> drivers/net/wireless/mediatek/mt76/mt7915/mac.c:778:37: error: 'struct mt76_phy' has no member named 'test'
778 | if (skb != phy->mt76->test.tx_skb)
| ^~
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:780:32: error: 'struct mt76_phy' has no member named 'test'
780 | td = &phy->mt76->test;
| ^~
In file included from include/linux/byteorder/little_endian.h:5,
from arch/microblaze/include/uapi/asm/byteorder.h:6,
from include/asm-generic/bitops/le.h:7,
from include/asm-generic/bitops.h:36,
from ./arch/microblaze/include/generated/asm/bitops.h:1,
from include/linux/bitops.h:33,
from include/linux/kernel.h:12,
from include/linux/skbuff.h:13,
from include/linux/if_ether.h:19,
from include/linux/etherdevice.h:20,
from drivers/net/wireless/mediatek/mt76/mt7915/mac.c:4:
>> drivers/net/wireless/mediatek/mt76/mt7915/mac.c:909:54: error: 'struct mt7915_phy' has no member named 'test'
909 | phy->test.spe_idx));
| ^~
include/uapi/linux/byteorder/little_endian.h:33:51: note: in definition of macro '__cpu_to_le32'
33 | #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
| ^
include/linux/compiler_types.h:310:9: note: in expansion of macro '__compiletime_assert'
310 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:322:9: note: in expansion of macro '_compiletime_assert'
322 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:49:17: note: in expansion of macro 'BUILD_BUG_ON_MSG'
49 | BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:94:17: note: in expansion of macro '__BF_FIELD_CHECK'
94 | __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
| ^~~~~~~~~~~~~~~~
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:908:40: note: in expansion of macro 'FIELD_PREP'
908 | txwi[7] |= cpu_to_le32(FIELD_PREP(MT_TXD7_SPE_IDX,
| ^~~~~~~~~~
>> drivers/net/wireless/mediatek/mt76/mt7915/mac.c:909:54: error: 'struct mt7915_phy' has no member named 'test'
909 | phy->test.spe_idx));
| ^~
include/uapi/linux/byteorder/little_endian.h:33:51: note: in definition of macro '__cpu_to_le32'
33 | #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
| ^
include/linux/compiler_types.h:310:9: note: in expansion of macro '__compiletime_assert'
310 | __compiletime_assert(condition, msg, prefix, suffix)
| ^~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:322:9: note: in expansion of macro '_compiletime_assert'
322 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:49:17: note: in expansion of macro 'BUILD_BUG_ON_MSG'
49 | BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:94:17: note: in expansion of macro '__BF_FIELD_CHECK'
94 | __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
| ^~~~~~~~~~~~~~~~
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:908:40: note: in expansion of macro 'FIELD_PREP'
908 | txwi[7] |= cpu_to_le32(FIELD_PREP(MT_TXD7_SPE_IDX,
| ^~~~~~~~~~
>> drivers/net/wireless/mediatek/mt76/mt7915/mac.c:909:54: error: 'struct mt7915_phy' has no member named 'test'
909 | phy->test.spe_idx));
| ^~
include/uapi/linux/byteorder/little_endian.h:33:51: note: in definition of macro '__cpu_to_le32'
33 | #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
| ^
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:908:40: note: in expansion of macro 'FIELD_PREP'
908 | txwi[7] |= cpu_to_le32(FIELD_PREP(MT_TXD7_SPE_IDX,
| ^~~~~~~~~~
At top level:
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:760:1: warning: 'mt7915_mac_write_txwi_tm' defined but not used [-Wunused-function]
760 | mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, struct mt76_wcid *wcid, __le32 *txwi,
| ^~~~~~~~~~~~~~~~~~~~~~~~vim +778 drivers/net/wireless/mediatek/mt76/mt7915/mac.c
5d8a83f0994134 Shayne Chen 2020-10-22 758
aadf09537c575d Shayne Chen 2020-10-22 759 static void
c742cd1ffffaef Ben Greear 2021-11-18 760 mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, struct mt76_wcid *wcid, __le32 *txwi,
c918c74d06457e Shayne Chen 2020-12-04 761 struct sk_buff *skb)
aadf09537c575d Shayne Chen 2020-10-22 762 {
c742cd1ffffaef Ben Greear 2021-11-18 763 struct mt76_testmode_data *td;
cc91747be98f2a Shayne Chen 2021-04-12 764 const struct ieee80211_rate *r;
c742cd1ffffaef Ben Greear 2021-11-18 765 struct mt7915_sta *msta;
c742cd1ffffaef Ben Greear 2021-11-18 766 u8 bw, mode, nss;
c742cd1ffffaef Ben Greear 2021-11-18 767 u8 rate_idx;
aadf09537c575d Shayne Chen 2020-10-22 768 u16 rateval = 0;
aadf09537c575d Shayne Chen 2020-10-22 769 u32 val;
cc91747be98f2a Shayne Chen 2021-04-12 770 bool cck = false;
cc91747be98f2a Shayne Chen 2021-04-12 771 int band;
aadf09537c575d Shayne Chen 2020-10-22 772
c742cd1ffffaef Ben Greear 2021-11-18 773 msta = container_of(wcid, struct mt7915_sta, wcid);
c742cd1ffffaef Ben Greear 2021-11-18 774
c742cd1ffffaef Ben Greear 2021-11-18 775 if (msta->test.txo_active) {
c742cd1ffffaef Ben Greear 2021-11-18 776 td = &msta->test;
c742cd1ffffaef Ben Greear 2021-11-18 777 } else {
c918c74d06457e Shayne Chen 2020-12-04 @778 if (skb != phy->mt76->test.tx_skb)
aadf09537c575d Shayne Chen 2020-10-22 779 return;
c742cd1ffffaef Ben Greear 2021-11-18 780 td = &phy->mt76->test;
c742cd1ffffaef Ben Greear 2021-11-18 781 }
c742cd1ffffaef Ben Greear 2021-11-18 782
c742cd1ffffaef Ben Greear 2021-11-18 783 nss = td->tx_rate_nss;
c742cd1ffffaef Ben Greear 2021-11-18 784 rate_idx = td->tx_rate_idx;
aadf09537c575d Shayne Chen 2020-10-22 785
aadf09537c575d Shayne Chen 2020-10-22 786 switch (td->tx_rate_mode) {
aadf09537c575d Shayne Chen 2020-10-22 787 case MT76_TM_TX_MODE_HT:
aadf09537c575d Shayne Chen 2020-10-22 788 nss = 1 + (rate_idx >> 3);
aadf09537c575d Shayne Chen 2020-10-22 789 mode = MT_PHY_TYPE_HT;
aadf09537c575d Shayne Chen 2020-10-22 790 break;
aadf09537c575d Shayne Chen 2020-10-22 791 case MT76_TM_TX_MODE_VHT:
aadf09537c575d Shayne Chen 2020-10-22 792 mode = MT_PHY_TYPE_VHT;
aadf09537c575d Shayne Chen 2020-10-22 793 break;
aadf09537c575d Shayne Chen 2020-10-22 794 case MT76_TM_TX_MODE_HE_SU:
aadf09537c575d Shayne Chen 2020-10-22 795 mode = MT_PHY_TYPE_HE_SU;
aadf09537c575d Shayne Chen 2020-10-22 796 break;
aadf09537c575d Shayne Chen 2020-10-22 797 case MT76_TM_TX_MODE_HE_EXT_SU:
aadf09537c575d Shayne Chen 2020-10-22 798 mode = MT_PHY_TYPE_HE_EXT_SU;
aadf09537c575d Shayne Chen 2020-10-22 799 break;
aadf09537c575d Shayne Chen 2020-10-22 800 case MT76_TM_TX_MODE_HE_TB:
aadf09537c575d Shayne Chen 2020-10-22 801 mode = MT_PHY_TYPE_HE_TB;
aadf09537c575d Shayne Chen 2020-10-22 802 break;
aadf09537c575d Shayne Chen 2020-10-22 803 case MT76_TM_TX_MODE_HE_MU:
aadf09537c575d Shayne Chen 2020-10-22 804 mode = MT_PHY_TYPE_HE_MU;
aadf09537c575d Shayne Chen 2020-10-22 805 break;
cc91747be98f2a Shayne Chen 2021-04-12 806 case MT76_TM_TX_MODE_CCK:
cc91747be98f2a Shayne Chen 2021-04-12 807 cck = true;
cc91747be98f2a Shayne Chen 2021-04-12 808 fallthrough;
aadf09537c575d Shayne Chen 2020-10-22 809 case MT76_TM_TX_MODE_OFDM:
cc91747be98f2a Shayne Chen 2021-04-12 810 band = phy->mt76->chandef.chan->band;
cc91747be98f2a Shayne Chen 2021-04-12 811 if (band == NL80211_BAND_2GHZ && !cck)
cc91747be98f2a Shayne Chen 2021-04-12 812 rate_idx += 4;
cc91747be98f2a Shayne Chen 2021-04-12 813
cc91747be98f2a Shayne Chen 2021-04-12 814 r = &phy->mt76->hw->wiphy->bands[band]->bitrates[rate_idx];
cc91747be98f2a Shayne Chen 2021-04-12 815 val = cck ? r->hw_value_short : r->hw_value;
cc91747be98f2a Shayne Chen 2021-04-12 816
cc91747be98f2a Shayne Chen 2021-04-12 817 mode = val >> 8;
cc91747be98f2a Shayne Chen 2021-04-12 818 rate_idx = val & 0xff;
cc91747be98f2a Shayne Chen 2021-04-12 819 break;
aadf09537c575d Shayne Chen 2020-10-22 820 default:
aadf09537c575d Shayne Chen 2020-10-22 821 mode = MT_PHY_TYPE_OFDM;
aadf09537c575d Shayne Chen 2020-10-22 822 break;
aadf09537c575d Shayne Chen 2020-10-22 823 }
aadf09537c575d Shayne Chen 2020-10-22 824
c742cd1ffffaef Ben Greear 2021-11-18 825 if (msta->test.txo_active) {
c742cd1ffffaef Ben Greear 2021-11-18 826 bw = td->txbw;
c742cd1ffffaef Ben Greear 2021-11-18 827 } else {
c918c74d06457e Shayne Chen 2020-12-04 828 switch (phy->mt76->chandef.width) {
aadf09537c575d Shayne Chen 2020-10-22 829 case NL80211_CHAN_WIDTH_40:
aadf09537c575d Shayne Chen 2020-10-22 830 bw = 1;
aadf09537c575d Shayne Chen 2020-10-22 831 break;
aadf09537c575d Shayne Chen 2020-10-22 832 case NL80211_CHAN_WIDTH_80:
aadf09537c575d Shayne Chen 2020-10-22 833 bw = 2;
aadf09537c575d Shayne Chen 2020-10-22 834 break;
aadf09537c575d Shayne Chen 2020-10-22 835 case NL80211_CHAN_WIDTH_80P80:
aadf09537c575d Shayne Chen 2020-10-22 836 case NL80211_CHAN_WIDTH_160:
aadf09537c575d Shayne Chen 2020-10-22 837 bw = 3;
aadf09537c575d Shayne Chen 2020-10-22 838 break;
aadf09537c575d Shayne Chen 2020-10-22 839 default:
aadf09537c575d Shayne Chen 2020-10-22 840 bw = 0;
aadf09537c575d Shayne Chen 2020-10-22 841 break;
aadf09537c575d Shayne Chen 2020-10-22 842 }
c742cd1ffffaef Ben Greear 2021-11-18 843 }
aadf09537c575d Shayne Chen 2020-10-22 844
aadf09537c575d Shayne Chen 2020-10-22 845 if (td->tx_rate_stbc && nss == 1) {
aadf09537c575d Shayne Chen 2020-10-22 846 nss++;
aadf09537c575d Shayne Chen 2020-10-22 847 rateval |= MT_TX_RATE_STBC;
aadf09537c575d Shayne Chen 2020-10-22 848 }
aadf09537c575d Shayne Chen 2020-10-22 849
aadf09537c575d Shayne Chen 2020-10-22 850 rateval |= FIELD_PREP(MT_TX_RATE_IDX, rate_idx) |
aadf09537c575d Shayne Chen 2020-10-22 851 FIELD_PREP(MT_TX_RATE_MODE, mode) |
aadf09537c575d Shayne Chen 2020-10-22 852 FIELD_PREP(MT_TX_RATE_NSS, nss - 1);
aadf09537c575d Shayne Chen 2020-10-22 853
c742cd1ffffaef Ben Greear 2021-11-18 854 /* TODO: Support per-skb txpower, p.15 of txpower doc, DW2 29:24. */
aadf09537c575d Shayne Chen 2020-10-22 855 txwi[2] |= cpu_to_le32(MT_TXD2_FIX_RATE);
aadf09537c575d Shayne Chen 2020-10-22 856
c742cd1ffffaef Ben Greear 2021-11-18 857 /* Looks like this sets tx attempt to exactly 1.
c742cd1ffffaef Ben Greear 2021-11-18 858 * TODO: Use td->tx_xmit_count, if in txo mode.
c742cd1ffffaef Ben Greear 2021-11-18 859 */
aadf09537c575d Shayne Chen 2020-10-22 860 le32p_replace_bits(&txwi[3], 1, MT_TXD3_REM_TX_COUNT);
aadf09537c575d Shayne Chen 2020-10-22 861 if (td->tx_rate_mode < MT76_TM_TX_MODE_HT)
aadf09537c575d Shayne Chen 2020-10-22 862 txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE);
aadf09537c575d Shayne Chen 2020-10-22 863
c742cd1ffffaef Ben Greear 2021-11-18 864 /* TODO: Take tx_dynbw into account in txo mode. */
aadf09537c575d Shayne Chen 2020-10-22 865 val = MT_TXD6_FIXED_BW |
aadf09537c575d Shayne Chen 2020-10-22 866 FIELD_PREP(MT_TXD6_BW, bw) |
aadf09537c575d Shayne Chen 2020-10-22 867 FIELD_PREP(MT_TXD6_TX_RATE, rateval) |
aadf09537c575d Shayne Chen 2020-10-22 868 FIELD_PREP(MT_TXD6_SGI, td->tx_rate_sgi);
aadf09537c575d Shayne Chen 2020-10-22 869
aadf09537c575d Shayne Chen 2020-10-22 870 /* for HE_SU/HE_EXT_SU PPDU
aadf09537c575d Shayne Chen 2020-10-22 871 * - 1x, 2x, 4x LTF + 0.8us GI
aadf09537c575d Shayne Chen 2020-10-22 872 * - 2x LTF + 1.6us GI, 4x LTF + 3.2us GI
aadf09537c575d Shayne Chen 2020-10-22 873 * for HE_MU PPDU
aadf09537c575d Shayne Chen 2020-10-22 874 * - 2x, 4x LTF + 0.8us GI
aadf09537c575d Shayne Chen 2020-10-22 875 * - 2x LTF + 1.6us GI, 4x LTF + 3.2us GI
aadf09537c575d Shayne Chen 2020-10-22 876 * for HE_TB PPDU
aadf09537c575d Shayne Chen 2020-10-22 877 * - 1x, 2x LTF + 1.6us GI
aadf09537c575d Shayne Chen 2020-10-22 878 * - 4x LTF + 3.2us GI
aadf09537c575d Shayne Chen 2020-10-22 879 */
aadf09537c575d Shayne Chen 2020-10-22 880 if (mode >= MT_PHY_TYPE_HE_SU)
aadf09537c575d Shayne Chen 2020-10-22 881 val |= FIELD_PREP(MT_TXD6_HELTF, td->tx_ltf);
aadf09537c575d Shayne Chen 2020-10-22 882
cc91747be98f2a Shayne Chen 2021-04-12 883 if (td->tx_rate_ldpc || (bw > 0 && mode >= MT_PHY_TYPE_HE_SU))
aadf09537c575d Shayne Chen 2020-10-22 884 val |= MT_TXD6_LDPC;
aadf09537c575d Shayne Chen 2020-10-22 885
cc91747be98f2a Shayne Chen 2021-04-12 886 txwi[3] &= ~cpu_to_le32(MT_TXD3_SN_VALID);
aadf09537c575d Shayne Chen 2020-10-22 887 txwi[6] |= cpu_to_le32(val);
c742cd1ffffaef Ben Greear 2021-11-18 888
c742cd1ffffaef Ben Greear 2021-11-18 889 if (msta->test.txo_active) {
c742cd1ffffaef Ben Greear 2021-11-18 890 /* see mt7915_tm_set_tx_frames */
c742cd1ffffaef Ben Greear 2021-11-18 891 static const u8 spe_idx_map[] = {0, 0, 1, 0, 3, 2, 4, 0,
c742cd1ffffaef Ben Greear 2021-11-18 892 9, 8, 6, 10, 16, 12, 18, 0};
c742cd1ffffaef Ben Greear 2021-11-18 893 u32 spe_idx;
c742cd1ffffaef Ben Greear 2021-11-18 894
c742cd1ffffaef Ben Greear 2021-11-18 895 if (td->tx_spe_idx) {
c742cd1ffffaef Ben Greear 2021-11-18 896 spe_idx = td->tx_spe_idx;
c742cd1ffffaef Ben Greear 2021-11-18 897 } else {
c742cd1ffffaef Ben Greear 2021-11-18 898 u8 tx_ant = td->tx_antenna_mask;
c742cd1ffffaef Ben Greear 2021-11-18 899
c742cd1ffffaef Ben Greear 2021-11-18 900 if (!tx_ant) {
c742cd1ffffaef Ben Greear 2021-11-18 901 /* use antenna mask that matches our nss */
c742cd1ffffaef Ben Greear 2021-11-18 902 tx_ant = GENMASK(nss - 1, 0);
c742cd1ffffaef Ben Greear 2021-11-18 903 }
c742cd1ffffaef Ben Greear 2021-11-18 904 spe_idx = spe_idx_map[tx_ant];
c742cd1ffffaef Ben Greear 2021-11-18 905 }
c742cd1ffffaef Ben Greear 2021-11-18 906 txwi[7] |= cpu_to_le32(FIELD_PREP(MT_TXD7_SPE_IDX, spe_idx));
c742cd1ffffaef Ben Greear 2021-11-18 907 } else {
aadf09537c575d Shayne Chen 2020-10-22 908 txwi[7] |= cpu_to_le32(FIELD_PREP(MT_TXD7_SPE_IDX,
78fc30a21cf117 Shayne Chen 2020-12-04 @909 phy->test.spe_idx));
c742cd1ffffaef Ben Greear 2021-11-18 910 }
aadf09537c575d Shayne Chen 2020-10-22 911 }aadf09537c575d Shayne Chen 2020-10-22 912
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH 8/8 mt76: mt7915: fix SGI reporting when using tx-overrides
In reply to [email protected]From: Ben Greear <[email protected]>
The station wtbl logic to read rate-ctrl settings does not work when fixed rates are used. So, read sgi settings from the txo configuration in this case.
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +9 -0
@@ -177,6 +177,15 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev) rx_cur); } +/* If we are in tx-override mode, then wtbl doesn't provide useful report +* for the SGI/LGI stuff, so just get it from the override struct. +*/ +if (msta->test.txo_active) { + msta->wcid.rate_he_gi = msta->test.tx_rate_sgi; + msta->wcid.rate_short_gi = msta->test.tx_rate_sgi; +continue ; + } +/* * We don't support reading GI info from txs packets. * For accurate tx status reporting and AQL improvement,
Signature · 1 line
2.20.1
Ryder Lee
maintainerQuoted 94 lines · On Thu, 2021-11-18 at 08:45 -0800, [email protected] wrote:
From: Ben Greear <[email protected]>
Explicitly cache
short_giandhe_giin 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 <[email protected]>---
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.16drivers/net/wireless/mediatek/mt76/mt76.h | 5 +++++ drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 17 +++++++++++++ ---- 2 files changed, 18 insertions(+), 4 deletions(-)drivers/net/wireless/mediatek/mt76/mt76.h +4
-0@@ -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()*/drivers/net/wireless/mediatek/mt76/mt76.h +1
-0+u8 rate_he_gi;/* cached HE GI, from mac_sta_poll() */ u16 idx;u8 hw_key_idx;drivers/net/wireless/mediatek/mt76/mt7915/mac.c +1
-0@@ -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 */
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +0
-0} else if (rate->flags & (RATE_INFO_FLAGS_VHT_MCS |
RATE_INFO_FLAGS_MCS)) {drivers/net/wireless/mediatek/mt76/mt7915/mac.c +1
-1-if (val &BIT (12 + bw)) +if (val &BIT (12 + bw)) { rate->flags |=
RATE_INFO_FLAGS_SHORT_GI;drivers/net/wireless/mediatek/mt76/mt7915/mac.c +3
-1-else + msta->wcid.rate_short_gi =1 ; + } +else { rate->flags &=~RATE_INFO_FLAGS_SHORT_GI;
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +4
-1+ 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 ;drivers/net/wireless/mediatek/mt76/mt7915/mac.c +2
-0case 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 :drivers/net/wireless/mediatek/mt76/mt7915/mac.c +0
-0case 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;
drivers/net/wireless/mediatek/mt76/mt7915/mac.c mt7915_mac_add_txs_skb(struct mt7915_dev · line 1446
Quoted 10 lines
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +2
-1- 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; }
Maybe we can consider switching to use existing fixed-rate method in debugfs? On th other hand, that's the only way to configure HE MU UL fixed-rate.
Ryder
Quoted 10 lines · Ryder Lee
Quoted 9 lines · On Thu, 2021-11-18 at 08:45 -0800, [email protected] wrote:
From: Ben Greear <[email protected]>
Explicitly cache
short_giandhe_giin 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 <[email protected]>---
Quoted 8 lines
Quoted 3 lines
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.16Maybe we can consider switching to use existing fixed-rate method in debugfs? On th other hand, that's the only way to configure HE MU UL fixed-rate.
This patch is to improve reported tx rates, not to control tx rates.
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Ryder Lee
maintainerQuoted 16 lines · * On Thu, 2021-11-18 at 09:10 -0800, Ben Greear wrote:
Quoted 15 lines · Ryder Lee
Quoted 13 lines · On Thu, 2021-11-18 at 08:45 -0800, [email protected] wrote:
From: Ben Greear <[email protected]>
Explicitly cache
short_giandhe_giin 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 <[email protected]>---
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
Quoted 8 lines
Quoted 5 lines
Maybe we can consider switching to use existing fixed-rate method in
debugfs? On th other hand, that's the only way to configure HE MU UL
fixed-rate.This patch is to improve reported tx rates, not to control tx rates.
Ah. I shall reply [PATCH 8/8] mt76: mt7915: fix SGI reporting when using tx-overrides.