get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 117391,
    "url": "http://patches.dpdk.org/api/patches/117391/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20221005231836.215112-3-yuanx.wang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20221005231836.215112-3-yuanx.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221005231836.215112-3-yuanx.wang@intel.com",
    "date": "2022-10-05T23:18:34",
    "name": "[v8,2/4] ethdev: introduce protocol hdr based buffer split",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "c877cc1233d58394f8c12c367c4a2e716fbbbfc9",
    "submitter": {
        "id": 2087,
        "url": "http://patches.dpdk.org/api/people/2087/?format=api",
        "name": "Wang, YuanX",
        "email": "yuanx.wang@intel.com"
    },
    "delegate": {
        "id": 3961,
        "url": "http://patches.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20221005231836.215112-3-yuanx.wang@intel.com/mbox/",
    "series": [
        {
            "id": 24991,
            "url": "http://patches.dpdk.org/api/series/24991/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=24991",
            "date": "2022-10-05T23:18:32",
            "name": "support protocol based buffer split",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/24991/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/117391/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/117391/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 CD000A0543;\n\tWed,  5 Oct 2022 17:31:56 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B5655427EE;\n\tWed,  5 Oct 2022 17:31:56 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id 9D474427F7\n for <dev@dpdk.org>; Wed,  5 Oct 2022 17:31:54 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 05 Oct 2022 08:31:53 -0700",
            "from unknown (HELO localhost.localdomain) ([10.239.252.55])\n by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 05 Oct 2022 08:31:48 -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=1664983914; x=1696519914;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=FlO6GdIAulPCcNXw+NOl66yEsFU4WYA4kbo2NHRzHE8=;\n b=fSp4sXdkK3Xgs70g+qEmHqHuFDozRkIPkJkCN7lEjzYEJthGRYJSy8J4\n l2C3bSQaK2xhMTWQgIC/4X9UBOdy0ZfuNdlZ9WvFXuS8Qr4U3Ormkb4QI\n 4rQgV6JNoJ6TY6MGgt2g/pwfMXzxnzoumTWUXa2/LUdEvOXtRW4i60aRv\n CNxRP15p+gdyNJ3AyxgbhpX3dmJPoRvfqlkaTnom6NCyXaaC7Y0X5SFiZ\n 4ymP4YYo605bz4YpYdIwnY1nIqNTQ3x1CJpElgMpcmYRRcvytu7zH3ghu\n Qi9gPgvPmbqB3mI4yPQlTB/ae8rgvaw2/RHgfwZjSs5X6YX2tnjibGw0z Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10491\"; a=\"303165939\"",
            "E=Sophos;i=\"5.95,161,1661842800\"; d=\"scan'208\";a=\"303165939\"",
            "E=McAfee;i=\"6500,9779,10491\"; a=\"869434649\"",
            "E=Sophos;i=\"5.95,161,1661842800\"; d=\"scan'208\";a=\"869434649\""
        ],
        "From": "Yuan Wang <yuanx.wang@intel.com>",
        "To": "dev@dpdk.org, Thomas Monjalon <thomas@monjalon.net>,\n Ferruh Yigit <ferruh.yigit@amd.com>,\n Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>",
        "Cc": "ferruh.yigit@xilinx.com, mdr@ashroe.eu, xiaoyun.li@intel.com,\n aman.deep.singh@intel.com, yuying.zhang@intel.com, qi.z.zhang@intel.com,\n qiming.yang@intel.com, jerinjacobk@gmail.com, viacheslavo@nvidia.com,\n stephen@networkplumber.org, xuan.ding@intel.com, hpothula@marvell.com,\n yaqi.tang@intel.com, Yuan Wang <yuanx.wang@intel.com>,\n Wenxuan Wu <wenxuanx.wu@intel.com>",
        "Subject": "[PATCH v8 2/4] ethdev: introduce protocol hdr based buffer split",
        "Date": "Thu,  6 Oct 2022 07:18:34 +0800",
        "Message-Id": "<20221005231836.215112-3-yuanx.wang@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20221005231836.215112-1-yuanx.wang@intel.com>",
        "References": "<20220812181552.2908067-1-yuanx.wang@intel.com>\n <20221005231836.215112-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\nproto_hdr = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |\n            RTE_PTYPE_L4_UDP\n\nFor inner ETH-IPV4-UDP, it should be defined as\nproto_hdr = RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |\n            RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP\n\nIf the protocol header is repeated with the previously defined one,\nthe repeated part can be omitted. For example, split after ETH, ETH-IPV4\nand ETH-IPV4-UDP, it should be defined as\nproto_hdr0 = RTE_PTYPE_L2_ETHER\nproto_hdr1 = RTE_PTYPE_L3_IPV4_EXT_UNKNOWN\nproto_hdr2 = RTE_PTYPE_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         * If one protocol header is defined to split packets into two\n         * segments, for non-tunneling packets, the complete protocol\n         * sequence should be defined.\n         * For tunneling packets, for simplicity,\n         * only the tunnel and inner part of comple protocol sequence\n         * is required.\n         * If several protocol headers are defined to split packets into\n         * multi-segments, the repeated parts of adjacent segments\n         * should be omitted.\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_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 |  4 ++\n lib/ethdev/rte_ethdev.c                | 89 ++++++++++++++++++++++----\n lib/ethdev/rte_ethdev.h                | 34 +++++++++-\n 3 files changed, 115 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 141fd9442b..4c3a7f8b8b 100644\n--- a/doc/guides/rel_notes/release_22_11.rst\n+++ b/doc/guides/rel_notes/release_22_11.rst\n@@ -127,6 +127,10 @@ New Features\n \n   * Added ``rte_eth_buffer_split_get_supported_hdr_ptypes()``, to get supported\n     header protocols of a PMD to split.\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\ndiff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex ee3b490889..60fe6eb2bd 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -1650,14 +1650,18 @@ 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 \tuint32_t offset_mask;\n \tuint16_t seg_idx;\n+\tint ptype_cnt;\n+\tuint32_t *ptypes;\n+\tint i;\n \n \tif (n_seg > seg_capa->max_nseg) {\n \t\tRTE_ETHDEV_LOG(ERR,\n@@ -1675,6 +1679,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@@ -1708,13 +1713,75 @@ 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+\t\t\tif (length != 0) {\n+\t\t\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t\t\t\"Do not set length split and protocol split within a segment\\n\"\n+\t\t\t\t\t);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\n+\t\t\tif (seg_idx == n_seg - 1) {\n+\t\t\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t\t\t\"The proto_hdr in the last segment should be 0\\n\"\n+\t\t\t\t\t);\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+\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\tptypes = malloc(sizeof(uint32_t) * ptype_cnt);\n+\t\t\tif (ptypes == NULL)\n+\t\t\t\treturn -ENOMEM;\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\tfree(ptypes);\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+\n+\t\t\tfree(ptypes);\n+\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+\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@@ -1794,7 +1861,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 c51c1f3fa0..4c9b121355 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,41 @@ 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 must be 0.\n+ *\n+ * - Protocol header based buffer split:\n+ *     - mp, offset, proto_hdr should be configured.\n+ *     - The length field must be 0.\n+ *     - The proto_hdr field in the last segment should be 0.\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 *\n+\t * If one protocol header is defined to split packets into two segments,\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 part of\n+\t * comple protocol sequence is required.\n+\t * If several protocol headers are defined to split packets into multi-segments,\n+\t * the repeated parts of adjacent segments should be omitted.\n+\t */\n+\tuint32_t proto_hdr;\n };\n \n /**\n",
    "prefixes": [
        "v8",
        "2/4"
    ]
}