DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net: add new header file for VXLAN
@ 2019-10-22 16:40 Flavia Musatescu
  2019-10-23 13:19 ` [dpdk-dev] [PATCH v2] " Flavia Musatescu
  0 siblings, 1 reply; 3+ messages in thread
From: Flavia Musatescu @ 2019-10-22 16:40 UTC (permalink / raw)
  To: dev, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, John McNamara,
	Marko Kovacevic, John Daley, Hyong Youb Kim, Wei Hu (Xavier),
	Min Hu (Connor),
	Yisen Zhuang, Konstantin Ananyev, Matan Azrad, Shahaf Shuler,
	Viacheslav Ovsiienko, Bruce Richardson, Harry van Haaren,
	Xiaoyun Li, Jiayu Hu, Olivier Matz, Cristian Dumitrescu
  Cc: Flavia Musatescu

The VXLAN related definitions and structures are moved from
rte_ether.h to a new header file: rte_xvlan.h.

Also introducing a new define macro for VXLAN default port id:
RTE_VXLAN_DEFAULT_PORT

Signed-off-by: Flavia Musatescu <flavia.musatescu@intel.com>
---
 app/test-pmd/csumonly.c                |  1 +
 app/test-pmd/util.c                    |  1 +
 doc/api/doxy-api-index.md              |  1 +
 drivers/net/enic/enic.h                |  5 +--
 drivers/net/enic/enic_ethdev.c         |  2 +-
 drivers/net/enic/enic_main.c           |  4 +-
 drivers/net/hns3/hns3_rxtx.c           |  1 +
 drivers/net/ixgbe/ixgbe_fdir.c         |  5 +--
 drivers/net/mlx5/mlx5_flow_dv.c        |  1 +
 examples/tep_termination/vxlan.c       |  2 +-
 examples/tep_termination/vxlan.h       |  2 +-
 lib/librte_gro/gro_tcp4.h              |  1 +
 lib/librte_net/Makefile                |  2 +-
 lib/librte_net/meson.build             |  1 +
 lib/librte_net/rte_ether.h             | 39 +-------------------
 lib/librte_net/rte_vxlan.h             | 67 ++++++++++++++++++++++++++++++++++
 lib/librte_pipeline/rte_table_action.c |  1 +
 17 files changed, 86 insertions(+), 50 deletions(-)
 create mode 100644 lib/librte_net/rte_vxlan.h

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index e1cb7fb..9997381 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -35,6 +35,7 @@
 #include <rte_ip.h>
 #include <rte_tcp.h>
 #include <rte_udp.h>
+#include <rte_vxlan.h>
 #include <rte_sctp.h>
 #include <rte_prefetch.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index 1570270..f20531d 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -8,6 +8,7 @@
 #include <rte_net.h>
 #include <rte_mbuf.h>
 #include <rte_ether.h>
+#include <rte_vxlan.h>
 #include <rte_ethdev.h>
 #include <rte_flow.h>
 
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 6c2d888..7ac2061 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -102,6 +102,7 @@ The public API headers are grouped by topics:
   [frag/reass]         (@ref rte_ip_frag.h),
   [LPM IPv4 route]     (@ref rte_lpm.h),
   [LPM IPv6 route]     (@ref rte_lpm6.h)
+  [VXLAN]              (@ref rte_vxlan.h)
 
 - **QoS**:
   [metering]           (@ref rte_meter.h),
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 93d3cfc..ecffa30 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -6,6 +6,8 @@
 #ifndef _ENIC_H_
 #define _ENIC_H_
 
+#include <rte_vxlan.h>
+
 #include "vnic_enet.h"
 #include "vnic_dev.h"
 #include "vnic_wq.h"
@@ -50,9 +52,6 @@
 
 #define ENICPMD_FDIR_MAX           64
 
-/* HW default VXLAN port */
-#define ENIC_DEFAULT_VXLAN_PORT	   4789
-
 /*
  * Interrupt 0: LSC and errors
  * Interrupt 1: rx queue 0
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 5fa7118..fbf1919 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -1047,7 +1047,7 @@ static int enicpmd_dev_udp_tunnel_port_del(struct rte_eth_dev *eth_dev,
 			     tnl->udp_port);
 		return -EINVAL;
 	}
-	return update_vxlan_port(enic, ENIC_DEFAULT_VXLAN_PORT);
+	return update_vxlan_port(enic, RTE_VXLAN_DEFAULT_PORT);
 }
 
 static int enicpmd_dev_fw_version_get(struct rte_eth_dev *eth_dev,
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index e507df1..3b502c3 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1727,14 +1727,14 @@ static int enic_dev_init(struct enic *enic)
 	 * enable/disable.
 	 */
 	if (enic->vxlan) {
-		enic->vxlan_port = ENIC_DEFAULT_VXLAN_PORT;
+		enic->vxlan_port = RTE_VXLAN_DEFAULT_PORT;
 		/*
 		 * Reset the vxlan port to the default, as the NIC firmware
 		 * does not reset it automatically and keeps the old setting.
 		 */
 		if (vnic_dev_overlay_offload_cfg(enic->vdev,
 						 OVERLAY_CFG_VXLAN_PORT_UPDATE,
-						 ENIC_DEFAULT_VXLAN_PORT)) {
+						 RTE_VXLAN_DEFAULT_PORT)) {
 			dev_err(enic, "failed to update vxlan port\n");
 			return -EINVAL;
 		}
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 184b8e4..fdac55a 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -15,6 +15,7 @@
 #include <rte_dev.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
+#include <rte_vxlan.h>
 #include <rte_ethdev_driver.h>
 #include <rte_io.h>
 #include <rte_ip.h>
diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index e559f0f..166dae1 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -12,7 +12,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_ether.h>
+#include <rte_vxlan.h>
 #include <rte_ethdev_driver.h>
 #include <rte_malloc.h>
 
@@ -77,7 +77,6 @@
 	rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\
 } while (0)
 
-#define DEFAULT_VXLAN_PORT 4789
 #define IXGBE_FDIRIP6M_INNER_MAC_SHIFT 4
 
 static int fdir_erase_filter_82599(struct ixgbe_hw *hw, uint32_t fdirhash);
@@ -366,7 +365,7 @@ fdir_set_input_mask_x550(struct rte_eth_dev *dev)
 
 	/* set the default UDP port for VxLAN */
 	if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
-		IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, DEFAULT_VXLAN_PORT);
+		IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, RTE_VXLAN_DEFAULT_PORT);
 
 	/* some bits must be set for mac vlan or tunnel mode */
 	fdirm |= IXGBE_FDIRM_L4P | IXGBE_FDIRM_L3P;
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index f0422dc..21afe6b 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -26,6 +26,7 @@
 #include <rte_malloc.h>
 #include <rte_ip.h>
 #include <rte_gre.h>
+#include <rte_vxlan.h>
 
 #include "mlx5.h"
 #include "mlx5_defs.h"
diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c
index 52c35a7..0ba6b8b 100644
--- a/examples/tep_termination/vxlan.c
+++ b/examples/tep_termination/vxlan.c
@@ -159,7 +159,7 @@ decapsulation(struct rte_mbuf *pkt)
 	/** check udp destination port, 4789 is the default vxlan port
 	 * (rfc7348) or that the rx offload flag is set (i40e only
 	 * currently)*/
-	if (udp_hdr->dst_port != rte_cpu_to_be_16(DEFAULT_VXLAN_PORT) &&
+	if (udp_hdr->dst_port != rte_cpu_to_be_16(RTE_VXLAN_DEFAULT_PORT) &&
 		(pkt->packet_type & RTE_PTYPE_TUNNEL_MASK) == 0)
 		return -1;
 	outer_header_len = info.outer_l2_len + info.outer_l3_len
diff --git a/examples/tep_termination/vxlan.h b/examples/tep_termination/vxlan.h
index 689aea4..587fb9f 100644
--- a/examples/tep_termination/vxlan.h
+++ b/examples/tep_termination/vxlan.h
@@ -7,6 +7,7 @@
 
 #include <rte_ether.h>
 #include <rte_ip.h>
+#include <rte_vxlan.h>
 
 #define PORT_MIN	49152
 #define PORT_MAX	65535
@@ -14,7 +15,6 @@
 
 #define VXLAN_N_PORTS  2
 #define VXLAN_HF_VNI 0x08000000
-#define DEFAULT_VXLAN_PORT 4789
 
 extern struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS];
 extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS];
diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h
index 9fe2911..bb875a5 100644
--- a/lib/librte_gro/gro_tcp4.h
+++ b/lib/librte_gro/gro_tcp4.h
@@ -7,6 +7,7 @@
 
 #include <rte_ip.h>
 #include <rte_tcp.h>
+#include <rte_vxlan.h>
 
 #define INVALID_ARRAY_INDEX 0xffffffffUL
 #define GRO_TCP4_TBL_MAX_ITEM_NUM (1024UL * 1024UL)
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 1244c9f..4702a47 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -20,7 +20,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 # install includes
 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_ether.h rte_gre.h rte_net.h rte_vxlan.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 868a93f..75e3065 100644
--- a/lib/librte_net/meson.build
+++ b/lib/librte_net/meson.build
@@ -11,6 +11,7 @@ headers = files('rte_ip.h',
 	'rte_icmp.h',
 	'rte_arp.h',
 	'rte_ether.h',
+	'rte_vxlan.h',
 	'rte_gre.h',
 	'rte_net.h',
 	'rte_net_crc.h',
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index aa6eff0..bdcf4b2 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -285,15 +285,7 @@ struct rte_vlan_hdr {
 	uint16_t eth_proto;/**< Ethernet type of encapsulated frame. */
 } __attribute__((__packed__));
 
-/**
- * VXLAN protocol header.
- * Contains the 8-bit flag, 24-bit VXLAN Network Identifier and
- * Reserved fields (24 bits and 8 bits)
- */
-struct rte_vxlan_hdr {
-	uint32_t vx_flags; /**< flag (8) + Reserved (24). */
-	uint32_t vx_vni;   /**< VNI (24) + Reserved (8). */
-} __attribute__((__packed__));
+
 
 /* Ethernet frame types */
 #define RTE_ETHER_TYPE_IPV4 0x0800 /**< IPv4 Protocol. */
@@ -313,35 +305,6 @@ struct rte_vxlan_hdr {
 #define RTE_ETHER_TYPE_MPLS 0x8847 /**< MPLS ethertype. */
 #define RTE_ETHER_TYPE_MPLSM 0x8848 /**< MPLS multicast ethertype. */
 
-#define RTE_ETHER_VXLAN_HLEN \
-	(sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr))
-	/**< VXLAN tunnel header length. */
-
-/**
- * VXLAN-GPE protocol header (draft-ietf-nvo3-vxlan-gpe-05).
- * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network
- * Identifier and Reserved fields (16 bits and 8 bits).
- */
-struct rte_vxlan_gpe_hdr {
-	uint8_t vx_flags;    /**< flag (8). */
-	uint8_t reserved[2]; /**< Reserved (16). */
-	uint8_t proto;       /**< next-protocol (8). */
-	uint32_t vx_vni;     /**< VNI (24) + Reserved (8). */
-} __attribute__((__packed__));
-
-/* VXLAN-GPE next protocol types */
-#define RTE_VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 Protocol. */
-#define RTE_VXLAN_GPE_TYPE_IPV6 2 /**< IPv6 Protocol. */
-#define RTE_VXLAN_GPE_TYPE_ETH  3 /**< Ethernet Protocol. */
-#define RTE_VXLAN_GPE_TYPE_NSH  4 /**< NSH Protocol. */
-#define RTE_VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */
-#define RTE_VXLAN_GPE_TYPE_GBP  6 /**< GBP Protocol. */
-#define RTE_VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */
-
-#define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \
-			      sizeof(struct rte_vxlan_gpe_hdr))
-/**< VXLAN-GPE tunnel header length. */
-
 /**
  * Extract VLAN tag information into mbuf
  *
diff --git a/lib/librte_net/rte_vxlan.h b/lib/librte_net/rte_vxlan.h
new file mode 100644
index 0000000..a6567d4
--- /dev/null
+++ b/lib/librte_net/rte_vxlan.h
@@ -0,0 +1,67 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018-2019 Intel Corporation
+ */
+
+#ifndef _RTE_VXLAN_H_
+#define _RTE_VXLAN_H_
+
+/**
+ * @file
+ *
+ * VXLAN-related definitions
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** VXLAN default port. */
+#define RTE_VXLAN_DEFAULT_PORT 4789
+
+/* VXLAN-GPE next protocol types */
+#define RTE_VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 Protocol. */
+#define RTE_VXLAN_GPE_TYPE_IPV6 2 /**< IPv6 Protocol. */
+#define RTE_VXLAN_GPE_TYPE_ETH  3 /**< Ethernet Protocol. */
+#define RTE_VXLAN_GPE_TYPE_NSH  4 /**< NSH Protocol. */
+#define RTE_VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */
+#define RTE_VXLAN_GPE_TYPE_GBP  6 /**< GBP Protocol. */
+#define RTE_VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */
+
+/** VXLAN tunnel header length. */
+#define RTE_ETHER_VXLAN_HLEN \
+	(sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr))
+
+/** VXLAN-GPE tunnel header length. */
+#define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \
+			      sizeof(struct rte_vxlan_gpe_hdr))
+
+/**
+ * VXLAN protocol header.
+ * Contains the 8-bit flag, 24-bit VXLAN Network Identifier and
+ * Reserved fields (24 bits and 8 bits)
+ */
+struct rte_vxlan_hdr {
+	uint32_t vx_flags; /**< flag (8) + Reserved (24). */
+	uint32_t vx_vni;   /**< VNI (24) + Reserved (8). */
+} __attribute__((__packed__));
+
+/**
+ * VXLAN-GPE protocol header (draft-ietf-nvo3-vxlan-gpe-05).
+ * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network
+ * Identifier and Reserved fields (16 bits and 8 bits).
+ */
+struct rte_vxlan_gpe_hdr {
+	uint8_t vx_flags;    /**< flag (8). */
+	uint8_t reserved[2]; /**< Reserved (16). */
+	uint8_t proto;       /**< next-protocol (8). */
+	uint32_t vx_vni;     /**< VNI (24) + Reserved (8). */
+} __attribute__((__packed__));
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_VXLAN_H_ */
diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
index 47d7efb..70cd20b 100644
--- a/lib/librte_pipeline/rte_table_action.c
+++ b/lib/librte_pipeline/rte_table_action.c
@@ -14,6 +14,7 @@
 #include <rte_esp.h>
 #include <rte_tcp.h>
 #include <rte_udp.h>
+#include <rte_vxlan.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH v2] net: add new header file for VXLAN
  2019-10-22 16:40 [dpdk-dev] [PATCH] net: add new header file for VXLAN Flavia Musatescu
@ 2019-10-23 13:19 ` Flavia Musatescu
  2019-10-24 14:52   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Flavia Musatescu @ 2019-10-23 13:19 UTC (permalink / raw)
  To: dev, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, John McNamara,
	Marko Kovacevic, John Daley, Hyong Youb Kim, Wei Hu (Xavier),
	Min Hu (Connor),
	Yisen Zhuang, Konstantin Ananyev, Matan Azrad, Shahaf Shuler,
	Viacheslav Ovsiienko, Bruce Richardson, Harry van Haaren,
	Xiaoyun Li, Jiayu Hu, Olivier Matz, Cristian Dumitrescu
  Cc: Flavia Musatescu

