diff options
author | Benjamin Poirier <bpoirier@suse.de> | 2015-04-28 17:49:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-29 15:16:57 -0400 |
commit | 42eab005a5dd5d7ea2b0328aecc4d6cc0c23c9c2 (patch) | |
tree | 564af2328fd4eaa679cc6feb6a54ca016df37cde /drivers/net/ethernet | |
parent | 0d699f28ee5d0641470a603ab5904e463cb1532a (diff) |
mlx4: Fix tx ring affinity_mask creation
By default, the number of tx queues is limited by the number of online cpus
in mlx4_en_get_profile(). However, this limit no longer holds after the
ethtool .set_channels method has been called. In that situation, the driver
may access invalid bits of certain cpumask variables when queue_index >=
nr_cpu_ids.
Signed-off-by: Benjamin Poirier <bpoirier@suse.de>
Acked-by: Ido Shamay <idos@mellanox.com>
Fixes: d03a68f ("net/mlx4_en: Configure the XPS queue mapping on driver load")
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_tx.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 1783705273d8..f7bf312fb443 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
@@ -143,8 +143,10 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, | |||
143 | ring->hwtstamp_tx_type = priv->hwtstamp_config.tx_type; | 143 | ring->hwtstamp_tx_type = priv->hwtstamp_config.tx_type; |
144 | ring->queue_index = queue_index; | 144 | ring->queue_index = queue_index; |
145 | 145 | ||
146 | if (queue_index < priv->num_tx_rings_p_up && cpu_online(queue_index)) | 146 | if (queue_index < priv->num_tx_rings_p_up) |
147 | cpumask_set_cpu(queue_index, &ring->affinity_mask); | 147 | cpumask_set_cpu_local_first(queue_index, |
148 | priv->mdev->dev->numa_node, | ||
149 | &ring->affinity_mask); | ||
148 | 150 | ||
149 | *pring = ring; | 151 | *pring = ring; |
150 | return 0; | 152 | return 0; |
@@ -213,7 +215,7 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv, | |||
213 | 215 | ||
214 | err = mlx4_qp_to_ready(mdev->dev, &ring->wqres.mtt, &ring->context, | 216 | err = mlx4_qp_to_ready(mdev->dev, &ring->wqres.mtt, &ring->context, |
215 | &ring->qp, &ring->qp_state); | 217 | &ring->qp, &ring->qp_state); |
216 | if (!user_prio && cpu_online(ring->queue_index)) | 218 | if (!cpumask_empty(&ring->affinity_mask)) |
217 | netif_set_xps_queue(priv->dev, &ring->affinity_mask, | 219 | netif_set_xps_queue(priv->dev, &ring->affinity_mask, |
218 | ring->queue_index); | 220 | ring->queue_index); |
219 | 221 | ||