[PATCH 07/10] net: netconsole: use net_eth_to_udp() for packet parsing

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


On 4/2/26 8:36 AM, Sascha Hauer wrote:
> Replace the separate net_eth_to_udp_payload() and net_eth_to_udplen()
> calls with the new consolidated net_eth_to_udp() helper.
> 
> 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/netconsole.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/net/netconsole.c b/net/netconsole.c
> index 28fd0e98ec..859cfe8e6f 100644
> --- a/net/netconsole.c
> +++ b/net/netconsole.c
> @@ -33,9 +33,12 @@ static struct nc_priv *g_priv;
>  static void nc_handler(void *ctx, char *pkt, unsigned len)
>  {
>  	struct nc_priv *priv = g_priv;
> -	unsigned char *packet = net_eth_to_udp_payload(pkt);
> +	struct net_udp_pkt udp;
>  
> -	kfifo_put(priv->fifo, packet, net_eth_to_udplen(pkt));
> +	if (net_eth_to_udp(pkt, len, &udp))
> +		return;
> +
> +	kfifo_put(priv->fifo, udp.payload, udp.len);
>  }
>  
>  static int nc_getc(struct console_device *cdev)
> 

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