Skip to contentSkip to conversation

i40e: Remove CONFIG_I40E_VXLAN

RFC Superseded Anjali Singhai Jain 4 participants 8 messages Aug 24, 2015 – Aug 25, 2015

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

RFC 1/4 i40e: Remove CONFIG_I40E_VXLAN

If the kernel flag CONFIG_VXLAN is true or CONFIG_VXLAN_MODULE is true, enable VXLAN offload in the driver.

---
 drivers/net/ethernet/intel/Kconfig          | 11 -----------
 drivers/net/ethernet/intel/i40e/i40e.h      |  4 ----
 drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++----------
 3 files changed, 4 insertions(+), 25 deletions(-)
drivers/net/ethernet/intel/Kconfig +0 -11
index 4163b16..061e4e0 100644
@@ -269,17 +269,6 @@ config I40E
 	  To compile this driver as a module, choose M here. The module
 	  will be called i40e.
 
-config I40E_VXLAN
-	bool "Virtual eXtensible Local Area Network Support"
-	default n
-	depends on I40E && VXLAN && !(I40E=y && VXLAN=m)
-	---help---
-	  This allows one to create VXLAN virtual interfaces that provide
-	  Layer 2 Networks over Layer 3 Networks. VXLAN is often used
-	  to tunnel virtual network infrastructure in virtualized environments.
-	  Say Y here if you want to use Virtual eXtensible Local Area Network
-	  (VXLAN) in the driver.
-
 config I40E_DCB
 	bool "Data Center Bridging (DCB) Support"
 	default n
drivers/net/ethernet/intel/i40e/i40e.h +0 -4
index c9fa289..257f7d8 100644
@@ -274,11 +274,9 @@ struct i40e_pf {
 	u32 fd_atr_cnt;
 	u32 fd_tcp_rule;
 
-#ifdef CONFIG_I40E_VXLAN
 	__be16  vxlan_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
 	u16 pending_vxlan_bitmap;
 
-#endif
 	enum i40e_interrupt_policy int_policy;
 	u16 rx_itr_default;
 	u16 tx_itr_default;
@@ -316,9 +314,7 @@ struct i40e_pf {
 #define I40E_FLAG_FD_ATR_ENABLED		BIT_ULL(22)
 #define I40E_FLAG_PTP				BIT_ULL(25)
 #define I40E_FLAG_MFP_ENABLED			BIT_ULL(26)
-#ifdef CONFIG_I40E_VXLAN
 #define I40E_FLAG_VXLAN_FILTER_SYNC		BIT_ULL(27)
-#endif
 #define I40E_FLAG_PORT_ID_VALID			BIT_ULL(28)
 #define I40E_FLAG_DCB_CAPABLE			BIT_ULL(29)
 #define I40E_FLAG_RSS_AQ_CAPABLE		BIT_ULL(31)
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -10
index aef0a4c..05081d1 100644
@@ -28,7 +28,7 @@
 #include "i40e.h"
 #include "i40e_helper.h"
 #include "i40e_diag.h"
-#ifdef CONFIG_I40E_VXLAN
+#if defined(CONFIG_VXLAN) || defined(CONFIG_VXLAN_MODULE)
 #include <net/vxlan.h>
 #endif
 
@@ -4934,7 +4934,7 @@ int i40e_open(struct net_device *netdev)
 						       TCP_FLAG_CWR) >> 16);
 	wr32(&pf->hw, I40E_GLLAN_TSOMSK_L, be32_to_cpu(TCP_FLAG_CWR) >> 16);
 
-#ifdef CONFIG_I40E_VXLAN
+#if defined(CONFIG_VXLAN) || defined(CONFIG_VXLAN_MODULE)
 	vxlan_get_rx_port(netdev);
 #endif
 
@@ -6659,13 +6659,13 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
 	i40e_flush(hw);
 }
 
-#ifdef CONFIG_I40E_VXLAN
 /**
  * i40e_sync_vxlan_filters_subtask - Sync the VSI filter list with HW
  * @pf: board private structure
  **/
 static void i40e_sync_vxlan_filters_subtask(struct i40e_pf *pf)
 {
+#if defined(CONFIG_VXLAN) || defined(CONFIG_VXLAN_MODULE)
 	struct i40e_hw *hw = &pf->hw;
 	i40e_status ret;
 	__be16 port;
@@ -6699,9 +6699,9 @@ static void i40e_sync_vxlan_filters_subtask(struct i40e_pf *pf)
 			}
 		}
 	}
