From patchwork Tue Apr 20 08:44:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Loftus, Ciara" X-Patchwork-Id: 91826 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B30CCA0547; Tue, 20 Apr 2021 10:44:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 865F741643; Tue, 20 Apr 2021 10:44:56 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 5BB24415D0 for ; Tue, 20 Apr 2021 10:44:54 +0200 (CEST) IronPort-SDR: ghlqdJ0kUft5MBwy7oDNYAfNYVLL8JnC1I5q679DuMVJ+PfLIVxgmrcSnkVZJJU2ws7m2PlZ49 EUpH6ZncNDag== X-IronPort-AV: E=McAfee;i="6200,9189,9959"; a="195584158" X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="195584158" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 01:44:53 -0700 IronPort-SDR: SENgIHlBCw0s+YwMpsD/hjPi6ZV9XLd5RbJ/Vd96jZo+zAII4YckQNcGglwiYHxrxQ+OOkUHar 3ojqJTkcuvDg== X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="463043229" Received: from silpixa00399839.ir.intel.com (HELO silpixa00399839.ger.corp.intel.com) ([10.237.222.249]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 01:44:51 -0700 From: Ciara Loftus To: dev@dpdk.org Cc: Ciara Loftus Date: Tue, 20 Apr 2021 09:44:30 +0100 Message-Id: <20210420084431.6417-1-ciara.loftus@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/2] net/af_xdp: fix trigger for syscall on tx X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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 */