Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/47213/?format=api
http://patchwork.dpdk.org/api/patches/47213/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20181023074649.10438-2-olivier.matz@6wind.com/", "project": { "id": 1, "url": "http://patchwork.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": "<20181023074649.10438-2-olivier.matz@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20181023074649.10438-2-olivier.matz@6wind.com", "date": "2018-10-23T07:46:49", "name": "[2/2] net: support Mpls in software packet type parser", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "07c4e2db211587af3e72a0621347cb09dd680cee", "submitter": { "id": 8, "url": "http://patchwork.dpdk.org/api/people/8/?format=api", "name": "Olivier Matz", "email": "olivier.matz@6wind.com" }, "delegate": { "id": 319, "url": "http://patchwork.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20181023074649.10438-2-olivier.matz@6wind.com/mbox/", "series": [ { "id": 2025, "url": "http://patchwork.dpdk.org/api/series/2025/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=2025", "date": "2018-10-23T07:46:48", "name": "[1/2] net: add Mpls header structure", "version": 1, "mbox": "http://patchwork.dpdk.org/series/2025/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/47213/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/47213/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 A2FAB1B3AC;\n\tTue, 23 Oct 2018 09:47:15 +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 6D2301B2AB\n\tfor <dev@dpdk.org>; Tue, 23 Oct 2018 09:47:12 +0200 (CEST)", "from glumotte.dev.6wind.com. (unknown [10.16.0.195])\n\tby proxy.6wind.com (Postfix) with ESMTP id 70811207922;\n\tTue, 23 Oct 2018 09:43:21 +0200 (CEST)" ], "From": "Olivier Matz <olivier.matz@6wind.com>", "To": "dev@dpdk.org", "Cc": "jerin.jacob@caviumnetworks.com, Didier Pallard <didier.pallard@6wind.com>", "Date": "Tue, 23 Oct 2018 09:46:49 +0200", "Message-Id": "<20181023074649.10438-2-olivier.matz@6wind.com>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20181023074649.10438-1-olivier.matz@6wind.com>", "References": "<20181023074649.10438-1-olivier.matz@6wind.com>", "Subject": "[dpdk-dev] [PATCH 2/2] net: support Mpls in software packet type\n\tparser", "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Add a new RTE_PTYPE_L2_ETHER_MPLS packet type, and its support in\nrte_net_get_ptype().\n\nSigned-off-by: Didier Pallard <didier.pallard@6wind.com>\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n lib/librte_mbuf/rte_mbuf_ptype.h | 7 +++++++\n lib/librte_net/rte_ether.h | 2 ++\n lib/librte_net/rte_net.c | 21 ++++++++++++++++++++-\n 3 files changed, 29 insertions(+), 1 deletion(-)", "diff": "diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h b/lib/librte_mbuf/rte_mbuf_ptype.h\nindex 01acc66e2..3029777e2 100644\n--- a/lib/librte_mbuf/rte_mbuf_ptype.h\n+++ b/lib/librte_mbuf/rte_mbuf_ptype.h\n@@ -131,6 +131,13 @@ extern \"C\" {\n */\n #define RTE_PTYPE_L2_ETHER_PPPOE 0x00000008\n /**\n+ * MPLS packet type.\n+ *\n+ * Packet format:\n+ * <'ether type'=[0x8847|0x0x8848]>\n+ */\n+#define RTE_PTYPE_L2_ETHER_MPLS 0x00000009\n+/**\n * Mask of layer 2 packet types.\n * It is used for outer packet for tunneling cases.\n */\ndiff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h\nindex bee2b34f0..c2c5e249f 100644\n--- a/lib/librte_net/rte_ether.h\n+++ b/lib/librte_net/rte_ether.h\n@@ -306,6 +306,8 @@ struct vxlan_hdr {\n #define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */\n #define ETHER_TYPE_TEB 0x6558 /**< Transparent Ethernet Bridging. */\n #define ETHER_TYPE_LLDP 0x88CC /**< LLDP Protocol. */\n+#define ETHER_TYPE_MPLS 0x8847 /**< MPLS ethertype. */\n+#define ETHER_TYPE_MPLSM 0x8848 /**< MPLS multicast ethertype. */\n \n #define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr))\n /**< VXLAN tunnel header length. */\ndiff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c\nindex 9eb7c7438..378a4126c 100644\n--- a/lib/librte_net/rte_net.c\n+++ b/lib/librte_net/rte_net.c\n@@ -13,6 +13,7 @@\n #include <rte_udp.h>\n #include <rte_sctp.h>\n #include <rte_gre.h>\n+#include <rte_mpls.h>\n #include <rte_net.h>\n \n /* get l3 packet type from ip6 next protocol */\n@@ -274,9 +275,27 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,\n \t\toff += 2 * sizeof(*vh);\n \t\thdr_lens->l2_len += 2 * sizeof(*vh);\n \t\tproto = vh->eth_proto;\n+\t} else if ((proto == rte_cpu_to_be_16(ETHER_TYPE_MPLS)) ||\n+\t\t(proto == rte_cpu_to_be_16(ETHER_TYPE_MPLSM))) {\n+\t\tunsigned int i;\n+\t\tconst struct mpls_hdr *mh;\n+\t\tstruct mpls_hdr mh_copy;\n+\n+#define MAX_MPLS_HDR 5\n+\t\tfor (i = 0; i < MAX_MPLS_HDR; i++) {\n+\t\t\tmh = rte_pktmbuf_read(m, off + (i * sizeof(*mh)),\n+\t\t\t\tsizeof(*mh), &mh_copy);\n+\t\t\tif (unlikely(mh == NULL))\n+\t\t\t\treturn pkt_type;\n+\t\t}\n+\t\tif (i == MAX_MPLS_HDR)\n+\t\t\treturn pkt_type;\n+\t\tpkt_type = RTE_PTYPE_L2_ETHER_MPLS;\n+\t\thdr_lens->l2_len += (sizeof(*mh) * i);\n+\t\treturn pkt_type;\n \t}\n \n- l3:\n+l3:\n \tif ((layers & RTE_PTYPE_L3_MASK) == 0)\n \t\treturn pkt_type;\n \n", "prefixes": [ "2/2" ] }{ "id": 47213, "url": "