diff options
author | Gal Pressman <galp@mellanox.com> | 2016-03-01 17:13:38 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-01 17:28:00 -0500 |
commit | 2fcb92fbd04eef26dfe7e67839da6262d83d6b65 (patch) | |
tree | 61da65145f76083409cc5fe3af4a91289d8ec010 | |
parent | 7524a5d88b94afef8397a79f1e664af5b7052c22 (diff) |
net/mlx5e: Don't modify CQ before it was created
Calling mlx5e_set_coalesce while the interface is down will result in
modifying CQs that don't exist.
Fixes: f62b8bb8f2d3 ('net/mlx5: Extend mlx5_core to support ConnectX-4
Ethernet functionality')
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index a1b3bb4358b5..0959656404b3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | |||
@@ -423,11 +423,15 @@ static int mlx5e_set_coalesce(struct net_device *netdev, | |||
423 | if (!MLX5_CAP_GEN(mdev, cq_moderation)) | 423 | if (!MLX5_CAP_GEN(mdev, cq_moderation)) |
424 | return -ENOTSUPP; | 424 | return -ENOTSUPP; |
425 | 425 | ||
426 | mutex_lock(&priv->state_lock); | ||
426 | priv->params.tx_cq_moderation_usec = coal->tx_coalesce_usecs; | 427 | priv->params.tx_cq_moderation_usec = coal->tx_coalesce_usecs; |
427 | priv->params.tx_cq_moderation_pkts = coal->tx_max_coalesced_frames; | 428 | priv->params.tx_cq_moderation_pkts = coal->tx_max_coalesced_frames; |
428 | priv->params.rx_cq_moderation_usec = coal->rx_coalesce_usecs; | 429 | priv->params.rx_cq_moderation_usec = coal->rx_coalesce_usecs; |
429 | priv->params.rx_cq_moderation_pkts = coal->rx_max_coalesced_frames; | 430 | priv->params.rx_cq_moderation_pkts = coal->rx_max_coalesced_frames; |
430 | 431 | ||
432 | if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) | ||
433 | goto out; | ||
434 | |||
431 | for (i = 0; i < priv->params.num_channels; ++i) { | 435 | for (i = 0; i < priv->params.num_channels; ++i) { |
432 | c = priv->channel[i]; | 436 | c = priv->channel[i]; |
433 | 437 | ||
@@ -443,6 +447,8 @@ static int mlx5e_set_coalesce(struct net_device *netdev, | |||
443 | coal->rx_max_coalesced_frames); | 447 | coal->rx_max_coalesced_frames); |
444 | } | 448 | } |
445 | 449 | ||
450 | out: | ||
451 | mutex_unlock(&priv->state_lock); | ||
446 | return 0; | 452 | return 0; |
447 | } | 453 | } |
448 | 454 | ||