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

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Apr 17 03:17:19 PDT 2026



On 4/2/26 8:36 AM, Sascha Hauer wrote:
> 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 at pengutronix.de>
> Co-Authored-By: Claude Opus 4.6 <noreply at anthropic.com>

Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>

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

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list