get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 28605,
    "url": "https://patches.dpdk.org/api/patches/28605/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1505184211-36728-6-git-send-email-jiayu.hu@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": "<1505184211-36728-6-git-send-email-jiayu.hu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1505184211-36728-6-git-send-email-jiayu.hu@intel.com",
    "date": "2017-09-12T02:43:31",
    "name": "[dpdk-dev,v3,5/5] app/testpmd: enable TCP/IPv4, VxLAN and GRE GSO",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4fd031141a5e150d1715716bcbdba82bf1abd5a5",
    "submitter": {
        "id": 539,
        "url": "https://patches.dpdk.org/api/people/539/?format=api",
        "name": "Hu, Jiayu",
        "email": "jiayu.hu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1505184211-36728-6-git-send-email-jiayu.hu@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/28605/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/28605/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 17CEF1B1A3;\n\tTue, 12 Sep 2017 04:41:03 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 5F40B7CCD\n\tfor <dev@dpdk.org>; Tue, 12 Sep 2017 04:40:54 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Sep 2017 19:40:52 -0700",
            "from dpdk15.sh.intel.com ([10.67.111.77])\n\tby fmsmga001.fm.intel.com with ESMTP; 11 Sep 2017 19:40:51 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos; i=\"5.42,381,1500966000\"; d=\"scan'208\";\n\ta=\"1194022494\"",
        "From": "Jiayu Hu <jiayu.hu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "konstantin.ananyev@intel.com, mark.b.kavanagh@intel.com,\n\tjianfeng.tan@intel.com, Jiayu Hu <jiayu.hu@intel.com>",
        "Date": "Tue, 12 Sep 2017 10:43:31 +0800",
        "Message-Id": "<1505184211-36728-6-git-send-email-jiayu.hu@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1505184211-36728-1-git-send-email-jiayu.hu@intel.com>",
        "References": "<1504598270-60080-1-git-send-email-jiayu.hu@intel.com>\n\t<1505184211-36728-1-git-send-email-jiayu.hu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 5/5] app/testpmd: enable TCP/IPv4,\n\tVxLAN and GRE GSO",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch adds GSO support to the csum forwarding engine. Oversized\npackets transmitted over a GSO-enabled port will undergo segmentation\n(with the exception of packet-types unsupported by the GSO library).\nGSO support is disabled by default.\n\nGSO support may be toggled on a per-port basis, using the command:\n\n        \"set port <port_id> gso on|off\"\n\nThe maximum packet length (including the packet header and payload) for\nGSO segments may be set with the command:\n\n        \"set gso segsz <length>\"\n\nShow GSO configuration for a given port with the command:\n\n\t\"show port <port_id> gso\"\n\nSigned-off-by: Jiayu Hu <jiayu.hu@intel.com>\nSigned-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>\n---\n app/test-pmd/cmdline.c  | 178 ++++++++++++++++++++++++++++++++++++++++++++++++\n app/test-pmd/config.c   |  24 +++++++\n app/test-pmd/csumonly.c | 102 +++++++++++++++++++++++++--\n app/test-pmd/testpmd.c  |  16 +++++\n app/test-pmd/testpmd.h  |  10 +++\n 5 files changed, 326 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex cd8c358..03b98a3 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -431,6 +431,17 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\"    Set max flow number and max packet number per-flow\"\n \t\t\t\" for GRO.\\n\\n\"\n \n+\t\t\t\"set port (port_id) gso (on|off)\"\n+\t\t\t\"    Enable or disable Generic Segmentation Offload in\"\n+\t\t\t\" csum forwarding engine.\\n\\n\"\n+\n+\t\t\t\"set gso segsz (length)\\n\"\n+\t\t\t\"    Set max packet length for output GSO segments,\"\n+\t\t\t\" including packet header and payload.\\n\\n\"\n+\n+\t\t\t\"show port (port_id) gso\\n\"\n+\t\t\t\"    Show GSO configuration.\\n\\n\"\n+\n \t\t\t\"set fwd (%s)\\n\"\n \t\t\t\"    Set packet forwarding mode.\\n\\n\"\n \n@@ -3963,6 +3974,170 @@ cmdline_parse_inst_t cmd_gro_set = {\n \t},\n };\n \n+/* *** ENABLE/DISABLE GSO *** */\n+struct cmd_gso_enable_result {\n+\tcmdline_fixed_string_t cmd_set;\n+\tcmdline_fixed_string_t cmd_port;\n+\tcmdline_fixed_string_t cmd_keyword;\n+\tcmdline_fixed_string_t cmd_mode;\n+\tuint8_t cmd_pid;\n+};\n+\n+static void\n+cmd_gso_enable_parsed(void *parsed_result,\n+\t\t__attribute__((unused)) struct cmdline *cl,\n+\t\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_gso_enable_result *res;\n+\n+\tres = parsed_result;\n+\tif (!strcmp(res->cmd_keyword, \"gso\"))\n+\t\tsetup_gso(res->cmd_mode, res->cmd_pid);\n+}\n+\n+cmdline_parse_token_string_t cmd_gso_enable_set =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result,\n+\t\t\tcmd_set, \"set\");\n+cmdline_parse_token_string_t cmd_gso_enable_port =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result,\n+\t\t\tcmd_port, \"port\");\n+cmdline_parse_token_string_t cmd_gso_enable_keyword =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result,\n+\t\t\tcmd_keyword, \"gso\");\n+cmdline_parse_token_string_t cmd_gso_enable_mode =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_gso_enable_result,\n+\t\t\tcmd_mode, \"on#off\");\n+cmdline_parse_token_num_t cmd_gso_enable_pid =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_gso_enable_result,\n+\t\t\tcmd_pid, UINT8);\n+\n+cmdline_parse_inst_t cmd_gso_enable = {\n+\t.f = cmd_gso_enable_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set port <port_id> gso on|off\",\n+\t.tokens = {\n+\t\t(void *)&cmd_gso_enable_set,\n+\t\t(void *)&cmd_gso_enable_port,\n+\t\t(void *)&cmd_gso_enable_pid,\n+\t\t(void *)&cmd_gso_enable_keyword,\n+\t\t(void *)&cmd_gso_enable_mode,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** SET MAX PACKET LENGTH FOR GSO SEGMENTS *** */\n+struct cmd_gso_size_result {\n+\tcmdline_fixed_string_t cmd_set;\n+\tcmdline_fixed_string_t cmd_keyword;\n+\tcmdline_fixed_string_t cmd_segsz;\n+\tuint16_t cmd_size;\n+};\n+\n+static void\n+cmd_gso_size_parsed(void *parsed_result,\n+\t\t       __attribute__((unused)) struct cmdline *cl,\n+\t\t       __attribute__((unused)) void *data)\n+{\n+\tstruct cmd_gso_size_result *res = parsed_result;\n+\n+\tif (test_done == 0) {\n+\t\tprintf(\"Before set GSO segsz, please stop fowarding first\\n\");\n+\t\treturn;\n+\t}\n+\n+\tif (!strcmp(res->cmd_keyword, \"gso\") &&\n+\t\t\t!strcmp(res->cmd_segsz, \"segsz\")) {\n+\t\tif (res->cmd_size == 0) {\n+\t\t\tprintf(\"gso_size should be larger than 0.\"\n+\t\t\t\t\t\" Please input a legal value\\n\");\n+\t\t} else\n+\t\t\tgso_max_segment_size = res->cmd_size;\n+\t}\n+}\n+\n+cmdline_parse_token_string_t cmd_gso_size_set =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_gso_size_result,\n+\t\t\t\tcmd_set, \"set\");\n+cmdline_parse_token_string_t cmd_gso_size_keyword =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_gso_size_result,\n+\t\t\t\tcmd_keyword, \"gso\");\n+cmdline_parse_token_string_t cmd_gso_size_segsz =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_gso_size_result,\n+\t\t\t\tcmd_segsz, \"segsz\");\n+cmdline_parse_token_num_t cmd_gso_size_size =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_gso_size_result,\n+\t\t\t\tcmd_size, UINT16);\n+\n+cmdline_parse_inst_t cmd_gso_size = {\n+\t.f = cmd_gso_size_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set gso segsz <length>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_gso_size_set,\n+\t\t(void *)&cmd_gso_size_keyword,\n+\t\t(void *)&cmd_gso_size_segsz,\n+\t\t(void *)&cmd_gso_size_size,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** SHOW GSO CONFIGURATION *** */\n+struct cmd_gso_show_result {\n+\tcmdline_fixed_string_t cmd_show;\n+\tcmdline_fixed_string_t cmd_port;\n+\tcmdline_fixed_string_t cmd_keyword;\n+\tuint8_t cmd_pid;\n+};\n+\n+static void\n+cmd_gso_show_parsed(void *parsed_result,\n+\t\t       __attribute__((unused)) struct cmdline *cl,\n+\t\t       __attribute__((unused)) void *data)\n+{\n+\tstruct cmd_gso_show_result *res = parsed_result;\n+\n+\tif (!rte_eth_dev_is_valid_port(res->cmd_pid)) {\n+\t\tprintf(\"invalid port id %u\\n\", res->cmd_pid);\n+\t\treturn;\n+\t}\n+\n+\tif (!strcmp(res->cmd_keyword, \"gso\")) {\n+\t\tif (gso_ports[res->cmd_pid].enable) {\n+\t\t\tprintf(\"Max GSO segment size: %uB\\n\"\n+\t\t\t\t\t\"Support GSO protocols: TCP/IPv4,\"\n+\t\t\t\t\t\" VxlAN and GRE\\n\",\n+\t\t\t\t\tgso_max_segment_size);\n+\t\t} else\n+\t\t\tprintf(\"Port %u doesn't enable GSO\\n\", res->cmd_pid);\n+\t}\n+}\n+\n+cmdline_parse_token_string_t cmd_gso_show_show =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_gso_show_result,\n+\t\t\t\tcmd_show, \"show\");\n+cmdline_parse_token_string_t cmd_gso_show_port =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_gso_show_result,\n+\t\t\t\tcmd_port, \"port\");\n+cmdline_parse_token_string_t cmd_gso_show_keyword =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_gso_show_result,\n+\t\t\t\tcmd_keyword, \"gso\");\n+cmdline_parse_token_num_t cmd_gso_show_pid =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_gso_show_result,\n+\t\t\t\tcmd_pid, UINT8);\n+\n+cmdline_parse_inst_t cmd_gso_show = {\n+\t.f = cmd_gso_show_parsed,\n+\t.data = NULL,\n+\t.help_str = \"show port <port_id> gso\",\n+\t.tokens = {\n+\t\t(void *)&cmd_gso_show_show,\n+\t\t(void *)&cmd_gso_show_port,\n+\t\t(void *)&cmd_gso_show_pid,\n+\t\t(void *)&cmd_gso_show_keyword,\n+\t\tNULL,\n+\t},\n+};\n+\n /* *** ENABLE/DISABLE FLUSH ON RX STREAMS *** */\n struct cmd_set_flush_rx {\n \tcmdline_fixed_string_t set;\n@@ -14251,6 +14426,9 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_tunnel_tso_show,\n \t(cmdline_parse_inst_t *)&cmd_enable_gro,\n \t(cmdline_parse_inst_t *)&cmd_gro_set,\n+\t(cmdline_parse_inst_t *)&cmd_gso_enable,\n+\t(cmdline_parse_inst_t *)&cmd_gso_size,\n+\t(cmdline_parse_inst_t *)&cmd_gso_show,\n \t(cmdline_parse_inst_t *)&cmd_link_flow_control_set,\n \t(cmdline_parse_inst_t *)&cmd_link_flow_control_set_rx,\n \t(cmdline_parse_inst_t *)&cmd_link_flow_control_set_tx,\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 3ae3e1c..3434346 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -2454,6 +2454,30 @@ setup_gro(const char *mode, uint8_t port_id)\n \t}\n }\n \n+void\n+setup_gso(const char *mode, uint8_t port_id)\n+{\n+\tif (!rte_eth_dev_is_valid_port(port_id)) {\n+\t\tprintf(\"invalid port id %u\\n\", port_id);\n+\t\treturn;\n+\t}\n+\tif (strcmp(mode, \"on\") == 0) {\n+\t\tif (test_done == 0) {\n+\t\t\tprintf(\"before enable GSO,\"\n+\t\t\t\t\t\" please stop forwarding first\\n\");\n+\t\t\treturn;\n+\t\t}\n+\t\tgso_ports[port_id].enable = 1;\n+\t} else if (strcmp(mode, \"off\") == 0) {\n+\t\tif (test_done == 0) {\n+\t\t\tprintf(\"before disable GSO,\"\n+\t\t\t\t\t\" please stop forwarding first\\n\");\n+\t\t\treturn;\n+\t\t}\n+\t\tgso_ports[port_id].enable = 0;\n+\t}\n+}\n+\n char*\n list_pkt_forwarding_modes(void)\n {\ndiff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c\nindex 90c8119..8e9a8a1 100644\n--- a/app/test-pmd/csumonly.c\n+++ b/app/test-pmd/csumonly.c\n@@ -66,10 +66,12 @@\n #include <rte_tcp.h>\n #include <rte_udp.h>\n #include <rte_sctp.h>\n+#include <rte_net.h>\n #include <rte_prefetch.h>\n #include <rte_string_fns.h>\n #include <rte_flow.h>\n #include <rte_gro.h>\n+#include <rte_gso.h>\n #include \"testpmd.h\"\n \n #define IP_DEFTTL  64   /* from RFC 1340. */\n@@ -103,6 +105,7 @@ struct testpmd_offload_info {\n \tuint16_t tso_segsz;\n \tuint16_t tunnel_tso_segsz;\n \tuint32_t pkt_len;\n+\tuint32_t packet_type;\n };\n \n /* simplified GRE header */\n@@ -129,10 +132,25 @@ parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info)\n \tinfo->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4;\n \tinfo->l4_proto = ipv4_hdr->next_proto_id;\n \n+\tif (info->is_tunnel)\n+\t\tinfo->packet_type |= RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN;\n+\telse\n+\t\tinfo->packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;\n+\n \t/* only fill l4_len for TCP, it's useful for TSO */\n \tif (info->l4_proto == IPPROTO_TCP) {\n \t\ttcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + info->l3_len);\n \t\tinfo->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;\n+\t\tif (info->is_tunnel)\n+\t\t\tinfo->packet_type |= RTE_PTYPE_INNER_L4_TCP;\n+\t\telse\n+\t\t\tinfo->packet_type |= RTE_PTYPE_L4_TCP;\n+\t} else if (info->l4_proto == IPPROTO_UDP) {\n+\t\tif (info->is_tunnel)\n+\t\t\tinfo->packet_type |= RTE_PTYPE_INNER_L4_UDP;\n+\t\telse\n+\t\t\tinfo->packet_type |= RTE_PTYPE_L4_UDP;\n+\t\tinfo->l4_len = 0;\n \t} else\n \t\tinfo->l4_len = 0;\n }\n@@ -146,10 +164,25 @@ parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info)\n \tinfo->l3_len = sizeof(struct ipv6_hdr);\n \tinfo->l4_proto = ipv6_hdr->proto;\n \n+\tif (info->is_tunnel)\n+\t\tinfo->packet_type |= RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN;\n+\telse\n+\t\tinfo->packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;\n+\n \t/* only fill l4_len for TCP, it's useful for TSO */\n \tif (info->l4_proto == IPPROTO_TCP) {\n \t\ttcp_hdr = (struct tcp_hdr *)((char *)ipv6_hdr + info->l3_len);\n \t\tinfo->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;\n+\t\tif (info->is_tunnel)\n+\t\t\tinfo->packet_type |= RTE_PTYPE_INNER_L4_TCP;\n+\t\telse\n+\t\t\tinfo->packet_type |= RTE_PTYPE_L4_TCP;\n+\t} else if (info->l4_proto == IPPROTO_UDP) {\n+\t\tif (info->is_tunnel)\n+\t\t\tinfo->packet_type |= RTE_PTYPE_INNER_L4_UDP;\n+\t\telse\n+\t\t\tinfo->packet_type |= RTE_PTYPE_L4_UDP;\n+\t\tinfo->l4_len = 0;\n \t} else\n \t\tinfo->l4_len = 0;\n }\n@@ -164,16 +197,26 @@ parse_ethernet(struct ether_hdr *eth_hdr, struct testpmd_offload_info *info)\n {\n \tstruct ipv4_hdr *ipv4_hdr;\n \tstruct ipv6_hdr *ipv6_hdr;\n+\tuint32_t l2_type;\n \n \tinfo->l2_len = sizeof(struct ether_hdr);\n \tinfo->ethertype = eth_hdr->ether_type;\n+\tif (info->is_tunnel)\n+\t\tl2_type = RTE_PTYPE_INNER_L2_ETHER;\n+\telse\n+\t\tl2_type = RTE_PTYPE_L2_ETHER;\n \n \tif (info->ethertype == _htons(ETHER_TYPE_VLAN)) {\n \t\tstruct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1);\n \n \t\tinfo->l2_len  += sizeof(struct vlan_hdr);\n \t\tinfo->ethertype = vlan_hdr->eth_proto;\n+\t\tif (info->is_tunnel)\n+\t\t\tl2_type = RTE_PTYPE_INNER_L2_ETHER_VLAN;\n+\t\telse\n+\t\t\tl2_type = RTE_PTYPE_L2_ETHER_VLAN;\n \t}\n+\tinfo->packet_type |= l2_type;\n \n \tswitch (info->ethertype) {\n \tcase _htons(ETHER_TYPE_IPv4):\n@@ -212,6 +255,7 @@ parse_vxlan(struct udp_hdr *udp_hdr,\n \tinfo->outer_l2_len = info->l2_len;\n \tinfo->outer_l3_len = info->l3_len;\n \tinfo->outer_l4_proto = info->l4_proto;\n+\tinfo->packet_type |= RTE_PTYPE_TUNNEL_VXLAN;\n \n \teth_hdr = (struct ether_hdr *)((char *)udp_hdr +\n \t\tsizeof(struct udp_hdr) +\n@@ -245,6 +289,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)\n \t\tinfo->outer_l2_len = info->l2_len;\n \t\tinfo->outer_l3_len = info->l3_len;\n \t\tinfo->outer_l4_proto = info->l4_proto;\n+\t\tinfo->packet_type |= RTE_PTYPE_TUNNEL_GRE;\n \n \t\tipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr + gre_len);\n \n@@ -258,6 +303,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)\n \t\tinfo->outer_l2_len = info->l2_len;\n \t\tinfo->outer_l3_len = info->l3_len;\n \t\tinfo->outer_l4_proto = info->l4_proto;\n+\t\tinfo->packet_type |= RTE_PTYPE_TUNNEL_GRE;\n \n \t\tipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr + gre_len);\n \n@@ -271,6 +317,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)\n \t\tinfo->outer_l2_len = info->l2_len;\n \t\tinfo->outer_l3_len = info->l3_len;\n \t\tinfo->outer_l4_proto = info->l4_proto;\n+\t\tinfo->packet_type |= RTE_PTYPE_TUNNEL_GRE;\n \n \t\teth_hdr = (struct ether_hdr *)((char *)gre_hdr + gre_len);\n \n@@ -299,6 +346,7 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info)\n \tinfo->outer_ethertype = info->ethertype;\n \tinfo->outer_l2_len = info->l2_len;\n \tinfo->outer_l3_len = info->l3_len;\n+\tinfo->packet_type |= RTE_PTYPE_TUNNEL_IP;\n \n \tif (ip_version == 4) {\n \t\tparse_ipv4(ipv4_hdr, info);\n@@ -627,6 +675,9 @@ static void\n pkt_burst_checksum_forward(struct fwd_stream *fs)\n {\n \tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n+\tstruct rte_mbuf *gso_segments[GSO_MAX_PKT_BURST];\n+\tstruct rte_gso_ctx *gso_ctx;\n+\tstruct rte_mbuf **tx_pkts_burst;\n \tstruct rte_port *txp;\n \tstruct rte_mbuf *m, *p;\n \tstruct ether_hdr *eth_hdr;\n@@ -641,6 +692,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \tuint32_t rx_bad_ip_csum;\n \tuint32_t rx_bad_l4_csum;\n \tstruct testpmd_offload_info info;\n+\tuint16_t nb_segments = 0;\n+\tint ret;\n \n #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES\n \tuint64_t start_tsc;\n@@ -683,6 +736,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \t\tm = pkts_burst[i];\n \t\tinfo.is_tunnel = 0;\n \t\tinfo.pkt_len = rte_pktmbuf_pkt_len(m);\n+\t\tinfo.packet_type = 0;\n \t\ttx_ol_flags = 0;\n \t\trx_ol_flags = m->ol_flags;\n \n@@ -790,6 +844,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \t\t\tm->tso_segsz = info.tso_segsz;\n \t\t}\n \t\tm->ol_flags = tx_ol_flags;\n+\t\tm->packet_type = info.packet_type;\n \n \t\t/* Do split & copy for the packet. */\n \t\tif (tx_pkt_split != TX_PKT_SPLIT_OFF) {\n@@ -851,13 +906,51 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \t\t}\n \t}\n \n+\tif (gso_ports[fs->tx_port].enable == 0)\n+\t\ttx_pkts_burst = pkts_burst;\n+\telse {\n+\t\tgso_ctx = &(current_fwd_lcore()->gso_ctx);\n+\t\tgso_ctx->gso_size = gso_max_segment_size;\n+\t\tfor (i = 0; i < nb_rx; i++) {\n+\t\t\tret = rte_gso_segment(pkts_burst[i], *gso_ctx,\n+\t\t\t\t\t&gso_segments[nb_segments],\n+\t\t\t\t\tGSO_MAX_PKT_BURST - nb_segments);\n+\t\t\tif (ret >= 1)\n+\t\t\t\tnb_segments += ret;\n+\t\t\telse if (ret < 0) {\n+\t\t\t\t/* insufficient MBUFs, stop GSO */\n+\t\t\t\tmemcpy(&gso_segments[nb_segments],\n+\t\t\t\t\t\t&pkts_burst[i],\n+\t\t\t\t\t\tsizeof(struct rte_mbuf *) *\n+\t\t\t\t\t\t(nb_rx - i));\n+\t\t\t\tnb_segments += (nb_rx - i);\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tif (unlikely(nb_rx - i >= GSO_MAX_PKT_BURST -\n+\t\t\t\t\t\tnb_segments)) {\n+\t\t\t\t/*\n+\t\t\t\t * insufficient space in gso_segments,\n+\t\t\t\t * stop GSO.\n+\t\t\t\t */\n+\t\t\t\tmemcpy(&gso_segments[nb_segments],\n+\t\t\t\t\t\t&pkts_burst[i],\n+\t\t\t\t\t\tsizeof(struct rte_mbuf *) *\n+\t\t\t\t\t\t(nb_rx - i));\n+\t\t\t\tnb_segments += (nb_rx - i);\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t\ttx_pkts_burst = gso_segments;\n+\t\tnb_rx = nb_segments;\n+\t}\n+\n \tnb_prep = rte_eth_tx_prepare(fs->tx_port, fs->tx_queue,\n-\t\t\tpkts_burst, nb_rx);\n+\t\t\ttx_pkts_burst, nb_rx);\n \tif (nb_prep != nb_rx)\n \t\tprintf(\"Preparing packet burst to transmit failed: %s\\n\",\n \t\t\t\trte_strerror(rte_errno));\n \n-\tnb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst,\n+\tnb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, tx_pkts_burst,\n \t\t\tnb_prep);\n \n \t/*\n@@ -868,7 +961,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \t\twhile (nb_tx < nb_rx && retry++ < burst_tx_retry_num) {\n \t\t\trte_delay_us(burst_tx_delay_time);\n \t\t\tnb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue,\n-\t\t\t\t\t&pkts_burst[nb_tx], nb_rx - nb_tx);\n+\t\t\t\t\t&tx_pkts_burst[nb_tx], nb_rx - nb_tx);\n \t\t}\n \t}\n \tfs->tx_packets += nb_tx;\n@@ -881,9 +974,10 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \tif (unlikely(nb_tx < nb_rx)) {\n \t\tfs->fwd_dropped += (nb_rx - nb_tx);\n \t\tdo {\n-\t\t\trte_pktmbuf_free(pkts_burst[nb_tx]);\n+\t\t\trte_pktmbuf_free(tx_pkts_burst[nb_tx]);\n \t\t} while (++nb_tx < nb_rx);\n \t}\n+\n #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES\n \tend_tsc = rte_rdtsc();\n \tcore_cycles = (end_tsc - start_tsc);\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 7d40139..dd4b365 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -400,6 +400,9 @@ static int eth_event_callback(uint8_t port_id,\n  */\n static int all_ports_started(void);\n \n+struct gso_status gso_ports[RTE_MAX_ETHPORTS];\n+uint16_t gso_max_segment_size = ETHER_MAX_LEN;\n+\n /*\n  * Helper function to check if socket is already discovered.\n  * If yes, return positive value. If not, return zero.\n@@ -570,6 +573,7 @@ init_config(void)\n \tunsigned int nb_mbuf_per_pool;\n \tlcoreid_t  lc_id;\n \tuint8_t port_per_socket[RTE_MAX_NUMA_NODES];\n+\tuint32_t gso_types = 0;\n \n \tmemset(port_per_socket,0,RTE_MAX_NUMA_NODES);\n \n@@ -654,6 +658,12 @@ init_config(void)\n \n \tinit_port_config();\n \n+\tgso_types = RTE_PTYPE_L2_ETHER_VLAN | RTE_PTYPE_L2_ETHER |\n+\t\tRTE_PTYPE_INNER_L2_ETHER | RTE_PTYPE_INNER_L2_ETHER_VLAN |\n+\t\tRTE_PTYPE_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_L4_TCP |\n+\t\tRTE_PTYPE_L4_UDP | RTE_PTYPE_TUNNEL_VXLAN |\n+\t\tRTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | RTE_PTYPE_INNER_L4_TCP |\n+\t\tRTE_PTYPE_TUNNEL_GRE;\n \t/*\n \t * Records which Mbuf pool to use by each logical core, if needed.\n \t */\n@@ -664,6 +674,12 @@ init_config(void)\n \t\tif (mbp == NULL)\n \t\t\tmbp = mbuf_pool_find(0);\n \t\tfwd_lcores[lc_id]->mbp = mbp;\n+\t\t/* initialize GSO context */\n+\t\tfwd_lcores[lc_id]->gso_ctx.direct_pool = mbp;\n+\t\tfwd_lcores[lc_id]->gso_ctx.indirect_pool = mbp;\n+\t\tfwd_lcores[lc_id]->gso_ctx.gso_types = gso_types;\n+\t\tfwd_lcores[lc_id]->gso_ctx.gso_size = ETHER_MAX_LEN;\n+\t\tfwd_lcores[lc_id]->gso_ctx.ipid_flag = RTE_GSO_IPID_INCREASE;\n \t}\n \n \t/* Configuration of packet forwarding streams. */\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex c9d7739..725af1a 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -36,6 +36,7 @@\n \n #include <rte_pci.h>\n #include <rte_gro.h>\n+#include <rte_gso.h>\n \n #define RTE_PORT_ALL            (~(portid_t)0x0)\n \n@@ -205,6 +206,7 @@ struct rte_port {\n  * CPU id. configuration table.\n  */\n struct fwd_lcore {\n+\tstruct rte_gso_ctx gso_ctx;     /**< GSO context */\n \tstruct rte_mempool *mbp; /**< The mbuf pool to use by this core */\n \tstreamid_t stream_idx;   /**< index of 1st stream in \"fwd_streams\" */\n \tstreamid_t stream_nb;    /**< number of streams in \"fwd_streams\" */\n@@ -442,6 +444,13 @@ struct gro_status {\n };\n extern struct gro_status gro_ports[RTE_MAX_ETHPORTS];\n \n+#define GSO_MAX_PKT_BURST 2048\n+struct gso_status {\n+\tuint8_t enable;\n+};\n+extern struct gso_status gso_ports[RTE_MAX_ETHPORTS];\n+extern uint16_t gso_max_segment_size;\n+\n static inline unsigned int\n lcore_num(void)\n {\n@@ -641,6 +650,7 @@ void get_5tuple_filter(uint8_t port_id, uint16_t index);\n int rx_queue_id_is_invalid(queueid_t rxq_id);\n int tx_queue_id_is_invalid(queueid_t txq_id);\n void setup_gro(const char *mode, uint8_t port_id);\n+void setup_gso(const char *mode, uint8_t port_id);\n \n /* Functions to manage the set of filtered Multicast MAC addresses */\n void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "5/5"
    ]
}