The VXLAN related definitions and structures are moved from
rte_ether.h to a new header file: rte_xvlan.h.

Also introducing a new define macro for VXLAN default port id:
RTE_VXLAN_DEFAULT_PORT

Signed-off-by: Flavia Musatescu <flavia.musatescu@intel.com>
---
v2: fixed mlx5 pmd build error
---
 app/test-pmd/csumonly.c                |  1 +
 app/test-pmd/util.c                    |  1 +
 doc/api/doxy-api-index.md              |  1 +
 drivers/net/enic/enic.h                |  5 +--
 drivers/net/enic/enic_ethdev.c         |  2 +-
 drivers/net/enic/enic_main.c           |  4 +-
 drivers/net/hns3/hns3_rxtx.c           |  1 +
 drivers/net/ixgbe/ixgbe_fdir.c         |  5 +--
 drivers/net/mlx5/mlx5_defs.h           |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c        |  1 +
 examples/tep_termination/vxlan.c       |  2 +-
 examples/tep_termination/vxlan.h       |  2 +-
 lib/librte_gro/gro_tcp4.h              |  1 +
 lib/librte_net/Makefile                |  2 +-
 lib/librte_net/meson.build             |  1 +
 lib/librte_net/rte_ether.h             | 39 +------------------
 lib/librte_net/rte_vxlan.h             | 71 ++++++++++++++++++++++++++++++++++
 lib/librte_pipeline/rte_table_action.c |  1 +
 18 files changed, 91 insertions(+), 50 deletions(-)
 create mode 100644 lib/librte_net/rte_vxlan.h

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index e1cb7fb..9997381 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -35,6 +35,7 @@
 #include <rte_ip.h>
 #include <rte_tcp.h>
 #include <rte_udp.h>
