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 9AB8D45AF1; Wed, 9 Oct 2024 12:32:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8EF8410E8; Wed, 9 Oct 2024 12:32:21 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by mails.dpdk.org (Postfix) with ESMTP id 6A76F410D0 for ; Wed, 9 Oct 2024 12:32:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728469938; x=1760005938; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SC8dMiMGB6AcJpwK35ft+0LDpjfGzIgA+87BODygGRI=; b=kQHtDewQuId9Y8qmrd9rfbv5ippwdIUR3lcF2AZN8Leo/2Sx8WMLGRd9 F8bVqXspCcmdkYWgONGAXR1ycy1YLTNHEwU7EQPIp1WLYa6YTYsj6yL/y igUYJty6np7ieEhzTNIhIuzYksYj+VHAYl+HCr/nzG5l7YTbQ68tO0vs/ DkULKfFyUgPxdVtjDiViD4NZYLJRBToSgttiVvw09xXxcQvKKHSLR0F8d bDNO0BJLJ/F/W0gRUre5cJmf5rw47rfJqQyfEgFqBqvlaPhBTAVoRlcv5 2ksZ6Mz2zp5y4ASW64F1c+4+lEjVIEeyb8atQu9btC1yCCBvAM9P7vXnq A==; X-CSE-ConnectionGUID: a80R/EUhQtCcF/F85T8tPg== X-CSE-MsgGUID: AQ9k1jezRtWMOsdy7ZQNYw== X-IronPort-AV: E=McAfee;i="6700,10204,11219"; a="31649228" X-IronPort-AV: E=Sophos;i="6.11,189,1725346800"; d="scan'208";a="31649228" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2024 03:32:18 -0700 X-CSE-ConnectionGUID: sETA6445TNG0eeEqy3ymAA== X-CSE-MsgGUID: RE7rfSvMRMywgtHySEobnA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,189,1725346800"; d="scan'208";a="76651301" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by orviesa007.jf.intel.com with ESMTP; 09 Oct 2024 03:32:18 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Bruce Richardson Subject: [PATCH v3 2/3] net/ice: add traffic management node query function Date: Wed, 9 Oct 2024 11:32:09 +0100 Message-ID: <20241009103210.3858363-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009103210.3858363-1-bruce.richardson@intel.com> References: <20241008105350.1396216-1-bruce.richardson@intel.com> <20241009103210.3858363-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 Implement the new node querying function for the "ice" net driver. Signed-off-by: Bruce Richardson --- 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