netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Yadu Kishore <kyk.segfault@gmail.com>
Cc: Network Development <netdev@vger.kernel.org>
Subject: Re: TCP checksum not offloaded during GSO
Date: Wed, 5 Feb 2020 16:43:51 -0500	[thread overview]
Message-ID: <CA+FuTSeYGYr3Umij+Mezk9CUcaxYwqEe5sPSuXF8jPE2yMFJAw@mail.gmail.com> (raw)
In-Reply-To: <CABGOaVTY6BrzJTYEtVXwawzP7-D8sb1KASDWFk15v0QFaJVbUg@mail.gmail.com>

On Tue, Feb 4, 2020 at 12:55 AM Yadu Kishore <kyk.segfault@gmail.com> wrote:
>
> Hi,
>
> I'm working on enhancing a driver for a Network Controller that
> supports "Checksum Offloads".
> So I'm offloading TCP/UDP checksum computation in the network driver
> using NETIF_F_HW_CSUM on
> linux kernel version 4.19.23 aarch64 for hikey android platform. The
> Network Controller does not support scatter-gather (SG) DMA.
> Hence I'm not enabling the NETIF_IF_SG feature.
> I see that GSO for TCP is enabled by default in the kernel 4.19.23
> When running iperf TCP traffic I observed that the TCP checksum is not
> offloaded for the majority
> of the TCP packets. Most of the skbs received in the output path in
> the driver have skb->ip_summed
> set to CHECKSUM_NONE.
> The csum is offloaded only for the initial TCP connection establishment packets.
> For UDP I do not observe this problem.
> It appears that a decision was taken not to offload TCP csum (during GSO)
> if the network driver does not support SG :
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 02c638a643ea..9c065ac72e87 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -3098,8 +3098,9 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
>   if (nskb->len == len + doffset)
>   goto perform_csum_check;
>
> - if (!sg && !nskb->remcsum_offload) {
> - nskb->ip_summed = CHECKSUM_NONE;
> + if (!sg) {
> + if (!nskb->remcsum_offload)
> + nskb->ip_summed = CHECKSUM_NONE;
>   SKB_GSO_CB(nskb)->csum =
>   skb_copy_and_csum_bits(head_skb, offset,
>         skb_put(nskb, len),
>
> The above is a code snippet from the actual commit :
>
> commit 7fbeffed77c130ecf64e8a2f7f9d6d63a9d60a19

This behavior goes back to the original introduction of gso and
skb_segment, commit f4c50d990dcf ("[NET]: Add software TSOv4").

Without scatter-gather, the data has to be copied from skb linear to
nskb linear. This code is probably the way that it is because if it
has to copy anyway, it might as well perform the copy-and-checksum
optimization.

  reply	other threads:[~2020-02-05 21:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04  5:55 TCP checksum not offloaded during GSO Yadu Kishore
2020-02-05 21:43 ` Willem de Bruijn [this message]
2020-02-21  5:13   ` [PATCH] net: Make skb_segment not to compute checksum if network controller supports checksumming Yadu Kishore
2020-02-23  2:41     ` Willem de Bruijn
2020-02-28  5:24       ` Yadu Kishore
2020-02-28 14:30         ` Willem de Bruijn
2020-02-28 20:01           ` David Miller
2020-03-02  6:51             ` [PATCH v2] " Yadu Kishore
2020-03-02  8:42               ` Yadu Kishore
2020-03-02 15:19                 ` David Laight
2020-03-03  9:15                   ` Yadu Kishore
2020-03-03  9:56                     ` David Laight
2020-03-05  6:32                       ` Yadu Kishore
2020-03-05 16:06                         ` Willem de Bruijn
2020-03-05 17:00                           ` David Laight
2020-03-05 17:19                             ` Eric Dumazet
2020-03-06 17:12                               ` David Laight
2020-03-13  6:36                                 ` Yadu Kishore
2020-03-13 13:57                                   ` Willem de Bruijn
2020-03-13 14:04                                     ` David Laight
2020-03-13 18:05                                   ` David Miller
2020-03-17  8:38                                     ` [PATCH v3] " Yadu Kishore
2020-03-22  3:06                                       ` David Miller
2020-03-22 14:40                                       ` Willem de Bruijn
2020-03-23 20:00                                       ` David Miller
2020-03-22 19:53                                 ` [PATCH v2] " Tom Herbert
2020-03-23  9:15                                   ` David Laight
2020-02-06 12:13 ` TCP checksum not offloaded during GSO David Laight

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=CA+FuTSeYGYr3Umij+Mezk9CUcaxYwqEe5sPSuXF8jPE2yMFJAw@mail.gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=kyk.segfault@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).