get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 116835,
    "url": "https://patches.dpdk.org/api/patches/116835/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220926094039.1572741-3-yuanx.wang@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": "<20220926094039.1572741-3-yuanx.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220926094039.1572741-3-yuanx.wang@intel.com",
    "date": "2022-09-26T09:40:37",
    "name": "[v5,2/4] ethdev: introduce protocol hdr based buffer split",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d79cdc968421eb0ba27ca8317d8f75ed762ded71",
    "submitter": {
        "id": 2087,
        "url": "https://patches.dpdk.org/api/people/2087/?format=api",
        "name": "Wang, YuanX",
        "email": "yuanx.wang@intel.com"
    },
    "delegate": {
        "id": 3961,
        "url": "https://patches.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220926094039.1572741-3-yuanx.wang@intel.com/mbox/",
    "series": [
        {
            "id": 24816,
            "url": "https://patches.dpdk.org/api/series/24816/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=24816",
            "date": "2022-09-26T09:40:35",
            "name": "support protocol based buffer split",
            "version": 5,
            "mbox": "https://patches.dpdk.org/series/24816/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/116835/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/116835/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 EC5A3A00C3;\n\tMon, 26 Sep 2022 03:57:19 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DBB50400D7;\n\tMon, 26 Sep 2022 03:57:19 +0200 (CEST)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n by mails.dpdk.org (Postfix) with ESMTP id 5F85F400D4\n for <dev@dpdk.org>; Mon, 26 Sep 2022 03:57:18 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 25 Sep 2022 18:57:17 -0700",
            "from unknown (HELO localhost.localdomain) ([10.239.252.55])\n by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 25 Sep 2022 18:57:12 -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=1664157438; x=1695693438;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=qI/CG0HPh5vdM5yASMDcQWS0UTwATUfc4/vUhrhHSTg=;\n b=OmvmWX1CXt4XmOjweneiHcS70AkKVCGu1yJrpsozpXFCB7sJdELm6cj7\n bnxIe+WMsO8sbfasbq3uwfRv6gdFFAx69NBkXYbdykyBUNZIv1T5LCMdQ\n X5ol53A35KDoxsUK4dKgvjjut6xi0jKedtF1mBicPU9jkMthk71GcQglx\n WqphyCDHo8tiM/CUQX+TzL8cyMjSdnw3ORBauzlQhQlXvYHJSDAgNCRQX\n vPJ2al4NKtdHPojlagVjrrwq7t2Lnd56iUePYMg/hDtnD4PfiRgUNe2GQ\n /q1RFFZ83jLnmfLToeVNsRS24j1bCRjJxV2OMOYh+FasHR2wmR4Ts5hCQ g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10481\"; a=\"387207867\"",
            "E=Sophos;i=\"5.93,345,1654585200\"; d=\"scan'208\";a=\"387207867\"",
            "E=Sophos;i=\"5.93,345,1654585200\"; d=\"scan'208\";a=\"620873456\""
        ],
        "From": "Yuan Wang <yuanx.wang@intel.com>",
        "To": "dev@dpdk.org, Thomas Monjalon <thomas@monjalon.net>,\n Ferruh Yigit <ferruh.yigit@xilinx.com>,\n Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>",
        "Cc": "mdr@ashroe.eu, xiaoyun.li@intel.com, aman.deep.singh@intel.com,\n yuying.zhang@intel.com, qi.z.zhang@intel.com, qiming.yang@intel.com,\n jerinjacobk@gmail.com, viacheslavo@nvidia.com, stephen@networkplumber.org,\n xuan.ding@intel.com, hpothula@marvell.com, yaqi.tang@intel.com,\n Yuan Wang <yuanx.wang@intel.com>, Wenxuan Wu <wenxuanx.wu@intel.com>",
        "Subject": "[PATCH v5 2/4] ethdev: introduce protocol hdr based buffer split",
        "Date": "Mon, 26 Sep 2022 17:40:37 +0800",
        "Message-Id": "<20220926094039.1572741-3-yuanx.wang@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220926094039.1572741-1-yuanx.wang@intel.com>",
        "References": "<20220812181552.2908067-1-yuanx.wang@intel.com>\n <20220926094039.1572741-1-yuanx.wang@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": "Currently, Rx buffer split supports length based split. With Rx queue\noffload RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT enabled and Rx packet segment\nconfigured, PMD will be able to split the received packets into\nmultiple segments.\n\nHowever, length based buffer split is not suitable for NICs that do split\nbased on protocol headers. Given an arbitrarily variable length in Rx\npacket segment, it is almost impossible to pass a fixed protocol header to\ndriver. Besides, the existence of tunneling results in the composition of\na packet is various, which makes the situation even worse.\n\nThis patch extends current buffer split to support protocol header based\nbuffer split. A new proto_hdr field is introduced in the reserved field\nof rte_eth_rxseg_split structure to specify protocol header. The proto_hdr\nfield defines the split position of packet, splitting will always happen\nafter the protocol header defined in the Rx packet segment. When Rx queue\noffload RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT is enabled and corresponding\nprotocol header is configured, driver will split the ingress packets into\nmultiple segments.\n\nExamples for proto_hdr field defines:\nTo split after ETH-IPV4-UDP, it should be defined as\nRTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP\n\nFor inner ETH-IPV4-UDP, it should be defined as\nRTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |\nRTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP\n\nstruct rte_eth_rxseg_split {\n        struct rte_mempool *mp; /* memory pools to allocate segment from */\n        uint16_t length; /* segment maximal data length,\n                            configures split point */\n        uint16_t offset; /* data offset from beginning\n                            of mbuf data buffer */\n        /**\n\t * Proto_hdr defines a bit mask of the protocol sequence as\n         * RTE_PTYPE_*, configures split point. The last RTE_PTYPE*\n         * in the mask indicates the split position.\n\t * For non-tunneling packets, the complete protocol sequence\n         * should be defined.\n\t * For tunneling packets, for simplicity, only the tunnel and\n         * inner protocol sequence should be defined.\n\t */\n        uint32_t proto_hdr;\n};\n\nIf protocol header split can be supported by a PMD, the\nrte_eth_buffer_split_get_supported_hdr_ptypes function can\nbe use to obtain a list of these protocol headers.\n\nFor example, let's suppose we configured the Rx queue with the\nfollowing segments:\n        seg0 - pool0, proto_hdr0=RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4,\n               off0=2B\n        seg1 - pool1, proto_hdr1=RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4\n               | RTE_PTYPE_L4_UDP, off1=128B\n        seg2 - pool2, off1=0B\n\nThe packet consists of ETH_IPV4_UDP_PAYLOAD will be split like\nfollowing:\n        seg0 - ipv4 header @ RTE_PKTMBUF_HEADROOM + 2 in mbuf from pool0\n        seg1 - udp header @ 128 in mbuf from pool1\n        seg2 - payload @ 0 in mbuf from pool2\n\nNote: NIC will only do split when the packets exactly match all the\nprotocol headers in the segments. For example, if ARP packets received\nwith above config, the NIC won't do split for ARP packets since\nit does not contains ipv4 header and udp header. These packets will be put\ninto the last valid mempool, with zero offset.\n\nNow buffer split can be configured in two modes. For length based\nbuffer split, the mp, length, offset field in Rx packet segment should\nbe configured, while the proto_hdr field will be ignored.\nFor protocol header based buffer split, the mp, offset, proto_hdr field\nin Rx packet segment should be configured, while the length field will\nbe ignored.\n\nThe split limitations imposed by underlying driver is reported in the\nrte_eth_dev_info->rx_seg_capa field. The memory attributes for the split\nparts may differ either, dpdk memory and external memory, respectively.\n\nSigned-off-by: Yuan Wang <yuanx.wang@intel.com>\nSigned-off-by: Xuan Ding <xuan.ding@intel.com>\nSigned-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>\n---\n doc/guides/rel_notes/release_22_11.rst |  7 +++\n lib/ethdev/rte_ethdev.c                | 74 ++++++++++++++++++++++----\n lib/ethdev/rte_ethdev.h                | 29 +++++++++-\n 3 files changed, 98 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst\nindex 8e5bdde46a..cce1f6e50c 100644\n--- a/doc/guides/rel_notes/release_22_11.rst\n+++ b/doc/guides/rel_notes/release_22_11.rst\n@@ -64,6 +64,13 @@ New Features\n   Added ``rte_eth_buffer_split_get_supported_hdr_ptypes()``, to get supported\n   header protocols of a PMD to split.\n \n+* **Added protocol header based buffer split.**\n+\n+  Ethdev: The ``reserved`` field in the ``rte_eth_rxseg_split`` structure is\n+  replaced with ``proto_hdr`` to support protocol header based buffer split.\n+  User can choose length or protocol header to configure buffer split\n+  according to NIC's capability.\n+\n \n Removed Items\n -------------\ndiff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex 1f0a7f8f3f..27ec19faed 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -1649,9 +1649,10 @@ rte_eth_dev_is_removed(uint16_t port_id)\n }\n \n static int\n-rte_eth_rx_queue_check_split(const struct rte_eth_rxseg_split *rx_seg,\n-\t\t\t     uint16_t n_seg, uint32_t *mbp_buf_size,\n-\t\t\t     const struct rte_eth_dev_info *dev_info)\n+rte_eth_rx_queue_check_split(uint16_t port_id,\n+\t\t\tconst struct rte_eth_rxseg_split *rx_seg,\n+\t\t\tuint16_t n_seg, uint32_t *mbp_buf_size,\n+\t\t\tconst struct rte_eth_dev_info *dev_info)\n {\n \tconst struct rte_eth_rxseg_capa *seg_capa = &dev_info->rx_seg_capa;\n \tstruct rte_mempool *mp_first;\n@@ -1674,6 +1675,7 @@ rte_eth_rx_queue_check_split(const struct rte_eth_rxseg_split *rx_seg,\n \t\tstruct rte_mempool *mpl = rx_seg[seg_idx].mp;\n \t\tuint32_t length = rx_seg[seg_idx].length;\n \t\tuint32_t offset = rx_seg[seg_idx].offset;\n+\t\tuint32_t proto_hdr = rx_seg[seg_idx].proto_hdr;\n \n \t\tif (mpl == NULL) {\n \t\t\tRTE_ETHDEV_LOG(ERR, \"null mempool pointer\\n\");\n@@ -1707,13 +1709,63 @@ rte_eth_rx_queue_check_split(const struct rte_eth_rxseg_split *rx_seg,\n \t\t}\n \t\toffset += seg_idx != 0 ? 0 : RTE_PKTMBUF_HEADROOM;\n \t\t*mbp_buf_size = rte_pktmbuf_data_room_size(mpl);\n-\t\tlength = length != 0 ? length : *mbp_buf_size;\n-\t\tif (*mbp_buf_size < length + offset) {\n-\t\t\tRTE_ETHDEV_LOG(ERR,\n-\t\t\t\t       \"%s mbuf_data_room_size %u < %u (segment length=%u + segment offset=%u)\\n\",\n-\t\t\t\t       mpl->name, *mbp_buf_size,\n-\t\t\t\t       length + offset, length, offset);\n-\t\t\treturn -EINVAL;\n+\n+\t\tif (proto_hdr > 0) {\n+\t\t\t/* Split based on protocol headers. */\n+\n+\t\t\t/* skip the payload */\n+\t\t\tif (proto_hdr == RTE_PTYPE_ALL_MASK)\n+\t\t\t\tcontinue;\n+\n+\t\t\tint ptype_cnt;\n+\n+\t\t\tptype_cnt = rte_eth_buffer_split_get_supported_hdr_ptypes(port_id, NULL, 0);\n+\t\t\tif (ptype_cnt <= 0) {\n+\t\t\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t\t\t\"Port %u failed to supported buffer split header protocols\\n\",\n+\t\t\t\t\tport_id);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\n+\t\t\tuint32_t ptypes[ptype_cnt];\n+\t\t\tint i;\n+\n+\t\t\tptype_cnt = rte_eth_buffer_split_get_supported_hdr_ptypes(port_id,\n+\t\t\t\t\t\t\t\t\t\tptypes, ptype_cnt);\n+\t\t\tif (ptype_cnt < 0) {\n+\t\t\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t\t\t\"Port %u failed to supported buffer split header protocols\\n\",\n+\t\t\t\t\tport_id);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\n+\t\t\tfor (i = 0; i < ptype_cnt; i++)\n+\t\t\t\tif (ptypes[i] == proto_hdr)\n+\t\t\t\t\tbreak;\n+\t\t\tif (i == ptype_cnt) {\n+\t\t\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t\t\t\"Requested Rx split header protocols 0x%x is not supported.\\n\",\n+\t\t\t\t\tproto_hdr);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\n+\t\t\tif (*mbp_buf_size < offset) {\n+\t\t\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t\t\t\t\"%s mbuf_data_room_size %u < %u segment offset)\\n\",\n+\t\t\t\t\t\tmpl->name, *mbp_buf_size,\n+\t\t\t\t\t\toffset);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t} else {\n+\t\t\t/* Split at fixed length. */\n+\t\t\tlength = length != 0 ? length : *mbp_buf_size;\n+\t\t\tif (*mbp_buf_size < length + offset) {\n+\t\t\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t\t\t\"%s mbuf_data_room_size %u < %u (segment length=%u + segment offset=%u)\\n\",\n+\t\t\t\t\tmpl->name, *mbp_buf_size,\n+\t\t\t\t\tlength + offset, length, offset);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n \t\t}\n \t}\n \treturn 0;\n@@ -1793,7 +1845,7 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,\n \t\tn_seg = rx_conf->rx_nseg;\n \n \t\tif (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) {\n-\t\t\tret = rte_eth_rx_queue_check_split(rx_seg, n_seg,\n+\t\t\tret = rte_eth_rx_queue_check_split(port_id, 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 \t\t\tif (ret != 0)\ndiff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h\nindex c440e3863a..ba7c11f735 100644\n--- a/lib/ethdev/rte_ethdev.h\n+++ b/lib/ethdev/rte_ethdev.h\n@@ -994,6 +994,9 @@ struct rte_eth_txmode {\n  *   specified in the first array element, the second buffer, from the\n  *   pool in the second element, and so on.\n  *\n+ * - The proto_hdrs in the elements define the split position of\n+ *   received packets.\n+ *\n  * - The offsets from the segment description elements specify\n  *   the data offset from the buffer beginning except the first mbuf.\n  *   The first segment offset is added with RTE_PKTMBUF_HEADROOM.\n@@ -1015,12 +1018,36 @@ struct rte_eth_txmode {\n  *     - pool from the last valid element\n  *     - the buffer size from this pool\n  *     - zero offset\n+ *\n+ * - Length based buffer split:\n+ *     - mp, length, offset should be configured.\n+ *     - The proto_hdr field will be ignored.\n+ *\n+ * - Protocol header based buffer split:\n+ *     - mp, offset, proto_hdr should be configured.\n+ *     - The length field will be ignored.\n+ *\n+ * - For Protocol header based buffer split, if the received packets\n+ *   don't exactly match all protocol headers in the elements, packets\n+ *   will not be split.\n+ *   These packets will be put into:\n+ *     - pool from the last valid element\n+ *     - the buffer size from this pool\n+ *     - zero offset\n  */\n struct rte_eth_rxseg_split {\n \tstruct rte_mempool *mp; /**< Memory pool to allocate segment from. */\n \tuint16_t length; /**< Segment data length, configures split point. */\n \tuint16_t offset; /**< Data offset from beginning of mbuf data buffer. */\n-\tuint32_t reserved; /**< Reserved field. */\n+\t/**\n+\t * Proto_hdr defines a bit mask of the protocol sequence as RTE_PTYPE_*,\n+\t * configures split point. The last RTE_PTYPE* in the mask indicates the\n+\t * split position.\n+\t * For non-tunneling packets, the complete protocol sequence should be defined.\n+\t * For tunneling packets, for simplicity, only the tunnel and inner\n+\t * protocol sequence should be defined.\n+\t */\n+\tuint32_t proto_hdr;\n };\n \n /**\n",
    "prefixes": [
        "v5",
        "2/4"
    ]
}