Skip to contentSkip to conversation

netdev: clarify GSO vs csum in qstats

PATCH Superseded Jakub Kicinski 2 participants 3 messages Feb 13, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 netdev: clarify GSO vs csum in qstats

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.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 Documentation/netlink/specs/netdev.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/netlink/specs/netdev.yaml +2 -0
index 288923e965ae..0b311dc49691 100644
@@ -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 (which means pretty much all of them).
         type: uint
       -
         name: tx-hw-gso-packets
Signature · 1 line
2.48.1
#1 lore raw
Quoted 30 lines · Jakub Kicinski

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.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 Documentation/netlink/specs/netdev.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/netlink/specs/netdev.yaml +0 -0
index 288923e965ae..0b311dc49691 100644

Documentation/netlink/specs/netdev.yaml name: netdev · line 460

Quoted 4 lines
Documentation/netlink/specs/netdev.yaml +1 -0
@@ -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

Good to call out wire packets, as opposed to the GSO packet itself. That is sometimes left ambiguous in GSO counting.

Documentation/netlink/specs/netdev.yaml name: netdev · line 461

Quoted 1 line
Documentation/netlink/specs/netdev.yaml +1 -0
+          calculated the L4 checksum (which means pretty much all of them).

Can we clarify what pretty much here means?

TSO requires checksum offload. USO with zero checksum is the only exception that I can think of right now.

Quoted 6 lines
Documentation/netlink/specs/netdev.yaml +0 -0
         type: uint
       -
         name: tx-hw-gso-packets
Signature · 1 line
2.48.1
author maintainer
#2 lore raw
Quoted 6 lines · On Thu, 13 Feb 2025 10:39:30 -0500 Willem de Bruijn wrote:
Quoted 1 line

+ calculated the L4 checksum (which means pretty much all of them).

Can we clarify what pretty much here means?

TSO requires checksum offload. USO with zero checksum is the only exception that I can think of right now.

I was worried that somehow another case will appear and the comment will become stale. I will just delete the part in the parenthesis.