Thread (14 messages) 14 messages, 3 authors, 2026-02-02

RE: [PATCH v1 net-next 3/3] virtio_net: Accurate ECN flag in virtio_net_hdr

From: Chia-Yu Chang (Nokia) <hidden>
Date: 2026-02-02 16:56:43
Also in: bpf, linux-doc, linux-kselftest, linux-rdma, virtualization

-----Original Message-----
From: Michael S. Tsirkin <mst@redhat.com> 
Sent: Sunday, February 1, 2026 10:18 AM
To: Chia-Yu Chang (Nokia) <redacted>
Cc: tariqt@nvidia.com; linux-rdma@vger.kernel.org; shaojijie@huawei.com; shenjian15@huawei.com; salil.mehta@huawei.com; mbloch@nvidia.com; saeedm@nvidia.com; leon@kernel.org; eperezma@redhat.com; brett.creeley@amd.com; jasowang@redhat.com; virtualization@lists.linux.dev; xuanzhuo@linux.alibaba.com; pabeni@redhat.com; edumazet@google.com; parav@nvidia.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; kuba@kernel.org; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; ncardwell@google.com; Koen De Schepper (Nokia) <redacted>; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire@apple.com; rs.ietf@gmx.at; Jason_Livingood@comcast.com; vidhi_goel@apple.com
Subject: Re: [PATCH v1 net-next 3/3] virtio_net: Accurate ECN flag in virtio_net_hdr


CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information.



Thanks for the patch! Yet something to improve:

On Sat, Jan 31, 2026 at 11:55:10PM +0100, chia-yu.chang@nokia-bell-labs.com wrote:
quoted
From: Chia-Yu Chang <redacted>

Unlike RFC 3168 ECN, accurate ECN uses the CWR flag as part of the ACE 
field to count new packets with CE mark; however, it will be corrupted 
by the RFC 3168 ECN-aware TSO. Therefore, fallback shall be applied by 
seting NETIF_F_GSO_ACCECN to ensure that the CWR flag should not be 
changed within a super-skb.

To apply the aforementieond new AccECN GSO for virtio, new featue bits 
for host and guest are added for feature negotiation between driver 
and device. And the translation of Accurate ECN GSO flag between 
virtio_net_hdr and skb header for NETIF_F_GSO_ACCECN is also added to 
avoid CWR flag corruption due to RFC3168 ECN TSO.

Signed-off-by: Chia-Yu Chang <redacted>

To the best of my understanding, this is a new feature - support for VIRTIO_NET_F_HOST_ACCECN, VIRTIO_NET_F_GUEST_ACCECN?
The commit log makes it sound like it fixes some behaviour for existing hardware, but that is not the case.
Thansk for the feedback, I will update commit message in v3.
quoted
---
v2:
- Replace VIRTIO_NET_HDR_GSO_ECN with VIRTIO_NET_HDR_GSO_ECN_FLAGS
but where is v2? this is v1...
I shall update this version as v2, will do at the next version.

[...]
quoted
diff --git a/include/uapi/linux/virtio_net.h 
b/include/uapi/linux/virtio_net.h index 1db45b01532b..af5bfe45aa1f 
100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -56,6 +56,8 @@
 #define VIRTIO_NET_F_MQ      22      /* Device supports Receive Flow
                                       * Steering */
 #define VIRTIO_NET_F_CTRL_MAC_ADDR 23        /* Set MAC address */
+#define VIRTIO_NET_F_HOST_ACCECN 25  /* Host can handle GSO of AccECN 
+*/ #define VIRTIO_NET_F_GUEST_ACCECN 26 /* Guest can handle GSO of 
+AccECN */
 #define VIRTIO_NET_F_DEVICE_STATS 50 /* Device can provide 
device-level statistics. */  #define VIRTIO_NET_F_VQ_NOTF_COAL 52 /* Device supports virtqueue notification coalescing */
 #define VIRTIO_NET_F_NOTF_COAL       53      /* Device supports notifications coalescing */
@@ -165,6 +167,9 @@ struct virtio_net_hdr_v1 {  #define 
VIRTIO_NET_HDR_GSO_UDP_TUNNEL (VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV4 | \
                                     VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV6)
 #define VIRTIO_NET_HDR_GSO_ECN               0x80    /* TCP has ECN set */
+#define VIRTIO_NET_HDR_GSO_ACCECN    0x10    /* TCP AccECN segmentation */
+#define VIRTIO_NET_HDR_GSO_ECN_FLAGS (VIRTIO_NET_HDR_GSO_ECN | \
+                                      VIRTIO_NET_HDR_GSO_ACCECN)
      __u8 gso_type;
      __virtio16 hdr_len;     /* Ethernet + IP + tcp/udp hdrs */
      __virtio16 gso_size;    /* Bytes to append to hdr_len per frame */

UAPI changes need to be added to the virtio spec.
Pls get this approved by the virtio TC.
Thanks!
There were some discussions last October in virtio-comment@lists.linux.dev mailing list.

At that moment, it is suggested to make Linux kernel accept new comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN first.

So, could virtio-spec colleague give your feedback? (Parav?).

Otherwise, the CWR handling of virtio will be wrong after all Accurate ECN commits are merged in Linux.

Chia-Yu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help