Re: [PATCH] wifi: mt76: mt7603: add debugfs attr for disabling frames buffering

2024-05-25 Thread Shengyu Qu

Hi Rafal,

Maybe we could disable frames buffering by default until it is fixed?
Also, maybe we could do more tests on newer models such as mt7986/81 to
make this patch benefit more models?

Best regards,
Shengyu


在 2024/3/26 6:33, Rafał Miłecki 写道:

From: Rafał Miłecki 

MT7603EN and MT7628AN were reported by multiple users to be unstable
under high traffic. Transmission of packets could stop for seconds often
leading to disconnections.

Long research & debugging revelaed a close relation between MCU
interrupts of type PKT_TYPE_TXS and slowdowns / stalls. That led to
questioning frames buffering feature.

It turns out that disabling SKBs loopback code makes mt7603 devices much
more stable under load. There are still some traffic hiccups but those
happen like once every an hour and end up in recovery in most cases.

Add a debugfs option for disabling frames buffering so users can give it
a try. If this solution yields a success we can make this feature
disabled by default.

This change was successfully tested using 2 GHz AP interface on:
1. Netgear R6220 - MT7621ST (SoC) + MT7603EN (WiFi) + MT7612EN (WiFi)
2. Xiaomi Mi Router 4C - MT7628AN (Wi-Fi SoC)

Link: 
https://lore.kernel.org/linux-wireless/7c96d5ee-86c1-8068-1b58-40db6087a...@gmail.com/
Closes: https://github.com/openwrt/mt76/issues/865
Fixes: c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by: Rafał Miłecki 
---
  drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c | 2 ++
  drivers/net/wireless/mediatek/mt76/mt7603/dma.c | 3 +++
  drivers/net/wireless/mediatek/mt76/mt7603/init.c| 1 +
  drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h  | 2 ++
  4 files changed, 8 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c 
b/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c
index 3967f2f05774..c80baba7a402 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c
@@ -115,4 +115,6 @@ void mt7603_init_debugfs(struct mt7603_dev *dev)
&dev->sensitivity_limit);
debugfs_create_bool("dynamic_sensitivity", 0600, dir,
&dev->dynamic_sensitivity);
+   debugfs_create_bool("frames_buffering", 0600, dir,
+   &dev->frames_buffering);
  }
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/dma.c 
b/drivers/net/wireless/mediatek/mt76/mt7603/dma.c
index 7a2f5d38562b..f5ab729dec31 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/dma.c
@@ -27,6 +27,9 @@ mt7603_rx_loopback_skb(struct mt7603_dev *dev, struct sk_buff 
*skb)
u32 val;
u8 tid = 0;
  
+	if (!dev->frames_buffering)

+   goto free;
+
if (skb->len < MT_TXD_SIZE + sizeof(struct ieee80211_hdr))
goto free;
  
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c b/drivers/net/wireless/mediatek/mt76/mt7603/init.c

index 6c55c72f28a2..5abc2618ec8b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c
@@ -515,6 +515,7 @@ int mt7603_register_device(struct mt7603_dev *dev)
dev->slottime = 9;
dev->sensitivity_limit = 28;
dev->dynamic_sensitivity = true;
+   dev->frames_buffering = true;
  
  	ret = mt7603_init_hardware(dev);

if (ret)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h 
b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h
index 9e58df7042ad..02c88334cdc0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h
@@ -155,6 +155,8 @@ struct mt7603_dev {
u32 reset_test;
  
  	unsigned int reset_cause[__RESET_CAUSE_MAX];

+
+   bool frames_buffering;
  };
  
  extern const struct mt76_driver_ops mt7603_drv_ops;


OpenPGP_0xE3520CC91929C8E7.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] wifi: mt76: mt7603: add debugfs attr for disabling frames buffering

2024-05-25 Thread Rafał Miłecki

On 2.04.2024 18:54, Shengyu Qu wrote:

> Maybe we could disable frames buffering by default until it is fixed?

Please check commit description:

"If this solution yields a success we can make this feature disabled by 
default."


> Also, maybe we could do more tests on newer models such as mt7986/81 to
> make this patch benefit more models?

Can you point me to the mt7915 driver buffering code? I clearly missed that.

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] wifi: mt76: mt7603: add debugfs attr for disabling frames buffering

