Skip to contentSkip to conversation

rtw88: fix non-increase management packet sequence number

PATCH In review [email protected] 3 participants 3 messages Mar 26, 2020 Realtek wireless driver (rtw88)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtw88: fix non-increase management packet sequence number

From: Tzu-En Huang <[email protected]>

In previous setting, management packets' sequence numbers will not increase and always stay at 0. Add hw sequence number support for mgmt packets.
The table below shows different sequence number setting in the tx descriptor.

seq num ctrl | EN_HWSEQ | DISQSELSEL | HW_SSN_SEL
------------------------------------------------------

sw ctrl           |    0     |    N/A     |    N/A
hw ctrl per MACID |    1     |     0      |    N/A
hw ctrl per HWREG |    1     |     1      |HWREG(0/1/2/3)
---
 drivers/net/wireless/realtek/rtw88/main.h | 3 +++
 drivers/net/wireless/realtek/rtw88/tx.c   | 6 ++++++
 drivers/net/wireless/realtek/rtw88/tx.h   | 6 ++++++
 3 files changed, 15 insertions(+)
drivers/net/wireless/realtek/rtw88/main.h +3 -0
index 279410a87141..138851a10051 100644
@@ -562,6 +562,9 @@ struct rtw_tx_pkt_info {
 	bool short_gi;
 	bool report;
 	bool rts;
+	bool dis_qselseq;
+	bool en_hwseq;
+	u8 hw_ssn_sel;
 };
 
 struct rtw_rx_pkt_stat {
drivers/net/wireless/realtek/rtw88/tx.c +6 -0
index b31eb4d9664b..60989987f67b 100644
@@ -58,6 +58,9 @@ void rtw_tx_fill_tx_desc(struct rtw_tx_pkt_info *pkt_info, struct sk_buff *skb)
 	SET_TX_DESC_SPE_RPT(txdesc, pkt_info->report);
 	SET_TX_DESC_SW_DEFINE(txdesc, pkt_info->sn);
 	SET_TX_DESC_USE_RTS(txdesc, pkt_info->rts);
+	SET_TX_DESC_DISQSELSEQ(txdesc, pkt_info->dis_qselseq);
+	SET_TX_DESC_EN_HWSEQ(txdesc, pkt_info->en_hwseq);
+	SET_TX_DESC_HW_SSN_SEL(txdesc, pkt_info->hw_ssn_sel);
 }
 EXPORT_SYMBOL(rtw_tx_fill_tx_desc);
 
@@ -227,6 +230,9 @@ static void rtw_tx_mgmt_pkt_info_update(struct rtw_dev *rtwdev,
 	pkt_info->use_rate = true;
 	pkt_info->rate_id = 6;
 	pkt_info->dis_rate_fallback = true;
+	pkt_info->dis_qselseq = true;
+	pkt_info->en_hwseq = true;
+	pkt_info->hw_ssn_sel = 0;
 }
 
 static void rtw_tx_data_pkt_info_update(struct rtw_dev *rtwdev,
drivers/net/wireless/realtek/rtw88/tx.h +6 -0
index e488a2643eb3..b973de0f4dc0 100644
@@ -53,6 +53,12 @@
 	le32p_replace_bits((__le32 *)(txdesc) + 0x02, value, BIT(19))
 #define SET_TX_DESC_SW_DEFINE(tx_desc, value)                                  \
 	le32p_replace_bits((__le32 *)(txdesc) + 0x06, value, GENMASK(11, 0))
+#define SET_TX_DESC_DISQSELSEQ(txdesc, value)                                 \
+	le32p_replace_bits((__le32 *)(txdesc) + 0x00, value, BIT(31))
+#define SET_TX_DESC_EN_HWSEQ(txdesc, value)                                   \
+	le32p_replace_bits((__le32 *)(txdesc) + 0x08, value, BIT(15))
+#define SET_TX_DESC_HW_SSN_SEL(txdesc, value)                                 \
+	le32p_replace_bits((__le32 *)(txdesc) + 0x03, value, GENMASK(7, 6))
 
 enum rtw_tx_desc_queue_select {
 	TX_DESC_QSEL_TID0	= 0,
Signature · 1 line
2.17.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 3 lines · On Wed, Mar 25, 2020 at 7:04 PM <[email protected]> wrote:

In previous setting, management packets' sequence numbers will not increase and always stay at 0. Add hw sequence number support for mgmt packets.

I see that you're differentiating frames by mgmt/null-func/data in your own TX handler, but shouldn't you be basing your sequence number decisions based on IEEE80211_TX_CTL_ASSIGN_SEQ and IEEE80211_TX_CTL_FIRST_FRAGMENT? Anyway, this patch seems to work as expected:

#2 lore raw
In reply to [email protected]
Quoted 10 lines · <[email protected]> wrote:

From: Tzu-En Huang <[email protected]>

In previous setting, management packets' sequence numbers will not increase and always stay at 0. Add hw sequence number support for mgmt packets.
The table below shows different sequence number setting in the tx descriptor.

seq num ctrl | EN_HWSEQ | DISQSELSEL | HW_SSN_SEL
------------------------------------------------------

Quoted 8 lines
sw ctrl           |    0     |    N/A     |    N/A
hw ctrl per MACID |    1     |     0      |    N/A
hw ctrl per HWREG |    1     |     1      |HWREG(0/1/2/3)

Patch applied to wireless-drivers-next.git, thanks.

2542469d1258 rtw88: fix non-increase management packet sequence number

Signature · 3 lines
https://patchwork.kernel.org/patch/11458951/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches