fix: fix race in IwxProcessEvents; fix WiFi bugs

This commit is contained in:
daniel committed 2026-10-02 10:21:18 +02:00
1 parent c91de69189
commit ef1e69ae83
7 files changed
+191 -27

No files matched your search

+12
View File
@@ -27,6 +27,10 @@ def link_of(result):
f = result.split()
return int(f[f.index('LINK') + 1]) if 'LINK' in f else -1
def work_of(result):
f = result.split()
return int(f[f.index('WORK') + 1]) if 'WORK' in f else -1
def check(cond, what):
print(f" {'PASS' if cond else 'FAIL'} {what}")
if not cond:
@@ -656,6 +660,9 @@ d8.cmd("RXMGMT " + mgmt(0x10, STA, AP, AP,
struct.pack('<HHH', 0x0421, 0, 7 | 0xc000)).hex())
ev = d8.cmd("SERVICE")
check(link_of(ev['result']) == 1, "the open network is associated and the link is up")
# The idle loop only hands a connection to a core for servicing when this
# says there is something to do, so a settled link must report nothing.
check(work_of(ev['result']) == 0, "a settled link has no service work pending")
# Well short of the threshold: a few unacknowledged frames are ordinary.
ev = d8.cmd("TXSTATUS 0 15")
@@ -682,6 +689,10 @@ check(link_of(ev['result']) == 1,
"the transmit path itself does not tear anything down")
check(not ev['CMD'],
"no firmware command is sent from the completion path")
# The pump that noticed this may run on a different core from the one that
# services the connection; the pending teardown has to be visible by itself.
check(work_of(ev['result']) == 1,
"the pending teardown is reported as service work")
ev = d8.cmd("SERVICE")
check(state_of(ev['result']) == 0 and link_of(ev['result']) == 0,
@@ -689,6 +700,7 @@ check(state_of(ev['result']) == 0 and link_of(ev['result']) == 0,
check(any(c == MAC_CONFIG and struct.unpack_from('<I', p, 4)[0] == 3
for c, p in ev['CMD']),
"and unwinds the firmware contexts")
check(work_of(ev['result']) == 0, "and leaves no service work behind")
d8.p.stdin.close()
print()
+4 -2
View File
@@ -204,10 +204,12 @@ int main() {
unsigned acked, count;
sscanf(line.c_str(), "TXSTATUS %u %u", &acked, &count);
for (unsigned i = 0; i < count; i++) IwxConnectNoteTx(acked != 0);
printf("DONE STATE %d LINK %d\n", IwxConnectState(), IwxLinkUp() ? 1 : 0);
printf("DONE STATE %d LINK %d WORK %d\n", IwxConnectState(),
IwxLinkUp() ? 1 : 0, IwxConnectHasWork() ? 1 : 0);
} else if (line.rfind("SERVICE", 0) == 0) {
IwxConnectService();
printf("DONE STATE %d LINK %d\n", IwxConnectState(), IwxLinkUp() ? 1 : 0);
printf("DONE STATE %d LINK %d WORK %d\n", IwxConnectState(),
IwxLinkUp() ? 1 : 0, IwxConnectHasWork() ? 1 : 0);
} else if (line.rfind("TICK ", 0) == 0) {
unsigned ms; sscanf(line.c_str(), "TICK %u", &ms);
Timekeeping::g_ms += ms;