2024-05-25 Thread Rafał Miłecki

On 26.03.2024 00:11, Rafał Miłecki wrote:

I'll provide some iperf logs from my ThinkPad with 8086:3166 Intel
Wireless-AC 3165 working as 2 GHz client of MT7603EN on Netgear R6220.


I run seven 1-hour iperf sessions overnight using ThinkPad + Xiaomi
Mi Router 4C (MT7628AN Wi-Fi SoC) with buffering DISABLED.

Session 1 (1 hour) with 51.7 Mbps avg:
All GOOD

Session 2 (1 hour) with 40.5 Mbps avg:
* 2 seconds traffic stall (STA diconnected with 34=DISASSOC_LOW_ACK)
* 718 seconds traffic stall (nothing in STA logs)

Session 3 (1 hour) with 51.6 Mbps avg:
* 5 seconds traffic stall (STA diconnected with 34=DISASSOC_LOW_ACK)

Session 4 (1 hour) with 51.8 Mbps avg:
All GOOD

Session 5 (1 hour) with 51.8 Mbps avg:
All GOOD

Session 6 (1 hour) with 51.8 Mbps avg:
All GOOD

Session 7 (1 hour) with 51.1 Mbps avg:
All GOOD

I find MT7628AN without frames buffering pretty usable.



Now, with frames buffering enabled, things look quite worse. There are
multiple traffic stalls and often TCP session dies. See below.

pon, 25 mar 2024, 23:23:51 CET

Client connecting to 192.168.27.1, TCP port 5001
TCP window size: 85.0 KByte (default)

