From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Wen Gu <guwen@linux.alibaba.com>,
Philo Lu <lulie@linux.alibaba.com>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>,
Dong Yibo <dong100@mucse.com>,
Mingyu Wang <25181214217@stu.xidian.edu.cn>,
Heiner Kallweit <hkallweit1@gmail.com>,
Dust Li <dust.li@linux.alibaba.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next v43 6/8] eea: implement packet transmit logic
Date: Mon, 18 May 2026 10:47:05 +0800 [thread overview]
Message-ID: <1779072425.0877278-7-xuanzhuo@linux.alibaba.com> (raw)
In-Reply-To: <20260514095138.80680-7-xuanzhuo@linux.alibaba.com>
From sashiko:
commit cffb539ce8b8ad9935febc105007a1405d95169b
Author: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
eea: implement packet transmit logic
This commit fills in the previously stubbed eea_tx_xmit() and
eea_poll_tx() with the full TX path: building descriptors from skbs,
handling DMA mapping/unmapping, GSO and checksum offload setup, and
completion processing.
> diff --git a/drivers/net/ethernet/alibaba/eea/eea_tx.c b/drivers/net/ethernet/alibaba/eea/eea_tx.c
> index 5a8babfce5de..8b7fc75ead8a 100644
> --- a/drivers/net/ethernet/alibaba/eea/eea_tx.c
> +++ b/drivers/net/ethernet/alibaba/eea/eea_tx.c
[ ... ]
> +static int eea_fill_desc_from_skb(const struct sk_buff *skb,
> + struct eea_tx_desc *desc)
> +{
> + if (skb_is_gso(skb)) {
> + struct skb_shared_info *sinfo = skb_shinfo(skb);
> +
> + desc->gso_size = cpu_to_le16(sinfo->gso_size);
> + if (sinfo->gso_type & SKB_GSO_TCPV4)
> + desc->gso_type = EEA_TX_GSO_TCPV4;
> +
> + else if (sinfo->gso_type & SKB_GSO_TCPV6)
> + desc->gso_type = EEA_TX_GSO_TCPV6;
> +
> + else if (sinfo->gso_type & SKB_GSO_UDP_L4)
> + desc->gso_type = EEA_TX_GSO_UDP_L4;
> +
> + else
> + return -EINVAL;
> +
> + if (sinfo->gso_type & SKB_GSO_TCP_ECN)
> + desc->gso_type |= EEA_TX_GSO_ECN;
> + } else {
> + desc->gso_type = EEA_TX_GSO_NONE;
> + }
> +
> + if (skb->ip_summed == CHECKSUM_PARTIAL) {
> + desc->csum_start = cpu_to_le16(skb_checksum_start_offset(skb));
> + desc->csum_offset = cpu_to_le16(skb->csum_offset);
> + }
> +
> + return 0;
> +}
Can stale fields in a reused descriptor slot be sent to the device?
The SQ ring slots are reused as the ring wraps. Several eea_tx_desc
fields are only conditionally written:
- csum_start and csum_offset are only set when
skb->ip_summed == CHECKSUM_PARTIAL
- gso_size is only set when skb_is_gso(skb)
- gso_type is set here for the head descriptor, but
eea_tx_add_skb_frag() and the >USHRT_MAX split path in
eea_tx_desc_fill() never write gso_type, gso_size, csum_start
or csum_offset on continuation descriptors
- reserved1, reserved2 and reserved3 are never written
After the first ring wrap each reused slot will carry whatever values
the previous occupant wrote. Does correctness here rely on the device
gating each optional field on EEA_DESC_F_DO_CSUM and on the
"more descriptors" flag, and ignoring all reserved bits?
If so, would it be worth either zeroing the descriptor at fill time
(for example a memset before populating it) or adding a comment that
documents the hardware contract being relied on?
What is the silent drop signal when an unsupported gso_type appears?
When skb_is_gso(skb) is true but the type is none of TCPV4, TCPV6 or
UDP_L4, this returns -EINVAL, which propagates up through
eea_tx_post_skb() into err_cancel and ultimately to
dev_kfree_skb_any() in eea_tx_xmit(). There is no kfree_skb_reason(),
no per-queue counter and no log message.
Today the four supported types match what is advertised in
hw_features and features, so this branch should be unreachable. If a
future feature flag is advertised without updating this switch (for
example a tunnel GSO type), would the resulting drops be observable
from userspace at all?
Would kfree_skb_reason() with a specific drop reason, or restructuring
so the unsupported case is structurally unreachable, make this easier
to debug?
> +static int eea_tx_check_free_num(struct eea_net_tx *tx,
> + struct netdev_queue *txq)
> +{
> + int n;
> +
> + /* MAX_SKB_FRAGS + 1: Covers the skb linear head and all paged fragments
> + * 1: Extra slot for a head or fragment that exceeds 64KB.
> + */
> + n = MAX_SKB_FRAGS + 2;
> + return netif_txq_maybe_stop(txq, tx->ering->num_free, n, n);
> }
>
> netdev_tx_t eea_tx_xmit(struct sk_buff *skb, struct net_device *netdev)
> {
> - /* Empty function; will be implemented in a subsequent commit. */
> - dev_kfree_skb_any(skb);
> + struct eea_net *enet = netdev_priv(netdev);
> + int qnum = skb_get_queue_mapping(skb);
> + struct eea_net_tx *tx = &enet->tx[qnum];
> + struct netdev_queue *txq;
> + int err, enable;
> +
> + txq = netdev_get_tx_queue(netdev, qnum);
> +
> + enable = eea_tx_check_free_num(tx, txq);
> + if (!enable)
> + return NETDEV_TX_BUSY;
> +
> + err = eea_tx_post_skb(tx, skb);
> + if (unlikely(err)) {
> + dev_kfree_skb_any(skb);
> + } else {
> + if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))
> + skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
> + skb_tx_timestamp(skb);
> + }
> +
> + /* NETDEV_TX_BUSY is expensive. So stop advancing the TX queue. */
> + eea_tx_check_free_num(tx, txq);
> +
> + if (!netdev_xmit_more() || netif_xmit_stopped(txq))
> + eea_tx_kick(tx);
> +
> return NETDEV_TX_OK;
> }
Is BQL intended to be wired up here?
eea_tx_check_free_num() uses netif_txq_maybe_stop(), which is the
BQL-aware helper, but the xmit path never calls
netdev_tx_sent_queue() and the completion path in eea_clean_tx() /
eea_poll_tx() never calls netdev_tx_completed_queue(). Without the
paired byte updates, BQL has no view of in-flight bytes.
Also, the stop and start thresholds passed to netif_txq_maybe_stop()
are both MAX_SKB_FRAGS + 2, so there is no hysteresis between
queue-stop and queue-wake. eea_poll_tx() uses the same threshold for
its wake check:
if (netif_tx_queue_stopped(txq) &&
tx->ering->num_free >= MAX_SKB_FRAGS + 2)
netif_tx_wake_queue(txq);
Was a stop/start gap (e.g. start at 2 * stop) considered to dampen
wake/stop oscillation under sustained pressure?
next prev parent reply other threads:[~2026-05-18 2:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 9:51 [PATCH net-next v43 0/8] eea: Add basic driver framework for Alibaba Elastic Ethernet Adaptor Xuan Zhuo
2026-05-14 9:51 ` [PATCH net-next v43 1/8] eea: introduce PCI framework Xuan Zhuo
2026-05-18 3:06 ` Xuan Zhuo
2026-05-18 3:07 ` Xuan Zhuo
2026-05-14 9:51 ` [PATCH net-next v43 2/8] eea: introduce ring and descriptor structures Xuan Zhuo
2026-05-18 2:57 ` Xuan Zhuo
2026-05-14 9:51 ` [PATCH net-next v43 3/8] eea: probe the netdevice and create adminq Xuan Zhuo
2026-05-18 1:41 ` Xuan Zhuo
2026-05-18 1:41 ` Xuan Zhuo
2026-05-14 9:51 ` [PATCH net-next v43 4/8] eea: create/destroy rx,tx queues for netdevice open and stop Xuan Zhuo
2026-05-18 1:18 ` Xuan Zhuo
2026-05-18 1:24 ` Xuan Zhuo
2026-05-14 9:51 ` [PATCH net-next v43 5/8] eea: implement packet receive logic Xuan Zhuo
2026-05-18 2:34 ` Xuan Zhuo
2026-05-18 2:35 ` Xuan Zhuo
2026-05-14 9:51 ` [PATCH net-next v43 6/8] eea: implement packet transmit logic Xuan Zhuo
2026-05-18 2:47 ` Xuan Zhuo [this message]
2026-05-18 2:48 ` Xuan Zhuo
2026-05-14 9:51 ` [PATCH net-next v43 7/8] eea: introduce ethtool support Xuan Zhuo
2026-05-18 2:56 ` Xuan Zhuo
2026-05-14 9:51 ` [PATCH net-next v43 8/8] eea: introduce callback for ndo_get_stats64 and register netdev Xuan Zhuo
2026-05-18 3:01 ` Xuan Zhuo
2026-05-15 6:40 ` [PATCH net-next v43 0/8] eea: Add basic driver framework for Alibaba Elastic Ethernet Adaptor Xuan Zhuo
2026-05-19 10:33 ` Paolo Abeni
2026-05-19 10:40 ` patchwork-bot+netdevbpf
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=1779072425.0877278-7-xuanzhuo@linux.alibaba.com \
--to=xuanzhuo@linux.alibaba.com \
--cc=25181214217@stu.xidian.edu.cn \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dong100@mucse.com \
--cc=dust.li@linux.alibaba.com \
--cc=edumazet@google.com \
--cc=guwen@linux.alibaba.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=lulie@linux.alibaba.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vadim.fedorenko@linux.dev \
/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