i40e: Remove CONFIG_I40E_VXLAN
Subsystems (9)
PATCH v4 1/6 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.
v2: Fix bisection error for this patch series.
--- drivers/net/ethernet/intel/i40e/i40e.h | 2 -- drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++-------- 2 files changed, 2 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -2
@@ -282,11 +282,9 @@ struct i40e_pf {u32 fd_atr_cnt;u32 fd_tcp_rule; -#if IS_ENABLED (CONFIG_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;
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -8
@@ -6990,13 +6990,13 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)i40e_flush (hw); } -#if IS_ENABLED (CONFIG_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 IS_ENABLED (CONFIG_VXLAN )struct i40e_hw *hw = &pf->hw;i40e_status ret;__be16 port;
@@ -7030,9 +7030,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
@@ -7057,9 +7057,7 @@ static void i40e_service_task(struct work_struct *work)i40e_watchdog_subtask (pf);i40e_fdir_reinit_subtask (pf);i40e_sync_filters_subtask (pf); -#if IS_ENABLED (CONFIG_VXLAN )i40e_sync_vxlan_filters_subtask (pf); -#endif i40e_clean_adminq_subtask (pf);i40e_service_event_complete (pf);
@@ -8433,7 +8431,6 @@ static int i40e_set_features(struct net_device *netdev,return 0 ; } -#if IS_ENABLED (CONFIG_VXLAN )/** * i40e_get_vxlan_port_idx - Lookup a possibly offloaded for Rx UDP port * @pf: board private structure
@@ -8528,7 +8525,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) {
@@ -8753,10 +8749,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, -#if IS_ENABLED(CONFIG_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
PATCH v4 2/6 net: Generalize udp based tunnel offload
Replace add/del ndo ops for vxlan_port with tunnel_port so that all UDP based tunnels can use the same ndo op. Add a parameter to pass tunnel type to the ndo_op.
Change all drivers to use the generalized udp tunnel offload
Patch was compile tested with x86_64_defconfig.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 15 ++++++--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 15 ++++++--- drivers/net/ethernet/emulex/benet/be_main.c | 15 ++++++--- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 27 ++++++++++++---- drivers/net/ethernet/intel/i40e/i40e_main.c | 41 +++++++++++++++++------- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 17 +++++++--- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 21 ++++++++---- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 17 +++++++--- drivers/net/vxlan.c | 20 ++++++------ include/linux/netdevice.h | 39 ++++++++++++---------- include/net/udp_tunnel.h | 5 +++ 11 files changed, 161 insertions(+), 71 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +11 -4
@@ -47,6 +47,7 @@#include <net/ip.h> #include <net/ipv6.h> #include <net/tcp.h> +#include <net/udp_tunnel.h> #include <net/vxlan.h> #include <net/checksum.h> #include <net/ip6_checksum.h>
@@ -10124,11 +10125,14 @@ static void __bnx2x_add_vxlan_port(struct bnx2x *bp, u16 port) }static void bnx2x_add_vxlan_port (struct net_device *netdev, -sa_family_t sa_family,__be16 port) +sa_family_t sa_family,__be16 port, +u32 type) {struct bnx2x *bp =netdev_priv (netdev);u16 t_port =ntohs (port); +if (type !=UDP_TUNNEL_VXLAN ) +return ;__bnx2x_add_vxlan_port (bp, t_port); }
@@ -10152,11 +10156,14 @@ static void __bnx2x_del_vxlan_port(struct bnx2x *bp, u16 port) }static void bnx2x_del_vxlan_port (struct net_device *netdev, -sa_family_t sa_family,__be16 port) +sa_family_t sa_family,__be16 port, +u32 type) {struct bnx2x *bp =netdev_priv (netdev);u16 t_port =ntohs (port); +if (type !=UDP_TUNNEL_VXLAN ) +return ;__bnx2x_del_vxlan_port (bp, t_port); }#endif
@@ -13011,8 +13018,8 @@ static const struct net_device_ops bnx2x_netdev_ops = { .ndo_set_vf_link_state = bnx2x_set_vf_link_state, .ndo_features_check = bnx2x_features_check, #ifdef CONFIG_BNX2X_VXLAN - .ndo_add_vxlan_port = bnx2x_add_vxlan_port, - .ndo_del_vxlan_port = bnx2x_del_vxlan_port, + .ndo_add_udp_tunnel_port = bnx2x_add_vxlan_port, + .ndo_del_udp_tunnel_port = bnx2x_del_vxlan_port,#endif };
drivers/net/ethernet/broadcom/bnxt/bnxt.c +11 -4
@@ -39,6 +39,7 @@#include <net/ip6_checksum.h> #if defined(CONFIG_VXLAN ) || defined(CONFIG_VXLAN_MODULE )#include <net/vxlan.h> +#include <net/udp_tunnel.h> #endif #ifdef CONFIG_NET_RX_BUSY_POLL #include <net/busy_poll.h>
@@ -5409,7 +5410,7 @@ static void bnxt_cfg_ntp_filters(struct bnxt *bp)#endif /* CONFIG_RFS_ACCEL */ static void bnxt_add_vxlan_port (struct net_device *dev,sa_family_t sa_family, -__be16 port) +__be16 port,u32 type) {struct bnxt *bp =netdev_priv (dev);
@@ -5419,6 +5420,9 @@ static void bnxt_add_vxlan_port(struct net_device *dev, sa_family_t sa_family,if (sa_family !=AF_INET6 && sa_family !=AF_INET )return ; +if (type !=UDP_TUNNEL_VXLAN ) +return ; +if (bp->vxlan_port_cnt && bp->vxlan_port != port)return ;
@@ -5431,7 +5435,7 @@ static void bnxt_add_vxlan_port(struct net_device *dev, sa_family_t sa_family, }static void bnxt_del_vxlan_port (struct net_device *dev,sa_family_t sa_family, -__be16 port) +__be16 port,u32 type) {struct bnxt *bp =netdev_priv (dev);
@@ -5441,6 +5445,9 @@ static void bnxt_del_vxlan_port(struct net_device *dev, sa_family_t sa_family,if (sa_family !=AF_INET6 && sa_family !=AF_INET )return ; +if (type !=UDP_TUNNEL_VXLAN ) +return ; +if (bp->vxlan_port_cnt && bp->vxlan_port == port) { bp->vxlan_port_cnt--;
@@ -5479,8 +5486,8 @@ static const struct net_device_ops bnxt_netdev_ops = {#ifdef CONFIG_RFS_ACCEL .ndo_rx_flow_steer = bnxt_rx_flow_steer, #endif - .ndo_add_vxlan_port = bnxt_add_vxlan_port, - .ndo_del_vxlan_port = bnxt_del_vxlan_port, + .ndo_add_udp_tunnel_port = bnxt_add_vxlan_port, + .ndo_del_udp_tunnel_port = bnxt_del_vxlan_port, #ifdef CONFIG_NET_RX_BUSY_POLL .ndo_busy_poll = bnxt_busy_poll,#endif
drivers/net/ethernet/emulex/benet/be_main.c +11 -4
@@ -23,6 +23,7 @@#include <linux/aer.h> #include <linux/if_bridge.h> #include <net/busy_poll.h> +#include <net/udp_tunnel.h> #include <net/vxlan.h> MODULE_VERSION (DRV_VER );
@@ -5177,12 +5178,15 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,* until after all the tunnels are removed. */ static void be_add_vxlan_port (struct net_device *netdev,sa_family_t sa_family, -__be16 port) +__be16 port,u32 type) {struct be_adapter *adapter =netdev_priv (netdev);struct device *dev = &adapter->pdev->dev;int status; +if (type !=UDP_TUNNEL_VXLAN ) +return ; +if (lancer_chip (adapter) ||BEx_chip (adapter) ||be_is_mc (adapter))return ;
@@ -5231,10 +5235,13 @@ err: }static void be_del_vxlan_port (struct net_device *netdev,sa_family_t sa_family, -__be16 port) +__be16 port,u32 type) {struct be_adapter *adapter =netdev_priv (netdev); +if (type !=UDP_TUNNEL_VXLAN ) +return ; +if (lancer_chip (adapter) ||BEx_chip (adapter) ||be_is_mc (adapter))return ;
@@ -5344,8 +5351,8 @@ static const struct net_device_ops be_netdev_ops = { .ndo_busy_poll = be_busy_poll,#endif #ifdef CONFIG_BE2NET_VXLAN - .ndo_add_vxlan_port = be_add_vxlan_port, - .ndo_del_vxlan_port = be_del_vxlan_port, + .ndo_add_udp_tunnel_port = be_add_vxlan_port, + .ndo_del_udp_tunnel_port = be_del_vxlan_port, .ndo_features_check = be_features_check, #endif .ndo_get_phys_port_id = be_get_phys_port_id,
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +21 -6
@@ -21,6 +21,7 @@#include "fm10k.h" #include <linux/vmalloc.h> #if IS_ENABLED (CONFIG_FM10K_VXLAN ) +#include <net/udp_tunnel.h> #include <net/vxlan.h> #endif /* CONFIG_FM10K_VXLAN */
@@ -439,18 +440,24 @@ static void fm10k_restore_vxlan_port(struct fm10k_intfc *interface)* @netdev: network interface device structure * @sa_family: Address family of new port * @port: port number used for VXLAN +* @type: Tunnel type * -* This funciton is called when a new VXLAN interface has added a new port +* This function is called when a new VXLAN interface has added a new port * number to the range that is currently in use for VXLAN. The new port * number is always added to the tail so that the port number list should * match the order in which the ports were allocated. The head of the list * is always used as the VXLAN port number for offloads. **/ static void fm10k_add_vxlan_port (struct net_device *dev, -sa_family_t sa_family,__be16 port) { +sa_family_t sa_family,__be16 port, +u32 type) { +#if IS_ENABLED (CONFIG_FM10K_VXLAN )struct fm10k_intfc *interface =netdev_priv (dev);struct fm10k_vxlan_port *vxlan_port; +if (type !=UDP_TUNNEL_VXLAN ) +return ; +/* only the PF supports configuring tunnels */ if (interface->hw.mac.type != fm10k_mac_pf)return ;
@@ -476,6 +483,7 @@ insert_tail:list_add_tail (&vxlan_port->list, &interface->vxlan_port);fm10k_restore_vxlan_port (interface); +#endif }/**
@@ -483,17 +491,23 @@ insert_tail:* @netdev: network interface device structure * @sa_family: Address family of freed port * @port: port number used for VXLAN +* @type: Tunnel type * -* This funciton is called when a new VXLAN interface has freed a port +* This function is called when a new VXLAN interface has freed a port * number from the range that is currently in use for VXLAN. The freed * port is removed from the list and the new head is used to determine * the port number for offloads. **/ static void fm10k_del_vxlan_port (struct net_device *dev, -sa_family_t sa_family,__be16 port) { +sa_family_t sa_family,__be16 port, +u32 type) { +#if IS_ENABLED (CONFIG_FM10K_VXLAN )struct fm10k_intfc *interface =netdev_priv (dev);struct fm10k_vxlan_port *vxlan_port; +if (type !=UDP_TUNNEL_VXLAN ) +return ; +if (interface->hw.mac.type != fm10k_mac_pf)return ;
@@ -508,6 +522,7 @@ static void fm10k_del_vxlan_port(struct net_device *dev, }fm10k_restore_vxlan_port (interface); +#endif }/**
@@ -1389,8 +1404,8 @@ static const struct net_device_ops fm10k_netdev_ops = { .ndo_set_vf_vlan = fm10k_ndo_set_vf_vlan, .ndo_set_vf_rate = fm10k_ndo_set_vf_bw, .ndo_get_vf_config = fm10k_ndo_get_vf_config, - .ndo_add_vxlan_port = fm10k_add_vxlan_port, - .ndo_del_vxlan_port = fm10k_del_vxlan_port, + .ndo_add_udp_tunnel_port = fm10k_add_vxlan_port, + .ndo_del_udp_tunnel_port = fm10k_del_vxlan_port, .ndo_do_ioctl = fm10k_ioctl, .ndo_dfwd_add_station = fm10k_dfwd_add_station, .ndo_dfwd_del_station = fm10k_dfwd_del_station,
drivers/net/ethernet/intel/i40e/i40e_main.c +29 -12
99 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +13 -4
@@ -50,6 +50,7 @@#include <linux/if_bridge.h> #include <linux/prefetch.h> #include <scsi/fc/fc_fcoe.h> +#include <net/udp_tunnel.h> #include <net/vxlan.h> #ifdef CONFIG_OF
@@ -8312,14 +8313,18 @@ static int ixgbe_set_features(struct net_device *netdev,* @dev: The port's netdev * @sa_family: Socket Family that VXLAN is notifiying us about * @port: New UDP port number that VXLAN started listening to +* @type: Tunnel type **/ static void ixgbe_add_vxlan_port (struct net_device *dev,sa_family_t sa_family, -__be16 port) +__be16 port,u32 type) {struct ixgbe_adapter *adapter =netdev_priv (dev);struct ixgbe_hw *hw = &adapter->hw;u16 new_port =ntohs (port); +if (type !=UDP_TUNNEL_VXLAN ) +return ; +if (!(adapter->flags &IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE ))return ;
@@ -8345,13 +8350,17 @@ static void ixgbe_add_vxlan_port(struct net_device *dev, sa_family_t sa_family,* @dev: The port's netdev * @sa_family: Socket Family that VXLAN is notifying us about * @port: UDP port number that VXLAN stopped listening to +* @type: Tunnel type **/ static void ixgbe_del_vxlan_port (struct net_device *dev,sa_family_t sa_family, -__be16 port) +__be16 port,u32 type) {struct ixgbe_adapter *adapter =netdev_priv (dev);u16 new_port =ntohs (port); +if (type !=UDP_TUNNEL_VXLAN ) +return ; +if (!(adapter->flags &IXGBE_FLAG_VXLAN_OFFLOAD_CAPABLE ))return ;
@@ -8663,8 +8672,8 @@ static const struct net_device_ops ixgbe_netdev_ops = { .ndo_dfwd_add_station = ixgbe_fwd_add, .ndo_dfwd_del_station = ixgbe_fwd_del, #ifdef CONFIG_IXGBE_VXLAN - .ndo_add_vxlan_port = ixgbe_add_vxlan_port, - .ndo_del_vxlan_port = ixgbe_del_vxlan_port, + .ndo_add_udp_tunnel_port = ixgbe_add_vxlan_port, + .ndo_del_udp_tunnel_port = ixgbe_del_vxlan_port, #endif /* CONFIG_IXGBE_VXLAN */ .ndo_features_check = ixgbe_features_check, };
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +15 -6
@@ -39,6 +39,7 @@#include <linux/hash.h> #include <net/ip.h> #include <net/busy_poll.h> +#include <net/udp_tunnel.h> #include <net/vxlan.h> #include <linux/mlx4/driver.h>
@@ -2402,11 +2403,15 @@ static void mlx4_en_del_vxlan_offloads(struct work_struct *work) }static void mlx4_en_add_vxlan_port (struct net_device *dev, -sa_family_t sa_family,__be16 port) +sa_family_t sa_family,__be16 port, +u32 type) {struct mlx4_en_priv *priv =netdev_priv (dev);__be16 current_port; +if (type !=UDP_TUNNEL_VXLAN ) +return ; +if (priv->mdev->dev->caps.tunnel_offload_mode !=MLX4_TUNNEL_OFFLOAD_MODE_VXLAN )return ;
@@ -2425,11 +2430,15 @@ static void mlx4_en_add_vxlan_port(struct net_device *dev, }static void mlx4_en_del_vxlan_port (struct net_device *dev, -sa_family_t sa_family,__be16 port) +sa_family_t sa_family,__be16 port, +u32 type) {struct mlx4_en_priv *priv =netdev_priv (dev);__be16 current_port; +if (type !=UDP_TUNNEL_VXLAN ) +return ; +if (priv->mdev->dev->caps.tunnel_offload_mode !=MLX4_TUNNEL_OFFLOAD_MODE_VXLAN )return ;
@@ -2509,8 +2518,8 @@ static const struct net_device_ops mlx4_netdev_ops = {#endif .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, #ifdef CONFIG_MLX4_EN_VXLAN - .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, - .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, + .ndo_add_udp_tunnel_port = mlx4_en_add_vxlan_port, + .ndo_del_udp_tunnel_port = mlx4_en_del_vxlan_port, .ndo_features_check = mlx4_en_features_check, #endif .ndo_set_tx_maxrate = mlx4_en_set_tx_maxrate,
@@ -2547,8 +2556,8 @@ static const struct net_device_ops mlx4_netdev_ops_master = {#endif .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, #ifdef CONFIG_MLX4_EN_VXLAN - .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, - .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, + .ndo_add_udp_tunnel_port = mlx4_en_add_vxlan_port, + .ndo_del_udp_tunnel_port = mlx4_en_del_vxlan_port, .ndo_features_check = mlx4_en_features_check, #endif .ndo_set_tx_maxrate = mlx4_en_set_tx_maxrate,
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +13 -4
@@ -17,6 +17,7 @@#include <linux/log2.h> #include <linux/pci.h> #ifdef CONFIG_QLCNIC_VXLAN +#include <net/udp_tunnel.h> #include <net/vxlan.h> #endif
@@ -475,11 +476,15 @@ static int qlcnic_get_phys_port_id(struct net_device *netdev,#ifdef CONFIG_QLCNIC_VXLAN static void qlcnic_add_vxlan_port (struct net_device *netdev, -sa_family_t sa_family,__be16 port) +sa_family_t sa_family,__be16 port, +u32 type) {struct qlcnic_adapter *adapter =netdev_priv (netdev);struct qlcnic_hardware_context *ahw = adapter->ahw; +if (type !=UDP_TUNNEL_VXLAN ) +return ; +/* Adapter supports only one VXLAN port. Use very first port * for enabling offload */
@@ -497,11 +502,15 @@ static void qlcnic_add_vxlan_port(struct net_device *netdev, }static void qlcnic_del_vxlan_port (struct net_device *netdev, -sa_family_t sa_family,__be16 port) +sa_family_t sa_family,__be16 port, +u32 type) {struct qlcnic_adapter *adapter =netdev_priv (netdev);struct qlcnic_hardware_context *ahw = adapter->ahw; +if (type !=UDP_TUNNEL_VXLAN ) +return ; +if (!qlcnic_encap_rx_offload (adapter) || !ahw->vxlan_port_count || (ahw->vxlan_port !=ntohs (port)))return ;
@@ -539,8 +548,8 @@ static const struct net_device_ops qlcnic_netdev_ops = { .ndo_fdb_dump = qlcnic_fdb_dump, .ndo_get_phys_port_id = qlcnic_get_phys_port_id,#ifdef CONFIG_QLCNIC_VXLAN - .ndo_add_vxlan_port = qlcnic_add_vxlan_port, - .ndo_del_vxlan_port = qlcnic_del_vxlan_port, + .ndo_add_udp_tunnel_port = qlcnic_add_vxlan_port, + .ndo_del_udp_tunnel_port = qlcnic_del_vxlan_port, .ndo_features_check = qlcnic_features_check,#endif #ifdef CONFIG_NET_POLL_CONTROLLER
drivers/net/vxlan.c +10 -10
@@ -628,9 +628,9 @@ static void vxlan_notify_add_rx_port(struct vxlan_sock *vs)rcu_read_lock ();for_each_netdev_rcu (net, dev) { -if (dev->netdev_ops->ndo_add_vxlan_port) - dev->netdev_ops->ndo_add_vxlan_port (dev, sa_family, - port); +if (dev->netdev_ops->ndo_add_udp_tunnel_port) + dev->netdev_ops->ndo_add_udp_tunnel_port (dev, sa_family, + port,UDP_TUNNEL_VXLAN ); }rcu_read_unlock (); }
@@ -646,9 +646,9 @@ static void vxlan_notify_del_rx_port(struct vxlan_sock *vs)rcu_read_lock ();for_each_netdev_rcu (net, dev) { -if (dev->netdev_ops->ndo_del_vxlan_port) - dev->netdev_ops->ndo_del_vxlan_port (dev, sa_family, - port); +if (dev->netdev_ops->ndo_del_udp_tunnel_port) + dev->netdev_ops->ndo_del_udp_tunnel_port (dev, sa_family, + port,UDP_TUNNEL_VXLAN ); }rcu_read_unlock ();
@@ -2422,9 +2422,9 @@ static struct device_type vxlan_type = { .name = "vxlan", }; -/* Calls the ndo_add_vxlan_port of the caller in order to +/* Calls the ndo_add_udp_tunnel_port of the caller in order to * supply the listening VXLAN udp ports. Callers are expected -* to implement the ndo_add_vxlan_port. +* to implement the ndo_add_udp_tunnel_port. */ void vxlan_get_rx_port (struct net_device *dev) {
@@ -2440,8 +2440,8 @@ void vxlan_get_rx_port(struct net_device *dev)hlist_for_each_entry_rcu (vs, &vn->sock_list[i], hlist) { port =inet_sk (vs->sock->sk)->inet_sport; sa_family =vxlan_get_sk_family (vs); - dev->netdev_ops->ndo_add_vxlan_port (dev, sa_family, - port); + dev->netdev_ops->ndo_add_udp_tunnel_port (dev, sa_family, + port,UDP_TUNNEL_VXLAN ); } }spin_unlock (&vn->sock_lock);
include/linux/netdevice.h +22 -17
@@ -1004,18 +1004,24 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,* not implement this, it is assumed that the hw is not able to have * multiple net devices on single physical port. * -* void (*ndo_add_vxlan_port)(struct net_device *dev, -* sa_family_t sa_family, __be16 port); -* Called by vxlan to notiy a driver about the UDP port and socket -* address family that vxlan is listnening to. It is called only when -* a new port starts listening. The operation is protected by the -* vxlan_net->sock_lock. -* -* void (*ndo_del_vxlan_port)(struct net_device *dev, -* sa_family_t sa_family, __be16 port); -* Called by vxlan to notify the driver about a UDP port and socket -* address family that vxlan is not listening to anymore. The operation -* is protected by the vxlan_net->sock_lock. +* void (*ndo_add_udp_tunnel_port)(struct net_device *dev, +* sa_family_t sa_family, __be16 port, u32 type); +* Called by UDP based tunnel modules to notify a driver about a UDP +* port and socket address family that the tunnel is listening to. It is +* called only when a new port starts listening. The operation is +* protected by tunnel socket sock_lock which is per tunnel type. +* If the driver implementation shares resources between different types +* of tunnels, it should implement it's own locking to safeguard against +* simultaneous access. +* +* void (*ndo_del_udp_tunnel_port)(struct net_device *dev, +* sa_family_t sa_family, __be16 port, u32 type); +* Called by UDP based tunnel modules to notify the driver about a UDP port +* and socket address family that tunnel is not listening to anymore. +* The operation is protected protected by tunnel socket sock_lock which +* is per tunnel type. If the driver implementation shares resources +* between different types of tunnels, it should implement it's own locking +* to safeguard against simultaneous access. * * void* (*ndo_dfwd_add_station)(struct net_device *pdev, * struct net_device *dev)
@@ -1209,13 +1215,12 @@ struct net_device_ops { struct netdev_phys_item_id *ppid);int (*ndo_get_phys_port_name)(struct net_device *dev,char *name,size_t len); -void (*ndo_add_vxlan_port)(struct net_device *dev, +void (*ndo_add_udp_tunnel_port)(struct net_device *dev,sa_family_t sa_family, -__be16 port); -void (*ndo_del_vxlan_port)(struct net_device *dev, +__be16 port,u32 type); +void (*ndo_del_udp_tunnel_port)(struct net_device *dev,sa_family_t sa_family, -__be16 port); - +__be16 port,u32 type);void * (*ndo_dfwd_add_station)(struct net_device *pdev,struct net_device *dev); void (*ndo_dfwd_del_station)(struct net_device *pdev,
include/net/udp_tunnel.h +5 -0
@@ -9,6 +9,11 @@#include <net/addrconf.h> #endif +enum udp_tunnel_type { +UDP_TUNNEL_VXLAN , +UDP_TUNNEL_GENEVE , +}; +struct udp_port_cfg {u8 family;
Signature · 1 line
1.8.1.4
PATCH v4 3/6 i40e: Generalize the flow for udp based tunnels
In reply to Anjali Singhai JainThis patch generalizes the driver flow to make room for more than just VXLAN tunnel by defining a common data structure with tunnel type.
--- drivers/net/ethernet/intel/i40e/i40e.h | 11 ++++-- drivers/net/ethernet/intel/i40e/i40e_main.c | 54 ++++++++++++++++------------- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 6 ++-- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 2 +- 4 files changed, 41 insertions(+), 32 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +8 -3
@@ -246,6 +246,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;
@@ -282,8 +287,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;
@@ -321,7 +326,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 +29 -25
141 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_txrx.c +3 -3
@@ -2006,7 +2006,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);
@@ -2091,7 +2091,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) &
@@ -2324,7 +2324,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 ;case IPPROTO_GRE : l4_tunnel =I40E_TXD_CTX_GRE_TUNNELING ;
drivers/net/ethernet/intel/i40e/i40e_txrx.h +1 -1
@@ -163,7 +163,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
Bowers
PATCH v4 3/6 i40e: Generalize the flow for udp based tunnels
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Anjali Singhai Jain
Sent: Tuesday, November 10, 2015 9:57 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v4 3/6] i40e: Generalize the flow for udp based tunnelsThis patch generalizes the driver flow to make room for more than just VXLAN tunnel by defining a common data structure with tunnel type.
Quoted 8 lines
Signed-off-by Kiran Patil <[email protected]>Signed-off-by Anjali Singhai Jain <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 11 ++++-- drivers/net/ethernet/intel/i40e/i40e_main.c | 54 ++++++++++++++++------- ------ drivers/net/ethernet/intel/i40e/i40e_txrx.c | 6 ++-- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 2 +- 4 files changed, 41 insertions(+), 32 deletions(-)
Patch code changes correctly applied
PATCH v4 4/6 geneve: Add geneve udp port offload for ethernet
In reply to Anjali Singhai JainCall ndo_ops to add/del UDP ports to a device that supports geneve offload.
--- drivers/net/geneve.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/net/geneve.c +23 -0
@@ -371,8 +371,11 @@ static struct socket *geneve_create_sock(struct net *net, bool ipv6,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 ) {
@@ -381,6 +384,14 @@ 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_udp_tunnel_port) + dev->netdev_ops->ndo_add_udp_tunnel_port (dev, + sa_family, + port,UDP_TUNNEL_GENEVE ); + } +rcu_read_unlock (); }static int geneve_hlen (struct genevehdr *gh)
@@ -521,8 +532,20 @@ static struct geneve_sock *geneve_socket_create(struct net *net, __be16 port,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_udp_tunnel_port) + dev->netdev_ops->ndo_del_udp_tunnel_port (dev, + sa_family, + port,UDP_TUNNEL_GENEVE ); + } +rcu_read_unlock ();if (sa_family ==AF_INET )udp_del_offload (&gs->udp_offloads);
Signature · 1 line
1.8.1.4
PATCH v4 5/6 i40e:Add geneve tunnel offload support
In reply to Anjali Singhai JainThis patch adds driver hooks to implement ndo_ops to add/del udp port in the HW to identify GENEVE tunnels.
Also cleans up the features_check path now that we support multiple udp based tunnels.
Add a spin_lock to guard the common data structure for the udp based tunnels.
--- drivers/net/ethernet/intel/i40e/i40e.h | 2 + drivers/net/ethernet/intel/i40e/i40e_main.c | 61 ++++++++++++++++++++++------- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 +- 3 files changed, 50 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +2 -0
@@ -338,6 +338,7 @@ struct i40e_pf {#define I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE BIT_ULL(38)#define I40E_FLAG_LINK_POLLING_ENABLED BIT_ULL(39)#define I40E_FLAG_VEB_MODE_ENABLED BIT_ULL(40) +#define I40E_FLAG_GENEVE_OFFLOAD_CAPABLE BIT_ULL(41)#define I40E_FLAG_NO_PCI_LINK_CHECK BIT_ULL(42)/* tracks features that get auto disabled by errors */
@@ -422,6 +423,7 @@ struct i40e_pf {u32 ioremap_len;u32 fd_inv; +spinlock_t udp_tunnel_lock; };struct i40e_mac_filter {
drivers/net/ethernet/intel/i40e/i40e_main.c +47 -14
191 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_txrx.c +1 -1
@@ -1383,7 +1383,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
Bowers
PATCH v4 5/6 i40e:Add geneve tunnel offload support
Quoted 17 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Anjali Singhai Jain
Sent: Tuesday, November 10, 2015 9:57 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v4 5/6] i40e:Add geneve tunnel offload supportThis patch adds driver hooks to implement
ndo_opsto add/del udp port in the HW to identify GENEVE tunnels.Also cleans up the
features_checkpath now that we support multiple udp based tunnels.Add a
spin_lockto guard the common data structure for the udp based tunnels.
Quoted 8 lines
Signed-off-by Anjali Singhai Jain <[email protected]>Signed-off-by Kiran Patil <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 2 + drivers/net/ethernet/intel/i40e/i40e_main.c | 61 ++++++++++++++++++++++------- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 +- 3 files changed, 50 insertions(+), 15 deletions(-)
Patch code changes correctly applied
PATCH v4 6/6 net: Add a generic udp_offload_get_port function
In reply to Anjali Singhai JainThe new function udp_offload_get_port replaces vxlan_get_rx_port().
This is a generic function that will help replay all udp tunnel ports irrespective of tunnel type. This way when new udp tunnels get added this function need not change.
Note: Drivers besides i40e are compile tested with this change.
v2: fix a compile issue with redefinition of the function.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 5 +++-- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- drivers/net/ethernet/emulex/benet/be_main.c | 3 ++- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 3 ++- drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 +++-- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 3 ++- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 3 ++- drivers/net/vxlan.c | 28 ++---------------------- include/linux/netdevice.h | 2 ++ include/net/protocol.h | 2 ++ include/net/vxlan.h | 8 ------- net/ipv4/udp_offload.c | 25 +++++++++++++++++++++ 13 files changed, 49 insertions(+), 46 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +3 -2
@@ -60,6 +60,7 @@#include <linux/semaphore.h> #include <linux/stringify.h> #include <linux/vmalloc.h> +#include <net/protocol.h> #include "bnx2x.h" #include "bnx2x_init.h"
@@ -10293,7 +10294,7 @@ sp_rtnl_not_reset:netdev_info (bp->dev,"Deleted vxlan dest port %d" , port); bp->vxlan_dst_port =0 ; - vxlan_get_rx_port(bp->dev); + udp_offload_get_port(bp->dev); } }#endif
@@ -12499,7 +12500,7 @@ static int bnx2x_open(struct net_device *dev)#ifdef CONFIG_BNX2X_VXLAN if (IS_PF (bp)) -vxlan_get_rx_port (dev); +udp_offload_get_port (dev);#endif return 0 ;
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -1
@@ -39,6 +39,7 @@#include <net/ip6_checksum.h> #if defined(CONFIG_VXLAN ) || defined(CONFIG_VXLAN_MODULE )#include <net/vxlan.h> +#include <net/protocol.h> #include <net/udp_tunnel.h> #endif #ifdef CONFIG_NET_RX_BUSY_POLL
@@ -4579,7 +4580,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) if (irq_re_init) { #if defined(CONFIG_VXLAN) || defined(CONFIG_VXLAN_MODULE) - vxlan_get_rx_port(bp->dev); + udp_offload_get_port(bp->dev); #endif if (!bnxt_hwrm_tunnel_dst_port_alloc( bp, htons(0x17c1),
drivers/net/ethernet/emulex/benet/be_main.c +2 -1
@@ -25,6 +25,7 @@#include <net/busy_poll.h> #include <net/udp_tunnel.h> #include <net/vxlan.h> +#include <net/protocol.h> MODULE_VERSION (DRV_VER );MODULE_DESCRIPTION (DRV_DESC " " DRV_VER );
@@ -3606,7 +3607,7 @@ static int be_open(struct net_device *netdev)#ifdef CONFIG_BE2NET_VXLAN if (skyhawk_chip (adapter)) -vxlan_get_rx_port (netdev); +udp_offload_get_port (netdev);#endif return 0 ;
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +2 -1
@@ -23,6 +23,7 @@#if IS_ENABLED (CONFIG_FM10K_VXLAN )#include <net/udp_tunnel.h> #include <net/vxlan.h> +#include <net/protocol.h> #endif /* CONFIG_FM10K_VXLAN */ /**
@@ -573,7 +574,7 @@ int fm10k_open(struct net_device *netdev)#if IS_ENABLED (CONFIG_FM10K_VXLAN )/* update VXLAN port configuration */ -vxlan_get_rx_port (netdev); +udp_offload_get_port (netdev);#endif fm10k_up (interface);
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -3
@@ -34,6 +34,7 @@#if IS_ENABLED (CONFIG_GENEVE )#include <net/geneve.h> #endif +#include <net/protocol.h> const char i40e_driver_name[] ="i40e" ; static const char i40e_driver_string[] =
@@ -5298,9 +5299,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 ); -#if IS_ENABLED (CONFIG_VXLAN ) -vxlan_get_rx_port (netdev); -#endif +udp_offload_get_port (netdev);return 0 ; }
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -2
@@ -52,6 +52,7 @@#include <scsi/fc/fc_fcoe.h> #include <net/udp_tunnel.h> #include <net/vxlan.h> +#include <net/protocol.h> #ifdef CONFIG_OF #include <linux/of_net.h>
@@ -6039,7 +6040,7 @@ static int ixgbe_open(struct net_device *netdev)ixgbe_clear_vxlan_port (adapter);#ifdef CONFIG_IXGBE_VXLAN -vxlan_get_rx_port (netdev); +udp_offload_get_port (netdev);#endif return 0 ;
@@ -7118,7 +7119,7 @@ static void ixgbe_service_task(struct work_struct *work)#ifdef CONFIG_IXGBE_VXLAN if (adapter->flags2 &IXGBE_FLAG2_VXLAN_REREG_NEEDED ) { adapter->flags2 &= ~IXGBE_FLAG2_VXLAN_REREG_NEEDED ; -vxlan_get_rx_port (adapter->netdev); +udp_offload_get_port (adapter->netdev); }#endif /* CONFIG_IXGBE_VXLAN */ ixgbe_reset_subtask (adapter);
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +2 -1
@@ -41,6 +41,7 @@#include <net/busy_poll.h> #include <net/udp_tunnel.h> #include <net/vxlan.h> +#include <net/protocol.h> #include <linux/mlx4/driver.h> #include <linux/mlx4/device.h>
@@ -1714,7 +1715,7 @@ int mlx4_en_start_port(struct net_device *dev)#ifdef CONFIG_MLX4_EN_VXLAN if (priv->mdev->dev->caps.tunnel_offload_mode ==MLX4_TUNNEL_OFFLOAD_MODE_VXLAN ) -vxlan_get_rx_port (dev); +udp_offload_get_port (dev);#endif priv->port_up = true;netif_tx_start_all_queues (dev);
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +2 -1
@@ -19,6 +19,7 @@#ifdef CONFIG_QLCNIC_VXLAN #include <net/udp_tunnel.h> #include <net/vxlan.h> +#include <net/protocol.h> #endif #include "qlcnic.h"
@@ -2025,7 +2026,7 @@ qlcnic_attach(struct qlcnic_adapter *adapter)#ifdef CONFIG_QLCNIC_VXLAN if (qlcnic_encap_rx_offload (adapter)) -vxlan_get_rx_port (netdev); +udp_offload_get_port (netdev);#endif adapter->is_up =QLCNIC_ADAPTER_UP_MAGIC ;
drivers/net/vxlan.c +2 -26
@@ -2422,32 +2422,6 @@ static struct device_type vxlan_type = { .name = "vxlan", }; -/* Calls the ndo_add_udp_tunnel_port of the caller in order to -* supply the listening VXLAN udp ports. Callers are expected -* to implement the ndo_add_udp_tunnel_port. -*/ -void vxlan_get_rx_port (struct net_device *dev) -{ -struct vxlan_sock *vs; -struct net *net =dev_net (dev); -struct vxlan_net *vn =net_generic (net, vxlan_net_id); -sa_family_t sa_family; -__be16 port; -unsigned int i; - -spin_lock (&vn->sock_lock); -for (i =0 ; i <PORT_HASH_SIZE ; ++i) { -hlist_for_each_entry_rcu (vs, &vn->sock_list[i], hlist) { - port =inet_sk (vs->sock->sk)->inet_sport; - sa_family =vxlan_get_sk_family (vs); - dev->netdev_ops->ndo_add_udp_tunnel_port (dev, sa_family, - port,UDP_TUNNEL_VXLAN ); - } - } -spin_unlock (&vn->sock_lock); -} -EXPORT_SYMBOL_GPL (vxlan_get_rx_port); -/* Initialize the device structure. */ static void vxlan_setup (struct net_device *dev) {
@@ -2636,6 +2610,8 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6,/* Initialize the vxlan udp offloads structure */ vs->udp_offloads.port = port; + vs->udp_offloads.tunnel_type =UDP_TUNNEL_VXLAN ; + vs->udp_offloads.family = ipv6 ?AF_INET6 :AF_INET ; vs->udp_offloads.callbacks.gro_receive = vxlan_gro_receive; vs->udp_offloads.callbacks.gro_complete = vxlan_gro_complete;
include/linux/netdevice.h +2 -0
@@ -2059,6 +2059,8 @@ struct udp_offload_callbacks {struct udp_offload {__be16 port; +u8 tunnel_type; +u8 family;u8 ipproto;struct udp_offload_callbacks callbacks; };
include/net/protocol.h +2 -0
@@ -110,6 +110,8 @@ void inet_unregister_protosw(struct inet_protosw *p);int udp_add_offload (struct udp_offload *prot);void udp_del_offload (struct udp_offload *prot); +void udp_offload_get_port (struct net_device *dev); +#if IS_ENABLED (CONFIG_IPV6 )int inet6_add_protocol (const struct inet6_protocol *prot,unsigned char num);int inet6_del_protocol (const struct inet6_protocol *prot,unsigned char num);
include/net/vxlan.h +0 -8
@@ -242,14 +242,6 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb,/* IPv6 header + UDP + VXLAN + Ethernet header */ #define VXLAN6_HEADROOM (40 + 8 + 8 + 14) -#if IS_ENABLED (CONFIG_VXLAN ) -void vxlan_get_rx_port (struct net_device *netdev); -#else -static inline void vxlan_get_rx_port (struct net_device *netdev) -{ -} -#endif -static inline unsigned short vxlan_get_sk_family (struct vxlan_sock *vs) {return vs->sock->sk->sk_family;
net/ipv4/udp_offload.c +25 -0
@@ -290,6 +290,31 @@ unlock: }EXPORT_SYMBOL (udp_del_offload); +void udp_offload_get_port (struct net_device *dev) +{ +#if IS_ENABLED (CONFIG_VXLAN ) ||IS_ENABLED (CONFIG_GENEVE ) +struct udp_offload_priv __rcu **head = &udp_offload_base; +struct udp_offload_priv *uo_priv; +struct udp_offload *uo; + +rcu_read_lock (); + uo_priv =rcu_dereference (udp_offload_base); +for (; uo_priv !=NULL ; uo_priv =rcu_dereference (uo_priv->next)) { +/* call the right add port */ + uo = uo_priv->offload; +if (uo && dev->netdev_ops->ndo_add_udp_tunnel_port) + dev->netdev_ops->ndo_add_udp_tunnel_port (dev, + uo->family, + uo->port, + uo->tunnel_type); + + head = &uo_priv->next; + } +rcu_read_unlock (); +#endif +} +EXPORT_SYMBOL (udp_offload_get_port); +struct sk_buff **udp_gro_receive (struct sk_buff **head,struct sk_buff *skb,struct udphdr *uh) {
Signature · 1 line
1.8.1.4
PATCH v4 6/6 net: Add a generic udp_offload_get_port function
Quoted 10 lines · Anjali Singhai Jain
The new function
udp_offload_get_portreplacesvxlan_get_rx_port().
This is a generic function that will help replay all udp tunnel ports irrespective of tunnel type. This way when new udp tunnels get added this function need not change.Note: Drivers besides i40e are compile tested with this change.
v2: fix a compile issue with redefinition of the function.
Signed-off-by Anjali Singhai Jain <[email protected]>Signed-off-by Kiran Patil <[email protected]>
I don't think that the locking is safe in the patch. The original vxlan_get_rx_port() held vn->sock_lock while calling into drivers but the new udp_offload_get_port() doesn't hold anything except for RCU. i40e is protected because you introduced a new spinlock but I don't think the same thing hold true for other drivers, even if they are only handling VXLAN. There's no guarantee that they are in a safe context when they call this function vs. calls from adding new tunnel ports. Based on our previous conversation about RTNL, I think there are existing drivers that don't meet this so we would have to add new locks to every driver supporting this.
I believe that is really quite simple to just call ndo_add_udp_tunnel_port() from udp_add_offload() while udp_offload_lock() is held (and the opposite on delete). We could also hold this instead of RCU in udp_offload_get_port(). At that point, we wouldn't need any new locking in drivers so I think that this would be simplest and cleanest path forward.
net/ipv4/udp_offload.c unlock: · line 295
Quoted 10 lines
index f938616..30aa84c 100644
net/ipv4/udp_offload.c +3
-0@@ -290,6 +290,31 @@ unlock: }EXPORT_SYMBOL (udp_del_offload); +void udp_offload_get_port (struct net_device *dev) +{ +#if IS_ENABLED (CONFIG_VXLAN ) ||IS_ENABLED (CONFIG_GENEVE )
I think it is better to not check for VXLAN or Geneve here. This is generic code so it shouldn't make any assumptions about what protocols it is supporting.
PATCH v4 6/6 net: Add a generic udp_offload_get_port function
In reply to Anjali Singhai JainQuoted 10 lines · Anjali Singhai Jain
The new function
udp_offload_get_portreplacesvxlan_get_rx_port().
This is a generic function that will help replay all udp tunnel ports irrespective of tunnel type. This way when new udp tunnels get added this function need not change.Note: Drivers besides i40e are compile tested with this change.
v2: fix a compile issue with redefinition of the function.
Signed-off-by Anjali Singhai Jain <[email protected]>Signed-off-by Kiran Patil <[email protected]>
I don't think that the locking is safe in the patch. The original vxlan_get_rx_port() held vn->sock_lock while calling into drivers but the new udp_offload_get_port() doesn't hold anything except for RCU. i40e is protected because you introduced a new spinlock but I don't think the same thing hold true for other drivers, even if they are only handling VXLAN. There's no guarantee that they are in a safe context when they call this function vs. calls from adding new tunnel ports. Based on our previous conversation about RTNL, I think there are existing drivers that don't meet this so we would have to add new locks to every driver supporting this.
I believe that is really quite simple to just call ndo_add_udp_tunnel_port() from udp_add_offload() while udp_offload_lock() is held (and the opposite on delete). We could also hold this instead of RCU in udp_offload_get_port(). At that point, we wouldn't need any new locking in drivers so I think that this would be simplest and cleanest path forward.
net/ipv4/udp_offload.c unlock: · line 295
Quoted 10 lines
index f938616..30aa84c 100644
net/ipv4/udp_offload.c +3
-0@@ -290,6 +290,31 @@ unlock: }EXPORT_SYMBOL (udp_del_offload); +void udp_offload_get_port (struct net_device *dev) +{ +#if IS_ENABLED (CONFIG_VXLAN ) ||IS_ENABLED (CONFIG_GENEVE )
I think it is better to not check for VXLAN or Geneve here. This is generic code so it shouldn't make any assumptions about what protocols it is supporting.
Keller
PATCH v4 1/6 i40e: Remove CONFIG_I40E_VXLAN
In reply to Anjali Singhai JainHi Anjali,
Quoted 41 lines · Anjali Singhai Jain
If the kernel flag
CONFIG_VXLANis true orCONFIG_VXLAN_MODULEis true,
enable VXLAN offload in the driver.v2: Fix bisection error for this patch series.
Signed-off-by Kiran Patil <[email protected]>Signed-off-by Anjali Singhai Jain <[email protected]>---
?drivers/net/ethernet/intel/i40e/i40e.h??????|??2 -- ?drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++-------- ?2 files changed, 2 insertions(+), 10 deletions(-)drivers/net/ethernet/intel/i40e/i40e.h +0
-0@@ -282,11 +282,9 @@ struct i40e_pf { ? u32 fd_atr_cnt; ? u32 fd_tcp_rule;?
-#ifIS_ENABLED(CONFIG_VXLAN)
? __be16??vxlan_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
? u16pending_vxlan_bitmap;
?
-#endif
? enumi40e_interrupt_policyint_policy;
? u16rx_itr_default;
? u16tx_itr_default;drivers/net/ethernet/intel/i40e/i40e_main.c +0
-0@@ -6990,13 +6990,13 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf) ? i40e_flush(hw); ?}?
-#ifIS_ENABLED(CONFIG_VXLAN)
Quoted 8 lines
?/**
? *i40e_sync_vxlan_filters_subtask- Sync the VSI filter list with HW
? * @pf: board private structure
? **/
?static voidi40e_sync_vxlan_filters_subtask(struct i40e_pf *pf)?{
+#ifIS_ENABLED(CONFIG_VXLAN)
Direct use of CONFIG_VXLAN is not going to work. What happens in the case where CONFIG_VXLAN=m and CONFIG_I40E=y?
The kernel will load i40e as it loads itself at boot and vxlan module will not get included (because i40e isn't a module so it doesn't run depmod etc) and then it will run and try to call vxlan code and fail because of an unknown symbol since vxlan won't have been started yet.
This is the entire reason why CONFIG_XXX_VXLAN exists. The alternative is to use select VXLAN and force VXLAN on when we enable I40E.
That's the primary reason why we can't directly use CONFIG_VXLAN as a check in driver code.
Regards,
Jake
Quoted 57 lines
? struct
i40e_hw*hw =&pf->hw;
?i40e_statusret;
?__be16port;drivers/net/ethernet/intel/i40e/i40e_main.c +1
-0@@ -7030,9 +7030,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 towork_structcontaining our datadrivers/net/ethernet/intel/i40e/i40e_main.c +0
-2@@ -7057,9 +7057,7 @@ static void i40e_service_task(struct work_struct *work) ? i40e_watchdog_subtask(pf); ? i40e_fdir_reinit_subtask(pf); ? i40e_sync_filters_subtask(pf); -#if IS_ENABLED (CONFIG_VXLAN ) ? i40e_sync_vxlan_filters_subtask(pf); -#endif ? i40e_clean_adminq_subtask(pf);?
?i40e_service_event_complete(pf);drivers/net/ethernet/intel/i40e/i40e_main.c +0
-0@@ -8433,7 +8431,6 @@ static int i40e_set_features(struct net_device *netdev, ? return 0; ?}?
-#ifIS_ENABLED(CONFIG_VXLAN)
?/**
? *i40e_get_vxlan_port_idx- Lookup a possibly offloaded for Rx UDP port
? * @pf: board private structuredrivers/net/ethernet/intel/i40e/i40e_main.c +0
-0@@ -8528,7 +8525,6 @@ static void i40e_del_vxlan_port(struct net_device *netdev, ? } ?}?
-#endif
?static int i40e_get_phys_port_id(structnet_device*netdev,
? ?structnetdev_phys_item_id*ppid)
?{drivers/net/ethernet/intel/i40e/i40e_main.c +0
-2@@ -8753,10 +8749,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, -#if IS_ENABLED(CONFIG_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,
Singhai
PATCH v4 1/6 i40e: Remove CONFIG_I40E_VXLAN
Jake this patch doesn't change the use of CONFIG_VXLAN in our driver to guard against a potential issue that you pointed out. Our driver had already changed to using CONFIG_VXLAN in a previous patch.
But I believe that we will still be okay in the scenario that VXLAN module is not loaded because of two reasons
1) We check a flag in sync_vsi_filters if a filter was added or deleted before proceeding to do anything and that will return very quickly from the function when VXLAN or GENEVE module is not loaded.
2) udp_offload_get_port function has empty definitions in the base kernel that will always exist even when the module is not loaded.
Having said that, I am still going to make sure that it's not an issue with a previous patch for our driver. Although the shift to using udp_offload_get_port with this patch series will help alleviate that issue.
Anjali
Quoted 131 lines
-----Original Message-----
From: Keller, Jacob E
Sent: Tuesday, November 10, 2015 10:01 AM
To: intel-wired-lan at lists.osuosl.org; Singhai, Anjali
Subject: Re: [Intel-wired-lan] [PATCH v4 1/6] i40e: RemoveCONFIG_I40E_VXLANHi Anjali,
Quoted 40 lines · Anjali Singhai Jain
If the kernel flag
CONFIG_VXLANis true orCONFIG_VXLAN_MODULEis true, enable VXLAN offload in the driver.v2: Fix bisection error for this patch series.
Signed-off-by Kiran Patil <[email protected]>Signed-off-by Anjali Singhai Jain <[email protected]>---
?drivers/net/ethernet/intel/i40e/i40e.h??????|??2 -- ?drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++-------- ?2 files changed, 2 insertions(+), 10 deletions(-)drivers/net/ethernet/intel/i40e/i40e.h +0
-2@@ -282,11 +282,9 @@ struct i40e_pf { ? u32 fd_atr_cnt; ? u32 fd_tcp_rule; -#if IS_ENABLED (CONFIG_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;drivers/net/ethernet/intel/i40e/i40e_main.c +0
-1@@ -6990,13 +6990,13 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf) ? i40e_flush(hw); ?} -#if IS_ENABLED (CONFIG_VXLAN )Quoted 7 lines
?/**
? *i40e_sync_vxlan_filters_subtask- Sync the VSI filter list with HW ? * @pf: board private structure
? **/
?static voidi40e_sync_vxlan_filters_subtask(struct i40e_pf *pf)?{
+#ifIS_ENABLED(CONFIG_VXLAN)Direct use of
CONFIG_VXLANis not going to work. What happens in the case whereCONFIG_VXLAN=mandCONFIG_I40E=y?The kernel will load i40e as it loads itself at boot and vxlan module will not get included (because i40e isn't a module so it doesn't run depmod etc) and then it will run and try to call vxlan code and fail because of an unknown symbol since vxlan won't have been started yet.
This is the entire reason why
CONFIG_XXX_VXLANexists. The alternative is to use select VXLAN and force VXLAN on when we enable I40E.That's the primary reason why we can't directly use
CONFIG_VXLANas a check in driver code.Regards,
JakeQuoted 56 lines
? struct
i40e_hw*hw =&pf->hw;
?i40e_statusret;
?__be16port;drivers/net/ethernet/intel/i40e/i40e_main.c +1
-1@@ -7030,9 +7030,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 towork_structcontaining our data @@ -7057,9 +7057,7 @@ static voidi40e_service_task(struct work_struct *work)
?i40e_watchdog_subtask(pf);
?i40e_fdir_reinit_subtask(pf);
?i40e_sync_filters_subtask(pf);
-#ifIS_ENABLED(CONFIG_VXLAN)
?i40e_sync_vxlan_filters_subtask(pf);
-#endif
?i40e_clean_adminq_subtask(pf);?
i40e_service_event_complete(pf);drivers/net/ethernet/intel/i40e/i40e_main.c +0
-1@@ -8433,7 +8431,6 @@ static int i40e_set_features(struct net_device *netdev, ? return 0; ?} -#if IS_ENABLED (CONFIG_VXLAN )?/**
? *i40e_get_vxlan_port_idx- Lookup a possibly offloaded for Rx UDP port
? * @pf: board private structuredrivers/net/ethernet/intel/i40e/i40e_main.c +0
-1@@ -8528,7 +8525,6 @@ static void i40e_del_vxlan_port(structnet_device *netdev, ? } ?} -#endif ?static int i40e_get_phys_port_id(struct net_device *netdev, ? ?struct netdev_phys_item_id *ppid)?{
drivers/net/ethernet/intel/i40e/i40e_main.c +0
-2@@ -8753,10 +8749,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, -#if IS_ENABLED(CONFIG_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,
Keller
PATCH v4 1/6 i40e: Remove CONFIG_I40E_VXLAN
Ok. That should work, but a quick check would be helpful.
Regards,
Jake
Quoted 163 lines · Anjali
Jake this patch doesn't change the use of
CONFIG_VXLANin our driver to guard against a potential issue that you pointed out. Our driver had already changed to usingCONFIG_VXLANin a previous patch.But I believe that we will still be okay in the scenario that VXLAN module is not loaded because of two reasons
1) We check a flag insync_vsi_filtersif a filter was added or deleted before proceeding to do anything and that will return very quickly from the function when VXLAN or GENEVE module is not loaded.
2)udp_offload_get_portfunction has empty definitions in the base kernel that will always exist even when the module is not loaded.Having said that, I am still going to make sure that it's not an issue with a previous patch for our driver. Although the shift to using
udp_offload_get_portwith this patch series will help alleviate that issue.Anjali
Quoted 143 lines
-----Original Message-----
From: Keller, Jacob E
Sent: Tuesday, November 10, 2015 10:01 AM
To: intel-wired-lan at lists.osuosl.org; Singhai, Anjali
Subject: Re: [Intel-wired-lan] [PATCH v4 1/6] i40e: RemoveCONFIG_I40E_VXLANHi Anjali,
Quoted 40 lines · Anjali Singhai Jain
If the kernel flag
CONFIG_VXLANis true orCONFIG_VXLAN_MODULEis true, enable VXLAN offload in the driver.v2: Fix bisection error for this patch series.
Signed-off-by Kiran Patil <[email protected]>Signed-off-by Anjali Singhai Jain <[email protected]>---
?drivers/net/ethernet/intel/i40e/i40e.h??????|??2 -- ?drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++-------- ?2 files changed, 2 insertions(+), 10 deletions(-)drivers/net/ethernet/intel/i40e/i40e.h +0
-2@@ -282,11 +282,9 @@ struct i40e_pf { ? u32 fd_atr_cnt; ? u32 fd_tcp_rule; -#if IS_ENABLED (CONFIG_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;drivers/net/ethernet/intel/i40e/i40e_main.c +0
-1@@ -6990,13 +6990,13 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf) ? i40e_flush(hw); ?} -#if IS_ENABLED (CONFIG_VXLAN )Quoted 8 lines
?/**
? *i40e_sync_vxlan_filters_subtask- Sync the VSI filter list with HW
? * @pf: board private structure
? **/
?static voidi40e_sync_vxlan_filters_subtask(struct i40e_pf *pf)?{
+#ifIS_ENABLED(CONFIG_VXLAN)Direct use of
CONFIG_VXLANis not going to work. What happens in the case
whereCONFIG_VXLAN=mandCONFIG_I40E=y?The kernel will load i40e as it loads itself at boot and vxlan module will not get
included (because i40e isn't a module so it doesn't run depmod etc) and then
it will run and try to call vxlan code and fail because of an unknown symbol
since vxlan won't have been started yet.This is the entire reason why
CONFIG_XXX_VXLANexists. The alternative is
to use select VXLAN and force VXLAN on when we enable I40E.That's the primary reason why we can't directly use
CONFIG_VXLANas a
check in driver code.Regards,
JakeQuoted 61 lines
? struct
i40e_hw*hw =&pf->hw;
?i40e_statusret;
?__be16port;drivers/net/ethernet/intel/i40e/i40e_main.c +1
-1@@ -7030,9 +7030,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 towork_structcontaining our data @@ -7057,9 +7057,7 @@ static voidi40e_service_task(struct work_struct *work)
?i40e_watchdog_subtask(pf);
?i40e_fdir_reinit_subtask(pf);
?i40e_sync_filters_subtask(pf);
-#ifIS_ENABLED(CONFIG_VXLAN)
?i40e_sync_vxlan_filters_subtask(pf);
-#endif
?i40e_clean_adminq_subtask(pf);?
i40e_service_event_complete(pf);drivers/net/ethernet/intel/i40e/i40e_main.c +0
-0@@ -8433,7 +8431,6 @@ static int i40e_set_features(struct
net_device
*netdev,
? return 0;
?}-#if
IS_ENABLED(CONFIG_VXLAN)
?/**
? *i40e_get_vxlan_port_idx- Lookup a possibly offloaded for Rx UDP
port
? * @pf: board private structuredrivers/net/ethernet/intel/i40e/i40e_main.c +0
-1@@ -8528,7 +8525,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)
?{drivers/net/ethernet/intel/i40e/i40e_main.c +0
-0@@ -8753,10 +8749,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,
-#ifIS_ENABLED(CONFIG_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,
Singhai
PATCH v4 1/6 i40e: Remove CONFIG_I40E_VXLAN
Ok, So I did do a check. This series does fix the issue where we no more have to worry about whether VXLAN or GENEVE is a module and the driver is in-built since udp_offload_get_port will always be defined.. But we will have to actually drop the previous patch that changes the driver to start using CONFIG_VXLAN, and rebase this patch series.
I will go ahead and do that.
Anjali
Quoted 169 lines
-----Original Message-----
From: Keller, Jacob E
Sent: Tuesday, November 10, 2015 11:23 AM
To: intel-wired-lan at lists.osuosl.org; Singhai, Anjali
Subject: Re: [Intel-wired-lan] [PATCH v4 1/6] i40e: RemoveCONFIG_I40E_VXLANOk. That should work, but a quick check would be helpful.
Regards,
JakeQuoted 156 lines · Anjali
Jake this patch doesn't change the use of
CONFIG_VXLANin our driver to guard against a potential issue that you pointed out. Our driver had already changed to usingCONFIG_VXLANin a previous patch.But I believe that we will still be okay in the scenario that VXLAN module is not loaded because of two reasons
1) We check a flag insync_vsi_filtersif a filter was added or deleted before proceeding to do anything and that will return very quickly from the function when VXLAN or GENEVE module is not loaded.
2)udp_offload_get_portfunction has empty definitions in the base kernel that will always exist even when the module is not loaded.Having said that, I am still going to make sure that it's not an issue with a previous patch for our driver. Although the shift to using
udp_offload_get_portwith this patch series will help alleviate that issue.Anjali
Quoted 136 lines
-----Original Message-----
From: Keller, Jacob E
Sent: Tuesday, November 10, 2015 10:01 AM
To: intel-wired-lan at lists.osuosl.org; Singhai, Anjali
Subject: Re: [Intel-wired-lan] [PATCH v4 1/6] i40e: RemoveCONFIG_I40E_VXLANHi Anjali,
Quoted 40 lines · Anjali Singhai Jain
If the kernel flag
CONFIG_VXLANis true orCONFIG_VXLAN_MODULEis true, enable VXLAN offload in the driver.v2: Fix bisection error for this patch series.
Signed-off-by Kiran Patil <[email protected]>Signed-off-by Anjali Singhai Jain <[email protected]>---
?drivers/net/ethernet/intel/i40e/i40e.h??????|??2 -- ?drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++-------- ?2 files changed, 2 insertions(+), 10 deletions(-)drivers/net/ethernet/intel/i40e/i40e.h +0
-2@@ -282,11 +282,9 @@ struct i40e_pf { ? u32 fd_atr_cnt; ? u32 fd_tcp_rule; -#if IS_ENABLED (CONFIG_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;drivers/net/ethernet/intel/i40e/i40e_main.c +0
-1@@ -6990,13 +6990,13 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf) ? i40e_flush(hw); ?} -#if IS_ENABLED (CONFIG_VXLAN )Quoted 8 lines
?/**
? *i40e_sync_vxlan_filters_subtask- Sync the VSI filter list with HW
? * @pf: board private structure
? **/
?static voidi40e_sync_vxlan_filters_subtask(struct i40e_pf *pf)?{
+#ifIS_ENABLED(CONFIG_VXLAN)Direct use of
CONFIG_VXLANis not going to work. What happens in the case whereCONFIG_VXLAN=mandCONFIG_I40E=y?The kernel will load i40e as it loads itself at boot and vxlan module will not get included (because i40e isn't a module so it doesn't run depmod etc) and then it will run and try to call vxlan code and fail because of an unknown symbol since vxlan won't have been started yet.
This is the entire reason why
CONFIG_XXX_VXLANexists. The alternative is to use select VXLAN and force VXLAN on when we enable I40E.That's the primary reason why we can't directly use
CONFIG_VXLANas a check in driver code.Regards,
JakeQuoted 58 lines
? struct
i40e_hw*hw =&pf->hw;
?i40e_statusret;
?__be16port;drivers/net/ethernet/intel/i40e/i40e_main.c +1
-1@@ -7030,9 +7030,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 towork_structcontaining our data @@ -7057,9 +7057,7 @@ static voidi40e_service_task(struct work_struct *work)
?i40e_watchdog_subtask(pf);
?i40e_fdir_reinit_subtask(pf);
?i40e_sync_filters_subtask(pf);
-#ifIS_ENABLED(CONFIG_VXLAN)
?i40e_sync_vxlan_filters_subtask(pf);
-#endif
?i40e_clean_adminq_subtask(pf);?
i40e_service_event_complete(pf); @@ -8433,7 +8431,6 @@ static
int i40e_set_features(structnet_device*netdev,
? return 0;
?}-#if
IS_ENABLED(CONFIG_VXLAN)
?/**
? *i40e_get_vxlan_port_idx- Lookup a possibly offloaded for Rx UDP port
? * @pf: board private structuredrivers/net/ethernet/intel/i40e/i40e_main.c +0
-1@@ -8528,7 +8525,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)
?{drivers/net/ethernet/intel/i40e/i40e_main.c +0
-0@@ -8753,10 +8749,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,
-#ifIS_ENABLED(CONFIG_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,
Bowers
PATCH v4 1/6 i40e: Remove CONFIG_I40E_VXLAN
In reply to Anjali Singhai JainQuoted 10 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Anjali Singhai Jain
Sent: Tuesday, November 10, 2015 9:57 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v4 1/6] i40e: RemoveCONFIG_I40E_VXLANIf the kernel flag
CONFIG_VXLANis true orCONFIG_VXLAN_MODULEis true, enable VXLAN offload in the driver.
Quoted 8 lines
v2: Fix bisection error for this patch series.
Signed-off-by Kiran Patil <[email protected]>Signed-off-by Anjali Singhai Jain <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 2 -- drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++-------- 2 files changed, 2 insertions(+), 10 deletions(-)
Patch code changes altered by subesquent patch
Bowers
PATCH v4 1/6 i40e: Remove CONFIG_I40E_VXLAN
In reply to Anjali Singhai JainQuoted 10 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Anjali Singhai Jain
Sent: Tuesday, November 10, 2015 9:57 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v4 1/6] i40e: RemoveCONFIG_I40E_VXLANIf the kernel flag
CONFIG_VXLANis true orCONFIG_VXLAN_MODULEis true, enable VXLAN offload in the driver.
Quoted 8 lines
v2: Fix bisection error for this patch series.
Signed-off-by Kiran Patil <[email protected]>Signed-off-by Anjali Singhai Jain <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 2 -- drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++-------- 2 files changed, 2 insertions(+), 10 deletions(-)