Skip to contentSkip to conversation

mt76: mt7915: disable RX_HDR_TRANS_SHORT

PATCH In review Bo Jiao 2 participants 4 messages Apr 20, 2022 – Apr 21, 2022

Subsystems (2)
lore
Share & tools
lore

Bo Jiao

author
#0 lore raw

PATCH 1/1 mt76: mt7915: disable RX_HDR_TRANS_SHORT

From: Bo Jiao <[email protected]>

This patch disables RX_TRANS_SHORT to make MDP to do header translation when payload less than 8 bytes, hence the (QoS) null data can be encapsulated to 802.3 format. However, WDS requires (QoS) null data in 802.11 format to created vlan AP interfaces.

---
 drivers/net/wireless/mediatek/mt76/agg-rx.c      | 3 +++
 drivers/net/wireless/mediatek/mt76/mt7915/init.c | 3 +++
 drivers/net/wireless/mediatek/mt76/mt7915/mac.c  | 4 ----
 drivers/net/wireless/mediatek/mt76/mt7915/regs.h | 3 +++
 4 files changed, 9 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/agg-rx.c +3 -0
index 7262222..efd1a85 100644
@@ -167,6 +167,9 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
 		return;
 	}
 
+	if (!status->aggr)
+		return;
+
 	/* not part of a BA session */
 	ackp = status->qos_ctl & IEEE80211_QOS_CTL_ACK_POLICY_MASK;
 	if (ackp != IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK &&
drivers/net/wireless/mediatek/mt76/mt7915/init.c +3 -0
index facd604..12f8757 100644
@@ -453,6 +453,9 @@ static void mt7915_mac_init(struct mt7915_dev *dev)
 
 	mt76_rmw_field(dev, MT_MDP_DCR1, MT_MDP_DCR1_MAX_RX_LEN, rx_len);
 
+	if (!is_mt7915(&dev->mt76))
+		mt76_clear(dev, MT_MDP_DCR2, MT_MDP_DCR2_RX_TRANS_SHORT);
+
 	/* enable hardware de-agg */
 	mt76_set(dev, MT_MDP_DCR0, MT_MDP_DCR0_DAMSDU_EN);
 
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +0 -4
index 5080280..bc2fb00 100644
@@ -842,10 +842,6 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb)
 	if (!status->wcid || !ieee80211_is_data_qos(fc))
 		return 0;
 
-	/* drop no data frame */
-	if (fc & cpu_to_le16(IEEE80211_STYPE_NULLFUNC))
-		return -EINVAL;
-
 	status->aggr = unicast &&
 		       !ieee80211_is_qos_nullfunc(fc);
 	status->qos_ctl = qos_ctl;
drivers/net/wireless/mediatek/mt76/mt7915/regs.h +3 -0
index e4dbf99..bb0dec8 100644
@@ -158,6 +158,9 @@ enum offs_rev {
 #define MT_MDP_DCR1			MT_MDP(0x004)
 #define MT_MDP_DCR1_MAX_RX_LEN		GENMASK(15, 3)
 
+#define MT_MDP_DCR2			MT_MDP(0x0e8)
+#define MT_MDP_DCR2_RX_TRANS_SHORT	BIT(2)
+
 #define MT_MDP_BNRCFR0(_band)		MT_MDP(__OFFS(MDP_BNRCFR0) + \
 					       ((_band) << 8))
 #define MT_MDP_RCFR0_MCU_RX_MGMT	GENMASK(5, 4)
Signature · 1 line
2.18.0
maintainer
#1 lore raw
Quoted 23 lines · Bo Jiao

From: Bo Jiao <[email protected]>

This patch disables RX_TRANS_SHORT to make MDP to do header translation when payload less than 8 bytes, hence the (QoS) null data can be encapsulated to 802.3 format. However, WDS requires (QoS) null data in 802.11 format to created vlan AP interfaces.

---
  drivers/net/wireless/mediatek/mt76/agg-rx.c      | 3 +++
  drivers/net/wireless/mediatek/mt76/mt7915/init.c | 3 +++
  drivers/net/wireless/mediatek/mt76/mt7915/mac.c  | 4 ----
  drivers/net/wireless/mediatek/mt76/mt7915/regs.h | 3 +++
  4 files changed, 9 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/agg-rx.c +0 -0
index 7262222..efd1a85 100644

drivers/net/wireless/mediatek/mt76/agg-rx.c void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames) · line 175