[  3] local 192.168.1.181 port 58838 connected with 192.168.27.1 port 5001
[ ID] Interval   Transfer Bandwidth
[  3]  0.0- 1.0 sec  3.12 MBytes  26.2 Mbits/sec
[  3]  1.0- 2.0 sec  3.25 MBytes  27.3 Mbits/sec
[  3]  2.0- 3.0 sec  3.25 MBytes  27.3 Mbits/sec
[  3]  3.0- 4.0 sec  5.25 MBytes  44.0 Mbits/sec
[  3]  4.0- 5.0 sec  7.25 MBytes  60.8 Mbits/sec
[  3]  5.0- 6.0 sec  6.38 MBytes  53.5 Mbits/sec
[  3]  6.0- 7.0 sec  7.25 MBytes  60.8 Mbits/sec
[  3]  7.0- 8.0 sec  6.38 MBytes  53.5 Mbits/sec
[  3]  8.0- 9.0 sec  7.12 MBytes  59.8 Mbits/sec
[  3]  9.0-10.0 sec  6.25 MBytes  52.4 Mbits/sec
[  3] 10.0-11.0 sec  6.50 MBytes  54.5 Mbits/sec
[  3] 11.0-12.0 sec  7.12 MBytes  59.8 Mbits/sec
[  3] 12.0-13.0 sec  6.38 MBytes  53.5 Mbits/sec
[  3] 13.0-14.0 sec  4.62 MBytes  38.8 Mbits/sec
[  3] 14.0-15.0 sec  5.50 MBytes  46.1 Mbits/sec
[  3] 15.0-16.0 sec  5.38 MBytes  45.1 Mbits/sec
[  3] 16.0-17.0 sec  6.50 MBytes  54.5 Mbits/sec
[  3] 17.0-18.0 sec  7.25 MBytes  60.8 Mbits/sec
[  3] 18.0-19.0 sec  6.38 MBytes  53.5 Mbits/sec
[  3] 19.0-20.0 sec  6.25 MBytes  52.4 Mbits/sec
[  3] 20.0-21.0 sec  7.25 MBytes  60.8 Mbits/sec
[  3] 21.0-22.0 sec  6.25 MBytes  52.4 Mbits/sec
[  3] 22.0-23.0 sec  7.00 MBytes  58.7 Mbits/sec
[  3] 23.0-24.0 sec  6.25 MBytes  52.4 Mbits/sec
[  3] 24.0-25.0 sec  7.25 MBytes  60.8 Mbits/sec
[  3] 25.0-26.0 sec  4.50 MBytes  37.7 Mbits/sec
[  3] 26.0-27.0 sec  3.62 MBytes  30.4 Mbits/sec
[  3] 27.0-28.0 sec  3.12 MBytes  26.2 Mbits/sec
[  3] 28.0-29.0 sec  2.62 MBytes  22.0 Mbits/sec
[  3] 29.0-30.0 sec  1.75 MBytes  14.7 Mbits/sec
[  3] 30.0-31.0 sec  0.00 Bytes  0.00 bits/sec
[  3] 31.0-32.0 sec  0.00 Bytes  0.00 bits/sec
[  3] 32.0-33.0 sec  3.50 MBytes  29.4 Mbits/sec
[  3] 33.0-34.0 sec  7.25 MBytes  60.8 Mbits/sec
[  3] 34.0-35.0 sec  5.62 MBytes  47.2 Mbits/sec
[  3] 35.0-36.0 sec  7.12 MBytes  59.8 Mbits/sec
[  3] 36.0-37.0 sec  6.50 MBytes  54.5 Mbits/sec
[  3] 37.0-38.0 sec  7.25 MBytes  60.8 Mbits/sec
[  3] 38.0-39.0 sec  6.38 MBytes  53.5 Mbits/sec
[  3] 39.0-40.0 sec  7.12 MBytes  59.8 Mbits/sec
[  3] 40.0-41.0 sec  6.38 MBytes  53.5 Mbits/sec
[  3] 41.0-42.0 sec  4.50 MBytes  37.7 Mbits/sec
[  3] 42.0-43.0 sec  3.88 MBytes  32.5 Mbits/sec
[  3] 43.0-44.0 sec  5.50 MBytes  46.1 Mbits/sec
[  3] 44.0-45.0 sec  6.25 MBytes  52.4 Mbits/sec
[  3] 45.0-46.0 sec  6.38 MBytes  53.5 Mbits/sec
[  3] 46.0-47.0 sec  7.25 MBytes  60.8 Mbits/sec
[  3] 47.0-48.0 sec  6.25 MBytes  52.4 Mbits/sec
[  3] 48.0-49.0 sec  7.25 MBytes  60.8 Mbits/sec
[  3] 49.0-50.0 sec  6.25 MBytes  52.4 Mbits/sec
[  3] 50.0-51.0 sec  6.38 MBytes  53.5 Mbits/sec
[  3] 51.0-52.0 sec  7.12 MBytes  59.8 Mbits/sec
[  3] 52.0-53.0 sec  6.50 MBytes  54.5 Mbits/sec
[  3] 53.0-54.0 sec  7.00 MBytes  58.7 Mbits/sec
[  3] 54.0-55.0 sec  5.50 MBytes  46.1 Mbits/sec
[  3] 55.0-56.0 sec  3.75 MBytes  31.5 Mbits/sec
[  3] 56.0-57.0 sec  1.88 MBytes  15.7 Mbits/sec
[  3] 57.0-58.0 sec  2.38 MBytes  19.9 Mbits/sec
[  3] 58.0-59.0 sec  2.88 MBytes  24.1 Mbits/sec
[  3] 59.0-60.0 sec  2.12 MBytes  17.8 Mbits/sec
[  3] 60.0-61.0 sec  1.12 MBytes  9.44 Mbits/sec
[  3] 61.0-62.0 sec  2.12 MBytes  17.8 Mbits/sec
[  3] 62.0-63.0 sec  2.12 MBytes  17.8 Mbits/sec
[  3] 63.0-64.0 sec  2.00 MBytes  16.8 Mbits/sec
[  3] 64.0-65.0 sec  2.25 MBytes  18.9 Mbits/sec
[  3] 65.0-66.0 sec  2.00 MBytes  16.8 Mbits/sec
[  3] 66.0-67.0 sec  0.00 Bytes  0.00 bits/sec
[  3] 67.0-68.0 sec  1.25 MBytes  10.5 Mbits/sec
[  3] 68.0-69.0 sec  1.12 MBytes  9.44 Mbits/sec
[  3] 69.0-70.0 sec  1.12 MBytes  9.44 Mbits/sec
[  3] 70.0-71.0 sec  3.75 MBytes  31.5 Mbits/sec
[  3] 71.0-72.0 sec  1.88 MBytes  15.7 Mbits/sec
[  3] 72.0-73.0 sec  0.00 Bytes  0.00 bits/sec
[  3] 73.0-74.0 sec  0.00 Bytes  0.00 bits/sec
[  3]