All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Tathagat Priyadarshi <tathagat.dpdk@gmail.com>
Cc: dev@dpdk.org, weh@microsoft.com, longli@microsoft.com
Subject: Re: [PATCH v3 0/2] net/mana: fix tx burst error handling and add TSO support
Date: Wed, 28 Oct 2026 07:00:48 -0700	[thread overview]
Message-ID: <20261028070048.168f3605@phoenix.local> (raw)
In-Reply-To: <20261027182115.3666158-1-tathagat.dpdk@gmail.com>

On Tue, 27 Oct 2026 18:21:13 +0000
Tathagat Priyadarshi <tathagat.dpdk@gmail.com> 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 <stephen@networkplumber.org>

  parent reply	other threads:[~2026-10-28 14:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12  7:36 [PATCH 0/2] net/mana: fix transmit burst and add hardware TSO support Tathagat Priyadarshi
2026-10-12  7:36 ` [PATCH 1/2] net/mana: fix transmit burst error handling Tathagat Priyadarshi
2026-10-12  7:36 ` [PATCH 2/2] net/mana: add hardware TSO support Tathagat Priyadarshi
2026-10-12 21:37 ` [PATCH 0/2] net/mana: fix transmit burst and " Stephen Hemminger
2026-10-26 21:21 ` [PATCH v2 0/2] net/mana: fix tx burst error handling and add " Tathagat Priyadarshi
2026-10-26 21:21   ` [PATCH v2 1/2] net/mana: fix transmit burst error handling Tathagat Priyadarshi
2026-10-26 21:21   ` [PATCH v2 2/2] net/mana: add hardware TSO support Tathagat Priyadarshi
2026-10-27 14:02   ` [PATCH v2 0/2] net/mana: fix tx burst error handling and add " Stephen Hemminger
2026-10-27 18:21 ` [PATCH v3 " Tathagat Priyadarshi
2026-10-27 18:21   ` [PATCH v3 1/2] net/mana: fix transmit burst error handling Tathagat Priyadarshi
2026-10-27 18:21   ` [PATCH v3 2/2] net/mana: add hardware TSO support Tathagat Priyadarshi
2026-10-28 14:00   ` Stephen Hemminger [this message]
2026-10-28 19:37     ` [PATCH v3 0/2] net/mana: fix tx burst error handling and add " Tathagat Priyadarshi

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=20261028070048.168f3605@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=longli@microsoft.com \
    --cc=tathagat.dpdk@gmail.com \
    --cc=weh@microsoft.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.