All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>,
	David Laight <David.Laight@aculab.com>
Subject: Re: [PATCH net-next 2/2] net: optimize skb_postpull_rcsum()
Date: Thu, 2 Dec 2021 23:07:05 +0200	[thread overview]
Message-ID: <20211202210705.vsqr67svt3sm53h3@skbuf> (raw)
In-Reply-To: <CANn89iJOH0QtRhDfBzJr3fpJPNCQJhbMqT_8sa+vH_6mmZ7xhw@mail.gmail.com>

On Thu, Dec 02, 2021 at 12:37:35PM -0800, Eric Dumazet wrote:
> On Thu, Dec 2, 2021 at 11:32 AM Eric Dumazet <edumazet@google.com> wrote:
> >
> > Thanks Vladimir
> >
> > I think that maybe the issue is that the initial skb->csum is zero,
> > and the csum_parttial(removed_block) is also zero.
> >
> > But the initial skb->csum should not be zero if you have a non " all
> > zero"  frame.
> >
> > Can you double check this in drivers/net/ethernet/freescale/enetc/enetc.c ?
> 
> Yes, I am not sure why the csum is inverted in enetc_get_offloads()

I guess it's inverted because the hardware doesn't provide its one's
complement.

> Perhaps
> 
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c
> b/drivers/net/ethernet/freescale/enetc/enetc.c
> index 504e12554079e306e477b9619f272d6e96527377..72524f14cae0093763f8a3f57b1e08e31bc4df1a
> 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc.c
> @@ -986,7 +986,7 @@ static void enetc_get_offloads(struct enetc_bdr *rx_ring,
>         if (rx_ring->ndev->features & NETIF_F_RXCSUM) {
>                 u16 inet_csum = le16_to_cpu(rxbd->r.inet_csum);
> 
> -               skb->csum = csum_unfold((__force __sum16)~htons(inet_csum));
> +               skb->csum = csum_unfold((__force __sum16)htons(inet_csum));
>                 skb->ip_summed = CHECKSUM_COMPLETE;
>         }
> 
> If this does not work, then maybe :
> 
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c
> b/drivers/net/ethernet/freescale/enetc/enetc.c
> index 504e12554079e306e477b9619f272d6e96527377..d190faa9a8242f9f3f962dd30b9f4409a83ee697
> 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc.c
> @@ -987,7 +987,8 @@ static void enetc_get_offloads(struct enetc_bdr *rx_ring,
>                 u16 inet_csum = le16_to_cpu(rxbd->r.inet_csum);
> 
>                 skb->csum = csum_unfold((__force __sum16)~htons(inet_csum));
> -               skb->ip_summed = CHECKSUM_COMPLETE;
> +               if (likely(skb->csum))
> +                       skb->ip_summed = CHECKSUM_COMPLETE;
>         }
> 
>         if (le16_to_cpu(rxbd->r.flags) & ENETC_RXBD_FLAG_VLAN) {

I guess you aren't interested any longer in the result of these changes,
since the csum isn't zero in enetc?

  reply	other threads:[~2021-12-02 21:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 20:24 [PATCH net-next 0/2] net: small csum optimizations Eric Dumazet
2021-11-24 20:24 ` [PATCH net-next 1/2] gro: optimize skb_gro_postpull_rcsum() Eric Dumazet
2021-11-24 20:24 ` [PATCH net-next 2/2] net: optimize skb_postpull_rcsum() Eric Dumazet
2021-11-25  9:41   ` David Laight
2021-11-25 13:32     ` Eric Dumazet
2021-11-25 14:29       ` David Laight
2021-12-02 13:10   ` Vladimir Oltean
2021-12-02 14:51     ` Eric Dumazet
2021-12-02 16:29       ` Vladimir Oltean
2021-12-02 19:32         ` Eric Dumazet
2021-12-02 20:37           ` Eric Dumazet
2021-12-02 21:07             ` Vladimir Oltean [this message]
2021-12-02 20:40           ` Vladimir Oltean
2021-12-02 20:58             ` Vladimir Oltean
2021-12-02 20:58             ` David Laight
2021-12-02 21:40               ` Vladimir Oltean
2021-12-03 14:51                 ` David Laight
2021-12-03 14:57                 ` David Laight
2021-12-03 16:14                   ` Vladimir Oltean
2021-12-03 16:30                     ` Eric Dumazet
2021-12-03 16:47                       ` David Laight
2021-12-03 16:58                         ` Eric Dumazet
2021-12-03 17:41                           ` David Laight
2021-12-02 15:06     ` David Laight
2021-12-02 15:22       ` Eric Dumazet
2021-11-26  5:20 ` [PATCH net-next 0/2] net: small csum optimizations patchwork-bot+netdevbpf

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=20211202210705.vsqr67svt3sm53h3@skbuf \
    --to=olteanv@gmail.com \
    --cc=David.Laight@aculab.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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.