CV-Bowen opened a new pull request, #20896:
URL: https://github.com/apache/nuttx/pull/20896
## Summary
virtio-net buffer handling fixes:
- free completed TX buffers in the TX done callback; when the TX quota
is exhausted nothing else returned them, and senders such as IGMP and
MLD waited for a message forever
- drain the RX and TX virtqueues on ifdown instead of leaving the RX
buffers queued, and free the netpkt when virtio_net_rxfill() fails to
queue it
- on remove, drain both the used and the avail ring of each virtqueue
after resetting the device, so the pre-filled RX ring and pending TX
buffers are freed
## Impact
virtio-net only. No API or Kconfig change.
## Testing
Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu
13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU
Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
`qemu-armv8a:netnsh` with `-device virtio-net-pci -netdev user`:
ping, ifdown/ifup, ping again, then `/proc/iobinfo`:
```
qemu-system-aarch64 -cpu cortex-a53 -nographic \
-machine virt,virtualization=on,gic-version=3 \
-global virtio-mmio.force-legacy=false \
-device virtio-net-pci,netdev=u1 -netdev user,id=u1 \
-kernel ./nuttx
```
| | master | this PR |
|---|---|---|
| ping 20 before ifdown | 20/20 | 20/20 |
| ping 20 after ifdown/ifup | 20/20 | 20/20 |
| iobinfo ntotal/nfree after 4 ifdown/ifup cycles | 64/48 | 64/48 |
<details><summary>ping, ifdown/ifup, ping</summary>
```
nsh> ping -c 20 10.0.2.2
PING 10.0.2.2 56 bytes of data
56 bytes from 10.0.2.2: icmp_seq=0 time=40.0 ms
56 bytes from 10.0.2.2: icmp_seq=1 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=2 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=3 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=4 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=5 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=6 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=7 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=8 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=9 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=10 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=11 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=12 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=13 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=14 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=15 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=16 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=17 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=18 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=19 time=10.0 ms
20 packets transmitted, 20 received, 0% packet loss, time 20200 ms
rtt min/avg/max/mdev = 10.000/16.000/40.000/7.348 ms
nsh> ifdown eth0
ifdown eth0...OK
nsh> ifup eth0
ifup eth0...OK
nsh> ping -c 20 10.0.2.2
PING 10.0.2.2 56 bytes of data
56 bytes from 10.0.2.2: icmp_seq=0 time=30.0 ms
56 bytes from 10.0.2.2: icmp_seq=1 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=2 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=3 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=4 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=5 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=6 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=7 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=8 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=9 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=10 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=11 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=12 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=13 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=14 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=15 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=16 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=17 time=20.0 ms
56 bytes from 10.0.2.2: icmp_seq=18 time=10.0 ms
56 bytes from 10.0.2.2: icmp_seq=19 time=20.0 ms
20 packets transmitted, 20 received, 0% packet loss, time 20200 ms
rtt min/avg/max/mdev = 10.000/16.000/30.000/5.830 ms
nsh> cat /proc/iobinfo
ntotal nfree nwait nthrottle
```
</details>
The IGMP/MLD stall and driver remove were not reproduced here.
No regression in rpmsg: sim:rpserver/rpproxy and
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping,
rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC
disabled, which current master needs for nxinit to start nsh there; unrelated
to this change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]