Commit 7c509a48 authored by Hadar Hen Zion's avatar Hadar Hen Zion Committed by David S. Miller

net/mlx4_en: Prepare ethtool private flags to support more flags

Currently we support only one ethtool private flag. Prepare
mlx4_en_set_priv_flags function to support more than one private flag.
Will be used in the next patch to support hardware accelerated 802.1ad
vlan.
Signed-off-by: default avatarHadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: default avatarAmir Vadai <amirv@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 77fc29c4
...@@ -1801,30 +1801,29 @@ static int mlx4_en_set_priv_flags(struct net_device *dev, u32 flags) ...@@ -1801,30 +1801,29 @@ static int mlx4_en_set_priv_flags(struct net_device *dev, u32 flags)
bool bf_enabled_old = !!(priv->pflags & MLX4_EN_PRIV_FLAGS_BLUEFLAME); bool bf_enabled_old = !!(priv->pflags & MLX4_EN_PRIV_FLAGS_BLUEFLAME);
int i; int i;
if (bf_enabled_new == bf_enabled_old) if (bf_enabled_new != bf_enabled_old) {
return 0; /* Nothing to do */ if (bf_enabled_new) {
bool bf_supported = true;
if (bf_enabled_new) { for (i = 0; i < priv->tx_ring_num; i++)
bool bf_supported = true; bf_supported &= priv->tx_ring[i]->bf_alloced;
for (i = 0; i < priv->tx_ring_num; i++) if (!bf_supported) {
bf_supported &= priv->tx_ring[i]->bf_alloced; en_err(priv, "BlueFlame is not supported\n");
return -EINVAL;
}
if (!bf_supported) { priv->pflags |= MLX4_EN_PRIV_FLAGS_BLUEFLAME;
en_err(priv, "BlueFlame is not supported\n"); } else {
return -EINVAL; priv->pflags &= ~MLX4_EN_PRIV_FLAGS_BLUEFLAME;
} }
priv->pflags |= MLX4_EN_PRIV_FLAGS_BLUEFLAME; for (i = 0; i < priv->tx_ring_num; i++)
} else { priv->tx_ring[i]->bf_enabled = bf_enabled_new;
priv->pflags &= ~MLX4_EN_PRIV_FLAGS_BLUEFLAME;
}
for (i = 0; i < priv->tx_ring_num; i++)
priv->tx_ring[i]->bf_enabled = bf_enabled_new;
en_info(priv, "BlueFlame %s\n", en_info(priv, "BlueFlame %s\n",
bf_enabled_new ? "Enabled" : "Disabled"); bf_enabled_new ? "Enabled" : "Disabled");
}
return 0; return 0;
} }
......
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