openwrt / openwrt/mt76

mt7628/mt7688 scan takes long time

Open
#973 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
888
Forks
436
PR merge metrics
No merged PRs in 30d

Description

Device: AsiaRF ARFHL-AP (mt7688an), AsiaRF ARFHL-OD (mt7628an)
OS: OpenWrt 23.05, OpenWrt 24.10

When a mt7628/mt7688 AP is scanning, the entire scan process takes too long to complete, which leads to the client side disconnect because AP doesn't response during scanning.

Using time command to measure the scan time, the current measured time is more than 4.5 seconds.

# time iwinfo phy0-ap0 scan > /dev/null
real    0m 4.65s
user    0m 0.01s
sys     0m 0.02s

It's 4 times longer than before, which was about 1.2-1.4 seconds before this patch applied:

wifi: mt76: mt7603: improve stuck beacon handling

After digging, this line will result in this issue:

@@ -108,7 +147,7 @@ void mt7603_pre_tbtt_tasklet(struct tasklet_struct *t)
                 skb_queue_len(&data.q) < 8);
 
        if (skb_queue_empty(&data.q))
-               goto out;
+               return;

In this commit, the timing to execute mt76_queue_tx_cleanup on MT_TXQ_BEACON moves to the top of the function, which was executed under the tag "out".
If I clean up the queue before return this callback, the issue fixs:

+--- a/mt7603/beacon.c
++++ b/mt7603/beacon.c
@@ -146,8 +146,10 @@
 	} while (nframes != skb_queue_len(&data.q) &&
 		 skb_queue_len(&data.q) < 8);
 
-	if (skb_queue_empty(&data.q))
+	if (skb_queue_empty(&data.q)){
+		mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[MT_TXQ_BEACON], false);
 		return;
+	}
 
 	for (i = 0; i < ARRAY_SIZE(data.tail); i++) {
 		if (!data.tail[i])

This issue is possible same as #967 but it will happen anyway in my case (both client connects or no). In that case, the disconnect seems conditional.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in mt7603/beacon.c at mt7603_pre_tbtt_tasklet and compare the beacon queue cleanup timing with commit c03d84c0d018946c068965ce91c5402f9f2dffbb. Reproduce with time iwinfo phy0-ap0 scan > /dev/null on the listed mt7628/mt7688 devices; done means scan time returns near 1.2–1.4 seconds without client disconnects.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.