netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* TCP checksum not offloaded during GSO
@ 2020-02-04  5:55 Yadu Kishore
  2020-02-05 21:43 ` Willem de Bruijn
  2020-02-06 12:13 ` TCP checksum not offloaded during GSO David Laight
  0 siblings, 2 replies; 28+ messages in thread
From: Yadu Kishore @ 2020-02-04  5:55 UTC (permalink / raw)
  To: netdev

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
Author: Alexander Duyck <aduyck@mirantis.com>
Date:   Fri Feb 5 15:27:43 2016 -0800

    net: Update remote checksum segmentation to support use of GSO checksum

    This patch addresses two main issues.

    First in the case of remote checksum offload we were avoiding dealing with
    scatter-gather issues.  As a result it would be possible to assemble a
    series of frames that used frags instead of being linearized as they should
    have if remote checksum offload was enabled.

    Second I have updated the code so that we now let GSO take care of doing
    the checksum on the data itself and drop the special case that was added
    for remote checksum offload.

    Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

However it appears that even before the above commit the original
condition did seem to indicate
that if the network driver does not support SG, the csum would be
computed by the kernel itself (in case of GSO).
We would like to know the reason for this design decision (to NOT
offload checksum computation to the HW in case of GSO).
Our intention is to find out a way to enable/offload CSUM computation
to the HW even when GSO is active (TCP).

Thanks,
Yadu Kishore

^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2020-03-23 20:00 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04  5:55 TCP checksum not offloaded during GSO Yadu Kishore
2020-02-05 21:43 ` Willem de Bruijn
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

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).