1 Star 0 Fork 72

叶青龙/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0311-ethdev-add-API-to-check-if-queue-is-valid.patch 3.38 KB
一键复制 编辑 原始数据 按行查看 历史
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yeqinglong01/dpdk.git
git@gitee.com:yeqinglong01/dpdk.git
yeqinglong01
dpdk
dpdk
master

搜索帮助