daniel-p-carvalho opened a new pull request, #20576: URL: https://github.com/apache/nuttx/pull/20576
## Summary Convert the PIC32MZ Ethernet MAC driver (`arch/mips/src/pic32mz/pic32mz_ethernet.c`) from the legacy `net_driver_s` model to `netdev_lowerhalf_s`, registered with `netdev_lower_register()`. Why: the Ethernet bridge in #20519 is being restructured as a lowerhalf driver (see the review there), and this driver is the Ethernet side of its main use case (Ethernet <-> PIC32MZ-W1 Wi-Fi, whose driver is already lowerhalf). It also moves one more in-tree MAC to the new model. How: - Each RX/TX descriptor owns a DMA buffer of its own (the free buffer list is gone). - `receive()` takes the next frame in ring order, copies it to a `netpkt` and gives the descriptor back to the hardware. The interrupt only calls `netdev_lower_rxready()`. - `transmit()` copies the packet to the buffer of the next TX descriptor and holds the `netpkt` until the descriptor is reclaimed. The TX quota is the number of TX descriptors, so the upper half never queues more than the ring can take. `reclaim()` and the TX done interrupt release the sent descriptors. - The RX ring order / `BUFCDEC` handling and the TX done fixes already in the driver (#20571) are kept. - The TX timeout watchdog is kept: it resets the interface, and the packets held for the TX descriptors are released on `ifup`/`ifdown`. - Removed: the buffer list, `devif_poll()` use, the response/pending logic and `txavail`. The copy in each direction is unavoidable here: the IOB buffers are not DMA aligned and the descriptors need buffers in the KSEG0/KSEG1 window of `g_buffers`. ## Impact - Only `arch/mips/src/pic32mz/pic32mz_ethernet.c` changes. No Kconfig, board or API change. - Users of the driver get the lowerhalf upper half (net statistics, VLAN and, with #20519, bridge support). - `CONFIG_NET_MCASTGROUP` keeps the existing (not implemented) `addmac`/`rmmac` stubs, now with the lowerhalf signature. ## Testing Host: Ubuntu, NuttX built with XC32 v6.00 and with the CI Pinguino p32-gcc 4.9.2 (both without warnings); `checkpatch` clean. Target: custom board derived from the EV49N51A (PIC32MZ-W1, LAN8720A), `ev49n51a:netnsh` + `NETUTILS_IPERF`, 2 TX / 4 RX descriptors, IOB 24 x 196, cable straight to the host (100 Mbit/s full duplex). | Test | Result | Legacy driver (master) | |---|---|---| | 1000 pings, `-i 0.2` | 0% loss, rtt 0.5-0.76 ms | - | | TCP host -> board | 27.5 Mbit/s | 28 | | TCP board -> host | 51.7 Mbit/s | 47 | | UDP host -> board 50M | 44585/44585 datagrams received | full | | UDP host -> board 95M | flood survives, board keeps answering | survives | | UDP board -> host | 84.7 Mbit/s, 0 lost | - | | 5 x `ifdown`/`ifup` with ping running | recovers every time (about 5 s outage per cycle), no heap growth | - | | 3 x `ifdown`/`ifup` under TCP TX load | recovers, TCP back to 50.5 Mbit/s, no leftover task | - | Not tested: the TX timeout path, `CONFIG_NET_MCASTGROUP` (it does not build in the test configuration), and more than one interface (the driver supports one). -- 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]