+#include <rte_vxlan.h>
 #include <rte_sctp.h>
 #include <rte_prefetch.h>
 #include <rte_string_fns.h>
diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index 1570270..f20531d 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -8,6 +8,7 @@
 #include <rte_net.h>
 #include <rte_mbuf.h>
 #include <rte_ether.h>
+#include <rte_vxlan.h>
 #include <rte_ethdev.h>
 #include <rte_flow.h>
 
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 6c2d888..7ac2061 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -102,6 +102,7 @@ The public API headers are grouped by topics:
   [frag/reass]         (@ref rte_ip_frag.h),
   [LPM IPv4 route]     (@ref rte_lpm.h),
   [LPM IPv6 route]     (@ref rte_lpm6.h)
+  [VXLAN]              (@ref rte_vxlan.h)
 
 - **QoS**:
   [metering]           (@ref rte_meter.h),
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 93d3cfc..ecffa30 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -6,6 +6,8 @@
 #ifndef _ENIC_H_
 #define _ENIC_H_
 
+#include <rte_vxlan.h>
+
 #include "vnic_enet.h"
 #include "vnic_dev.h"
 #include "vnic_wq.h"
@@ -50,9 +52,6 @@
 
 #define ENICPMD_FDIR_MAX           64
 
-/* HW default VXLAN port */
-#define ENIC_DEFAULT_VXLAN_PORT	   4789
-
 /*
  * Interrupt 0: LSC and errors
  * Interrupt 1: rx queue 0
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 5fa7118..fbf1919 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -1047,7 +1047,7 @@ static int enicpmd_dev_udp_tunnel_port_del(struct rte_eth_dev *eth_dev,
 			     tnl->udp_port);
 		return -EINVAL;
 	}
-	return update_vxlan_port(enic, ENIC_DEFAULT_VXLAN_PORT);
+	return update_vxlan_port(enic, RTE_VXLAN_DEFAULT_PORT);
 }
 
 static int enicpmd_dev_fw_version_get(struct rte_eth_dev *eth_dev,
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index e507df1..3b502c3 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1727,14 +1727,14 @@ static int enic_dev_init(struct enic *enic)
 	 * enable/disable.
 	 */
 	if (enic->vxlan) {
-		enic->vxlan_port = ENIC_DEFAULT_VXLAN_PORT;
+		enic->vxlan_port = RTE_VXLAN_DEFAULT_PORT;
 		/*
 		 * Reset the vxlan port to the default, as the NIC firmware
 		 * does not reset it automatically and keeps the old setting.
 		 */
 		if (vnic_dev_overlay_offload_cfg(enic->vdev,
 						 OVERLAY_CFG_VXLAN_PORT_UPDATE,
-						 ENIC_DEFAULT_VXLAN_PORT)) {
+						 RTE_VXLAN_DEFAULT_PORT)) {
 			dev_err(enic, "failed to update vxlan port\n");
 			return -EINVAL;
 		}
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 184b8e4..fdac55a 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -15,6 +15,7 @@
 #include <rte_dev.h>
 #include <rte_eal.h>
 #include <rte_ether.h>
