All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Sergey Shtylyov <s.shtylyov@omp.ru>,
	Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Nikita Yushchenko <nikita.yoush@cogentembedded.com>,
	netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Biju Das <biju.das.au@gmail.com>
Subject: Re: [PATCH net-next 1/2] ravb: Add Rx checksum offload support
Date: Tue, 23 Jan 2024 17:09:21 -0800	[thread overview]
Message-ID: <20240123170921.51089d41@kernel.org> (raw)
In-Reply-To: <20240123151924.373917-2-biju.das.jz@bp.renesas.com>

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

  reply	other threads:[~2024-01-24  1:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 15:19 [PATCH net-next 0/2] Add HW check sum of load for RZ/G2L GbEthernet IP Biju Das
2024-01-23 15:19 ` [PATCH net-next 1/2] ravb: Add Rx checksum offload support Biju Das
2024-01-24  1:09   ` Jakub Kicinski [this message]
2024-01-24  8:31     ` Biju Das
2024-01-24 20:50       ` Sergey Shtylyov
2024-01-25  6:45         ` Biju Das
2024-01-23 15:19 ` [PATCH net-next 2/2] ravb: Add Tx " Biju Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240123170921.51089d41@kernel.org \
    --to=kuba@kernel.org \
    --cc=biju.das.au@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikita.yoush@cogentembedded.com \
    --cc=pabeni@redhat.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=s.shtylyov@omp.ru \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.