lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABGOaVTY6BrzJTYEtVXwawzP7-D8sb1KASDWFk15v0QFaJVbUg@mail.gmail.com>
Date:   Tue, 4 Feb 2020 11:25:12 +0530
From:   Yadu Kishore <kyk.segfault@...il.com>
To:     netdev@...r.kernel.org
Subject: TCP checksum not offloaded during GSO

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@...antis.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@...antis.com>
    Signed-off-by: David S. Miller <davem@...emloft.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