Commit a66132f3 authored by Or Gerlitz's avatar Or Gerlitz Committed by David S. Miller

net/mlx4: Set proper build dependancy with vxlan

Make sure that vxlan_get_rx_port() is present in the kernel build in a manner
consistent with mlx4, else mlx4 can be made built-in where vxlan a module and
the phase of the build linking fails. Add CONFIG_MLX4_EN_VXLAN for that.

Also, #ifdef the advertizement and implementation of the mlx4 vxlan ndo
calls and related code under this config directive.
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c5abe7c0
...@@ -23,6 +23,13 @@ config MLX4_EN_DCB ...@@ -23,6 +23,13 @@ config MLX4_EN_DCB
If unsure, set to Y If unsure, set to Y
config MLX4_EN_VXLAN
bool "VXLAN offloads Support"
default y
depends on MLX4_EN && VXLAN && !(MLX4_EN=y && VXLAN=m)
---help---
Say Y here if you want to use VXLAN offloads in the driver.
config MLX4_CORE config MLX4_CORE
tristate tristate
depends on PCI depends on PCI
......
...@@ -1698,8 +1698,10 @@ int mlx4_en_start_port(struct net_device *dev) ...@@ -1698,8 +1698,10 @@ int mlx4_en_start_port(struct net_device *dev)
mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap);
#ifdef CONFIG_MLX4_EN_VXLAN
if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS)
vxlan_get_rx_port(dev); vxlan_get_rx_port(dev);
#endif
priv->port_up = true; priv->port_up = true;
netif_tx_start_all_queues(dev); netif_tx_start_all_queues(dev);
netif_device_attach(dev); netif_device_attach(dev);
...@@ -2267,6 +2269,7 @@ static int mlx4_en_get_phys_port_id(struct net_device *dev, ...@@ -2267,6 +2269,7 @@ static int mlx4_en_get_phys_port_id(struct net_device *dev,
return 0; return 0;
} }
#ifdef CONFIG_MLX4_EN_VXLAN
static void mlx4_en_add_vxlan_offloads(struct work_struct *work) static void mlx4_en_add_vxlan_offloads(struct work_struct *work)
{ {
int ret; int ret;
...@@ -2341,6 +2344,7 @@ static void mlx4_en_del_vxlan_port(struct net_device *dev, ...@@ -2341,6 +2344,7 @@ static void mlx4_en_del_vxlan_port(struct net_device *dev,
queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); queue_work(priv->mdev->workqueue, &priv->vxlan_del_task);
} }
#endif
static const struct net_device_ops mlx4_netdev_ops = { static const struct net_device_ops mlx4_netdev_ops = {
.ndo_open = mlx4_en_open, .ndo_open = mlx4_en_open,
...@@ -2368,8 +2372,10 @@ static const struct net_device_ops mlx4_netdev_ops = { ...@@ -2368,8 +2372,10 @@ static const struct net_device_ops mlx4_netdev_ops = {
.ndo_busy_poll = mlx4_en_low_latency_recv, .ndo_busy_poll = mlx4_en_low_latency_recv,
#endif #endif
.ndo_get_phys_port_id = mlx4_en_get_phys_port_id, .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_add_vxlan_port = mlx4_en_add_vxlan_port,
.ndo_del_vxlan_port = mlx4_en_del_vxlan_port, .ndo_del_vxlan_port = mlx4_en_del_vxlan_port,
#endif
}; };
static const struct net_device_ops mlx4_netdev_ops_master = { static const struct net_device_ops mlx4_netdev_ops_master = {
...@@ -2461,8 +2467,10 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, ...@@ -2461,8 +2467,10 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate); INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate);
INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats);
INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task); INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task);
#ifdef CONFIG_MLX4_EN_VXLAN
INIT_WORK(&priv->vxlan_add_task, mlx4_en_add_vxlan_offloads); INIT_WORK(&priv->vxlan_add_task, mlx4_en_add_vxlan_offloads);
INIT_WORK(&priv->vxlan_del_task, mlx4_en_del_vxlan_offloads); INIT_WORK(&priv->vxlan_del_task, mlx4_en_del_vxlan_offloads);
#endif
#ifdef CONFIG_MLX4_EN_DCB #ifdef CONFIG_MLX4_EN_DCB
if (!mlx4_is_slave(priv->mdev->dev)) { if (!mlx4_is_slave(priv->mdev->dev)) {
if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_SET_ETH_SCHED) { if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_SET_ETH_SCHED) {
......
...@@ -559,8 +559,10 @@ struct mlx4_en_priv { ...@@ -559,8 +559,10 @@ struct mlx4_en_priv {
struct work_struct linkstate_task; struct work_struct linkstate_task;
struct delayed_work stats_task; struct delayed_work stats_task;
struct delayed_work service_task; struct delayed_work service_task;
#ifdef CONFIG_MLX4_EN_VXLAN
struct work_struct vxlan_add_task; struct work_struct vxlan_add_task;
struct work_struct vxlan_del_task; struct work_struct vxlan_del_task;
#endif
struct mlx4_en_perf_stats pstats; struct mlx4_en_perf_stats pstats;
struct mlx4_en_pkt_stats pkstats; struct mlx4_en_pkt_stats pkstats;
struct mlx4_en_port_stats port_stats; struct mlx4_en_port_stats port_stats;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment