You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "CV-Bowen (via GitHub)" <gi...@apache.org> on 2026/10/22 18:00:47 UTC

[PR] drivers/virtio-net: fix TX/RX buffer reclaim on txdone, ifdown and remove [nuttx]

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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] drivers/virtio-net: fix TX/RX buffer reclaim on txdone, ifdown and remove [nuttx]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20896:
URL: https://github.com/apache/nuttx/pull/20896#issuecomment-6354310361

   <!-- membrowse-pr-comment -->
   ## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report &middot; [Explore what changed →](https://membrowse.com/public/apache/nuttx?commit_sha=e708a6e74bbd3e50adb6cf5cde0e247bb8a1d70f)
   
   
   *No memory changes detected for:*
   - [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=e708a6e74bbd3e50adb6cf5cde0e247bb8a1d70f&base=2ba1898abbd7d438b2975c82413761f8ddaba3a7)
   - [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=e708a6e74bbd3e50adb6cf5cde0e247bb8a1d70f&base=2ba1898abbd7d438b2975c82413761f8ddaba3a7)
   - [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=e708a6e74bbd3e50adb6cf5cde0e247bb8a1d70f&base=2ba1898abbd7d438b2975c82413761f8ddaba3a7)
   - [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=e708a6e74bbd3e50adb6cf5cde0e247bb8a1d70f&base=2ba1898abbd7d438b2975c82413761f8ddaba3a7)
   - [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=e708a6e74bbd3e50adb6cf5cde0e247bb8a1d70f&base=2ba1898abbd7d438b2975c82413761f8ddaba3a7)
   - [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=e708a6e74bbd3e50adb6cf5cde0e247bb8a1d70f&base=2ba1898abbd7d438b2975c82413761f8ddaba3a7)
   - [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=e708a6e74bbd3e50adb6cf5cde0e247bb8a1d70f&base=2ba1898abbd7d438b2975c82413761f8ddaba3a7)
   - [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=e708a6e74bbd3e50adb6cf5cde0e247bb8a1d70f&base=2ba1898abbd7d438b2975c82413761f8ddaba3a7)
   - [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=e708a6e74bbd3e50adb6cf5cde0e247bb8a1d70f&base=2ba1898abbd7d438b2975c82413761f8ddaba3a7)
   
   ---
   <sub>Catch memory regressions in CI with [MemBrowse](https://membrowse.com). Free for open source.</sub>
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org