[PATCH 09/10] net: fastboot: stop using net_eth_to_udp_payload() for PACKET_SIZE

Sascha Hauer
2026-04-02T06:37:26Z

The PACKET_SIZE macro used net_eth_to_udp_payload(0) as a trick to
compute the combined ethernet + IP + UDP header size at compile time.
Replace this with an explicit constant, removing the last user of the
old helpers outside of the header itself.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---
net/fastboot.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/fastboot.c b/net/fastboot.c
index 506af00cb8..b1cb8c8bf6 100644
--- a/net/fastboot.c
+++ b/net/fastboot.c
@@ -23,8 +23,8 @@

#define FASTBOOT_PORT 5554
#define MAX_MTU 1500
-#define PACKET_SIZE (min(PKTSIZE, MAX_MTU + ETHER_HDR_SIZE) \
- - (net_eth_to_udp_payload(0) - (char *)0))
+#define NET_UDP_HDR_SIZE (ETHER_HDR_SIZE + sizeof(struct iphdr) + sizeof(struct udphdr))
+#define PACKET_SIZE (min(PKTSIZE, MAX_MTU + ETHER_HDR_SIZE) - NET_UDP_HDR_SIZE)

enum {
FASTBOOT_ERROR = 0,

--
2.47.3