+#include <rte_vxlan.h>
 #include <rte_ethdev_driver.h>
 #include <rte_io.h>
 #include <rte_ip.h>
diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index e559f0f..166dae1 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -12,7 +12,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
-#include <rte_ether.h>
+#include <rte_vxlan.h>
 #include <rte_ethdev_driver.h>
 #include <rte_malloc.h>
 
@@ -77,7 +77,6 @@
 	rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\
 } while (0)
 
-#define DEFAULT_VXLAN_PORT 4789
 #define IXGBE_FDIRIP6M_INNER_MAC_SHIFT 4
 
 static int fdir_erase_filter_82599(struct ixgbe_hw *hw, uint32_t fdirhash);
@@ -366,7 +365,7 @@ fdir_set_input_mask_x550(struct rte_eth_dev *dev)
 
 	/* set the default UDP port for VxLAN */
 	if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
-		IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, DEFAULT_VXLAN_PORT);
+		IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, RTE_VXLAN_DEFAULT_PORT);
 
 	/* some bits must be set for mac vlan or tunnel mode */
 	fdirm |= IXGBE_FDIRM_L4P | IXGBE_FDIRM_L3P;
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index 180122d..bf6d058 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -7,6 +7,7 @@
 #define RTE_PMD_MLX5_DEFS_H_
 
 #include <rte_ethdev_driver.h>
