Re: [PATCH] net: ethernet: use ip_hdrlen() instead of bit shift
From: Moon Yeounsu
Date: Fri Aug 02 2024 - 21:21:55 EST
On Fri, Aug 2, 2024 at 10:35 PM Christophe JAILLET
<christophe.jaillet@xxxxxxxxxx> wrote:
> The extra () around "ip_hdrlen(skb)" can be remove.
> Also maybe the ones around "ETH_HLEN + ip_hdrlen(skb)" could also be
> removed.
Okay, I'll send the next patch which the parenthesis are removed!
But... The parenthesis around `ETH_HLEN + ip_hdrlen(skb) +
sizeof(struct udphdr)`
should be retained, because it makes a clear boundary.
>
> > skb_reset_network_header(skb);
> > return csum;
> > }
> > - skb_set_transport_header(skb,
> > - ETH_HLEN + (ip_hdr(skb)->ihl << 2));
> > + skb_set_transport_header(skb, ETH_HLEN + (ip_hdrlen(skb)));
>
> Same here, the extra () around "ip_hdrlen(skb)" can be remove.
I'll remove it also.
>
> CJ
>
> > csum = udp_hdr(skb)->check;
> > skb_reset_transport_header(skb);
> > skb_reset_network_header(skb);
>
Thank you for reviewing ^오^