get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 117577,
    "url": "http://patches.dpdk.org/api/patches/117577/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20221007172921.3325250-3-andrew.rybchenko@oktetlabs.ru/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20221007172921.3325250-3-andrew.rybchenko@oktetlabs.ru>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221007172921.3325250-3-andrew.rybchenko@oktetlabs.ru",
    "date": "2022-10-07T17:29:19",
    "name": "[v8,2/4] ethdev: support multiple mbuf pools per Rx queue",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "94df9e76d3b44d2bd9c0c3f9628abedc3d3643af",
    "submitter": {
        "id": 2013,
        "url": "http://patches.dpdk.org/api/people/2013/?format=api",
        "name": "Andrew Rybchenko",
        "email": "Andrew.Rybchenko@oktetlabs.ru"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20221007172921.3325250-3-andrew.rybchenko@oktetlabs.ru/mbox/",
    "series": [
        {
            "id": 25036,
            "url": "http://patches.dpdk.org/api/series/25036/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=25036",
            "date": "2022-10-07T17:29:17",
            "name": "ethdev: support mulitiple mbuf pools per Rx queue",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/25036/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/117577/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/117577/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 BA27FA00C4;\n\tFri,  7 Oct 2022 19:29:34 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 5A8A9427F4;\n\tFri,  7 Oct 2022 19:29:26 +0200 (CEST)",
            "from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113])\n by mails.dpdk.org (Postfix) with ESMTP id 25F774113D\n for <dev@dpdk.org>; Fri,  7 Oct 2022 19:29:25 +0200 (CEST)",
            "by shelob.oktetlabs.ru (Postfix, from userid 115)\n id E181E92; Fri,  7 Oct 2022 20:29:24 +0300 (MSK)",
            "from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17])\n by shelob.oktetlabs.ru (Postfix) with ESMTP id 0439B7F;\n Fri,  7 Oct 2022 20:29:23 +0300 (MSK)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.6 (2021-04-09) on mail1.oktetlabs.ru",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD\n autolearn=no autolearn_force=no version=3.4.6",
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 0439B7F",
        "Authentication-Results": "shelob.oktetlabs.ru/0439B7F; dkim=none;\n dkim-atps=neutral",
        "From": "Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>",
        "To": "Thomas Monjalon <thomas@monjalon.net>, Ferruh Yigit <ferruh.yigit@amd.com>",
        "Cc": "dev@dpdk.org,\n\tHanumanth Pothula <hpothula@marvell.com>",
        "Subject": "[PATCH v8 2/4] ethdev: support multiple mbuf pools per Rx queue",
        "Date": "Fri,  7 Oct 2022 20:29:19 +0300",
        "Message-Id": "<20221007172921.3325250-3-andrew.rybchenko@oktetlabs.ru>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20221007172921.3325250-1-andrew.rybchenko@oktetlabs.ru>",
        "References": "<20221006170126.1322852-1-hpothula@marvell.com>\n <20221007172921.3325250-1-andrew.rybchenko@oktetlabs.ru>",
        "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": "From: Hanumanth Pothula <hpothula@marvell.com>\n\nSome of the HW has support for choosing memory pools based on the\npacket's size.\n\nThis is often useful for saving the memory where the application\ncan create a different pool to steer the specific size of the\npacket, thus enabling more efficient usage of memory.\n\nFor example, let's say HW has a capability of three pools,\n - pool-1 size is 2K\n - pool-2 size is > 2K and < 4K\n - pool-3 size is > 4K\nHere,\n        pool-1 can accommodate packets with sizes < 2K\n        pool-2 can accommodate packets with sizes > 2K and < 4K\n        pool-3 can accommodate packets with sizes > 4K\n\nWith multiple mempool capability enabled in SW, an application may\ncreate three pools of different sizes and send them to PMD. Allowing\nPMD to program HW based on the packet lengths. So that packets with\nless than 2K are received on pool-1, packets with lengths between 2K\nand 4K are received on pool-2 and finally packets greater than 4K\nare received on pool-3.\n\nSigned-off-by: Hanumanth Pothula <hpothula@marvell.com>\nSigned-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\n---\n doc/guides/rel_notes/release_22_11.rst |  6 ++\n lib/ethdev/rte_ethdev.c                | 81 ++++++++++++++++++++++----\n lib/ethdev/rte_ethdev.h                | 29 +++++++++\n 3 files changed, 105 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst\nindex e165c45367..df32a6a5e7 100644\n--- a/doc/guides/rel_notes/release_22_11.rst\n+++ b/doc/guides/rel_notes/release_22_11.rst\n@@ -92,6 +92,12 @@ New Features\n   ``rte_eth_cman_config_set()``, ``rte_eth_cman_info_get()``\n   to support congestion management.\n \n+* **Added support for mulitiple mbuf pools per ethdev Rx queue.**\n+\n+  The capability allows application to provide many mempools of different\n+  size and PMD and/or NIC to choose a memory pool based on the packet's\n+  length and/or Rx buffers availability.\n+\n * **Updated Intel iavf driver.**\n \n   * Added flow subscription support.\ndiff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex b3dba291e7..979b02356e 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -1739,6 +1739,41 @@ rte_eth_rx_queue_check_split(const struct rte_eth_rxseg_split *rx_seg,\n \treturn 0;\n }\n \n+static int\n+rte_eth_rx_queue_check_mempools(struct rte_mempool **rx_mempools,\n+\t\t\t       uint16_t n_mempools, uint32_t *min_buf_size,\n+\t\t\t       const struct rte_eth_dev_info *dev_info)\n+{\n+\tuint16_t pool_idx;\n+\tint ret;\n+\n+\tif (n_mempools > dev_info->max_rx_mempools) {\n+\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t       \"Too many Rx mempools %u vs maximum %u\\n\",\n+\t\t\t       n_mempools, dev_info->max_rx_mempools);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (pool_idx = 0; pool_idx < n_mempools; pool_idx++) {\n+\t\tstruct rte_mempool *mp = rx_mempools[pool_idx];\n+\n+\t\tif (mp == NULL) {\n+\t\t\tRTE_ETHDEV_LOG(ERR, \"null Rx mempool pointer\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tret = rte_eth_check_rx_mempool(mp, RTE_PKTMBUF_HEADROOM,\n+\t\t\t\t\t       dev_info->min_rx_bufsize);\n+\t\tif (ret != 0)\n+\t\t\treturn ret;\n+\n+\t\t*min_buf_size = RTE_MIN(*min_buf_size,\n+\t\t\t\t\trte_pktmbuf_data_room_size(mp));\n+\t}\n+\n+\treturn 0;\n+}\n+\n int\n rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,\n \t\t       uint16_t nb_rx_desc, unsigned int socket_id,\n@@ -1746,7 +1781,8 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,\n \t\t       struct rte_mempool *mp)\n {\n \tint ret;\n-\tuint32_t mbp_buf_size;\n+\tuint64_t rx_offloads;\n+\tuint32_t mbp_buf_size = UINT32_MAX;\n \tstruct rte_eth_dev *dev;\n \tstruct rte_eth_dev_info dev_info;\n \tstruct rte_eth_rxconf local_conf;\n@@ -1766,35 +1802,42 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,\n \tif (ret != 0)\n \t\treturn ret;\n \n+\trx_offloads = dev->data->dev_conf.rxmode.offloads;\n+\tif (rx_conf != NULL)\n+\t\trx_offloads |= rx_conf->offloads;\n+\n+\t/* Ensure that we have one and only one source of Rx buffers */\n+\tif ((mp != NULL) +\n+\t    (rx_conf != NULL && rx_conf->rx_nseg > 0) +\n+\t    (rx_conf != NULL && rx_conf->rx_nmempool > 0) != 1) {\n+\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t       \"Ambiguous Rx mempools configuration\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n \tif (mp != NULL) {\n \t\t/* Single pool configuration check. */\n-\t\tif (rx_conf != NULL && rx_conf->rx_nseg != 0) {\n-\t\t\tRTE_ETHDEV_LOG(ERR,\n-\t\t\t\t       \"Ambiguous segment configuration\\n\");\n-\t\t\treturn -EINVAL;\n-\t\t}\n-\n \t\tret = rte_eth_check_rx_mempool(mp, RTE_PKTMBUF_HEADROOM,\n \t\t\t\t\t       dev_info.min_rx_bufsize);\n \t\tif (ret != 0)\n \t\t\treturn ret;\n \n \t\tmbp_buf_size = rte_pktmbuf_data_room_size(mp);\n-\t} else {\n+\t} else if (rx_conf != NULL && rx_conf->rx_nseg > 0) {\n \t\tconst struct rte_eth_rxseg_split *rx_seg;\n \t\tuint16_t n_seg;\n \n \t\t/* Extended multi-segment configuration check. */\n-\t\tif (rx_conf == NULL || rx_conf->rx_seg == NULL || rx_conf->rx_nseg == 0) {\n+\t\tif (rx_conf->rx_seg == NULL) {\n \t\t\tRTE_ETHDEV_LOG(ERR,\n-\t\t\t\t       \"Memory pool is null and no extended configuration provided\\n\");\n+\t\t\t\t       \"Memory pool is null and no multi-segment configuration provided\\n\");\n \t\t\treturn -EINVAL;\n \t\t}\n \n \t\trx_seg = (const struct rte_eth_rxseg_split *)rx_conf->rx_seg;\n \t\tn_seg = rx_conf->rx_nseg;\n \n-\t\tif (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {\n+\t\tif (rx_offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {\n \t\t\tret = rte_eth_rx_queue_check_split(rx_seg, n_seg,\n \t\t\t\t\t\t\t   &mbp_buf_size,\n \t\t\t\t\t\t\t   &dev_info);\n@@ -1804,6 +1847,22 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,\n \t\t\tRTE_ETHDEV_LOG(ERR, \"No Rx segmentation offload configured\\n\");\n \t\t\treturn -EINVAL;\n \t\t}\n+\t} else if (rx_conf != NULL && rx_conf->rx_nmempool > 0) {\n+\t\t/* Extended multi-pool configuration check. */\n+\t\tif (rx_conf->rx_mempools == NULL) {\n+\t\t\tRTE_ETHDEV_LOG(ERR, \"Memory pools array is null\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tret = rte_eth_rx_queue_check_mempools(rx_conf->rx_mempools,\n+\t\t\t\t\t\t     rx_conf->rx_nmempool,\n+\t\t\t\t\t\t     &mbp_buf_size,\n+\t\t\t\t\t\t     &dev_info);\n+\t\tif (ret != 0)\n+\t\t\treturn ret;\n+\t} else {\n+\t\tRTE_ETHDEV_LOG(ERR, \"Missing Rx mempool configuration\\n\");\n+\t\treturn -EINVAL;\n \t}\n \n \t/* Use default specified by driver, if nb_rx_desc is zero */\ndiff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h\nindex 2530eda7c4..d1e44ffa5f 100644\n--- a/lib/ethdev/rte_ethdev.h\n+++ b/lib/ethdev/rte_ethdev.h\n@@ -1067,6 +1067,28 @@ struct rte_eth_rxconf {\n \t */\n \tunion rte_eth_rxseg *rx_seg;\n \n+\t/**\n+\t * Array of mempools to allocate Rx buffers from.\n+\t *\n+\t * This provides support for multiple mbuf pools per Rx queue.\n+\t * The capability is reported in device info via positive\n+\t * max_rx_mempools.\n+\t *\n+\t * It could be useful for more efficient usage of memory when an\n+\t * application creates different mempools to steer the specific\n+\t * size of the packet.\n+\t *\n+\t * If many mempools are specified, packets received using Rx\n+\t * burst may belong to any provided mempool. From ethdev user point\n+\t * of view it is undefined how PMD/NIC chooses mempool for a packet.\n+\t *\n+\t * If Rx scatter is enabled, a packet may be delivered using a chain\n+\t * of mbufs obtained from single mempool or multiple mempools based\n+\t * on the NIC implementation.\n+\t */\n+\tstruct rte_mempool **rx_mempools;\n+\tuint16_t rx_nmempool; /** < Number of Rx mempools */\n+\n \tuint64_t reserved_64s[2]; /**< Reserved for future fields */\n \tvoid *reserved_ptrs[2];   /**< Reserved for future fields */\n };\n@@ -1614,6 +1636,13 @@ struct rte_eth_dev_info {\n \t/** Configured number of Rx/Tx queues */\n \tuint16_t nb_rx_queues; /**< Number of Rx queues. */\n \tuint16_t nb_tx_queues; /**< Number of Tx queues. */\n+\t/**\n+\t * Maximum number of Rx mempools supported per Rx queue.\n+\t *\n+\t * Value greater than 0 means that the driver supports Rx queue\n+\t * mempools specification via rx_conf->rx_mempools.\n+\t */\n+\tuint16_t max_rx_mempools;\n \t/** Rx parameter recommendations */\n \tstruct rte_eth_dev_portconf default_rxportconf;\n \t/** Tx parameter recommendations */\n",
    "prefixes": [
        "v8",
        "2/4"
    ]
}