casaroli opened a new pull request, #21560:
URL: https://github.com/apache/nuttx/pull/21560

   ## Summary
   
   `net/netdev/netdev_checksum.c` is built with every NET configuration, but 
`netdev_upperlayer_header_checksum()` and the protocol lookup of 
`netdev_checksum_offset()` use `IPv4BUF`/`IPv6BUF`, which need `IOB_DATA()` 
from `CONFIG_MM_IOB`. In a configuration with NET, NET_TCP or NET_UDP and 
without MM_IOB, for example sim:rpproxy (usrsock only, no Ethernet), `IOB_DATA` 
is not declared. clang and gcc 16 stop with an error ("implicit declaration of 
function 'IOB_DATA'"). The gcc 12 of the CI image gives no diagnostic, because 
the call comes from a macro of a header under `-isystem`, and the link drops 
the unused functions, so CI passes.
   
   This PR uses these buffers only with `CONFIG_MM_IOB`, as 
`netdev_checksum_start()` already does. Without MM_IOB, 
`netdev_checksum_offset()` returns `-EINVAL` and 
`netdev_upperlayer_header_checksum()` returns 0. The first commit adds two 
blank lines that nxstyle asks for in the same file (whitespace only).
   
   ## Impact
   
   - Configurations without MM_IOB only. With MM_IOB the code does not change.
   - No code calls these functions without MM_IOB: a driver that offloads the 
checksum uses the IOB of the device.
   - Documentation/ (`Documentation/os/networking/netdev.rst`) does not 
describe this case, so there is no documentation change.
   
   ## Testing
   
   Builds with `EXTRAFLAGS=-Wno-cpp -Werror`, nuttx master 6d1fa235d69 vs this 
PR:
   
   | Configuration | MM_IOB | master | this PR |
   |---|---|---|---|
   | sim:rpproxy, macOS host (clang), `NETUTILS_IPERF` off | no | FAIL: 
`netdev_checksum.c:107` and `:256`, `IOB_DATA` not declared | OK |
   | sim:rpproxy, Linux, CI image (gcc 12.3), `tools/testbuild.sh -N -e 
"-Wno-cpp -Werror"`, make and CMake | no | OK (no diagnostic; 
`netdev_checksum.o` has an undefined `IOB_DATA`) | OK |
   | `netdev_checksum.c` of sim:rpproxy, gcc 16.2 with the same flags | no | 
FAIL: implicit declaration of `IOB_DATA` (`:107`) | OK |
   | sim:rpproxy, macOS host, with the apps fix for iperf 
(apache/nuttx-apps#NNNNN) | no | not run | OK |
   | qemu-armv8a:netnsh (aarch64 gcc) | yes | not run | OK |
   | qemu-armv8a:netnsh + `NET_IPv6` (both IP versions) | yes | not run | OK |
   
   sim:rpproxy with `NET_IPv6` on and no MM_IOB still fails in other files 
(`net/neighbor/neighbor_lookup.c`: no `d_mac`, and `netinit.c` in apps); 
`netdev_checksum.c` builds there. That is a separate problem.
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
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]

Reply via email to