mlx4_en: fix allocation of CPU affinity reverse-map
Subsystems (4)
PATCH 1/1 mlx4_en: fix allocation of CPU affinity reverse-map
The mlx4_en driver allocates the number of objects for the CPU affinity reverse-map based on the number of rx rings of the device. However, mlx4_assign_eq() calls irq_cpu_rmap_add() as many times as IRQ's are assigned to EQ's, which can be as large as mlx4_dev->caps.comp_pool. If caps.comp_pool is larger than rx_ring_num we will eventually hit the BUG_ON() in cpu_rmap_add().
Fix this problem by allocating space for the maximum number of CPU affinity reverse-map objects we might want to add.
--- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -1
@@ -1829,7 +1829,7 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) }#ifdef CONFIG_RFS_ACCEL - priv->dev->rx_cpu_rmap =alloc_irq_cpu_rmap (priv->rx_ring_num); + priv->dev->rx_cpu_rmap =alloc_irq_cpu_rmap (priv->mdev->dev->caps.comp_pool);if (!priv->dev->rx_cpu_rmap) goto err;#endif
Signature · 1 line
1.7.1
Quoted 21 lines · Kleber Sacilotto de Souza
The
mlx4_endriver allocates the number of objects for the CPU affinity reverse-map based on the number of rx rings of the device. However,mlx4_assign_eq()callsirq_cpu_rmap_add()as many times as IRQ's are assigned to EQ's, which can be as large asmlx4_dev->caps.comp_pool. If caps.comp_pool is larger thanrx_ring_numwe will eventually hit theBUG_ON()incpu_rmap_add().Fix this problem by allocating space for the maximum number of CPU affinity reverse-map objects we might want to add.
Signed-off-by Kleber Sacilotto de Souza <[email protected]>--- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/net/ethernet/mellanox/mlx4/en_netdev.c +0
-0
drivers/net/ethernet/mellanox/mlx4/en_netdev.c int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) · line 1835
Quoted 8 lines
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1
-1@@ -1829,7 +1829,7 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) }#ifdef CONFIG_RFS_ACCEL - priv->dev->rx_cpu_rmap =alloc_irq_cpu_rmap (priv->rx_ring_num); + priv->dev->rx_cpu_rmap =alloc_irq_cpu_rmap (priv->mdev->dev->caps.comp_pool);if (!priv->dev->rx_cpu_rmap) goto err;#endif
From: Kleber Sacilotto de Souza <[email protected]>
Date: Sat, 23 Feb 2013 02:14:52 -0300
Quoted 11 lines
The
mlx4_endriver allocates the number of objects for the CPU affinity reverse-map based on the number of rx rings of the device. However,mlx4_assign_eq()callsirq_cpu_rmap_add()as many times as IRQ's are assigned to EQ's, which can be as large asmlx4_dev->caps.comp_pool. If caps.comp_pool is larger thanrx_ring_numwe will eventually hit theBUG_ON()incpu_rmap_add().Fix this problem by allocating space for the maximum number of CPU affinity reverse-map objects we might want to add.
Signed-off-by Kleber Sacilotto de Souza <[email protected]>
Applied.