From: Stephen Hemminger <stephen@networkplumber.org>
To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: dev@dpdk.org, Thomas Monjalon <thomas@monjalon.net>
Subject: Re: [RFC] ethdev: clarify rte_eth_tx_burst() return value and ownership semantics
Date: Tue, 17 Feb 2026 06:54:21 -0800 [thread overview]
Message-ID: <20260217065421.22fca263@phoenix.local> (raw)
In-Reply-To: <b361cfbe-039d-437e-b628-5cb9f923bac7@oktetlabs.ru>
On Tue, 17 Feb 2026 09:41:07 +0300
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru> wrote:
> On 2/16/26 9:00 PM, Stephen Hemminger wrote:
> > The documentation for rte_eth_tx_burst() uses the word "sent" to
> > describe the return value, which is misleading. Packets returned as
> > consumed may not have been transmitted yet; they have been accepted
> > by the driver and are no longer the caller's responsibility.
> >
> > This matters because the common usage pattern is:
> >
> > n = rte_eth_tx_burst(port, txq, mbufs, nb_pkts);
> > for (i = n; i < nb_pkts; i++)
> > rte_pktmbuf_free(mbufs[i]);
> >
> > For this to work correctly, the contract must be:
> > - tx_pkts[0..n-1]: ownership transferred to the driver.
> > - tx_pkts[n..nb_pkts-1]: untouched, still owned by the caller.
> >
> > Several drivers (and AI-assisted reviews) misinterpret the current
> > wording and treat packets with errors as unconsumed, returning a
> > short count. This causes callers to retry those packets indefinitely.
> > The correct behavior is that the driver must consume (and free)
> > erroneous packets, counting them via tx_errors.
> >
> > Replace "sent" with "consumed" in the return value description,
> > spell out the mbuf ownership contract, clarify the error handling
> > expectation, and update the @return block to match.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>
> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>
> Thanks for the clarification. I really like it.
>
I haven't reviewed all drivers but have found bugs related to this
in tap, af_packet and likely other software drivers. The hardware
drivers seem to be modeled after ixgbe and get it right.
next prev parent reply other threads:[~2026-02-17 14:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-16 18:00 [RFC] ethdev: clarify rte_eth_tx_burst() return value and ownership semantics Stephen Hemminger
2026-02-17 6:41 ` Andrew Rybchenko
2026-02-17 14:54 ` Stephen Hemminger [this message]
2026-02-18 8:48 ` Morten Brørup
2026-02-18 8:52 ` Bruce Richardson
2026-02-18 17:13 ` Stephen Hemminger
2026-02-18 17:32 ` Morten Brørup
2026-02-19 0:44 ` [PATCH v2] " Stephen Hemminger
2026-02-19 7:20 ` Morten Brørup
2026-02-19 19:00 ` Stephen Hemminger
2026-02-19 19:00 ` Stephen Hemminger
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=20260217065421.22fca263@phoenix.local \
--to=stephen@networkplumber.org \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=thomas@monjalon.net \
/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