diff options
author | Or Gerlitz <ogerlitz@mellanox.com> | 2014-04-01 04:27:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-04-01 16:25:51 -0400 |
commit | a66132f3eb514f42c49a3e8f57aab2ccd0360f06 (patch) | |
tree | 3ff54ad41d26def78043606175bb07b7a7631b59 /drivers/net/ethernet/mellanox | |
parent | c5abe7c0a44ac2e8147543203de48b4aa0d4eaec (diff) |
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: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/Kconfig | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 2 |
3 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/Kconfig b/drivers/net/ethernet/mellanox/mlx4/Kconfig index 1a6e1887a171..1486ce902a56 100644 --- a/drivers/net/ethernet/mellanox/mlx4/Kconfig +++ b/drivers/net/ethernet/mellanox/mlx4/Kconfig | |||
@@ -23,6 +23,13 @@ config MLX4_EN_DCB | |||
23 | 23 | ||
24 | If unsure, set to Y | 24 | If unsure, set to Y |
25 | 25 | ||
26 | config MLX4_EN_VXLAN | ||
27 | bool "VXLAN offloads Support" | ||
28 | default y | ||
29 | depends on MLX4_EN && VXLAN && !(MLX4_EN=y && VXLAN=m) | ||
30 | ---help--- | ||
31 | Say Y here if you want to use VXLAN offloads in the driver. | ||
32 | |||
26 | config MLX4_CORE | 33 | config MLX4_CORE |
27 | tristate | 34 | tristate |
28 | depends on PCI | 35 | depends on PCI |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 82d7eb5b79cc..f085c2df5e69 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -1698,8 +1698,10 @@ int mlx4_en_start_port(struct net_device *dev) | |||
1698 | 1698 | ||
1699 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | 1699 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); |
1700 | 1700 | ||
1701 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
1701 | if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) | 1702 | if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) |
1702 | vxlan_get_rx_port(dev); | 1703 | vxlan_get_rx_port(dev); |
1704 | #endif | ||
1703 | priv->port_up = true; | 1705 | priv->port_up = true; |
1704 | netif_tx_start_all_queues(dev); | 1706 | netif_tx_start_all_queues(dev); |
1705 | netif_device_attach(dev); | 1707 | netif_device_attach(dev); |
@@ -2267,6 +2269,7 @@ static int mlx4_en_get_phys_port_id(struct net_device *dev, | |||
2267 | return 0; | 2269 | return 0; |
2268 | } | 2270 | } |
2269 | 2271 | ||
2272 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
2270 | static void mlx4_en_add_vxlan_offloads(struct work_struct *work) | 2273 | static void mlx4_en_add_vxlan_offloads(struct work_struct *work) |
2271 | { | 2274 | { |
2272 | int ret; | 2275 | int ret; |
@@ -2341,6 +2344,7 @@ static void mlx4_en_del_vxlan_port(struct net_device *dev, | |||
2341 | 2344 | ||
2342 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); | 2345 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); |
2343 | } | 2346 | } |
2347 | #endif | ||
2344 | 2348 | ||
2345 | static const struct net_device_ops mlx4_netdev_ops = { | 2349 | static const struct net_device_ops mlx4_netdev_ops = { |
2346 | .ndo_open = mlx4_en_open, | 2350 | .ndo_open = mlx4_en_open, |
@@ -2368,8 +2372,10 @@ static const struct net_device_ops mlx4_netdev_ops = { | |||
2368 | .ndo_busy_poll = mlx4_en_low_latency_recv, | 2372 | .ndo_busy_poll = mlx4_en_low_latency_recv, |
2369 | #endif | 2373 | #endif |
2370 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, | 2374 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, |
2375 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
2371 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, | 2376 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, |
2372 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, | 2377 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, |
2378 | #endif | ||
2373 | }; | 2379 | }; |
2374 | 2380 | ||
2375 | static const struct net_device_ops mlx4_netdev_ops_master = { | 2381 | 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 | INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate); | 2467 | INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate); |
2462 | INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); | 2468 | INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); |
2463 | INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task); | 2469 | INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task); |
2470 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
2464 | INIT_WORK(&priv->vxlan_add_task, mlx4_en_add_vxlan_offloads); | 2471 | INIT_WORK(&priv->vxlan_add_task, mlx4_en_add_vxlan_offloads); |
2465 | INIT_WORK(&priv->vxlan_del_task, mlx4_en_del_vxlan_offloads); | 2472 | INIT_WORK(&priv->vxlan_del_task, mlx4_en_del_vxlan_offloads); |
2473 | #endif | ||
2466 | #ifdef CONFIG_MLX4_EN_DCB | 2474 | #ifdef CONFIG_MLX4_EN_DCB |
2467 | if (!mlx4_is_slave(priv->mdev->dev)) { | 2475 | if (!mlx4_is_slave(priv->mdev->dev)) { |
2468 | if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_SET_ETH_SCHED) { | 2476 | if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_SET_ETH_SCHED) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 36fc2a2b24c3..7a733c287744 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -559,8 +559,10 @@ struct mlx4_en_priv { | |||
559 | struct work_struct linkstate_task; | 559 | struct work_struct linkstate_task; |
560 | struct delayed_work stats_task; | 560 | struct delayed_work stats_task; |
561 | struct delayed_work service_task; | 561 | struct delayed_work service_task; |
562 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
562 | struct work_struct vxlan_add_task; | 563 | struct work_struct vxlan_add_task; |
563 | struct work_struct vxlan_del_task; | 564 | struct work_struct vxlan_del_task; |
565 | #endif | ||
564 | struct mlx4_en_perf_stats pstats; | 566 | struct mlx4_en_perf_stats pstats; |
565 | struct mlx4_en_pkt_stats pkstats; | 567 | struct mlx4_en_pkt_stats pkstats; |
566 | struct mlx4_en_port_stats port_stats; | 568 | struct mlx4_en_port_stats port_stats; |