get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 27877,
    "url": "http://patches.dpdk.org/api/patches/27877/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1503584144-63181-5-git-send-email-jiayu.hu@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1503584144-63181-5-git-send-email-jiayu.hu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1503584144-63181-5-git-send-email-jiayu.hu@intel.com",
    "date": "2017-08-24T14:15:43",
    "name": "[dpdk-dev,4/5] lib/gso: add GRE GSO support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "893094a79195a0fc071f4821afd76739ed3924eb",
    "submitter": {
        "id": 539,
        "url": "http://patches.dpdk.org/api/people/539/?format=api",
        "name": "Hu, Jiayu",
        "email": "jiayu.hu@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1503584144-63181-5-git-send-email-jiayu.hu@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/27877/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/27877/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 D422B7D5F;\n\tThu, 24 Aug 2017 16:13:49 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 893087D5E\n\tfor <dev@dpdk.org>; Thu, 24 Aug 2017 16:13:44 +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:44 -0700",
            "from dpdk15.sh.intel.com ([10.67.111.77])\n\tby orsmga005.jf.intel.com with ESMTP; 24 Aug 2017 07:13:43 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.41,421,1498546800\"; d=\"scan'208\";a=\"141575673\"",
        "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:43 +0800",
        "Message-Id": "<1503584144-63181-5-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 4/5] lib/gso: add GRE 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 GRE-tunneled packets. Supported GRE\npackets must contain an outer IPv4 header, and inner TCP/IPv4 headers.\nThey may also contain a single VLAN tag. GRE GSO assumes that all input\npackets have correct checksums and doesn't update checksums for output\npackets. Additionally, it doesn't process IP fragmented packets.\n\nAs with VxLAN GSO, GRE GSO uses a two-segment MBUF to organize each\noutput packet, which requires multi-segment mbuf support in the TX\nfunctions of the NIC driver. Also, if a packet is GSOed, GRE GSO reduces\nits MBUF refcnt by 1. As a result, when all of its GSOed segments are\nfreed, 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/gso_common.c | 66 +++++++++++++++++++++++++++++++++++++++++++--\n lib/librte_gso/gso_common.h | 21 +++++++++++++++\n lib/librte_gso/rte_gso.c    |  5 +++-\n lib/librte_gso/rte_gso.h    |  4 +++\n 4 files changed, 93 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/lib/librte_gso/gso_common.c b/lib/librte_gso/gso_common.c\nindex 65cec44..b3e7f9d 100644\n--- a/lib/librte_gso/gso_common.c\n+++ b/lib/librte_gso/gso_common.c\n@@ -37,6 +37,7 @@\n #include <rte_malloc.h>\n \n #include <rte_ether.h>\n+#include <rte_gre.h>\n #include <rte_ip.h>\n #include <rte_tcp.h>\n #include <rte_udp.h>\n@@ -159,6 +160,8 @@ gso_do_segment(struct rte_mbuf *pkt,\n \n static inline void parse_ethernet(struct ether_hdr *eth_hdr,\n \t\tstruct rte_mbuf *pkt);\n+static inline void parse_ipv4(struct ipv4_hdr *ipv4_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@@ -190,15 +193,29 @@ parse_udp(struct udp_hdr *udp_hdr, struct rte_mbuf *pkt)\n }\n \n static inline void\n+parse_gre(struct gre_hdr *gre_hdr, struct rte_mbuf *pkt)\n+{\n+\tstruct ipv4_hdr *ipv4_hdr;\n+\n+\tif (gre_hdr->proto == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) {\n+\t\tipv4_hdr = (struct ipv4_hdr *)(gre_hdr + 1);\n+\t\tpkt->packet_type |= RTE_PTYPE_INNER_L3_IPV4;\n+\t\tparse_ipv4(ipv4_hdr, pkt);\n+\t}\n+}\n+\n+static inline void\n parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct rte_mbuf *pkt)\n {\n+\tstruct gre_hdr *gre_hdr;\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\tif (IS_VXLAN_PKT(pkt)) {\n-\t\t\tpkt->outer_l3_len = pkt->l3_len;\n+\t\tif (IS_TUNNEL_PKT(pkt)) {\n+\t\t\tif (IS_VXLAN_PKT(pkt))\n+\t\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@@ -211,6 +228,14 @@ parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct rte_mbuf *pkt)\n \t\tudp_hdr = (struct udp_hdr *)((char *)ipv4_hdr + pkt->l3_len);\n \t\tparse_udp(udp_hdr, pkt);\n \t\tbreak;\n+\tcase IPPROTO_GRE:\n+\t\tgre_hdr = (struct gre_hdr *)(ipv4_hdr + 1);\n+\t\tpkt->outer_l2_len = pkt->l2_len;\n+\t\tpkt->outer_l3_len = IPv4_HDR_LEN(ipv4_hdr);\n+\t\tpkt->l2_len = sizeof(*gre_hdr);\n+\t\tpkt->packet_type |= RTE_PTYPE_TUNNEL_GRE;\n+\t\tparse_gre(gre_hdr, pkt);\n+\t\tbreak;\n \t}\n }\n \n@@ -343,6 +368,43 @@ gso_update_pkt_headers(struct rte_mbuf *pkt, uint16_t nb_segments,\n \t\t\tsent_seq += seg->next->data_len;\n \t\t}\n \t\tbreak;\n+\tcase ETHER_VLAN_IPv4_GRE_IPv4_TCP_PKT:\n+\tcase ETHER_IPv4_GRE_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\tpkt->outer_l3_len + pkt->l2_len);\n+\t\ttcp_hdr = (struct tcp_hdr *)(ipv4_hdr + 1);\n+\n+\t\t/* Retrieve values from original packet */\n+\t\tid = rte_be_to_cpu_16(ipv4_hdr->packet_id);\n+\t\touter_id = rte_be_to_cpu_16(outer_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 inner IPv4 header */\n+\t\t\toffset += seg->outer_l3_len + 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 0ad95d3..2ed264a 100644\n--- a/lib/librte_gso/gso_common.h\n+++ b/lib/librte_gso/gso_common.h\n@@ -87,6 +87,21 @@\n \t\tRTE_PTYPE_INNER_L3_IPV4 | \\\n \t\tRTE_PTYPE_INNER_L4_TCP)\n \n+/* GRE packet. */\n+#define ETHER_IPv4_GRE_IPv4_TCP_PKT (\\\n+\t\tETHER_IPv4_PKT          | \\\n+\t\tRTE_PTYPE_TUNNEL_GRE    | \\\n+\t\tRTE_PTYPE_INNER_L3_IPV4 | \\\n+\t\tRTE_PTYPE_INNER_L4_TCP)\n+\n+/* GRE packet with VLAN tag. */\n+#define ETHER_VLAN_IPv4_GRE_IPv4_TCP_PKT (\\\n+\t\tRTE_PTYPE_L2_ETHER_VLAN | \\\n+\t\tRTE_PTYPE_L3_IPV4       | \\\n+\t\tRTE_PTYPE_TUNNEL_GRE    | \\\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@@ -96,6 +111,12 @@\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+#define IS_GRE_PKT(pkt) ((pkt->packet_type & RTE_PTYPE_TUNNEL_GRE) == \\\n+\t\tRTE_PTYPE_TUNNEL_GRE)\n+\n+#define IS_TUNNEL_PKT(pkt) ((pkt->packet_type & RTE_PTYPE_TUNNEL_VXLAN) | \\\n+\t\t(pkt->packet_type & RTE_PTYPE_TUNNEL_GRE))\n /**\n  * Internal function which parses a packet, setting outer_l2/l3_len and\n  * l2/l3/l4_len and packet_type.\ndiff --git a/lib/librte_gso/rte_gso.c b/lib/librte_gso/rte_gso.c\nindex f110f18..244bbf6 100644\n--- a/lib/librte_gso/rte_gso.c\n+++ b/lib/librte_gso/rte_gso.c\n@@ -53,7 +53,8 @@ rte_gso_segment(struct rte_mbuf *pkt,\n \t\treturn -EINVAL;\n \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\t\t\tRTE_GSO_IPV4_VXLAN_TCP_IPV4 |\n+\t\t\t\t\tRTE_GSO_IPV4_GRE_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@@ -77,6 +78,8 @@ rte_gso_segment(struct rte_mbuf *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+\tcase ETHER_VLAN_IPv4_GRE_IPv4_TCP_PKT:\n+\tcase ETHER_IPv4_GRE_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);\ndiff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h\nindex e1b2c23..86ca790 100644\n--- a/lib/librte_gso/rte_gso.h\n+++ b/lib/librte_gso/rte_gso.h\n@@ -52,6 +52,10 @@ extern \"C\" {\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+#define RTE_GSO_IPV4_GRE_TCP_IPV4 (1ULL << 2)\n+/**< GSO flag for GRE packets that contain outer IPv4, and inner\n+ * TCP/IPv4 headers (with optional outer VLAN tag).\n+ */\n \n /**\n  * GSO context structure.\n",
    "prefixes": [
        "dpdk-dev",
        "4/5"
    ]
}