From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 72D8EA04AC; Mon, 24 Aug 2020 11:41:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D598F1C0C3; Mon, 24 Aug 2020 11:40:55 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id DF24F1C0BC for ; Mon, 24 Aug 2020 11:40:53 +0200 (CEST) IronPort-SDR: QOnziJNF9VIkW2wMWoBJZ5i6UQrLdSXaYi7yw+a7/o2vJdGn7i3K74PHbdUW3/tjSaNOLNqsOP Y5pjqUpckCoA== X-IronPort-AV: E=McAfee;i="6000,8403,9722"; a="217403214" X-IronPort-AV: E=Sophos;i="5.76,348,1592895600"; d="scan'208";a="217403214" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2020 02:40:53 -0700 IronPort-SDR: DnKN6MZSwrp6Q29OttQqX5kQe1cMO08PWVgAhzBh9ZuTrS0K4NeSYtYPECDXHwoY0/5yE8/nH6 BYZwpf3kFe3w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,348,1592895600"; d="scan'208";a="330955767" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.180]) by fmsmga002.fm.intel.com with ESMTP; 24 Aug 2020 02:40:51 -0700 From: Ferruh Yigit To: dev@dpdk.org, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , Thomas Monjalon , Andrew Rybchenko , Ray Kinsella , Neil Horman Cc: Ferruh Yigit Date: Mon, 24 Aug 2020 10:40:19 +0100 Message-Id: <20200824094021.2323605-5-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200824094021.2323605-1-ferruh.yigit@intel.com> References: <20200824094021.2323605-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 5/7] ethdev: use hairpin helper functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Hairpin helper functions were not used by drivers, but it was used only local to ethdev. They are: 'rte_eth_dev_is_rx_hairpin_queue()' 'rte_eth_dev_is_tx_hairpin_queue()' Exposing them as internal APIs and update mlx5 driver (only user of hairpin) to use them. Signed-off-by: Ferruh Yigit --- drivers/net/mlx5/mlx5_rxq.c | 4 ++-- drivers/net/mlx5/mlx5_txq.c | 4 ++-- lib/librte_ethdev/rte_ethdev_driver.h | 2 ++ lib/librte_ethdev/rte_ethdev_version.map | 2 ++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 79eb8f8d72..4b200579dd 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -542,7 +542,7 @@ mlx5_rx_queue_stop(struct rte_eth_dev *dev, uint16_t idx) eth_rx_burst_t pkt_burst = dev->rx_pkt_burst; int ret; - if (dev->data->rx_queue_state[idx] == RTE_ETH_QUEUE_STATE_HAIRPIN) { + if (rte_eth_dev_is_rx_hairpin_queue(dev, idx)) { DRV_LOG(ERR, "Hairpin queue can't be stopped"); rte_errno = EINVAL; return -EINVAL; @@ -653,7 +653,7 @@ mlx5_rx_queue_start(struct rte_eth_dev *dev, uint16_t idx) { int ret; - if (dev->data->rx_queue_state[idx] == RTE_ETH_QUEUE_STATE_HAIRPIN) { + if (rte_eth_dev_is_rx_hairpin_queue(dev, idx)) { DRV_LOG(ERR, "Hairpin queue can't be started"); rte_errno = EINVAL; return -EINVAL; diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 21fe16b7ed..9d5f4d35b2 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -244,7 +244,7 @@ mlx5_tx_queue_stop(struct rte_eth_dev *dev, uint16_t idx) { int ret; - if (dev->data->tx_queue_state[idx] == RTE_ETH_QUEUE_STATE_HAIRPIN) { + if (rte_eth_dev_is_tx_hairpin_queue(dev, idx)) { DRV_LOG(ERR, "Hairpin queue can't be stopped"); rte_errno = EINVAL; return -EINVAL; @@ -371,7 +371,7 @@ mlx5_tx_queue_start(struct rte_eth_dev *dev, uint16_t idx) { int ret; - if (dev->data->tx_queue_state[idx] == RTE_ETH_QUEUE_STATE_HAIRPIN) { + if (rte_eth_dev_is_tx_hairpin_queue(dev, idx)) { DRV_LOG(ERR, "Hairpin queue can't be started"); rte_errno = EINVAL; return -EINVAL; diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h index 3d1bc33272..5dfe9fdf1a 100644 --- a/lib/librte_ethdev/rte_ethdev_driver.h +++ b/lib/librte_ethdev/rte_ethdev_driver.h @@ -734,6 +734,7 @@ struct eth_dev_ops { * @return * - (1) if the queue is hairpin queue, 0 otherwise. */ +__rte_internal int rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id); /** @@ -748,6 +749,7 @@ int rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id); * @return * - (1) if the queue is hairpin queue, 0 otherwise. */ +__rte_internal int rte_eth_dev_is_tx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id); /** diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map index 6a84f3d76d..5db3fb156a 100644 --- a/lib/librte_ethdev/rte_ethdev_version.map +++ b/lib/librte_ethdev/rte_ethdev_version.map @@ -237,6 +237,8 @@ INTERNAL { rte_eth_dev_attach_secondary; rte_eth_dev_create; rte_eth_dev_destroy; + rte_eth_dev_is_rx_hairpin_queue; + rte_eth_dev_is_tx_hairpin_queue; rte_eth_dev_probing_finish; rte_eth_dev_release_port; rte_eth_devargs_parse; -- 2.25.4