[RFC,2/3] net/af_xdp: Use recvfrom() instead of poll()

Message ID 20210218092307.29575-3-ciara.loftus@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series AF_XDP Preferred Busy Polling |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Loftus, Ciara Feb. 18, 2021, 9:23 a.m. UTC
  poll() is more expensive and requires more tuning
when used with the upcoming busy polling functionality.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index b51db90204..34b15aa3d0 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -263,9 +263,9 @@  af_xdp_rx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	if (nb_pkts == 0) {
 #if defined(XDP_USE_NEED_WAKEUP)
 		if (xsk_ring_prod__needs_wakeup(fq))
-			(void)poll(rxq->fds, 1, 1000);
+			recvfrom(xsk_socket__fd(rxq->xsk), NULL, 0,
+				MSG_DONTWAIT, NULL, NULL);
 #endif
-
 		return 0;
 	}
 
@@ -336,7 +336,8 @@  af_xdp_rx_cp(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	if (nb_pkts == 0) {
 #if defined(XDP_USE_NEED_WAKEUP)
 		if (xsk_ring_prod__needs_wakeup(fq))
-			(void)poll(rxq->fds, 1, 1000);
+			recvfrom(xsk_socket__fd(rxq->xsk), NULL, 0,
+				MSG_DONTWAIT, NULL, NULL);
 #endif
 		return 0;
 	}