From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 123F345ADE; Tue, 8 Oct 2024 12:54:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F23B240695; Tue, 8 Oct 2024 12:54:09 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by mails.dpdk.org (Postfix) with ESMTP id 9F78F4067D for ; Tue, 8 Oct 2024 12:54:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728384849; x=1759920849; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N3jf+yyYSh9VT3tl7+wBqMRL73RN5qr6l2EqsbXP+pw=; b=PDq1NsvuJ9JojZQgV456djvzVCbsTvRCSqpoxnGWKXCq5m9o59NQO5B3 Sq9Iv+ZjTGiU2Soztak0CI4V0ZxH1t18mhydFIhdEehrvnkENGlpF76YQ xB8DGVGBznyO3DeueXr2YUaQtICfvO6MiISJ9x64hQn1ZX4+IM58zEhjN 84o8s6ncQr7lnC1+tD0AnyAfFjLnNSPERik3TknFdU9M0IwSgTtpiHlLx K23u8dd1S4TS4GLXQj/YjBP9VRnAYfub4dr+xWxQSWSIOJXE6OMgSi6sv T5Oo8Q75/Vpd2FLlzReOjTCmPLvOOVIvIpHOtn/HmFX45cpJf/96oxnPo w==; X-CSE-ConnectionGUID: b/K7tODlRd6rPKyucsW/ZQ== X-CSE-MsgGUID: 2AYlm3ltSNK6DOQMqctIZA== X-IronPort-AV: E=McAfee;i="6700,10204,11218"; a="27025135" X-IronPort-AV: E=Sophos;i="6.11,186,1725346800"; d="scan'208";a="27025135" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2024 03:54:08 -0700 X-CSE-ConnectionGUID: 20hlqrGRTgi9HwgyrO/NFQ== X-CSE-MsgGUID: EMBPDt4wSliNam3XA/v25w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,186,1725346800"; d="scan'208";a="106547856" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by fmviesa001.fm.intel.com with ESMTP; 08 Oct 2024 03:54:06 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Bruce Richardson , Thomas Monjalon , Andrew Rybchenko , Cristian Dumitrescu Subject: [PATCH 1/3] ethdev: add traffic manager query function Date: Tue, 8 Oct 2024 11:53:48 +0100 Message-ID: <20241008105350.1396216-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008105350.1396216-1-bruce.richardson@intel.com> References: <20241008105350.1396216-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add function to allow querying a node in the scheduler tree. Returns the parameters as were given to the add function. Adding this function allows apps to just query the hierarchy rather than having to maintain their own copies of it internally. Signed-off-by: Bruce Richardson --- lib/ethdev/ethdev_trace.h | 16 ++++++++++ lib/ethdev/ethdev_trace_points.c | 3 ++ lib/ethdev/rte_tm.c | 25 ++++++++++++++++ lib/ethdev/rte_tm.h | 50 ++++++++++++++++++++++++++++++++ lib/ethdev/rte_tm_driver.h | 12 ++++++++ lib/ethdev/version.map | 3 ++ 6 files changed, 109 insertions(+) diff --git a/lib/ethdev/ethdev_trace.h b/lib/ethdev/ethdev_trace.h index 3bec87bfdb..dee2819531 100644 --- a/lib/ethdev/ethdev_trace.h +++ b/lib/ethdev/ethdev_trace.h @@ -1903,6 +1903,22 @@ RTE_TRACE_POINT( rte_trace_point_emit_int(ret); ) +RTE_TRACE_POINT( + rte_tm_trace_node_query, + RTE_TRACE_POINT_ARGS(uint16_t port_id, 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, int ret), + rte_trace_point_emit_u16(port_id); + rte_trace_point_emit_u32(node_id); + rte_trace_point_emit_ptr(parent_node_id); + rte_trace_point_emit_ptr(priority); + rte_trace_point_emit_ptr(weight); + rte_trace_point_emit_ptr(level_id); + rte_trace_point_emit_ptr(params); + rte_trace_point_emit_int(ret); +) + RTE_TRACE_POINT( rte_tm_trace_node_delete, RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t node_id, int ret), diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c index 99e04f5893..f5ed7ca637 100644 --- a/lib/ethdev/ethdev_trace_points.c +++ b/lib/ethdev/ethdev_trace_points.c @@ -694,6 +694,9 @@ RTE_TRACE_POINT_REGISTER(rte_tm_trace_mark_vlan_dei, RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_add, lib.ethdev.tm.node_add) +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_query, + lib.ethdev.tm.node_query) + RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_capabilities_get, lib.ethdev.tm.node_capabilities_get) diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c index 3eb98e618a..8000b66af9 100644 --- a/lib/ethdev/rte_tm.c +++ b/lib/ethdev/rte_tm.c @@ -301,6 +301,31 @@ int rte_tm_node_add(uint16_t port_id, return ret; } +int rte_tm_node_query(uint16_t port_id, + 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 rte_eth_dev *dev = &rte_eth_devices[port_id]; + int ret; + + if (dev == NULL) + return -EINVAL; + + ret = RTE_TM_FUNC(port_id, node_query)(dev, + node_id, parent_node_id, priority, weight, level_id, + params, error); + + rte_tm_trace_node_query(port_id, node_id, parent_node_id, priority, + weight, level_id, params, ret); + + return ret; +} + /* Delete node from traffic manager hierarchy */ int rte_tm_node_delete(uint16_t port_id, uint32_t node_id, diff --git a/lib/ethdev/rte_tm.h b/lib/ethdev/rte_tm.h index e5da9b8323..852c3485a7 100644 --- a/lib/ethdev/rte_tm.h +++ b/lib/ethdev/rte_tm.h @@ -20,6 +20,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -1599,6 +1600,55 @@ rte_tm_node_add(uint16_t port_id, const struct rte_tm_node_params *params, struct rte_tm_error *error); +/** + * Return information about a traffic management node + * + * Return information about a hierarchy node, using the same format of parameters + * as was passed to the rte_rm_node_add() function. + * Each of the "out" parameters pointers (except error) may be passed as NULL if the + * information is not needed by the caller. For example, to one may check if a node id + * is in use by: + * + * struct rte_tm_error error; + * int ret = rte_tm_node_query(port, node_id, NULL, NULL, NULL, NULL, NULL, &error); + * if (ret == ENOENT) ... + * + * @param[in] port_id + * The port identifier of the Ethernet device. + * @param[in] node_id + * Node ID. Should be a valid node id. + * @param[out] parent_node_id + * Parent node ID. + * @param[out] priority + * Node priority. The highest node priority is zero. Used by the SP algorithm + * running on the parent of the current node for scheduling this child node. + * @param[out] weight + * Node weight. The node weight is relative to the weight sum of all siblings + * that have the same priority. The lowest weight is one. Used by the WFQ + * algorithm running on the parent of the current node for scheduling this + * child node. + * @param[out] level_id + * The node level in the scheduler hierarchy. + * @param[out] params + * Node parameters, as would be used when creating the node. + * @param[out] error + * Error details. Filled in only on error, when not NULL. + * @return + * 0 on success, non-zero error code otherwise. + * -EINVAL - port or node id value is invalid + * -ENOENT - no node exists with the provided id + */ +__rte_experimental +int +rte_tm_node_query(uint16_t port_id, + 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); + /** * Traffic manager node delete * diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h index 6c2618c0d8..fc67f1cb4b 100644 --- a/lib/ethdev/rte_tm_driver.h +++ b/lib/ethdev/rte_tm_driver.h @@ -119,6 +119,16 @@ typedef int (*rte_tm_node_resume_t)(struct rte_eth_dev *dev, uint32_t node_id, struct rte_tm_error *error); +/** @internal Traffic manager node query */ +typedef int (*rte_tm_node_query_t)(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); + /** @internal Traffic manager hierarchy commit */ typedef int (*rte_tm_hierarchy_commit_t)(struct rte_eth_dev *dev, int clear_on_fail, @@ -248,6 +258,8 @@ struct rte_tm_ops { rte_tm_node_suspend_t node_suspend; /** Traffic manager node resume */ rte_tm_node_resume_t node_resume; + /** Traffic manager node resume */ + rte_tm_node_query_t node_query; /** Traffic manager hierarchy commit */ rte_tm_hierarchy_commit_t hierarchy_commit; diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 1669055ca5..9b180a330d 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -325,6 +325,9 @@ EXPERIMENTAL { rte_flow_template_table_resizable; rte_flow_template_table_resize; rte_flow_template_table_resize_complete; + + # added in 24.11 + rte_tm_node_query; }; INTERNAL { -- 2.43.0