[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240123170921.51089d41@kernel.org>
Date: Tue, 23 Jan 2024 17:09:21 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Biju Das <biju.das.jz@...renesas.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Sergey Shtylyov
<s.shtylyov@....ru>, Claudiu Beznea <claudiu.beznea.uj@...renesas.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>, Wolfram Sang
<wsa+renesas@...g-engineering.com>, Nikita Yushchenko
<nikita.yoush@...entembedded.com>, netdev@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, Geert Uytterhoeven
<geert+renesas@...der.be>, Prabhakar Mahadev Lad
<prabhakar.mahadev-lad.rj@...renesas.com>, Biju Das <biju.das.au@...il.com>
Subject: Re: [PATCH net-next 1/2] ravb: Add Rx checksum offload support
On Tue, 23 Jan 2024 15:19:23 +0000 Biju Das wrote:
> +static void ravb_rx_csum_gbeth(struct sk_buff *skb)
> +{
> + __sum16 csum_ip_hdr, csum_proto;
> + u8 *hw_csum;
> +
> + /* The hardware checksum status is contained in sizeof(__sum16) * 2 = 4
> + * bytes appended to packet data. First 2 bytes is ip header csum and
> + * last 2 bytes is protocol csum.
> + */
> + if (unlikely(skb->len < sizeof(__sum16) * 2))
> + return;
> +
> + hw_csum = skb_tail_pointer(skb) - sizeof(__sum16);
> + csum_proto = csum_unfold((__force __sum16)get_unaligned_le16(hw_csum));
> +
> + hw_csum -= sizeof(__sum16);
> + csum_ip_hdr = csum_unfold((__force __sum16)get_unaligned_le16(hw_csum));
> + skb_trim(skb, skb->len - 2 * sizeof(__sum16));
> +
> + /* TODO: IPV6 Rx csum */
> + if (skb->protocol == htons(ETH_P_IP) && csum_ip_hdr == TOE_RX_CSUM_OK &&
> + csum_proto == TOE_RX_CSUM_OK)
> + /* Hardware validated our checksum */
> + skb->ip_summed = CHECKSUM_UNNECESSARY;
> +}
sparse does not seem to be onboard:
drivers/net/ethernet/renesas/ravb_main.c:771:20: warning: incorrect type in assignment (different base types)
drivers/net/ethernet/renesas/ravb_main.c:771:20: expected restricted __sum16 [usertype] csum_proto
drivers/net/ethernet/renesas/ravb_main.c:771:20: got restricted __wsum
drivers/net/ethernet/renesas/ravb_main.c:774:21: warning: incorrect type in assignment (different base types)
drivers/net/ethernet/renesas/ravb_main.c:774:21: expected restricted __sum16 [usertype] csum_ip_hdr
drivers/net/ethernet/renesas/ravb_main.c:774:21: got restricted __wsum
--
pw-bot: cr
Powered by blists - more mailing lists