From: netdev-bot+sashiko@kernel.org
To: hamzamahfooz@linux.microsoft.com
Cc: netdev@vger.kernel.org, haiyangz@microsoft.com,
wei.liu@kernel.org, decui@microsoft.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, weh@microsoft.com, kotaranov@microsoft.com,
willemb@google.com, horms@kernel.org,
linux-hyperv@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next] net: mana: add UDP segmentation offload support
Date: Thu, 03 Dec 2026 23:15:26 +0000 [thread overview]
Message-ID: <179633972649.3146.6197822221634880833@kernel.org> (raw)
In-Reply-To: <20261130231409.2567518-1-hamzamahfooz@linux.microsoft.com>
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
prev parent reply other threads:[~2026-12-03 23:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 23:14 [PATCH net-next] net: mana: add UDP segmentation offload support Hamza Mahfooz
2026-11-30 23:21 ` sashiko-bot
2026-12-01 17:36 ` Joe Damato
2026-12-01 18:42 ` Hamza Mahfooz
2026-12-03 23:15 ` netdev-bot+sashiko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179633972649.3146.6197822221634880833@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=edumazet@kernel.org \
--cc=haiyangz@microsoft.com \
--cc=hamzamahfooz@linux.microsoft.com \
--cc=horms@kernel.org \
--cc=kotaranov@microsoft.com \
--cc=kuba@kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=weh@microsoft.com \
--cc=wei.liu@kernel.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox