DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Cc: jerin.jacob@caviumnetworks.com
Subject: [dpdk-dev] [PATCH 1/2] net: add Mpls header structure
Date: Tue, 23 Oct 2018 09:46:48 +0200	[thread overview]
Message-ID: <20181023074649.10438-1-olivier.matz@6wind.com> (raw)

Add the Mpls header structure in librte_net. It will be used by next
patch that adds the support of Mpls L2 layer in the software packet
type parser.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_net/Makefile    |  2 +-
 lib/librte_net/meson.build |  3 ++-
 lib/librte_net/rte_mpls.h  | 42 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_net/rte_mpls.h

diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 85e403f41..c3082069a 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -20,6 +20,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build
index d3ea1feb5..7d66f693c 100644
--- a/lib/librte_net/meson.build
+++ b/lib/librte_net/meson.build
@@ -13,7 +13,8 @@ headers = files('rte_ip.h',
 	'rte_ether.h',
 	'rte_gre.h',
 	'rte_net.h',
-	'rte_net_crc.h')
+	'rte_net_crc.h',
+	'rte_mpls.h')
 
 sources = files('rte_arp.c', 'rte_net.c', 'rte_net_crc.c')
 deps += ['mbuf']
diff --git a/lib/librte_net/rte_mpls.h b/lib/librte_net/rte_mpls.h
new file mode 100644
index 000000000..11d26ba35
--- /dev/null
+++ b/lib/librte_net/rte_mpls.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016 6WIND S.A.
+ */
+
+#ifndef _RTE_MPLS_H_
+#define _RTE_MPLS_H_
+
+/**
+ * @file
+ *
+ * MPLS-related defines
+ */
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * MPLS header.
+ */
+struct mpls_hdr {
+	uint16_t tag_msb;   /**< Label(msb). */
+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint8_t tag_lsb:4;  /**< Label(lsb). */
+	uint8_t tc:3;       /**< Traffic class. */
+	uint8_t bs:1;       /**< Bottom of stack. */
+#else
+	uint8_t bs:1;       /**< Bottom of stack. */
+	uint8_t tc:3;       /**< Traffic class. */
+	uint8_t tag_lsb:4;  /**< label(lsb) */
+#endif
+	uint8_t  ttl;       /**< Time to live. */
+} __attribute__((__packed__));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_MPLS_H_ */
-- 
2.11.0

             reply	other threads:[~2018-10-23  7:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23  7:46 Olivier Matz [this message]
2018-10-23  7:46 ` [dpdk-dev] [PATCH 2/2] net: support Mpls in software packet type parser Olivier Matz
2018-10-25 11:04 ` [dpdk-dev] [PATCH 1/2] net: add Mpls header structure Ferruh Yigit
2018-10-25 11:05   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181023074649.10438-1-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).