Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/15516/?format=api
http://patches.dpdk.org/api/patches/15516/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1472481335-21226-11-git-send-email-olivier.matz@6wind.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": "<1472481335-21226-11-git-send-email-olivier.matz@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1472481335-21226-11-git-send-email-olivier.matz@6wind.com", "date": "2016-08-29T14:35:29", "name": "[dpdk-dev,v2,10/16] net: support Gre in software packet type parser", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "03f9bef4251dec42ecaddd73f62c4b21c4e33e7e", "submitter": { "id": 8, "url": "http://patches.dpdk.org/api/people/8/?format=api", "name": "Olivier Matz", "email": "olivier.matz@6wind.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1472481335-21226-11-git-send-email-olivier.matz@6wind.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/15516/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/15516/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 492F93990;\n\tMon, 29 Aug 2016 16:36:05 +0200 (CEST)", "from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com\n\t[62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 51E582BD8\n\tfor <dev@dpdk.org>; Mon, 29 Aug 2016 16:35:53 +0200 (CEST)", "from glumotte.dev.6wind.com (unknown [10.16.0.195])\n\tby proxy.6wind.com (Postfix) with ESMTP id 34E5324E32;\n\tMon, 29 Aug 2016 16:35:53 +0200 (CEST)" ], "From": "Olivier Matz <olivier.matz@6wind.com>", "To": "dev@dpdk.org", "Cc": "cunming.liang@intel.com, john.mcnamara@intel.com,\n\tandrey.chilikin@intel.com, konstantin.ananyev@intel.com", "Date": "Mon, 29 Aug 2016 16:35:29 +0200", "Message-Id": "<1472481335-21226-11-git-send-email-olivier.matz@6wind.com>", "X-Mailer": "git-send-email 2.8.1", "In-Reply-To": "<1472481335-21226-1-git-send-email-olivier.matz@6wind.com>", "References": "<1467733310-20875-1-git-send-email-olivier.matz@6wind.com>\n\t<1472481335-21226-1-git-send-email-olivier.matz@6wind.com>", "Subject": "[dpdk-dev] [PATCH v2 10/16] net: support Gre in software packet\n\ttype parser", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <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": "Add support of Gre tunnels in rte_net_get_ptype().\n\nSigned-off-by: Jean Dao <jean.dao@6wind.com>\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n lib/librte_net/rte_net.c | 40 ++++++++++++++++++++++++++++++++++++----\n lib/librte_net/rte_net.h | 2 +-\n 2 files changed, 37 insertions(+), 5 deletions(-)", "diff": "diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c\nindex d921db8..0840126 100644\n--- a/lib/librte_net/rte_net.c\n+++ b/lib/librte_net/rte_net.c\n@@ -41,6 +41,7 @@\n #include <rte_tcp.h>\n #include <rte_udp.h>\n #include <rte_sctp.h>\n+#include <rte_gre.h>\n #include <rte_net.h>\n \n /* get l3 packet type from ip6 next protocol */\n@@ -150,11 +151,40 @@ ptype_inner_l4(uint8_t proto)\n \treturn ptype_inner_l4_proto[proto];\n }\n \n-/* get the tunnel packet type if any, update proto. */\n+/* get the tunnel packet type if any, update proto and off. */\n static uint32_t\n-ptype_tunnel(uint16_t *proto)\n+ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m,\n+\tuint32_t *off)\n {\n \tswitch (*proto) {\n+\tcase IPPROTO_GRE: {\n+\t\tstatic const uint8_t opt_len[16] = {\n+\t\t\t[0x0] = 4,\n+\t\t\t[0x1] = 8,\n+\t\t\t[0x2] = 8,\n+\t\t\t[0x8] = 8,\n+\t\t\t[0x3] = 12,\n+\t\t\t[0x9] = 12,\n+\t\t\t[0xa] = 12,\n+\t\t\t[0xb] = 16,\n+\t\t};\n+\t\tconst struct gre_hdr *gh;\n+\t\tstruct gre_hdr gh_copy;\n+\t\tuint16_t flags;\n+\n+\t\tgh = rte_pktmbuf_read(m, *off, sizeof(*gh), &gh_copy);\n+\t\tif (unlikely(gh == NULL))\n+\t\t\treturn 0;\n+\n+\t\tflags = rte_be_to_cpu_16(*(const uint16_t *)gh);\n+\t\tflags >>= 12;\n+\t\tif (opt_len[flags] == 0)\n+\t\t\treturn 0;\n+\n+\t\t*off += opt_len[flags];\n+\t\t*proto = gh->proto;\n+\t\treturn RTE_PTYPE_TUNNEL_GRE;\n+\t}\n \tcase IPPROTO_IPIP:\n \t\t*proto = rte_cpu_to_be_16(ETHER_TYPE_IPv4);\n \t\treturn RTE_PTYPE_TUNNEL_IP;\n@@ -332,9 +362,11 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,\n \t\thdr_lens->l4_len = sizeof(struct sctp_hdr);\n \t\treturn pkt_type;\n \t} else {\n+\t\tuint32_t prev_off = off;\n+\n \t\thdr_lens->l4_len = 0;\n-\t\tpkt_type |= ptype_tunnel(&proto);\n-\t\thdr_lens->tunnel_len = 0;\n+\t\tpkt_type |= ptype_tunnel(&proto, m, &off);\n+\t\thdr_lens->tunnel_len = off - prev_off;\n \t}\n \n \t/* same job for inner header: we need to duplicate the code\ndiff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h\nindex f433389..4a72b1b 100644\n--- a/lib/librte_net/rte_net.h\n+++ b/lib/librte_net/rte_net.h\n@@ -68,7 +68,7 @@ struct rte_net_hdr_lens {\n * L2: Ether, Vlan, QinQ\n * L3: IPv4, IPv6\n * L4: TCP, UDP, SCTP\n- * Tunnels: IPv4, IPv6\n+ * Tunnels: IPv4, IPv6, Gre\n *\n * @param m\n * The packet mbuf to be parsed.\n", "prefixes": [ "dpdk-dev", "v2", "10/16" ] }{ "id": 15516, "url": "