get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 115509,
    "url": "http://patchwork.dpdk.org/api/patches/115509/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20220826131737.1741743-2-cristian.dumitrescu@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20220826131737.1741743-2-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220826131737.1741743-2-cristian.dumitrescu@intel.com",
    "date": "2022-08-26T13:17:17",
    "name": "[V2,01/21] net/softnic: remove the traffic manager support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ee62a438bae779e2cf376b24254dcf1bd41aa22f",
    "submitter": {
        "id": 19,
        "url": "http://patchwork.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20220826131737.1741743-2-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 24429,
            "url": "http://patchwork.dpdk.org/api/series/24429/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=24429",
            "date": "2022-08-26T13:17:16",
            "name": "net/softnic: replace the legacy pipeline with SWX pipeline",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/24429/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/115509/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/115509/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 22806A0550;\n\tFri, 26 Aug 2022 15:18:13 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id A41A2427F9;\n\tFri, 26 Aug 2022 15:18:02 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id 9A67640143\n for <dev@dpdk.org>; Fri, 26 Aug 2022 15:17:58 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 26 Aug 2022 06:17:40 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com.) ([10.237.223.157])\n by orsmga002.jf.intel.com with ESMTP; 26 Aug 2022 06:17:39 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1661519878; x=1693055878;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=/BqxQgBetOpiQK9lC+vS8pGlGe8LHY9HOxktHgXjS74=;\n b=mpIh3Ni2O5PaOC+Om48TB7e+8Pr4g8di3QuMQia0Jlzpe9ljqoWmNUiy\n SFKkP4dOOmYZP9Haqx1p5S5iCgBeRwsif2xXgezn3tOwM1OGfjxPGSo/Y\n aMrqxMqAZP5zk4k3m+arwkNZBpDJe9PiUKhdqB+WnddsqmPQbNLd6HvCG\n 4hHynxw6PSGOe8wMGVD+QvBgQyw+DlnboQ40pQvwlOR+zFQOBNFLtThUF\n dE1i7UInfH1Y87ism7Ppq3rUifCeUq69aVWnM9GYCaZ1JJyJ6F7DGUHZi\n vgizJrpK8Ik6s/bAWAyaWz1F9H0iJ33jSvvjnDAu/MzuGVafb0F6NhDXp A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10450\"; a=\"320598536\"",
            "E=Sophos;i=\"5.93,265,1654585200\"; d=\"scan'208\";a=\"320598536\"",
            "E=Sophos;i=\"5.93,265,1654585200\"; d=\"scan'208\";a=\"610561570\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Yogesh Jangra <yogesh.jangra@intel.com>",
        "Subject": "[PATCH V2 01/21] net/softnic: remove the traffic manager support",
        "Date": "Fri, 26 Aug 2022 13:17:17 +0000",
        "Message-Id": "<20220826131737.1741743-2-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220826131737.1741743-1-cristian.dumitrescu@intel.com>",
        "References": "<20220804165839.1074817-1-cristian.dumitrescu@intel.com>\n <20220826131737.1741743-1-cristian.dumitrescu@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": "Remove the Ethernet device traffic manager API support.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Yogesh Jangra <yogesh.jangra@intel.com>\n---\n drivers/net/softnic/meson.build               |    3 +-\n drivers/net/softnic/rte_eth_softnic.c         |  170 -\n drivers/net/softnic/rte_eth_softnic.h         |   10 -\n drivers/net/softnic/rte_eth_softnic_cli.c     | 1328 ------\n .../net/softnic/rte_eth_softnic_internals.h   |  176 -\n .../net/softnic/rte_eth_softnic_pipeline.c    |   31 -\n drivers/net/softnic/rte_eth_softnic_tm.c      | 3657 -----------------\n 7 files changed, 1 insertion(+), 5374 deletions(-)\n delete mode 100644 drivers/net/softnic/rte_eth_softnic_tm.c",
    "diff": "diff --git a/drivers/net/softnic/meson.build b/drivers/net/softnic/meson.build\nindex aff5fb3bf2..e2dbd6166e 100644\n--- a/drivers/net/softnic/meson.build\n+++ b/drivers/net/softnic/meson.build\n@@ -21,6 +21,5 @@ sources = files(\n         'rte_eth_softnic_swq.c',\n         'rte_eth_softnic_tap.c',\n         'rte_eth_softnic_thread.c',\n-        'rte_eth_softnic_tm.c',\n )\n-deps += ['pipeline', 'port', 'table', 'sched', 'cryptodev']\n+deps += ['pipeline', 'port', 'table', 'cryptodev']\ndiff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c\nindex 8c098cad5b..ae3e8b3bcd 100644\n--- a/drivers/net/softnic/rte_eth_softnic.c\n+++ b/drivers/net/softnic/rte_eth_softnic.c\n@@ -13,7 +13,6 @@\n #include <rte_kvargs.h>\n #include <rte_errno.h>\n #include <rte_ring.h>\n-#include <rte_tm_driver.h>\n #include <rte_mtr_driver.h>\n \n #include \"rte_eth_softnic.h\"\n@@ -23,20 +22,6 @@\n #define PMD_PARAM_CONN_PORT                                \"conn_port\"\n #define PMD_PARAM_CPU_ID                                   \"cpu_id\"\n #define PMD_PARAM_SC                                       \"sc\"\n-#define PMD_PARAM_TM_N_QUEUES                              \"tm_n_queues\"\n-#define PMD_PARAM_TM_QSIZE0                                \"tm_qsize0\"\n-#define PMD_PARAM_TM_QSIZE1                                \"tm_qsize1\"\n-#define PMD_PARAM_TM_QSIZE2                                \"tm_qsize2\"\n-#define PMD_PARAM_TM_QSIZE3                                \"tm_qsize3\"\n-#define PMD_PARAM_TM_QSIZE4                                \"tm_qsize4\"\n-#define PMD_PARAM_TM_QSIZE5                                \"tm_qsize5\"\n-#define PMD_PARAM_TM_QSIZE6                                \"tm_qsize6\"\n-#define PMD_PARAM_TM_QSIZE7                                \"tm_qsize7\"\n-#define PMD_PARAM_TM_QSIZE8                                \"tm_qsize8\"\n-#define PMD_PARAM_TM_QSIZE9                                \"tm_qsize9\"\n-#define PMD_PARAM_TM_QSIZE10                               \"tm_qsize10\"\n-#define PMD_PARAM_TM_QSIZE11                               \"tm_qsize11\"\n-#define PMD_PARAM_TM_QSIZE12                               \"tm_qsize12\"\n \n \n static const char * const pmd_valid_args[] = {\n@@ -44,20 +29,6 @@ static const char * const pmd_valid_args[] = {\n \tPMD_PARAM_CONN_PORT,\n \tPMD_PARAM_CPU_ID,\n \tPMD_PARAM_SC,\n-\tPMD_PARAM_TM_N_QUEUES,\n-\tPMD_PARAM_TM_QSIZE0,\n-\tPMD_PARAM_TM_QSIZE1,\n-\tPMD_PARAM_TM_QSIZE2,\n-\tPMD_PARAM_TM_QSIZE3,\n-\tPMD_PARAM_TM_QSIZE4,\n-\tPMD_PARAM_TM_QSIZE5,\n-\tPMD_PARAM_TM_QSIZE6,\n-\tPMD_PARAM_TM_QSIZE7,\n-\tPMD_PARAM_TM_QSIZE8,\n-\tPMD_PARAM_TM_QSIZE9,\n-\tPMD_PARAM_TM_QSIZE10,\n-\tPMD_PARAM_TM_QSIZE11,\n-\tPMD_PARAM_TM_QSIZE12,\n \tNULL\n };\n \n@@ -193,12 +164,10 @@ pmd_dev_stop(struct rte_eth_dev *dev)\n \tsoftnic_table_action_profile_free(p);\n \tsoftnic_port_in_action_profile_free(p);\n \tsoftnic_tap_free(p);\n-\tsoftnic_tmgr_free(p);\n \tsoftnic_link_free(p);\n \tsoftnic_softnic_swq_free_keep_rxq_txq(p);\n \tsoftnic_mempool_free(p);\n \n-\ttm_hierarchy_free(p);\n \tsoftnic_mtr_free(p);\n \n \treturn 0;\n@@ -218,12 +187,10 @@ pmd_free(struct pmd_internals *p)\n \tsoftnic_table_action_profile_free(p);\n \tsoftnic_port_in_action_profile_free(p);\n \tsoftnic_tap_free(p);\n-\tsoftnic_tmgr_free(p);\n \tsoftnic_link_free(p);\n \tsoftnic_swq_free(p);\n \tsoftnic_mempool_free(p);\n \n-\ttm_hierarchy_free(p);\n \tsoftnic_mtr_free(p);\n \n \trte_free(p);\n@@ -256,14 +223,6 @@ pmd_flow_ops_get(struct rte_eth_dev *dev __rte_unused,\n \treturn 0;\n }\n \n-static int\n-pmd_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg)\n-{\n-\t*(const struct rte_tm_ops **)arg = &pmd_tm_ops;\n-\n-\treturn 0;\n-}\n-\n static int\n pmd_mtr_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg)\n {\n@@ -282,7 +241,6 @@ static const struct eth_dev_ops pmd_ops = {\n \t.rx_queue_setup = pmd_rx_queue_setup,\n \t.tx_queue_setup = pmd_tx_queue_setup,\n \t.flow_ops_get = pmd_flow_ops_get,\n-\t.tm_ops_get = pmd_tm_ops_get,\n \t.mtr_ops_get = pmd_mtr_ops_get,\n };\n \n@@ -325,13 +283,11 @@ pmd_init(struct pmd_params *params)\n \tmemcpy(&p->params, params, sizeof(p->params));\n \n \t/* Resources */\n-\ttm_hierarchy_init(p);\n \tsoftnic_mtr_init(p);\n \n \tsoftnic_mempool_init(p);\n \tsoftnic_swq_init(p);\n \tsoftnic_link_init(p);\n-\tsoftnic_tmgr_init(p);\n \tsoftnic_tap_init(p);\n \tsoftnic_cryptodev_init(p);\n \tsoftnic_port_in_action_profile_init(p);\n@@ -459,20 +415,6 @@ pmd_parse_args(struct pmd_params *p, const char *params)\n \t}\n \tp->cpu_id = SOFTNIC_CPU_ID;\n \tp->sc = SOFTNIC_SC;\n-\tp->tm.n_queues = SOFTNIC_TM_N_QUEUES;\n-\tp->tm.qsize[0] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[1] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[2] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[3] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[4] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[5] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[6] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[7] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[8] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[9] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[10] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[11] = SOFTNIC_TM_QUEUE_SIZE;\n-\tp->tm.qsize[12] = SOFTNIC_TM_QUEUE_SIZE;\n \n \t/* Firmware script (optional) */\n \tif (rte_kvargs_count(kvlist, PMD_PARAM_FIRMWARE) == 1) {\n@@ -517,104 +459,6 @@ pmd_parse_args(struct pmd_params *p, const char *params)\n \t\t\tgoto out_free;\n \t}\n \n-\t/* TM number of queues (optional) */\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_N_QUEUES) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_N_QUEUES,\n-\t\t\t&get_uint32, &p->tm.n_queues);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n-\t/* TM queue size 0 .. 3 (optional) */\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE0) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE0,\n-\t\t\t&get_uint32, &p->tm.qsize[0]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE1) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE1,\n-\t\t\t&get_uint32, &p->tm.qsize[1]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE2) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE2,\n-\t\t\t&get_uint32, &p->tm.qsize[2]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE3) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE3,\n-\t\t\t&get_uint32, &p->tm.qsize[3]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE4) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE4,\n-\t\t\t&get_uint32, &p->tm.qsize[4]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE5) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE5,\n-\t\t\t&get_uint32, &p->tm.qsize[5]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE6) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE6,\n-\t\t\t&get_uint32, &p->tm.qsize[6]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE7) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE7,\n-\t\t\t&get_uint32, &p->tm.qsize[7]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE8) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE8,\n-\t\t\t&get_uint32, &p->tm.qsize[8]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE9) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE9,\n-\t\t\t&get_uint32, &p->tm.qsize[9]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE10) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE10,\n-\t\t\t&get_uint32, &p->tm.qsize[10]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE11) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE11,\n-\t\t\t&get_uint32, &p->tm.qsize[11]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n-\tif (rte_kvargs_count(kvlist, PMD_PARAM_TM_QSIZE12) == 1) {\n-\t\tret = rte_kvargs_process(kvlist, PMD_PARAM_TM_QSIZE12,\n-\t\t\t&get_uint32, &p->tm.qsize[12]);\n-\t\tif (ret < 0)\n-\t\t\tgoto out_free;\n-\t}\n-\n out_free:\n \trte_kvargs_free(kvlist);\n \treturn ret;\n@@ -696,20 +540,6 @@ RTE_PMD_REGISTER_PARAM_STRING(net_softnic,\n \tPMD_PARAM_FIRMWARE \"=<string> \"\n \tPMD_PARAM_CONN_PORT \"=<uint16> \"\n \tPMD_PARAM_CPU_ID \"=<uint32> \"\n-\tPMD_PARAM_TM_N_QUEUES \"=<uint32> \"\n-\tPMD_PARAM_TM_QSIZE0 \"=<uint32> \"\n-\tPMD_PARAM_TM_QSIZE1 \"=<uint32> \"\n-\tPMD_PARAM_TM_QSIZE2 \"=<uint32> \"\n-\tPMD_PARAM_TM_QSIZE3 \"=<uint32>\"\n-\tPMD_PARAM_TM_QSIZE4 \"=<uint32> \"\n-\tPMD_PARAM_TM_QSIZE5 \"=<uint32> \"\n-\tPMD_PARAM_TM_QSIZE6 \"=<uint32> \"\n-\tPMD_PARAM_TM_QSIZE7 \"=<uint32> \"\n-\tPMD_PARAM_TM_QSIZE8 \"=<uint32> \"\n-\tPMD_PARAM_TM_QSIZE9 \"=<uint32> \"\n-\tPMD_PARAM_TM_QSIZE10 \"=<uint32> \"\n-\tPMD_PARAM_TM_QSIZE11 \"=<uint32>\"\n-\tPMD_PARAM_TM_QSIZE12 \"=<uint32>\"\n );\n \n int\ndiff --git a/drivers/net/softnic/rte_eth_softnic.h b/drivers/net/softnic/rte_eth_softnic.h\nindex 6c11d89ab6..3fd80fa571 100644\n--- a/drivers/net/softnic/rte_eth_softnic.h\n+++ b/drivers/net/softnic/rte_eth_softnic.h\n@@ -46,16 +46,6 @@ extern \"C\" {\n #define SOFTNIC_SC                                         1\n #endif\n \n-/** Traffic Manager: Number of scheduler queues. */\n-#ifndef SOFTNIC_TM_N_QUEUES\n-#define SOFTNIC_TM_N_QUEUES                                (64 * 1024)\n-#endif\n-\n-/** Traffic Manager: Scheduler queue size (per traffic class). */\n-#ifndef SOFTNIC_TM_QUEUE_SIZE\n-#define SOFTNIC_TM_QUEUE_SIZE                              64\n-#endif\n-\n /**\n  * Soft NIC run.\n  *\ndiff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c\nindex 7acbeecae7..7556e50831 100644\n--- a/drivers/net/softnic/rte_eth_softnic_cli.c\n+++ b/drivers/net/softnic/rte_eth_softnic_cli.c\n@@ -186,1270 +186,6 @@ cmd_swq(struct pmd_internals *softnic,\n \t}\n }\n \n-/**\n- * tmgr shaper profile\n- *  id <profile_id>\n- *  rate <tb_rate> size <tb_size>\n- *  adj <packet_length_adjust>\n- */\n-static void\n-cmd_tmgr_shaper_profile(struct pmd_internals *softnic,\n-\tchar **tokens,\n-\tuint32_t n_tokens,\n-\tchar *out,\n-\tsize_t out_size)\n-{\n-\tstruct rte_tm_shaper_params sp;\n-\tstruct rte_tm_error error;\n-\tuint32_t shaper_profile_id;\n-\tuint16_t port_id;\n-\tint status;\n-\n-\tmemset(&sp, 0, sizeof(struct rte_tm_shaper_params));\n-\n-\tif (n_tokens != 11) {\n-\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[1], \"shaper\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"shaper\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[2], \"profile\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"profile\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[3], \"id\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"id\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&shaper_profile_id, tokens[4]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"profile_id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[5], \"rate\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"rate\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint64(&sp.peak.rate, tokens[6]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tb_rate\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[7], \"size\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"size\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint64(&sp.peak.size, tokens[8]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tb_size\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[9], \"adj\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"adj\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_int32(&sp.pkt_length_adjust, tokens[10]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"packet_length_adjust\");\n-\t\treturn;\n-\t}\n-\n-\tstatus = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);\n-\tif (status)\n-\t\treturn;\n-\n-\tstatus = rte_tm_shaper_profile_add(port_id, shaper_profile_id, &sp, &error);\n-\tif (status != 0) {\n-\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n-\t\treturn;\n-\t}\n-}\n-\n-/**\n- * tmgr shared shaper\n- *  id <shared_shaper_id>\n- *  profile <shaper_profile_id>\n- */\n-static void\n-cmd_tmgr_shared_shaper(struct pmd_internals *softnic,\n-\tchar **tokens,\n-\tuint32_t n_tokens,\n-\tchar *out,\n-\tsize_t out_size)\n-{\n-\tstruct rte_tm_error error;\n-\tuint32_t shared_shaper_id, shaper_profile_id;\n-\tuint16_t port_id;\n-\tint status;\n-\n-\tif (n_tokens != 7) {\n-\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[1], \"shared\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"shared\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[2], \"shaper\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"shaper\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[3], \"id\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"id\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&shared_shaper_id, tokens[4]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared_shaper_id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[5], \"profile\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"profile\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&shaper_profile_id, tokens[6]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shaper_profile_id\");\n-\t\treturn;\n-\t}\n-\n-\tstatus = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);\n-\tif (status)\n-\t\treturn;\n-\n-\tstatus = rte_tm_shared_shaper_add_update(port_id,\n-\t\tshared_shaper_id,\n-\t\tshaper_profile_id,\n-\t\t&error);\n-\tif (status != 0) {\n-\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n-\t\treturn;\n-\t}\n-}\n-\n-/**\n- * tmgr node\n- *   id <node_id>\n- *   parent <parent_node_id | none>\n- *   priority <priority>\n- *   weight <weight>\n- *   [shaper profile <shaper_profile_id>]\n- *   [shared shaper <shared_shaper_id>]\n- *   [nonleaf sp <n_sp_priorities>]\n- */\n-static void\n-cmd_tmgr_node(struct pmd_internals *softnic,\n-\tchar **tokens,\n-\tuint32_t n_tokens,\n-\tchar *out,\n-\tsize_t out_size)\n-{\n-\tstruct rte_tm_error error;\n-\tstruct rte_tm_node_params np;\n-\tuint32_t node_id, parent_node_id, priority, weight, shared_shaper_id;\n-\tuint16_t port_id;\n-\tint status;\n-\n-\tmemset(&np, 0, sizeof(struct rte_tm_node_params));\n-\tnp.shaper_profile_id = RTE_TM_SHAPER_PROFILE_ID_NONE;\n-\tnp.nonleaf.n_sp_priorities = 1;\n-\n-\tif (n_tokens < 10) {\n-\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[1], \"node\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"node\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[2], \"id\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"id\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&node_id, tokens[3]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"node_id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[4], \"parent\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"parent\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[5], \"none\") == 0)\n-\t\tparent_node_id = RTE_TM_NODE_ID_NULL;\n-\telse {\n-\t\tif (softnic_parser_read_uint32(&parent_node_id, tokens[5]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"parent_node_id\");\n-\t\t\treturn;\n-\t\t}\n-\t}\n-\n-\tif (strcmp(tokens[6], \"priority\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"priority\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&priority, tokens[7]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"priority\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[8], \"weight\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"weight\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&weight, tokens[9]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"weight\");\n-\t\treturn;\n-\t}\n-\n-\ttokens += 10;\n-\tn_tokens -= 10;\n-\n-\tif (n_tokens >= 2 &&\n-\t\t(strcmp(tokens[0], \"shaper\") == 0) &&\n-\t\t(strcmp(tokens[1], \"profile\") == 0)) {\n-\t\tif (n_tokens < 3) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, \"tmgr node\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tif (strcmp(tokens[2], \"none\") == 0) {\n-\t\t\tnp.shaper_profile_id = RTE_TM_SHAPER_PROFILE_ID_NONE;\n-\t\t} else {\n-\t\t\tif (softnic_parser_read_uint32(&np.shaper_profile_id, tokens[2]) != 0) {\n-\t\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shaper_profile_id\");\n-\t\t\t\treturn;\n-\t\t\t}\n-\t\t}\n-\n-\t\ttokens += 3;\n-\t\tn_tokens -= 3;\n-\t} /* shaper profile */\n-\n-\tif (n_tokens >= 2 &&\n-\t\t(strcmp(tokens[0], \"shared\") == 0) &&\n-\t\t(strcmp(tokens[1], \"shaper\") == 0)) {\n-\t\tif (n_tokens < 3) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, \"tmgr node\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tif (softnic_parser_read_uint32(&shared_shaper_id, tokens[2]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared_shaper_id\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tnp.shared_shaper_id = &shared_shaper_id;\n-\t\tnp.n_shared_shapers = 1;\n-\n-\t\ttokens += 3;\n-\t\tn_tokens -= 3;\n-\t} /* shared shaper */\n-\n-\tif (n_tokens >= 2 &&\n-\t\t(strcmp(tokens[0], \"nonleaf\") == 0) &&\n-\t\t(strcmp(tokens[1], \"sp\") == 0)) {\n-\t\tif (n_tokens < 3) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, \"tmgr node\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tif (softnic_parser_read_uint32(&np.nonleaf.n_sp_priorities, tokens[2]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"n_sp_priorities\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\ttokens += 3;\n-\t\tn_tokens -= 3;\n-\t} /* nonleaf sp <n_sp_priorities> */\n-\n-\tif (n_tokens) {\n-\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n-\t\treturn;\n-\t}\n-\n-\tstatus = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);\n-\tif (status != 0)\n-\t\treturn;\n-\n-\tstatus = rte_tm_node_add(port_id,\n-\t\tnode_id,\n-\t\tparent_node_id,\n-\t\tpriority,\n-\t\tweight,\n-\t\tRTE_TM_NODE_LEVEL_ID_ANY,\n-\t\t&np,\n-\t\t&error);\n-\tif (status != 0) {\n-\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n-\t\treturn;\n-\t}\n-}\n-\n-static uint32_t\n-root_node_id(uint32_t n_spp,\n-\tuint32_t n_pps)\n-{\n-\tuint32_t n_queues = n_spp * n_pps * RTE_SCHED_QUEUES_PER_PIPE;\n-\tuint32_t n_tc = n_spp * n_pps * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE;\n-\tuint32_t n_pipes = n_spp * n_pps;\n-\n-\treturn n_queues + n_tc + n_pipes + n_spp;\n-}\n-\n-static uint32_t\n-subport_node_id(uint32_t n_spp,\n-\tuint32_t n_pps,\n-\tuint32_t subport_id)\n-{\n-\tuint32_t n_pipes = n_spp * n_pps;\n-\tuint32_t n_tc = n_pipes * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE;\n-\tuint32_t n_queues = n_pipes * RTE_SCHED_QUEUES_PER_PIPE;\n-\n-\treturn n_queues + n_tc + n_pipes + subport_id;\n-}\n-\n-static uint32_t\n-pipe_node_id(uint32_t n_spp,\n-\tuint32_t n_pps,\n-\tuint32_t subport_id,\n-\tuint32_t pipe_id)\n-{\n-\tuint32_t n_pipes = n_spp * n_pps;\n-\tuint32_t n_tc = n_pipes * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE;\n-\tuint32_t n_queues = n_pipes * RTE_SCHED_QUEUES_PER_PIPE;\n-\n-\treturn n_queues +\n-\t\tn_tc +\n-\t\tpipe_id +\n-\t\tsubport_id * n_pps;\n-}\n-\n-static uint32_t\n-tc_node_id(uint32_t n_spp,\n-\tuint32_t n_pps,\n-\tuint32_t subport_id,\n-\tuint32_t pipe_id,\n-\tuint32_t tc_id)\n-{\n-\tuint32_t n_pipes = n_spp * n_pps;\n-\tuint32_t n_queues = n_pipes * RTE_SCHED_QUEUES_PER_PIPE;\n-\n-\treturn n_queues +\n-\t\ttc_id +\n-\t\t(pipe_id + subport_id * n_pps) * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE;\n-}\n-\n-static uint32_t\n-queue_node_id(uint32_t n_spp __rte_unused,\n-\tuint32_t n_pps,\n-\tuint32_t subport_id,\n-\tuint32_t pipe_id,\n-\tuint32_t tc_id,\n-\tuint32_t queue_id)\n-{\n-\treturn queue_id + tc_id +\n-\t\t(pipe_id + subport_id * n_pps) * RTE_SCHED_QUEUES_PER_PIPE;\n-}\n-\n-struct tmgr_hierarchy_default_params {\n-\tuint32_t n_spp; /**< Number of subports per port. */\n-\tuint32_t n_pps; /**< Number of pipes per subport. */\n-\n-\tstruct {\n-\t\tuint32_t port;\n-\t\tuint32_t subport;\n-\t\tuint32_t pipe;\n-\t\tuint32_t tc[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];\n-\t} shaper_profile_id;\n-\n-\tstruct {\n-\t\tuint32_t tc[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];\n-\t\tuint32_t tc_valid[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];\n-\t} shared_shaper_id;\n-\n-\tstruct {\n-\t\tuint32_t queue[RTE_SCHED_QUEUES_PER_PIPE];\n-\t} weight;\n-};\n-\n-static int\n-tmgr_hierarchy_default(struct pmd_internals *softnic,\n-\tstruct tmgr_hierarchy_default_params *params)\n-{\n-\tstruct rte_tm_node_params root_node_params = {\n-\t\t.shaper_profile_id = params->shaper_profile_id.port,\n-\t\t.nonleaf = {\n-\t\t\t.n_sp_priorities = 1,\n-\t\t},\n-\t};\n-\n-\tstruct rte_tm_node_params subport_node_params = {\n-\t\t.shaper_profile_id = params->shaper_profile_id.subport,\n-\t\t.nonleaf = {\n-\t\t\t.n_sp_priorities = 1,\n-\t\t},\n-\t};\n-\n-\tstruct rte_tm_node_params pipe_node_params = {\n-\t\t.shaper_profile_id = params->shaper_profile_id.pipe,\n-\t\t.nonleaf = {\n-\t\t\t.n_sp_priorities = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,\n-\t\t},\n-\t};\n-\n-\tuint32_t *shared_shaper_id =\n-\t\t(uint32_t *)calloc(RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,\n-\t\t\tsizeof(uint32_t));\n-\n-\tif (shared_shaper_id == NULL)\n-\t\treturn -1;\n-\n-\tmemcpy(shared_shaper_id, params->shared_shaper_id.tc,\n-\t\tsizeof(params->shared_shaper_id.tc));\n-\n-\tstruct rte_tm_node_params tc_node_params[] = {\n-\t\t[0] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[0],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[0],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[0]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[1] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[1],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[1],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[1]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[2] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[2],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[2],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[2]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[3] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[3],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[3],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[3]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[4] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[4],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[4],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[4]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[5] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[5],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[5],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[5]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[6] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[6],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[6],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[6]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[7] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[7],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[7],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[7]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[8] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[8],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[8],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[8]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[9] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[9],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[9],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[9]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[10] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[10],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[10],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[10]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[11] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[11],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[11],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[11]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\n-\t\t[12] = {\n-\t\t\t.shaper_profile_id = params->shaper_profile_id.tc[12],\n-\t\t\t.shared_shaper_id = &shared_shaper_id[12],\n-\t\t\t.n_shared_shapers =\n-\t\t\t\t(params->shared_shaper_id.tc_valid[12]) ? 1 : 0,\n-\t\t\t.nonleaf = {\n-\t\t\t\t.n_sp_priorities = 1,\n-\t\t\t},\n-\t\t},\n-\t};\n-\n-\tstruct rte_tm_node_params queue_node_params = {\n-\t\t.shaper_profile_id = RTE_TM_SHAPER_PROFILE_ID_NONE,\n-\t};\n-\n-\tstruct rte_tm_error error;\n-\tuint32_t n_spp = params->n_spp, n_pps = params->n_pps, s;\n-\tint status;\n-\tuint16_t port_id;\n-\n-\tstatus = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);\n-\tif (status)\n-\t\treturn -1;\n-\n-\t/* Hierarchy level 0: Root node */\n-\tstatus = rte_tm_node_add(port_id,\n-\t\troot_node_id(n_spp, n_pps),\n-\t\tRTE_TM_NODE_ID_NULL,\n-\t\t0,\n-\t\t1,\n-\t\tRTE_TM_NODE_LEVEL_ID_ANY,\n-\t\t&root_node_params,\n-\t\t&error);\n-\tif (status)\n-\t\treturn -1;\n-\n-\t/* Hierarchy level 1: Subport nodes */\n-\tfor (s = 0; s < params->n_spp; s++) {\n-\t\tuint32_t p;\n-\n-\t\tstatus = rte_tm_node_add(port_id,\n-\t\t\tsubport_node_id(n_spp, n_pps, s),\n-\t\t\troot_node_id(n_spp, n_pps),\n-\t\t\t0,\n-\t\t\t1,\n-\t\t\tRTE_TM_NODE_LEVEL_ID_ANY,\n-\t\t\t&subport_node_params,\n-\t\t\t&error);\n-\t\tif (status)\n-\t\t\treturn -1;\n-\n-\t\t/* Hierarchy level 2: Pipe nodes */\n-\t\tfor (p = 0; p < params->n_pps; p++) {\n-\t\t\tuint32_t t;\n-\n-\t\t\tstatus = rte_tm_node_add(port_id,\n-\t\t\t\tpipe_node_id(n_spp, n_pps, s, p),\n-\t\t\t\tsubport_node_id(n_spp, n_pps, s),\n-\t\t\t\t0,\n-\t\t\t\t1,\n-\t\t\t\tRTE_TM_NODE_LEVEL_ID_ANY,\n-\t\t\t\t&pipe_node_params,\n-\t\t\t\t&error);\n-\t\t\tif (status)\n-\t\t\t\treturn -1;\n-\n-\t\t\t/* Hierarchy level 3: Traffic class nodes */\n-\t\t\tfor (t = 0; t < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; t++) {\n-\t\t\t\tuint32_t q;\n-\n-\t\t\t\tstatus = rte_tm_node_add(port_id,\n-\t\t\t\t\ttc_node_id(n_spp, n_pps, s, p, t),\n-\t\t\t\t\tpipe_node_id(n_spp, n_pps, s, p),\n-\t\t\t\t\tt,\n-\t\t\t\t\t1,\n-\t\t\t\t\tRTE_TM_NODE_LEVEL_ID_ANY,\n-\t\t\t\t\t&tc_node_params[t],\n-\t\t\t\t\t&error);\n-\t\t\t\tif (status)\n-\t\t\t\t\treturn -1;\n-\n-\t\t\t\t/* Hierarchy level 4: Queue nodes */\n-\t\t\t\tif (t < RTE_SCHED_TRAFFIC_CLASS_BE) {\n-\t\t\t\t\t/* Strict-priority traffic class queues */\n-\t\t\t\t\tq = 0;\n-\t\t\t\t\tstatus = rte_tm_node_add(port_id,\n-\t\t\t\t\t\tqueue_node_id(n_spp, n_pps, s, p, t, q),\n-\t\t\t\t\t\ttc_node_id(n_spp, n_pps, s, p, t),\n-\t\t\t\t\t\t0,\n-\t\t\t\t\t\tparams->weight.queue[q],\n-\t\t\t\t\t\tRTE_TM_NODE_LEVEL_ID_ANY,\n-\t\t\t\t\t\t&queue_node_params,\n-\t\t\t\t\t\t&error);\n-\t\t\t\t\tif (status)\n-\t\t\t\t\t\treturn -1;\n-\n-\t\t\t\t\tcontinue;\n-\t\t\t\t}\n-\t\t\t\t/* Best-effort traffic class queues */\n-\t\t\t\tfor (q = 0; q < RTE_SCHED_BE_QUEUES_PER_PIPE; q++) {\n-\t\t\t\t\tstatus = rte_tm_node_add(port_id,\n-\t\t\t\t\t\tqueue_node_id(n_spp, n_pps, s, p, t, q),\n-\t\t\t\t\t\ttc_node_id(n_spp, n_pps, s, p, t),\n-\t\t\t\t\t\t0,\n-\t\t\t\t\t\tparams->weight.queue[q],\n-\t\t\t\t\t\tRTE_TM_NODE_LEVEL_ID_ANY,\n-\t\t\t\t\t\t&queue_node_params,\n-\t\t\t\t\t\t&error);\n-\t\t\t\t\tif (status)\n-\t\t\t\t\t\treturn -1;\n-\t\t\t\t}\n-\t\t\t} /* TC */\n-\t\t} /* Pipe */\n-\t} /* Subport */\n-\n-\treturn 0;\n-}\n-\n-\n-/**\n- * tmgr hierarchy-default\n- *  spp <n_subports_per_port>\n- *  pps <n_pipes_per_subport>\n- *  shaper profile\n- *   port <profile_id>\n- *   subport <profile_id>\n- *   pipe <profile_id>\n- *   tc0 <profile_id>\n- *   tc1 <profile_id>\n- *   tc2 <profile_id>\n- *   tc3 <profile_id>\n- *   tc4 <profile_id>\n- *   tc5 <profile_id>\n- *   tc6 <profile_id>\n- *   tc7 <profile_id>\n- *   tc8 <profile_id>\n- *   tc9 <profile_id>\n- *   tc10 <profile_id>\n- *   tc11 <profile_id>\n- *   tc12 <profile_id>\n- *  shared shaper\n- *   tc0 <id | none>\n- *   tc1 <id | none>\n- *   tc2 <id | none>\n- *   tc3 <id | none>\n- *   tc4 <id | none>\n- *   tc5 <id | none>\n- *   tc6 <id | none>\n- *   tc7 <id | none>\n- *   tc8 <id | none>\n- *   tc9 <id | none>\n- *   tc10 <id | none>\n- *   tc11 <id | none>\n- *   tc12 <id | none>\n- *  weight\n- *   queue  <q12> ... <q15>\n- */\n-static void\n-cmd_tmgr_hierarchy_default(struct pmd_internals *softnic,\n-\tchar **tokens,\n-\tuint32_t n_tokens,\n-\tchar *out,\n-\tsize_t out_size)\n-{\n-\tstruct tmgr_hierarchy_default_params p;\n-\tint i, j, status;\n-\n-\tmemset(&p, 0, sizeof(p));\n-\n-\tif (n_tokens != 74) {\n-\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[1], \"hierarchy-default\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"hierarchy-default\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[2], \"spp\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"spp\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.n_spp, tokens[3]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"n_subports_per_port\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[4], \"pps\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"pps\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.n_pps, tokens[5]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"n_pipes_per_subport\");\n-\t\treturn;\n-\t}\n-\n-\t/* Shaper profile */\n-\n-\tif (strcmp(tokens[6], \"shaper\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"shaper\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[7], \"profile\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"profile\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[8], \"port\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"port\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.port, tokens[9]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"port profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[10], \"subport\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"subport\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.subport, tokens[11]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"subport profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[12], \"pipe\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"pipe\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.pipe, tokens[13]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"pipe_profile_id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[14], \"tc0\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc0\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[0], tokens[15]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc0 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[16], \"tc1\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc1\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[1], tokens[17]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc1 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[18], \"tc2\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc2\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[2], tokens[19]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc2 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[20], \"tc3\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc3\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[3], tokens[21]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc3 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[22], \"tc4\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc4\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[4], tokens[23]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc4 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[24], \"tc5\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc5\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[5], tokens[25]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc5 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[26], \"tc6\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc6\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[6], tokens[27]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc6 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[28], \"tc7\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc7\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[7], tokens[29]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc7 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[30], \"tc8\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc8\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[8], tokens[31]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc8 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[32], \"tc9\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc9\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[9], tokens[33]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc9 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[34], \"tc10\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc10\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[10], tokens[35]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc10 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[36], \"tc11\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc11\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[11], tokens[37]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc11 profile id\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[38], \"tc12\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc12\");\n-\t\treturn;\n-\t}\n-\n-\tif (softnic_parser_read_uint32(&p.shaper_profile_id.tc[12], tokens[39]) != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"tc12 profile id\");\n-\t\treturn;\n-\t}\n-\n-\t/* Shared shaper */\n-\n-\tif (strcmp(tokens[40], \"shared\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"shared\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[41], \"shaper\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"shaper\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[42], \"tc0\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc0\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[43], \"none\") == 0)\n-\t\tp.shared_shaper_id.tc_valid[0] = 0;\n-\telse {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[0],\n-\t\t\ttokens[43]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc0\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[0] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[44], \"tc1\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc1\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[45], \"none\") == 0)\n-\t\tp.shared_shaper_id.tc_valid[1] = 0;\n-\telse {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[1],\n-\t\t\ttokens[45]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc1\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[1] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[46], \"tc2\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc2\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[47], \"none\") == 0)\n-\t\tp.shared_shaper_id.tc_valid[2] = 0;\n-\telse {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[2],\n-\t\t\ttokens[47]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc2\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[2] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[48], \"tc3\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc3\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[49], \"none\") == 0)\n-\t\tp.shared_shaper_id.tc_valid[3] = 0;\n-\telse {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[3],\n-\t\t\ttokens[49]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc3\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[3] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[50], \"tc4\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc4\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[51], \"none\") == 0) {\n-\t\tp.shared_shaper_id.tc_valid[4] = 0;\n-\t} else {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[4],\n-\t\t\ttokens[51]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc4\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[4] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[52], \"tc5\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc5\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[53], \"none\") == 0) {\n-\t\tp.shared_shaper_id.tc_valid[5] = 0;\n-\t} else {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[5],\n-\t\t\ttokens[53]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc5\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[5] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[54], \"tc6\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc6\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[55], \"none\") == 0) {\n-\t\tp.shared_shaper_id.tc_valid[6] = 0;\n-\t} else {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[6],\n-\t\t\ttokens[55]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc6\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[6] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[56], \"tc7\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc7\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[57], \"none\") == 0) {\n-\t\tp.shared_shaper_id.tc_valid[7] = 0;\n-\t} else {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[7],\n-\t\t\ttokens[57]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc7\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[7] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[58], \"tc8\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc8\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[59], \"none\") == 0) {\n-\t\tp.shared_shaper_id.tc_valid[8] = 0;\n-\t} else {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[8],\n-\t\t\ttokens[59]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc8\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[8] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[60], \"tc9\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc9\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[61], \"none\") == 0) {\n-\t\tp.shared_shaper_id.tc_valid[9] = 0;\n-\t} else {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[9],\n-\t\t\ttokens[61]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc9\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[9] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[62], \"tc10\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc10\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[63], \"none\") == 0) {\n-\t\tp.shared_shaper_id.tc_valid[10] = 0;\n-\t} else {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[10],\n-\t\t\ttokens[63]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc10\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[10] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[64], \"tc11\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc11\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[65], \"none\") == 0) {\n-\t\tp.shared_shaper_id.tc_valid[11] = 0;\n-\t} else {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[11],\n-\t\t\ttokens[65]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc11\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[11] = 1;\n-\t}\n-\n-\tif (strcmp(tokens[66], \"tc12\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"tc12\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[67], \"none\") == 0) {\n-\t\tp.shared_shaper_id.tc_valid[12] = 0;\n-\t} else {\n-\t\tif (softnic_parser_read_uint32(&p.shared_shaper_id.tc[12],\n-\t\t\ttokens[67]) != 0) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared shaper tc12\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.shared_shaper_id.tc_valid[12] = 1;\n-\t}\n-\n-\t/* Weight */\n-\n-\tif (strcmp(tokens[68], \"weight\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"weight\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[69], \"queue\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"queue\");\n-\t\treturn;\n-\t}\n-\n-\tfor (i = 0, j = 0; i < 16; i++) {\n-\t\tif (i < RTE_SCHED_TRAFFIC_CLASS_BE) {\n-\t\t\tp.weight.queue[i] = 1;\n-\t\t} else {\n-\t\t\tif (softnic_parser_read_uint32(&p.weight.queue[i],\n-\t\t\t\ttokens[70 + j]) != 0) {\n-\t\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"weight queue\");\n-\t\t\t\treturn;\n-\t\t\t}\n-\t\t\tj++;\n-\t\t}\n-\t}\n-\n-\tstatus = tmgr_hierarchy_default(softnic, &p);\n-\tif (status != 0) {\n-\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n-\t\treturn;\n-\t}\n-}\n-\n-/**\n- * tmgr hierarchy commit\n- */\n-static void\n-cmd_tmgr_hierarchy_commit(struct pmd_internals *softnic,\n-\tchar **tokens,\n-\tuint32_t n_tokens,\n-\tchar *out,\n-\tsize_t out_size)\n-{\n-\tstruct rte_tm_error error;\n-\tuint16_t port_id;\n-\tint status;\n-\n-\tif (n_tokens != 3) {\n-\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[1], \"hierarchy\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"hierarchy\");\n-\t\treturn;\n-\t}\n-\n-\tif (strcmp(tokens[2], \"commit\") != 0) {\n-\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"commit\");\n-\t\treturn;\n-\t}\n-\n-\tstatus = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);\n-\tif (status != 0)\n-\t\treturn;\n-\n-\tstatus = rte_tm_hierarchy_commit(port_id, 1, &error);\n-\tif (status) {\n-\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n-\t\treturn;\n-\t}\n-}\n-\n-/**\n- * tmgr <tmgr_name>\n- */\n-static void\n-cmd_tmgr(struct pmd_internals *softnic,\n-\tchar **tokens,\n-\tuint32_t n_tokens,\n-\tchar *out,\n-\tsize_t out_size)\n-{\n-\tchar *name;\n-\tstruct softnic_tmgr_port *tmgr_port;\n-\n-\tif (n_tokens != 2) {\n-\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n-\t\treturn;\n-\t}\n-\n-\tname = tokens[1];\n-\n-\ttmgr_port = softnic_tmgr_port_create(softnic, name);\n-\tif (tmgr_port == NULL) {\n-\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n-\t\treturn;\n-\t}\n-}\n-\n /**\n  * tap <tap_name>\n  */\n@@ -2247,7 +983,6 @@ cmd_pipeline(struct pmd_internals *softnic,\n  *  bsz <burst_size>\n  *  link <link_name> rxq <queue_id>\n  *  | swq <swq_name>\n- *  | tmgr <tmgr_name>\n  *  | tap <tap_name> mempool <mempool_name> mtu <mtu>\n  *  | source mempool <mempool_name> file <file_name> bpp <n_bytes_per_pkt>\n  *  | cryptodev <cryptodev_name> rxq <queue_id>\n@@ -2331,18 +1066,6 @@ cmd_pipeline_port_in(struct pmd_internals *softnic,\n \n \t\tstrlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name));\n \n-\t\tt0 += 2;\n-\t} else if (strcmp(tokens[t0], \"tmgr\") == 0) {\n-\t\tif (n_tokens < t0 + 2) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH,\n-\t\t\t\t\"pipeline port in tmgr\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.type = PORT_IN_TMGR;\n-\n-\t\tstrlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name));\n-\n \t\tt0 += 2;\n \t} else if (strcmp(tokens[t0], \"tap\") == 0) {\n \t\tif (n_tokens < t0 + 6) {\n@@ -2482,7 +1205,6 @@ cmd_pipeline_port_in(struct pmd_internals *softnic,\n  *  bsz <burst_size>\n  *  link <link_name> txq <txq_id>\n  *  | swq <swq_name>\n- *  | tmgr <tmgr_name>\n  *  | tap <tap_name>\n  *  | sink [file <file_name> pkts <max_n_pkts>]\n  *  | cryptodev <cryptodev_name> txq <txq_id> offset <crypto_op_offset>\n@@ -2557,16 +1279,6 @@ cmd_pipeline_port_out(struct pmd_internals *softnic,\n \n \t\tp.type = PORT_OUT_SWQ;\n \n-\t\tstrlcpy(p.dev_name, tokens[7], sizeof(p.dev_name));\n-\t} else if (strcmp(tokens[6], \"tmgr\") == 0) {\n-\t\tif (n_tokens != 8) {\n-\t\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH,\n-\t\t\t\t\"pipeline port out tmgr\");\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tp.type = PORT_OUT_TMGR;\n-\n \t\tstrlcpy(p.dev_name, tokens[7], sizeof(p.dev_name));\n \t} else if (strcmp(tokens[6], \"tap\") == 0) {\n \t\tif (n_tokens != 8) {\n@@ -6129,46 +4841,6 @@ softnic_cli_process(char *in, char *out, size_t out_size, void *arg)\n \t\treturn;\n \t}\n \n-\tif (strcmp(tokens[0], \"tmgr\") == 0) {\n-\t\tif (n_tokens == 2) {\n-\t\t\tcmd_tmgr(softnic, tokens, n_tokens, out, out_size);\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tif (n_tokens >= 3 &&\n-\t\t\t(strcmp(tokens[1], \"shaper\") == 0) &&\n-\t\t\t(strcmp(tokens[2], \"profile\") == 0)) {\n-\t\t\tcmd_tmgr_shaper_profile(softnic, tokens, n_tokens, out, out_size);\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tif (n_tokens >= 3 &&\n-\t\t\t(strcmp(tokens[1], \"shared\") == 0) &&\n-\t\t\t(strcmp(tokens[2], \"shaper\") == 0)) {\n-\t\t\tcmd_tmgr_shared_shaper(softnic, tokens, n_tokens, out, out_size);\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tif (n_tokens >= 2 &&\n-\t\t\t(strcmp(tokens[1], \"node\") == 0)) {\n-\t\t\tcmd_tmgr_node(softnic, tokens, n_tokens, out, out_size);\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tif (n_tokens >= 2 &&\n-\t\t\t(strcmp(tokens[1], \"hierarchy-default\") == 0)) {\n-\t\t\tcmd_tmgr_hierarchy_default(softnic, tokens, n_tokens, out, out_size);\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tif (n_tokens >= 3 &&\n-\t\t\t(strcmp(tokens[1], \"hierarchy\") == 0) &&\n-\t\t\t(strcmp(tokens[2], \"commit\") == 0)) {\n-\t\t\tcmd_tmgr_hierarchy_commit(softnic, tokens, n_tokens, out, out_size);\n-\t\t\treturn;\n-\t\t}\n-\t}\n-\n \tif (strcmp(tokens[0], \"tap\") == 0) {\n \t\tcmd_tap(softnic, tokens, n_tokens, out, out_size);\n \t\treturn;\ndiff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h\nindex 07285ca315..4cc98b7aad 100644\n--- a/drivers/net/softnic/rte_eth_softnic_internals.h\n+++ b/drivers/net/softnic/rte_eth_softnic_internals.h\n@@ -13,14 +13,12 @@\n #include <rte_mbuf.h>\n #include <rte_ring.h>\n #include <rte_ethdev.h>\n-#include <rte_sched.h>\n #include <rte_port_in_action.h>\n #include <rte_table_action.h>\n #include <rte_pipeline.h>\n \n #include <rte_ethdev_core.h>\n #include <ethdev_driver.h>\n-#include <rte_tm_driver.h>\n #include <rte_flow_driver.h>\n #include <rte_mtr_driver.h>\n \n@@ -40,12 +38,6 @@ struct pmd_params {\n \tuint16_t conn_port;\n \tuint32_t cpu_id;\n \tint sc; /**< Service cores. */\n-\n-\t/** Traffic Management (TM) */\n-\tstruct {\n-\t\tuint32_t n_queues; /**< Number of queues */\n-\t\tuint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];\n-\t} tm;\n };\n \n /**\n@@ -161,134 +153,6 @@ struct softnic_link {\n \n TAILQ_HEAD(softnic_link_list, softnic_link);\n \n-/**\n- * TMGR\n- */\n-\n-#ifndef TM_MAX_SUBPORTS\n-#define TM_MAX_SUBPORTS\t\t\t\t\t8\n-#endif\n-\n-#ifndef TM_MAX_PIPES_PER_SUBPORT\n-#define TM_MAX_PIPES_PER_SUBPORT\t\t\t4096\n-#endif\n-\n-#ifndef TM_MAX_PIPE_PROFILE\n-#define TM_MAX_PIPE_PROFILE\t\t\t\t256\n-#endif\n-\n-#ifndef TM_MAX_SUBPORT_PROFILE\n-#define TM_MAX_SUBPORT_PROFILE\t\t\t\t256\n-#endif\n-\n-struct tm_params {\n-\tstruct rte_sched_port_params port_params;\n-\tstruct rte_sched_subport_params subport_params[TM_MAX_SUBPORTS];\n-\tstruct rte_sched_subport_profile_params\n-\t\tsubport_profile[TM_MAX_SUBPORT_PROFILE];\n-\tuint32_t n_subport_profiles;\n-\tuint32_t subport_to_profile[TM_MAX_SUBPORT_PROFILE];\n-\tstruct rte_sched_pipe_params pipe_profiles[TM_MAX_PIPE_PROFILE];\n-\tuint32_t n_pipe_profiles;\n-\tuint32_t pipe_to_profile[TM_MAX_SUBPORTS * TM_MAX_PIPES_PER_SUBPORT];\n-};\n-\n-/* TM Levels */\n-enum tm_node_level {\n-\tTM_NODE_LEVEL_PORT = 0,\n-\tTM_NODE_LEVEL_SUBPORT,\n-\tTM_NODE_LEVEL_PIPE,\n-\tTM_NODE_LEVEL_TC,\n-\tTM_NODE_LEVEL_QUEUE,\n-\tTM_NODE_LEVEL_MAX,\n-};\n-\n-/* TM Shaper Profile */\n-struct tm_shaper_profile {\n-\tTAILQ_ENTRY(tm_shaper_profile) node;\n-\tuint32_t shaper_profile_id;\n-\tuint32_t n_users;\n-\tstruct rte_tm_shaper_params params;\n-};\n-\n-TAILQ_HEAD(tm_shaper_profile_list, tm_shaper_profile);\n-\n-/* TM Shared Shaper */\n-struct tm_shared_shaper {\n-\tTAILQ_ENTRY(tm_shared_shaper) node;\n-\tuint32_t shared_shaper_id;\n-\tuint32_t n_users;\n-\tuint32_t shaper_profile_id;\n-};\n-\n-TAILQ_HEAD(tm_shared_shaper_list, tm_shared_shaper);\n-\n-/* TM WRED Profile */\n-struct tm_wred_profile {\n-\tTAILQ_ENTRY(tm_wred_profile) node;\n-\tuint32_t wred_profile_id;\n-\tuint32_t n_users;\n-\tstruct rte_tm_wred_params params;\n-};\n-\n-TAILQ_HEAD(tm_wred_profile_list, tm_wred_profile);\n-\n-/* TM Node */\n-struct tm_node {\n-\tTAILQ_ENTRY(tm_node) node;\n-\tuint32_t node_id;\n-\tuint32_t parent_node_id;\n-\tuint32_t priority;\n-\tuint32_t weight;\n-\tuint32_t level;\n-\tstruct tm_node *parent_node;\n-\tstruct tm_shaper_profile *shaper_profile;\n-\tstruct tm_wred_profile *wred_profile;\n-\tstruct rte_tm_node_params params;\n-\tstruct rte_tm_node_stats stats;\n-\tuint32_t n_children;\n-};\n-\n-TAILQ_HEAD(tm_node_list, tm_node);\n-\n-/* TM Hierarchy Specification */\n-struct tm_hierarchy {\n-\tstruct tm_shaper_profile_list shaper_profiles;\n-\tstruct tm_shared_shaper_list shared_shapers;\n-\tstruct tm_wred_profile_list wred_profiles;\n-\tstruct tm_node_list nodes;\n-\n-\tuint32_t n_shaper_profiles;\n-\tuint32_t n_shared_shapers;\n-\tuint32_t n_wred_profiles;\n-\tuint32_t n_nodes;\n-\n-\tuint32_t n_tm_nodes[TM_NODE_LEVEL_MAX];\n-};\n-\n-struct tm_internals {\n-\t/** Hierarchy specification\n-\t *\n-\t *     -Hierarchy is unfrozen at init and when port is stopped.\n-\t *     -Hierarchy is frozen on successful hierarchy commit.\n-\t *     -Run-time hierarchy changes are not allowed, therefore it makes\n-\t *      sense to keep the hierarchy frozen after the port is started.\n-\t */\n-\tstruct tm_hierarchy h;\n-\tint hierarchy_frozen;\n-\n-\t/** Blueprints */\n-\tstruct tm_params params;\n-};\n-\n-struct softnic_tmgr_port {\n-\tTAILQ_ENTRY(softnic_tmgr_port) node;\n-\tchar name[NAME_SIZE];\n-\tstruct rte_sched_port *s;\n-};\n-\n-TAILQ_HEAD(softnic_tmgr_port_list, softnic_tmgr_port);\n-\n /**\n  * TAP\n  */\n@@ -385,7 +249,6 @@ struct pipeline_params {\n enum softnic_port_in_type {\n \tPORT_IN_RXQ,\n \tPORT_IN_SWQ,\n-\tPORT_IN_TMGR,\n \tPORT_IN_TAP,\n \tPORT_IN_SOURCE,\n \tPORT_IN_CRYPTODEV,\n@@ -426,7 +289,6 @@ struct softnic_port_in_params {\n enum softnic_port_out_type {\n \tPORT_OUT_TXQ,\n \tPORT_OUT_SWQ,\n-\tPORT_OUT_TMGR,\n \tPORT_OUT_TAP,\n \tPORT_OUT_SINK,\n \tPORT_OUT_CRYPTODEV,\n@@ -619,10 +481,6 @@ struct pmd_internals {\n \t/** Params */\n \tstruct pmd_params params;\n \n-\tstruct {\n-\t\tstruct tm_internals tm; /**< Traffic Management */\n-\t} soft;\n-\n \tstruct flow_internals flow;\n \tstruct mtr_internals mtr;\n \n@@ -630,7 +488,6 @@ struct pmd_internals {\n \tstruct softnic_mempool_list mempool_list;\n \tstruct softnic_swq_list swq_list;\n \tstruct softnic_link_list link_list;\n-\tstruct softnic_tmgr_port_list tmgr_port_list;\n \tstruct softnic_tap_list tap_list;\n \tstruct softnic_cryptodev_list cryptodev_list;\n \tstruct softnic_port_in_action_profile_list port_in_action_profile_list;\n@@ -753,39 +610,6 @@ softnic_link_create(struct pmd_internals *p,\n \tconst char *name,\n \tstruct softnic_link_params *params);\n \n-/**\n- * TMGR\n- */\n-int\n-softnic_tmgr_init(struct pmd_internals *p);\n-\n-void\n-softnic_tmgr_free(struct pmd_internals *p);\n-\n-struct softnic_tmgr_port *\n-softnic_tmgr_port_find(struct pmd_internals *p,\n-\tconst char *name);\n-\n-struct softnic_tmgr_port *\n-softnic_tmgr_port_create(struct pmd_internals *p,\n-\tconst char *name);\n-\n-void\n-tm_hierarchy_init(struct pmd_internals *p);\n-\n-void\n-tm_hierarchy_free(struct pmd_internals *p);\n-\n-static inline int\n-tm_used(struct rte_eth_dev *dev)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\n-\treturn p->soft.tm.h.n_tm_nodes[TM_NODE_LEVEL_PORT];\n-}\n-\n-extern const struct rte_tm_ops pmd_tm_ops;\n-\n /**\n  * TAP\n  */\ndiff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c\nindex 337aa32e57..c7d2a7de19 100644\n--- a/drivers/net/softnic/rte_eth_softnic_pipeline.c\n+++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c\n@@ -305,21 +305,6 @@ softnic_pipeline_port_in_create(struct pmd_internals *softnic,\n \t\tbreak;\n \t}\n \n-\tcase PORT_IN_TMGR:\n-\t{\n-\t\tstruct softnic_tmgr_port *tmgr_port;\n-\n-\t\ttmgr_port = softnic_tmgr_port_find(softnic, params->dev_name);\n-\t\tif (tmgr_port == NULL)\n-\t\t\treturn -1;\n-\n-\t\tpp.sched.sched = tmgr_port->s;\n-\n-\t\tp.ops = &rte_port_sched_reader_ops;\n-\t\tp.arg_create = &pp.sched;\n-\t\tbreak;\n-\t}\n-\n \tcase PORT_IN_TAP:\n \t{\n \t\tstruct softnic_tap *tap;\n@@ -545,22 +530,6 @@ softnic_pipeline_port_out_create(struct pmd_internals *softnic,\n \t\tbreak;\n \t}\n \n-\tcase PORT_OUT_TMGR:\n-\t{\n-\t\tstruct softnic_tmgr_port *tmgr_port;\n-\n-\t\ttmgr_port = softnic_tmgr_port_find(softnic, params->dev_name);\n-\t\tif (tmgr_port == NULL)\n-\t\t\treturn -1;\n-\n-\t\tpp.sched.sched = tmgr_port->s;\n-\t\tpp.sched.tx_burst_sz = params->burst_size;\n-\n-\t\tp.ops = &rte_port_sched_writer_ops;\n-\t\tp.arg_create = &pp.sched;\n-\t\tbreak;\n-\t}\n-\n \tcase PORT_OUT_TAP:\n \t{\n \t\tstruct softnic_tap *tap;\ndiff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c\ndeleted file mode 100644\nindex 6a7766ba1c..0000000000\n--- a/drivers/net/softnic/rte_eth_softnic_tm.c\n+++ /dev/null\n@@ -1,3657 +0,0 @@\n-/* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2017 Intel Corporation\n- */\n-\n-#include <stdint.h>\n-#include <stdlib.h>\n-#include <string.h>\n-\n-#include <rte_malloc.h>\n-#include <rte_string_fns.h>\n-\n-#include \"rte_eth_softnic_internals.h\"\n-#include \"rte_eth_softnic.h\"\n-\n-#define SUBPORT_TC_PERIOD\t10\n-#define PIPE_TC_PERIOD\t\t40\n-\n-int\n-softnic_tmgr_init(struct pmd_internals *p)\n-{\n-\tTAILQ_INIT(&p->tmgr_port_list);\n-\n-\treturn 0;\n-}\n-\n-void\n-softnic_tmgr_free(struct pmd_internals *p)\n-{\n-\tfor ( ; ; ) {\n-\t\tstruct softnic_tmgr_port *tmgr_port;\n-\n-\t\ttmgr_port = TAILQ_FIRST(&p->tmgr_port_list);\n-\t\tif (tmgr_port == NULL)\n-\t\t\tbreak;\n-\n-\t\tTAILQ_REMOVE(&p->tmgr_port_list, tmgr_port, node);\n-\t\trte_sched_port_free(tmgr_port->s);\n-\t\tfree(tmgr_port);\n-\t}\n-}\n-\n-struct softnic_tmgr_port *\n-softnic_tmgr_port_find(struct pmd_internals *p,\n-\tconst char *name)\n-{\n-\tstruct softnic_tmgr_port *tmgr_port;\n-\n-\tif (name == NULL)\n-\t\treturn NULL;\n-\n-\tTAILQ_FOREACH(tmgr_port, &p->tmgr_port_list, node)\n-\t\tif (strcmp(tmgr_port->name, name) == 0)\n-\t\t\treturn tmgr_port;\n-\n-\treturn NULL;\n-}\n-\n-struct softnic_tmgr_port *\n-softnic_tmgr_port_create(struct pmd_internals *p,\n-\tconst char *name)\n-{\n-\tstruct softnic_tmgr_port *tmgr_port;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\tstruct rte_sched_port *sched;\n-\tuint32_t n_subports, subport_id;\n-\n-\t/* Check input params */\n-\tif (name == NULL ||\n-\t\tsoftnic_tmgr_port_find(p, name))\n-\t\treturn NULL;\n-\n-\t/*\n-\t * Resource\n-\t */\n-\n-\t/* Is hierarchy frozen? */\n-\tif (p->soft.tm.hierarchy_frozen == 0)\n-\t\treturn NULL;\n-\n-\t/* Port */\n-\tsched = rte_sched_port_config(&t->port_params);\n-\tif (sched == NULL)\n-\t\treturn NULL;\n-\n-\t/* Subport */\n-\tn_subports = t->port_params.n_subports_per_port;\n-\tfor (subport_id = 0; subport_id < n_subports; subport_id++) {\n-\t\tuint32_t n_pipes_per_subport =\n-\t\tt->subport_params[subport_id].n_pipes_per_subport_enabled;\n-\t\tuint32_t pipe_id;\n-\t\tint status;\n-\n-\t\tstatus = rte_sched_subport_config(sched,\n-\t\t\tsubport_id,\n-\t\t\t&t->subport_params[subport_id],\n-\t\t\tt->subport_to_profile[subport_id]);\n-\t\tif (status) {\n-\t\t\trte_sched_port_free(sched);\n-\t\t\treturn NULL;\n-\t\t}\n-\n-\t\t/* Pipe */\n-\t\tfor (pipe_id = 0; pipe_id < n_pipes_per_subport; pipe_id++) {\n-\t\t\tint pos = subport_id * TM_MAX_PIPES_PER_SUBPORT + pipe_id;\n-\t\t\tint profile_id = t->pipe_to_profile[pos];\n-\n-\t\t\tif (profile_id < 0)\n-\t\t\t\tcontinue;\n-\n-\t\t\tstatus = rte_sched_pipe_config(sched,\n-\t\t\t\tsubport_id,\n-\t\t\t\tpipe_id,\n-\t\t\t\tprofile_id);\n-\t\t\tif (status) {\n-\t\t\t\trte_sched_port_free(sched);\n-\t\t\t\treturn NULL;\n-\t\t\t}\n-\t\t}\n-\t}\n-\n-\t/* Node allocation */\n-\ttmgr_port = calloc(1, sizeof(struct softnic_tmgr_port));\n-\tif (tmgr_port == NULL) {\n-\t\trte_sched_port_free(sched);\n-\t\treturn NULL;\n-\t}\n-\n-\t/* Node fill in */\n-\tstrlcpy(tmgr_port->name, name, sizeof(tmgr_port->name));\n-\ttmgr_port->s = sched;\n-\n-\t/* Node add to list */\n-\tTAILQ_INSERT_TAIL(&p->tmgr_port_list, tmgr_port, node);\n-\n-\treturn tmgr_port;\n-}\n-\n-static struct rte_sched_port *\n-SCHED(struct pmd_internals *p)\n-{\n-\tstruct softnic_tmgr_port *tmgr_port;\n-\n-\ttmgr_port = softnic_tmgr_port_find(p, \"TMGR\");\n-\tif (tmgr_port == NULL)\n-\t\treturn NULL;\n-\n-\treturn tmgr_port->s;\n-}\n-\n-void\n-tm_hierarchy_init(struct pmd_internals *p)\n-{\n-\tmemset(&p->soft.tm, 0, sizeof(p->soft.tm));\n-\n-\t/* Initialize shaper profile list */\n-\tTAILQ_INIT(&p->soft.tm.h.shaper_profiles);\n-\n-\t/* Initialize shared shaper list */\n-\tTAILQ_INIT(&p->soft.tm.h.shared_shapers);\n-\n-\t/* Initialize wred profile list */\n-\tTAILQ_INIT(&p->soft.tm.h.wred_profiles);\n-\n-\t/* Initialize TM node list */\n-\tTAILQ_INIT(&p->soft.tm.h.nodes);\n-}\n-\n-void\n-tm_hierarchy_free(struct pmd_internals *p)\n-{\n-\t/* Remove all nodes*/\n-\tfor ( ; ; ) {\n-\t\tstruct tm_node *tm_node;\n-\n-\t\ttm_node = TAILQ_FIRST(&p->soft.tm.h.nodes);\n-\t\tif (tm_node == NULL)\n-\t\t\tbreak;\n-\n-\t\tTAILQ_REMOVE(&p->soft.tm.h.nodes, tm_node, node);\n-\t\tfree(tm_node);\n-\t}\n-\n-\t/* Remove all WRED profiles */\n-\tfor ( ; ; ) {\n-\t\tstruct tm_wred_profile *wred_profile;\n-\n-\t\twred_profile = TAILQ_FIRST(&p->soft.tm.h.wred_profiles);\n-\t\tif (wred_profile == NULL)\n-\t\t\tbreak;\n-\n-\t\tTAILQ_REMOVE(&p->soft.tm.h.wred_profiles, wred_profile, node);\n-\t\tfree(wred_profile);\n-\t}\n-\n-\t/* Remove all shared shapers */\n-\tfor ( ; ; ) {\n-\t\tstruct tm_shared_shaper *shared_shaper;\n-\n-\t\tshared_shaper = TAILQ_FIRST(&p->soft.tm.h.shared_shapers);\n-\t\tif (shared_shaper == NULL)\n-\t\t\tbreak;\n-\n-\t\tTAILQ_REMOVE(&p->soft.tm.h.shared_shapers, shared_shaper, node);\n-\t\tfree(shared_shaper);\n-\t}\n-\n-\t/* Remove all shaper profiles */\n-\tfor ( ; ; ) {\n-\t\tstruct tm_shaper_profile *shaper_profile;\n-\n-\t\tshaper_profile = TAILQ_FIRST(&p->soft.tm.h.shaper_profiles);\n-\t\tif (shaper_profile == NULL)\n-\t\t\tbreak;\n-\n-\t\tTAILQ_REMOVE(&p->soft.tm.h.shaper_profiles,\n-\t\t\tshaper_profile, node);\n-\t\tfree(shaper_profile);\n-\t}\n-\n-\ttm_hierarchy_init(p);\n-}\n-\n-static struct tm_shaper_profile *\n-tm_shaper_profile_search(struct rte_eth_dev *dev, uint32_t shaper_profile_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_shaper_profile_list *spl = &p->soft.tm.h.shaper_profiles;\n-\tstruct tm_shaper_profile *sp;\n-\n-\tTAILQ_FOREACH(sp, spl, node)\n-\t\tif (shaper_profile_id == sp->shaper_profile_id)\n-\t\t\treturn sp;\n-\n-\treturn NULL;\n-}\n-\n-static struct tm_shared_shaper *\n-tm_shared_shaper_search(struct rte_eth_dev *dev, uint32_t shared_shaper_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_shared_shaper_list *ssl = &p->soft.tm.h.shared_shapers;\n-\tstruct tm_shared_shaper *ss;\n-\n-\tTAILQ_FOREACH(ss, ssl, node)\n-\t\tif (shared_shaper_id == ss->shared_shaper_id)\n-\t\t\treturn ss;\n-\n-\treturn NULL;\n-}\n-\n-static struct tm_wred_profile *\n-tm_wred_profile_search(struct rte_eth_dev *dev, uint32_t wred_profile_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_wred_profile_list *wpl = &p->soft.tm.h.wred_profiles;\n-\tstruct tm_wred_profile *wp;\n-\n-\tTAILQ_FOREACH(wp, wpl, node)\n-\t\tif (wred_profile_id == wp->wred_profile_id)\n-\t\t\treturn wp;\n-\n-\treturn NULL;\n-}\n-\n-static struct tm_node *\n-tm_node_search(struct rte_eth_dev *dev, uint32_t node_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_node_list *nl = &p->soft.tm.h.nodes;\n-\tstruct tm_node *n;\n-\n-\tTAILQ_FOREACH(n, nl, node)\n-\t\tif (n->node_id == node_id)\n-\t\t\treturn n;\n-\n-\treturn NULL;\n-}\n-\n-static struct tm_node *\n-tm_root_node_present(struct rte_eth_dev *dev)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_node_list *nl = &p->soft.tm.h.nodes;\n-\tstruct tm_node *n;\n-\n-\tTAILQ_FOREACH(n, nl, node)\n-\t\tif (n->parent_node_id == RTE_TM_NODE_ID_NULL)\n-\t\t\treturn n;\n-\n-\treturn NULL;\n-}\n-\n-static uint32_t\n-tm_node_subport_id(struct rte_eth_dev *dev, struct tm_node *subport_node)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_node_list *nl = &p->soft.tm.h.nodes;\n-\tstruct tm_node *ns;\n-\tuint32_t subport_id;\n-\n-\tsubport_id = 0;\n-\tTAILQ_FOREACH(ns, nl, node) {\n-\t\tif (ns->level != TM_NODE_LEVEL_SUBPORT)\n-\t\t\tcontinue;\n-\n-\t\tif (ns->node_id == subport_node->node_id)\n-\t\t\treturn subport_id;\n-\n-\t\tsubport_id++;\n-\t}\n-\n-\treturn UINT32_MAX;\n-}\n-\n-static uint32_t\n-tm_node_pipe_id(struct rte_eth_dev *dev, struct tm_node *pipe_node)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_node_list *nl = &p->soft.tm.h.nodes;\n-\tstruct tm_node *np;\n-\tuint32_t pipe_id;\n-\n-\tpipe_id = 0;\n-\tTAILQ_FOREACH(np, nl, node) {\n-\t\tif (np->level != TM_NODE_LEVEL_PIPE ||\n-\t\t\tnp->parent_node_id != pipe_node->parent_node_id)\n-\t\t\tcontinue;\n-\n-\t\tif (np->node_id == pipe_node->node_id)\n-\t\t\treturn pipe_id;\n-\n-\t\tpipe_id++;\n-\t}\n-\n-\treturn UINT32_MAX;\n-}\n-\n-static uint32_t\n-tm_node_tc_id(struct rte_eth_dev *dev __rte_unused, struct tm_node *tc_node)\n-{\n-\treturn tc_node->priority;\n-}\n-\n-static uint32_t\n-tm_node_queue_id(struct rte_eth_dev *dev, struct tm_node *queue_node)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_node_list *nl = &p->soft.tm.h.nodes;\n-\tstruct tm_node *nq;\n-\tuint32_t queue_id;\n-\n-\tqueue_id = 0;\n-\tTAILQ_FOREACH(nq, nl, node) {\n-\t\tif (nq->level != TM_NODE_LEVEL_QUEUE ||\n-\t\t\tnq->parent_node_id != queue_node->parent_node_id)\n-\t\t\tcontinue;\n-\n-\t\tif (nq->node_id == queue_node->node_id)\n-\t\t\treturn queue_id;\n-\n-\t\tqueue_id++;\n-\t}\n-\n-\treturn UINT32_MAX;\n-}\n-\n-static uint32_t\n-tm_level_get_max_nodes(struct rte_eth_dev *dev, enum tm_node_level level)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tuint32_t n_queues_max = p->params.tm.n_queues;\n-\tuint32_t n_tc_max =\n-\t\t(n_queues_max * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE)\n-\t\t/ RTE_SCHED_QUEUES_PER_PIPE;\n-\tuint32_t n_pipes_max = n_tc_max / RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE;\n-\tuint32_t n_subports_max = n_pipes_max;\n-\tuint32_t n_root_max = 1;\n-\n-\tswitch (level) {\n-\tcase TM_NODE_LEVEL_PORT:\n-\t\treturn n_root_max;\n-\tcase TM_NODE_LEVEL_SUBPORT:\n-\t\treturn n_subports_max;\n-\tcase TM_NODE_LEVEL_PIPE:\n-\t\treturn n_pipes_max;\n-\tcase TM_NODE_LEVEL_TC:\n-\t\treturn n_tc_max;\n-\tcase TM_NODE_LEVEL_QUEUE:\n-\tdefault:\n-\t\treturn n_queues_max;\n-\t}\n-}\n-\n-/* Traffic manager node type get */\n-static int\n-pmd_tm_node_type_get(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tint *is_leaf,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\n-\tif (is_leaf == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t   EINVAL,\n-\t\t   RTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t   NULL,\n-\t\t   rte_strerror(EINVAL));\n-\n-\tif (node_id == RTE_TM_NODE_ID_NULL ||\n-\t\t(tm_node_search(dev, node_id) == NULL))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t   EINVAL,\n-\t\t   RTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t   NULL,\n-\t\t   rte_strerror(EINVAL));\n-\n-\t*is_leaf = node_id < p->params.tm.n_queues;\n-\n-\treturn 0;\n-}\n-\n-#ifdef RTE_SCHED_CMAN\n-#define WRED_SUPPORTED\t\t\t\t\t\t1\n-#else\n-#define WRED_SUPPORTED\t\t\t\t\t\t0\n-#endif\n-\n-#define STATS_MASK_DEFAULT\t\t\t\t\t\\\n-\t(RTE_TM_STATS_N_PKTS |\t\t\t\t\t\\\n-\tRTE_TM_STATS_N_BYTES |\t\t\t\t\t\\\n-\tRTE_TM_STATS_N_PKTS_GREEN_DROPPED |\t\t\t\\\n-\tRTE_TM_STATS_N_BYTES_GREEN_DROPPED)\n-\n-#define STATS_MASK_QUEUE\t\t\t\t\t\t\\\n-\t(STATS_MASK_DEFAULT |\t\t\t\t\t\\\n-\tRTE_TM_STATS_N_PKTS_QUEUED)\n-\n-static const struct rte_tm_capabilities tm_cap = {\n-\t.n_nodes_max = UINT32_MAX,\n-\t.n_levels_max = TM_NODE_LEVEL_MAX,\n-\n-\t.non_leaf_nodes_identical = 0,\n-\t.leaf_nodes_identical = 1,\n-\n-\t.shaper_n_max = UINT32_MAX,\n-\t.shaper_private_n_max = UINT32_MAX,\n-\t.shaper_private_dual_rate_n_max = 0,\n-\t.shaper_private_rate_min = 1,\n-\t.shaper_private_rate_max = UINT32_MAX,\n-\t.shaper_private_packet_mode_supported = 0,\n-\t.shaper_private_byte_mode_supported = 1,\n-\n-\t.shaper_shared_n_max = UINT32_MAX,\n-\t.shaper_shared_n_nodes_per_shaper_max = UINT32_MAX,\n-\t.shaper_shared_n_shapers_per_node_max = 1,\n-\t.shaper_shared_dual_rate_n_max = 0,\n-\t.shaper_shared_rate_min = 1,\n-\t.shaper_shared_rate_max = UINT32_MAX,\n-\t.shaper_shared_packet_mode_supported = 0,\n-\t.shaper_shared_byte_mode_supported = 1,\n-\n-\t.shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,\n-\t.shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,\n-\n-\t.sched_n_children_max = UINT32_MAX,\n-\t.sched_sp_n_priorities_max = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,\n-\t.sched_wfq_n_children_per_group_max = UINT32_MAX,\n-\t.sched_wfq_n_groups_max = 1,\n-\t.sched_wfq_weight_max = UINT32_MAX,\n-\t.sched_wfq_packet_mode_supported = 0,\n-\t.sched_wfq_byte_mode_supported = 1,\n-\n-\t.cman_wred_packet_mode_supported = WRED_SUPPORTED,\n-\t.cman_wred_byte_mode_supported = 0,\n-\t.cman_head_drop_supported = 0,\n-\t.cman_wred_context_n_max = 0,\n-\t.cman_wred_context_private_n_max = 0,\n-\t.cman_wred_context_shared_n_max = 0,\n-\t.cman_wred_context_shared_n_nodes_per_context_max = 0,\n-\t.cman_wred_context_shared_n_contexts_per_node_max = 0,\n-\n-\t.mark_vlan_dei_supported = {0, 0, 0},\n-\t.mark_ip_ecn_tcp_supported = {0, 0, 0},\n-\t.mark_ip_ecn_sctp_supported = {0, 0, 0},\n-\t.mark_ip_dscp_supported = {0, 0, 0},\n-\n-\t.dynamic_update_mask = 0,\n-\n-\t.stats_mask = STATS_MASK_QUEUE,\n-};\n-\n-/* Traffic manager capabilities get */\n-static int\n-pmd_tm_capabilities_get(struct rte_eth_dev *dev __rte_unused,\n-\tstruct rte_tm_capabilities *cap,\n-\tstruct rte_tm_error *error)\n-{\n-\tif (cap == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t   EINVAL,\n-\t\t   RTE_TM_ERROR_TYPE_CAPABILITIES,\n-\t\t   NULL,\n-\t\t   rte_strerror(EINVAL));\n-\n-\tmemcpy(cap, &tm_cap, sizeof(*cap));\n-\n-\tcap->n_nodes_max = tm_level_get_max_nodes(dev, TM_NODE_LEVEL_PORT) +\n-\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_SUBPORT) +\n-\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_PIPE) +\n-\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_TC) +\n-\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_QUEUE);\n-\n-\tcap->shaper_private_n_max =\n-\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_PORT) +\n-\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_SUBPORT) +\n-\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_PIPE) +\n-\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_TC);\n-\n-\tcap->shaper_shared_n_max = RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE *\n-\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_SUBPORT);\n-\n-\tcap->shaper_n_max = cap->shaper_private_n_max +\n-\t\tcap->shaper_shared_n_max;\n-\n-\tcap->shaper_shared_n_nodes_per_shaper_max =\n-\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_PIPE);\n-\n-\tcap->sched_n_children_max = RTE_MAX(\n-\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_PIPE),\n-\t\t(uint32_t)RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE);\n-\n-\tcap->sched_wfq_n_children_per_group_max = cap->sched_n_children_max;\n-\n-\tif (WRED_SUPPORTED)\n-\t\tcap->cman_wred_context_private_n_max =\n-\t\t\ttm_level_get_max_nodes(dev, TM_NODE_LEVEL_QUEUE);\n-\n-\tcap->cman_wred_context_n_max = cap->cman_wred_context_private_n_max +\n-\t\tcap->cman_wred_context_shared_n_max;\n-\n-\treturn 0;\n-}\n-\n-static const struct rte_tm_level_capabilities tm_level_cap[] = {\n-\t[TM_NODE_LEVEL_PORT] = {\n-\t\t.n_nodes_max = 1,\n-\t\t.n_nodes_nonleaf_max = 1,\n-\t\t.n_nodes_leaf_max = 0,\n-\t\t.non_leaf_nodes_identical = 1,\n-\t\t.leaf_nodes_identical = 0,\n-\n-\t\t{.nonleaf = {\n-\t\t\t.shaper_private_supported = 1,\n-\t\t\t.shaper_private_dual_rate_supported = 0,\n-\t\t\t.shaper_private_rate_min = 1,\n-\t\t\t.shaper_private_rate_max = UINT32_MAX,\n-\t\t\t.shaper_private_packet_mode_supported = 0,\n-\t\t\t.shaper_private_byte_mode_supported = 1,\n-\t\t\t.shaper_shared_n_max = 0,\n-\t\t\t.shaper_shared_packet_mode_supported = 0,\n-\t\t\t.shaper_shared_byte_mode_supported = 0,\n-\n-\t\t\t.sched_n_children_max = UINT32_MAX,\n-\t\t\t.sched_sp_n_priorities_max = 1,\n-\t\t\t.sched_wfq_n_children_per_group_max = UINT32_MAX,\n-\t\t\t.sched_wfq_n_groups_max = 1,\n-\t\t\t.sched_wfq_weight_max = 1,\n-\t\t\t.sched_wfq_packet_mode_supported = 0,\n-\t\t\t.sched_wfq_byte_mode_supported = 1,\n-\n-\t\t\t.stats_mask = STATS_MASK_DEFAULT,\n-\t\t} },\n-\t},\n-\n-\t[TM_NODE_LEVEL_SUBPORT] = {\n-\t\t.n_nodes_max = UINT32_MAX,\n-\t\t.n_nodes_nonleaf_max = UINT32_MAX,\n-\t\t.n_nodes_leaf_max = 0,\n-\t\t.non_leaf_nodes_identical = 1,\n-\t\t.leaf_nodes_identical = 0,\n-\n-\t\t{.nonleaf = {\n-\t\t\t.shaper_private_supported = 1,\n-\t\t\t.shaper_private_dual_rate_supported = 0,\n-\t\t\t.shaper_private_rate_min = 1,\n-\t\t\t.shaper_private_rate_max = UINT32_MAX,\n-\t\t\t.shaper_private_packet_mode_supported = 0,\n-\t\t\t.shaper_private_byte_mode_supported = 1,\n-\t\t\t.shaper_shared_n_max = 0,\n-\t\t\t.shaper_shared_packet_mode_supported = 0,\n-\t\t\t.shaper_shared_byte_mode_supported = 0,\n-\n-\t\t\t.sched_n_children_max = UINT32_MAX,\n-\t\t\t.sched_sp_n_priorities_max = 1,\n-\t\t\t.sched_wfq_n_children_per_group_max = UINT32_MAX,\n-\t\t\t.sched_wfq_n_groups_max = 1,\n-\t\t\t.sched_wfq_weight_max = UINT32_MAX,\n-\t\t\t.sched_wfq_packet_mode_supported = 0,\n-\t\t\t.sched_wfq_byte_mode_supported = 1,\n-\n-\t\t\t.stats_mask = STATS_MASK_DEFAULT,\n-\t\t} },\n-\t},\n-\n-\t[TM_NODE_LEVEL_PIPE] = {\n-\t\t.n_nodes_max = UINT32_MAX,\n-\t\t.n_nodes_nonleaf_max = UINT32_MAX,\n-\t\t.n_nodes_leaf_max = 0,\n-\t\t.non_leaf_nodes_identical = 1,\n-\t\t.leaf_nodes_identical = 0,\n-\n-\t\t{.nonleaf = {\n-\t\t\t.shaper_private_supported = 1,\n-\t\t\t.shaper_private_dual_rate_supported = 0,\n-\t\t\t.shaper_private_rate_min = 1,\n-\t\t\t.shaper_private_rate_max = UINT32_MAX,\n-\t\t\t.shaper_private_packet_mode_supported = 0,\n-\t\t\t.shaper_private_byte_mode_supported = 1,\n-\t\t\t.shaper_shared_n_max = 0,\n-\t\t\t.shaper_shared_packet_mode_supported = 0,\n-\t\t\t.shaper_shared_byte_mode_supported = 0,\n-\n-\t\t\t.sched_n_children_max =\n-\t\t\t\tRTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,\n-\t\t\t.sched_sp_n_priorities_max =\n-\t\t\t\tRTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,\n-\t\t\t.sched_wfq_n_children_per_group_max = 1,\n-\t\t\t.sched_wfq_n_groups_max = 0,\n-\t\t\t.sched_wfq_weight_max = 1,\n-\t\t\t.sched_wfq_packet_mode_supported = 0,\n-\t\t\t.sched_wfq_byte_mode_supported = 0,\n-\n-\t\t\t.stats_mask = STATS_MASK_DEFAULT,\n-\t\t} },\n-\t},\n-\n-\t[TM_NODE_LEVEL_TC] = {\n-\t\t.n_nodes_max = UINT32_MAX,\n-\t\t.n_nodes_nonleaf_max = UINT32_MAX,\n-\t\t.n_nodes_leaf_max = 0,\n-\t\t.non_leaf_nodes_identical = 1,\n-\t\t.leaf_nodes_identical = 0,\n-\n-\t\t{.nonleaf = {\n-\t\t\t.shaper_private_supported = 1,\n-\t\t\t.shaper_private_dual_rate_supported = 0,\n-\t\t\t.shaper_private_rate_min = 1,\n-\t\t\t.shaper_private_rate_max = UINT32_MAX,\n-\t\t\t.shaper_private_packet_mode_supported = 0,\n-\t\t\t.shaper_private_byte_mode_supported = 1,\n-\t\t\t.shaper_shared_n_max = 1,\n-\t\t\t.shaper_shared_packet_mode_supported = 0,\n-\t\t\t.shaper_shared_byte_mode_supported = 1,\n-\n-\t\t\t.sched_n_children_max =\n-\t\t\t\tRTE_SCHED_BE_QUEUES_PER_PIPE,\n-\t\t\t.sched_sp_n_priorities_max = 1,\n-\t\t\t.sched_wfq_n_children_per_group_max =\n-\t\t\t\tRTE_SCHED_BE_QUEUES_PER_PIPE,\n-\t\t\t.sched_wfq_n_groups_max = 1,\n-\t\t\t.sched_wfq_weight_max = UINT32_MAX,\n-\t\t\t.sched_wfq_packet_mode_supported = 0,\n-\t\t\t.sched_wfq_byte_mode_supported = 1,\n-\n-\t\t\t.stats_mask = STATS_MASK_DEFAULT,\n-\t\t} },\n-\t},\n-\n-\t[TM_NODE_LEVEL_QUEUE] = {\n-\t\t.n_nodes_max = UINT32_MAX,\n-\t\t.n_nodes_nonleaf_max = 0,\n-\t\t.n_nodes_leaf_max = UINT32_MAX,\n-\t\t.non_leaf_nodes_identical = 0,\n-\t\t.leaf_nodes_identical = 1,\n-\n-\t\t{.leaf = {\n-\t\t\t.shaper_private_supported = 0,\n-\t\t\t.shaper_private_dual_rate_supported = 0,\n-\t\t\t.shaper_private_rate_min = 0,\n-\t\t\t.shaper_private_rate_max = 0,\n-\t\t\t.shaper_private_packet_mode_supported = 0,\n-\t\t\t.shaper_private_byte_mode_supported = 0,\n-\t\t\t.shaper_shared_n_max = 0,\n-\t\t\t.shaper_shared_packet_mode_supported = 0,\n-\t\t\t.shaper_shared_byte_mode_supported = 0,\n-\n-\t\t\t.cman_head_drop_supported = 0,\n-\t\t\t.cman_wred_packet_mode_supported = WRED_SUPPORTED,\n-\t\t\t.cman_wred_byte_mode_supported = 0,\n-\t\t\t.cman_wred_context_private_supported = WRED_SUPPORTED,\n-\t\t\t.cman_wred_context_shared_n_max = 0,\n-\n-\t\t\t.stats_mask = STATS_MASK_QUEUE,\n-\t\t} },\n-\t},\n-};\n-\n-/* Traffic manager level capabilities get */\n-static int\n-pmd_tm_level_capabilities_get(struct rte_eth_dev *dev __rte_unused,\n-\tuint32_t level_id,\n-\tstruct rte_tm_level_capabilities *cap,\n-\tstruct rte_tm_error *error)\n-{\n-\tif (cap == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t   EINVAL,\n-\t\t   RTE_TM_ERROR_TYPE_CAPABILITIES,\n-\t\t   NULL,\n-\t\t   rte_strerror(EINVAL));\n-\n-\tif (level_id >= TM_NODE_LEVEL_MAX)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t   EINVAL,\n-\t\t   RTE_TM_ERROR_TYPE_LEVEL_ID,\n-\t\t   NULL,\n-\t\t   rte_strerror(EINVAL));\n-\n-\tmemcpy(cap, &tm_level_cap[level_id], sizeof(*cap));\n-\n-\tswitch (level_id) {\n-\tcase TM_NODE_LEVEL_PORT:\n-\t\tcap->nonleaf.sched_n_children_max =\n-\t\t\ttm_level_get_max_nodes(dev,\n-\t\t\t\tTM_NODE_LEVEL_SUBPORT);\n-\t\tcap->nonleaf.sched_wfq_n_children_per_group_max =\n-\t\t\tcap->nonleaf.sched_n_children_max;\n-\t\tbreak;\n-\n-\tcase TM_NODE_LEVEL_SUBPORT:\n-\t\tcap->n_nodes_max = tm_level_get_max_nodes(dev,\n-\t\t\tTM_NODE_LEVEL_SUBPORT);\n-\t\tcap->n_nodes_nonleaf_max = cap->n_nodes_max;\n-\t\tcap->nonleaf.sched_n_children_max =\n-\t\t\ttm_level_get_max_nodes(dev,\n-\t\t\t\tTM_NODE_LEVEL_PIPE);\n-\t\tcap->nonleaf.sched_wfq_n_children_per_group_max =\n-\t\t\tcap->nonleaf.sched_n_children_max;\n-\t\tbreak;\n-\n-\tcase TM_NODE_LEVEL_PIPE:\n-\t\tcap->n_nodes_max = tm_level_get_max_nodes(dev,\n-\t\t\tTM_NODE_LEVEL_PIPE);\n-\t\tcap->n_nodes_nonleaf_max = cap->n_nodes_max;\n-\t\tbreak;\n-\n-\tcase TM_NODE_LEVEL_TC:\n-\t\tcap->n_nodes_max = tm_level_get_max_nodes(dev,\n-\t\t\tTM_NODE_LEVEL_TC);\n-\t\tcap->n_nodes_nonleaf_max = cap->n_nodes_max;\n-\t\tbreak;\n-\n-\tcase TM_NODE_LEVEL_QUEUE:\n-\tdefault:\n-\t\tcap->n_nodes_max = tm_level_get_max_nodes(dev,\n-\t\t\tTM_NODE_LEVEL_QUEUE);\n-\t\tcap->n_nodes_leaf_max = cap->n_nodes_max;\n-\t\tbreak;\n-\t}\n-\n-\treturn 0;\n-}\n-\n-static const struct rte_tm_node_capabilities tm_node_cap[] = {\n-\t[TM_NODE_LEVEL_PORT] = {\n-\t\t.shaper_private_supported = 1,\n-\t\t.shaper_private_dual_rate_supported = 0,\n-\t\t.shaper_private_rate_min = 1,\n-\t\t.shaper_private_rate_max = UINT32_MAX,\n-\t\t.shaper_private_packet_mode_supported = 0,\n-\t\t.shaper_private_byte_mode_supported = 1,\n-\t\t.shaper_shared_n_max = 0,\n-\t\t.shaper_shared_packet_mode_supported = 0,\n-\t\t.shaper_shared_byte_mode_supported = 0,\n-\n-\t\t{.nonleaf = {\n-\t\t\t.sched_n_children_max = UINT32_MAX,\n-\t\t\t.sched_sp_n_priorities_max = 1,\n-\t\t\t.sched_wfq_n_children_per_group_max = UINT32_MAX,\n-\t\t\t.sched_wfq_n_groups_max = 1,\n-\t\t\t.sched_wfq_weight_max = 1,\n-\t\t\t.sched_wfq_packet_mode_supported = 0,\n-\t\t\t.sched_wfq_byte_mode_supported = 1,\n-\t\t} },\n-\n-\t\t.stats_mask = STATS_MASK_DEFAULT,\n-\t},\n-\n-\t[TM_NODE_LEVEL_SUBPORT] = {\n-\t\t.shaper_private_supported = 1,\n-\t\t.shaper_private_dual_rate_supported = 0,\n-\t\t.shaper_private_rate_min = 1,\n-\t\t.shaper_private_rate_max = UINT32_MAX,\n-\t\t.shaper_private_packet_mode_supported = 0,\n-\t\t.shaper_private_byte_mode_supported = 1,\n-\t\t.shaper_shared_n_max = 0,\n-\t\t.shaper_shared_packet_mode_supported = 0,\n-\t\t.shaper_shared_byte_mode_supported = 0,\n-\n-\t\t{.nonleaf = {\n-\t\t\t.sched_n_children_max = UINT32_MAX,\n-\t\t\t.sched_sp_n_priorities_max = 1,\n-\t\t\t.sched_wfq_n_children_per_group_max = UINT32_MAX,\n-\t\t\t.sched_wfq_n_groups_max = 1,\n-\t\t\t.sched_wfq_weight_max = UINT32_MAX,\n-\t\t\t.sched_wfq_packet_mode_supported = 0,\n-\t\t\t.sched_wfq_byte_mode_supported = 1,\n-\t\t} },\n-\n-\t\t.stats_mask = STATS_MASK_DEFAULT,\n-\t},\n-\n-\t[TM_NODE_LEVEL_PIPE] = {\n-\t\t.shaper_private_supported = 1,\n-\t\t.shaper_private_dual_rate_supported = 0,\n-\t\t.shaper_private_rate_min = 1,\n-\t\t.shaper_private_rate_max = UINT32_MAX,\n-\t\t.shaper_private_packet_mode_supported = 0,\n-\t\t.shaper_private_byte_mode_supported = 1,\n-\t\t.shaper_shared_n_max = 0,\n-\t\t.shaper_shared_packet_mode_supported = 0,\n-\t\t.shaper_shared_byte_mode_supported = 0,\n-\n-\t\t{.nonleaf = {\n-\t\t\t.sched_n_children_max =\n-\t\t\t\tRTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,\n-\t\t\t.sched_sp_n_priorities_max =\n-\t\t\t\tRTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,\n-\t\t\t.sched_wfq_n_children_per_group_max = 1,\n-\t\t\t.sched_wfq_n_groups_max = 0,\n-\t\t\t.sched_wfq_weight_max = 1,\n-\t\t\t.sched_wfq_packet_mode_supported = 0,\n-\t\t\t.sched_wfq_byte_mode_supported = 0,\n-\t\t} },\n-\n-\t\t.stats_mask = STATS_MASK_DEFAULT,\n-\t},\n-\n-\t[TM_NODE_LEVEL_TC] = {\n-\t\t.shaper_private_supported = 1,\n-\t\t.shaper_private_dual_rate_supported = 0,\n-\t\t.shaper_private_rate_min = 1,\n-\t\t.shaper_private_rate_max = UINT32_MAX,\n-\t\t.shaper_private_packet_mode_supported = 0,\n-\t\t.shaper_private_byte_mode_supported = 1,\n-\t\t.shaper_shared_n_max = 1,\n-\t\t.shaper_shared_packet_mode_supported = 0,\n-\t\t.shaper_shared_byte_mode_supported = 1,\n-\n-\t\t{.nonleaf = {\n-\t\t\t.sched_n_children_max =\n-\t\t\t\tRTE_SCHED_BE_QUEUES_PER_PIPE,\n-\t\t\t.sched_sp_n_priorities_max = 1,\n-\t\t\t.sched_wfq_n_children_per_group_max =\n-\t\t\t\tRTE_SCHED_BE_QUEUES_PER_PIPE,\n-\t\t\t.sched_wfq_n_groups_max = 1,\n-\t\t\t.sched_wfq_weight_max = UINT32_MAX,\n-\t\t\t.sched_wfq_packet_mode_supported = 0,\n-\t\t\t.sched_wfq_byte_mode_supported = 1,\n-\t\t} },\n-\n-\t\t.stats_mask = STATS_MASK_DEFAULT,\n-\t},\n-\n-\t[TM_NODE_LEVEL_QUEUE] = {\n-\t\t.shaper_private_supported = 0,\n-\t\t.shaper_private_dual_rate_supported = 0,\n-\t\t.shaper_private_rate_min = 0,\n-\t\t.shaper_private_rate_max = 0,\n-\t\t.shaper_private_packet_mode_supported = 0,\n-\t\t.shaper_private_byte_mode_supported = 0,\n-\t\t.shaper_shared_n_max = 0,\n-\t\t.shaper_shared_packet_mode_supported = 0,\n-\t\t.shaper_shared_byte_mode_supported = 0,\n-\n-\n-\t\t{.leaf = {\n-\t\t\t.cman_head_drop_supported = 0,\n-\t\t\t.cman_wred_packet_mode_supported = WRED_SUPPORTED,\n-\t\t\t.cman_wred_byte_mode_supported = 0,\n-\t\t\t.cman_wred_context_private_supported = WRED_SUPPORTED,\n-\t\t\t.cman_wred_context_shared_n_max = 0,\n-\t\t} },\n-\n-\t\t.stats_mask = STATS_MASK_QUEUE,\n-\t},\n-};\n-\n-/* Traffic manager node capabilities get */\n-static int\n-pmd_tm_node_capabilities_get(struct rte_eth_dev *dev __rte_unused,\n-\tuint32_t node_id,\n-\tstruct rte_tm_node_capabilities *cap,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct tm_node *tm_node;\n-\n-\tif (cap == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t   EINVAL,\n-\t\t   RTE_TM_ERROR_TYPE_CAPABILITIES,\n-\t\t   NULL,\n-\t\t   rte_strerror(EINVAL));\n-\n-\ttm_node = tm_node_search(dev, node_id);\n-\tif (tm_node == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t   EINVAL,\n-\t\t   RTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t   NULL,\n-\t\t   rte_strerror(EINVAL));\n-\n-\tmemcpy(cap, &tm_node_cap[tm_node->level], sizeof(*cap));\n-\n-\tswitch (tm_node->level) {\n-\tcase TM_NODE_LEVEL_PORT:\n-\t\tcap->nonleaf.sched_n_children_max =\n-\t\t\ttm_level_get_max_nodes(dev,\n-\t\t\t\tTM_NODE_LEVEL_SUBPORT);\n-\t\tcap->nonleaf.sched_wfq_n_children_per_group_max =\n-\t\t\tcap->nonleaf.sched_n_children_max;\n-\t\tbreak;\n-\n-\tcase TM_NODE_LEVEL_SUBPORT:\n-\t\tcap->nonleaf.sched_n_children_max =\n-\t\t\ttm_level_get_max_nodes(dev,\n-\t\t\t\tTM_NODE_LEVEL_PIPE);\n-\t\tcap->nonleaf.sched_wfq_n_children_per_group_max =\n-\t\t\tcap->nonleaf.sched_n_children_max;\n-\t\tbreak;\n-\n-\tcase TM_NODE_LEVEL_PIPE:\n-\tcase TM_NODE_LEVEL_TC:\n-\tcase TM_NODE_LEVEL_QUEUE:\n-\tdefault:\n-\t\tbreak;\n-\t}\n-\n-\treturn 0;\n-}\n-\n-static int\n-shaper_profile_check(struct rte_eth_dev *dev,\n-\tuint32_t shaper_profile_id,\n-\tstruct rte_tm_shaper_params *profile,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct tm_shaper_profile *sp;\n-\n-\t/* Shaper profile ID must not be NONE. */\n-\tif (shaper_profile_id == RTE_TM_SHAPER_PROFILE_ID_NONE)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Shaper profile must not exist. */\n-\tsp = tm_shaper_profile_search(dev, shaper_profile_id);\n-\tif (sp)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEEXIST,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EEXIST));\n-\n-\t/* Profile must not be NULL. */\n-\tif (profile == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Peak rate: non-zero, 32-bit */\n-\tif (profile->peak.rate == 0 ||\n-\t\tprofile->peak.rate >= UINT32_MAX)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Peak size: non-zero, 32-bit */\n-\tif (profile->peak.size == 0 ||\n-\t\tprofile->peak.size >= UINT32_MAX)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Dual-rate profiles are not supported. */\n-\tif (profile->committed.rate != 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Packet length adjust: 24 bytes */\n-\tif (profile->pkt_length_adjust != RTE_TM_ETH_FRAMING_OVERHEAD_FCS)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Packet mode is not supported. */\n-\tif (profile->packet_mode != 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\treturn 0;\n-}\n-\n-/* Traffic manager shaper profile add */\n-static int\n-pmd_tm_shaper_profile_add(struct rte_eth_dev *dev,\n-\tuint32_t shaper_profile_id,\n-\tstruct rte_tm_shaper_params *profile,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_shaper_profile_list *spl = &p->soft.tm.h.shaper_profiles;\n-\tstruct tm_shaper_profile *sp;\n-\tint status;\n-\n-\t/* Check input params */\n-\tstatus = shaper_profile_check(dev, shaper_profile_id, profile, error);\n-\tif (status)\n-\t\treturn status;\n-\n-\t/* Memory allocation */\n-\tsp = calloc(1, sizeof(struct tm_shaper_profile));\n-\tif (sp == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tENOMEM,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(ENOMEM));\n-\n-\t/* Fill in */\n-\tsp->shaper_profile_id = shaper_profile_id;\n-\tmemcpy(&sp->params, profile, sizeof(sp->params));\n-\n-\t/* Add to list */\n-\tTAILQ_INSERT_TAIL(spl, sp, node);\n-\tp->soft.tm.h.n_shaper_profiles++;\n-\n-\treturn 0;\n-}\n-\n-/* Traffic manager shaper profile delete */\n-static int\n-pmd_tm_shaper_profile_delete(struct rte_eth_dev *dev,\n-\tuint32_t shaper_profile_id,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_shaper_profile *sp;\n-\n-\t/* Check existing */\n-\tsp = tm_shaper_profile_search(dev, shaper_profile_id);\n-\tif (sp == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Check unused */\n-\tif (sp->n_users)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEBUSY,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EBUSY));\n-\n-\t/* Remove from list */\n-\tTAILQ_REMOVE(&p->soft.tm.h.shaper_profiles, sp, node);\n-\tp->soft.tm.h.n_shaper_profiles--;\n-\tfree(sp);\n-\n-\treturn 0;\n-}\n-\n-static struct tm_node *\n-tm_shared_shaper_get_tc(struct rte_eth_dev *dev,\n-\tstruct tm_shared_shaper *ss)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_node_list *nl = &p->soft.tm.h.nodes;\n-\tstruct tm_node *n;\n-\n-\t/* Subport: each TC uses shared shaper  */\n-\tTAILQ_FOREACH(n, nl, node) {\n-\t\tif (n->level != TM_NODE_LEVEL_TC ||\n-\t\t\tn->params.n_shared_shapers == 0 ||\n-\t\t\tn->params.shared_shaper_id[0] != ss->shared_shaper_id)\n-\t\t\tcontinue;\n-\n-\t\treturn n;\n-\t}\n-\n-\treturn NULL;\n-}\n-\n-static int\n-subport_profile_exists(struct rte_eth_dev *dev,\n-\tstruct rte_sched_subport_profile_params *sp,\n-\tuint32_t *subport_profile_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\tuint32_t i;\n-\n-\tfor (i = 0; i < t->n_subport_profiles; i++)\n-\t\tif (memcmp(&t->subport_profile[i], sp, sizeof(*sp)) == 0) {\n-\t\t\tif (subport_profile_id)\n-\t\t\t\t*subport_profile_id = i;\n-\t\t\treturn 1;\n-\t\t}\n-\n-\treturn 0;\n-}\n-\n-static int\n-update_subport_tc_rate(struct rte_eth_dev *dev,\n-\tstruct tm_node *nt,\n-\tstruct tm_shared_shaper *ss,\n-\tstruct tm_shaper_profile *sp_new)\n-{\n-\tstruct rte_sched_subport_profile_params subport_profile;\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tuint32_t tc_id = tm_node_tc_id(dev, nt);\n-\tstruct tm_node *np = nt->parent_node;\n-\tstruct tm_node *ns = np->parent_node;\n-\tuint32_t subport_id = tm_node_subport_id(dev, ns);\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\tuint32_t subport_profile_id;\n-\tstruct tm_shaper_profile *sp_old = tm_shaper_profile_search(dev,\n-\t\tss->shaper_profile_id);\n-\n-\tif (subport_id >= TM_MAX_SUBPORT_PROFILE)\n-\t\treturn -1;\n-\n-\tsubport_profile_id = t->subport_to_profile[subport_id];\n-\n-\t/* Derive new subport configuration. */\n-\tmemcpy(&subport_profile,\n-\t\t&p->soft.tm.params.subport_profile[subport_profile_id],\n-\t\tsizeof(subport_profile));\n-\tsubport_profile.tc_rate[tc_id] = sp_new->params.peak.rate;\n-\n-\t/* Update the subport configuration. */\n-\tif (rte_sched_subport_config(SCHED(p),\n-\t\tsubport_id, NULL, subport_profile_id))\n-\t\treturn -1;\n-\n-\t/* Commit changes. */\n-\tsp_old->n_users--;\n-\n-\tss->shaper_profile_id = sp_new->shaper_profile_id;\n-\tsp_new->n_users++;\n-\n-\tmemcpy(&p->soft.tm.params.subport_profile[subport_profile_id],\n-\t\t&subport_profile,\n-\t\tsizeof(subport_profile));\n-\n-\treturn 0;\n-}\n-\n-/* Traffic manager shared shaper add/update */\n-static int\n-pmd_tm_shared_shaper_add_update(struct rte_eth_dev *dev,\n-\tuint32_t shared_shaper_id,\n-\tuint32_t shaper_profile_id,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_shared_shaper *ss;\n-\tstruct tm_shaper_profile *sp;\n-\tstruct tm_node *nt;\n-\n-\t/* Shaper profile must be valid. */\n-\tsp = tm_shaper_profile_search(dev, shaper_profile_id);\n-\tif (sp == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/**\n-\t * Add new shared shaper\n-\t */\n-\tss = tm_shared_shaper_search(dev, shared_shaper_id);\n-\tif (ss == NULL) {\n-\t\tstruct tm_shared_shaper_list *ssl =\n-\t\t\t&p->soft.tm.h.shared_shapers;\n-\n-\t\t/* Hierarchy must not be frozen */\n-\t\tif (p->soft.tm.hierarchy_frozen)\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEBUSY,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EBUSY));\n-\n-\t\t/* Memory allocation */\n-\t\tss = calloc(1, sizeof(struct tm_shared_shaper));\n-\t\tif (ss == NULL)\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tENOMEM,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(ENOMEM));\n-\n-\t\t/* Fill in */\n-\t\tss->shared_shaper_id = shared_shaper_id;\n-\t\tss->shaper_profile_id = shaper_profile_id;\n-\n-\t\t/* Add to list */\n-\t\tTAILQ_INSERT_TAIL(ssl, ss, node);\n-\t\tp->soft.tm.h.n_shared_shapers++;\n-\n-\t\treturn 0;\n-\t}\n-\n-\t/**\n-\t * Update existing shared shaper\n-\t */\n-\t/* Hierarchy must be frozen (run-time update) */\n-\tif (p->soft.tm.hierarchy_frozen == 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEBUSY,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EBUSY));\n-\n-\n-\t/* Propagate change. */\n-\tnt = tm_shared_shaper_get_tc(dev, ss);\n-\tif (update_subport_tc_rate(dev, nt, ss, sp))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\treturn 0;\n-}\n-\n-/* Traffic manager shared shaper delete */\n-static int\n-pmd_tm_shared_shaper_delete(struct rte_eth_dev *dev,\n-\tuint32_t shared_shaper_id,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_shared_shaper *ss;\n-\n-\t/* Check existing */\n-\tss = tm_shared_shaper_search(dev, shared_shaper_id);\n-\tif (ss == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_SHARED_SHAPER_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Check unused */\n-\tif (ss->n_users)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEBUSY,\n-\t\t\tRTE_TM_ERROR_TYPE_SHARED_SHAPER_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EBUSY));\n-\n-\t/* Remove from list */\n-\tTAILQ_REMOVE(&p->soft.tm.h.shared_shapers, ss, node);\n-\tp->soft.tm.h.n_shared_shapers--;\n-\tfree(ss);\n-\n-\treturn 0;\n-}\n-\n-static int\n-wred_profile_check(struct rte_eth_dev *dev,\n-\tuint32_t wred_profile_id,\n-\tstruct rte_tm_wred_params *profile,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct tm_wred_profile *wp;\n-\tenum rte_color color;\n-\n-\t/* WRED profile ID must not be NONE. */\n-\tif (wred_profile_id == RTE_TM_WRED_PROFILE_ID_NONE)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_WRED_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* WRED profile must not exist. */\n-\twp = tm_wred_profile_search(dev, wred_profile_id);\n-\tif (wp)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEEXIST,\n-\t\t\tRTE_TM_ERROR_TYPE_WRED_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EEXIST));\n-\n-\t/* Profile must not be NULL. */\n-\tif (profile == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_WRED_PROFILE,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-        /* WRED profile should be in packet mode */\n-        if (profile->packet_mode == 0)\n-                return -rte_tm_error_set(error,\n-                        ENOTSUP,\n-                        RTE_TM_ERROR_TYPE_WRED_PROFILE,\n-                        NULL,\n-                        rte_strerror(ENOTSUP));\n-\n-\t/* min_th <= max_th, max_th > 0  */\n-\tfor (color = RTE_COLOR_GREEN; color < RTE_COLORS; color++) {\n-\t\tuint32_t min_th = profile->red_params[color].min_th;\n-\t\tuint32_t max_th = profile->red_params[color].max_th;\n-\n-\t\tif (min_th > max_th ||\n-\t\t\tmax_th == 0 ||\n-\t\t\tmin_th > UINT16_MAX ||\n-\t\t\tmax_th > UINT16_MAX)\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_WRED_PROFILE,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t}\n-\n-\treturn 0;\n-}\n-\n-/* Traffic manager WRED profile add */\n-static int\n-pmd_tm_wred_profile_add(struct rte_eth_dev *dev,\n-\tuint32_t wred_profile_id,\n-\tstruct rte_tm_wred_params *profile,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_wred_profile_list *wpl = &p->soft.tm.h.wred_profiles;\n-\tstruct tm_wred_profile *wp;\n-\tint status;\n-\n-\t/* Check input params */\n-\tstatus = wred_profile_check(dev, wred_profile_id, profile, error);\n-\tif (status)\n-\t\treturn status;\n-\n-\t/* Memory allocation */\n-\twp = calloc(1, sizeof(struct tm_wred_profile));\n-\tif (wp == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tENOMEM,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(ENOMEM));\n-\n-\t/* Fill in */\n-\twp->wred_profile_id = wred_profile_id;\n-\tmemcpy(&wp->params, profile, sizeof(wp->params));\n-\n-\t/* Add to list */\n-\tTAILQ_INSERT_TAIL(wpl, wp, node);\n-\tp->soft.tm.h.n_wred_profiles++;\n-\n-\treturn 0;\n-}\n-\n-/* Traffic manager WRED profile delete */\n-static int\n-pmd_tm_wred_profile_delete(struct rte_eth_dev *dev,\n-\tuint32_t wred_profile_id,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_wred_profile *wp;\n-\n-\t/* Check existing */\n-\twp = tm_wred_profile_search(dev, wred_profile_id);\n-\tif (wp == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_WRED_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Check unused */\n-\tif (wp->n_users)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEBUSY,\n-\t\t\tRTE_TM_ERROR_TYPE_WRED_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EBUSY));\n-\n-\t/* Remove from list */\n-\tTAILQ_REMOVE(&p->soft.tm.h.wred_profiles, wp, node);\n-\tp->soft.tm.h.n_wred_profiles--;\n-\tfree(wp);\n-\n-\treturn 0;\n-}\n-\n-static int\n-node_add_check_port(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tuint32_t parent_node_id __rte_unused,\n-\tuint32_t priority,\n-\tuint32_t weight,\n-\tuint32_t level_id __rte_unused,\n-\tstruct rte_tm_node_params *params,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_shaper_profile *sp = tm_shaper_profile_search(dev,\n-\t\tparams->shaper_profile_id);\n-\n-\t/* node type: non-leaf */\n-\tif (node_id < p->params.tm.n_queues)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Priority must be 0 */\n-\tif (priority != 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PRIORITY,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Weight must be 1 */\n-\tif (weight != 1)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_WEIGHT,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Shaper must be valid */\n-\tif (params->shaper_profile_id == RTE_TM_SHAPER_PROFILE_ID_NONE ||\n-\t\tsp == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* No shared shapers */\n-\tif (params->n_shared_shapers != 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Number of SP priorities must be 1 */\n-\tif (params->nonleaf.n_sp_priorities != 1)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Stats */\n-\tif (params->stats_mask & ~STATS_MASK_DEFAULT)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_STATS,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\treturn 0;\n-}\n-\n-static int\n-node_add_check_subport(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tuint32_t parent_node_id __rte_unused,\n-\tuint32_t priority,\n-\tuint32_t weight,\n-\tuint32_t level_id __rte_unused,\n-\tstruct rte_tm_node_params *params,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\n-\t/* node type: non-leaf */\n-\tif (node_id < p->params.tm.n_queues)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Priority must be 0 */\n-\tif (priority != 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PRIORITY,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Weight must be 1 */\n-\tif (weight != 1)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_WEIGHT,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Shaper must be valid */\n-\tif (params->shaper_profile_id == RTE_TM_SHAPER_PROFILE_ID_NONE ||\n-\t\t(!tm_shaper_profile_search(dev, params->shaper_profile_id)))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* No shared shapers */\n-\tif (params->n_shared_shapers != 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Number of SP priorities must be 1 */\n-\tif (params->nonleaf.n_sp_priorities != 1)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Stats */\n-\tif (params->stats_mask & ~STATS_MASK_DEFAULT)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_STATS,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\treturn 0;\n-}\n-\n-static int\n-node_add_check_pipe(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tuint32_t parent_node_id __rte_unused,\n-\tuint32_t priority,\n-\tuint32_t weight __rte_unused,\n-\tuint32_t level_id __rte_unused,\n-\tstruct rte_tm_node_params *params,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\n-\t/* node type: non-leaf */\n-\tif (node_id < p->params.tm.n_queues)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Priority must be 0 */\n-\tif (priority != 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PRIORITY,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Shaper must be valid */\n-\tif (params->shaper_profile_id == RTE_TM_SHAPER_PROFILE_ID_NONE ||\n-\t\t(!tm_shaper_profile_search(dev, params->shaper_profile_id)))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* No shared shapers */\n-\tif (params->n_shared_shapers != 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Number of SP priorities must be 4 */\n-\tif (params->nonleaf.n_sp_priorities !=\n-\t\tRTE_SCHED_TRAFFIC_CLASSES_PER_PIPE)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* WFQ mode must be byte mode */\n-\tif (params->nonleaf.wfq_weight_mode != NULL &&\n-\t\tparams->nonleaf.wfq_weight_mode[0] != 0 &&\n-\t\tparams->nonleaf.wfq_weight_mode[1] != 0 &&\n-\t\tparams->nonleaf.wfq_weight_mode[2] != 0 &&\n-\t\tparams->nonleaf.wfq_weight_mode[3] != 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Stats */\n-\tif (params->stats_mask & ~STATS_MASK_DEFAULT)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_STATS,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\treturn 0;\n-}\n-\n-static int\n-node_add_check_tc(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tuint32_t parent_node_id __rte_unused,\n-\tuint32_t priority __rte_unused,\n-\tuint32_t weight,\n-\tuint32_t level_id __rte_unused,\n-\tstruct rte_tm_node_params *params,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\n-\t/* node type: non-leaf */\n-\tif (node_id < p->params.tm.n_queues)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Weight must be 1 */\n-\tif (weight != 1)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_WEIGHT,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Shaper must be valid */\n-\tif (params->shaper_profile_id == RTE_TM_SHAPER_PROFILE_ID_NONE ||\n-\t\t(!tm_shaper_profile_search(dev, params->shaper_profile_id)))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Single valid shared shaper */\n-\tif (params->n_shared_shapers > 1)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\tif (params->n_shared_shapers == 1 &&\n-\t\t(params->shared_shaper_id == NULL ||\n-\t\t(!tm_shared_shaper_search(dev, params->shared_shaper_id[0]))))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_SHAPER_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Number of priorities must be 1 */\n-\tif (params->nonleaf.n_sp_priorities != 1)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Stats */\n-\tif (params->stats_mask & ~STATS_MASK_DEFAULT)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_STATS,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\treturn 0;\n-}\n-\n-static int\n-node_add_check_queue(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tuint32_t parent_node_id __rte_unused,\n-\tuint32_t priority,\n-\tuint32_t weight __rte_unused,\n-\tuint32_t level_id __rte_unused,\n-\tstruct rte_tm_node_params *params,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\n-\t/* node type: leaf */\n-\tif (node_id >= p->params.tm.n_queues)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Priority must be 0 */\n-\tif (priority != 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PRIORITY,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* No shaper */\n-\tif (params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* No shared shapers */\n-\tif (params->n_shared_shapers != 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Congestion management must not be head drop */\n-\tif (params->leaf.cman == RTE_TM_CMAN_HEAD_DROP)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Congestion management set to WRED */\n-\tif (params->leaf.cman == RTE_TM_CMAN_WRED) {\n-\t\tuint32_t wred_profile_id = params->leaf.wred.wred_profile_id;\n-\t\tstruct tm_wred_profile *wp = tm_wred_profile_search(dev,\n-\t\t\twred_profile_id);\n-\n-\t\t/* WRED profile (for private WRED context) must be valid */\n-\t\tif (wred_profile_id == RTE_TM_WRED_PROFILE_ID_NONE ||\n-\t\t\twp == NULL)\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_WRED_PROFILE_ID,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\n-\t\t/* No shared WRED contexts */\n-\t\tif (params->leaf.wred.n_shared_wred_contexts != 0)\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_WRED_CONTEXTS,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t}\n-\n-\t/* Stats */\n-\tif (params->stats_mask & ~STATS_MASK_QUEUE)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS_STATS,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\treturn 0;\n-}\n-\n-static int\n-node_add_check(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tuint32_t parent_node_id,\n-\tuint32_t priority,\n-\tuint32_t weight,\n-\tuint32_t level_id,\n-\tstruct rte_tm_node_params *params,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct tm_node *pn;\n-\tuint32_t level;\n-\tint status;\n-\n-\t/* node_id, parent_node_id:\n-\t *    -node_id must not be RTE_TM_NODE_ID_NULL\n-\t *    -node_id must not be in use\n-\t *    -root node add (parent_node_id is RTE_TM_NODE_ID_NULL):\n-\t *        -root node must not exist\n-\t *    -non-root node add (parent_node_id is not RTE_TM_NODE_ID_NULL):\n-\t *        -parent_node_id must be valid\n-\t */\n-\tif (node_id == RTE_TM_NODE_ID_NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\tif (tm_node_search(dev, node_id))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEEXIST,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EEXIST));\n-\n-\tif (parent_node_id == RTE_TM_NODE_ID_NULL) {\n-\t\tpn = NULL;\n-\t\tif (tm_root_node_present(dev))\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEEXIST,\n-\t\t\t\tRTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EEXIST));\n-\t} else {\n-\t\tpn = tm_node_search(dev, parent_node_id);\n-\t\tif (pn == NULL)\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t}\n-\n-\t/* priority: must be 0 .. 3 */\n-\tif (priority >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PRIORITY,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* weight: must be 1 .. 255 */\n-\tif (weight == 0 || weight >= UINT8_MAX)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_WEIGHT,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* level_id: if valid, then\n-\t *    -root node add (parent_node_id is RTE_TM_NODE_ID_NULL):\n-\t *        -level_id must be zero\n-\t *    -non-root node add (parent_node_id is not RTE_TM_NODE_ID_NULL):\n-\t *        -level_id must be parent level ID plus one\n-\t */\n-\tlevel = (pn == NULL) ? 0 : pn->level + 1;\n-\tif (level_id != RTE_TM_NODE_LEVEL_ID_ANY && level_id != level)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_LEVEL_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* params: must not be NULL */\n-\tif (params == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARAMS,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* params: per level checks */\n-\tswitch (level) {\n-\tcase TM_NODE_LEVEL_PORT:\n-\t\tstatus = node_add_check_port(dev, node_id,\n-\t\t\tparent_node_id, priority, weight, level_id,\n-\t\t\tparams, error);\n-\t\tif (status)\n-\t\t\treturn status;\n-\t\tbreak;\n-\n-\tcase TM_NODE_LEVEL_SUBPORT:\n-\t\tstatus = node_add_check_subport(dev, node_id,\n-\t\t\tparent_node_id, priority, weight, level_id,\n-\t\t\tparams, error);\n-\t\tif (status)\n-\t\t\treturn status;\n-\t\tbreak;\n-\n-\tcase TM_NODE_LEVEL_PIPE:\n-\t\tstatus = node_add_check_pipe(dev, node_id,\n-\t\t\tparent_node_id, priority, weight, level_id,\n-\t\t\tparams, error);\n-\t\tif (status)\n-\t\t\treturn status;\n-\t\tbreak;\n-\n-\tcase TM_NODE_LEVEL_TC:\n-\t\tstatus = node_add_check_tc(dev, node_id,\n-\t\t\tparent_node_id, priority, weight, level_id,\n-\t\t\tparams, error);\n-\t\tif (status)\n-\t\t\treturn status;\n-\t\tbreak;\n-\n-\tcase TM_NODE_LEVEL_QUEUE:\n-\t\tstatus = node_add_check_queue(dev, node_id,\n-\t\t\tparent_node_id, priority, weight, level_id,\n-\t\t\tparams, error);\n-\t\tif (status)\n-\t\t\treturn status;\n-\t\tbreak;\n-\n-\tdefault:\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_LEVEL_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\t}\n-\n-\treturn 0;\n-}\n-\n-/* Traffic manager node add */\n-static int\n-pmd_tm_node_add(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tuint32_t parent_node_id,\n-\tuint32_t priority,\n-\tuint32_t weight,\n-\tuint32_t level_id,\n-\tstruct rte_tm_node_params *params,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_node_list *nl = &p->soft.tm.h.nodes;\n-\tstruct tm_node *n;\n-\tuint32_t i;\n-\tint status;\n-\n-\t/* Checks */\n-\tif (p->soft.tm.hierarchy_frozen)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEBUSY,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EBUSY));\n-\n-\tstatus = node_add_check(dev, node_id, parent_node_id, priority, weight,\n-\t\tlevel_id, params, error);\n-\tif (status)\n-\t\treturn status;\n-\n-\t/* Memory allocation */\n-\tn = calloc(1, sizeof(struct tm_node));\n-\tif (n == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tENOMEM,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(ENOMEM));\n-\n-\t/* Fill in */\n-\tn->node_id = node_id;\n-\tn->parent_node_id = parent_node_id;\n-\tn->priority = priority;\n-\tn->weight = weight;\n-\n-\tif (parent_node_id != RTE_TM_NODE_ID_NULL) {\n-\t\tn->parent_node = tm_node_search(dev, parent_node_id);\n-\t\tn->level = n->parent_node->level + 1;\n-\t}\n-\n-\tif (params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE)\n-\t\tn->shaper_profile = tm_shaper_profile_search(dev,\n-\t\t\tparams->shaper_profile_id);\n-\n-\tif (n->level == TM_NODE_LEVEL_QUEUE &&\n-\t\tparams->leaf.cman == RTE_TM_CMAN_WRED)\n-\t\tn->wred_profile = tm_wred_profile_search(dev,\n-\t\t\tparams->leaf.wred.wred_profile_id);\n-\n-\tmemcpy(&n->params, params, sizeof(n->params));\n-\n-\t/* Add to list */\n-\tTAILQ_INSERT_TAIL(nl, n, node);\n-\tp->soft.tm.h.n_nodes++;\n-\n-\t/* Update dependencies */\n-\tif (n->parent_node)\n-\t\tn->parent_node->n_children++;\n-\n-\tif (n->shaper_profile)\n-\t\tn->shaper_profile->n_users++;\n-\n-\tfor (i = 0; i < params->n_shared_shapers; i++) {\n-\t\tstruct tm_shared_shaper *ss;\n-\n-\t\tss = tm_shared_shaper_search(dev, params->shared_shaper_id[i]);\n-\t\tss->n_users++;\n-\t}\n-\n-\tif (n->wred_profile)\n-\t\tn->wred_profile->n_users++;\n-\n-\tp->soft.tm.h.n_tm_nodes[n->level]++;\n-\n-\treturn 0;\n-}\n-\n-/* Traffic manager node delete */\n-static int\n-pmd_tm_node_delete(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_node *n;\n-\tuint32_t i;\n-\n-\t/* Check hierarchy changes are currently allowed */\n-\tif (p->soft.tm.hierarchy_frozen)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEBUSY,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EBUSY));\n-\n-\t/* Check existing */\n-\tn = tm_node_search(dev, node_id);\n-\tif (n == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Check unused */\n-\tif (n->n_children)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEBUSY,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EBUSY));\n-\n-\t/* Update dependencies */\n-\tp->soft.tm.h.n_tm_nodes[n->level]--;\n-\n-\tif (n->wred_profile)\n-\t\tn->wred_profile->n_users--;\n-\n-\tfor (i = 0; i < n->params.n_shared_shapers; i++) {\n-\t\tstruct tm_shared_shaper *ss;\n-\n-\t\tss = tm_shared_shaper_search(dev,\n-\t\t\t\tn->params.shared_shaper_id[i]);\n-\t\tss->n_users--;\n-\t}\n-\n-\tif (n->shaper_profile)\n-\t\tn->shaper_profile->n_users--;\n-\n-\tif (n->parent_node)\n-\t\tn->parent_node->n_children--;\n-\n-\t/* Remove from list */\n-\tTAILQ_REMOVE(&p->soft.tm.h.nodes, n, node);\n-\tp->soft.tm.h.n_nodes--;\n-\tfree(n);\n-\n-\treturn 0;\n-}\n-\n-\n-static void\n-pipe_profile_build(struct rte_eth_dev *dev,\n-\tstruct tm_node *np,\n-\tstruct rte_sched_pipe_params *pp)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_hierarchy *h = &p->soft.tm.h;\n-\tstruct tm_node_list *nl = &h->nodes;\n-\tstruct tm_node *nt, *nq;\n-\n-\tmemset(pp, 0, sizeof(*pp));\n-\n-\t/* Pipe */\n-\tpp->tb_rate = np->shaper_profile->params.peak.rate;\n-\tpp->tb_size = np->shaper_profile->params.peak.size;\n-\n-\t/* Traffic Class (TC) */\n-\tpp->tc_period = PIPE_TC_PERIOD;\n-\n-\tpp->tc_ov_weight = np->weight;\n-\n-\tTAILQ_FOREACH(nt, nl, node) {\n-\t\tuint32_t queue_id = 0;\n-\n-\t\tif (nt->level != TM_NODE_LEVEL_TC ||\n-\t\t\tnt->parent_node_id != np->node_id)\n-\t\t\tcontinue;\n-\n-\t\tpp->tc_rate[nt->priority] =\n-\t\t\tnt->shaper_profile->params.peak.rate;\n-\n-\t\t/* Queue */\n-\t\tTAILQ_FOREACH(nq, nl, node) {\n-\n-\t\t\tif (nq->level != TM_NODE_LEVEL_QUEUE ||\n-\t\t\t\tnq->parent_node_id != nt->node_id)\n-\t\t\t\tcontinue;\n-\n-\t\t\tif (nt->priority == RTE_SCHED_TRAFFIC_CLASS_BE)\n-\t\t\t\tpp->wrr_weights[queue_id] = nq->weight;\n-\n-\t\t\tqueue_id++;\n-\t\t}\n-\t}\n-}\n-\n-static int\n-pipe_profile_free_exists(struct rte_eth_dev *dev,\n-\tuint32_t *pipe_profile_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\n-\tif (t->n_pipe_profiles < TM_MAX_PIPE_PROFILE) {\n-\t\t*pipe_profile_id = t->n_pipe_profiles;\n-\t\treturn 1;\n-\t}\n-\n-\treturn 0;\n-}\n-\n-static int\n-pipe_profile_exists(struct rte_eth_dev *dev,\n-\tstruct rte_sched_pipe_params *pp,\n-\tuint32_t *pipe_profile_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\tuint32_t i;\n-\n-\tfor (i = 0; i < t->n_pipe_profiles; i++)\n-\t\tif (memcmp(&t->pipe_profiles[i], pp, sizeof(*pp)) == 0) {\n-\t\t\tif (pipe_profile_id)\n-\t\t\t\t*pipe_profile_id = i;\n-\t\t\treturn 1;\n-\t\t}\n-\n-\treturn 0;\n-}\n-\n-static void\n-pipe_profile_install(struct rte_eth_dev *dev,\n-\tstruct rte_sched_pipe_params *pp,\n-\tuint32_t pipe_profile_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\n-\tmemcpy(&t->pipe_profiles[pipe_profile_id], pp, sizeof(*pp));\n-\tt->n_pipe_profiles++;\n-}\n-\n-static void\n-pipe_profile_mark(struct rte_eth_dev *dev,\n-\tuint32_t subport_id,\n-\tuint32_t pipe_id,\n-\tuint32_t pipe_profile_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_hierarchy *h = &p->soft.tm.h;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\tuint32_t n_pipes_per_subport, pos;\n-\n-\tn_pipes_per_subport = h->n_tm_nodes[TM_NODE_LEVEL_PIPE] /\n-\t\th->n_tm_nodes[TM_NODE_LEVEL_SUBPORT];\n-\tpos = subport_id * n_pipes_per_subport + pipe_id;\n-\n-\tt->pipe_to_profile[pos] = pipe_profile_id;\n-}\n-\n-static struct rte_sched_pipe_params *\n-pipe_profile_get(struct rte_eth_dev *dev, struct tm_node *np)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_hierarchy *h = &p->soft.tm.h;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\tuint32_t n_pipes_per_subport = h->n_tm_nodes[TM_NODE_LEVEL_PIPE] /\n-\t\th->n_tm_nodes[TM_NODE_LEVEL_SUBPORT];\n-\n-\tuint32_t subport_id = tm_node_subport_id(dev, np->parent_node);\n-\tuint32_t pipe_id = tm_node_pipe_id(dev, np);\n-\n-\tuint32_t pos = subport_id * n_pipes_per_subport + pipe_id;\n-\tuint32_t pipe_profile_id = t->pipe_to_profile[pos];\n-\n-\treturn &t->pipe_profiles[pipe_profile_id];\n-}\n-\n-static int\n-pipe_profiles_generate(struct rte_eth_dev *dev)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_hierarchy *h = &p->soft.tm.h;\n-\tstruct tm_node_list *nl = &h->nodes;\n-\tstruct tm_node *ns, *np;\n-\tuint32_t subport_id;\n-\n-\t/* Objective: Fill in the following fields in struct tm_params:\n-\t *    - pipe_profiles\n-\t *    - n_pipe_profiles\n-\t *    - pipe_to_profile\n-\t */\n-\n-\tsubport_id = 0;\n-\tTAILQ_FOREACH(ns, nl, node) {\n-\t\tuint32_t pipe_id;\n-\n-\t\tif (ns->level != TM_NODE_LEVEL_SUBPORT)\n-\t\t\tcontinue;\n-\n-\t\tpipe_id = 0;\n-\t\tTAILQ_FOREACH(np, nl, node) {\n-\t\t\tstruct rte_sched_pipe_params pp;\n-\t\t\tuint32_t pos;\n-\n-\t\t\tmemset(&pp, 0, sizeof(pp));\n-\n-\t\t\tif (np->level != TM_NODE_LEVEL_PIPE ||\n-\t\t\t\tnp->parent_node_id != ns->node_id)\n-\t\t\t\tcontinue;\n-\n-\t\t\tpipe_profile_build(dev, np, &pp);\n-\n-\t\t\tif (!pipe_profile_exists(dev, &pp, &pos)) {\n-\t\t\t\tif (!pipe_profile_free_exists(dev, &pos))\n-\t\t\t\t\treturn -1;\n-\n-\t\t\t\tpipe_profile_install(dev, &pp, pos);\n-\t\t\t}\n-\n-\t\t\tpipe_profile_mark(dev, subport_id, pipe_id, pos);\n-\n-\t\t\tpipe_id++;\n-\t\t}\n-\n-\t\tsubport_id++;\n-\t}\n-\n-\treturn 0;\n-}\n-\n-static struct tm_wred_profile *\n-tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_hierarchy *h = &p->soft.tm.h;\n-\tstruct tm_node_list *nl = &h->nodes;\n-\tstruct tm_node *nq;\n-\n-\tTAILQ_FOREACH(nq, nl, node) {\n-\t\tif (nq->level != TM_NODE_LEVEL_QUEUE ||\n-\t\t\tnq->parent_node->priority != tc_id)\n-\t\t\tcontinue;\n-\n-\t\treturn nq->wred_profile;\n-\t}\n-\n-\treturn NULL;\n-}\n-\n-#ifdef RTE_SCHED_CMAN\n-\n-static void\n-wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct rte_sched_subport_params *pp =\n-\t\t&p->soft.tm.params.subport_params[subport_id];\n-\n-\tuint32_t tc_id;\n-\tenum rte_color color;\n-\n-\tfor (tc_id = 0; tc_id < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; tc_id++)\n-\t\tfor (color = RTE_COLOR_GREEN; color < RTE_COLORS; color++) {\n-\t\t\tstruct rte_red_params *dst =\n-\t\t\t\t&pp->cman_params->red_params[tc_id][color];\n-\t\t\tstruct tm_wred_profile *src_wp =\n-\t\t\t\ttm_tc_wred_profile_get(dev, tc_id);\n-\t\t\tstruct rte_tm_red_params *src =\n-\t\t\t\t&src_wp->params.red_params[color];\n-\n-\t\t\tmemcpy(dst, src, sizeof(*dst));\n-\t\t}\n-}\n-\n-#else\n-\n-#define wred_profiles_set(dev, subport_id)\n-\n-#endif\n-\n-static struct tm_shared_shaper *\n-tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node)\n-{\n-\treturn (tc_node->params.n_shared_shapers) ?\n-\t\ttm_shared_shaper_search(dev,\n-\t\t\ttc_node->params.shared_shaper_id[0]) :\n-\t\tNULL;\n-}\n-\n-static struct tm_shared_shaper *\n-tm_subport_tc_shared_shaper_get(struct rte_eth_dev *dev,\n-\tstruct tm_node *subport_node,\n-\tuint32_t tc_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_node_list *nl = &p->soft.tm.h.nodes;\n-\tstruct tm_node *n;\n-\n-\tTAILQ_FOREACH(n, nl, node) {\n-\t\tif (n->level != TM_NODE_LEVEL_TC ||\n-\t\t\tn->parent_node->parent_node_id !=\n-\t\t\t\tsubport_node->node_id ||\n-\t\t\tn->priority != tc_id)\n-\t\t\tcontinue;\n-\n-\t\treturn tm_tc_shared_shaper_get(dev, n);\n-\t}\n-\n-\treturn NULL;\n-}\n-\n-static struct rte_sched_subport_profile_params *\n-subport_profile_get(struct rte_eth_dev *dev, struct tm_node *np)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\tuint32_t subport_id = tm_node_subport_id(dev, np->parent_node);\n-\n-\tif (subport_id >= TM_MAX_SUBPORT_PROFILE)\n-\t\treturn NULL;\n-\n-\treturn &t->subport_profile[subport_id];\n-}\n-\n-static void\n-subport_profile_mark(struct rte_eth_dev *dev,\n-\tuint32_t subport_id,\n-\tuint32_t subport_profile_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\n-\tt->subport_to_profile[subport_id] = subport_profile_id;\n-}\n-\n-static void\n-subport_profile_install(struct rte_eth_dev *dev,\n-\tstruct rte_sched_subport_profile_params *sp,\n-\tuint32_t subport_profile_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\n-\tmemcpy(&t->subport_profile[subport_profile_id],\n-\t\tsp, sizeof(*sp));\n-\tt->n_subport_profiles++;\n-}\n-\n-static int\n-subport_profile_free_exists(struct rte_eth_dev *dev,\n-\tuint32_t *subport_profile_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\n-\tif (t->n_subport_profiles < TM_MAX_SUBPORT_PROFILE) {\n-\t\t*subport_profile_id = t->n_subport_profiles;\n-\t\treturn 1;\n-\t}\n-\n-\treturn 0;\n-}\n-\n-static void\n-subport_profile_build(struct rte_eth_dev *dev, struct tm_node *np,\n-\tstruct rte_sched_subport_profile_params *sp)\n-{\n-\tuint32_t i;\n-\tmemset(sp, 0, sizeof(*sp));\n-\n-\tsp->tb_rate = np->shaper_profile->params.peak.rate;\n-\tsp->tb_size = np->shaper_profile->params.peak.size;\n-\n-\tfor (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) {\n-\t\tstruct tm_shared_shaper *ss;\n-\t\tstruct tm_shaper_profile *ssp;\n-\n-\t\tss = tm_subport_tc_shared_shaper_get(dev, np, i);\n-\t\tssp = (ss) ? tm_shaper_profile_search(dev,\n-\t\t\tss->shaper_profile_id) :\n-\t\t\tnp->shaper_profile;\n-\t\tsp->tc_rate[i] = ssp->params.peak.rate;\n-\t}\n-\n-\t/* Traffic Class (TC) */\n-\tsp->tc_period = SUBPORT_TC_PERIOD;\n-}\n-\n-static int\n-subport_profiles_generate(struct rte_eth_dev *dev)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_hierarchy *h = &p->soft.tm.h;\n-\tstruct tm_node_list *nl = &h->nodes;\n-\tstruct tm_node *ns;\n-\tuint32_t subport_id;\n-\n-\t/* Objective: Fill in the following fields in struct tm_params:\n-\t *    - subport_profiles\n-\t *    - n_subport_profiles\n-\t *    - subport_to_profile\n-\t */\n-\n-\tsubport_id = 0;\n-\tTAILQ_FOREACH(ns, nl, node) {\n-\t\tif (ns->level != TM_NODE_LEVEL_SUBPORT)\n-\t\t\tcontinue;\n-\n-\t\tstruct rte_sched_subport_profile_params sp;\n-\t\tuint32_t pos;\n-\n-\t\tmemset(&sp, 0, sizeof(sp));\n-\n-\t\tsubport_profile_build(dev, ns, &sp);\n-\n-\t\tif (!subport_profile_exists(dev, &sp, &pos)) {\n-\t\t\tif (!subport_profile_free_exists(dev, &pos))\n-\t\t\t\treturn -1;\n-\n-\t\t\tsubport_profile_install(dev, &sp, pos);\n-\t\t}\n-\n-\t\tsubport_profile_mark(dev, subport_id, pos);\n-\n-\t\tsubport_id++;\n-\t}\n-\n-\treturn 0;\n-}\n-\n-\n-static int\n-hierarchy_commit_check(struct rte_eth_dev *dev, struct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_hierarchy *h = &p->soft.tm.h;\n-\tstruct tm_node_list *nl = &h->nodes;\n-\tstruct tm_shared_shaper_list *ssl = &h->shared_shapers;\n-\tstruct tm_wred_profile_list *wpl = &h->wred_profiles;\n-\tstruct tm_node *nr = tm_root_node_present(dev), *ns, *np, *nt, *nq;\n-\tstruct tm_shared_shaper *ss;\n-\n-\tuint32_t n_pipes_per_subport;\n-\n-\t/* Root node exists. */\n-\tif (nr == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_LEVEL_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* There is at least one subport, max is not exceeded. */\n-\tif (nr->n_children == 0 || nr->n_children > TM_MAX_SUBPORTS)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_LEVEL_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* There is at least one pipe. */\n-\tif (h->n_tm_nodes[TM_NODE_LEVEL_PIPE] == 0)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_LEVEL_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Number of pipes is the same for all subports. Maximum number of pipes\n-\t * per subport is not exceeded.\n-\t */\n-\tn_pipes_per_subport = h->n_tm_nodes[TM_NODE_LEVEL_PIPE] /\n-\t\th->n_tm_nodes[TM_NODE_LEVEL_SUBPORT];\n-\n-\tif (n_pipes_per_subport > TM_MAX_PIPES_PER_SUBPORT)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\tTAILQ_FOREACH(ns, nl, node) {\n-\t\tif (ns->level != TM_NODE_LEVEL_SUBPORT)\n-\t\t\tcontinue;\n-\n-\t\tif (ns->n_children != n_pipes_per_subport)\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t}\n-\n-\t/* Each pipe has exactly 13 TCs, with exactly one TC for each priority */\n-\tTAILQ_FOREACH(np, nl, node) {\n-\t\tuint32_t mask = 0, mask_expected =\n-\t\t\tRTE_LEN2MASK(RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,\n-\t\t\t\tuint32_t);\n-\n-\t\tif (np->level != TM_NODE_LEVEL_PIPE)\n-\t\t\tcontinue;\n-\n-\t\tif (np->n_children != RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE)\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\n-\t\tTAILQ_FOREACH(nt, nl, node) {\n-\t\t\tif (nt->level != TM_NODE_LEVEL_TC ||\n-\t\t\t\tnt->parent_node_id != np->node_id)\n-\t\t\t\tcontinue;\n-\n-\t\t\tmask |= 1 << nt->priority;\n-\t\t}\n-\n-\t\tif (mask != mask_expected)\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t}\n-\n-\t/** Each Strict priority TC has exactly 1 packet queues while\n-\t *\tlowest priority TC (Best-effort) has 4 queues.\n-\t */\n-\tTAILQ_FOREACH(nt, nl, node) {\n-\t\tif (nt->level != TM_NODE_LEVEL_TC)\n-\t\t\tcontinue;\n-\n-\t\tif (nt->n_children != 1 && nt->n_children != RTE_SCHED_BE_QUEUES_PER_PIPE)\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t}\n-\n-\t/**\n-\t * Shared shapers:\n-\t *    -For each TC #i, all pipes in the same subport use the same\n-\t *     shared shaper (or no shared shaper) for their TC#i.\n-\t *    -Each shared shaper needs to have at least one user. All its\n-\t *     users have to be TC nodes with the same priority and the same\n-\t *     subport.\n-\t */\n-\tTAILQ_FOREACH(ns, nl, node) {\n-\t\tstruct tm_shared_shaper *s[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];\n-\t\tuint32_t id;\n-\n-\t\tif (ns->level != TM_NODE_LEVEL_SUBPORT)\n-\t\t\tcontinue;\n-\n-\t\tfor (id = 0; id < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; id++)\n-\t\t\ts[id] = tm_subport_tc_shared_shaper_get(dev, ns, id);\n-\n-\t\tTAILQ_FOREACH(nt, nl, node) {\n-\t\t\tstruct tm_shared_shaper *subport_ss, *tc_ss;\n-\n-\t\t\tif (nt->level != TM_NODE_LEVEL_TC ||\n-\t\t\t\tnt->parent_node->parent_node_id !=\n-\t\t\t\t\tns->node_id)\n-\t\t\t\tcontinue;\n-\n-\t\t\tsubport_ss = s[nt->priority];\n-\t\t\ttc_ss = tm_tc_shared_shaper_get(dev, nt);\n-\n-\t\t\tif (subport_ss == NULL && tc_ss == NULL)\n-\t\t\t\tcontinue;\n-\n-\t\t\tif ((subport_ss == NULL && tc_ss != NULL) ||\n-\t\t\t\t(subport_ss != NULL && tc_ss == NULL) ||\n-\t\t\t\tsubport_ss->shared_shaper_id !=\n-\t\t\t\t\ttc_ss->shared_shaper_id)\n-\t\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\t\tEINVAL,\n-\t\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t\tNULL,\n-\t\t\t\t\trte_strerror(EINVAL));\n-\t\t}\n-\t}\n-\n-\tTAILQ_FOREACH(ss, ssl, node) {\n-\t\tstruct tm_node *nt_any = tm_shared_shaper_get_tc(dev, ss);\n-\t\tuint32_t n_users = 0;\n-\n-\t\tif (nt_any != NULL)\n-\t\t\tTAILQ_FOREACH(nt, nl, node) {\n-\t\t\t\tif (nt->level != TM_NODE_LEVEL_TC ||\n-\t\t\t\t\tnt->priority != nt_any->priority ||\n-\t\t\t\t\tnt->parent_node->parent_node_id !=\n-\t\t\t\t\tnt_any->parent_node->parent_node_id)\n-\t\t\t\t\tcontinue;\n-\n-\t\t\t\tn_users++;\n-\t\t\t}\n-\n-\t\tif (ss->n_users == 0 || ss->n_users != n_users)\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t}\n-\n-\t/* Not too many subport profiles. */\n-\tif (subport_profiles_generate(dev))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\n-\t/* Not too many pipe profiles. */\n-\tif (pipe_profiles_generate(dev))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/**\n-\t * WRED (when used, i.e. at least one WRED profile defined):\n-\t *    -Each WRED profile must have at least one user.\n-\t *    -All leaf nodes must have their private WRED context enabled.\n-\t *    -For each TC #i, all leaf nodes must use the same WRED profile\n-\t *     for their private WRED context.\n-\t */\n-\tif (h->n_wred_profiles) {\n-\t\tstruct tm_wred_profile *wp;\n-\t\tstruct tm_wred_profile *w[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];\n-\t\tuint32_t id;\n-\n-\t\tTAILQ_FOREACH(wp, wpl, node)\n-\t\t\tif (wp->n_users == 0)\n-\t\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\t\tEINVAL,\n-\t\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t\tNULL,\n-\t\t\t\t\trte_strerror(EINVAL));\n-\n-\t\tfor (id = 0; id < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; id++) {\n-\t\t\tw[id] = tm_tc_wred_profile_get(dev, id);\n-\n-\t\t\tif (w[id] == NULL)\n-\t\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\t\tEINVAL,\n-\t\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t\tNULL,\n-\t\t\t\t\trte_strerror(EINVAL));\n-\t\t}\n-\n-\t\tTAILQ_FOREACH(nq, nl, node) {\n-\t\t\tuint32_t id;\n-\n-\t\t\tif (nq->level != TM_NODE_LEVEL_QUEUE)\n-\t\t\t\tcontinue;\n-\n-\t\t\tid = nq->parent_node->priority;\n-\n-\t\t\tif (nq->wred_profile == NULL ||\n-\t\t\t\tnq->wred_profile->wred_profile_id !=\n-\t\t\t\t\tw[id]->wred_profile_id)\n-\t\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\t\tEINVAL,\n-\t\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t\tNULL,\n-\t\t\t\t\trte_strerror(EINVAL));\n-\t\t}\n-\t}\n-\n-\treturn 0;\n-}\n-\n-static void\n-hierarchy_blueprints_create(struct rte_eth_dev *dev)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_params *t = &p->soft.tm.params;\n-\tstruct tm_hierarchy *h = &p->soft.tm.h;\n-\n-\tstruct tm_node_list *nl = &h->nodes;\n-\tstruct tm_node *root = tm_root_node_present(dev), *n;\n-\n-\tuint32_t subport_id;\n-\n-\tt->port_params = (struct rte_sched_port_params) {\n-\t\t.name = dev->data->name,\n-\t\t.socket = dev->data->numa_node,\n-\t\t.rate = root->shaper_profile->params.peak.rate,\n-\t\t.mtu = dev->data->mtu,\n-\t\t.frame_overhead =\n-\t\t\troot->shaper_profile->params.pkt_length_adjust,\n-\t\t.n_subports_per_port = root->n_children,\n-\t\t.n_subport_profiles = t->n_subport_profiles,\n-\t\t.subport_profiles = t->subport_profile,\n-\t\t.n_max_subport_profiles = TM_MAX_SUBPORT_PROFILE,\n-\t\t.n_pipes_per_subport = TM_MAX_PIPES_PER_SUBPORT,\n-\t};\n-\n-\tsubport_id = 0;\n-\tTAILQ_FOREACH(n, nl, node) {\n-\n-\t\tif (n->level != TM_NODE_LEVEL_SUBPORT)\n-\t\t\tcontinue;\n-\n-\t\tt->subport_params[subport_id] =\n-\t\t\t(struct rte_sched_subport_params) {\n-\t\t\t\t.n_pipes_per_subport_enabled =\n-\t\t\t\t\th->n_tm_nodes[TM_NODE_LEVEL_PIPE] /\n-\t\t\t\t\th->n_tm_nodes[TM_NODE_LEVEL_SUBPORT],\n-\t\t\t\t.qsize = {p->params.tm.qsize[0],\n-\t\t\t\t\tp->params.tm.qsize[1],\n-\t\t\t\t\tp->params.tm.qsize[2],\n-\t\t\t\t\tp->params.tm.qsize[3],\n-\t\t\t\t\tp->params.tm.qsize[4],\n-\t\t\t\t\tp->params.tm.qsize[5],\n-\t\t\t\t\tp->params.tm.qsize[6],\n-\t\t\t\t\tp->params.tm.qsize[7],\n-\t\t\t\t\tp->params.tm.qsize[8],\n-\t\t\t\t\tp->params.tm.qsize[9],\n-\t\t\t\t\tp->params.tm.qsize[10],\n-\t\t\t\t\tp->params.tm.qsize[11],\n-\t\t\t\t\tp->params.tm.qsize[12],\n-\t\t\t\t},\n-\t\t\t\t.pipe_profiles = t->pipe_profiles,\n-\t\t\t\t.n_pipe_profiles = t->n_pipe_profiles,\n-\t\t\t\t.n_max_pipe_profiles = TM_MAX_PIPE_PROFILE,\n-\t\t};\n-\t\twred_profiles_set(dev, subport_id);\n-\t\tsubport_id++;\n-\t}\n-}\n-\n-/* Traffic manager hierarchy commit */\n-static int\n-pmd_tm_hierarchy_commit(struct rte_eth_dev *dev,\n-\tint clear_on_fail,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tint status;\n-\n-\t/* Checks */\n-\tif (p->soft.tm.hierarchy_frozen)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEBUSY,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EBUSY));\n-\n-\tstatus = hierarchy_commit_check(dev, error);\n-\tif (status) {\n-\t\tif (clear_on_fail)\n-\t\t\ttm_hierarchy_free(p);\n-\n-\t\treturn status;\n-\t}\n-\n-\t/* Create blueprints */\n-\thierarchy_blueprints_create(dev);\n-\n-\t/* Freeze hierarchy */\n-\tp->soft.tm.hierarchy_frozen = 1;\n-\n-\treturn 0;\n-}\n-\n-static int\n-update_pipe_weight(struct rte_eth_dev *dev, struct tm_node *np, uint32_t weight)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tuint32_t pipe_id = tm_node_pipe_id(dev, np);\n-\n-\tstruct tm_node *ns = np->parent_node;\n-\tuint32_t subport_id = tm_node_subport_id(dev, ns);\n-\n-\tstruct rte_sched_pipe_params *profile0 = pipe_profile_get(dev, np);\n-\tstruct rte_sched_pipe_params profile1;\n-\tuint32_t pipe_profile_id;\n-\n-\t/* Derive new pipe profile. */\n-\tmemcpy(&profile1, profile0, sizeof(profile1));\n-\tprofile1.tc_ov_weight = (uint8_t)weight;\n-\n-\t/* Since implementation does not allow adding more pipe profiles after\n-\t * port configuration, the pipe configuration can be successfully\n-\t * updated only if the new profile is also part of the existing set of\n-\t * pipe profiles.\n-\t */\n-\tif (pipe_profile_exists(dev, &profile1, &pipe_profile_id) == 0)\n-\t\treturn -1;\n-\n-\t/* Update the pipe profile used by the current pipe. */\n-\tif (rte_sched_pipe_config(SCHED(p), subport_id, pipe_id,\n-\t\t(int32_t)pipe_profile_id))\n-\t\treturn -1;\n-\n-\t/* Commit changes. */\n-\tpipe_profile_mark(dev, subport_id, pipe_id, pipe_profile_id);\n-\tnp->weight = weight;\n-\n-\treturn 0;\n-}\n-\n-static int\n-update_queue_weight(struct rte_eth_dev *dev,\n-\tstruct tm_node *nq, uint32_t weight)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tuint32_t queue_id = tm_node_queue_id(dev, nq);\n-\n-\tstruct tm_node *nt = nq->parent_node;\n-\n-\tstruct tm_node *np = nt->parent_node;\n-\tuint32_t pipe_id = tm_node_pipe_id(dev, np);\n-\n-\tstruct tm_node *ns = np->parent_node;\n-\tuint32_t subport_id = tm_node_subport_id(dev, ns);\n-\n-\tuint32_t pipe_be_queue_id =\n-\t\tqueue_id - RTE_SCHED_TRAFFIC_CLASS_BE;\n-\n-\tstruct rte_sched_pipe_params *profile0 = pipe_profile_get(dev, np);\n-\tstruct rte_sched_pipe_params profile1;\n-\tuint32_t pipe_profile_id;\n-\n-\t/* Derive new pipe profile. */\n-\tmemcpy(&profile1, profile0, sizeof(profile1));\n-\tprofile1.wrr_weights[pipe_be_queue_id] = (uint8_t)weight;\n-\n-\t/* Since implementation does not allow adding more pipe profiles after\n-\t * port configuration, the pipe configuration can be successfully\n-\t * updated only if the new profile is also part of the existing set\n-\t * of pipe profiles.\n-\t */\n-\tif (pipe_profile_exists(dev, &profile1, &pipe_profile_id) == 0)\n-\t\treturn -1;\n-\n-\t/* Update the pipe profile used by the current pipe. */\n-\tif (rte_sched_pipe_config(SCHED(p), subport_id, pipe_id,\n-\t\t(int32_t)pipe_profile_id))\n-\t\treturn -1;\n-\n-\t/* Commit changes. */\n-\tpipe_profile_mark(dev, subport_id, pipe_id, pipe_profile_id);\n-\tnq->weight = weight;\n-\n-\treturn 0;\n-}\n-\n-/* Traffic manager node parent update */\n-static int\n-pmd_tm_node_parent_update(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tuint32_t parent_node_id,\n-\tuint32_t priority,\n-\tuint32_t weight,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct tm_node *n;\n-\n-\t/* Port must be started and TM used. */\n-\tif (dev->data->dev_started == 0 && (tm_used(dev) == 0))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEBUSY,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EBUSY));\n-\n-\t/* Node must be valid */\n-\tn = tm_node_search(dev, node_id);\n-\tif (n == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Parent node must be the same */\n-\tif (n->parent_node_id != parent_node_id)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Priority must be the same */\n-\tif (n->priority != priority)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_PRIORITY,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* weight: must be 1 .. 255 */\n-\tif (weight == 0 || weight >= UINT8_MAX)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_WEIGHT,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\tswitch (n->level) {\n-\tcase TM_NODE_LEVEL_PORT:\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_WEIGHT,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\t\t/* fall-through */\n-\tcase TM_NODE_LEVEL_SUBPORT:\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_WEIGHT,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\t\t/* fall-through */\n-\tcase TM_NODE_LEVEL_PIPE:\n-\t\tif (update_pipe_weight(dev, n, weight))\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t\treturn 0;\n-\t\t/* fall-through */\n-\tcase TM_NODE_LEVEL_TC:\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_WEIGHT,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\t\t/* fall-through */\n-\tcase TM_NODE_LEVEL_QUEUE:\n-\t\t/* fall-through */\n-\tdefault:\n-\t\tif (update_queue_weight(dev, n, weight))\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t\treturn 0;\n-\t}\n-}\n-\n-static int\n-update_subport_rate(struct rte_eth_dev *dev,\n-\tstruct tm_node *ns,\n-\tstruct tm_shaper_profile *sp)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tuint32_t subport_id = tm_node_subport_id(dev, ns);\n-\n-\tstruct rte_sched_subport_profile_params *profile0 =\n-\t\t\t\t\tsubport_profile_get(dev, ns);\n-\tstruct rte_sched_subport_profile_params profile1;\n-\tuint32_t subport_profile_id;\n-\n-\tif (profile0 == NULL)\n-\t\treturn -1;\n-\n-\t/* Derive new pipe profile. */\n-\tmemcpy(&profile1, profile0, sizeof(profile1));\n-\tprofile1.tb_rate = sp->params.peak.rate;\n-\tprofile1.tb_size = sp->params.peak.size;\n-\n-\t/* Since implementation does not allow adding more subport profiles\n-\t * after port configuration, the pipe configuration can be successfully\n-\t * updated only if the new profile is also part of the existing set of\n-\t * pipe profiles.\n-\t */\n-\tif (subport_profile_exists(dev, &profile1, &subport_profile_id) == 0)\n-\t\treturn -1;\n-\n-\t/* Update the subport configuration. */\n-\tif (rte_sched_subport_config(SCHED(p), subport_id,\n-\t\tNULL, subport_profile_id))\n-\t\treturn -1;\n-\n-\t/* Commit changes. */\n-\tns->shaper_profile->n_users--;\n-\n-\tns->shaper_profile = sp;\n-\tns->params.shaper_profile_id = sp->shaper_profile_id;\n-\tsp->n_users++;\n-\n-\tsubport_profile_mark(dev, subport_id, subport_profile_id);\n-\n-\tmemcpy(&p->soft.tm.params.subport_profile[subport_profile_id],\n-\t\t&profile1,\n-\t\tsizeof(profile1));\n-\n-\treturn 0;\n-}\n-\n-static int\n-update_pipe_rate(struct rte_eth_dev *dev,\n-\tstruct tm_node *np,\n-\tstruct tm_shaper_profile *sp)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tuint32_t pipe_id = tm_node_pipe_id(dev, np);\n-\n-\tstruct tm_node *ns = np->parent_node;\n-\tuint32_t subport_id = tm_node_subport_id(dev, ns);\n-\n-\tstruct rte_sched_pipe_params *profile0 = pipe_profile_get(dev, np);\n-\tstruct rte_sched_pipe_params profile1;\n-\tuint32_t pipe_profile_id;\n-\n-\t/* Derive new pipe profile. */\n-\tmemcpy(&profile1, profile0, sizeof(profile1));\n-\tprofile1.tb_rate = sp->params.peak.rate;\n-\tprofile1.tb_size = sp->params.peak.size;\n-\n-\t/* Since implementation does not allow adding more pipe profiles after\n-\t * port configuration, the pipe configuration can be successfully\n-\t * updated only if the new profile is also part of the existing set of\n-\t * pipe profiles.\n-\t */\n-\tif (pipe_profile_exists(dev, &profile1, &pipe_profile_id) == 0)\n-\t\treturn -1;\n-\n-\t/* Update the pipe profile used by the current pipe. */\n-\tif (rte_sched_pipe_config(SCHED(p), subport_id, pipe_id,\n-\t\t(int32_t)pipe_profile_id))\n-\t\treturn -1;\n-\n-\t/* Commit changes. */\n-\tpipe_profile_mark(dev, subport_id, pipe_id, pipe_profile_id);\n-\tnp->shaper_profile->n_users--;\n-\tnp->shaper_profile = sp;\n-\tnp->params.shaper_profile_id = sp->shaper_profile_id;\n-\tsp->n_users++;\n-\n-\treturn 0;\n-}\n-\n-static int\n-update_tc_rate(struct rte_eth_dev *dev,\n-\tstruct tm_node *nt,\n-\tstruct tm_shaper_profile *sp)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tuint32_t tc_id = tm_node_tc_id(dev, nt);\n-\n-\tstruct tm_node *np = nt->parent_node;\n-\tuint32_t pipe_id = tm_node_pipe_id(dev, np);\n-\n-\tstruct tm_node *ns = np->parent_node;\n-\tuint32_t subport_id = tm_node_subport_id(dev, ns);\n-\n-\tstruct rte_sched_pipe_params *profile0 = pipe_profile_get(dev, np);\n-\tstruct rte_sched_pipe_params profile1;\n-\tuint32_t pipe_profile_id;\n-\n-\t/* Derive new pipe profile. */\n-\tmemcpy(&profile1, profile0, sizeof(profile1));\n-\tprofile1.tc_rate[tc_id] = sp->params.peak.rate;\n-\n-\t/* Since implementation does not allow adding more pipe profiles after\n-\t * port configuration, the pipe configuration can be successfully\n-\t * updated only if the new profile is also part of the existing set of\n-\t * pipe profiles.\n-\t */\n-\tif (pipe_profile_exists(dev, &profile1, &pipe_profile_id) == 0)\n-\t\treturn -1;\n-\n-\t/* Update the pipe profile used by the current pipe. */\n-\tif (rte_sched_pipe_config(SCHED(p), subport_id, pipe_id,\n-\t\t(int32_t)pipe_profile_id))\n-\t\treturn -1;\n-\n-\t/* Commit changes. */\n-\tpipe_profile_mark(dev, subport_id, pipe_id, pipe_profile_id);\n-\tnt->shaper_profile->n_users--;\n-\tnt->shaper_profile = sp;\n-\tnt->params.shaper_profile_id = sp->shaper_profile_id;\n-\tsp->n_users++;\n-\n-\treturn 0;\n-}\n-\n-/* Traffic manager node shaper update */\n-static int\n-pmd_tm_node_shaper_update(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tuint32_t shaper_profile_id,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct tm_node *n;\n-\tstruct tm_shaper_profile *sp;\n-\n-\t/* Port must be started and TM used. */\n-\tif (dev->data->dev_started == 0 && (tm_used(dev) == 0))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEBUSY,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EBUSY));\n-\n-\t/* Node must be valid */\n-\tn = tm_node_search(dev, node_id);\n-\tif (n == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\t/* Shaper profile must be valid. */\n-\tsp = tm_shaper_profile_search(dev, shaper_profile_id);\n-\tif (sp == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_SHAPER_PROFILE,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\tswitch (n->level) {\n-\tcase TM_NODE_LEVEL_PORT:\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\t\t/* fall-through */\n-\tcase TM_NODE_LEVEL_SUBPORT:\n-\t\tif (update_subport_rate(dev, n, sp))\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t\treturn 0;\n-\t\t/* fall-through */\n-\tcase TM_NODE_LEVEL_PIPE:\n-\t\tif (update_pipe_rate(dev, n, sp))\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t\treturn 0;\n-\t\t/* fall-through */\n-\tcase TM_NODE_LEVEL_TC:\n-\t\tif (update_tc_rate(dev, n, sp))\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t\treturn 0;\n-\t\t/* fall-through */\n-\tcase TM_NODE_LEVEL_QUEUE:\n-\t\t/* fall-through */\n-\tdefault:\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\t}\n-}\n-\n-static inline uint32_t\n-tm_port_queue_id(struct rte_eth_dev *dev,\n-\tuint32_t port_subport_id,\n-\tuint32_t subport_pipe_id,\n-\tuint32_t pipe_tc_id,\n-\tuint32_t tc_queue_id)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_hierarchy *h = &p->soft.tm.h;\n-\tuint32_t n_pipes_per_subport = h->n_tm_nodes[TM_NODE_LEVEL_PIPE] /\n-\t\t\th->n_tm_nodes[TM_NODE_LEVEL_SUBPORT];\n-\n-\tuint32_t port_pipe_id =\n-\t\tport_subport_id * n_pipes_per_subport + subport_pipe_id;\n-\n-\tuint32_t port_queue_id =\n-\t\tport_pipe_id * RTE_SCHED_QUEUES_PER_PIPE + pipe_tc_id + tc_queue_id;\n-\n-\treturn port_queue_id;\n-}\n-\n-static int\n-read_port_stats(struct rte_eth_dev *dev,\n-\tstruct tm_node *nr,\n-\tstruct rte_tm_node_stats *stats,\n-\tuint64_t *stats_mask,\n-\tint clear)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct tm_hierarchy *h = &p->soft.tm.h;\n-\tuint32_t n_subports_per_port = h->n_tm_nodes[TM_NODE_LEVEL_SUBPORT];\n-\tuint32_t subport_id;\n-\n-\tfor (subport_id = 0; subport_id < n_subports_per_port; subport_id++) {\n-\t\tstruct rte_sched_subport_stats s;\n-\t\tuint32_t tc_ov, id;\n-\n-\t\t/* Stats read */\n-\t\tint status = rte_sched_subport_read_stats(SCHED(p),\n-\t\t\tsubport_id,\n-\t\t\t&s,\n-\t\t\t&tc_ov);\n-\t\tif (status)\n-\t\t\treturn status;\n-\n-\t\t/* Stats accumulate */\n-\t\tfor (id = 0; id < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; id++) {\n-\t\t\tnr->stats.n_pkts +=\n-\t\t\t\ts.n_pkts_tc[id] - s.n_pkts_tc_dropped[id];\n-\t\t\tnr->stats.n_bytes +=\n-\t\t\t\ts.n_bytes_tc[id] - s.n_bytes_tc_dropped[id];\n-\t\t\tnr->stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN] +=\n-\t\t\t\ts.n_pkts_tc_dropped[id];\n-\t\t\tnr->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] +=\n-\t\t\t\ts.n_bytes_tc_dropped[id];\n-\t\t}\n-\t}\n-\n-\t/* Stats copy */\n-\tif (stats)\n-\t\tmemcpy(stats, &nr->stats, sizeof(*stats));\n-\n-\tif (stats_mask)\n-\t\t*stats_mask = STATS_MASK_DEFAULT;\n-\n-\t/* Stats clear */\n-\tif (clear)\n-\t\tmemset(&nr->stats, 0, sizeof(nr->stats));\n-\n-\treturn 0;\n-}\n-\n-static int\n-read_subport_stats(struct rte_eth_dev *dev,\n-\tstruct tm_node *ns,\n-\tstruct rte_tm_node_stats *stats,\n-\tuint64_t *stats_mask,\n-\tint clear)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tuint32_t subport_id = tm_node_subport_id(dev, ns);\n-\tstruct rte_sched_subport_stats s;\n-\tuint32_t tc_ov, tc_id;\n-\n-\t/* Stats read */\n-\tint status = rte_sched_subport_read_stats(SCHED(p),\n-\t\tsubport_id,\n-\t\t&s,\n-\t\t&tc_ov);\n-\tif (status)\n-\t\treturn status;\n-\n-\t/* Stats accumulate */\n-\tfor (tc_id = 0; tc_id < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; tc_id++) {\n-\t\tns->stats.n_pkts +=\n-\t\t\ts.n_pkts_tc[tc_id] - s.n_pkts_tc_dropped[tc_id];\n-\t\tns->stats.n_bytes +=\n-\t\t\ts.n_bytes_tc[tc_id] - s.n_bytes_tc_dropped[tc_id];\n-\t\tns->stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN] +=\n-\t\t\ts.n_pkts_tc_dropped[tc_id];\n-\t\tns->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] +=\n-\t\t\ts.n_bytes_tc_dropped[tc_id];\n-\t}\n-\n-\t/* Stats copy */\n-\tif (stats)\n-\t\tmemcpy(stats, &ns->stats, sizeof(*stats));\n-\n-\tif (stats_mask)\n-\t\t*stats_mask = STATS_MASK_DEFAULT;\n-\n-\t/* Stats clear */\n-\tif (clear)\n-\t\tmemset(&ns->stats, 0, sizeof(ns->stats));\n-\n-\treturn 0;\n-}\n-\n-static int\n-read_pipe_stats(struct rte_eth_dev *dev,\n-\tstruct tm_node *np,\n-\tstruct rte_tm_node_stats *stats,\n-\tuint64_t *stats_mask,\n-\tint clear)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\n-\tuint32_t pipe_id = tm_node_pipe_id(dev, np);\n-\n-\tstruct tm_node *ns = np->parent_node;\n-\tuint32_t subport_id = tm_node_subport_id(dev, ns);\n-\tuint32_t tc_id, queue_id;\n-\tuint32_t i;\n-\n-\t/* Stats read */\n-\tfor (i = 0; i < RTE_SCHED_QUEUES_PER_PIPE; i++) {\n-\t\tstruct rte_sched_queue_stats s;\n-\t\tuint16_t qlen;\n-\n-\t\tif (i < RTE_SCHED_TRAFFIC_CLASS_BE) {\n-\t\t\ttc_id = i;\n-\t\t\tqueue_id = i;\n-\t\t} else {\n-\t\t\ttc_id = RTE_SCHED_TRAFFIC_CLASS_BE;\n-\t\t\tqueue_id = i - tc_id;\n-\t\t}\n-\n-\t\tuint32_t qid = tm_port_queue_id(dev,\n-\t\t\tsubport_id,\n-\t\t\tpipe_id,\n-\t\t\ttc_id,\n-\t\t\tqueue_id);\n-\n-\t\tint status = rte_sched_queue_read_stats(SCHED(p),\n-\t\t\tqid,\n-\t\t\t&s,\n-\t\t\t&qlen);\n-\t\tif (status)\n-\t\t\treturn status;\n-\n-\t\t/* Stats accumulate */\n-\t\tnp->stats.n_pkts += s.n_pkts - s.n_pkts_dropped;\n-\t\tnp->stats.n_bytes += s.n_bytes - s.n_bytes_dropped;\n-\t\tnp->stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN] += s.n_pkts_dropped;\n-\t\tnp->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] +=\n-\t\t\ts.n_bytes_dropped;\n-\t\tnp->stats.leaf.n_pkts_queued = qlen;\n-\t}\n-\n-\t/* Stats copy */\n-\tif (stats)\n-\t\tmemcpy(stats, &np->stats, sizeof(*stats));\n-\n-\tif (stats_mask)\n-\t\t*stats_mask = STATS_MASK_DEFAULT;\n-\n-\t/* Stats clear */\n-\tif (clear)\n-\t\tmemset(&np->stats, 0, sizeof(np->stats));\n-\n-\treturn 0;\n-}\n-\n-static int\n-read_tc_stats(struct rte_eth_dev *dev,\n-\tstruct tm_node *nt,\n-\tstruct rte_tm_node_stats *stats,\n-\tuint64_t *stats_mask,\n-\tint clear)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\n-\tuint32_t tc_id = tm_node_tc_id(dev, nt);\n-\n-\tstruct tm_node *np = nt->parent_node;\n-\tuint32_t pipe_id = tm_node_pipe_id(dev, np);\n-\n-\tstruct tm_node *ns = np->parent_node;\n-\tuint32_t subport_id = tm_node_subport_id(dev, ns);\n-\tstruct rte_sched_queue_stats s;\n-\tuint32_t qid, i;\n-\tuint16_t qlen;\n-\tint status;\n-\n-\t/* Stats read */\n-\tif (tc_id < RTE_SCHED_TRAFFIC_CLASS_BE) {\n-\t\tqid = tm_port_queue_id(dev,\n-\t\t\tsubport_id,\n-\t\t\tpipe_id,\n-\t\t\ttc_id,\n-\t\t\t0);\n-\n-\t\tstatus = rte_sched_queue_read_stats(SCHED(p),\n-\t\t\tqid,\n-\t\t\t&s,\n-\t\t\t&qlen);\n-\t\tif (status)\n-\t\t\treturn status;\n-\n-\t\t/* Stats accumulate */\n-\t\tnt->stats.n_pkts += s.n_pkts - s.n_pkts_dropped;\n-\t\tnt->stats.n_bytes += s.n_bytes - s.n_bytes_dropped;\n-\t\tnt->stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN] += s.n_pkts_dropped;\n-\t\tnt->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] +=\n-\t\t\ts.n_bytes_dropped;\n-\t\tnt->stats.leaf.n_pkts_queued = qlen;\n-\t} else {\n-\t\tfor (i = 0; i < RTE_SCHED_BE_QUEUES_PER_PIPE; i++) {\n-\t\t\tqid = tm_port_queue_id(dev,\n-\t\t\t\tsubport_id,\n-\t\t\t\tpipe_id,\n-\t\t\t\ttc_id,\n-\t\t\t\ti);\n-\n-\t\t\tstatus = rte_sched_queue_read_stats(SCHED(p),\n-\t\t\t\tqid,\n-\t\t\t\t&s,\n-\t\t\t\t&qlen);\n-\t\t\tif (status)\n-\t\t\t\treturn status;\n-\n-\t\t\t/* Stats accumulate */\n-\t\t\tnt->stats.n_pkts += s.n_pkts - s.n_pkts_dropped;\n-\t\t\tnt->stats.n_bytes += s.n_bytes - s.n_bytes_dropped;\n-\t\t\tnt->stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN] +=\n-\t\t\t\ts.n_pkts_dropped;\n-\t\t\tnt->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] +=\n-\t\t\t\ts.n_bytes_dropped;\n-\t\t\tnt->stats.leaf.n_pkts_queued = qlen;\n-\t\t}\n-\t}\n-\n-\t/* Stats copy */\n-\tif (stats)\n-\t\tmemcpy(stats, &nt->stats, sizeof(*stats));\n-\n-\tif (stats_mask)\n-\t\t*stats_mask = STATS_MASK_DEFAULT;\n-\n-\t/* Stats clear */\n-\tif (clear)\n-\t\tmemset(&nt->stats, 0, sizeof(nt->stats));\n-\n-\treturn 0;\n-}\n-\n-static int\n-read_queue_stats(struct rte_eth_dev *dev,\n-\tstruct tm_node *nq,\n-\tstruct rte_tm_node_stats *stats,\n-\tuint64_t *stats_mask,\n-\tint clear)\n-{\n-\tstruct pmd_internals *p = dev->data->dev_private;\n-\tstruct rte_sched_queue_stats s;\n-\tuint16_t qlen;\n-\n-\tuint32_t queue_id = tm_node_queue_id(dev, nq);\n-\n-\tstruct tm_node *nt = nq->parent_node;\n-\tuint32_t tc_id = tm_node_tc_id(dev, nt);\n-\n-\tstruct tm_node *np = nt->parent_node;\n-\tuint32_t pipe_id = tm_node_pipe_id(dev, np);\n-\n-\tstruct tm_node *ns = np->parent_node;\n-\tuint32_t subport_id = tm_node_subport_id(dev, ns);\n-\n-\t/* Stats read */\n-\tuint32_t qid = tm_port_queue_id(dev,\n-\t\tsubport_id,\n-\t\tpipe_id,\n-\t\ttc_id,\n-\t\tqueue_id);\n-\n-\tint status = rte_sched_queue_read_stats(SCHED(p),\n-\t\tqid,\n-\t\t&s,\n-\t\t&qlen);\n-\tif (status)\n-\t\treturn status;\n-\n-\t/* Stats accumulate */\n-\tnq->stats.n_pkts += s.n_pkts - s.n_pkts_dropped;\n-\tnq->stats.n_bytes += s.n_bytes - s.n_bytes_dropped;\n-\tnq->stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN] += s.n_pkts_dropped;\n-\tnq->stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN] +=\n-\t\ts.n_bytes_dropped;\n-\tnq->stats.leaf.n_pkts_queued = qlen;\n-\n-\t/* Stats copy */\n-\tif (stats)\n-\t\tmemcpy(stats, &nq->stats, sizeof(*stats));\n-\n-\tif (stats_mask)\n-\t\t*stats_mask = STATS_MASK_QUEUE;\n-\n-\t/* Stats clear */\n-\tif (clear)\n-\t\tmemset(&nq->stats, 0, sizeof(nq->stats));\n-\n-\treturn 0;\n-}\n-\n-/* Traffic manager read stats counters for specific node */\n-static int\n-pmd_tm_node_stats_read(struct rte_eth_dev *dev,\n-\tuint32_t node_id,\n-\tstruct rte_tm_node_stats *stats,\n-\tuint64_t *stats_mask,\n-\tint clear,\n-\tstruct rte_tm_error *error)\n-{\n-\tstruct tm_node *n;\n-\n-\t/* Port must be started and TM used. */\n-\tif (dev->data->dev_started == 0 && (tm_used(dev) == 0))\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEBUSY,\n-\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EBUSY));\n-\n-\t/* Node must be valid */\n-\tn = tm_node_search(dev, node_id);\n-\tif (n == NULL)\n-\t\treturn -rte_tm_error_set(error,\n-\t\t\tEINVAL,\n-\t\t\tRTE_TM_ERROR_TYPE_NODE_ID,\n-\t\t\tNULL,\n-\t\t\trte_strerror(EINVAL));\n-\n-\tswitch (n->level) {\n-\tcase TM_NODE_LEVEL_PORT:\n-\t\tif (read_port_stats(dev, n, stats, stats_mask, clear))\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t\treturn 0;\n-\n-\tcase TM_NODE_LEVEL_SUBPORT:\n-\t\tif (read_subport_stats(dev, n, stats, stats_mask, clear))\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t\treturn 0;\n-\n-\tcase TM_NODE_LEVEL_PIPE:\n-\t\tif (read_pipe_stats(dev, n, stats, stats_mask, clear))\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t\treturn 0;\n-\n-\tcase TM_NODE_LEVEL_TC:\n-\t\tif (read_tc_stats(dev, n, stats, stats_mask, clear))\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t\treturn 0;\n-\n-\tcase TM_NODE_LEVEL_QUEUE:\n-\tdefault:\n-\t\tif (read_queue_stats(dev, n, stats, stats_mask, clear))\n-\t\t\treturn -rte_tm_error_set(error,\n-\t\t\t\tEINVAL,\n-\t\t\t\tRTE_TM_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\tNULL,\n-\t\t\t\trte_strerror(EINVAL));\n-\t\treturn 0;\n-\t}\n-}\n-\n-const struct rte_tm_ops pmd_tm_ops = {\n-\t.node_type_get = pmd_tm_node_type_get,\n-\t.capabilities_get = pmd_tm_capabilities_get,\n-\t.level_capabilities_get = pmd_tm_level_capabilities_get,\n-\t.node_capabilities_get = pmd_tm_node_capabilities_get,\n-\n-\t.wred_profile_add = pmd_tm_wred_profile_add,\n-\t.wred_profile_delete = pmd_tm_wred_profile_delete,\n-\t.shared_wred_context_add_update = NULL,\n-\t.shared_wred_context_delete = NULL,\n-\n-\t.shaper_profile_add = pmd_tm_shaper_profile_add,\n-\t.shaper_profile_delete = pmd_tm_shaper_profile_delete,\n-\t.shared_shaper_add_update = pmd_tm_shared_shaper_add_update,\n-\t.shared_shaper_delete = pmd_tm_shared_shaper_delete,\n-\n-\t.node_add = pmd_tm_node_add,\n-\t.node_delete = pmd_tm_node_delete,\n-\t.node_suspend = NULL,\n-\t.node_resume = NULL,\n-\t.hierarchy_commit = pmd_tm_hierarchy_commit,\n-\n-\t.node_parent_update = pmd_tm_node_parent_update,\n-\t.node_shaper_update = pmd_tm_node_shaper_update,\n-\t.node_shared_shaper_update = NULL,\n-\t.node_stats_update = NULL,\n-\t.node_wfq_weight_mode_update = NULL,\n-\t.node_cman_update = NULL,\n-\t.node_wred_context_update = NULL,\n-\t.node_shared_wred_context_update = NULL,\n-\n-\t.node_stats_read = pmd_tm_node_stats_read,\n-};\n",
    "prefixes": [
        "V2",
        "01/21"
    ]
}