DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ciara Loftus <ciara.loftus@intel.com>
To: dev@dpdk.org
Cc: Ciara Loftus <ciara.loftus@intel.com>
Subject: [dpdk-dev] [PATCH 1/2] net/af_xdp: fix trigger for syscall on tx
Date: Tue, 20 Apr 2021 09:44:30 +0100	[thread overview]
Message-ID: <20210420084431.6417-1-ciara.loftus@intel.com> (raw)

The send() syscall on the tx path is not concerned with busy polling
and as such its invocation should not depend on whether or not it is
configured. Fix this by distinguishing the conditions necessary for
syscalls on the rx and tx paths individually.

Fixes: 055a393626ed ("net/af_xdp: prefer busy polling")

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
 drivers/net/af_xdp/compat.h         | 14 ++++++++++++--
 drivers/net/af_xdp/rte_eth_af_xdp.c |  4 ++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/net/af_xdp/compat.h b/drivers/net/af_xdp/compat.h
index 545c8aa395..9de9454885 100644
--- a/drivers/net/af_xdp/compat.h
+++ b/drivers/net/af_xdp/compat.h
@@ -42,14 +42,24 @@ create_shared_socket(struct xsk_socket **xsk_ptr __rte_unused,
 
 #ifdef XDP_USE_NEED_WAKEUP
 static int
-syscall_needed(struct xsk_ring_prod *q, uint32_t busy_budget)
+rx_syscall_needed(struct xsk_ring_prod *q, uint32_t busy_budget)
 {
 	return xsk_ring_prod__needs_wakeup(q) | busy_budget;
 }
+static int
+tx_syscall_needed(struct xsk_ring_prod *q)
+{
+	return xsk_ring_prod__needs_wakeup(q);
+}
 #else
 static int
-syscall_needed(struct xsk_ring_prod *q __rte_unused, uint32_t busy_budget)
+rx_syscall_needed(struct xsk_ring_prod *q __rte_unused, uint32_t busy_budget)
 {
 	return busy_budget;
 }
+static int
+tx_syscall_needed(struct xsk_ring_prod *q __rte_unused)
+{
+	return 1;
+}
 #endif
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 6e44a21c64..8c6cd224a8 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -273,7 +273,7 @@ af_xdp_rx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	nb_pkts = xsk_ring_cons__peek(rx, nb_pkts, &idx_rx);
 
 	if (nb_pkts == 0) {
-		if (syscall_needed(&rxq->fq, rxq->busy_budget))
+		if (rx_syscall_needed(&rxq->fq, rxq->busy_budget))
 			(void)recvfrom(xsk_socket__fd(rxq->xsk), NULL, 0,
 				MSG_DONTWAIT, NULL, NULL);
 
@@ -456,7 +456,7 @@ kick_tx(struct pkt_tx_queue *txq, struct xsk_ring_cons *cq)
 
 	pull_umem_cq(umem, XSK_RING_CONS__DEFAULT_NUM_DESCS, cq);
 
-	if (syscall_needed(&txq->tx, txq->pair->busy_budget))
+	if (tx_syscall_needed(&txq->tx))
 		while (send(xsk_socket__fd(txq->pair->xsk), NULL,
 			    0, MSG_DONTWAIT) < 0) {
 			/* some thing unexpected */
-- 
2.25.1


             reply	other threads:[~2021-04-20  8:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20  8:44 Ciara Loftus [this message]
2021-04-20  8:44 ` [dpdk-dev] [PATCH 2/2] net/af_xdp: only use recvfrom if busy polling is enabled Ciara Loftus
2021-04-20 10:15 ` [dpdk-dev] [PATCH 1/2] net/af_xdp: fix trigger for syscall on tx Ferruh Yigit

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=20210420084431.6417-1-ciara.loftus@intel.com \
    --to=ciara.loftus@intel.com \
    --cc=dev@dpdk.org \
    /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;
as well as URLs for NNTP newsgroup(s).