HedongGao opened a new pull request, #21502: URL: https://github.com/apache/nuttx/pull/21502
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary Add a sched_note driver that streams instrumentation data over a network device as UDP packets, together with the netpoll infrastructure it relies on. This PR contains three commits: 1. **drivers/note: fix nxstyle errors in note_driver.c** Whitespace-only cleanup of existing nxstyle errors in `drivers/note/note_driver.c` (indentation, brace alignment, blank lines after declarations), so that the file passes `tools/nxstyle`. `git diff -w` for this commit is empty. No functional change. 2. **net: add netpoll support** (author: @p-szafonimateusz) Netpoll, inspired by the Linux feature of the same name, allows sending and receiving UDP packets with minimal involvement of the network stack, so it can be used where the stack is normally not usable, such as interrupt context or the final stage of a panic. It is built on top of `struct netdev_lowerhalf_s`; an optional `txpoll` op is added to `struct netdev_ops_s` to wait for transmission done. New option: `CONFIG_NET_NETPOLL`. 3. **drivers/note: add note over netdev** (author: @p-szafonimateusz) New note driver `notenet_driver.c` which packs note records into UDP packets and sends them through netpoll, from a work queue or immediately when the buffer is 75% full. A panic notifier flushes the remaining data on `PANIC_KERNEL_FINAL`. The driver is bound to the interface named `CONFIG_DRIVERS_NOTENET_INTF` when it is brought up by the netdev upper-half driver (`drivers/net/netdev_drivers.c`). New options: `CONFIG_DRIVERS_NOTENET`, `CONFIG_DRIVERS_NOTENET_INTF`, `_IPADDR`, `_MAC`, `_PORT`, `_WORK_DELAY`. Documentation is added under `Documentation/os/networking/` (`netpoll.rst`, `note.rst`). ## Impact - New features, all disabled by default. No behavior change unless `CONFIG_NET_NETPOLL` / `CONFIG_DRIVERS_NOTENET` are enabled. - Only network drivers based on the netdev lower-half interface are supported. - `struct netdev_ops_s` gets an optional `txpoll` member only when `CONFIG_NET_NETPOLL=y`. - The netpoll commit carries `[skip-cmake-parity]`: `net/Makefile` includes the new `netpoll/Make.defs`, while CMake picks up `net/netpoll/CMakeLists.txt` automatically via `nuttx_add_subdirectory()`. ## Testing Host: Ubuntu 22.04 x86_64, Linux 6.8, GCC 13.1. - `./tools/checkpatch.sh -c -u -m -g apache/master..HEAD`: all checks pass. - Build test `sim:tcpblaster` (CMake + Ninja) with: ``` CONFIG_SCHED_INSTRUMENTATION=y CONFIG_DRIVERS_NOTE=y CONFIG_DRIVERS_NOTE_MAX=2 CONFIG_NET_NETPOLL=y CONFIG_DRIVERS_NOTENET=y ``` Builds successfully; `notenet_init`, `netpoll_udp_init`, `g_notenet` and `netdev_drivers_init` are linked into the image. No new warnings (the existing `note_common` / `noteram_dump_header` unused-function warnings are 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]
