get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 112694,
    "url": "http://patchwork.dpdk.org/api/patches/112694/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20220613102550.241759-4-wenxuanx.wu@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": "<20220613102550.241759-4-wenxuanx.wu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220613102550.241759-4-wenxuanx.wu@intel.com",
    "date": "2022-06-13T10:25:49",
    "name": "[v9,3/4] app/testpmd: add rxhdrs commands and parameters",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0fa1faaa5d08a2d05f459b93fd47b24400d4de05",
    "submitter": {
        "id": 2515,
        "url": "http://patchwork.dpdk.org/api/people/2515/?format=api",
        "name": "Wu, WenxuanX",
        "email": "wenxuanx.wu@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/20220613102550.241759-4-wenxuanx.wu@intel.com/mbox/",
    "series": [
        {
            "id": 23498,
            "url": "http://patchwork.dpdk.org/api/series/23498/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=23498",
            "date": "2022-06-13T10:25:46",
            "name": "add an api to support proto based buffer split",
            "version": 9,
            "mbox": "http://patchwork.dpdk.org/series/23498/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/112694/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/112694/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 31F12A0543;\n\tMon, 13 Jun 2022 12:49:20 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id AA48D4282C;\n\tMon, 13 Jun 2022 12:49:13 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id 1B5404282A\n for <dev@dpdk.org>; Mon, 13 Jun 2022 12:49:11 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Jun 2022 03:49:11 -0700",
            "from unknown (HELO localhost.localdomain) ([10.239.251.3])\n by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Jun 2022 03:49:07 -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=1655117352; x=1686653352;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=QL6h49G2Yj8hv+kxI39sxIl4bAO75j03FHgWxYODvlg=;\n b=Es3X2syaJRYoA+2xJ2WeItMyeQWFKI7XNB9uTL7jWONb8jytBLjzl/9I\n lYnbMew8X8cSDvXjCOQ2DYgMkORiNBKeXzv3GnRfi8fBNtaC1b/9A0w1W\n f2cvwz2H+EaKWNCR4Ge/WrDvvxqwHUMQrerbXbQpBfWg8M9qaB0pwYtgT\n dvIYOPvERiDp+alN7sJTzx7bNjVTZduqBszm+//bN8cNhgTcTKqMJlIyY\n CQnWpCdGiQmi22OZp4wtNLtsnbs7IyfPjBxAm1jRJU4953h5ZHo8se4u0\n O6NXvDSwDfiiXv0GxoYprXfay7rt+CRNS3pXzAi5OEddzpXDRGsTqkhvA A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10376\"; a=\"258076149\"",
            "E=Sophos;i=\"5.91,297,1647327600\"; d=\"scan'208\";a=\"258076149\"",
            "E=Sophos;i=\"5.91,297,1647327600\"; d=\"scan'208\";a=\"617442832\""
        ],
        "From": "wenxuanx.wu@intel.com",
        "To": "thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru, xiaoyun.li@intel.com,\n ferruh.yigit@xilinx.com, aman.deep.singh@intel.com, dev@dpdk.org,\n yuying.zhang@intel.com, qi.z.zhang@intel.com, jerinjacobk@gmail.com",
        "Cc": "stephen@networkplumber.org, Wenxuan Wu <wenxuanx.wu@intel.com>,\n Xuan Ding <xuan.ding@intel.com>, Yuan Wang <yuanx.wang@intel.com>",
        "Subject": "[PATCH v9 3/4] app/testpmd: add rxhdrs commands and parameters",
        "Date": "Mon, 13 Jun 2022 10:25:49 +0000",
        "Message-Id": "<20220613102550.241759-4-wenxuanx.wu@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220613102550.241759-1-wenxuanx.wu@intel.com>",
        "References": "<20220303060136.36427-1-xuan.ding@intel.com>\n <20220613102550.241759-1-wenxuanx.wu@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": "From: Wenxuan Wu <wenxuanx.wu@intel.com>\n\nAdd command line parameter:\n--rxhdrs=mac,[ipv4,udp]\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 mac,ipv4,l3,tcp,udp,sctp\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 two 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 mac,ipv4\n\t(default protocols of testpmd : mac|icmp|ipv4|ipv6|l3|tcp|udp|\n\t\t\t\tsctp|l4|inner_mac|inner_ipv4|inner_ipv6|\n\t\t\t\tinner_l3|inner_tcp|inner_udp|inner_sctp|\n\t\t\t\tinner_l4)\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: Wenxuan Wu <wenxuanx.wu@intel.com>\nSigned-off-by: Xuan Ding <xuan.ding@intel.com>\nSigned-off-by: Yuan Wang <yuanx.wang@intel.com>\nReviewed-by: Qi Zhang <qi.z.zhang@intel.com>\n---\n app/test-pmd/cmdline.c    | 133 +++++++++++++++++++++++++++++++++++++-\n app/test-pmd/config.c     |  75 +++++++++++++++++++++\n app/test-pmd/parameters.c |  15 ++++-\n app/test-pmd/testpmd.c    |   6 +-\n app/test-pmd/testpmd.h    |   6 ++\n 5 files changed, 229 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 6ffea8e21a..474235bc91 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -183,7 +183,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@@ -316,6 +316,15 @@ 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 (mac[,ipv4])*\\n\"\n+\t\t\t\"\tSet 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\"\n+\t\t\t\"\tSupported proto header: mac|ipv4||qinq|gre|ipv6|l3|tcp|udp|sctp|l4|\"\n+\t\t\t\"inner_mac|inner_ipv4|inner_ipv6|inner_l3|inner_tcp|\"\n+\t\t\t\"inner_udp|inner_sctp\\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@@ -3617,6 +3626,78 @@ 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+\tif (!strcmp(value, \"mac\"))\n+\t\tprotocol = RTE_PTYPE_L2_ETHER;\n+\telse if (!strcmp(value, \"ipv4\"))\n+\t\tprotocol = RTE_PTYPE_L3_IPV4;\n+\telse if (!strcmp(value, \"ipv6\"))\n+\t\tprotocol = RTE_PTYPE_L3_IPV6;\n+\telse if (!strcmp(value, \"l3\"))\n+\t\tprotocol = RTE_PTYPE_L3_IPV4|RTE_PTYPE_L3_IPV6;\n+\telse if (!strcmp(value, \"tcp\"))\n+\t\tprotocol = RTE_PTYPE_L4_TCP;\n+\telse if (!strcmp(value, \"udp\"))\n+\t\tprotocol = RTE_PTYPE_L4_UDP;\n+\telse if (!strcmp(value, \"sctp\"))\n+\t\tprotocol = RTE_PTYPE_L4_SCTP;\n+\telse if (!strcmp(value, \"l4\"))\n+\t\tprotocol = RTE_PTYPE_L4_TCP|RTE_PTYPE_L4_UDP|RTE_PTYPE_L4_SCTP;\n+\telse if (!strcmp(value, \"inner_mac\"))\n+\t\tprotocol = RTE_PTYPE_INNER_L2_ETHER;\n+\telse if (!strcmp(value, \"inner_ipv4\"))\n+\t\tprotocol = RTE_PTYPE_INNER_L3_IPV4;\n+\telse if (!strcmp(value, \"inner_ipv6\"))\n+\t\tprotocol = RTE_PTYPE_INNER_L3_IPV6;\n+\telse if (!strcmp(value, \"inner_l3\"))\n+\t\tprotocol = RTE_PTYPE_INNER_L3_IPV4|RTE_PTYPE_INNER_L3_IPV6;\n+\telse if (!strcmp(value, \"inner_tcp\"))\n+\t\tprotocol = RTE_PTYPE_INNER_L4_TCP;\n+\telse if (!strcmp(value, \"inner_udp\"))\n+\t\tprotocol = RTE_PTYPE_INNER_L4_UDP;\n+\telse if (!strcmp(value, \"inner_sctp\"))\n+\t\tprotocol = RTE_PTYPE_INNER_L4_SCTP;\n+\telse if (!strcmp(value, \"unknown\"))\n+\t\tprotocol = RTE_PTYPE_UNKNOWN;\n+\telse if (!strcmp(value, \"gre\"))\n+\t\tprotocol = RTE_PTYPE_TUNNEL_GRE;\n+\telse if (!strcmp(value, \"qinq\"))\n+\t\tprotocol = RTE_PTYPE_L2_ETHER_QINQ;\n+\telse {\n+\t\tfprintf(stderr, \"Unsupported protocol name: %s\\n\", value);\n+\t\treturn 0;\n+\t}\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+\tnb_item = 0;\n+\tchar *str2 = strdup(str);\n+\tcur = strtok_r(str2, \",\", &tmp);\n+\twhile (cur != NULL) {\n+\t\tparsed_items[nb_item] = get_ptype(cur);\n+\t\tcur = strtok_r(NULL, \",\", &tmp);\n+\t\tnb_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+\tset_rx_pkt_hdrs(parsed_items, nb_item);\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@@ -3986,6 +4067,49 @@ 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 cmd_keyword;\n+\tcmdline_fixed_string_t rxhdrs;\n+\tcmdline_fixed_string_t seg_hdrs;\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->seg_hdrs, \"segment hdrs\",\n+\t\t\t\t  MAX_SEGS_BUFFER_SPLIT, seg_hdrs, 0);\n+\tif (nb_segs >= 1)\n+\t\tset_rx_pkt_hdrs(seg_hdrs, nb_segs);\n+\tcmd_reconfig_device_queue(RTE_PORT_ALL, 0, 1);\n+}\n+cmdline_parse_token_string_t cmd_set_rxhdrs_keyword =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_rxhdrs_result,\n+\t\t\t\t cmd_keyword, \"set\");\n+cmdline_parse_token_string_t cmd_set_rxhdrs_name =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_rxhdrs_result,\n+\t\t\t\t rxhdrs, \"rxhdrs\");\n+cmdline_parse_token_string_t cmd_set_rxhdrs_seg_hdrs =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_rxhdrs_result,\n+\t\t\t\t seg_hdrs, NULL);\n+cmdline_parse_inst_t cmd_set_rxhdrs = {\n+\t.f = cmd_set_rxhdrs_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set rxhdrs <mac[,ipv4]*>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_rxhdrs_keyword,\n+\t\t(void *)&cmd_set_rxhdrs_name,\n+\t\t(void *)&cmd_set_rxhdrs_seg_hdrs,\n+\t\tNULL,\n+\t},\n+};\n /* *** SET SEGMENT LENGTHS OF TXONLY PACKETS *** */\n \n struct cmd_set_txpkts_result {\n@@ -8058,6 +8182,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@@ -8070,12 +8196,12 @@ cmdline_parse_token_string_t cmd_showcfg_port =\n \tTOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, \"config\");\n 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 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@@ -17833,6 +17959,7 @@ cmdline_parse_ctx_t main_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 cc8e7aa138..90ac5cfa68 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -4757,6 +4757,81 @@ show_rx_pkt_segments(void)\n \t\tprintf(\"%hu\\n\", rx_pkt_seg_lengths[i]);\n \t}\n }\n+static const char *get_ptype_str(uint32_t ptype)\n+{\n+\tswitch (ptype) {\n+\tcase RTE_PTYPE_INNER_L2_ETHER_QINQ:\n+\t\treturn \"qinq\";\n+\tcase RTE_PTYPE_TUNNEL_GRE:\n+\t\treturn \"gre\";\n+\tcase RTE_PTYPE_UNKNOWN:\n+\t\treturn \"unknown\";\n+\tcase RTE_PTYPE_L2_ETHER:\n+\t\treturn \"outer_mac\";\n+\tcase RTE_PTYPE_L3_IPV4:\n+\t\treturn \"ipv4\";\n+\tcase RTE_PTYPE_L3_IPV6:\n+\t\treturn \"ipv6\";\n+\tcase RTE_PTYPE_L3_IPV6|RTE_PTYPE_L3_IPV4:\n+\t\treturn \"ip\";\n+\tcase RTE_PTYPE_L4_TCP:\n+\t\treturn \"tcp\";\n+\tcase RTE_PTYPE_L4_UDP:\n+\t\treturn \"udp\";\n+\tcase RTE_PTYPE_L4_SCTP:\n+\t\treturn \"sctp\";\n+\tcase RTE_PTYPE_L4_TCP|RTE_PTYPE_L4_UDP|RTE_PTYPE_L4_SCTP:\n+\t\treturn \"l4\";\n+\tcase RTE_PTYPE_INNER_L2_ETHER:\n+\t\treturn \"inner_mac\";\n+\tcase RTE_PTYPE_INNER_L3_IPV4:\n+\t\treturn \"inner_ipv4\";\n+\tcase RTE_PTYPE_INNER_L3_IPV6:\n+\t\treturn \"inner_ipv6\";\n+\tcase RTE_PTYPE_INNER_L4_TCP:\n+\t\treturn \"inner_tcp\";\n+\tcase RTE_PTYPE_INNER_L4_UDP:\n+\t\treturn \"inner_udp\";\n+\tcase RTE_PTYPE_INNER_L4_SCTP:\n+\t\treturn \"inner_sctp\";\n+\tdefault:\n+\t\treturn \"unsupported\";\n+\t}\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(\"%s\\n\", rx_pkt_hdr_protos[i] == 0 ? \"payload\" :\n+\t\t\t\t\t\tget_ptype_str(rx_pkt_hdr_protos[i]));\n+\t}\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 >= MAX_SEGS_BUFFER_SPLIT) {\n+\t\tprintf(\"nb segments per RX packets=%u >= \"\n+\t\t       \"MAX_SEGS_BUFFER_SPLIT - ignored\\n\", nb_segs);\n+\t\treturn;\n+\t}\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 = (rx_pkt_nb_segs == 0) ? (uint8_t) nb_segs + 1 : rx_pkt_nb_segs;\n+}\n \n void\n set_rx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs)\ndiff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c\nindex daf6a31b2b..f86d626276 100644\n--- a/app/test-pmd/parameters.c\n+++ b/app/test-pmd/parameters.c\n@@ -161,6 +161,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=mac[,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@@ -673,6 +674,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@@ -1327,7 +1329,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@@ -1337,6 +1338,18 @@ 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+\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 >= 1)\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 fe2ce19f99..ef679c70be 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -240,6 +240,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@@ -2587,11 +2588,12 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,\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\t\t\t\trx_pkt_seg_lengths[i] :\n+\t\t\t\t\tmbuf_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\trx_seg->proto_hdr = rx_pkt_hdr_protos[i];\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 31f766c965..e791b9becd 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -534,6 +534,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@@ -864,6 +865,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 cmdline_read_from_file(const char *filename);\n void prompt(void);\n@@ -1018,6 +1022,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);\n",
    "prefixes": [
        "v9",
        "3/4"
    ]
}