diff options
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/Makefile | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/vxlan.h | 11 |
5 files changed, 24 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig index 1cf722eba607..f5c3b9465d8d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig +++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig | |||
@@ -31,3 +31,10 @@ config MLX5_CORE_EN_DCB | |||
31 | This flag is depended on the kernel's DCB support. | 31 | This flag is depended on the kernel's DCB support. |
32 | 32 | ||
33 | If unsure, set to Y | 33 | If unsure, set to Y |
34 | |||
35 | config MLX5_CORE_EN_VXLAN | ||
36 | bool "VXLAN offloads Support" | ||
37 | default y | ||
38 | depends on MLX5_CORE_EN && VXLAN && !(MLX5_CORE=y && VXLAN=m) | ||
39 | ---help--- | ||
40 | Say Y here if you want to use VXLAN offloads in the driver. | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Makefile b/drivers/net/ethernet/mellanox/mlx5/core/Makefile index 4fc45ee0c5d1..bf65b71c7360 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/Makefile +++ b/drivers/net/ethernet/mellanox/mlx5/core/Makefile | |||
@@ -6,6 +6,7 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \ | |||
6 | 6 | ||
7 | mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o eswitch.o \ | 7 | mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o eswitch.o \ |
8 | en_main.o en_fs.o en_ethtool.o en_tx.o en_rx.o \ | 8 | en_main.o en_fs.o en_ethtool.o en_tx.o en_rx.o \ |
9 | en_txrx.o en_clock.o vxlan.o en_tc.o | 9 | en_txrx.o en_clock.o en_tc.o |
10 | 10 | ||
11 | mlx5_core-$(CONFIG_MLX5_CORE_EN_VXLAN) += vxlan.o | ||
11 | mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) += en_dcbnl.o | 12 | mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) += en_dcbnl.o |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 3881dce0cc30..24344aafbd36 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h | |||
@@ -564,7 +564,9 @@ struct mlx5e_priv { | |||
564 | struct mlx5e_flow_tables fts; | 564 | struct mlx5e_flow_tables fts; |
565 | struct mlx5e_eth_addr_db eth_addr; | 565 | struct mlx5e_eth_addr_db eth_addr; |
566 | struct mlx5e_vlan_db vlan; | 566 | struct mlx5e_vlan_db vlan; |
567 | #ifdef CONFIG_MLX5_CORE_EN_VXLAN | ||
567 | struct mlx5e_vxlan_db vxlan; | 568 | struct mlx5e_vxlan_db vxlan; |
569 | #endif | ||
568 | 570 | ||
569 | struct mlx5e_params params; | 571 | struct mlx5e_params params; |
570 | struct workqueue_struct *wq; | 572 | struct workqueue_struct *wq; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index d4dfc5ce516a..94fef705890b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
@@ -2149,6 +2149,7 @@ static int mlx5e_get_vf_stats(struct net_device *dev, | |||
2149 | vf_stats); | 2149 | vf_stats); |
2150 | } | 2150 | } |
2151 | 2151 | ||
2152 | #if IS_ENABLED(CONFIG_MLX5_CORE_EN_VXLAN) | ||
2152 | static void mlx5e_add_vxlan_port(struct net_device *netdev, | 2153 | static void mlx5e_add_vxlan_port(struct net_device *netdev, |
2153 | sa_family_t sa_family, __be16 port) | 2154 | sa_family_t sa_family, __be16 port) |
2154 | { | 2155 | { |
@@ -2220,6 +2221,7 @@ static netdev_features_t mlx5e_features_check(struct sk_buff *skb, | |||
2220 | 2221 | ||
2221 | return features; | 2222 | return features; |
2222 | } | 2223 | } |
2224 | #endif | ||
2223 | 2225 | ||
2224 | static const struct net_device_ops mlx5e_netdev_ops_basic = { | 2226 | static const struct net_device_ops mlx5e_netdev_ops_basic = { |
2225 | .ndo_open = mlx5e_open, | 2227 | .ndo_open = mlx5e_open, |
@@ -2251,9 +2253,11 @@ static const struct net_device_ops mlx5e_netdev_ops_sriov = { | |||
2251 | .ndo_set_features = mlx5e_set_features, | 2253 | .ndo_set_features = mlx5e_set_features, |
2252 | .ndo_change_mtu = mlx5e_change_mtu, | 2254 | .ndo_change_mtu = mlx5e_change_mtu, |
2253 | .ndo_do_ioctl = mlx5e_ioctl, | 2255 | .ndo_do_ioctl = mlx5e_ioctl, |
2256 | #ifdef CONFIG_MLX5_CORE_EN_VXLAN | ||
2254 | .ndo_add_vxlan_port = mlx5e_add_vxlan_port, | 2257 | .ndo_add_vxlan_port = mlx5e_add_vxlan_port, |
2255 | .ndo_del_vxlan_port = mlx5e_del_vxlan_port, | 2258 | .ndo_del_vxlan_port = mlx5e_del_vxlan_port, |
2256 | .ndo_features_check = mlx5e_features_check, | 2259 | .ndo_features_check = mlx5e_features_check, |
2260 | #endif | ||
2257 | .ndo_set_vf_mac = mlx5e_set_vf_mac, | 2261 | .ndo_set_vf_mac = mlx5e_set_vf_mac, |
2258 | .ndo_set_vf_vlan = mlx5e_set_vf_vlan, | 2262 | .ndo_set_vf_vlan = mlx5e_set_vf_vlan, |
2259 | .ndo_get_vf_config = mlx5e_get_vf_config, | 2263 | .ndo_get_vf_config = mlx5e_get_vf_config, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h index 129f3527aa14..217ac530a514 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/vxlan.h | |||
@@ -48,14 +48,21 @@ struct mlx5e_vxlan_work { | |||
48 | 48 | ||
49 | static inline bool mlx5e_vxlan_allowed(struct mlx5_core_dev *mdev) | 49 | static inline bool mlx5e_vxlan_allowed(struct mlx5_core_dev *mdev) |
50 | { | 50 | { |
51 | return (MLX5_CAP_ETH(mdev, tunnel_stateless_vxlan) && | 51 | return IS_ENABLED(CONFIG_MLX5_CORE_EN_VXLAN) && |
52 | (MLX5_CAP_ETH(mdev, tunnel_stateless_vxlan) && | ||
52 | mlx5_core_is_pf(mdev)); | 53 | mlx5_core_is_pf(mdev)); |
53 | } | 54 | } |
54 | 55 | ||
56 | #ifdef CONFIG_MLX5_CORE_EN_VXLAN | ||
55 | void mlx5e_vxlan_init(struct mlx5e_priv *priv); | 57 | void mlx5e_vxlan_init(struct mlx5e_priv *priv); |
58 | void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv); | ||
59 | #else | ||
60 | static inline void mlx5e_vxlan_init(struct mlx5e_priv *priv) {} | ||
61 | static inline void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv) {} | ||
62 | #endif | ||
63 | |||
56 | void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, sa_family_t sa_family, | 64 | void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, sa_family_t sa_family, |
57 | u16 port, int add); | 65 | u16 port, int add); |
58 | struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port); | 66 | struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port); |
59 | void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv); | ||
60 | 67 | ||
61 | #endif /* __MLX5_VXLAN_H__ */ | 68 | #endif /* __MLX5_VXLAN_H__ */ |