get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 117737,
    "url": "http://patchwork.dpdk.org/api/patches/117737/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20221009202541.352724-4-yuanx.wang@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": "<20221009202541.352724-4-yuanx.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221009202541.352724-4-yuanx.wang@intel.com",
    "date": "2022-10-09T20:25:40",
    "name": "[v9,3/4] app/testpmd: add rxhdrs commands and parameters",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "d208fdaa3d652a14d8ae48e90f6fed9c77f5c9dd",
    "submitter": {
        "id": 2087,
        "url": "http://patchwork.dpdk.org/api/people/2087/?format=api",
        "name": "Wang, YuanX",
        "email": "yuanx.wang@intel.com"
    },
    "delegate": {
        "id": 3961,
        "url": "http://patchwork.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20221009202541.352724-4-yuanx.wang@intel.com/mbox/",
    "series": [
        {
            "id": 25061,
            "url": "http://patchwork.dpdk.org/api/series/25061/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=25061",
            "date": "2022-10-09T20:25:37",
            "name": "support protocol based buffer split",
            "version": 9,
            "mbox": "http://patchwork.dpdk.org/series/25061/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/117737/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/117737/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 5DF4FA0542;\n\tSun,  9 Oct 2022 14:40:03 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4A5564114A;\n\tSun,  9 Oct 2022 14:40:03 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id 4355F427EE\n for <dev@dpdk.org>; Sun,  9 Oct 2022 14:40:01 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 09 Oct 2022 05:40:00 -0700",
            "from unknown (HELO localhost.localdomain) ([10.239.252.55])\n by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 09 Oct 2022 05:39:54 -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=1665319201; x=1696855201;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=QJ8xw7H3Vdh/kw7YbH6uy1giSVzTdVvY+hiuuhbdR9w=;\n b=MzpWC6/32IkiaIi7UhaeKQrXfG2HQORntgfrUNm4xIIuZXcEiCZ7h7EM\n vQMs5naVOVH3XGcQd3WjXZJ+yO14NvK83mF+eLpGEYBqe5U//XFTD+9hx\n 2HC9ZDWzn9MO5ei0cNbflCUkCLthhJ1XmGjz0XT5jdU/Qhr1BJvB/+lfF\n azm6p+urwiSSxHwGO6hATjRe3Z/u5NoDKe7nrhOFllNK2pEOmpeEIuHKB\n AK8pzqhID/2ccQ15DD8fD38T82qQ9D8lGTKRjqwN/wj0oHAEBLwr4zpTb\n JYCeMYOF84wtshmYPnhspDlKy6Uz0ALzW6HotT2o98qYEeE4V0vJ7kB41 Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10494\"; a=\"283780097\"",
            "E=Sophos;i=\"5.95,171,1661842800\"; d=\"scan'208\";a=\"283780097\"",
            "E=McAfee;i=\"6500,9779,10494\"; a=\"656628398\"",
            "E=Sophos;i=\"5.95,171,1661842800\"; d=\"scan'208\";a=\"656628398\""
        ],
        "From": "Yuan Wang <yuanx.wang@intel.com>",
        "To": "dev@dpdk.org, Aman Singh <aman.deep.singh@intel.com>,\n Yuying Zhang <yuying.zhang@intel.com>",
        "Cc": "thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru,\n ferruh.yigit@xilinx.com, mdr@ashroe.eu, xiaoyun.li@intel.com,\n qi.z.zhang@intel.com, qiming.yang@intel.com, jerinjacobk@gmail.com,\n viacheslavo@nvidia.com, stephen@networkplumber.org, xuan.ding@intel.com,\n hpothula@marvell.com, yaqi.tang@intel.com,\n Yuan Wang <yuanx.wang@intel.com>, Wenxuan Wu <wenxuanx.wu@intel.com>",
        "Subject": "[PATCH v9 3/4] app/testpmd: add rxhdrs commands and parameters",
        "Date": "Mon, 10 Oct 2022 04:25:40 +0800",
        "Message-Id": "<20221009202541.352724-4-yuanx.wang@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20221009202541.352724-1-yuanx.wang@intel.com>",
        "References": "<20220812181552.2908067-1-yuanx.wang@intel.com>\n <20221009202541.352724-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": "Add command line parameter:\n--rxhdrs=eth[,ipv4]\n\nSet the protocol_hdr of segments to scatter packets on receiving if\nsplit feature is engaged. And the queues with BUFFER_SPLIT flag.\n\nAdd interactive mode command:\ntestpmd>set rxhdrs eth,ipv4,ipv4-udp\n(protocol sequence should be valid)\n\nThe protocol split feature is off by default. To enable protocol split,\nyou need:\n1. Start testpmd with multiple mempools. E.g. --mbuf-size=2048,2048\n2. Configure Rx queue with rx_offload buffer split on.\n3. Set the protocol type of buffer split. E.g. set rxhdrs eth,eth-ipv4\n        (default protocols of testpmd : eth|ipv4|ipv6|ipv4-tcp|ipv6-tcp|\n         ipv4-udp|ipv6-udp|ipv4-sctp|ipv6-sctp|grenat|inner-eth|\n         inner-ipv4|inner-ipv6|inner-ipv4-tcp|inner-ipv6-tcp|\n         inner-ipv4-udp|inner-ipv6-udp|inner-ipv4-sctp|inner-ipv6-sctp)\nAbove protocols can be configured in testpmd. But the configuration can\nonly be applied when it is supported by specific pmd.\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 app/test-pmd/cmdline.c                      | 152 +++++++++++++++++++-\n app/test-pmd/config.c                       | 108 ++++++++++++++\n app/test-pmd/parameters.c                   |  16 ++-\n app/test-pmd/testpmd.c                      |  11 +-\n app/test-pmd/testpmd.h                      |   6 +\n doc/guides/testpmd_app_ug/testpmd_funcs.rst |  19 ++-\n 6 files changed, 303 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 4565a3953a..57ac6828d0 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -181,7 +181,7 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\"show (rxq|txq) info (port_id) (queue_id)\\n\"\n \t\t\t\"    Display information for configured RX/TX queue.\\n\\n\"\n \n-\t\t\t\"show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts)\\n\"\n+\t\t\t\"show config (rxtx|cores|fwd|rxoffs|rxpkts|rxhdrs|txpkts)\\n\"\n \t\t\t\"    Display the given configuration.\\n\\n\"\n \n \t\t\t\"read rxd (port_id) (queue_id) (rxd_id)\\n\"\n@@ -305,6 +305,17 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\" Affects only the queues configured with split\"\n \t\t\t\" offloads.\\n\\n\"\n \n+\t\t\t\"set rxhdrs (eth[,ipv4])*\\n\"\n+\t\t\t\"    Set the protocol hdr of each segment to scatter\"\n+\t\t\t\" packets on receiving if split feature is engaged.\"\n+\t\t\t\" Affects only the queues configured with split\"\n+\t\t\t\" offloads.\\n\"\n+\t\t\t\"    Supported values: eth|ipv4|ipv6|ipv4-tcp|ipv6-tcp|\"\n+\t\t\t\"ipv4-udp|ipv6-udp|ipv4-sctp|ipv6-sctp|\"\n+\t\t\t\"grenat|inner-eth|inner-ipv4|inner-ipv6|inner-ipv4-tcp|\"\n+\t\t\t\"inner-ipv6-tcp|inner-ipv4-udp|inner-ipv6-udp|\"\n+\t\t\t\"inner-ipv4-sctp|inner-ipv6-sctp\\n\\n\"\n+\n \t\t\t\"set txpkts (x[,y]*)\\n\"\n \t\t\t\"    Set the length of each segment of TXONLY\"\n \t\t\t\" and optionally CSUM packets.\\n\\n\"\n@@ -3366,6 +3377,94 @@ static cmdline_parse_inst_t cmd_stop = {\n \t},\n };\n \n+static unsigned int\n+get_ptype(char *value)\n+{\n+\tuint32_t protocol;\n+\n+\tif (!strcmp(value, \"eth\"))\n+\t\tprotocol = RTE_PTYPE_L2_ETHER;\n+\telse if (!strcmp(value, \"ipv4\"))\n+\t\tprotocol = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;\n+\telse if (!strcmp(value, \"ipv6\"))\n+\t\tprotocol = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;\n+\telse if (!strcmp(value, \"ipv4-tcp\"))\n+\t\tprotocol = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_TCP;\n+\telse if (!strcmp(value, \"ipv4-udp\"))\n+\t\tprotocol = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP;\n+\telse if (!strcmp(value, \"ipv4-sctp\"))\n+\t\tprotocol = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_SCTP;\n+\telse if (!strcmp(value, \"ipv6-tcp\"))\n+\t\tprotocol = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_L4_TCP;\n+\telse if (!strcmp(value, \"ipv6-udp\"))\n+\t\tprotocol = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_L4_UDP;\n+\telse if (!strcmp(value, \"ipv6-sctp\"))\n+\t\tprotocol = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_L4_SCTP;\n+\telse if (!strcmp(value, \"grenat\"))\n+\t\tprotocol = RTE_PTYPE_TUNNEL_GRENAT;\n+\telse if (!strcmp(value, \"inner-eth\"))\n+\t\tprotocol = RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER;\n+\telse if (!strcmp(value, \"inner-ipv4\"))\n+\t\tprotocol = RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |\n+\t\t\t\tRTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN;\n+\telse if (!strcmp(value, \"inner-ipv6\"))\n+\t\tprotocol = RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |\n+\t\t\t\tRTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN;\n+\telse if (!strcmp(value, \"inner-ipv4-tcp\"))\n+\t\tprotocol = RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |\n+\t\t\t\tRTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP;\n+\telse if (!strcmp(value, \"inner-ipv4-udp\"))\n+\t\tprotocol = RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |\n+\t\t\t\tRTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP;\n+\telse if (!strcmp(value, \"inner-ipv4-sctp\"))\n+\t\tprotocol = RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |\n+\t\t\t\tRTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP;\n+\telse if (!strcmp(value, \"inner-ipv6-tcp\"))\n+\t\tprotocol = RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |\n+\t\t\t\tRTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP;\n+\telse if (!strcmp(value, \"inner-ipv6-udp\"))\n+\t\tprotocol = RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |\n+\t\t\t\tRTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP;\n+\telse if (!strcmp(value, \"inner-ipv6-sctp\"))\n+\t\tprotocol = RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER |\n+\t\t\t\tRTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP;\n+\telse {\n+\t\tfprintf(stderr, \"Unsupported protocol: %s\\n\", value);\n+\t\tprotocol = RTE_PTYPE_UNKNOWN;\n+\t}\n+\n+\treturn protocol;\n+}\n+/* *** SET RXHDRSLIST *** */\n+\n+unsigned int\n+parse_hdrs_list(const char *str, const char *item_name, unsigned int max_items,\n+\t\t\t\tunsigned int *parsed_items, int check_hdrs_sequence)\n+{\n+\tunsigned int nb_item;\n+\tchar *cur;\n+\tchar *tmp;\n+\tunsigned int cur_item, prev_items = 0;\n+\n+\tnb_item = 0;\n+\tchar *str2 = strdup(str);\n+\tcur = strtok_r(str2, \",\", &tmp);\n+\twhile (cur != NULL) {\n+\t\tcur_item = get_ptype(cur);\n+\t\tcur_item &= ~prev_items;\n+\t\tparsed_items[nb_item] = cur_item;\n+\t\tcur = strtok_r(NULL, \",\", &tmp);\n+\t\tnb_item++;\n+\t\tprev_items |= cur_item;\n+\t}\n+\tif (nb_item > max_items)\n+\t\tfprintf(stderr, \"Number of %s = %u > %u (maximum items)\\n\",\n+\t\t\titem_name, nb_item + 1, max_items);\n+\tfree(str2);\n+\tif (!check_hdrs_sequence)\n+\t\treturn nb_item;\n+\treturn nb_item;\n+}\n /* *** SET CORELIST and PORTLIST CONFIGURATION *** */\n \n unsigned int\n@@ -3735,6 +3834,50 @@ static cmdline_parse_inst_t cmd_set_rxpkts = {\n \t},\n };\n \n+/* *** SET SEGMENT HEADERS OF RX PACKETS SPLIT *** */\n+struct cmd_set_rxhdrs_result {\n+\tcmdline_fixed_string_t set;\n+\tcmdline_fixed_string_t rxhdrs;\n+\tcmdline_fixed_string_t values;\n+};\n+\n+static void\n+cmd_set_rxhdrs_parsed(void *parsed_result,\n+\t\t      __rte_unused struct cmdline *cl,\n+\t\t      __rte_unused void *data)\n+{\n+\tstruct cmd_set_rxhdrs_result *res;\n+\tunsigned int seg_hdrs[MAX_SEGS_BUFFER_SPLIT];\n+\tunsigned int nb_segs;\n+\n+\tres = parsed_result;\n+\tnb_segs = parse_hdrs_list(res->values, \"segment hdrs\",\n+\t\t\t\t  MAX_SEGS_BUFFER_SPLIT, seg_hdrs, 0);\n+\tif (nb_segs > 0)\n+\t\tset_rx_pkt_hdrs(seg_hdrs, nb_segs);\n+\tcmd_reconfig_device_queue(RTE_PORT_ALL, 0, 1);\n+}\n+static cmdline_parse_token_string_t cmd_set_rxhdrs_set =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_rxhdrs_result,\n+\t\t\t\tset, \"set\");\n+static cmdline_parse_token_string_t cmd_set_rxhdrs_rxhdrs =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_rxhdrs_result,\n+\t\t\t\trxhdrs, \"rxhdrs\");\n+static cmdline_parse_token_string_t cmd_set_rxhdrs_values =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_rxhdrs_result,\n+\t\t\t\tvalues, NULL);\n+\n+static cmdline_parse_inst_t cmd_set_rxhdrs = {\n+\t.f = cmd_set_rxhdrs_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set rxhdrs <eth[,ipv4]*>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_rxhdrs_set,\n+\t\t(void *)&cmd_set_rxhdrs_rxhdrs,\n+\t\t(void *)&cmd_set_rxhdrs_values,\n+\t\tNULL,\n+\t},\n+};\n /* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */\n \n struct cmd_set_txpkts_result {\n@@ -6487,6 +6630,8 @@ static void cmd_showcfg_parsed(void *parsed_result,\n \t\tshow_rx_pkt_offsets();\n \telse if (!strcmp(res->what, \"rxpkts\"))\n \t\tshow_rx_pkt_segments();\n+\telse if (!strcmp(res->what, \"rxhdrs\"))\n+\t\tshow_rx_pkt_hdrs();\n \telse if (!strcmp(res->what, \"txpkts\"))\n \t\tshow_tx_pkt_segments();\n \telse if (!strcmp(res->what, \"txtimes\"))\n@@ -6499,12 +6644,12 @@ static cmdline_parse_token_string_t cmd_showcfg_port =\n \tTOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, \"config\");\n static cmdline_parse_token_string_t cmd_showcfg_what =\n \tTOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what,\n-\t\t\t\t \"rxtx#cores#fwd#rxoffs#rxpkts#txpkts#txtimes\");\n+\t\t\t\t \"rxtx#cores#fwd#rxoffs#rxpkts#rxhdrs#txpkts#txtimes\");\n \n static cmdline_parse_inst_t cmd_showcfg = {\n \t.f = cmd_showcfg_parsed,\n \t.data = NULL,\n-\t.help_str = \"show config rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes\",\n+\t.help_str = \"show config rxtx|cores|fwd|rxoffs|rxpkts|rxhdrs|txpkts|txtimes\",\n \t.tokens = {\n \t\t(void *)&cmd_showcfg_show,\n \t\t(void *)&cmd_showcfg_port,\n@@ -12455,6 +12600,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_set_log,\n \t(cmdline_parse_inst_t *)&cmd_set_rxoffs,\n \t(cmdline_parse_inst_t *)&cmd_set_rxpkts,\n+\t(cmdline_parse_inst_t *)&cmd_set_rxhdrs,\n \t(cmdline_parse_inst_t *)&cmd_set_txpkts,\n \t(cmdline_parse_inst_t *)&cmd_set_txsplit,\n \t(cmdline_parse_inst_t *)&cmd_set_txtimes,\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 841e8efe78..dec16a9049 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -4889,6 +4889,114 @@ show_rx_pkt_segments(void)\n \t}\n }\n \n+static const char *get_ptype_str(uint32_t ptype)\n+{\n+\tif ((ptype & (RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_TCP)) ==\n+\t\t(RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_TCP))\n+\t\treturn \"ipv4-tcp\";\n+\telse if ((ptype & (RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP)) ==\n+\t\t(RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_UDP))\n+\t\treturn \"ipv4-udp\";\n+\telse if ((ptype & (RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_SCTP)) ==\n+\t\t(RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_SCTP))\n+\t\treturn \"ipv4-sctp\";\n+\telse if ((ptype & (RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_L4_TCP)) ==\n+\t\t(RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_L4_TCP))\n+\t\treturn \"ipv6-tcp\";\n+\telse if ((ptype & (RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_L4_UDP)) ==\n+\t\t(RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_L4_UDP))\n+\t\treturn \"ipv6-udp\";\n+\telse if ((ptype & (RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_L4_SCTP)) ==\n+\t\t(RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_L4_SCTP))\n+\t\treturn \"ipv6-sctp\";\n+\telse if ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP)\n+\t\treturn \"tcp\";\n+\telse if ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP)\n+\t\treturn \"udp\";\n+\telse if ((ptype & RTE_PTYPE_L4_SCTP) == RTE_PTYPE_L4_SCTP)\n+\t\treturn \"sctp\";\n+\telse if ((ptype & RTE_PTYPE_L3_IPV4_EXT_UNKNOWN) == RTE_PTYPE_L3_IPV4_EXT_UNKNOWN)\n+\t\treturn \"ipv4\";\n+\telse if ((ptype & RTE_PTYPE_L3_IPV6_EXT_UNKNOWN) == RTE_PTYPE_L3_IPV6_EXT_UNKNOWN)\n+\t\treturn \"ipv6\";\n+\telse if ((ptype & RTE_PTYPE_L2_ETHER) == RTE_PTYPE_L2_ETHER)\n+\t\treturn \"eth\";\n+\n+\telse if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP)) ==\n+\t\t(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP))\n+\t\treturn \"inner-ipv4-tcp\";\n+\telse if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP)) ==\n+\t\t(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP))\n+\t\treturn \"inner-ipv4-udp\";\n+\telse if ((ptype & (RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP)) ==\n+\t\t(RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP))\n+\t\treturn \"inner-ipv4-sctp\";\n+\telse if ((ptype & (RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP)) ==\n+\t\t(RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP))\n+\t\treturn \"inner-ipv6-tcp\";\n+\telse if ((ptype & (RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP)) ==\n+\t\t(RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_UDP))\n+\t\treturn \"inner-ipv6-udp\";\n+\telse if ((ptype & (RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP)) ==\n+\t\t(RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_SCTP))\n+\t\treturn \"inner-ipv6-sctp\";\n+\telse if ((ptype & RTE_PTYPE_INNER_L4_TCP) == RTE_PTYPE_INNER_L4_TCP)\n+\t\treturn \"inner-tcp\";\n+\telse if ((ptype & RTE_PTYPE_INNER_L4_UDP) == RTE_PTYPE_INNER_L4_UDP)\n+\t\treturn \"inner-udp\";\n+\telse if ((ptype & RTE_PTYPE_INNER_L4_SCTP) == RTE_PTYPE_INNER_L4_SCTP)\n+\t\treturn \"inner-sctp\";\n+\telse if ((ptype & RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN) ==\n+\t\tRTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)\n+\t\treturn \"inner-ipv4\";\n+\telse if ((ptype & RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN) ==\n+\t\tRTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)\n+\t\treturn \"inner-ipv6\";\n+\telse if ((ptype & RTE_PTYPE_INNER_L2_ETHER) == RTE_PTYPE_INNER_L2_ETHER)\n+\t\treturn \"inner-eth\";\n+\telse if ((ptype & RTE_PTYPE_TUNNEL_GRENAT) == RTE_PTYPE_TUNNEL_GRENAT)\n+\t\treturn \"grenat\";\n+\telse\n+\t\treturn \"unsupported\";\n+}\n+\n+void\n+show_rx_pkt_hdrs(void)\n+{\n+\tuint32_t i, n;\n+\n+\tn = rx_pkt_nb_segs;\n+\tprintf(\"Number of segments: %u\\n\", n);\n+\tif (n) {\n+\t\tprintf(\"Packet segs: \");\n+\t\tfor (i = 0; i < n - 1; i++)\n+\t\t\tprintf(\"%s, \", get_ptype_str(rx_pkt_hdr_protos[i]));\n+\t\tprintf(\"payload\\n\");\n+\t}\n+}\n+\n+void\n+set_rx_pkt_hdrs(unsigned int *seg_hdrs, unsigned int nb_segs)\n+{\n+\tunsigned int i;\n+\n+\tif (nb_segs + 1 > MAX_SEGS_BUFFER_SPLIT) {\n+\t\tprintf(\"nb segments per RX packets=%u > \"\n+\t\t       \"MAX_SEGS_BUFFER_SPLIT - ignored\\n\", nb_segs + 1);\n+\t\treturn;\n+\t}\n+\n+\tmemset(rx_pkt_hdr_protos, 0, sizeof(rx_pkt_hdr_protos));\n+\n+\tfor (i = 0; i < nb_segs; i++)\n+\t\trx_pkt_hdr_protos[i] = (uint32_t)seg_hdrs[i];\n+\t/*\n+\t * We calculate the number of hdrs, but payload is not included,\n+\t * so rx_pkt_nb_segs would increase 1.\n+\t */\n+\trx_pkt_nb_segs = nb_segs + 1;\n+}\n+\n void\n set_rx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs)\n {\ndiff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c\nindex 14752f9571..ff760460ec 100644\n--- a/app/test-pmd/parameters.c\n+++ b/app/test-pmd/parameters.c\n@@ -152,6 +152,7 @@ usage(char* progname)\n \t       \" Used mainly with PCAP drivers.\\n\");\n \tprintf(\"  --rxoffs=X[,Y]*: set RX segment offsets for split.\\n\");\n \tprintf(\"  --rxpkts=X[,Y]*: set RX segment sizes to split.\\n\");\n+\tprintf(\"  --rxhdrs=eth[,ipv4]*: set RX segment protocol to split.\\n\");\n \tprintf(\"  --txpkts=X[,Y]*: set TX segment sizes\"\n \t\t\" or total packet length.\\n\");\n \tprintf(\"  --txonly-multi-flow: generate multiple flows in txonly mode\\n\");\n@@ -660,6 +661,7 @@ launch_args_parse(int argc, char** argv)\n \t\t{ \"flow-isolate-all\",\t        0, 0, 0 },\n \t\t{ \"rxoffs\",\t\t\t1, 0, 0 },\n \t\t{ \"rxpkts\",\t\t\t1, 0, 0 },\n+\t\t{ \"rxhdrs\",\t\t\t1, 0, 0 },\n \t\t{ \"txpkts\",\t\t\t1, 0, 0 },\n \t\t{ \"txonly-multi-flow\",\t\t0, 0, 0 },\n \t\t{ \"rxq-share\",\t\t\t2, 0, 0 },\n@@ -1254,7 +1256,6 @@ launch_args_parse(int argc, char** argv)\n \t\t\tif (!strcmp(lgopts[opt_idx].name, \"rxpkts\")) {\n \t\t\t\tunsigned int seg_len[MAX_SEGS_BUFFER_SPLIT];\n \t\t\t\tunsigned int nb_segs;\n-\n \t\t\t\tnb_segs = parse_item_list\n \t\t\t\t\t\t(optarg, \"rxpkt segments\",\n \t\t\t\t\t\t MAX_SEGS_BUFFER_SPLIT,\n@@ -1264,6 +1265,19 @@ launch_args_parse(int argc, char** argv)\n \t\t\t\telse\n \t\t\t\t\trte_exit(EXIT_FAILURE, \"bad rxpkts\\n\");\n \t\t\t}\n+\t\t\tif (!strcmp(lgopts[opt_idx].name, \"rxhdrs\")) {\n+\t\t\t\tunsigned int seg_hdrs[MAX_SEGS_BUFFER_SPLIT];\n+\t\t\t\tunsigned int nb_segs;\n+\n+\t\t\t\tnb_segs = parse_hdrs_list\n+\t\t\t\t\t\t(optarg, \"rxpkt segments\",\n+\t\t\t\t\t\tMAX_SEGS_BUFFER_SPLIT,\n+\t\t\t\t\t\tseg_hdrs, 0);\n+\t\t\t\tif (nb_segs > 0)\n+\t\t\t\t\tset_rx_pkt_hdrs(seg_hdrs, nb_segs);\n+\t\t\t\telse\n+\t\t\t\t\trte_exit(EXIT_FAILURE, \"bad rxpkts\\n\");\n+\t\t\t}\n \t\t\tif (!strcmp(lgopts[opt_idx].name, \"txpkts\")) {\n \t\t\t\tunsigned seg_lengths[RTE_MAX_SEGS_PER_PKT];\n \t\t\t\tunsigned int nb_segs;\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex bb1c901742..5b0f0838dc 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -247,6 +247,7 @@ uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];\n uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */\n uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];\n uint8_t  rx_pkt_nb_offs; /**< Number of specified offsets */\n+uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];\n \n /*\n  * Configuration of packet segments used by the \"txonly\" processing engine.\n@@ -2668,12 +2669,16 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,\n \t\tmp_n = (i >= mbuf_data_size_n) ? mbuf_data_size_n - 1 : i;\n \t\tmpx = mbuf_pool_find(socket_id, mp_n);\n \t\t/* Handle zero as mbuf data buffer size. */\n-\t\trx_seg->length = rx_pkt_seg_lengths[i] ?\n-\t\t\t\t   rx_pkt_seg_lengths[i] :\n-\t\t\t\t   mbuf_data_size[mp_n];\n \t\trx_seg->offset = i < rx_pkt_nb_offs ?\n \t\t\t\t   rx_pkt_seg_offsets[i] : 0;\n \t\trx_seg->mp = mpx ? mpx : mp;\n+\t\tif (rx_pkt_hdr_protos[i] != 0 && rx_pkt_seg_lengths[i] == 0) {\n+\t\t\trx_seg->proto_hdr = rx_pkt_hdr_protos[i];\n+\t\t} else {\n+\t\t\trx_seg->length = rx_pkt_seg_lengths[i] ?\n+\t\t\t\t\trx_pkt_seg_lengths[i] :\n+\t\t\t\t\tmbuf_data_size[mp_n];\n+\t\t}\n \t}\n \trx_conf->rx_nseg = rx_pkt_nb_segs;\n \trx_conf->rx_seg = rx_useg;\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex ca2408cb6b..e65be323b8 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -580,6 +580,7 @@ extern uint32_t max_rx_pkt_len;\n  * Configuration of packet segments used to scatter received packets\n  * if some of split features is configured.\n  */\n+extern uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT];\n extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT];\n extern uint8_t  rx_pkt_nb_segs; /**< Number of segments to split */\n extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT];\n@@ -851,6 +852,9 @@ inc_tx_burst_stats(struct fwd_stream *fs, uint16_t nb_tx)\n unsigned int parse_item_list(const char *str, const char *item_name,\n \t\t\tunsigned int max_items,\n \t\t\tunsigned int *parsed_items, int check_unique_values);\n+unsigned int parse_hdrs_list(const char *str, const char *item_name,\n+\t\t\tunsigned int max_item,\n+\t\t\tunsigned int *parsed_items, int check_unique_values);\n void launch_args_parse(int argc, char** argv);\n void cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue);\n void cmdline_read_from_file(const char *filename);\n@@ -1006,6 +1010,8 @@ void set_record_core_cycles(uint8_t on_off);\n void set_record_burst_stats(uint8_t on_off);\n void set_verbose_level(uint16_t vb_level);\n void set_rx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs);\n+void set_rx_pkt_hdrs(unsigned int *seg_protos, unsigned int nb_segs);\n+void show_rx_pkt_hdrs(void);\n void show_rx_pkt_segments(void);\n void set_rx_pkt_offsets(unsigned int *seg_offsets, unsigned int nb_offs);\n void show_rx_pkt_offsets(void);\ndiff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\nindex 1cf814ae89..fdad100944 100644\n--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n@@ -278,7 +278,7 @@ show config\n Displays the configuration of the application.\n The configuration comes from the command-line, the runtime or the application defaults::\n \n-   testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes)\n+   testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|rxhdrs|txpkts|txtimes)\n \n The available information categories are:\n \n@@ -290,7 +290,9 @@ The available information categories are:\n \n * ``rxoffs``: Packet offsets for RX split.\n \n-* ``rxpkts``: Packets to RX split configuration.\n+* ``rxpkts``: Packets to RX length-based split configuration.\n+\n+* ``rxhdrs``: Packets to RX proto-based split configuration.\n \n * ``txpkts``: Packets to TX configuration.\n \n@@ -799,6 +801,19 @@ mbuf for remaining segments will be allocated from the last valid pool).\n Where x[,y]* represents a CSV list of values, without white space. Zero value\n means to use the corresponding memory pool data buffer size.\n \n+set rxhdrs\n+~~~~~~~~~~\n+\n+Set the protocol headers of segments to scatter packets on receiving if split\n+feature is engaged. Affects only the queues configured with split\n+offloads (currently BUFFER_SPLIT is supported only).\n+\n+   testpmd> set rxhdrs (eth[,ipv4]*)\n+\n+Where eth[,ipv4]* represents a CSV list of values, without white space. If the list\n+of offsets is shorter than the list of segments the zero offsets will be used\n+for the remaining segments.\n+\n set txpkts\n ~~~~~~~~~~\n \n",
    "prefixes": [
        "v9",
        "3/4"
    ]
}