Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/76064/?format=api
http://patches.dpdk.org/api/patches/76064/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200827070244.32392-2-ophirmu@nvidia.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": "<20200827070244.32392-2-ophirmu@nvidia.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200827070244.32392-2-ophirmu@nvidia.com", "date": "2020-08-27T07:02:42", "name": "[v2,1/3] app/testpmd: add GENEVE parsing", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "71bffe548e5f70c64cba8f6a3d8d69afbee21fbf", "submitter": { "id": 1908, "url": "http://patches.dpdk.org/api/people/1908/?format=api", "name": "Ophir Munk", "email": "ophirmu@nvidia.com" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200827070244.32392-2-ophirmu@nvidia.com/mbox/", "series": [ { "id": 11817, "url": "http://patches.dpdk.org/api/series/11817/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11817", "date": "2020-08-27T07:02:44", "name": "Add GENEVE protocol parsing to testpmd", "version": 2, "mbox": "http://patches.dpdk.org/series/11817/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/76064/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/76064/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 5391BA04B1;\n\tThu, 27 Aug 2020 09:03:26 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 0B7181C0B0;\n\tThu, 27 Aug 2020 09:03:04 +0200 (CEST)", "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id 3FB0F1BF5A\n for <dev@dpdk.org>; Thu, 27 Aug 2020 09:02:58 +0200 (CEST)", "from Internal Mail-Server by MTLPINE1 (envelope-from\n ophirmu@nvidia.com) with SMTP; 27 Aug 2020 10:02:52 +0300", "from nvidia.com (pegasus05.mtr.labs.mlnx [10.210.16.100])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 07R72qrW020045;\n Thu, 27 Aug 2020 10:02:52 +0300" ], "From": "Ophir Munk <ophirmu@nvidia.com>", "To": "dev@dpdk.org, Wenzhuo Lu <wenzhuo.lu@intel.com>,\n Beilei Xing <beilei.xing@intel.com>,\n Bernard Iremonger <bernard.iremonger@intel.com>", "Cc": "Ophir Munk <ophirmu@mellanox.com>", "Date": "Thu, 27 Aug 2020 07:02:42 +0000", "Message-Id": "<20200827070244.32392-2-ophirmu@nvidia.com>", "X-Mailer": "git-send-email 2.8.4", "In-Reply-To": "<20200827070244.32392-1-ophirmu@nvidia.com>", "References": "<20200729082905.19499-4-ophirmu@mellanox.com>\n <20200827070244.32392-1-ophirmu@nvidia.com>", "Subject": "[dpdk-dev] [PATCH v2 1/3] app/testpmd: add GENEVE parsing", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "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", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "From: Ophir Munk <ophirmu@mellanox.com>\n\nGENEVE is a widely used tunneling protocol in modern Virtualized\nNetworks. testpmd already supports parsing of several tunneling\nprotocols including VXLAN, VXLAN-GPE, GRE. This commit adds GENEVE\nparsing of inner protocols (IPv4-0x0800, IPv6-0x86dd, Ethernet-0x6558)\nbased on IETF draft-ietf-nvo3-geneve-09. GENEVE is considered more\nflexible than the other protocols. In terms of protocol format GENEVE\nheader has a variable length options as opposed to other tunneling\nprotocols which have a fixed header size.\n\nSigned-off-by: Ophir Munk <ophirmu@mellanox.com>\n---\n app/test-pmd/csumonly.c | 70 ++++++++++++++++++++++++++++++++++++++++++-\n app/test-pmd/testpmd.h | 1 +\n lib/librte_net/Makefile | 2 +-\n lib/librte_net/meson.build | 3 +-\n lib/librte_net/rte_geneve.h | 72 +++++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 145 insertions(+), 3 deletions(-)\n create mode 100644 lib/librte_net/rte_geneve.h", "diff": "diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c\nindex 0a96b24..5f29868 100644\n--- a/app/test-pmd/csumonly.c\n+++ b/app/test-pmd/csumonly.c\n@@ -43,6 +43,7 @@\n #include <rte_flow.h>\n #include <rte_gro.h>\n #include <rte_gso.h>\n+#include <rte_geneve.h>\n \n #include \"testpmd.h\"\n \n@@ -63,6 +64,7 @@\n #endif\n \n uint16_t vxlan_gpe_udp_port = 4790;\n+uint16_t geneve_udp_port = RTE_GENEVE_DEFAULT_PORT;\n \n /* structure that caches offload info for the current packet */\n struct testpmd_offload_info {\n@@ -333,6 +335,64 @@ parse_vxlan_gpe(struct rte_udp_hdr *udp_hdr,\n \tinfo->l2_len += RTE_ETHER_VXLAN_GPE_HLEN;\n }\n \n+/* Fill in outer layers length */\n+static void\n+update_tunnel_outer(struct testpmd_offload_info *info)\n+{\n+\tinfo->is_tunnel = 1;\n+\tinfo->outer_ethertype = info->ethertype;\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+}\n+\n+/* Parse a geneve header */\n+static void\n+parse_geneve(struct rte_udp_hdr *udp_hdr,\n+\t struct testpmd_offload_info *info)\n+{\n+\tstruct rte_ether_hdr *eth_hdr;\n+\tstruct rte_ipv4_hdr *ipv4_hdr;\n+\tstruct rte_ipv6_hdr *ipv6_hdr;\n+\tstruct rte_geneve_hdr *geneve_hdr;\n+\tuint16_t geneve_len;\n+\n+\t/* Check udp destination port. */\n+\tif (udp_hdr->dst_port != _htons(geneve_udp_port))\n+\t\treturn;\n+\n+\tgeneve_hdr = (struct rte_geneve_hdr *)((char *)udp_hdr +\n+\t\t\t\tsizeof(struct rte_udp_hdr));\n+\tgeneve_len = sizeof(struct rte_geneve_hdr) + geneve_hdr->opt_len * 4;\n+\tif (!geneve_hdr->proto || geneve_hdr->proto ==\n+\t _htons(RTE_GENEVE_TYPE_IPV4)) {\n+\t\tupdate_tunnel_outer(info);\n+\t\tipv4_hdr = (struct rte_ipv4_hdr *)((char *)geneve_hdr +\n+\t\t\t geneve_len);\n+\t\tparse_ipv4(ipv4_hdr, info);\n+\t\tinfo->ethertype = _htons(RTE_ETHER_TYPE_IPV4);\n+\t\tinfo->l2_len = 0;\n+\t} else if (geneve_hdr->proto == _htons(RTE_GENEVE_TYPE_IPV6)) {\n+\t\tupdate_tunnel_outer(info);\n+\t\tipv6_hdr = (struct rte_ipv6_hdr *)((char *)geneve_hdr +\n+\t\t\t geneve_len);\n+\t\tinfo->ethertype = _htons(RTE_ETHER_TYPE_IPV6);\n+\t\tparse_ipv6(ipv6_hdr, info);\n+\t\tinfo->l2_len = 0;\n+\n+\t} else if (geneve_hdr->proto == _htons(RTE_GENEVE_TYPE_ETH)) {\n+\t\tupdate_tunnel_outer(info);\n+\t\teth_hdr = (struct rte_ether_hdr *)((char *)geneve_hdr +\n+\t\t\t geneve_len);\n+\t\tparse_ethernet(eth_hdr, info);\n+\t} else\n+\t\treturn;\n+\n+\tinfo->l2_len +=\n+\t\t(sizeof(struct rte_udp_hdr) + sizeof(struct rte_geneve_hdr) +\n+\t\t((struct rte_geneve_hdr *)geneve_hdr)->opt_len * 4);\n+}\n+\n /* Parse a gre header */\n static void\n parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)\n@@ -873,9 +933,17 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \t\t\t\t}\n \t\t\t\tparse_vxlan(udp_hdr, &info,\n \t\t\t\t\t m->packet_type);\n-\t\t\t\tif (info.is_tunnel)\n+\t\t\t\tif (info.is_tunnel) {\n \t\t\t\t\ttx_ol_flags |=\n \t\t\t\t\t\tPKT_TX_TUNNEL_VXLAN;\n+\t\t\t\t\tgoto tunnel_update;\n+\t\t\t\t}\n+\t\t\t\tparse_geneve(udp_hdr, &info);\n+\t\t\t\tif (info.is_tunnel) {\n+\t\t\t\t\ttx_ol_flags |=\n+\t\t\t\t\t\tPKT_TX_TUNNEL_GENEVE;\n+\t\t\t\t\tgoto tunnel_update;\n+\t\t\t\t}\n \t\t\t} else if (info.l4_proto == IPPROTO_GRE) {\n \t\t\t\tstruct simple_gre_hdr *gre_hdr;\n \ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 25a12b1..a60e009 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -456,6 +456,7 @@ extern struct fwd_lcore **fwd_lcores;\n extern struct fwd_stream **fwd_streams;\n \n extern uint16_t vxlan_gpe_udp_port; /**< UDP port of tunnel VXLAN-GPE. */\n+extern uint16_t geneve_udp_port; /**< UDP port of tunnel GENEVE. */\n \n extern portid_t nb_peer_eth_addrs; /**< Number of peer ethernet addresses. */\n extern struct rte_ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS];\ndiff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile\nindex 9830e77..9fe99af 100644\n--- a/lib/librte_net/Makefile\n+++ b/lib/librte_net/Makefile\n@@ -20,6 +20,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_gtp.h rte_vxlan.h\n-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ecpri.h\n+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ecpri.h rte_geneve.h\n \n include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build\nindex 24ed825..52d3a97 100644\n--- a/lib/librte_net/meson.build\n+++ b/lib/librte_net/meson.build\n@@ -16,7 +16,8 @@ headers = files('rte_ip.h',\n \t'rte_net_crc.h',\n \t'rte_mpls.h',\n \t'rte_higig.h',\n-\t'rte_ecpri.h')\n+\t'rte_ecpri.h',\n+\t'rte_geneve.h')\n \n sources = files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.c')\n deps += ['mbuf']\ndiff --git a/lib/librte_net/rte_geneve.h b/lib/librte_net/rte_geneve.h\nnew file mode 100644\nindex 0000000..a7101c8\n--- /dev/null\n+++ b/lib/librte_net/rte_geneve.h\n@@ -0,0 +1,72 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2020 Mellanox Technologies, Ltd\n+ */\n+\n+#ifndef _RTE_GENEVE_H_\n+#define _RTE_GENEVE_H_\n+\n+/**\n+ * @file\n+ *\n+ * GENEVE-related definitions\n+ */\n+\n+#include <stdint.h>\n+\n+#include <rte_udp.h>\n+\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+/** GENEVE default port. */\n+#define RTE_GENEVE_DEFAULT_PORT 6081\n+\n+/**\n+ * GENEVE protocol header. (draft-ietf-nvo3-geneve-09)\n+ * Contains:\n+ * 2-bits version (must be 0).\n+ * 6-bits option length in four byte multiples, not including the eight\n+ *\tbytes of the fixed tunnel header.\n+ * 1-bit control packet.\n+ * 1-bit critical options in packet.\n+ * 6-bits reserved\n+ * 16-bits Protocol Type. The protol data unit after the Geneve header\n+ *\tfollowing the EtherType convention. Ethernet itself is represented by\n+ *\tthe value 0x6558.\n+ * 24-bits Virtual Network Identifier (VNI). Virtual network unique identified.\n+ * 8-bits reserved bits (must be 0 on transmission and ignored on reciept).\n+ * More-bits (optinal) variable length options.\n+ */\n+__extension__\n+struct rte_geneve_hdr {\n+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN\n+\tuint8_t ver:2;\t\t/**< Version (2). */\n+\tuint8_t opt_len:6;\t/**< Options length (6). */\n+\tuint8_t oam:1;\t\t/**< Control packet (1). */\n+\tuint8_t critical:1;\t/**< Critical packet (1). */\n+\tuint8_t rsvd1:6;\t/**< Reserved (6). */\n+#else\n+\tuint8_t opt_len:6;\t/**< Options length (6). */\n+\tuint8_t ver:2;\t\t/**< Version (2). */\n+\tuint8_t rsvd1:6;\t/**< Reserved (6). */\n+\tuint8_t critical:1;\t/**< Critical packet (1). */\n+\tuint8_t oam:1;\t\t/**< Control packet (1). */\n+#endif\n+\trte_be16_t proto;\t/**< Protocol type (16). */\n+\tuint8_t vni[3];\t\t/**< Virtual network identifier (24). */\n+\tuint8_t rsvd2;\t\t/**< Reserved (8). */\n+\tuint8_t opts[];\t\t/**<Variable length options. */\n+} __rte_packed;\n+\n+/* GENEVE next protocol types */\n+#define RTE_GENEVE_TYPE_IPV4\t\t0x0800 /**< IPv4 Protocol. */\n+#define RTE_GENEVE_TYPE_IPV6\t\t0x86dd /**< IPv6 Protocol. */\n+#define RTE_GENEVE_TYPE_ETH\t\t0x6558 /**< Ethernet Protocol. */\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* RTE_GENEVE_H_ */\n", "prefixes": [ "v2", "1/3" ] }{ "id": 76064, "url": "