get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 49126,
    "url": "https://patches.dpdk.org/api/patches/49126/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20181219154237.836-2-reshma.pattan@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20181219154237.836-2-reshma.pattan@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20181219154237.836-2-reshma.pattan@intel.com",
    "date": "2018-12-19T15:42:37",
    "name": "[v6,2/2] mbuf: implement generic format for sched field",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4968b06e136ad4e6add8bd8548665e19eec7f15a",
    "submitter": {
        "id": 70,
        "url": "https://patches.dpdk.org/api/people/70/?format=api",
        "name": "Pattan, Reshma",
        "email": "reshma.pattan@intel.com"
    },
    "delegate": {
        "id": 10018,
        "url": "https://patches.dpdk.org/api/users/10018/?format=api",
        "username": "cristian_dumitrescu",
        "first_name": "Cristian",
        "last_name": "Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20181219154237.836-2-reshma.pattan@intel.com/mbox/",
    "series": [
        {
            "id": 2872,
            "url": "https://patches.dpdk.org/api/series/2872/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=2872",
            "date": "2018-12-19T15:42:36",
            "name": "[v6,1/2] meter: add new rte color definition",
            "version": 6,
            "mbox": "https://patches.dpdk.org/series/2872/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/49126/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/49126/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id F3F581B725;\n\tWed, 19 Dec 2018 16:42:47 +0100 (CET)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id 115CD1B607\n\tfor <dev@dpdk.org>; Wed, 19 Dec 2018 16:42:43 +0100 (CET)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Dec 2018 07:42:43 -0800",
            "from silpixa00398672.ir.intel.com (HELO\n\tsilpixa00398672.ger.corp.intel.com) ([10.237.222.112])\n\tby fmsmga001.fm.intel.com with ESMTP; 19 Dec 2018 07:42:41 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.56,373,1539673200\"; d=\"scan'208\";a=\"131298525\"",
        "From": "Reshma Pattan <reshma.pattan@intel.com>",
        "To": "dev@dpdk.org, jerin.jacob@caviumnetworks.com, nikhil.rao@intel.com,\n\tolivier.matz@6wind.com, thomas@monjalon.net, jasvinder.singh@intel.com,\n\tcristian.dumitrescu@intel.com",
        "Cc": "Reshma Pattan <reshma.pattan@intel.com>",
        "Date": "Wed, 19 Dec 2018 15:42:37 +0000",
        "Message-Id": "<20181219154237.836-2-reshma.pattan@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20181219154237.836-1-reshma.pattan@intel.com>",
        "References": "<20181219153418.52747-1-reshma.pattan@intel.com>\n\t<20181219154237.836-1-reshma.pattan@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v6 2/2] mbuf: implement generic format for sched\n\tfield",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch implements the changes proposed in the deprecation\nnotes [1][2].\n\nlibrte_mbuf changes:\nThe mbuf::hash::sched field is updated to support generic\ndefinition in line with the ethdev TM and MTR APIs. The new generic\nformat contains: queue ID, traffic class, color.\n\nAdded public APIs to set and get these new fields to and from mbuf.\n\nlibrte_sched changes:\nIn addtion, following API functions of the sched library have\nbeen modified with an additional parameter of type struct\nrte_sched_port to accommodate the changes made to mbuf sched field.\n(i)rte_sched_port_pkt_write()\n(ii) rte_sched_port_pkt_read_tree_path()\n\nlibrte_pipeline, qos_sched UT, qos_sched app are updated\nto make use of new changes.\n\nAlso mbuf::hash::txadapter has been added for eventdev txq,\nrte_event_eth_tx_adapter_txq_set and rte_event_eth_tx_adapter_txq_get()\nare updated to use uses mbuf::hash::txadapter.txq.\n\ndoc:\nRelease notes updated.\nRemoved deprecation notice for mbuf::hash::sched and sched API.\n\n[1] http://mails.dpdk.org/archives/dev/2018-February/090651.html\n[2] https://mails.dpdk.org/archives/dev/2018-November/119051.html\n\nSigned-off-by: Jasvinder Singh <jasvinder.singh@intel.com>\nSigned-off-by: Reshma Pattan <reshma.pattan@intel.com>\nAcked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\nv6: added scheduler comment\n\nv5:\nRemoved librte_meter from librte_mbuf dependency list.\nChanged the mbuf set/get functions to use uint8_t for color.\n\nv4: converted mbuf::hash::sched as instantiation of rte_mbuf_sched.\n\nv3: addressed review comments given in the below link.\nhttp://patches.dpdk.org/patch/48587/\nUpdated library ABI versioning in meson build.\n---\n---\n doc/guides/rel_notes/deprecation.rst          |  10 --\n doc/guides/rel_notes/release_19_02.rst        |   4 +-\n examples/qos_sched/app_thread.c               |   7 +-\n examples/qos_sched/main.c                     |   1 +\n .../rte_event_eth_tx_adapter.h                |  18 ++-\n lib/librte_mbuf/Makefile                      |   2 +-\n lib/librte_mbuf/meson.build                   |   2 +-\n lib/librte_mbuf/rte_mbuf.h                    | 119 +++++++++++++++++-\n lib/librte_pipeline/rte_table_action.c        |  44 +++----\n lib/librte_sched/Makefile                     |   2 +-\n lib/librte_sched/meson.build                  |   1 +\n lib/librte_sched/rte_sched.c                  |  90 ++++++-------\n lib/librte_sched/rte_sched.h                  |  10 +-\n test/test/test_sched.c                        |   9 +-\n 14 files changed, 197 insertions(+), 122 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst\nindex ac7fb29a7..ec80dcc7b 100644\n--- a/doc/guides/rel_notes/deprecation.rst\n+++ b/doc/guides/rel_notes/deprecation.rst\n@@ -49,16 +49,6 @@ Deprecation Notices\n   structure would be made internal (or removed if all dependencies are cleared)\n   in future releases.\n \n-* mbuf: The opaque ``mbuf->hash.sched`` field will be updated to support generic\n-  definition in line with the ethdev TM and MTR APIs. Currently, this field\n-  is defined in librte_sched in a non-generic way. The new generic format\n-  will contain: queue ID, traffic class, color. Field size will not change.\n-\n-* sched: Some API functions will change prototype due to the above\n-  deprecation note for mbuf->hash.sched, e.g. ``rte_sched_port_pkt_write()``\n-  and ``rte_sched_port_pkt_read()`` will likely have an additional parameter\n-  of type ``struct rte_sched_port``.\n-\n * mbuf: the macro ``RTE_MBUF_INDIRECT()`` will be removed in v18.08 or later and\n   replaced with ``RTE_MBUF_CLONED()`` which is already added in v18.05. As\n   ``EXT_ATTACHED_MBUF`` is newly introduced in v18.05, ``RTE_MBUF_INDIRECT()``\ndiff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst\nindex 8deb68b9a..1f9ec9fc1 100644\n--- a/doc/guides/rel_notes/release_19_02.rst\n+++ b/doc/guides/rel_notes/release_19_02.rst\n@@ -156,7 +156,7 @@ The libraries prepended with a plus sign were incremented in this version.\n      librte_kvargs.so.1\n      librte_latencystats.so.1\n      librte_lpm.so.2\n-     librte_mbuf.so.4\n+   + librte_mbuf.so.5\n      librte_member.so.1\n      librte_mempool.so.5\n      librte_meter.so.2\n@@ -178,7 +178,7 @@ The libraries prepended with a plus sign were incremented in this version.\n      librte_rawdev.so.1\n      librte_reorder.so.1\n      librte_ring.so.2\n-     librte_sched.so.1\n+   + librte_sched.so.2\n      librte_security.so.1\n      librte_table.so.3\n      librte_timer.so.1\ndiff --git a/examples/qos_sched/app_thread.c b/examples/qos_sched/app_thread.c\nindex a59274236..bec4deee3 100644\n--- a/examples/qos_sched/app_thread.c\n+++ b/examples/qos_sched/app_thread.c\n@@ -73,8 +73,11 @@ app_rx_thread(struct thread_conf **confs)\n \t\t\tfor(i = 0; i < nb_rx; i++) {\n \t\t\t\tget_pkt_sched(rx_mbufs[i],\n \t\t\t\t\t\t&subport, &pipe, &traffic_class, &queue, &color);\n-\t\t\t\trte_sched_port_pkt_write(rx_mbufs[i], subport, pipe,\n-\t\t\t\t\t\ttraffic_class, queue, (enum rte_meter_color) color);\n+\t\t\t\trte_sched_port_pkt_write(conf->sched_port,\n+\t\t\t\t\t\trx_mbufs[i],\n+\t\t\t\t\t\tsubport, pipe,\n+\t\t\t\t\t\ttraffic_class, queue,\n+\t\t\t\t\t\t(enum rte_meter_color) color);\n \t\t\t}\n \n \t\t\tif (unlikely(rte_ring_sp_enqueue_bulk(conf->rx_ring,\ndiff --git a/examples/qos_sched/main.c b/examples/qos_sched/main.c\nindex e7c97bd64..c0ed16b68 100644\n--- a/examples/qos_sched/main.c\n+++ b/examples/qos_sched/main.c\n@@ -55,6 +55,7 @@ app_main_loop(__attribute__((unused))void *dummy)\n \t\t\tflow->rx_thread.rx_port = flow->rx_port;\n \t\t\tflow->rx_thread.rx_ring =  flow->rx_ring;\n \t\t\tflow->rx_thread.rx_queue = flow->rx_queue;\n+\t\t\tflow->rx_thread.sched_port = flow->sched_port;\n \n \t\t\trx_confs[rx_idx++] = &flow->rx_thread;\n \ndiff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h b/lib/librte_eventdev/rte_event_eth_tx_adapter.h\nindex 81456d4a9..2a50656d9 100644\n--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h\n+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h\n@@ -63,13 +63,11 @@\n  * function can be used to retrieve the adapter's service function ID.\n  *\n  * The ethernet port and transmit queue index to transmit the mbuf on are\n- * specified using the mbuf port and the higher 16 bits of\n- * struct rte_mbuf::hash::sched:hi. The application should use the\n- * rte_event_eth_tx_adapter_txq_set() and rte_event_eth_tx_adapter_txq_get()\n- * functions to access the transmit queue index since it is expected that the\n- * transmit queue will be eventually defined within struct rte_mbuf and using\n- * these macros will help with minimizing application impact due to\n- * a change in how the transmit queue index is specified.\n+ * specified using the mbuf port struct rte_mbuf::hash::txadapter:txq.\n+ * The application should use the rte_event_eth_tx_adapter_txq_set()\n+ * and rte_event_eth_tx_adapter_txq_get() functions to access the transmit\n+ * queue index, using these macros will help with minimizing application\n+ * impact due to a change in how the transmit queue index is specified.\n  */\n \n #ifdef __cplusplus\n@@ -300,8 +298,7 @@ rte_event_eth_tx_adapter_queue_del(uint8_t id,\n static __rte_always_inline void __rte_experimental\n rte_event_eth_tx_adapter_txq_set(struct rte_mbuf *pkt, uint16_t queue)\n {\n-\tuint16_t *p = (uint16_t *)&pkt->hash.sched.hi;\n-\tp[1] = queue;\n+\tpkt->hash.txadapter.txq = queue;\n }\n \n /**\n@@ -320,8 +317,7 @@ rte_event_eth_tx_adapter_txq_set(struct rte_mbuf *pkt, uint16_t queue)\n static __rte_always_inline uint16_t __rte_experimental\n rte_event_eth_tx_adapter_txq_get(struct rte_mbuf *pkt)\n {\n-\tuint16_t *p = (uint16_t *)&pkt->hash.sched.hi;\n-\treturn p[1];\n+\treturn pkt->hash.txadapter.txq;\n }\n \n /**\ndiff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile\nindex e2b98a254..8c4c7d790 100644\n--- a/lib/librte_mbuf/Makefile\n+++ b/lib/librte_mbuf/Makefile\n@@ -11,7 +11,7 @@ LDLIBS += -lrte_eal -lrte_mempool\n \n EXPORT_MAP := rte_mbuf_version.map\n \n-LIBABIVER := 4\n+LIBABIVER := 5\n \n # all source are stored in SRCS-y\n SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c rte_mbuf_pool_ops.c\ndiff --git a/lib/librte_mbuf/meson.build b/lib/librte_mbuf/meson.build\nindex 94d9c4c96..e37da0250 100644\n--- a/lib/librte_mbuf/meson.build\n+++ b/lib/librte_mbuf/meson.build\n@@ -1,7 +1,7 @@\n # SPDX-License-Identifier: BSD-3-Clause\n # Copyright(c) 2017 Intel Corporation\n \n-version = 4\n+version = 5\n sources = files('rte_mbuf.c', 'rte_mbuf_ptype.c', 'rte_mbuf_pool_ops.c')\n headers = files('rte_mbuf.h', 'rte_mbuf_ptype.h', 'rte_mbuf_pool_ops.h')\n deps += ['mempool']\ndiff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h\nindex 3dbc6695e..dd69123a1 100644\n--- a/lib/librte_mbuf/rte_mbuf.h\n+++ b/lib/librte_mbuf/rte_mbuf.h\n@@ -468,6 +468,17 @@ __extension__\n typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes\n                                * with a single assignment */\n \n+struct rte_mbuf_sched {\n+\tuint32_t queue_id;   /**< Queue ID. */\n+\tuint8_t traffic_class;\n+\t/**< Traffic class ID. Traffic class 0\n+\t * is the highest priority traffic class.\n+\t */\n+\tuint8_t color;\n+\t/**< Color. @see enum rte_color.*/\n+\tuint16_t reserved;   /**< Reserved. */\n+};\n+\n /**\n  * The generic rte_mbuf, containing a packet mbuf.\n  */\n@@ -574,14 +585,16 @@ struct rte_mbuf {\n \t\t\t\t * on PKT_RX_FDIR_* flag in ol_flags.\n \t\t\t\t */\n \t\t\t} fdir;\t/**< Filter identifier if FDIR enabled */\n+\t\t\tstruct rte_mbuf_sched sched; /**< Hierarchical scheduler */\n \t\t\tstruct {\n-\t\t\t\tuint32_t lo;\n-\t\t\t\tuint32_t hi;\n+\t\t\t\tuint32_t reserved1;\n+\t\t\t\tuint16_t reserved2;\n+\t\t\t\tuint16_t txq;\n \t\t\t\t/**< The event eth Tx adapter uses this field\n \t\t\t\t * to store Tx queue id.\n \t\t\t\t * @see rte_event_eth_tx_adapter_txq_set()\n \t\t\t\t */\n-\t\t\t} sched;          /**< Hierarchical scheduler */\n+\t\t\t} txadapter; /**< Eventdev ethdev Tx adapter */\n \t\t\t/**< User defined tags. See rte_distributor_process() */\n \t\t\tuint32_t usr;\n \t\t} hash;                   /**< hash information */\n@@ -2289,6 +2302,106 @@ rte_pktmbuf_linearize(struct rte_mbuf *mbuf)\n  */\n void rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len);\n \n+/**\n+ * Get the value of mbuf sched queue_id field.\n+ */\n+static inline uint32_t\n+rte_mbuf_sched_queue_get(const struct rte_mbuf *m)\n+{\n+\treturn m->hash.sched.queue_id;\n+}\n+\n+/**\n+ * Get the value of mbuf sched traffic_class field.\n+ */\n+static inline uint8_t\n+rte_mbuf_sched_traffic_class_get(const struct rte_mbuf *m)\n+{\n+\treturn m->hash.sched.traffic_class;\n+}\n+\n+/**\n+ * Get the value of mbuf sched color field.\n+ */\n+static inline uint8_t\n+rte_mbuf_sched_color_get(const struct rte_mbuf *m)\n+{\n+\treturn m->hash.sched.color;\n+}\n+\n+/**\n+ * Get the values of mbuf sched queue_id, traffic_class and color.\n+ * @param m\n+ *   Mbuf to read\n+ * @param queue_id\n+ *  Returns the queue id\n+ * @param traffic_class\n+ *  Returns the traffic class id\n+ * @param color\n+ *  Returns the colour id\n+ */\n+static inline void\n+rte_mbuf_sched_get(const struct rte_mbuf *m, uint32_t *queue_id,\n+\t\t\tuint8_t *traffic_class,\n+\t\t\tuint8_t *color)\n+{\n+\tstruct rte_mbuf_sched sched = m->hash.sched;\n+\n+\t*queue_id = sched.queue_id;\n+\t*traffic_class = sched.traffic_class;\n+\t*color = sched.color;\n+}\n+\n+/**\n+ * Set the mbuf sched queue_id to the defined value.\n+ */\n+static inline void\n+rte_mbuf_sched_queue_set(struct rte_mbuf *m, uint32_t queue_id)\n+{\n+\tm->hash.sched.queue_id = queue_id;\n+}\n+\n+/**\n+ * Set the mbuf sched traffic_class id to the defined value.\n+ */\n+static inline void\n+rte_mbuf_sched_traffic_class_set(struct rte_mbuf *m, uint8_t traffic_class)\n+{\n+\tm->hash.sched.traffic_class = traffic_class;\n+}\n+\n+/**\n+ * Set the mbuf sched color id to the defined value.\n+ */\n+static inline void\n+rte_mbuf_sched_color_set(struct rte_mbuf *m, uint8_t color)\n+{\n+\tm->hash.sched.color = color;\n+}\n+\n+/**\n+ * Set the mbuf sched queue_id, traffic_class and color.\n+ * @param m\n+ *   Mbuf to set\n+ * @param queue_id\n+ *  Queue id value to be set\n+ * @param traffic_class\n+ *  Traffic class id value to be set\n+ * @param color\n+ *  Color id to be set\n+ */\n+static inline void\n+rte_mbuf_sched_set(struct rte_mbuf *m, uint32_t queue_id,\n+\t\t\tuint8_t traffic_class,\n+\t\t\tuint8_t color)\n+{\n+\tm->hash.sched = (struct rte_mbuf_sched){\n+\t\t\t\t.queue_id = queue_id,\n+\t\t\t\t.traffic_class = traffic_class,\n+\t\t\t\t.color = color,\n+\t\t\t};\n+}\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c\nindex 7c7c8dd82..8a2bb13dc 100644\n--- a/lib/librte_pipeline/rte_table_action.c\n+++ b/lib/librte_pipeline/rte_table_action.c\n@@ -107,14 +107,6 @@ mtr_cfg_check(struct rte_table_action_mtr_config *mtr)\n \treturn 0;\n }\n \n-#define MBUF_SCHED_QUEUE_TC_COLOR(queue, tc, color)        \\\n-\t((uint16_t)((((uint64_t)(queue)) & 0x3) |          \\\n-\t((((uint64_t)(tc)) & 0x3) << 2) |                  \\\n-\t((((uint64_t)(color)) & 0x3) << 4)))\n-\n-#define MBUF_SCHED_COLOR(sched, color)                     \\\n-\t(((sched) & (~0x30LLU)) | ((color) << 4))\n-\n struct mtr_trtcm_data {\n \tstruct rte_meter_trtcm trtcm;\n \tuint64_t stats[e_RTE_METER_COLORS];\n@@ -176,7 +168,7 @@ mtr_data_size(struct rte_table_action_mtr_config *mtr)\n struct dscp_table_entry_data {\n \tenum rte_meter_color color;\n \tuint16_t tc;\n-\tuint16_t queue_tc_color;\n+\tuint16_t tc_queue;\n };\n \n struct dscp_table_data {\n@@ -319,8 +311,7 @@ pkt_work_mtr(struct rte_mbuf *mbuf,\n \tuint32_t dscp,\n \tuint16_t total_length)\n {\n-\tuint64_t drop_mask, sched;\n-\tuint64_t *sched_ptr = (uint64_t *) &mbuf->hash.sched;\n+\tuint64_t drop_mask;\n \tstruct dscp_table_entry_data *dscp_entry = &dscp_table->entry[dscp];\n \tenum rte_meter_color color_in, color_meter, color_policer;\n \tuint32_t tc, mp_id;\n@@ -329,7 +320,6 @@ pkt_work_mtr(struct rte_mbuf *mbuf,\n \tcolor_in = dscp_entry->color;\n \tdata += tc;\n \tmp_id = MTR_TRTCM_DATA_METER_PROFILE_ID_GET(data);\n-\tsched = *sched_ptr;\n \n \t/* Meter */\n \tcolor_meter = rte_meter_trtcm_color_aware_check(\n@@ -346,7 +336,7 @@ pkt_work_mtr(struct rte_mbuf *mbuf,\n \tdrop_mask = MTR_TRTCM_DATA_POLICER_ACTION_DROP_GET(data, color_meter);\n \tcolor_policer =\n \t\tMTR_TRTCM_DATA_POLICER_ACTION_COLOR_GET(data, color_meter);\n-\t*sched_ptr = MBUF_SCHED_COLOR(sched, color_policer);\n+\trte_mbuf_sched_color_set(mbuf, (uint8_t)color_policer);\n \n \treturn drop_mask;\n }\n@@ -368,9 +358,8 @@ tm_cfg_check(struct rte_table_action_tm_config *tm)\n }\n \n struct tm_data {\n-\tuint16_t queue_tc_color;\n-\tuint16_t subport;\n-\tuint32_t pipe;\n+\tuint32_t queue_id;\n+\tuint32_t reserved;\n } __attribute__((__packed__));\n \n static int\n@@ -397,9 +386,9 @@ tm_apply(struct tm_data *data,\n \t\treturn status;\n \n \t/* Apply */\n-\tdata->queue_tc_color = 0;\n-\tdata->subport = (uint16_t) p->subport_id;\n-\tdata->pipe = p->pipe_id;\n+\tdata->queue_id = p->subport_id <<\n+\t\t\t\t(__builtin_ctz(cfg->n_pipes_per_subport) + 4) |\n+\t\t\t\tp->pipe_id << 4;\n \n \treturn 0;\n }\n@@ -411,12 +400,11 @@ pkt_work_tm(struct rte_mbuf *mbuf,\n \tuint32_t dscp)\n {\n \tstruct dscp_table_entry_data *dscp_entry = &dscp_table->entry[dscp];\n-\tstruct tm_data *sched_ptr = (struct tm_data *) &mbuf->hash.sched;\n-\tstruct tm_data sched;\n-\n-\tsched = *data;\n-\tsched.queue_tc_color = dscp_entry->queue_tc_color;\n-\t*sched_ptr = sched;\n+\tuint32_t queue_id = data->queue_id |\n+\t\t\t\t(dscp_entry->tc << 2) |\n+\t\t\t\tdscp_entry->tc_queue;\n+\trte_mbuf_sched_set(mbuf, queue_id, dscp_entry->tc,\n+\t\t\t\t(uint8_t)dscp_entry->color);\n }\n \n /**\n@@ -2580,17 +2568,13 @@ rte_table_action_dscp_table_update(struct rte_table_action *action,\n \t\t\t&action->dscp_table.entry[i];\n \t\tstruct rte_table_action_dscp_table_entry *entry =\n \t\t\t&table->entry[i];\n-\t\tuint16_t queue_tc_color =\n-\t\t\tMBUF_SCHED_QUEUE_TC_COLOR(entry->tc_queue_id,\n-\t\t\t\tentry->tc_id,\n-\t\t\t\tentry->color);\n \n \t\tif ((dscp_mask & (1LLU << i)) == 0)\n \t\t\tcontinue;\n \n \t\tdata->color = entry->color;\n \t\tdata->tc = entry->tc_id;\n-\t\tdata->queue_tc_color = queue_tc_color;\n+\t\tdata->tc_queue = entry->tc_queue_id;\n \t}\n \n \treturn 0;\ndiff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile\nindex 46c53ed71..644fd9d15 100644\n--- a/lib/librte_sched/Makefile\n+++ b/lib/librte_sched/Makefile\n@@ -18,7 +18,7 @@ LDLIBS += -lrte_timer\n \n EXPORT_MAP := rte_sched_version.map\n \n-LIBABIVER := 1\n+LIBABIVER := 2\n \n #\n # all source are stored in SRCS-y\ndiff --git a/lib/librte_sched/meson.build b/lib/librte_sched/meson.build\nindex f85d64df8..8e989e5f6 100644\n--- a/lib/librte_sched/meson.build\n+++ b/lib/librte_sched/meson.build\n@@ -1,6 +1,7 @@\n # SPDX-License-Identifier: BSD-3-Clause\n # Copyright(c) 2017 Intel Corporation\n \n+version = 2\n sources = files('rte_sched.c', 'rte_red.c', 'rte_approx.c')\n headers = files('rte_sched.h', 'rte_sched_common.h',\n \t\t'rte_red.h', 'rte_approx.h')\ndiff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c\nindex 587d5e602..dd7739172 100644\n--- a/lib/librte_sched/rte_sched.c\n+++ b/lib/librte_sched/rte_sched.c\n@@ -128,22 +128,6 @@ enum grinder_state {\n \te_GRINDER_READ_MBUF\n };\n \n-/*\n- * Path through the scheduler hierarchy used by the scheduler enqueue\n- * operation to identify the destination queue for the current\n- * packet. Stored in the field pkt.hash.sched of struct rte_mbuf of\n- * each packet, typically written by the classification stage and read\n- * by scheduler enqueue.\n- */\n-struct rte_sched_port_hierarchy {\n-\tuint16_t queue:2;                /**< Queue ID (0 .. 3) */\n-\tuint16_t traffic_class:2;        /**< Traffic class ID (0 .. 3)*/\n-\tuint32_t color:2;                /**< Color */\n-\tuint16_t unused:10;\n-\tuint16_t subport;                /**< Subport ID */\n-\tuint32_t pipe;\t\t         /**< Pipe ID */\n-};\n-\n struct rte_sched_grinder {\n \t/* Pipe cache */\n \tuint16_t pcache_qmask[RTE_SCHED_GRINDER_PCACHE_SIZE];\n@@ -185,6 +169,7 @@ struct rte_sched_port {\n \t/* User parameters */\n \tuint32_t n_subports_per_port;\n \tuint32_t n_pipes_per_subport;\n+\tuint32_t n_pipes_per_subport_log2;\n \tuint32_t rate;\n \tuint32_t mtu;\n \tuint32_t frame_overhead;\n@@ -645,6 +630,8 @@ rte_sched_port_config(struct rte_sched_port_params *params)\n \t/* User parameters */\n \tport->n_subports_per_port = params->n_subports_per_port;\n \tport->n_pipes_per_subport = params->n_pipes_per_subport;\n+\tport->n_pipes_per_subport_log2 =\n+\t\t\t__builtin_ctz(params->n_pipes_per_subport);\n \tport->rate = params->rate;\n \tport->mtu = params->mtu + params->frame_overhead;\n \tport->frame_overhead = params->frame_overhead;\n@@ -1006,44 +993,52 @@ rte_sched_port_pipe_profile_add(struct rte_sched_port *port,\n \treturn 0;\n }\n \n+static inline uint32_t\n+rte_sched_port_qindex(struct rte_sched_port *port,\n+\tuint32_t subport,\n+\tuint32_t pipe,\n+\tuint32_t traffic_class,\n+\tuint32_t queue)\n+{\n+\treturn ((subport & (port->n_subports_per_port - 1)) <<\n+\t\t\t(port->n_pipes_per_subport_log2 + 4)) |\n+\t\t\t((pipe & (port->n_pipes_per_subport - 1)) << 4) |\n+\t\t\t((traffic_class &\n+\t\t\t    (RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE - 1)) << 2) |\n+\t\t\t(queue & (RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS - 1));\n+}\n+\n void\n-rte_sched_port_pkt_write(struct rte_mbuf *pkt,\n-\t\t\t uint32_t subport, uint32_t pipe, uint32_t traffic_class,\n+rte_sched_port_pkt_write(struct rte_sched_port *port,\n+\t\t\t struct rte_mbuf *pkt,\n+\t\t\t uint32_t subport, uint32_t pipe,\n+\t\t\t uint32_t traffic_class,\n \t\t\t uint32_t queue, enum rte_meter_color color)\n {\n-\tstruct rte_sched_port_hierarchy *sched\n-\t\t= (struct rte_sched_port_hierarchy *) &pkt->hash.sched;\n-\n-\tRTE_BUILD_BUG_ON(sizeof(*sched) > sizeof(pkt->hash.sched));\n-\n-\tsched->color = (uint32_t) color;\n-\tsched->subport = subport;\n-\tsched->pipe = pipe;\n-\tsched->traffic_class = traffic_class;\n-\tsched->queue = queue;\n+\tuint32_t queue_id = rte_sched_port_qindex(port, subport, pipe,\n+\t\t\ttraffic_class, queue);\n+\trte_mbuf_sched_set(pkt, queue_id, traffic_class, (uint8_t)color);\n }\n \n void\n-rte_sched_port_pkt_read_tree_path(const struct rte_mbuf *pkt,\n+rte_sched_port_pkt_read_tree_path(struct rte_sched_port *port,\n+\t\t\t\t  const struct rte_mbuf *pkt,\n \t\t\t\t  uint32_t *subport, uint32_t *pipe,\n \t\t\t\t  uint32_t *traffic_class, uint32_t *queue)\n {\n-\tconst struct rte_sched_port_hierarchy *sched\n-\t\t= (const struct rte_sched_port_hierarchy *) &pkt->hash.sched;\n+\tuint32_t queue_id = rte_mbuf_sched_queue_get(pkt);\n \n-\t*subport = sched->subport;\n-\t*pipe = sched->pipe;\n-\t*traffic_class = sched->traffic_class;\n-\t*queue = sched->queue;\n+\t*subport = queue_id >> (port->n_pipes_per_subport_log2 + 4);\n+\t*pipe = (queue_id >> 4) & (port->n_pipes_per_subport - 1);\n+\t*traffic_class = (queue_id >> 2) &\n+\t\t\t\t(RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE - 1);\n+\t*queue = queue_id & (RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS - 1);\n }\n \n enum rte_meter_color\n rte_sched_port_pkt_read_color(const struct rte_mbuf *pkt)\n {\n-\tconst struct rte_sched_port_hierarchy *sched\n-\t\t= (const struct rte_sched_port_hierarchy *) &pkt->hash.sched;\n-\n-\treturn (enum rte_meter_color) sched->color;\n+\treturn (enum rte_meter_color)rte_mbuf_sched_color_get(pkt);\n }\n \n int\n@@ -1100,18 +1095,6 @@ rte_sched_queue_read_stats(struct rte_sched_port *port,\n \treturn 0;\n }\n \n-static inline uint32_t\n-rte_sched_port_qindex(struct rte_sched_port *port, uint32_t subport, uint32_t pipe, uint32_t traffic_class, uint32_t queue)\n-{\n-\tuint32_t result;\n-\n-\tresult = subport * port->n_pipes_per_subport + pipe;\n-\tresult = result * RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE + traffic_class;\n-\tresult = result * RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS + queue;\n-\n-\treturn result;\n-}\n-\n #ifdef RTE_SCHED_DEBUG\n \n static inline int\n@@ -1272,11 +1255,8 @@ rte_sched_port_enqueue_qptrs_prefetch0(struct rte_sched_port *port,\n #ifdef RTE_SCHED_COLLECT_STATS\n \tstruct rte_sched_queue_extra *qe;\n #endif\n-\tuint32_t subport, pipe, traffic_class, queue, qindex;\n-\n-\trte_sched_port_pkt_read_tree_path(pkt, &subport, &pipe, &traffic_class, &queue);\n+\tuint32_t qindex = rte_mbuf_sched_queue_get(pkt);\n \n-\tqindex = rte_sched_port_qindex(port, subport, pipe, traffic_class, queue);\n \tq = port->queue + qindex;\n \trte_prefetch0(q);\n #ifdef RTE_SCHED_COLLECT_STATS\ndiff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h\nindex 84fa896de..243efa1d4 100644\n--- a/lib/librte_sched/rte_sched.h\n+++ b/lib/librte_sched/rte_sched.h\n@@ -355,6 +355,8 @@ rte_sched_queue_read_stats(struct rte_sched_port *port,\n  * Scheduler hierarchy path write to packet descriptor. Typically\n  * called by the packet classification stage.\n  *\n+ * @param port\n+ *   Handle to port scheduler instance\n  * @param pkt\n  *   Packet descriptor handle\n  * @param subport\n@@ -369,7 +371,8 @@ rte_sched_queue_read_stats(struct rte_sched_port *port,\n  *   Packet color set\n  */\n void\n-rte_sched_port_pkt_write(struct rte_mbuf *pkt,\n+rte_sched_port_pkt_write(struct rte_sched_port *port,\n+\t\t\t struct rte_mbuf *pkt,\n \t\t\t uint32_t subport, uint32_t pipe, uint32_t traffic_class,\n \t\t\t uint32_t queue, enum rte_meter_color color);\n \n@@ -379,6 +382,8 @@ rte_sched_port_pkt_write(struct rte_mbuf *pkt,\n  * enqueue operation. The subport, pipe, traffic class and queue\n  * parameters need to be pre-allocated by the caller.\n  *\n+ * @param port\n+ *   Handle to port scheduler instance\n  * @param pkt\n  *   Packet descriptor handle\n  * @param subport\n@@ -392,7 +397,8 @@ rte_sched_port_pkt_write(struct rte_mbuf *pkt,\n  *\n  */\n void\n-rte_sched_port_pkt_read_tree_path(const struct rte_mbuf *pkt,\n+rte_sched_port_pkt_read_tree_path(struct rte_sched_port *port,\n+\t\t\t\t  const struct rte_mbuf *pkt,\n \t\t\t\t  uint32_t *subport, uint32_t *pipe,\n \t\t\t\t  uint32_t *traffic_class, uint32_t *queue);\n \ndiff --git a/test/test/test_sched.c b/test/test/test_sched.c\nindex 32e500ba9..40e411cab 100644\n--- a/test/test/test_sched.c\n+++ b/test/test/test_sched.c\n@@ -76,7 +76,7 @@ create_mempool(void)\n }\n \n static void\n-prepare_pkt(struct rte_mbuf *mbuf)\n+prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf)\n {\n \tstruct ether_hdr *eth_hdr;\n \tstruct vlan_hdr *vlan1, *vlan2;\n@@ -95,7 +95,8 @@ prepare_pkt(struct rte_mbuf *mbuf)\n \tip_hdr->dst_addr = IPv4(0,0,TC,QUEUE);\n \n \n-\trte_sched_port_pkt_write(mbuf, SUBPORT, PIPE, TC, QUEUE, e_RTE_METER_YELLOW);\n+\trte_sched_port_pkt_write(port, mbuf, SUBPORT, PIPE, TC, QUEUE,\n+\t\t\t\t\te_RTE_METER_YELLOW);\n \n \t/* 64 byte packet */\n \tmbuf->pkt_len  = 60;\n@@ -138,7 +139,7 @@ test_sched(void)\n \tfor (i = 0; i < 10; i++) {\n \t\tin_mbufs[i] = rte_pktmbuf_alloc(mp);\n \t\tTEST_ASSERT_NOT_NULL(in_mbufs[i], \"Packet allocation failed\\n\");\n-\t\tprepare_pkt(in_mbufs[i]);\n+\t\tprepare_pkt(port, in_mbufs[i]);\n \t}\n \n \n@@ -155,7 +156,7 @@ test_sched(void)\n \t\tcolor = rte_sched_port_pkt_read_color(out_mbufs[i]);\n \t\tTEST_ASSERT_EQUAL(color, e_RTE_METER_YELLOW, \"Wrong color\\n\");\n \n-\t\trte_sched_port_pkt_read_tree_path(out_mbufs[i],\n+\t\trte_sched_port_pkt_read_tree_path(port, out_mbufs[i],\n \t\t\t\t&subport, &pipe, &traffic_class, &queue);\n \n \t\tTEST_ASSERT_EQUAL(subport, SUBPORT, \"Wrong subport\\n\");\n",
    "prefixes": [
        "v6",
        "2/2"
    ]
}