From: Stephen Hemminger <stephen@networkplumber.org>
To: Yan Yanovsky <yan.yanovsky@catonetworks.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"qi.z.zhang@intel.com" <qi.z.zhang@intel.com>,
"ciara.loftus@intel.com" <ciara.loftus@intel.com>
Subject: Re: Subject: [PATCH v3] af_xdp kick_tx() Retries instead of endless loop
Date: Mon, 8 Dec 2025 11:02:08 -0800 [thread overview]
Message-ID: <20251208110208.3f637bbe@phoenix.local> (raw)
In-Reply-To: <VI1PR03MB4144B177CE39B84E0DE3F01FF7A2A@VI1PR03MB4144.eurprd03.prod.outlook.com>
On Mon, 8 Dec 2025 15:56:37 +0000
Yan Yanovsky <yan.yanovsky@catonetworks.com> wrote:
> From 191d90eaab50c6855ee746361e7e735572f3b1ce Mon Sep 17 00:00:00 2001
> From: Yan Yanovsky <yan.yanovsky@catonetworks.com>
> Date: Sun, 7 Dec 2025 18:10:45 +0200
> Subject: [PATCH v3] af_xdp kick_tx() Retries instead of endless loop
> Signed-off-by: Yan Yanovsky <yan.yanovsky@catonetworks.com>
>
Minor cosmetic changes needed.
> drivers/net/af_xdp/rte_eth_af_xdp.c | 28 ++++++++++++++++++----------
> 1 file changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index b6ec9bf490..dc34f1a29e 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -80,6 +80,7 @@ RTE_LOG_REGISTER_DEFAULT(af_xdp_logtype, NOTICE);
> #define ETH_AF_XDP_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
>
> #define ETH_AF_XDP_MP_KEY "afxdp_mp_send_fds"
> +#define MAX_TX_KICK_TRIES 10
>
> static int afxdp_dev_count;
>
> @@ -480,22 +481,29 @@ static void
> kick_tx(struct pkt_tx_queue *txq, struct xsk_ring_cons *cq)
> {
> struct xsk_umem_info *umem = txq->umem;
> + int tries = 0;
>
Unnecessary initialization
> + /* Pull completion queue entries to free UMEM buffers */
> pull_umem_cq(umem, XSK_RING_CONS__DEFAULT_NUM_DESCS, cq);
>
> - if (tx_syscall_needed(&txq->tx))
> - while (send(xsk_socket__fd(txq->pair->xsk), NULL,
> - 0, MSG_DONTWAIT) < 0) {
> - /* some thing unexpected */
> - if (errno != EBUSY && errno != EAGAIN && errno != EINTR)
> - break;
> + if (!tx_syscall_needed(&txq->tx))
> + return;
>
> - /* pull from completion queue to leave more space */
> - if (errno == EAGAIN)
> + for (tries = 0; tries < MAX_TX_KICK_TRIES; tries++) {
Suggest (but not required) to put definition here as:
for (unsigned int tries = 0; tries < MAX_TX_KICK_TRIES; tries++) {
> + if (send(xsk_socket__fd(txq->pair->xsk), NULL, 0,
> + MSG_DONTWAIT) >= 0)
> + break;
> + if (errno != EBUSY && errno != EAGAIN && errno != EINTR)
> + break;
> +
> + if (errno == EAGAIN) {
> + /* Kernel TX ring has no space or UMEM completion queue
> + * is lagging behind. Try pulling CQ to free room. */\
> pull_umem_cq(umem,
Do not put line continuation on the comment.
Original indent is better. I.e line up args on first to same column
> - XSK_RING_CONS__DEFAULT_NUM_DESCS,
> - cq);
> + XSK_RING_CONS__DEFAULT_NUM_DESCS,
> + cq);
> }
> + }
> }
>
> #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
Subject is repeated twice.
prev parent reply other threads:[~2025-12-08 19:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 15:56 Subject: [PATCH v3] af_xdp kick_tx() Retries instead of endless loop Yan Yanovsky
2025-12-08 19:02 ` Stephen Hemminger [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=20251208110208.3f637bbe@phoenix.local \
--to=stephen@networkplumber.org \
--cc=ciara.loftus@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
--cc=yan.yanovsky@catonetworks.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.