diff mbox series

[net-next,v2] netdev: clarify GSO vs csum in qstats

Message ID 20250214224601.2271201-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit b5e489003abcff4b65088d49fce78dcb3cc1ae06
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] netdev: clarify GSO vs csum in qstats | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: donald.hunter@gmail.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-15--18-00 (tests: 891)

Commit Message

Jakub Kicinski Feb. 14, 2025, 10:46 p.m. UTC
Could be just me, but I had to pause and double check that the Tx csum
counter in qstat should include GSO'd packets. GSO pretty much implies
csum so one could possibly interpret the csum counter as pure csum offload.

But the counters are based on virtio:

  [tx_needs_csum]
      The number of packets which require checksum calculation by the device.

  [rx_needs_csum]
      The number of packets with VIRTIO_NET_HDR_F_NEEDS_CSUM.

and VIRTIO_NET_HDR_F_NEEDS_CSUM gets set on GSO packets virtio sends.

Clarify this in the spec to avoid any confusion.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2:
 - remove the note that almost all GSO types need L4 csum
v1: https://lore.kernel.org/20250213010457.1351376-1-kuba@kernel.org

CC: willemb@google.com
CC: ecree.xilinx@gmail.com
CC: neescoba@cisco.com
---
 Documentation/netlink/specs/netdev.yaml | 2 ++
 1 file changed, 2 insertions(+)

Comments

Willem de Bruijn Feb. 14, 2025, 11:15 p.m. UTC | #1
Jakub Kicinski wrote:
> Could be just me, but I had to pause and double check that the Tx csum
> counter in qstat should include GSO'd packets. GSO pretty much implies
> csum

Unfortunately specifically to virtio_net, this sensible limitation was
not enforced from the start. Which is why virtio_net_hdr_to_skb has a
branch for !VIRTIO_NET_HDR_F_NEEDS_CSUM && gso_type. Mainly "used" by
syzkaller afaik.

With the addition of USO besides TSO that could also eschew L4 checksum
offload. But the local stack does not generate those (udp_send_skb),
nor does UDP GRO (first branch in udp_gro_receive_segment).

In any case, the new comment clearly mentions this limitation on L4
checksum.

> so one could possibly interpret the csum counter as pure csum offload.
> 
> But the counters are based on virtio:
> 
>   [tx_needs_csum]
>       The number of packets which require checksum calculation by the device.
> 
>   [rx_needs_csum]
>       The number of packets with VIRTIO_NET_HDR_F_NEEDS_CSUM.
> 
> and VIRTIO_NET_HDR_F_NEEDS_CSUM gets set on GSO packets virtio sends.
> 
> Clarify this in the spec to avoid any confusion.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Willem de Bruijn <willemb@google.com>

> ---
> v2:
>  - remove the note that almost all GSO types need L4 csum
> v1: https://lore.kernel.org/20250213010457.1351376-1-kuba@kernel.org
> 
> CC: willemb@google.com
> CC: ecree.xilinx@gmail.com
> CC: neescoba@cisco.com
> ---
>  Documentation/netlink/specs/netdev.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml
> index 288923e965ae..48159eb116a4 100644
> --- a/Documentation/netlink/specs/netdev.yaml
> +++ b/Documentation/netlink/specs/netdev.yaml
> @@ -457,6 +457,8 @@ name: netdev
>          name: tx-needs-csum
>          doc: |
>            Number of packets that required the device to calculate the checksum.
> +          This counter includes the number of GSO wire packets for which device
> +          calculated the L4 checksum.
>          type: uint
>        -
>          name: tx-hw-gso-packets
> -- 
> 2.48.1
>
patchwork-bot+netdevbpf@kernel.org Feb. 18, 2025, 1:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 14 Feb 2025 14:46:01 -0800 you wrote:
> Could be just me, but I had to pause and double check that the Tx csum
> counter in qstat should include GSO'd packets. GSO pretty much implies
> csum so one could possibly interpret the csum counter as pure csum offload.
> 
> But the counters are based on virtio:
> 
>   [tx_needs_csum]
>       The number of packets which require checksum calculation by the device.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] netdev: clarify GSO vs csum in qstats
    https://git.kernel.org/netdev/net-next/c/b5e489003abc

You are awesome, thank you!
diff mbox series

Patch

diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml
index 288923e965ae..48159eb116a4 100644
--- a/Documentation/netlink/specs/netdev.yaml
+++ b/Documentation/netlink/specs/netdev.yaml
@@ -457,6 +457,8 @@  name: netdev
         name: tx-needs-csum
         doc: |
           Number of packets that required the device to calculate the checksum.
+          This counter includes the number of GSO wire packets for which device
+          calculated the L4 checksum.
         type: uint
       -
         name: tx-hw-gso-packets