[PATCH 10/10] net: remove unused net_eth_to_udp{hdr,_payload,len}() helpers

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



On 4/2/26 8:36 AM, Sascha Hauer wrote:
> All callers have been converted to net_eth_to_udp() which validates
> the packet length before accessing headers.  Remove the old helpers.
> 
> 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>

> ---
>  include/net.h | 16 ----------------
>  1 file changed, 16 deletions(-)
> 
> diff --git a/include/net.h b/include/net.h
> index bdf39bc531..4d443135c1 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -282,11 +282,6 @@ static inline struct iphdr *net_eth_to_iphdr(char *pkt)
>  	return (struct iphdr *)(pkt + ETHER_HDR_SIZE);
>  }
>  
> -static inline struct udphdr *net_eth_to_udphdr(char *pkt)
> -{
> -	return (struct udphdr *)(net_eth_to_iphdr(pkt) + 1);
> -}
> -
>  static inline struct icmphdr *net_eth_to_icmphdr(char *pkt)
>  {
>  	return (struct icmphdr *)(net_eth_to_iphdr(pkt) + 1);
> @@ -297,17 +292,6 @@ static inline char *net_eth_to_icmp_payload(char *pkt)
>  	return (char *)(net_eth_to_icmphdr(pkt) + 1);
>  }
>  
> -static inline char *net_eth_to_udp_payload(char *pkt)
> -{
> -	return (char *)(net_eth_to_udphdr(pkt) + 1);
> -}
> -
> -static inline int net_eth_to_udplen(char *pkt)
> -{
> -	struct udphdr *udp = net_eth_to_udphdr(pkt);
> -	return ntohs(udp->uh_ulen) - 8;
> -}
> -
>  struct net_udp_pkt {
>  	struct udphdr *udp;
>  	void *payload;
> 

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