On Tue, 27 Oct 2026 18:21:13 +0000
Tathagat Priyadarshi <[email protected]> wrote:

> This series fixes transmit burst error handling and adds hardware TCP
> segmentation offload (TSO) for the Microsoft Azure MANA PMD.
> 
> Patch 1 drops packets that fail validation, counting them in
> stats.errors and consuming them, so rte_eth_tx_burst() maintains a
> contiguous prefix and short returns reflect only ring backpressure.
> It also clamps segment limits to MAX_SGL_ENTRIES_FOR_TRANSMIT.
> 
> Patch 2 implements hardware TSO for IPv4 and IPv6 TCP traffic,
> formatting SGE0 for headers and subsequent SGEs for payload, handling
> GDMA work request flags, advertising RTE_ETH_TX_OFFLOAD_TCP_TSO, and
> handling non-TSO fallback checksums.
> 
> Hardware TSO segmentation was verified on Azure Standard_D8ds_v6 (kernel
> 6.8.0-1067-azure, MANA PCI 7870:00:00.0; driver reports no firmware
> version) between two VMs on one subnet using an earlier revision of
> this series:
> - VM A ran testpmd txonly, modified locally to emit TCP packets with
>   RTE_MBUF_F_TX_TCP_SEG set (not part of this series), after
>   "csum set ip hw 0", "csum set tcp hw 0" and "tso set 1460 0".
> - VM B captured the frames with tcpdump on its kernel interface, GRO off.
> - A 4000-byte IPv4 packet in a single mbuf, in mbufs with a header-only
>   first segment, and in mbufs with payload in the first segment, each
>   arrived as 1514, 1514 and 1080 byte frames with consecutive TCP
>   sequence numbers, per-segment IP IDs and valid IP and TCP checksums.
> - Plain UDP with "tso set 0" was unaffected.
> - The drop paths (packets exceeding segment limit, oversized MSS or
>   header) and IPv6 TSO were not exercised on hardware.
> 
> The v3 changes (hardware field bounds for MSS and header length,
> loop bound, unsegmented fallback checksum masking, and dev_info limit
> advertisement) were compile-tested but have not been re-run on hardware.
> 
> v3:
> - Patch 1: no changes.
> - Patch 2:
>   * Mask RTE_MBUF_F_TX_TCP_SEG in the non-TSO fallback branch so
>     rte_ipv4_phdr_cksum / rte_ipv6_phdr_cksum calculate the full L4
>     length into the pseudo-header checksum.
>   * Reject invalid TSO packets (tso_segsz > MANA_TSO_MAX_SEGSZ or
>     gso_hs > UINT8_MAX) to prevent hardware bitfield truncations.
>   * Reflect the extra SGE for TSO in dev_info by setting nb_seg_max to
>     max_sge - 1 (keeping nb_mtu_seg_max as max_sge) instead of a mana.rst
>     limitation note.
>   * Bound the TSO segment walk by expected_sge and verify SGE count.
>   * Streamline commit message and cover letter.
> 
> v2:
> - Patch 1:
>   * Drop unsendable packets and return a separate consumed count (nb_done)
>     instead of breaking out of the burst; break only when the ring is full.
>   * Move MAX_SGL_ENTRIES_FOR_TRANSMIT clamp from patch 2 to patch 1, and
>     clamp dev_info nb_seg_max and nb_mtu_seg_max.
> - Patch 2:
>   * Use the drop path for all per-packet TSO validation failures.
>   * Honour implied TCP checksum when RTE_MBUF_F_TX_TCP_SEG is set but the
>     packet is unsegmented.
>   * Move GDMA_WR_OOB_IN_SGL and GDMA_WR_PAD_BY_SGE0 adjacent to
>     struct gdma_work_request.
>   * Add release notes entry and update mana.ini feature matrix.
> 
> Tathagat Priyadarshi (2):
>   net/mana: fix transmit burst error handling
>   net/mana: add hardware TSO support
> 
>  doc/guides/nics/features/mana.ini      |   1 +
>  doc/guides/rel_notes/release_26_11.rst |   4 +
>  drivers/net/mana/gdma.c                |   5 +
>  drivers/net/mana/mana.c                |   9 +-
>  drivers/net/mana/mana.h                |   9 +-
>  drivers/net/mana/tx.c                  | 206 +++++++++++++++++++++----
>  6 files changed, 195 insertions(+), 39 deletions(-)
> 

I can apply it as is. But you may want to look at the length issues
reported in AI review 

Subject: Re: [PATCH v3 0/2] net/mana: tx burst fixes and TSO

Applied to main (e3e29ed), net/mana builds clean with -Dwerror=true
at each commit. Fixes: hashes verified.

Patch 1 drops invalid packets and counts them in the returned value,
which is the right tx_burst contract. The SGL bound fix is correct.
No findings on patch 1.

Patch 2 follows the Linux mana TSO path (header in SGE0,
OOB_IN_SGL | PAD_BY_SGE0, tot_len/payload_len zeroed, pseudo-header
seeded without length). Field widths match: last_v_bytes is 8 bits,
client_data_unit is 14 bits.

[PATCH v3 2/2] net/mana: add hardware TSO support

Info: l4_len is not validated. tcp_hdr->cksum is written at
l2_len + l3_len + 16, so with l4_len < 20 the write can land past
data_len, and SGE0 would split the TCP header. Cheap to reject:

        if (unlikely(m_pkt->l4_len < sizeof(struct rte_tcp_hdr) ||
                     m_pkt->data_len < gso_hs ||
                     gso_hs > UINT8_MAX)) {

Info: total TSO length is not bounded. pkt_len can exceed 64K with
a long chain. If the hardware has a limit on TSO payload, check
pkt_len - gso_hs against it and drop.

Info: the header fixups (IPv4 total_length/hdr_checksum, IPv6
payload_len, TCP cksum) write into packet data from tx_burst. An
application holding a reference to the mbuf (e.g. for retransmit)
sees the modified headers. tx_pkt_prepare is the ethdev hook for
this; the existing checksum path already does the same thing, so
not a blocker for this series.

Reviewed-by: Stephen Hemminger <[email protected]>

Reply via email to