get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/135759/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 135759,
    "url": "http://patches.dpdk.org/api/patches/135759/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240105211237.394105-3-qi.z.zhang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20240105211237.394105-3-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240105211237.394105-3-qi.z.zhang@intel.com",
    "date": "2024-01-05T21:12:36",
    "name": "[v3,2/3] net/ice: refactor tm config data structure",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4599e7969f6b813da68072c8a6b19e2a083aa0bc",
    "submitter": {
        "id": 504,
        "url": "http://patches.dpdk.org/api/people/504/?format=api",
        "name": "Qi Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patches.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240105211237.394105-3-qi.z.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 30742,
            "url": "http://patches.dpdk.org/api/series/30742/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30742",
            "date": "2024-01-05T21:12:34",
            "name": "net/ice: simplified to 3 layer Tx scheduler",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/30742/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/135759/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/135759/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 764074383C;\n\tFri,  5 Jan 2024 13:45:18 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 77DD24068A;\n\tFri,  5 Jan 2024 13:45:10 +0100 (CET)",
            "from mgamail.intel.com (mgamail.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id 7B7D140608\n for <dev@dpdk.org>; Fri,  5 Jan 2024 13:45:08 +0100 (CET)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 05 Jan 2024 04:45:07 -0800",
            "from dpdk-qzhan15-test02.sh.intel.com ([10.67.119.16])\n by orsmga003.jf.intel.com with ESMTP; 05 Jan 2024 04:45:05 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1704458708; x=1735994708;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=FT5oF7/EsCqCfQioUk2LIULfRCeMV3mBIs8weAhC4aI=;\n b=F0glCcQATWiHQGxHedyjXCHN4jfoZ9vTsvMiZE+Rk4Hf64+5233nkIOb\n gysE82Qquiq6kUX78z7yEPDr4QGT2DHpy2snEQYsHmnR6FYpPS9RoY3Ek\n SXS0aFou2Vnav4VlMjIf9/9GpBqESyAhZ9Vgw6AVLRZn6ZwmuhEZvphdo\n EpCkFvsljyN1mpNal1a7BPnH29b1f8sgMl/AtvyqfU3e5HNEzG5NItPkW\n 6nalBIu1gUV1cM8i22sc924RxwtxUEPaOW6oWd/5jbEhAvEpXvsfiOYzA\n V0tvmRtXfye4yDQ/WDdnD6Ehb63XjNr+6r7P6c3RX3YNAicN7qzMr1PiM g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10943\"; a=\"376988426\"",
            "E=Sophos;i=\"6.04,333,1695711600\"; d=\"scan'208\";a=\"376988426\"",
            "E=McAfee;i=\"6600,9927,10943\"; a=\"730468562\"",
            "E=Sophos;i=\"6.04,333,1695711600\"; d=\"scan'208\";a=\"730468562\""
        ],
        "X-ExtLoop1": "1",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "To": "qiming.yang@intel.com,\n\twenjun1.wu@intel.com",
        "Cc": "dev@dpdk.org,\n\tQi Zhang <qi.z.zhang@intel.com>",
        "Subject": "[PATCH v3 2/3] net/ice: refactor tm config data structure",
        "Date": "Fri,  5 Jan 2024 16:12:36 -0500",
        "Message-Id": "<20240105211237.394105-3-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20240105211237.394105-1-qi.z.zhang@intel.com>",
        "References": "<20240105135906.383394-1-qi.z.zhang@intel.com>\n <20240105211237.394105-1-qi.z.zhang@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 <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Simplified struct ice_tm_conf by removing per level node list.\n\nSigned-off-by: Qi Zhang <qi.z.zhang@intel.com>\n---\n drivers/net/ice/ice_ethdev.h |   5 +-\n drivers/net/ice/ice_tm.c     | 244 ++++++++++++++++-------------------\n 2 files changed, 111 insertions(+), 138 deletions(-)",
    "diff": "diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h\nindex ae22c29ffc..008a7a23b9 100644\n--- a/drivers/net/ice/ice_ethdev.h\n+++ b/drivers/net/ice/ice_ethdev.h\n@@ -472,6 +472,7 @@ struct ice_tm_node {\n \tuint32_t id;\n \tuint32_t priority;\n \tuint32_t weight;\n+\tuint32_t level;\n \tuint32_t reference_count;\n \tstruct ice_tm_node *parent;\n \tstruct ice_tm_node **children;\n@@ -492,10 +493,6 @@ enum ice_tm_node_type {\n struct ice_tm_conf {\n \tstruct ice_shaper_profile_list shaper_profile_list;\n \tstruct ice_tm_node *root; /* root node - port */\n-\tstruct ice_tm_node_list qgroup_list; /* node list for all the queue groups */\n-\tstruct ice_tm_node_list queue_list; /* node list for all the queues */\n-\tuint32_t nb_qgroup_node;\n-\tuint32_t nb_queue_node;\n \tbool committed;\n \tbool clear_on_fail;\n };\ndiff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c\nindex 7ae68c683b..c579662843 100644\n--- a/drivers/net/ice/ice_tm.c\n+++ b/drivers/net/ice/ice_tm.c\n@@ -6,6 +6,9 @@\n #include \"ice_ethdev.h\"\n #include \"ice_rxtx.h\"\n \n+#define MAX_CHILDREN_PER_SCHED_NODE\t8\n+#define MAX_CHILDREN_PER_TM_NODE\t256\n+\n static int ice_hierarchy_commit(struct rte_eth_dev *dev,\n \t\t\t\t int clear_on_fail,\n \t\t\t\t __rte_unused struct rte_tm_error *error);\n@@ -43,66 +46,30 @@ ice_tm_conf_init(struct rte_eth_dev *dev)\n \t/* initialize node configuration */\n \tTAILQ_INIT(&pf->tm_conf.shaper_profile_list);\n \tpf->tm_conf.root = NULL;\n-\tTAILQ_INIT(&pf->tm_conf.qgroup_list);\n-\tTAILQ_INIT(&pf->tm_conf.queue_list);\n-\tpf->tm_conf.nb_qgroup_node = 0;\n-\tpf->tm_conf.nb_queue_node = 0;\n \tpf->tm_conf.committed = false;\n \tpf->tm_conf.clear_on_fail = false;\n }\n \n-void\n-ice_tm_conf_uninit(struct rte_eth_dev *dev)\n+static void free_node(struct ice_tm_node *root)\n {\n-\tstruct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n-\tstruct ice_tm_node *tm_node;\n+\tuint32_t i;\n \n-\t/* clear node configuration */\n-\twhile ((tm_node = TAILQ_FIRST(&pf->tm_conf.queue_list))) {\n-\t\tTAILQ_REMOVE(&pf->tm_conf.queue_list, tm_node, node);\n-\t\trte_free(tm_node);\n-\t}\n-\tpf->tm_conf.nb_queue_node = 0;\n-\twhile ((tm_node = TAILQ_FIRST(&pf->tm_conf.qgroup_list))) {\n-\t\tTAILQ_REMOVE(&pf->tm_conf.qgroup_list, tm_node, node);\n-\t\trte_free(tm_node);\n-\t}\n-\tpf->tm_conf.nb_qgroup_node = 0;\n-\tif (pf->tm_conf.root) {\n-\t\trte_free(pf->tm_conf.root);\n-\t\tpf->tm_conf.root = NULL;\n-\t}\n+\tif (root == NULL)\n+\t\treturn;\n+\n+\tfor (i = 0; i < root->reference_count; i++)\n+\t\tfree_node(root->children[i]);\n+\n+\trte_free(root);\n }\n \n-static inline struct ice_tm_node *\n-ice_tm_node_search(struct rte_eth_dev *dev,\n-\t\t    uint32_t node_id, enum ice_tm_node_type *node_type)\n+void\n+ice_tm_conf_uninit(struct rte_eth_dev *dev)\n {\n \tstruct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n-\tstruct ice_tm_node_list *qgroup_list = &pf->tm_conf.qgroup_list;\n-\tstruct ice_tm_node_list *queue_list = &pf->tm_conf.queue_list;\n-\tstruct ice_tm_node *tm_node;\n-\n-\tif (pf->tm_conf.root && pf->tm_conf.root->id == node_id) {\n-\t\t*node_type = ICE_TM_NODE_TYPE_PORT;\n-\t\treturn pf->tm_conf.root;\n-\t}\n \n-\tTAILQ_FOREACH(tm_node, qgroup_list, node) {\n-\t\tif (tm_node->id == node_id) {\n-\t\t\t*node_type = ICE_TM_NODE_TYPE_QGROUP;\n-\t\t\treturn tm_node;\n-\t\t}\n-\t}\n-\n-\tTAILQ_FOREACH(tm_node, queue_list, node) {\n-\t\tif (tm_node->id == node_id) {\n-\t\t\t*node_type = ICE_TM_NODE_TYPE_QUEUE;\n-\t\t\treturn tm_node;\n-\t\t}\n-\t}\n-\n-\treturn NULL;\n+\tfree_node(pf->tm_conf.root);\n+\tpf->tm_conf.root = NULL;\n }\n \n static int\n@@ -195,11 +162,29 @@ ice_node_param_check(struct ice_pf *pf, uint32_t node_id,\n \treturn 0;\n }\n \n+static struct ice_tm_node *\n+find_node(struct ice_tm_node *root, uint32_t id)\n+{\n+\tuint32_t i;\n+\n+\tif (root == NULL || root->id == id)\n+\t\treturn root;\n+\n+\tfor (i = 0; i < root->reference_count; i++) {\n+\t\tstruct ice_tm_node *node = find_node(root->children[i], id);\n+\n+\t\tif (node)\n+\t\t\treturn node;\n+\t}\n+\n+\treturn NULL;\n+}\n+\n static int\n ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,\n \t\t   int *is_leaf, struct rte_tm_error *error)\n {\n-\tenum ice_tm_node_type node_type = ICE_TM_NODE_TYPE_MAX;\n+\tstruct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n \tstruct ice_tm_node *tm_node;\n \n \tif (!is_leaf || !error)\n@@ -212,14 +197,14 @@ ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,\n \t}\n \n \t/* check if the node id exists */\n-\ttm_node = ice_tm_node_search(dev, node_id, &node_type);\n+\ttm_node = find_node(pf->tm_conf.root, node_id);\n \tif (!tm_node) {\n \t\terror->type = RTE_TM_ERROR_TYPE_NODE_ID;\n \t\terror->message = \"no such node\";\n \t\treturn -EINVAL;\n \t}\n \n-\tif (node_type == ICE_TM_NODE_TYPE_QUEUE)\n+\tif (tm_node->level == ICE_TM_NODE_TYPE_QUEUE)\n \t\t*is_leaf = true;\n \telse\n \t\t*is_leaf = false;\n@@ -341,8 +326,6 @@ ice_shaper_profile_del(struct rte_eth_dev *dev,\n \treturn 0;\n }\n \n-#define MAX_QUEUE_PER_GROUP\t8\n-\n static int\n ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,\n \t      uint32_t parent_node_id, uint32_t priority,\n@@ -351,8 +334,6 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,\n \t      struct rte_tm_error *error)\n {\n \tstruct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n-\tenum ice_tm_node_type node_type = ICE_TM_NODE_TYPE_MAX;\n-\tenum ice_tm_node_type parent_node_type = ICE_TM_NODE_TYPE_MAX;\n \tstruct ice_tm_shaper_profile *shaper_profile = NULL;\n \tstruct ice_tm_node *tm_node;\n \tstruct ice_tm_node *parent_node;\n@@ -367,7 +348,7 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,\n \t\treturn ret;\n \n \t/* check if the node is already existed */\n-\tif (ice_tm_node_search(dev, node_id, &node_type)) {\n+\tif (find_node(pf->tm_conf.root, node_id)) {\n \t\terror->type = RTE_TM_ERROR_TYPE_NODE_ID;\n \t\terror->message = \"node id already used\";\n \t\treturn -EINVAL;\n@@ -402,17 +383,19 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,\n \t\t}\n \n \t\t/* add the root node */\n-\t\ttm_node = rte_zmalloc(\"ice_tm_node\",\n-\t\t\t\t      sizeof(struct ice_tm_node),\n+\t\ttm_node = rte_zmalloc(NULL,\n+\t\t\t\t      sizeof(struct ice_tm_node) +\n+\t\t\t\t      sizeof(struct ice_tm_node *) * MAX_CHILDREN_PER_TM_NODE,\n \t\t\t\t      0);\n \t\tif (!tm_node)\n \t\t\treturn -ENOMEM;\n \t\ttm_node->id = node_id;\n+\t\ttm_node->level = ICE_TM_NODE_TYPE_PORT;\n \t\ttm_node->parent = NULL;\n \t\ttm_node->reference_count = 0;\n \t\ttm_node->shaper_profile = shaper_profile;\n-\t\ttm_node->children = (struct ice_tm_node **)\n-\t\t\trte_calloc(NULL, 256, (sizeof(struct ice_tm_node *)), 0);\n+\t\ttm_node->children =\n+\t\t\t(void *)((uint8_t *)tm_node + sizeof(struct ice_tm_node));\n \t\trte_memcpy(&tm_node->params, params,\n \t\t\t\t sizeof(struct rte_tm_node_params));\n \t\tpf->tm_conf.root = tm_node;\n@@ -420,29 +403,28 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,\n \t}\n \n \t/* check the parent node */\n-\tparent_node = ice_tm_node_search(dev, parent_node_id,\n-\t\t\t\t\t  &parent_node_type);\n+\tparent_node = find_node(pf->tm_conf.root, parent_node_id);\n \tif (!parent_node) {\n \t\terror->type = RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID;\n \t\terror->message = \"parent not exist\";\n \t\treturn -EINVAL;\n \t}\n-\tif (parent_node_type != ICE_TM_NODE_TYPE_PORT &&\n-\t    parent_node_type != ICE_TM_NODE_TYPE_QGROUP) {\n+\tif (parent_node->level != ICE_TM_NODE_TYPE_PORT &&\n+\t    parent_node->level != ICE_TM_NODE_TYPE_QGROUP) {\n \t\terror->type = RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID;\n \t\terror->message = \"parent is not valid\";\n \t\treturn -EINVAL;\n \t}\n \t/* check level */\n \tif (level_id != RTE_TM_NODE_LEVEL_ID_ANY &&\n-\t    level_id != (uint32_t)parent_node_type + 1) {\n+\t    level_id != parent_node->level + 1) {\n \t\terror->type = RTE_TM_ERROR_TYPE_NODE_PARAMS;\n \t\terror->message = \"Wrong level\";\n \t\treturn -EINVAL;\n \t}\n \n \t/* check the node number */\n-\tif (parent_node_type == ICE_TM_NODE_TYPE_PORT) {\n+\tif (parent_node->level == ICE_TM_NODE_TYPE_PORT) {\n \t\t/* check the queue group number */\n \t\tif (parent_node->reference_count >= pf->dev_data->nb_tx_queues) {\n \t\t\terror->type = RTE_TM_ERROR_TYPE_NODE_ID;\n@@ -451,7 +433,8 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,\n \t\t}\n \t} else {\n \t\t/* check the queue number */\n-\t\tif (parent_node->reference_count >= MAX_QUEUE_PER_GROUP) {\n+\t\tif (parent_node->reference_count >=\n+\t\t\tMAX_CHILDREN_PER_SCHED_NODE) {\n \t\t\terror->type = RTE_TM_ERROR_TYPE_NODE_ID;\n \t\t\terror->message = \"too many queues\";\n \t\t\treturn -EINVAL;\n@@ -463,8 +446,9 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,\n \t\t}\n \t}\n \n-\ttm_node = rte_zmalloc(\"ice_tm_node\",\n-\t\t\t      sizeof(struct ice_tm_node),\n+\ttm_node = rte_zmalloc(NULL,\n+\t\t\t      sizeof(struct ice_tm_node) +\n+\t\t\t      sizeof(struct ice_tm_node *) * MAX_CHILDREN_PER_TM_NODE,\n \t\t\t      0);\n \tif (!tm_node)\n \t\treturn -ENOMEM;\n@@ -473,9 +457,10 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,\n \ttm_node->weight = weight;\n \ttm_node->reference_count = 0;\n \ttm_node->parent = parent_node;\n+\ttm_node->level = parent_node->level + 1;\n \ttm_node->shaper_profile = shaper_profile;\n-\ttm_node->children = (struct ice_tm_node **)\n-\t\t\trte_calloc(NULL, 256, (sizeof(struct ice_tm_node *)), 0);\n+\ttm_node->children =\n+\t\t(void *)((uint8_t *)tm_node + sizeof(struct ice_tm_node));\n \ttm_node->parent->children[tm_node->parent->reference_count] = tm_node;\n \n \tif (tm_node->priority != 0 && level_id != ICE_TM_NODE_TYPE_QUEUE &&\n@@ -490,15 +475,6 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,\n \n \trte_memcpy(&tm_node->params, params,\n \t\t\t sizeof(struct rte_tm_node_params));\n-\tif (parent_node_type == ICE_TM_NODE_TYPE_PORT) {\n-\t\tTAILQ_INSERT_TAIL(&pf->tm_conf.qgroup_list,\n-\t\t\t\t  tm_node, node);\n-\t\tpf->tm_conf.nb_qgroup_node++;\n-\t} else {\n-\t\tTAILQ_INSERT_TAIL(&pf->tm_conf.queue_list,\n-\t\t\t\t  tm_node, node);\n-\t\tpf->tm_conf.nb_queue_node++;\n-\t}\n \ttm_node->parent->reference_count++;\n \n \treturn 0;\n@@ -509,8 +485,8 @@ ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,\n \t\t struct rte_tm_error *error)\n {\n \tstruct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n-\tenum ice_tm_node_type node_type = ICE_TM_NODE_TYPE_MAX;\n \tstruct ice_tm_node *tm_node;\n+\tuint32_t i, j;\n \n \tif (!error)\n \t\treturn -EINVAL;\n@@ -522,7 +498,7 @@ ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,\n \t}\n \n \t/* check if the node id exists */\n-\ttm_node = ice_tm_node_search(dev, node_id, &node_type);\n+\ttm_node = find_node(pf->tm_conf.root, node_id);\n \tif (!tm_node) {\n \t\terror->type = RTE_TM_ERROR_TYPE_NODE_ID;\n \t\terror->message = \"no such node\";\n@@ -538,21 +514,21 @@ ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,\n \t}\n \n \t/* root node */\n-\tif (node_type == ICE_TM_NODE_TYPE_PORT) {\n+\tif (tm_node->level == ICE_TM_NODE_TYPE_PORT) {\n \t\trte_free(tm_node);\n \t\tpf->tm_conf.root = NULL;\n \t\treturn 0;\n \t}\n \n \t/* queue group or queue node */\n+\tfor (i = 0; i < tm_node->parent->reference_count; i++)\n+\t\tif (tm_node->parent->children[i] == tm_node)\n+\t\t\tbreak;\n+\n+\tfor (j = i ; j < tm_node->parent->reference_count - 1; j++)\n+\t\ttm_node->parent->children[j] = tm_node->parent->children[j + 1];\n+\n \ttm_node->parent->reference_count--;\n-\tif (node_type == ICE_TM_NODE_TYPE_QGROUP) {\n-\t\tTAILQ_REMOVE(&pf->tm_conf.qgroup_list, tm_node, node);\n-\t\tpf->tm_conf.nb_qgroup_node--;\n-\t} else {\n-\t\tTAILQ_REMOVE(&pf->tm_conf.queue_list, tm_node, node);\n-\t\tpf->tm_conf.nb_queue_node--;\n-\t}\n \trte_free(tm_node);\n \n \treturn 0;\n@@ -708,9 +684,9 @@ static int ice_reset_noleaf_nodes(struct rte_eth_dev *dev)\n {\n \tstruct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n \tstruct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\tstruct ice_tm_node_list *qgroup_list = &pf->tm_conf.qgroup_list;\n \tstruct ice_sched_node *vsi_node = ice_get_vsi_node(hw);\n-\tstruct ice_tm_node *tm_node;\n+\tstruct ice_tm_node *root = pf->tm_conf.root;\n+\tuint32_t i;\n \tint ret;\n \n \t/* reset vsi_node */\n@@ -720,8 +696,12 @@ static int ice_reset_noleaf_nodes(struct rte_eth_dev *dev)\n \t\treturn ret;\n \t}\n \n-\t/* reset queue group nodes */\n-\tTAILQ_FOREACH(tm_node, qgroup_list, node) {\n+\tif (root == NULL)\n+\t\treturn 0;\n+\n+\tfor (i = 0; i < root->reference_count; i++) {\n+\t\tstruct ice_tm_node *tm_node = root->children[i];\n+\n \t\tif (tm_node->sched_node == NULL)\n \t\t\tcontinue;\n \n@@ -774,9 +754,7 @@ int ice_do_hierarchy_commit(struct rte_eth_dev *dev,\n {\n \tstruct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n \tstruct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\tstruct ice_tm_node_list *qgroup_list = &pf->tm_conf.qgroup_list;\n-\tstruct ice_tm_node_list *queue_list = &pf->tm_conf.queue_list;\n-\tstruct ice_tm_node *tm_node;\n+\tstruct ice_tm_node *root;\n \tstruct ice_sched_node *vsi_node = NULL;\n \tstruct ice_sched_node *queue_node;\n \tstruct ice_tx_queue *txq;\n@@ -807,14 +785,14 @@ int ice_do_hierarchy_commit(struct rte_eth_dev *dev,\n \n \t/* config vsi node */\n \tvsi_node = ice_get_vsi_node(hw);\n-\ttm_node = pf->tm_conf.root;\n+\troot = pf->tm_conf.root;\n \n-\tret_val = ice_set_node_rate(hw, tm_node, vsi_node);\n+\tret_val = ice_set_node_rate(hw, root, vsi_node);\n \tif (ret_val) {\n \t\terror->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;\n \t\tPMD_DRV_LOG(ERR,\n \t\t\t    \"configure vsi node %u bandwidth failed\",\n-\t\t\t    tm_node->id);\n+\t\t\t    root->id);\n \t\tgoto add_leaf;\n \t}\n \n@@ -825,13 +803,27 @@ int ice_do_hierarchy_commit(struct rte_eth_dev *dev,\n \tidx_vsi_child = 0;\n \tidx_qg = 0;\n \n-\tTAILQ_FOREACH(tm_node, qgroup_list, node) {\n+\tif (root == NULL)\n+\t\tgoto commit;\n+\n+\tfor (i = 0; i < root->reference_count; i++) {\n+\t\tstruct ice_tm_node *tm_node = root->children[i];\n \t\tstruct ice_tm_node *tm_child_node;\n \t\tstruct ice_sched_node *qgroup_sched_node =\n \t\t\tvsi_node->children[idx_vsi_child]->children[idx_qg];\n+\t\tuint32_t j;\n+\n+\t\tret_val = ice_cfg_hw_node(hw, tm_node, qgroup_sched_node);\n+\t\tif (ret_val) {\n+\t\t\terror->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;\n+\t\t\tPMD_DRV_LOG(ERR,\n+\t\t\t\t    \"configure queue group node %u failed\",\n+\t\t\t\t    tm_node->id);\n+\t\t\tgoto reset_leaf;\n+\t\t}\n \n-\t\tfor (i = 0; i < tm_node->reference_count; i++) {\n-\t\t\ttm_child_node = tm_node->children[i];\n+\t\tfor (j = 0; j < tm_node->reference_count; j++) {\n+\t\t\ttm_child_node = tm_node->children[j];\n \t\t\tqid = tm_child_node->id;\n \t\t\tret_val = ice_tx_queue_start(dev, qid);\n \t\t\tif (ret_val) {\n@@ -847,25 +839,25 @@ int ice_do_hierarchy_commit(struct rte_eth_dev *dev,\n \t\t\t\tPMD_DRV_LOG(ERR, \"get queue %u node failed\", qid);\n \t\t\t\tgoto reset_leaf;\n \t\t\t}\n-\t\t\tif (queue_node->info.parent_teid == qgroup_sched_node->info.node_teid)\n-\t\t\t\tcontinue;\n-\t\t\tret_val = ice_move_recfg_lan_txq(dev, queue_node, qgroup_sched_node, qid);\n+\t\t\tif (queue_node->info.parent_teid != qgroup_sched_node->info.node_teid) {\n+\t\t\t\tret_val = ice_move_recfg_lan_txq(dev, queue_node,\n+\t\t\t\t\t\t\t\t qgroup_sched_node, qid);\n+\t\t\t\tif (ret_val) {\n+\t\t\t\t\terror->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;\n+\t\t\t\t\tPMD_DRV_LOG(ERR, \"move queue %u failed\", qid);\n+\t\t\t\t\tgoto reset_leaf;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tret_val = ice_cfg_hw_node(hw, tm_child_node, queue_node);\n \t\t\tif (ret_val) {\n \t\t\t\terror->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;\n-\t\t\t\tPMD_DRV_LOG(ERR, \"move queue %u failed\", qid);\n+\t\t\t\tPMD_DRV_LOG(ERR,\n+\t\t\t\t\t    \"configure queue group node %u failed\",\n+\t\t\t\t\t    tm_node->id);\n \t\t\t\tgoto reset_leaf;\n \t\t\t}\n \t\t}\n \n-\t\tret_val = ice_cfg_hw_node(hw, tm_node, qgroup_sched_node);\n-\t\tif (ret_val) {\n-\t\t\terror->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;\n-\t\t\tPMD_DRV_LOG(ERR,\n-\t\t\t\t    \"configure queue group node %u failed\",\n-\t\t\t\t    tm_node->id);\n-\t\t\tgoto reset_leaf;\n-\t\t}\n-\n \t\tidx_qg++;\n \t\tif (idx_qg >= nb_qg) {\n \t\t\tidx_qg = 0;\n@@ -878,23 +870,7 @@ int ice_do_hierarchy_commit(struct rte_eth_dev *dev,\n \t\t}\n \t}\n \n-\t/* config queue nodes */\n-\tTAILQ_FOREACH(tm_node, queue_list, node) {\n-\t\tqid = tm_node->id;\n-\t\ttxq = dev->data->tx_queues[qid];\n-\t\tq_teid = txq->q_teid;\n-\t\tqueue_node = ice_sched_get_node(hw->port_info, q_teid);\n-\n-\t\tret_val = ice_cfg_hw_node(hw, tm_node, queue_node);\n-\t\tif (ret_val) {\n-\t\t\terror->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;\n-\t\t\tPMD_DRV_LOG(ERR,\n-\t\t\t\t    \"configure queue group node %u failed\",\n-\t\t\t\t    tm_node->id);\n-\t\t\tgoto reset_leaf;\n-\t\t}\n-\t}\n-\n+commit:\n \tpf->tm_conf.committed = true;\n \tpf->tm_conf.clear_on_fail = clear_on_fail;\n \n",
    "prefixes": [
        "v3",
        "2/3"
    ]
}