diff options
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_netdev.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index f3032fec8fce..4d69e382b4e5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -1693,7 +1693,7 @@ int mlx4_en_start_port(struct net_device *dev) | |||
1693 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | 1693 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); |
1694 | 1694 | ||
1695 | #ifdef CONFIG_MLX4_EN_VXLAN | 1695 | #ifdef CONFIG_MLX4_EN_VXLAN |
1696 | if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) | 1696 | if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
1697 | vxlan_get_rx_port(dev); | 1697 | vxlan_get_rx_port(dev); |
1698 | #endif | 1698 | #endif |
1699 | priv->port_up = true; | 1699 | priv->port_up = true; |
@@ -2281,8 +2281,16 @@ static void mlx4_en_add_vxlan_offloads(struct work_struct *work) | |||
2281 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, | 2281 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, |
2282 | VXLAN_STEER_BY_OUTER_MAC, 1); | 2282 | VXLAN_STEER_BY_OUTER_MAC, 1); |
2283 | out: | 2283 | out: |
2284 | if (ret) | 2284 | if (ret) { |
2285 | en_err(priv, "failed setting L2 tunnel configuration ret %d\n", ret); | 2285 | en_err(priv, "failed setting L2 tunnel configuration ret %d\n", ret); |
2286 | return; | ||
2287 | } | ||
2288 | |||
2289 | /* set offloads */ | ||
2290 | priv->dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM | | ||
2291 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL; | ||
2292 | priv->dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2293 | priv->dev->features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2286 | } | 2294 | } |
2287 | 2295 | ||
2288 | static void mlx4_en_del_vxlan_offloads(struct work_struct *work) | 2296 | static void mlx4_en_del_vxlan_offloads(struct work_struct *work) |
@@ -2290,6 +2298,11 @@ static void mlx4_en_del_vxlan_offloads(struct work_struct *work) | |||
2290 | int ret; | 2298 | int ret; |
2291 | struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, | 2299 | struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, |
2292 | vxlan_del_task); | 2300 | vxlan_del_task); |
2301 | /* unset offloads */ | ||
2302 | priv->dev->hw_enc_features &= ~(NETIF_F_IP_CSUM | NETIF_F_RXCSUM | | ||
2303 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL); | ||
2304 | priv->dev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL; | ||
2305 | priv->dev->features &= ~NETIF_F_GSO_UDP_TUNNEL; | ||
2293 | 2306 | ||
2294 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, | 2307 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, |
2295 | VXLAN_STEER_BY_OUTER_MAC, 0); | 2308 | VXLAN_STEER_BY_OUTER_MAC, 0); |
@@ -2342,6 +2355,11 @@ static void mlx4_en_del_vxlan_port(struct net_device *dev, | |||
2342 | 2355 | ||
2343 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); | 2356 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); |
2344 | } | 2357 | } |
2358 | |||
2359 | static bool mlx4_en_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
2360 | { | ||
2361 | return vxlan_gso_check(skb); | ||
2362 | } | ||
2345 | #endif | 2363 | #endif |
2346 | 2364 | ||
2347 | static const struct net_device_ops mlx4_netdev_ops = { | 2365 | static const struct net_device_ops mlx4_netdev_ops = { |
@@ -2373,6 +2391,7 @@ static const struct net_device_ops mlx4_netdev_ops = { | |||
2373 | #ifdef CONFIG_MLX4_EN_VXLAN | 2391 | #ifdef CONFIG_MLX4_EN_VXLAN |
2374 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, | 2392 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, |
2375 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, | 2393 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, |
2394 | .ndo_gso_check = mlx4_en_gso_check, | ||
2376 | #endif | 2395 | #endif |
2377 | }; | 2396 | }; |
2378 | 2397 | ||
@@ -2403,6 +2422,11 @@ static const struct net_device_ops mlx4_netdev_ops_master = { | |||
2403 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, | 2422 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, |
2404 | #endif | 2423 | #endif |
2405 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, | 2424 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, |
2425 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
2426 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, | ||
2427 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, | ||
2428 | .ndo_gso_check = mlx4_en_gso_check, | ||
2429 | #endif | ||
2406 | }; | 2430 | }; |
2407 | 2431 | ||
2408 | int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | 2432 | int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, |
@@ -2568,13 +2592,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2568 | if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0) | 2592 | if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0) |
2569 | dev->priv_flags |= IFF_UNICAST_FLT; | 2593 | dev->priv_flags |= IFF_UNICAST_FLT; |
2570 | 2594 | ||
2571 | if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { | ||
2572 | dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM | | ||
2573 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL; | ||
2574 | dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2575 | dev->features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2576 | } | ||
2577 | |||
2578 | mdev->pndev[port] = dev; | 2595 | mdev->pndev[port] = dev; |
2579 | 2596 | ||
2580 | netif_carrier_off(dev); | 2597 | netif_carrier_off(dev); |