* [PATCH net-next] net: mana: add UDP segmentation offload support
@ 2026-11-30 23:14 Hamza Mahfooz
2026-12-01 17:36 ` Joe Damato
2026-12-03 23:15 ` netdev-bot+sashiko
0 siblings, 2 replies; 4+ messages in thread
From: Hamza Mahfooz @ 2026-11-30 23:14 UTC (permalink / raw)
To: netdev
Cc: Haiyang Zhang, Wei Liu, Dexuan Cui, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Wei Hu,
Konstantin Taranov, Willem de Bruijn, Simon Horman, linux-hyperv,
linux-rdma, Hamza Mahfooz
The hardware segments both TCP and UDP. In LSO mode it takes the L4
protocol from the parsed header, rewrites the IP total/payload length,
the IPv4 ID and the UDP length of each segment, and computes the L4
checksum from scratch. However, it reports a non-fatal error if neither
the TCP nor the UDP checksum offload bit is set in the TX OOB.
Advertise NETIF_F_GSO_UDP_L4 and, for SKB_GSO_UDP_L4 skbs, set
comp_udp_csum instead of comp_tcp_csum and seed the UDP checksum
rather than the TCP one. Everything else, including the header size
calculation in mana_get_gso_hs(), is shared with TSO.
Advertise this change to the PF with the new driver capability flag
GDMA_DRV_CAP_FLAG_1_UDP_SEGMENTATION_OFFLOAD.
Tested between two Azure Standard_E372is_v7 VMs on different hosts,
where the MANA device is the VM's only network interface. The changes
below are relative to the same kernel with tx-udp-segmentation turned
off.
udpgso_bench_tx, one sender pinned to a CPU, 61600 byte sends split
into 1400 byte segments, median of three 10 second runs:
throughput CPU per byte
IPv4 +307% -84%
IPv6 +348% -84%
IPv4 zerocopy +498% -80%
IPv6 zerocopy +190% -79%
CPU is the user plus system time of the sending process. With USO a
single sender is no longer CPU bound. Its throughput varied widely,
both within and between runs, but its CPU time per byte did not.
With 8 IPv4 senders, each on its own core, the total throughput went
up by 432% while the senders' CPU usage went down by 51%. With the
default 212992 byte send buffer, a socket can only have about three
such sends in flight, so the rate also depends on TX completion
latency. With net.core.wmem_default raised to 4 MiB, 8, 16 and 32
senders all came close to the VMs' network limit, with 604% to 656%
more throughput than software GSO.
Uploads with msquic's secnetperf (which uses UDP_SEGMENT):
throughput CPU per byte
1 connection +39% -48%
8 connections +104% -56%
IPv6 results were similar. Sending without GSO is unaffected.
NOTE: netvsc does not advertise NETIF_F_GSO_UDP_L4. On VMs with
accelerated networking, where traffic goes through the netvsc device
and is then passed to the VF, UDP GSO packets are therefore still
segmented in software until netvsc supports USO as well. Where the
MANA device is the VM's network interface, as in the tests above,
this patch is enough.
Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
---
drivers/net/ethernet/microsoft/mana/mana_en.c | 26 ++++++++++++-------
include/net/mana/gdma.h | 6 ++++-
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index 95bf153c3e1a8..b8c21e26a2aeb 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -441,6 +441,9 @@ netdev_tx_t __mana_start_xmit(struct sk_buff *skb, struct net_device *ndev,
ipv6 = true;
if (skb_is_gso(skb)) {
+ bool is_uso = skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4;
+ u8 l4_proto = is_uso ? IPPROTO_UDP : IPPROTO_TCP;
+ __sum16 *l4_check;
int num_sge;
gso_hs = mana_get_gso_hs(skb);
@@ -465,7 +468,13 @@ netdev_tx_t __mana_start_xmit(struct sk_buff *skb, struct net_device *ndev,
pkg.tx_oob.s_oob.is_outer_ipv6 = ipv6;
pkg.tx_oob.s_oob.comp_iphdr_csum = 1;
- pkg.tx_oob.s_oob.comp_tcp_csum = 1;
+ if (is_uso) {
+ pkg.tx_oob.s_oob.comp_udp_csum = 1;
+ l4_check = &udp_hdr(skb)->check;
+ } else {
+ pkg.tx_oob.s_oob.comp_tcp_csum = 1;
+ l4_check = &tcp_hdr(skb)->check;
+ }
pkg.tx_oob.s_oob.trans_off = skb_transport_offset(skb);
pkg.wqe_req.client_data_unit = skb_shinfo(skb)->gso_size;
@@ -473,16 +482,14 @@ netdev_tx_t __mana_start_xmit(struct sk_buff *skb, struct net_device *ndev,
if (ipv4) {
ip_hdr(skb)->tot_len = 0;
ip_hdr(skb)->check = 0;
- tcp_hdr(skb)->check =
- ~csum_tcpudp_magic(ip_hdr(skb)->saddr,
- ip_hdr(skb)->daddr, 0,
- IPPROTO_TCP, 0);
+ *l4_check = ~csum_tcpudp_magic(ip_hdr(skb)->saddr,
+ ip_hdr(skb)->daddr, 0,
+ l4_proto, 0);
} else {
ipv6_hdr(skb)->payload_len = 0;
- tcp_hdr(skb)->check =
- ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
- &ipv6_hdr(skb)->daddr, 0,
- IPPROTO_TCP, 0);
+ *l4_check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
+ &ipv6_hdr(skb)->daddr, 0,
+ l4_proto, 0);
}
} else if (skb->ip_summed == CHECKSUM_PARTIAL) {
csum_type = mana_checksum_info(skb);
@@ -4000,6 +4007,7 @@ static int mana_probe_port(struct mana_context *ac, int port_idx,
ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
ndev->hw_features |= NETIF_F_RXCSUM;
ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
+ ndev->hw_features |= NETIF_F_GSO_UDP_L4;
ndev->hw_features |= NETIF_F_RXHASH;
ndev->features = ndev->hw_features | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX;
diff --git a/include/net/mana/gdma.h b/include/net/mana/gdma.h
index e17219a29fa5f..7d957241ee0c1 100644
--- a/include/net/mana/gdma.h
+++ b/include/net/mana/gdma.h
@@ -783,6 +783,9 @@ enum {
/* Enforce min 1 usec, 1 frames for Interrupt Moderation */
#define GDMA_DRV_CAP_FLAG_1_SET_MIN_INTR_MOD_VALUE BIT_ULL(33)
+/* Driver supports USO */
+#define GDMA_DRV_CAP_FLAG_1_UDP_SEGMENTATION_OFFLOAD BIT_ULL(35)
+
/* Capabilities in the PCI-only group below rely on dynamic MSI-X allocation
* and on the servicing and reset paths reached through
* mana_schedule_serv_work(). Transports that provide neither leave
@@ -809,7 +812,8 @@ enum {
GDMA_DRV_CAP_FLAG_1_DYN_INTERRUPT_MODERATION | \
GDMA_DRV_CAP_FLAG_1_NON_CONTIGUOUS_BUFFERS | \
GDMA_DRV_CAP_FLAG_1_THROTTLED_EVENT_QUEUE | \
- GDMA_DRV_CAP_FLAG_1_SET_MIN_INTR_MOD_VALUE)
+ GDMA_DRV_CAP_FLAG_1_SET_MIN_INTR_MOD_VALUE | \
+ GDMA_DRV_CAP_FLAG_1_UDP_SEGMENTATION_OFFLOAD)
#define GDMA_DRV_CAP_FLAGS2 0
--
2.56.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next] net: mana: add UDP segmentation offload support
2026-11-30 23:14 [PATCH net-next] net: mana: add UDP segmentation offload support Hamza Mahfooz
@ 2026-12-01 17:36 ` Joe Damato
2026-12-01 18:42 ` Hamza Mahfooz
2026-12-03 23:15 ` netdev-bot+sashiko
1 sibling, 1 reply; 4+ messages in thread
From: Joe Damato @ 2026-12-01 17:36 UTC (permalink / raw)
To: Hamza Mahfooz
Cc: netdev, Haiyang Zhang, Wei Liu, Dexuan Cui, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Wei Hu, Konstantin Taranov, Willem de Bruijn, Simon Horman,
linux-hyperv, linux-rdma
On Mon, Nov 30, 2026 at 06:14:09PM -0500, Hamza Mahfooz wrote:
> The hardware segments both TCP and UDP. In LSO mode it takes the L4
> protocol from the parsed header, rewrites the IP total/payload length,
> the IPv4 ID and the UDP length of each segment, and computes the L4
> checksum from scratch. However, it reports a non-fatal error if neither
> the TCP nor the UDP checksum offload bit is set in the TX OOB.
>
> Advertise NETIF_F_GSO_UDP_L4 and, for SKB_GSO_UDP_L4 skbs, set
> comp_udp_csum instead of comp_tcp_csum and seed the UDP checksum
> rather than the TCP one. Everything else, including the header size
> calculation in mana_get_gso_hs(), is shared with TSO.
>
> Advertise this change to the PF with the new driver capability flag
> GDMA_DRV_CAP_FLAG_1_UDP_SEGMENTATION_OFFLOAD.
>
> Tested between two Azure Standard_E372is_v7 VMs on different hosts,
> where the MANA device is the VM's only network interface. The changes
> below are relative to the same kernel with tx-udp-segmentation turned
> off.
>
> udpgso_bench_tx, one sender pinned to a CPU, 61600 byte sends split
> into 1400 byte segments, median of three 10 second runs:
>
> throughput CPU per byte
> IPv4 +307% -84%
> IPv6 +348% -84%
> IPv4 zerocopy +498% -80%
> IPv6 zerocopy +190% -79%
>
> CPU is the user plus system time of the sending process. With USO a
> single sender is no longer CPU bound. Its throughput varied widely,
> both within and between runs, but its CPU time per byte did not.
>
> With 8 IPv4 senders, each on its own core, the total throughput went
> up by 432% while the senders' CPU usage went down by 51%. With the
> default 212992 byte send buffer, a socket can only have about three
> such sends in flight, so the rate also depends on TX completion
> latency. With net.core.wmem_default raised to 4 MiB, 8, 16 and 32
> senders all came close to the VMs' network limit, with 604% to 656%
> more throughput than software GSO.
>
> Uploads with msquic's secnetperf (which uses UDP_SEGMENT):
>
> throughput CPU per byte
> 1 connection +39% -48%
> 8 connections +104% -56%
>
> IPv6 results were similar. Sending without GSO is unaffected.
>
> NOTE: netvsc does not advertise NETIF_F_GSO_UDP_L4. On VMs with
> accelerated networking, where traffic goes through the netvsc device
> and is then passed to the VF, UDP GSO packets are therefore still
> segmented in software until netvsc supports USO as well. Where the
> MANA device is the VM's network interface, as in the tests above,
> this patch is enough.
>
> Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
> ---
> drivers/net/ethernet/microsoft/mana/mana_en.c | 26 ++++++++++++-------
> include/net/mana/gdma.h | 6 ++++-
> 2 files changed, 22 insertions(+), 10 deletions(-)
>
Did you run uso.py from the selftests? Asking because it wasn't mentioned and
it might be worth running if you already have the test environment setup. You
might want to run it from the latest net-next because I recently added small
MSS size tests.
Other than the nit above about running the selftests, I spent a bit of time
reading the patch and it looks vaguely right to me with the caveat that I am
not super familiar with this driver, but:
Reviewed-by: Joe Damato <joe@dama.to>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: mana: add UDP segmentation offload support
2026-12-01 17:36 ` Joe Damato
@ 2026-12-01 18:42 ` Hamza Mahfooz
0 siblings, 0 replies; 4+ messages in thread
From: Hamza Mahfooz @ 2026-12-01 18:42 UTC (permalink / raw)
To: Joe Damato, Hamza Mahfooz, netdev, Haiyang Zhang, Wei Liu,
Dexuan Cui, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Wei Hu, Konstantin Taranov,
Willem de Bruijn, Simon Horman, linux-hyperv, linux-rdma
On Tue, Dec 01, 2026 at 09:36:02AM -0800, Joe Damato wrote:
> On Mon, Nov 30, 2026 at 06:14:09PM -0500, Hamza Mahfooz wrote:
> > The hardware segments both TCP and UDP. In LSO mode it takes the L4
> > protocol from the parsed header, rewrites the IP total/payload length,
> > the IPv4 ID and the UDP length of each segment, and computes the L4
> > checksum from scratch. However, it reports a non-fatal error if neither
> > the TCP nor the UDP checksum offload bit is set in the TX OOB.
> >
> > Advertise NETIF_F_GSO_UDP_L4 and, for SKB_GSO_UDP_L4 skbs, set
> > comp_udp_csum instead of comp_tcp_csum and seed the UDP checksum
> > rather than the TCP one. Everything else, including the header size
> > calculation in mana_get_gso_hs(), is shared with TSO.
> >
> > Advertise this change to the PF with the new driver capability flag
> > GDMA_DRV_CAP_FLAG_1_UDP_SEGMENTATION_OFFLOAD.
> >
> > Tested between two Azure Standard_E372is_v7 VMs on different hosts,
> > where the MANA device is the VM's only network interface. The changes
> > below are relative to the same kernel with tx-udp-segmentation turned
> > off.
> >
> > udpgso_bench_tx, one sender pinned to a CPU, 61600 byte sends split
> > into 1400 byte segments, median of three 10 second runs:
> >
> > throughput CPU per byte
> > IPv4 +307% -84%
> > IPv6 +348% -84%
> > IPv4 zerocopy +498% -80%
> > IPv6 zerocopy +190% -79%
> >
> > CPU is the user plus system time of the sending process. With USO a
> > single sender is no longer CPU bound. Its throughput varied widely,
> > both within and between runs, but its CPU time per byte did not.
> >
> > With 8 IPv4 senders, each on its own core, the total throughput went
> > up by 432% while the senders' CPU usage went down by 51%. With the
> > default 212992 byte send buffer, a socket can only have about three
> > such sends in flight, so the rate also depends on TX completion
> > latency. With net.core.wmem_default raised to 4 MiB, 8, 16 and 32
> > senders all came close to the VMs' network limit, with 604% to 656%
> > more throughput than software GSO.
> >
> > Uploads with msquic's secnetperf (which uses UDP_SEGMENT):
> >
> > throughput CPU per byte
> > 1 connection +39% -48%
> > 8 connections +104% -56%
> >
> > IPv6 results were similar. Sending without GSO is unaffected.
> >
> > NOTE: netvsc does not advertise NETIF_F_GSO_UDP_L4. On VMs with
> > accelerated networking, where traffic goes through the netvsc device
> > and is then passed to the VF, UDP GSO packets are therefore still
> > segmented in software until netvsc supports USO as well. Where the
> > MANA device is the VM's network interface, as in the tests above,
> > this patch is enough.
> >
> > Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
> > ---
> > drivers/net/ethernet/microsoft/mana/mana_en.c | 26 ++++++++++++-------
> > include/net/mana/gdma.h | 6 ++++-
> > 2 files changed, 22 insertions(+), 10 deletions(-)
> >
>
> Did you run uso.py from the selftests? Asking because it wasn't mentioned and
> it might be worth running if you already have the test environment setup. You
> might want to run it from the latest net-next because I recently added small
> MSS size tests.
>
I reran uso.py on the current HEAD of net-next FWIW and it's passing all
8/8 test cases.
Hamza
> Other than the nit above about running the selftests, I spent a bit of time
> reading the patch and it looks vaguely right to me with the caveat that I am
> not super familiar with this driver, but:
>
> Reviewed-by: Joe Damato <joe@dama.to>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: mana: add UDP segmentation offload support
2026-11-30 23:14 [PATCH net-next] net: mana: add UDP segmentation offload support Hamza Mahfooz
2026-12-01 17:36 ` Joe Damato
@ 2026-12-03 23:15 ` netdev-bot+sashiko
1 sibling, 0 replies; 4+ messages in thread
From: netdev-bot+sashiko @ 2026-12-03 23:15 UTC (permalink / raw)
To: hamzamahfooz
Cc: netdev, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
kuba, pabeni, weh, kotaranov, willemb, horms, linux-hyperv,
linux-rdma
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] USO is advertised to the stack without checking whether the PF
supports it.
- [Medium] The GSO branch of __mana_start_xmit() decides IPv4 vs IPv6
from skb->protocol alone (mana_en.c:438-441).
- [Medium] gso_size is not range-checked for USO skbs.
- [Low] UDP GSO skbs are now counted in the per-queue
tso_packets/tso_bytes (or tso_inner_*) counters in __mana_start_xmit()…
--
I found four possible regressions in this patch: three questions about the transmit path and feature advertising, plus one naming note about the TSO statistics. They are inline below.
net: mana: add UDP segmentation offload support
This patch advertises NETIF_F_GSO_UDP_L4 on MANA ports. For SKB_GSO_UDP_L4
skbs, __mana_start_xmit() now sets comp_udp_csum and seeds the UDP
pseudo-header checksum instead of the TCP one. It also adds the
driver capability bit GDMA_DRV_CAP_FLAG_1_UDP_SEGMENTATION_OFFLOAD to
GDMA_DRV_CAP_FLAGS1, which is sent to the PF.
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index 95bf153c3e1a8..b8c21e26a2aeb 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -441,6 +441,9 @@ netdev_tx_t __mana_start_xmit(struct sk_buff *skb, struct net_device *ndev,
> ipv6 = true;
>
> if (skb_is_gso(skb)) {
> + bool is_uso = skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4;
> + u8 l4_proto = is_uso ? IPPROTO_UDP : IPPROTO_TCP;
> + __sum16 *l4_check;
> int num_sge;
>
> gso_hs = mana_get_gso_hs(skb);
[Severity: Low]
This isn't a bug, but UDP GSO skbs now go through the existing stats
block just below this in __mana_start_xmit():
} else {
tx_stats->tso_packets++;
tx_stats->tso_bytes += skb->len - gso_hs;
}
These counters appear in ethtool -S as tx_N_tso_packets and
tx_N_tso_bytes (and the tso_inner_* variants). USO traffic is now counted
under TSO-named counters and can't be told apart from TSO.
mlx5 counts SKB_GSO_UDP_L4 under tso_packets too, so this is mostly a
naming question. Is this the intended accounting?
> @@ -465,7 +468,13 @@ netdev_tx_t __mana_start_xmit(struct sk_buff *skb, struct net_device *ndev,
> pkg.tx_oob.s_oob.is_outer_ipv6 = ipv6;
>
> pkg.tx_oob.s_oob.comp_iphdr_csum = 1;
> - pkg.tx_oob.s_oob.comp_tcp_csum = 1;
> + if (is_uso) {
> + pkg.tx_oob.s_oob.comp_udp_csum = 1;
> + l4_check = &udp_hdr(skb)->check;
> + } else {
> + pkg.tx_oob.s_oob.comp_tcp_csum = 1;
> + l4_check = &tcp_hdr(skb)->check;
> + }
> pkg.tx_oob.s_oob.trans_off = skb_transport_offset(skb);
>
> pkg.wqe_req.client_data_unit = skb_shinfo(skb)->gso_size;
[Severity: Medium]
Is gso_size range-checked anywhere for USO skbs before it goes into the
WQE?
mana_gd_write_client_oob() copies client_data_unit into a 14-bit field:
include/net/mana/gdma.h:struct gdma_wqe {
...
u32 client_data_unit :14;
...
}
A gso_size above 16383 is silently truncated, and 16384 is encoded as
an MSS of 0.
Locally generated UDP GSO is limited by the path MTU in udp_send_skb().
Forwarded or redirected GSO skbs can carry a gso_size up to 65535. This
covers bridge, macvlan, tc redirect, and tap or AF_PACKET with
virtio_net_hdr. Before this patch those skbs were segmented in software,
which kept the datagram boundaries.
At the low end, UDP_SEGMENT accepts any value up to USHRT_MAX. An
unprivileged user can call setsockopt(UDP_SEGMENT, 1) and send a few
bytes, which gives client_data_unit = 1. Until now an unprivileged user
could reach the LSO engine only through TCP, where TCP_MIN_SND_MSS applies.
mana_features_check() only looks at nr_frags. It is also only built when
MAX_SKB_FRAGS + 2 > MANA_MAX_TX_WQE_SGL_ENTRIES:
if (skb_shinfo(skb)->nr_frags + 2 > MAX_TX_WQE_SGL_ENTRIES) {
...
features &= ~NETIF_F_GSO_MASK;
}
The driver can't show what the hardware does with a truncated or very
small MSS. i40e, ice and idpf clear GSO in ndo_features_check for MSS
values their hardware can't handle.
Should mana also fall back to software GSO when gso_size is outside the
range the hardware accepts?
> @@ -473,16 +482,14 @@ netdev_tx_t __mana_start_xmit(struct sk_buff *skb, struct net_device *ndev,
> if (ipv4) {
> ip_hdr(skb)->tot_len = 0;
> ip_hdr(skb)->check = 0;
> - tcp_hdr(skb)->check =
> - ~csum_tcpudp_magic(ip_hdr(skb)->saddr,
> - ip_hdr(skb)->daddr, 0,
> - IPPROTO_TCP, 0);
> + *l4_check = ~csum_tcpudp_magic(ip_hdr(skb)->saddr,
> + ip_hdr(skb)->daddr, 0,
> + l4_proto, 0);
> } else {
> ipv6_hdr(skb)->payload_len = 0;
> - tcp_hdr(skb)->check =
> - ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
> - &ipv6_hdr(skb)->daddr, 0,
> - IPPROTO_TCP, 0);
> + *l4_check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
> + &ipv6_hdr(skb)->daddr, 0,
> + l4_proto, 0);
> }
[Severity: Medium]
What happens here for a UDP GSO skb whose skb->protocol is neither
ETH_P_IP nor ETH_P_IPV6?
Earlier in __mana_start_xmit(), ipv4 and ipv6 are set from skb->protocol
only:
if (skb->protocol == htons(ETH_P_IP))
ipv4 = true;
else if (skb->protocol == htons(ETH_P_IPV6))
ipv6 = true;
NETIF_F_GSO_UDP_L4 also ends up in vlan_features, but
NETIF_F_HW_VLAN_STAG_TX isn't advertised. For an 802.1ad VLAN on top of
mana, the path looks like:
__netif_skb_features()
keeps GSO_UDP_L4 via vlan_features
harmonize_features() sees ETH_P_IP via skb_network_protocol()
validate_xmit_vlan()
vlan_hw_offload_capable(features, ETH_P_8021AD) is false
__vlan_hwaccel_push_inside()
skb->protocol = ETH_P_8021AD
The unsegmented GSO skb then reaches mana. In-band 802.1Q tagged GSO skbs
forwarded through a bridge take a similar path.
Both ipv4 and ipv6 are then false, so is_outer_ipv4 and is_outer_ipv6
are 0. This else arm then runs on an IPv4/UDP header:
- payload_len = 0 overwrites the IPv4 ID field.
- csum_ipv6_magic() reads saddr and daddr from network offsets 8..39.
mana_fix_skb_head() only guarantees gso_hs bytes, which here is
network + 20 + 8 = 28. Up to 12 bytes past the headers (tailroom or
skb_shared_info in the head) are folded into the UDP checksum seed.
TSO already had this misclassification, but its 40-byte IPv4+TCP header
covered the read. Before this patch these UDP GSO skbs were segmented in
software.
The non-GSO path handles this case: mana_checksum_info() returns 0 and
the code falls back to skb_checksum_help().
Should the GSO path also fall back to software GSO when skb->protocol
isn't IPv4 or IPv6, for example from ndo_features_check?
[ ... ]
> @@ -4000,6 +4007,7 @@ static int mana_probe_port(struct mana_context *ac, int port_idx,
> ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
> ndev->hw_features |= NETIF_F_RXCSUM;
> ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
> + ndev->hw_features |= NETIF_F_GSO_UDP_L4;
> ndev->hw_features |= NETIF_F_RXHASH;
> ndev->features = ndev->hw_features | NETIF_F_HW_VLAN_CTAG_TX |
> NETIF_F_HW_VLAN_CTAG_RX;
[Severity: Medium]
Should this be gated on the PF reporting USO support?
mana_gd_verify_vf_version() now sends
GDMA_DRV_CAP_FLAG_1_UDP_SEGMENTATION_OFFLOAD to the PF in
GDMA_DRV_CAP_FLAGS1. However, mana_probe_port() sets NETIF_F_GSO_UDP_L4
for every port whatever the PF replies. No matching PF capability bit is
defined, and gc->pf_cap_flags1 isn't checked.
Other optional data path features in this driver check the PF side. DIM
does this:
if (gc->pf_cap_flags1 & GDMA_PF_CAP_FLAG_1_DYN_INTERRUPT_MODERATION) {
cq_spec.req_cq_moderation = true;
CQE8 coalescing does this:
gc->cqe8_coalescing_sup = !!(resp.pf_cap_flags1 &
MANA_PF_FLAG_1_CQE_8_COALESCING_SUPPORTED);
HWC_TIMEOUT_RECONFIG is also only used when the PF echoes the driver bit
back.
Take a host or PF that doesn't know bit 35, or doesn't enable UDP LSO for
the vPort. The driver would still post SKB_GSO_UDP_L4 WQEs with
comp_udp_csum = 1 and client_data_unit = gso_size. USO is on by default,
so every UDP_SEGMENT sender would be affected.
Can older hosts handle these WQEs? If not, should NETIF_F_GSO_UDP_L4 only
be advertised when the PF reports support?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130231409.2567518-1-hamzamahfooz%40linux.microsoft.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-03 23:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 23:14 [PATCH net-next] net: mana: add UDP segmentation offload support Hamza Mahfooz
2026-12-01 17:36 ` Joe Damato
2026-12-01 18:42 ` Hamza Mahfooz
2026-12-03 23:15 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox