From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 98A382B8B for ; Sun, 22 Apr 2018 13:58:13 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Apr 2018 04:58:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,311,1520924400"; d="scan'208";a="222402442" Received: from dpdk51.sh.intel.com ([10.67.110.184]) by fmsmga006.fm.intel.com with ESMTP; 22 Apr 2018 04:58:11 -0700 From: Qi Zhang To: thomas@monjalon.net, ferruh.yigit@intel.com Cc: konstantin.ananyev@intel.com, dev@dpdk.org, beilei.xing@intel.com, jingjing.wu@intel.com, wenzhuo.lu@intel.com, Qi Zhang Date: Sun, 22 Apr 2018 19:58:20 +0800 Message-Id: <20180422115824.105219-2-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180422115824.105219-1-qi.z.zhang@intel.com> References: <20180212045314.171616-1-qi.z.zhang@intel.com> <20180422115824.105219-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v7 1/5] ethdev: support runtime queue setup 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: , X-List-Received-Date: Sun, 22 Apr 2018 11:58:14 -0000 It's not possible to setup a queue when the port is started because of a check in ethdev layer. New capability flags are added in order to relax this check for devices which support queue setup in runtime. The functions rte_eth_[rx|tx]_queue_setup will raise an error only if the port is started and runtime setup of queue is not supported. Signed-off-by: Qi Zhang Acked-by: Konstantin Ananyev --- v7: - update default.init - rename runtime_queue_setup_capa to dev_capa for generic. - fix typo. v6: - fix tx queue state check in rte_eth_tx_queue_setup doc/guides/nics/features.rst | 18 ++++++++++++++++++ doc/guides/nics/features/default.ini | 2 ++ lib/librte_ether/rte_ethdev.c | 30 ++++++++++++++++++------------ lib/librte_ether/rte_ethdev.h | 7 +++++++ 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index 1b4fb979f..67d459f80 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -892,7 +892,25 @@ Documentation describes performance values. See ``dpdk.org/doc/perf/*``. +.. _nic_features_runtime_rx_queue_setup: +Runtime Rx queue setup +---------------------- + +Supports Rx queue setup after device started. + +* **[provides] rte_eth_dev_info**: ``dev_capa:DEV_CAPA_RUNTIME_RX_QUEUE_SETUP``. +* **[related] API**: ``rte_eth_dev_info_get()``. + +.. _nic_features_runtime_tx_queue_setup: + +Runtime Tx queue setup +---------------------- + +Supports Tx queue setup after device started. + +* **[provides] rte_eth_dev_info**: ``dev_capa:DEV_CAPA_RUNTIME_TX_QUEUE_SETUP``. +* **[related] API**: ``rte_eth_dev_info_get()``. .. _nic_features_other: diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index dae2ad776..dae80d52f 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -78,3 +78,5 @@ x86-64 = Usage doc = Design doc = Perf doc = +Runtime Rx queue setup = +Runtime Tx queue setup = diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 54d6bf355..dd8e38dfa 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1413,12 +1413,6 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, return -EINVAL; } - if (dev->data->dev_started) { - RTE_PMD_DEBUG_TRACE( - "port %d must be stopped to allow configuration\n", port_id); - return -EBUSY; - } - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP); RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP); @@ -1470,6 +1464,15 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, return -EINVAL; } + if (dev->data->dev_started && + !(dev_info.dev_capa & + DEV_CAPA_RUNTIME_RX_QUEUE_SETUP)) + return -EBUSY; + + if (dev->data->rx_queue_state[rx_queue_id] != + RTE_ETH_QUEUE_STATE_STOPPED) + return -EBUSY; + rxq = dev->data->rx_queues; if (rxq[rx_queue_id]) { RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, @@ -1545,12 +1548,6 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, return -EINVAL; } - if (dev->data->dev_started) { - RTE_PMD_DEBUG_TRACE( - "port %d must be stopped to allow configuration\n", port_id); - return -EBUSY; - } - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP); RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP); @@ -1575,6 +1572,15 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, return -EINVAL; } + if (dev->data->dev_started && + !(dev_info.dev_capa & + DEV_CAPA_RUNTIME_TX_QUEUE_SETUP)) + return -EBUSY; + + if (dev->data->tx_queue_state[tx_queue_id] != + RTE_ETH_QUEUE_STATE_STOPPED) + return -EBUSY; + txq = dev->data->tx_queues; if (txq[tx_queue_id]) { RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 7e4e57b3c..c775a64a1 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -981,6 +981,11 @@ struct rte_eth_conf { */ #define DEV_TX_OFFLOAD_SECURITY 0x00020000 +#define DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001 +/**< Device supports Rx queue setup after device started*/ +#define DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002 +/**< Device supports Tx queue setup after device started*/ + /* * If new Tx offload capabilities are defined, they also must be * mentioned in rte_tx_offload_names in rte_ethdev.c file. @@ -1054,6 +1059,8 @@ struct rte_eth_dev_info { struct rte_eth_dev_portconf default_rxportconf; /** Tx parameter recommendations */ struct rte_eth_dev_portconf default_txportconf; + /** Generic device capabilities */ + uint64_t dev_capa; }; /** -- 2.13.6