summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQi Zhang <qi.z.zhang@intel.com>2018-04-24 20:44:06 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2018-04-27 17:34:42 +0100
commitcac923cfea47a7deb01082452139512c216ebd12 (patch)
treeadceb0bdf69afc761936ea798d310e25e90a1844
parent0c0e46c36bcc5dfe9d2aa605e1a5f714d45e0b7f (diff)
downloaddpdk-cac923cfea47.zip
dpdk-cac923cfea47.tar.gz
dpdk-cac923cfea47.tar.xz
ethdev: support runtime queue setup
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 <qi.z.zhang@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
-rw-r--r--doc/guides/nics/features.rst18
-rw-r--r--doc/guides/nics/features/default.ini2
-rw-r--r--lib/librte_ether/rte_ethdev.c30
-rw-r--r--lib/librte_ether/rte_ethdev.h7
4 files changed, 45 insertions, 12 deletions
diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index 1b4fb97..14b8672 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:RTE_ETH_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:RTE_ETH_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 dae2ad7..2f03c1d 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -17,6 +17,8 @@ Lock-free Tx queue =
Fast mbuf free =
Free Tx mbuf on demand =
Queue start/stop =
+Runtime Rx queue setup =
+Runtime Tx queue setup =
MTU update =
Jumbo frame =
Scattered Rx =
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 264d874..a4b7e2f 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1423,12 +1423,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);
@@ -1480,6 +1474,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 &
+ RTE_ETH_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,
@@ -1555,12 +1558,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);
@@ -1585,6 +1582,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 &
+ RTE_ETH_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 0d5c8c7..efd84bb 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -993,6 +993,11 @@ struct rte_eth_conf {
*/
#define DEV_TX_OFFLOAD_IP_TNL_TSO 0x00080000
+#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001
+/**< Device supports Rx queue setup after device started*/
+#define RTE_ETH_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.
@@ -1066,6 +1071,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 (RTE_ETH_DEV_CAPA_). */
+ uint64_t dev_capa;
};
/**