get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 27876,
    "url": "https://patches.dpdk.org/api/patches/27876/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1503584144-63181-4-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": "<1503584144-63181-4-git-send-email-jiayu.hu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1503584144-63181-4-git-send-email-jiayu.hu@intel.com",
    "date": "2017-08-24T14:15:42",
    "name": "[dpdk-dev,3/5] lib/gso: add VxLAN GSO support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "707163f9727e2f722abccad91b4cbd9fec075893",
    "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/1503584144-63181-4-git-send-email-jiayu.hu@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/27876/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/27876/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 6AB097D5A;\n\tThu, 24 Aug 2017 16:13:47 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 783DA7D24\n\tfor <dev@dpdk.org>; Thu, 24 Aug 2017 16:13:43 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Aug 2017 07:13:42 -0700",
            "from dpdk15.sh.intel.com ([10.67.111.77])\n\tby orsmga005.jf.intel.com with ESMTP; 24 Aug 2017 07:13:41 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.41,421,1498546800\"; d=\"scan'208\";a=\"141575665\"",
        "From": "Jiayu Hu <jiayu.hu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "mark.b.kavanagh@intel.com, konstantin.ananyev@intel.com,\n\tjianfeng.tan@intel.com, Jiayu Hu <jiayu.hu@intel.com>",
        "Date": "Thu, 24 Aug 2017 22:15:42 +0800",
        "Message-Id": "<1503584144-63181-4-git-send-email-jiayu.hu@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1503584144-63181-1-git-send-email-jiayu.hu@intel.com>",
        "References": "<1503584144-63181-1-git-send-email-jiayu.hu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 3/5] lib/gso: add VxLAN GSO support",
        "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": "From: Mark Kavanagh <mark.b.kavanagh@intel.com>\n\nThis patch adds GSO support for VxLAN-encapsulated packets. Supported\nVxLAN packets must have an outer IPv4 header (prepended by an optional\nVLAN tag), and contain an inner TCP/IPv4 packet (with an optional inner\nVLAN tag).\n\nVxLAN GSO assumes that all input packets have correct checksums and\ndoesn't update checksums for output packets. Additionally, it doesn't\nprocess IP fragmented packets.\n\nAs with TCP/IPv4 GSO, VxLAN GSO uses a two-segment MBUF to organize each\noutput packet, which mandates support for multi-segment mbufs in the TX\nfunctions of the NIC driver. Also, if a packet is GSOed, VxLAN GSO\nreduces its MBUF refcnt by 1. As a result, when all of its GSOed\nsegments are freed, the packet is freed automatically.\n\nSigned-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>\nSigned-off-by: Jiayu Hu <jiayu.hu@intel.com>\n---\n lib/librte_gso/Makefile     |   1 +\n lib/librte_gso/gso_common.c | 109 ++++++++++++++++++++++++++++++++++++++++++--\n lib/librte_gso/gso_common.h |  41 ++++++++++++++++-\n lib/librte_gso/gso_tunnel.c |  62 +++++++++++++++++++++++++\n lib/librte_gso/gso_tunnel.h |  46 +++++++++++++++++++\n lib/librte_gso/rte_gso.c    |  12 ++++-\n lib/librte_gso/rte_gso.h    |   4 ++\n 7 files changed, 268 insertions(+), 7 deletions(-)\n create mode 100644 lib/librte_gso/gso_tunnel.c\n create mode 100644 lib/librte_gso/gso_tunnel.h",
    "diff": "diff --git a/lib/librte_gso/Makefile b/lib/librte_gso/Makefile\nindex 0f8e38f..a4d1a81 100644\n--- a/lib/librte_gso/Makefile\n+++ b/lib/librte_gso/Makefile\n@@ -44,6 +44,7 @@ LIBABIVER := 1\n SRCS-$(CONFIG_RTE_LIBRTE_GSO) += rte_gso.c\n SRCS-$(CONFIG_RTE_LIBRTE_GSO) += gso_common.c\n SRCS-$(CONFIG_RTE_LIBRTE_GSO) += gso_tcp.c\n+SRCS-$(CONFIG_RTE_LIBRTE_GSO) += gso_tunnel.c\n \n # install this header file\n SYMLINK-$(CONFIG_RTE_LIBRTE_GSO)-include += rte_gso.h\ndiff --git a/lib/librte_gso/gso_common.c b/lib/librte_gso/gso_common.c\nindex 2b54fbd..65cec44 100644\n--- a/lib/librte_gso/gso_common.c\n+++ b/lib/librte_gso/gso_common.c\n@@ -39,6 +39,7 @@\n #include <rte_ether.h>\n #include <rte_ip.h>\n #include <rte_tcp.h>\n+#include <rte_udp.h>\n \n #include \"gso_common.h\"\n \n@@ -156,18 +157,60 @@ gso_do_segment(struct rte_mbuf *pkt,\n \treturn nb_segs;\n }\n \n+static inline void parse_ethernet(struct ether_hdr *eth_hdr,\n+\t\tstruct rte_mbuf *pkt);\n+\n+static inline void\n+parse_vxlan(struct udp_hdr *udp_hdr, struct rte_mbuf *pkt)\n+{\n+\tstruct ether_hdr *eth_hdr;\n+\n+\teth_hdr = (struct ether_hdr *)((char *)udp_hdr +\n+\t\t\tsizeof(struct udp_hdr) +\n+\t\t\tsizeof(struct vxlan_hdr));\n+\n+\tpkt->packet_type |= RTE_PTYPE_TUNNEL_VXLAN;\n+\tpkt->outer_l2_len = pkt->l2_len;\n+\tparse_ethernet(eth_hdr, pkt);\n+\tpkt->l2_len += ETHER_VXLAN_HLEN; /* add udp + vxlan */\n+}\n+\n+static inline void\n+parse_udp(struct udp_hdr *udp_hdr, struct rte_mbuf *pkt)\n+{\n+\t/* Outer UDP header of VxLAN packet */\n+\tif (udp_hdr->dst_port == rte_cpu_to_be_16(VXLAN_DEFAULT_PORT)) {\n+\t\tpkt->packet_type |= RTE_PTYPE_L4_UDP;\n+\t\tparse_vxlan(udp_hdr, pkt);\n+\t} else {\n+\t\t/* IPv4/UDP packet */\n+\t\tpkt->l4_len = sizeof(struct udp_hdr);\n+\t\tpkt->packet_type |= RTE_PTYPE_L4_UDP;\n+\t}\n+}\n+\n static inline void\n parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct rte_mbuf *pkt)\n {\n \tstruct tcp_hdr *tcp_hdr;\n+\tstruct udp_hdr *udp_hdr;\n \n \tswitch (ipv4_hdr->next_proto_id) {\n \tcase IPPROTO_TCP:\n-\t\tpkt->packet_type |= RTE_PTYPE_L4_TCP;\n+\t\tif (IS_VXLAN_PKT(pkt)) {\n+\t\t\tpkt->outer_l3_len = pkt->l3_len;\n+\t\t\tpkt->packet_type |= RTE_PTYPE_INNER_L4_TCP;\n+\t\t} else\n+\t\t\tpkt->packet_type |= RTE_PTYPE_L4_TCP;\n \t\tpkt->l3_len = IPv4_HDR_LEN(ipv4_hdr);\n \t\ttcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len);\n \t\tpkt->l4_len = TCP_HDR_LEN(tcp_hdr);\n \t\tbreak;\n+\tcase IPPROTO_UDP:\n+\t\tpkt->l3_len = IPv4_HDR_LEN(ipv4_hdr);\n+\t\tudp_hdr = (struct udp_hdr *)((char *)ipv4_hdr + pkt->l3_len);\n+\t\tparse_udp(udp_hdr, pkt);\n+\t\tbreak;\n \t}\n }\n \n@@ -182,13 +225,21 @@ parse_ethernet(struct ether_hdr *eth_hdr, struct rte_mbuf *pkt)\n \tif (ethertype == ETHER_TYPE_VLAN) {\n \t\tvlan_hdr = (struct vlan_hdr *)(eth_hdr + 1);\n \t\tpkt->l2_len = sizeof(struct vlan_hdr);\n-\t\tpkt->packet_type |= RTE_PTYPE_L2_ETHER_VLAN;\n+\t\tif (IS_VXLAN_PKT(pkt))\n+\t\t\tpkt->packet_type |= RTE_PTYPE_INNER_L2_ETHER_VLAN;\n+\t\telse\n+\t\t\tpkt->packet_type |= RTE_PTYPE_L2_ETHER_VLAN;\n \t\tethertype = rte_be_to_cpu_16(vlan_hdr->eth_proto);\n-\t}\n+\t} else\n+\t\tpkt->l2_len = 0;\n \n \tswitch (ethertype) {\n \tcase ETHER_TYPE_IPv4:\n-\t\tif (IS_VLAN_PKT(pkt)) {\n+\t\tif (IS_VXLAN_PKT(pkt)) {\n+\t\t\tif (!IS_INNER_VLAN_PKT(pkt))\n+\t\t\t\tpkt->packet_type |= RTE_PTYPE_INNER_L2_ETHER;\n+\t\t\tpkt->packet_type |= RTE_PTYPE_INNER_L3_IPV4;\n+\t\t} else if (IS_VLAN_PKT(pkt)) {\n \t\t\tpkt->packet_type |= RTE_PTYPE_L3_IPV4;\n \t\t} else {\n \t\t\tpkt->packet_type |= RTE_PTYPE_L2_ETHER;\n@@ -236,14 +287,62 @@ void\n gso_update_pkt_headers(struct rte_mbuf *pkt, uint16_t nb_segments,\n \t\tstruct rte_mbuf **out_segments)\n {\n-\tstruct ipv4_hdr *ipv4_hdr;\n+\tstruct ipv4_hdr *ipv4_hdr, *outer_ipv4_hdr;\n \tstruct tcp_hdr *tcp_hdr;\n+\tstruct udp_hdr *udp_hdr;\n \tstruct rte_mbuf *seg;\n \tuint32_t sent_seq;\n \tuint16_t offset, i;\n \tuint16_t tail_seg_idx = nb_segments - 1, id;\n+\tuint16_t outer_id;\n \n \tswitch (pkt->packet_type) {\n+\tcase ETHER_VLAN_IPv4_UDP_VXLAN_VLAN_IPv4_TCP_PKT:\n+\tcase ETHER_VLAN_IPv4_UDP_VXLAN_IPv4_TCP_PKT:\n+\tcase ETHER_IPv4_UDP_VXLAN_VLAN_IPv4_TCP_PKT:\n+\tcase ETHER_IPv4_UDP_VXLAN_IPv4_TCP_PKT:\n+\t\touter_ipv4_hdr =\n+\t\t\t(struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) +\n+\t\t\t\tpkt->outer_l2_len);\n+\t\tipv4_hdr = (struct ipv4_hdr *)((char *)(outer_ipv4_hdr +\n+\t\t\t\t\tpkt->outer_l3_len + pkt->l2_len));\n+\t\ttcp_hdr = (struct tcp_hdr *)(ipv4_hdr + 1);\n+\n+\t\touter_id = rte_be_to_cpu_16(outer_ipv4_hdr->packet_id);\n+\t\tid = rte_be_to_cpu_16(ipv4_hdr->packet_id);\n+\t\tsent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq);\n+\n+\t\tfor (i = 0; i < nb_segments; i++) {\n+\t\t\tseg = out_segments[i];\n+\n+\t\t\t/* Update outer IPv4 header */\n+\t\t\toffset = seg->outer_l2_len;\n+\t\t\tupdate_ipv4_header(rte_pktmbuf_mtod(seg, char *),\n+\t\t\t\t\toffset, seg->pkt_len, outer_id);\n+\t\t\touter_id++;\n+\n+\t\t\t/* Update outer UDP header */\n+\t\t\toffset += seg->outer_l3_len;\n+\t\t\tudp_hdr = (struct udp_hdr *)(\n+\t\t\t\t\trte_pktmbuf_mtod(seg, char *) +\n+\t\t\t\t\toffset);\n+\t\t\tudp_hdr->dgram_len = rte_cpu_to_be_16(seg->pkt_len -\n+\t\t\t\t\toffset);\n+\n+\t\t\t/* Update inner IPv4 header */\n+\t\t\toffset += seg->l2_len;\n+\t\t\tupdate_ipv4_header(rte_pktmbuf_mtod(seg, char*),\n+\t\t\t\t\toffset, seg->pkt_len, id);\n+\t\t\tid++;\n+\n+\t\t\t/* Update inner TCP header */\n+\t\t\toffset += seg->l3_len;\n+\t\t\tupdate_tcp_header(rte_pktmbuf_mtod(seg, char *),\n+\t\t\t\t\toffset, sent_seq, i < tail_seg_idx);\n+\n+\t\t\tsent_seq += seg->next->data_len;\n+\t\t}\n+\t\tbreak;\n \tcase ETHER_VLAN_IPv4_TCP_PKT:\n \tcase ETHER_IPv4_TCP_PKT:\n \t\tipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) +\ndiff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h\nindex d750041..0ad95d3 100644\n--- a/lib/librte_gso/gso_common.h\n+++ b/lib/librte_gso/gso_common.h\n@@ -46,6 +46,8 @@\n #define TCP_HDR_LEN(tcph) ((tcph->data_off & 0xf0) >> 2)\n \n #define ETHER_IPv4_PKT (RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4)\n+#define INNER_ETHER_IPv4_TCP_PKT (RTE_PTYPE_INNER_L2_ETHER |\\\n+\t\tRTE_PTYPE_INNER_L3_IPV4 | RTE_PTYPE_INNER_L4_TCP)\n /* Supported packet types */\n /* TCP/IPv4 packet. */\n #define ETHER_IPv4_TCP_PKT (ETHER_IPv4_PKT | RTE_PTYPE_L4_TCP)\n@@ -54,9 +56,46 @@\n #define ETHER_VLAN_IPv4_TCP_PKT (RTE_PTYPE_L2_ETHER_VLAN | \\\n \t\tRTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_TCP)\n \n+/* VxLAN packet */\n+#define ETHER_IPv4_UDP_VXLAN_IPv4_TCP_PKT (ETHER_IPv4_PKT | \\\n+\t\tRTE_PTYPE_L4_UDP | \\\n+\t\tRTE_PTYPE_TUNNEL_VXLAN | \\\n+\t\tINNER_ETHER_IPv4_TCP_PKT)\n+\n+/* VxLAN packet with outer VLAN tag. */\n+#define ETHER_VLAN_IPv4_UDP_VXLAN_IPv4_TCP_PKT (RTE_PTYPE_L2_ETHER_VLAN | \\\n+\t\tRTE_PTYPE_L3_IPV4 | \\\n+\t\tRTE_PTYPE_L4_UDP | \\\n+\t\tRTE_PTYPE_TUNNEL_VXLAN | \\\n+\t\tINNER_ETHER_IPv4_TCP_PKT)\n+\n+/* VxLAN packet with inner VLAN tag. */\n+#define ETHER_IPv4_UDP_VXLAN_VLAN_IPv4_TCP_PKT (ETHER_IPv4_PKT | \\\n+\t\tRTE_PTYPE_L4_UDP | \\\n+\t\tRTE_PTYPE_TUNNEL_VXLAN | \\\n+\t\tRTE_PTYPE_INNER_L2_ETHER_VLAN | \\\n+\t\tRTE_PTYPE_INNER_L3_IPV4  | \\\n+\t\tRTE_PTYPE_INNER_L4_TCP)\n+\n+/* VxLAN packet with both outer and inner VLAN tags. */\n+#define ETHER_VLAN_IPv4_UDP_VXLAN_VLAN_IPv4_TCP_PKT (\\\n+\t\tRTE_PTYPE_L2_ETHER_VLAN | \\\n+\t\tRTE_PTYPE_L3_IPV4 | \\\n+\t\tRTE_PTYPE_L4_UDP | \\\n+\t\tRTE_PTYPE_TUNNEL_VXLAN | \\\n+\t\tRTE_PTYPE_INNER_L2_ETHER_VLAN | \\\n+\t\tRTE_PTYPE_INNER_L3_IPV4 | \\\n+\t\tRTE_PTYPE_INNER_L4_TCP)\n+\n #define IS_VLAN_PKT(pkt) ((pkt->packet_type & RTE_PTYPE_L2_ETHER_VLAN) == \\\n \t\tRTE_PTYPE_L2_ETHER_VLAN)\n+#define IS_INNER_VLAN_PKT(pkt) (\\\n+\t\t(pkt->packet_type & RTE_PTYPE_INNER_L2_ETHER_VLAN) == \\\n+\t\tRTE_PTYPE_INNER_L2_ETHER_VLAN)\n \n+#define VXLAN_DEFAULT_PORT 4789\n+#define IS_VXLAN_PKT(pkt) ((pkt->packet_type & RTE_PTYPE_TUNNEL_VXLAN) == \\\n+\t\tRTE_PTYPE_TUNNEL_VXLAN)\n /**\n  * Internal function which parses a packet, setting outer_l2/l3_len and\n  * l2/l3/l4_len and packet_type.\n@@ -92,7 +131,7 @@ void gso_update_pkt_headers(struct rte_mbuf *pkt, uint16_t nb_segments,\n  * @param pkt\n  *  Packet to segment.\n  * @param pkt_hdr_offset\n- *  Packet header offset, measured in byte.\n+ *  Packet header offset, measured in bytes.\n  * @param pyld_unit_size\n  *  The max payload length of a GSO segment.\n  * @param direct_pool\ndiff --git a/lib/librte_gso/gso_tunnel.c b/lib/librte_gso/gso_tunnel.c\nnew file mode 100644\nindex 0000000..6a04697\n--- /dev/null\n+++ b/lib/librte_gso/gso_tunnel.c\n@@ -0,0 +1,62 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <rte_ether.h>\n+\n+#include \"gso_common.h\"\n+#include \"gso_tunnel.h\"\n+\n+int\n+gso_tunnel_segment(struct rte_mbuf *pkt,\n+\t\tuint16_t gso_size,\n+\t\tstruct rte_mempool *direct_pool,\n+\t\tstruct rte_mempool *indirect_pool,\n+\t\tstruct rte_mbuf **pkts_out,\n+\t\tuint16_t nb_pkts_out)\n+{\n+\tuint16_t pyld_unit_size, hdr_offset;\n+\tint ret;\n+\n+\thdr_offset = pkt->outer_l2_len + pkt->outer_l3_len + pkt->l2_len +\n+\t\tpkt->l3_len + pkt->l4_len;\n+\n+\tpyld_unit_size = gso_size - hdr_offset - ETHER_CRC_LEN;\n+\n+\tret = gso_do_segment(pkt, hdr_offset, pyld_unit_size, direct_pool,\n+\t\t\tindirect_pool, pkts_out, nb_pkts_out);\n+\n+\tif (ret > 1)\n+\t\tgso_update_pkt_headers(pkt, ret, pkts_out);\n+\n+\treturn ret;\n+}\ndiff --git a/lib/librte_gso/gso_tunnel.h b/lib/librte_gso/gso_tunnel.h\nnew file mode 100644\nindex 0000000..a9b2363\n--- /dev/null\n+++ b/lib/librte_gso/gso_tunnel.h\n@@ -0,0 +1,46 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef _GSO_TUNNEL_H_\n+#define _GSO_TUNNEL_H_\n+\n+#include <stdint.h>\n+#include <rte_mbuf.h>\n+\n+int gso_tunnel_segment(struct rte_mbuf *pkt,\n+\t\tuint16_t gso_size,\n+\t\tstruct rte_mempool *direct_pool,\n+\t\tstruct rte_mempool *indirect_pool,\n+\t\tstruct rte_mbuf **pkts_out,\n+\t\tuint16_t nb_pkts_out);\n+#endif\ndiff --git a/lib/librte_gso/rte_gso.c b/lib/librte_gso/rte_gso.c\nindex fac95f2..f110f18 100644\n--- a/lib/librte_gso/rte_gso.c\n+++ b/lib/librte_gso/rte_gso.c\n@@ -36,6 +36,7 @@\n #include \"rte_gso.h\"\n #include \"gso_common.h\"\n #include \"gso_tcp.h\"\n+#include \"gso_tunnel.h\"\n \n int\n rte_gso_segment(struct rte_mbuf *pkt,\n@@ -51,7 +52,8 @@ rte_gso_segment(struct rte_mbuf *pkt,\n \t\t\tNULL || gso_ctx.indirect_pool == NULL)\n \t\treturn -EINVAL;\n \n-\tif ((gso_ctx.gso_types & RTE_GSO_TCP_IPV4) == 0 ||\n+\tif ((gso_ctx.gso_types & (RTE_GSO_TCP_IPV4 |\n+\t\t\t\t\tRTE_GSO_IPV4_VXLAN_TCP_IPV4)) == 0 ||\n \t\t\tgso_ctx.gso_size >= pkt->pkt_len ||\n \t\t\tgso_ctx.gso_size == 0)\n \t\treturn 1;\n@@ -71,6 +73,14 @@ rte_gso_segment(struct rte_mbuf *pkt,\n \t\t\t\tdirect_pool, indirect_pool,\n \t\t\t\tpkts_out, nb_pkts_out);\n \t\tbreak;\n+\tcase ETHER_VLAN_IPv4_UDP_VXLAN_VLAN_IPv4_TCP_PKT:\n+\tcase ETHER_VLAN_IPv4_UDP_VXLAN_IPv4_TCP_PKT:\n+\tcase ETHER_IPv4_UDP_VXLAN_VLAN_IPv4_TCP_PKT:\n+\tcase ETHER_IPv4_UDP_VXLAN_IPv4_TCP_PKT:\n+\t\tnb_segments = gso_tunnel_segment(pkt, gso_size,\n+\t\t\t\tdirect_pool, indirect_pool,\n+\t\t\t\tpkts_out, nb_pkts_out);\n+\t\tbreak;\n \tdefault:\n \t\tRTE_LOG(WARNING, GSO, \"Unsupported packet type\\n\");\n \t\tnb_segments = 1;\ndiff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h\nindex 77853fa..e1b2c23 100644\n--- a/lib/librte_gso/rte_gso.h\n+++ b/lib/librte_gso/rte_gso.h\n@@ -48,6 +48,10 @@ extern \"C\" {\n \n #define RTE_GSO_TCP_IPV4 (1ULL << 0)\n /**< GSO flag for TCP/IPv4 packets (containing optional VLAN tag) */\n+#define RTE_GSO_IPV4_VXLAN_TCP_IPV4 (1ULL << 1)\n+/**< GSO flag for VxLAN packets that contain outer IPv4, and inner\n+ * TCP/IPv4 headers (plus optional inner and/or outer VLAN tags).\n+ */\n \n /**\n  * GSO context structure.\n",
    "prefixes": [
        "dpdk-dev",
        "3/5"
    ]
}