From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: ferruh.yigit@amd.com, Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH v2 2/3] net/ice: add traffic management node query function
Date: Tue, 8 Oct 2024 15:43:19 +0100 [thread overview]
Message-ID: <20241008144320.1632138-3-bruce.richardson@intel.com> (raw)
In-Reply-To: <20241008144320.1632138-1-bruce.richardson@intel.com>
Implement the new node querying function for the "ice" net driver.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/ice/ice_tm.c | 52 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
index 7239ab53f1..35bc26ad47 100644
--- a/drivers/net/ice/ice_tm.c
+++ b/drivers/net/ice/ice_tm.c
@@ -17,6 +17,11 @@ static int ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
uint32_t weight, uint32_t level_id,
struct rte_tm_node_params *params,
struct rte_tm_error *error);
+static int ice_node_query(const struct rte_eth_dev *dev, uint32_t node_id,
+ uint32_t *parent_node_id, uint32_t *priority,
+ uint32_t *weight, uint32_t *level_id,
+ struct rte_tm_node_params *params,
+ struct rte_tm_error *error);
static int ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
struct rte_tm_error *error);
static int ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,
@@ -35,6 +40,7 @@ const struct rte_tm_ops ice_tm_ops = {
.node_add = ice_tm_node_add,
.node_delete = ice_tm_node_delete,
.node_type_get = ice_node_type_get,
+ .node_query = ice_node_query,
.hierarchy_commit = ice_hierarchy_commit,
};
@@ -219,6 +225,52 @@ ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,
return 0;
}
+static int
+ice_node_query(const struct rte_eth_dev *dev, uint32_t node_id,
+ uint32_t *parent_node_id, uint32_t *priority,
+ uint32_t *weight, uint32_t *level_id,
+ struct rte_tm_node_params *params,
+ struct rte_tm_error *error)
+{
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct ice_tm_node *tm_node;
+
+ if (node_id == RTE_TM_NODE_ID_NULL) {
+ error->type = RTE_TM_ERROR_TYPE_NODE_ID;
+ error->message = "invalid node id";
+ return -EINVAL;
+ }
+
+ /* check if the node id exists */
+ tm_node = find_node(pf->tm_conf.root, node_id);
+ if (!tm_node) {
+ error->type = RTE_TM_ERROR_TYPE_NODE_ID;
+ error->message = "no such node";
+ return -EEXIST;
+ }
+
+ if (parent_node_id != NULL) {
+ if (tm_node->parent != NULL)
+ *parent_node_id = tm_node->parent->id;
+ else
+ *parent_node_id = RTE_TM_NODE_ID_NULL;
+ }
+
+ if (priority != NULL)
+ *priority = tm_node->priority;
+
+ if (weight != NULL)
+ *weight = tm_node->weight;
+
+ if (level_id != NULL)
+ *level_id = tm_node->level;
+
+ if (params != NULL)
+ *params = tm_node->params;
+
+ return 0;
+}
+
static inline struct ice_tm_shaper_profile *
ice_shaper_profile_search(struct rte_eth_dev *dev,
uint32_t shaper_profile_id)
--
2.43.0
next prev parent reply other threads:[~2024-10-08 14:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 10:53 [PATCH 0/3] add support for querying ethdev TM nodes Bruce Richardson
2024-10-08 10:53 ` [PATCH 1/3] ethdev: add traffic manager query function Bruce Richardson
2024-10-08 10:53 ` [PATCH 2/3] net/ice: add traffic management node " Bruce Richardson
2024-10-08 10:53 ` [PATCH 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
2024-10-08 14:43 ` [PATCH v2 0/3] add support for querying ethdev " Bruce Richardson
2024-10-08 14:43 ` [PATCH v2 1/3] ethdev: add traffic manager query function Bruce Richardson
2024-10-09 0:57 ` fengchengwen
2024-10-09 8:07 ` Bruce Richardson
2024-10-09 9:38 ` fengchengwen
2024-10-08 14:43 ` Bruce Richardson [this message]
2024-10-08 14:43 ` [PATCH v2 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
2024-10-09 1:02 ` fengchengwen
2024-10-09 10:32 ` Bruce Richardson
2024-10-09 10:32 ` [PATCH v3 0/3] add support for querying ethdev " Bruce Richardson
2024-10-09 10:32 ` [PATCH v3 1/3] ethdev: add traffic manager query function Bruce Richardson
2024-10-10 2:05 ` Ferruh Yigit
2024-10-12 0:28 ` Ferruh Yigit
2024-10-09 10:32 ` [PATCH v3 2/3] net/ice: add traffic management node " Bruce Richardson
2024-10-09 10:32 ` [PATCH v3 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
2024-10-12 0:33 ` [PATCH v3 0/3] add support for querying ethdev " Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241008144320.1632138-3-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).