代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/dpdk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 16b5ecbb2f93fa577a0f665b7e1aaf07c63525f1 Mon Sep 17 00:00:00 2001
From: Dengdui Huang <huangdengdui@huawei.com>
Date: Mon, 5 Jun 2023 10:27:40 +0800
Subject: ethdev: add API to check if queue is valid
[ upstream commit dcf6ce9c2100c604fd0cf602841d290d8236b504 ]
The API rte_eth_dev_is_valid_rxq/txq which
is used to check if Rx/Tx queue is valid.
If the queue has been setup, it is considered valid.
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
lib/ethdev/rte_ethdev.c | 22 ++++++++++++++++++++++
lib/ethdev/rte_ethdev.h | 38 ++++++++++++++++++++++++++++++++++++++
lib/ethdev/version.map | 2 ++
3 files changed, 62 insertions(+)
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 61731ec83e..1a25515148 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1009,6 +1009,28 @@ eth_dev_validate_tx_queue(const struct rte_eth_dev *dev, uint16_t tx_queue_id)
return 0;
}
+int
+rte_eth_dev_is_valid_rxq(uint16_t port_id, uint16_t queue_id)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ return eth_dev_validate_rx_queue(dev, queue_id);
+}
+
+int
+rte_eth_dev_is_valid_txq(uint16_t port_id, uint16_t queue_id)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ return eth_dev_validate_tx_queue(dev, queue_id);
+}
+
int
rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id)
{
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 2064d439c8..c555ecb840 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -2692,6 +2692,44 @@ int rte_eth_dev_socket_id(uint16_t port_id);
*/
int rte_eth_dev_is_valid_port(uint16_t port_id);
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Check if Rx queue is valid. If the queue has been setup,
+ * it is considered valid.
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param queue_id
+ * The index of the receive queue.
+ * @return
+ * - -ENODEV: if *port_id* is invalid.
+ * - -EINVAL: if queue_id is out of range or queue is not been setup.
+ * - 0 if Rx queue is valid.
+ */
+__rte_experimental
+int rte_eth_dev_is_valid_rxq(uint16_t port_id, uint16_t queue_id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Check if Tx queue is valid. If the queue has been setup,
+ * it is considered valid.
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param queue_id
+ * The index of the transmit queue.
+ * @return
+ * - -ENODEV: if *port_id* is invalid.
+ * - -EINVAL: if queue_id is out of range or queue is not been setup.
+ * - 0 if Tx queue is valid.
+ */
+__rte_experimental
+int rte_eth_dev_is_valid_txq(uint16_t port_id, uint16_t queue_id);
+
/**
* Start specified Rx queue of a port. It is used when rx_deferred_start
* flag of the specified queue is true.
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 590aa5a0a6..f593f64ea9 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -263,6 +263,8 @@ EXPERIMENTAL {
# added in 22.11
rte_eth_rx_descriptor_dump;
rte_eth_tx_descriptor_dump;
+ rte_eth_dev_is_valid_rxq;
+ rte_eth_dev_is_valid_txq;
};
INTERNAL {
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。