+#include <rte_vxlan.h>
 
 #include "mlx5_autoconf.h"
 
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index f0422dc..21afe6b 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -26,6 +26,7 @@
 #include <rte_malloc.h>
 #include <rte_ip.h>
 #include <rte_gre.h>
+#include <rte_vxlan.h>
 
 #include "mlx5.h"
 #include "mlx5_defs.h"
diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c
index 52c35a7..0ba6b8b 100644
--- a/examples/tep_termination/vxlan.c
+++ b/examples/tep_termination/vxlan.c
@@ -159,7 +159,7 @@ decapsulation(struct rte_mbuf *pkt)
 	/** check udp destination port, 4789 is the default vxlan port
 	 * (rfc7348) or that the rx offload flag is set (i40e only
 	 * currently)*/
-	if (udp_hdr->dst_port != rte_cpu_to_be_16(DEFAULT_VXLAN_PORT) &&
+	if (udp_hdr->dst_port != rte_cpu_to_be_16(RTE_VXLAN_DEFAULT_PORT) &&
 		(pkt->packet_type & RTE_PTYPE_TUNNEL_MASK) == 0)
 		return -1;
 	outer_header_len = info.outer_l2_len + info.outer_l3_len
diff --git a/examples/tep_termination/vxlan.h b/examples/tep_termination/vxlan.h
index 689aea4..587fb9f 100644
--- a/examples/tep_termination/vxlan.h
+++ b/examples/tep_termination/vxlan.h
@@ -7,6 +7,7 @@
 
 #include <rte_ether.h>
 #include <rte_ip.h>
+#include <rte_vxlan.h>
 
 #define PORT_MIN	49152
 #define PORT_MAX	65535
@@ -14,7 +15,6 @@
 
 #define VXLAN_N_PORTS  2
 #define VXLAN_HF_VNI 0x08000000
-#define DEFAULT_VXLAN_PORT 4789
 
 extern struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS];
 extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS];
diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h
index 9fe2911..bb875a5 100644
--- a/lib/librte_gro/gro_tcp4.h
+++ b/lib/librte_gro/gro_tcp4.h
@@ -7,6 +7,7 @@
 
 #include <rte_ip.h>
 #include <rte_tcp.h>
+#include <rte_vxlan.h>
 
 #define INVALID_ARRAY_INDEX 0xffffffffUL
 #define GRO_TCP4_TBL_MAX_ITEM_NUM (1024UL * 1024UL)
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 1244c9f..4702a47 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -20,7 +20,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 # install includes
 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_ether.h rte_gre.h rte_net.h rte_vxlan.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 868a93f..75e3065 100644
--- a/lib/librte_net/meson.build
+++ b/lib/librte_net/meson.build
@@ -11,6 +11,7 @@ headers = files('rte_ip.h',
 	'rte_icmp.h',
 	'rte_arp.h',
 	'rte_ether.h',
+	'rte_vxlan.h',
 	'rte_gre.h',
 	'rte_net.h',
 	'rte_net_crc.h',
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index aa6eff0..bdcf4b2 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -285,15 +285,7 @@ struct rte_vlan_hdr {
 	uint16_t eth_proto;/**< Ethernet type of encapsulated frame. */
 } __attribute__((__packed__));
 
-/**
- * VXLAN protocol header.
- * Contains the 8-bit flag, 24-bit VXLAN Network Identifier and
- * Reserved fields (24 bits and 8 bits)
- */
-struct rte_vxlan_hdr {
-	uint32_t vx_flags; /**< flag (8) + Reserved (24). */
-	uint32_t vx_vni;   /**< VNI (24) + Reserved (8). */
-} __attribute__((__packed__));
+
 
 /* Ethernet frame types */
 #define RTE_ETHER_TYPE_IPV4 0x0800 /**< IPv4 Protocol. */
@@ -313,35 +305,6 @@ struct rte_vxlan_hdr {
 #define RTE_ETHER_TYPE_MPLS 0x8847 /**< MPLS ethertype. */
 #define RTE_ETHER_TYPE_MPLSM 0x8848 /**< MPLS multicast ethertype. */
 
-#define RTE_ETHER_VXLAN_HLEN \
-	(sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr))
-	/**< VXLAN tunnel header length. */
-
-/**
- * VXLAN-GPE protocol header (draft-ietf-nvo3-vxlan-gpe-05).
- * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network
- * Identifier and Reserved fields (16 bits and 8 bits).
- */
-struct rte_vxlan_gpe_hdr {
-	uint8_t vx_flags;    /**< flag (8). */
-	uint8_t reserved[2]; /**< Reserved (16). */
-	uint8_t proto;       /**< next-protocol (8). */
-	uint32_t vx_vni;     /**< VNI (24) + Reserved (8). */
-} __attribute__((__packed__));
-
-/* VXLAN-GPE next protocol types */
-#define RTE_VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 Protocol. */
-#define RTE_VXLAN_GPE_TYPE_IPV6 2 /**< IPv6 Protocol. */
-#define RTE_VXLAN_GPE_TYPE_ETH  3 /**< Ethernet Protocol. */
-#define RTE_VXLAN_GPE_TYPE_NSH  4 /**< NSH Protocol. */
-#define RTE_VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */
-#define RTE_VXLAN_GPE_TYPE_GBP  6 /**< GBP Protocol. */
-#define RTE_VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */
-
-#define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \
-			      sizeof(struct rte_vxlan_gpe_hdr))
-/**< VXLAN-GPE tunnel header length. */
-
 /**
  * Extract VLAN tag information into mbuf
  *
diff --git a/lib/librte_net/rte_vxlan.h b/lib/librte_net/rte_vxlan.h
new file mode 100644
index 0000000..63fc272
--- /dev/null
+++ b/lib/librte_net/rte_vxlan.h
@@ -0,0 +1,71 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018-2019 Intel Corporation
+ */
+
+#ifndef _RTE_VXLAN_H_
+#define _RTE_VXLAN_H_
+
+/**
+ * @file
+ *
+ * VXLAN-related definitions
+ */
+
+#include <stdint.h>
+
+#include <rte_udp.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** VXLAN default port. */
+#define RTE_VXLAN_DEFAULT_PORT 4789
+
+/**
+ * VXLAN protocol header.
+ * Contains the 8-bit flag, 24-bit VXLAN Network Identifier and
+ * Reserved fields (24 bits and 8 bits)
+ */
+struct rte_vxlan_hdr {
+	uint32_t vx_flags; /**< flag (8) + Reserved (24). */
+	uint32_t vx_vni;   /**< VNI (24) + Reserved (8). */
+} __attribute__((__packed__));
+
+/** VXLAN tunnel header length. */
+#define RTE_ETHER_VXLAN_HLEN \
+	(sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr))
+
+
+/**
+ * VXLAN-GPE protocol header (draft-ietf-nvo3-vxlan-gpe-05).
+ * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network
+ * Identifier and Reserved fields (16 bits and 8 bits).
+ */
+struct rte_vxlan_gpe_hdr {
+	uint8_t vx_flags;    /**< flag (8). */
+	uint8_t reserved[2]; /**< Reserved (16). */
+	uint8_t proto;       /**< next-protocol (8). */
+	uint32_t vx_vni;     /**< VNI (24) + Reserved (8). */
+} __attribute__((__packed__));
+
+/** VXLAN-GPE tunnel header length. */
+#define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \
+		sizeof(struct rte_vxlan_gpe_hdr))
+
+/* VXLAN-GPE next protocol types */
+#define RTE_VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 Protocol. */
+#define RTE_VXLAN_GPE_TYPE_IPV6 2 /**< IPv6 Protocol. */
+#define RTE_VXLAN_GPE_TYPE_ETH  3 /**< Ethernet Protocol. */
+#define RTE_VXLAN_GPE_TYPE_NSH  4 /**< NSH Protocol. */
+#define RTE_VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */
+#define RTE_VXLAN_GPE_TYPE_GBP  6 /**< GBP Protocol. */
+#define RTE_VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_VXLAN_H_ */
diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
index 47d7efb..70cd20b 100644
--- a/lib/librte_pipeline/rte_table_action.c
+++ b/lib/librte_pipeline/rte_table_action.c
@@ -14,6 +14,7 @@
 #include <rte_esp.h>
 #include <rte_tcp.h>
 #include <rte_udp.h>
