net/mlx4_en: Change loopback only upon feature change
Currently any change of netdev features results in a call to mlx4_en_update_loopback_state(). Those calls are unnecessary, and should be called only upon loopback feature change. Also moved some of the logic into mlx4_en_update_loopback_state(). Signed-off-by: Ido Shamay <idos@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
802f42a8d9
commit
241a08c3a7
@ -103,6 +103,11 @@ void mlx4_en_update_loopback_state(struct net_device *dev,
|
||||
{
|
||||
struct mlx4_en_priv *priv = netdev_priv(dev);
|
||||
|
||||
if (features & NETIF_F_LOOPBACK)
|
||||
priv->ctrl_flags |= cpu_to_be32(MLX4_WQE_CTRL_FORCE_LOOPBACK);
|
||||
else
|
||||
priv->ctrl_flags &= cpu_to_be32(~MLX4_WQE_CTRL_FORCE_LOOPBACK);
|
||||
|
||||
priv->flags &= ~(MLX4_EN_FLAG_RX_FILTER_NEEDED|
|
||||
MLX4_EN_FLAG_ENABLE_HW_LOOPBACK);
|
||||
|
||||
|
@ -2210,13 +2210,11 @@ static int mlx4_en_set_features(struct net_device *netdev,
|
||||
en_info(priv, "Turn %s TX vlan strip offload\n",
|
||||
(features & NETIF_F_HW_VLAN_CTAG_TX) ? "ON" : "OFF");
|
||||
|
||||
if (features & NETIF_F_LOOPBACK)
|
||||
priv->ctrl_flags |= cpu_to_be32(MLX4_WQE_CTRL_FORCE_LOOPBACK);
|
||||
else
|
||||
priv->ctrl_flags &=
|
||||
cpu_to_be32(~MLX4_WQE_CTRL_FORCE_LOOPBACK);
|
||||
|
||||
mlx4_en_update_loopback_state(netdev, features);
|
||||
if (DEV_FEATURE_CHANGED(netdev, features, NETIF_F_LOOPBACK)) {
|
||||
en_info(priv, "Turn %s loopback\n",
|
||||
(features & NETIF_F_LOOPBACK) ? "ON" : "OFF");
|
||||
mlx4_en_update_loopback_state(netdev, features);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user