]> git.karo-electronics.de Git - linux-beck.git/commitdiff
net/mlx4_en: Change loopback only upon feature change
authorIdo Shamay <idos@mellanox.com>
Thu, 2 Apr 2015 13:31:07 +0000 (16:31 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Apr 2015 20:24:51 +0000 (16:24 -0400)
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>
drivers/net/ethernet/mellanox/mlx4/en_main.c
drivers/net/ethernet/mellanox/mlx4/en_netdev.c

index 58d5a07d0ff4da6397118fb4b3b051ac936ed95b..913b716ed2e141189a978af29ab5d54c1b606387 100644 (file)
@@ -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);
 
index 51b20663c2a6182f9c1a6ce7da2731e08a339ff2..d73ab1ba5a7845029abafbae15260a4e6b0477af 100644 (file)
@@ -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;