Commit 9ec7fa7c authored by Eugenia Emantayev's avatar Eugenia Emantayev Committed by Kamal Mostafa

net/mlx4_en: Avoid changing dev->features directly in run-time

[ Upstream commit 925ab1aa ]

It's forbidden to manually change dev->features in run-time. Currently, this is
done in the driver to make sure that GSO_UDP_TUNNEL is advertized only when
VXLAN tunnel is set. However, since the stack actually does features intersection
with hw_enc_features, we can safely revert to advertizing features early when
registering the netdevice.

Fixes: f4a1edd5 ('net/mlx4_en: Advertize encapsulation offloads [...]')
Signed-off-by: default avatarEugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 71163348
...@@ -2299,8 +2299,6 @@ static void mlx4_en_add_vxlan_offloads(struct work_struct *work) ...@@ -2299,8 +2299,6 @@ static void mlx4_en_add_vxlan_offloads(struct work_struct *work)
/* set offloads */ /* set offloads */
priv->dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM | priv->dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL; NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL;
priv->dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
priv->dev->features |= NETIF_F_GSO_UDP_TUNNEL;
} }
static void mlx4_en_del_vxlan_offloads(struct work_struct *work) static void mlx4_en_del_vxlan_offloads(struct work_struct *work)
...@@ -2311,8 +2309,6 @@ static void mlx4_en_del_vxlan_offloads(struct work_struct *work) ...@@ -2311,8 +2309,6 @@ static void mlx4_en_del_vxlan_offloads(struct work_struct *work)
/* unset offloads */ /* unset offloads */
priv->dev->hw_enc_features &= ~(NETIF_F_IP_CSUM | NETIF_F_RXCSUM | priv->dev->hw_enc_features &= ~(NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL); NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL);
priv->dev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL;
priv->dev->features &= ~NETIF_F_GSO_UDP_TUNNEL;
ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port,
VXLAN_STEER_BY_OUTER_MAC, 0); VXLAN_STEER_BY_OUTER_MAC, 0);
...@@ -2622,6 +2618,11 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, ...@@ -2622,6 +2618,11 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
priv->rss_hash_fn = ETH_RSS_HASH_TOP; priv->rss_hash_fn = ETH_RSS_HASH_TOP;
} }
if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
dev->features |= NETIF_F_GSO_UDP_TUNNEL;
}
mdev->pndev[port] = dev; mdev->pndev[port] = dev;
netif_carrier_off(dev); netif_carrier_off(dev);
......
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