This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit c8c0661c997e31df18fcdd5f6775d07bfae6eac3 Author: Marco Casaroli <[email protected]> AuthorDate: Sun Nov 8 19:19:38 2026 +0100 net/netdev: Build the checksum helpers without MM_IOB. netdev_checksum.c is built with every NET configuration. The pseudo header checksum and the TCP/UDP protocol lookup use IPv4BUF and IPv6BUF, which need IOB_DATA() from CONFIG_MM_IOB. A configuration with NET, NET_TCP or NET_UDP and without MM_IOB, for example sim:rpproxy (usrsock only), then fails: IOB_DATA is not declared. Use 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. No driver calls them there: a driver that offloads the checksum uses the IOB of the device. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- net/netdev/netdev_checksum.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/net/netdev/netdev_checksum.c b/net/netdev/netdev_checksum.c index d22c3985a57..e785cb653b7 100644 --- a/net/netdev/netdev_checksum.c +++ b/net/netdev/netdev_checksum.c @@ -85,7 +85,8 @@ static int32_t hardware_chksum_start(FAR struct iob_s *iob, * ****************************************************************************/ -#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_TCP) +#if defined(CONFIG_MM_IOB) && \ + (defined(CONFIG_NET_UDP) || defined(CONFIG_NET_TCP)) static uint8_t hardware_chksum_get_proto(FAR struct net_driver_s *dev) { uint8_t proto = 0; @@ -201,22 +202,23 @@ int netdev_checksum_start(FAR struct net_driver_s *dev) int netdev_checksum_offset(FAR struct net_driver_s *dev) { -#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_TCP) +#if defined(CONFIG_MM_IOB) && \ + (defined(CONFIG_NET_UDP) || defined(CONFIG_NET_TCP)) uint8_t proto = hardware_chksum_get_proto(dev); -#endif -#ifdef CONFIG_NET_UDP +# ifdef CONFIG_NET_UDP if (proto == IP_PROTO_UDP) { return offsetof(struct udp_hdr_s, udpchksum); } -#endif +# endif -#ifdef CONFIG_NET_TCP +# ifdef CONFIG_NET_TCP if (proto == IP_PROTO_TCP) { return offsetof(struct tcp_hdr_s, tcpchksum); } +# endif #endif return -EINVAL; @@ -238,7 +240,7 @@ int netdev_checksum_offset(FAR struct net_driver_s *dev) uint16_t netdev_upperlayer_header_checksum(FAR struct net_driver_s *dev) { -#ifdef CONFIG_NET_IPv6 +#if defined(CONFIG_MM_IOB) && defined(CONFIG_NET_IPv6) # ifdef CONFIG_NET_IPv4 if (IFF_IS_IPv6(dev->d_flags)) # endif @@ -250,7 +252,7 @@ uint16_t netdev_upperlayer_header_checksum(FAR struct net_driver_s *dev) IPv6_HDRLEN)); } #endif -#ifdef CONFIG_NET_IPv4 +#if defined(CONFIG_MM_IOB) && defined(CONFIG_NET_IPv4) # ifdef CONFIG_NET_IPv6 else # endif