+#endif
 }
 
-#endif
 /**
  * i40e_service_task - Run the driver's async subtasks
  * @work: pointer to work_struct containing our data
@@ -6725,9 +6725,7 @@ static void i40e_service_task(struct work_struct *work)
 	i40e_watchdog_subtask(pf);
 	i40e_fdir_reinit_subtask(pf);
 	i40e_sync_filters_subtask(pf);
-#ifdef CONFIG_I40E_VXLAN
 	i40e_sync_vxlan_filters_subtask(pf);
-#endif
 	i40e_clean_adminq_subtask(pf);
 
 	i40e_service_event_complete(pf);
@@ -7944,7 +7942,6 @@ static int i40e_set_features(struct net_device *netdev,
 	return 0;
 }
 
-#ifdef CONFIG_I40E_VXLAN
 /**
  * i40e_get_vxlan_port_idx - Lookup a possibly offloaded for Rx UDP port
  * @pf: board private structure
@@ -8039,7 +8036,6 @@ static void i40e_del_vxlan_port(struct net_device *netdev,
 	}
 }
 
-#endif
 static int i40e_get_phys_port_id(struct net_device *netdev,
 				 struct netdev_phys_item_id *ppid)
 {
@@ -8262,10 +8258,8 @@ static const struct net_device_ops i40e_netdev_ops = {
 	.ndo_get_vf_config	= i40e_ndo_get_vf_config,
 	.ndo_set_vf_link_state	= i40e_ndo_set_vf_link_state,
 	.ndo_set_vf_spoofchk	= i40e_ndo_set_vf_spoofchk,
-#ifdef CONFIG_I40E_VXLAN
 	.ndo_add_vxlan_port	= i40e_add_vxlan_port,
 	.ndo_del_vxlan_port	= i40e_del_vxlan_port,
-#endif
 	.ndo_get_phys_port_id	= i40e_get_phys_port_id,
 	.ndo_fdb_add		= i40e_ndo_fdb_add,
 	.ndo_features_check	= i40e_features_check,
Signature · 1 line
1.8.1.4
#1 lore raw

RFC 1/4 i40e: Remove CONFIG_I40E_VXLAN

Quoted 64 lines · Anjali Singhai Jain

If the kernel flag CONFIG_VXLAN is true or CONFIG_VXLAN_MODULE is true, enable VXLAN offload in the driver.

---
  drivers/net/ethernet/intel/Kconfig          | 11 -----------
  drivers/net/ethernet/intel/i40e/i40e.h      |  4 ----
  drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++----------
  3 files changed, 4 insertions(+), 25 deletions(-)
drivers/net/ethernet/intel/Kconfig +0 -11
index 4163b16..061e4e0 100644
@@ -269,17 +269,6 @@ config I40E
  	  To compile this driver as a module, choose M here. The module
  	  will be called i40e.
 
-config I40E_VXLAN
-	bool "Virtual eXtensible Local Area Network Support"
-	default n
-	depends on I40E && VXLAN && !(I40E=y && VXLAN=m)
-	---help---
-	  This allows one to create VXLAN virtual interfaces that provide
-	  Layer 2 Networks over Layer 3 Networks. VXLAN is often used
-	  to tunnel virtual network infrastructure in virtualized environments.
-	  Say Y here if you want to use Virtual eXtensible Local Area Network
-	  (VXLAN) in the driver.
-
  config I40E_DCB
  	bool "Data Center Bridging (DCB) Support"
  	default n
drivers/net/ethernet/intel/i40e/i40e.h +0 -4
index c9fa289..257f7d8 100644
@@ -274,11 +274,9 @@ struct i40e_pf {
  	u32 fd_atr_cnt;
  	u32 fd_tcp_rule;
 
-#ifdef CONFIG_I40E_VXLAN
  	__be16  vxlan_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
  	u16 pending_vxlan_bitmap;
 
-#endif
  	enum i40e_interrupt_policy int_policy;
  	u16 rx_itr_default;
  	u16 tx_itr_default;
@@ -316,9 +314,7 @@ struct i40e_pf {
  #define I40E_FLAG_FD_ATR_ENABLED		BIT_ULL(22)
  #define I40E_FLAG_PTP				BIT_ULL(25)
  #define I40E_FLAG_MFP_ENABLED			BIT_ULL(26)
-#ifdef CONFIG_I40E_VXLAN
  #define I40E_FLAG_VXLAN_FILTER_SYNC		BIT_ULL(27)
-#endif
  #define I40E_FLAG_PORT_ID_VALID			BIT_ULL(28)
  #define I40E_FLAG_DCB_CAPABLE			BIT_ULL(29)
  #define I40E_FLAG_RSS_AQ_CAPABLE		BIT_ULL(31)
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -0
index aef0a4c..05081d1 100644

drivers/net/ethernet/intel/i40e/i40e_main.c line 31

Quoted 5 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
@@ -28,7 +28,7 @@
  #include "i40e.h"
  #include "i40e_helper.h"
  #include "i40e_diag.h"
-#ifdef CONFIG_I40E_VXLAN
+#if defined(CONFIG_VXLAN) || defined(CONFIG_VXLAN_MODULE)

This should probably just be replaced with:
#if IS_ENABLED(CONFIG_VXLAN)

Same goes for the other spots in this patch as well.

- Alex

#2 lore raw

RFC 2/4 geneve: Add geneve udp port offload for ethernet devices

In reply to Anjali Singhai Jain

Add ndo_ops to add/del UDP ports to a device that supports geneve offload.

v2:Added comments for new ndo_ops and minor format fix.

---
 include/linux/netdevice.h | 20 +++++++++++++++++++-
 net/ipv4/geneve_core.c    | 22 ++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)
include/linux/netdevice.h +19 -1
index f3bb290..d6f00c7 100644
@@ -1016,6 +1016,19 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
  *	address family that vxlan is not listening to anymore. The operation
  *	is protected by the vxlan_net->sock_lock.
  *
+ * void (*ndo_add_geneve_port)(struct net_device *dev,
+ *			      sa_family_t sa_family, __be16 port);
+ *	Called by geneve to notiy a driver about the UDP port and socket
+ *	address family that geneve is listnening to. It is called only when
+ *	a new port starts listening. The operation is protected by the
+ *	geneve_net->sock_lock.
+ *
+ * void (*ndo_del_geneve_port)(struct net_device *dev,
+ *			      sa_family_t sa_family, __be16 port);
+ *	Called by geneve to notify the driver about a UDP port and socket
+ *	address family that geneve is not listening to anymore. The operation
+ *	is protected by the geneve_net->sock_lock.
+ *
  * void* (*ndo_dfwd_add_station)(struct net_device *pdev,
  *				 struct net_device *dev)
  *	Called by upper layer devices to accelerate switching or other
@@ -1210,7 +1223,12 @@ struct net_device_ops {
 	void			(*ndo_del_vxlan_port)(struct  net_device *dev,
 						      sa_family_t sa_family,
 						      __be16 port);
-
+	void			(*ndo_add_geneve_port)(struct net_device *dev,
+						      sa_family_t sa_family,
+						      __be16 port);
+	void			(*ndo_del_geneve_port)(struct net_device *dev,
+						      sa_family_t sa_family,
+						      __be16 port);
 	void*			(*ndo_dfwd_add_station)(struct net_device *pdev,
 							struct net_device *dev);
 	void			(*ndo_dfwd_del_station)(struct net_device *pdev,
net/ipv4/geneve_core.c +22 -0
index 311a4ba..9ea9082 100644
@@ -234,8 +234,11 @@ static int geneve_gro_complete(struct sk_buff *skb, int nhoff,
 
 static void geneve_notify_add_rx_port(struct geneve_sock *gs)
 {
+	struct net_device *dev;
 	struct sock *sk = gs->sock->sk;
+	struct net *net = sock_net(sk);
 	sa_family_t sa_family = sk->sk_family;
+	__be16 port = inet_sk(sk)->inet_sport;
 	int err;
 
 	if (sa_family == AF_INET) {
@@ -244,12 +247,31 @@ static void geneve_notify_add_rx_port(struct geneve_sock *gs)
 			pr_warn("geneve: udp_add_offload failed with status %d\n",
 				err);
 	}
+
+	rcu_read_lock();
+	for_each_netdev_rcu(net, dev) {
+		if (dev->netdev_ops->ndo_add_geneve_port)
+			dev->netdev_ops->ndo_add_geneve_port(dev, sa_family,
+							     port);
+	}
+	rcu_read_unlock();
 }
 
 static void geneve_notify_del_rx_port(struct geneve_sock *gs)
 {
+	struct net_device *dev;
 	struct sock *sk = gs->sock->sk;
+	struct net *net = sock_net(sk);
 	sa_family_t sa_family = sk->sk_family;
+	__be16 port = inet_sk(sk)->inet_sport;
+
+	rcu_read_lock();
+	for_each_netdev_rcu(net, dev) {
+		if (dev->netdev_ops->ndo_del_geneve_port)
+			dev->netdev_ops->ndo_del_geneve_port(dev, sa_family,
+							     port);
+	}
+	rcu_read_unlock();
 
 	if (sa_family == AF_INET)
 		udp_del_offload(&gs->udp_offloads);
Signature · 1 line
1.8.1.4
#4 lore raw

RFC 2/4 geneve: Add geneve udp port offload for ethernet devices

Sorry my bad. I meant to send the patch series to Netdev for further review feedback as you had suggested in the mean while but ended up resending here. V2 of the patches are on the way with your feedback.

Thanks
Anjali

Quoted 20 lines

-----Original Message-----
From: Jesse Gross [mailto:jesse at nicira.com]
Sent: Monday, August 24, 2015 4:00 PM
To: Singhai, Anjali
Cc: intel-wired-lan
Subject: Re: [Intel-wired-lan] [RFC v1 2/4] geneve: Add geneve udp port offload for ethernet devices

Quoted 7 lines · Anjali Singhai Jain

Add ndo_ops to add/del UDP ports to a device that supports geneve offload.

v2:Added comments for new ndo_ops and minor format fix.

I'm a little confused - what happened to the comments on this patch and patch 4?

#5 lore raw

RFC 2/4 geneve: Add geneve udp port offload for ethernet devices

Thanks!

Quoted 26 lines · Anjali

Sorry my bad. I meant to send the patch series to Netdev for further review feedback as you had suggested in the mean while but ended up resending here. V2 of the patches are on the way with your feedback.

Thanks
Anjali

Quoted 20 lines

-----Original Message-----
From: Jesse Gross [mailto:jesse at nicira.com]
Sent: Monday, August 24, 2015 4:00 PM
To: Singhai, Anjali
Cc: intel-wired-lan
Subject: Re: [Intel-wired-lan] [RFC v1 2/4] geneve: Add geneve udp port offload for ethernet devices

Quoted 7 lines · Anjali Singhai Jain

Add ndo_ops to add/del UDP ports to a device that supports geneve offload.

v2:Added comments for new ndo_ops and minor format fix.

I'm a little confused - what happened to the comments on this patch and patch 4?

#6 lore raw

RFC 3/4 i40e: Generalize the UDP tunnel offload flow

In reply to Anjali Singhai Jain

This patch generalizes the implementation for UDP based tunnel offloads so that VXLAN and any other UDP based tunnel protocols such as Geneve can utilize it.

---
 drivers/net/ethernet/intel/i40e/i40e.h      | 11 +++++--
 drivers/net/ethernet/intel/i40e/i40e_main.c | 50 ++++++++++++++---------------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c |  6 ++--
 drivers/net/ethernet/intel/i40e/i40e_txrx.h |  2 +-
 4 files changed, 37 insertions(+), 32 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +8 -3
index 257f7d8..71752c6 100644
@@ -237,6 +237,11 @@ struct i40e_tc_configuration {
 	struct i40e_tc_info tc_info[I40E_MAX_TRAFFIC_CLASS];
 };
 
+struct i40e_udp_port_config {
+	__be16 index;
+	u8 type;
+};
+
 /* struct that defines the Ethernet device */
 struct i40e_pf {
 	struct pci_dev *pdev;
@@ -274,8 +279,8 @@ struct i40e_pf {
 	u32 fd_atr_cnt;
 	u32 fd_tcp_rule;
 
-	__be16  vxlan_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
-	u16 pending_vxlan_bitmap;
+	struct i40e_udp_port_config udp_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
+	u16 pending_udp_bitmap;
 
 	enum i40e_interrupt_policy int_policy;
 	u16 rx_itr_default;
@@ -314,7 +319,7 @@ struct i40e_pf {
 #define I40E_FLAG_FD_ATR_ENABLED		BIT_ULL(22)
 #define I40E_FLAG_PTP				BIT_ULL(25)
 #define I40E_FLAG_MFP_ENABLED			BIT_ULL(26)
-#define I40E_FLAG_VXLAN_FILTER_SYNC		BIT_ULL(27)
+#define I40E_FLAG_UDP_FILTER_SYNC              BIT_ULL(27)
 #define I40E_FLAG_PORT_ID_VALID			BIT_ULL(28)
 #define I40E_FLAG_DCB_CAPABLE			BIT_ULL(29)
 #define I40E_FLAG_RSS_AQ_CAPABLE		BIT_ULL(31)
drivers/net/ethernet/intel/i40e/i40e_main.c +25 -25

129 lines not on this page · raw message

drivers/net/ethernet/intel/i40e/i40e_txrx.c +3 -3
index 0fbcd05..424c5cc 100644
@@ -2007,7 +2007,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
 	if (!(tx_flags & (I40E_TX_FLAGS_IPV4 | I40E_TX_FLAGS_IPV6)))
 		return;
 
-	if (!(tx_flags & I40E_TX_FLAGS_VXLAN_TUNNEL)) {
+	if (!(tx_flags & I40E_TX_FLAGS_UDP_TUNNEL)) {
 		/* snag network header to get L4 type and address */
 		hdr.network = skb_network_header(skb);
 
@@ -2092,7 +2092,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
 		     I40E_TXD_FLTR_QW1_FD_STATUS_SHIFT;
 
 	dtype_cmd |= I40E_TXD_FLTR_QW1_CNT_ENA_MASK;
-	if (!(tx_flags & I40E_TX_FLAGS_VXLAN_TUNNEL))
+	if (!(tx_flags & I40E_TX_FLAGS_UDP_TUNNEL))
 		dtype_cmd |=
 			((u32)I40E_FD_ATR_STAT_IDX(pf->hw.pf_id) <<
 			I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) &
@@ -2323,7 +2323,7 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
 			oudph = udp_hdr(skb);
 			oiph = ip_hdr(skb);
 			l4_tunnel = I40E_TXD_CTX_UDP_TUNNELING;
-			*tx_flags |= I40E_TX_FLAGS_VXLAN_TUNNEL;
+			*tx_flags |= I40E_TX_FLAGS_UDP_TUNNEL;
 			break;
 		default:
 			return;
drivers/net/ethernet/intel/i40e/i40e_txrx.h +1 -1
index a992cb8f..db2130f 100644
@@ -151,7 +151,7 @@ enum i40e_dyn_idx_t {
 #define I40E_TX_FLAGS_FSO		BIT(7)
 #define I40E_TX_FLAGS_TSYN		BIT(8)
 #define I40E_TX_FLAGS_FD_SB		BIT(9)
-#define I40E_TX_FLAGS_VXLAN_TUNNEL	BIT(10)
+#define I40E_TX_FLAGS_UDP_TUNNEL	BIT(10)
 #define I40E_TX_FLAGS_VLAN_MASK		0xffff0000
 #define I40E_TX_FLAGS_VLAN_PRIO_MASK	0xe0000000
 #define I40E_TX_FLAGS_VLAN_PRIO_SHIFT	29
Signature · 1 line
1.8.1.4
#7 lore raw

RFC 4/4 i40e: geneve tunnel offload support

In reply to Anjali Singhai Jain

This patch adds driver hooks to implement ndo_ops to add/del udp port in the HW to identify GENEVE tunnels.

---
 drivers/net/ethernet/intel/i40e/i40e.h      |  1 +
 drivers/net/ethernet/intel/i40e/i40e_main.c | 89 ++++++++++++++++++++++++++++-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c |  2 +-
 3 files changed, 89 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
index 71752c6..12c96da 100644
@@ -330,6 +330,7 @@ struct i40e_pf {
 #define I40E_FLAG_VEB_STATS_ENABLED		BIT_ULL(37)
 #define I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE	BIT_ULL(38)
 #define I40E_FLAG_VEB_MODE_ENABLED		BIT_ULL(40)
+#define I40E_FLAG_GENEVE_OFFLOAD_CAPABLE	BIT_ULL(41)
 
 	/* tracks features that get auto disabled by errors */
 	u64 auto_disable_flags;
drivers/net/ethernet/intel/i40e/i40e_main.c +87 -2

113 lines not on this page · raw message

drivers/net/ethernet/intel/i40e/i40e_txrx.c +1 -1
index 424c5cc..b93c2dc 100644
@@ -1425,7 +1425,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
 	if (rx_error & BIT(I40E_RX_DESC_ERROR_PPRS_SHIFT))
 		return;
 
-	/* If VXLAN traffic has an outer UDPv4 checksum we need to check
+	/* If VXLAN/GENEVE traffic has an outer UDPv4 checksum we need to check
 	 * it in the driver, hardware does not do it for us.
 	 * Since L3L4P bit was set we assume a valid IHL value (>=5)
 	 * so the total length of IPv4 header is IHL*4 bytes
Signature · 1 line
1.8.1.4