Quoted 9 lines
drivers/net/wireless/mediatek/mt76/agg-rx.c +3 -0
@@ -167,6 +167,9 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
  		return;
  	}
 
+	if (!status->aggr)
+		return;
+
  	/* not part of a BA session */
  	ackp = status->qos_ctl & IEEE80211_QOS_CTL_ACK_POLICY_MASK;
  	if (ackp != IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK &&

This is an unrelated change, for which I've just sent a replacement patch. The rest is applied.

Thanks,

- Felix

author
#2 lore raw

hi felix:

mt7915_mac_fill_rx:

	......

	if (!status->wcid || !ieee80211_is_data_qos(fc))
		return 0;

	status->aggr = unicast &&
		       !ieee80211_is_qos_nullfunc(fc);
	status->qos_ctl = qos_ctl;
	status->seqno = IEEE80211_SEQ_TO_SN(seq_ctrl);

	return 0;

it will be returned by the condition !ieee80211_is_data_qos(fc) when receive non-Qos (null) data, and the status->aggr/status-

Quoted 1 line

qos_ctl/status->seqno keep the default value 0.

mt76_rx_aggr_reorder:

	....

	sta = wcid_to_sta(wcid);
	if (!sta)
		return;

	if (!status->aggr && !(status->flag & RX_FLAG_8023)) {
		mt76_rx_aggr_check_ctl(skb, frames);
		return;
	}

	....

those packet will be forced to do rx reorder and may incorrectly update tid->head.
https://patchwork.kernel.org/project/linux-wireless/patch/2022042010503
[email protected]/
Your replacement patch did not include this change.
+ if (!status->aggr)
+ return;
+

Thanks.

Quoted 43 lines · Felix Fietkau
Quoted 36 lines · Bo Jiao

From: Bo Jiao <[email protected]>

This patch disables RX_TRANS_SHORT to make MDP to do header translation
when payload less than 8 bytes, hence the (QoS) null data can be encapsulated
to 802.3 format. However, WDS requires (QoS) null data in 802.11 format
to created vlan AP interfaces.

---
  drivers/net/wireless/mediatek/mt76/agg-rx.c      | 3 +++
  drivers/net/wireless/mediatek/mt76/mt7915/init.c | 3 +++
  drivers/net/wireless/mediatek/mt76/mt7915/mac.c  | 4 ----
  drivers/net/wireless/mediatek/mt76/mt7915/regs.h | 3 +++
  4 files changed, 9 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/agg-rx.c +3 -0
index 7262222..efd1a85 100644
@@ -167,6 +167,9 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb,
 struct sk_buff_head *frames)
  		return;
  	}
 
+	if (!status->aggr)
+		return;
+
  	/* not part of a BA session */
  	ackp = status->qos_ctl &
Quoted 2 lines

IEEE80211_QOS_CTL_ACK_POLICY_MASK;
if (ackp != IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK &&

This is an unrelated change, for which I've just sent a replacement patch. The rest is applied.

Quoted 3 lines

Thanks,

- Felix

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

maintainer
#3 lore raw

Hi,

Quoted 42 lines · bo.jiao

hi felix:

mt7915_mac_fill_rx:

	......

	if (!status->wcid || !ieee80211_is_data_qos(fc))
		return 0;

	status->aggr = unicast &&
		       !ieee80211_is_qos_nullfunc(fc);
	status->qos_ctl = qos_ctl;
	status->seqno = IEEE80211_SEQ_TO_SN(seq_ctrl);

	return 0;

it will be returned by the condition !ieee80211_is_data_qos(fc) when receive non-Qos (null) data, and the status->aggr/status-

Quoted 1 line

qos_ctl/status->seqno keep the default value 0.

mt76_rx_aggr_reorder:

	....

	sta = wcid_to_sta(wcid);
	if (!sta)
		return;

	if (!status->aggr && !(status->flag & RX_FLAG_8023)) {
		mt76_rx_aggr_check_ctl(skb, frames);
		return;
	}

	....

those packet will be forced to do rx reorder and may incorrectly update tid->head.
https://patchwork.kernel.org/project/linux-wireless/patch/2022042010503
[email protected]/
Your replacement patch did not include this change.

drivers/net/wireless/mediatek/mt76/agg-rx.c +3 -0
+	if (!status->aggr)
+		return;
+
Quoted 1 line

Thanks.

I posted this patch: https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

- Felix