+#include <rte_vxlan.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net: add new header file for VXLAN
  2019-10-23 13:19 ` [dpdk-dev] [PATCH v2] " Flavia Musatescu
@ 2019-10-24 14:52   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2019-10-24 14:52 UTC (permalink / raw)
  To: Flavia Musatescu, dev, Wenzhuo Lu, Jingjing Wu,
	Bernard Iremonger, John McNamara, Marko Kovacevic, John Daley,
	Hyong Youb Kim, Wei Hu (Xavier), Min Hu (Connor),
	Yisen Zhuang, Konstantin Ananyev, Matan Azrad, Shahaf Shuler,
	Viacheslav Ovsiienko, Bruce Richardson, Harry van Haaren,
	Xiaoyun Li, Jiayu Hu, Olivier Matz, Cristian Dumitrescu,
	Raslan Darawsheh

On 10/23/2019 2:19 PM, Flavia Musatescu wrote:
> The VXLAN related definitions and structures are moved from
> rte_ether.h to a new header file: rte_xvlan.h.
> 
> Also introducing a new define macro for VXLAN default port id:
> RTE_VXLAN_DEFAULT_PORT
> 
> Signed-off-by: Flavia Musatescu <flavia.musatescu@intel.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Tested-by: Raslan Darawsheh <rasland@mellanox.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-24 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-22 16:40 [dpdk-dev] [PATCH] net: add new header file for VXLAN Flavia Musatescu
2019-10-23 13:19 ` [dpdk-dev] [PATCH v2] " Flavia Musatescu
2019-10-24 14:52   ` Ferruh Yigit

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).