]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mlx4_en: fix allocation of CPU affinity reverse-map
authorKleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Fri, 22 Feb 2013 19:14:52 +0000 (19:14 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 23 Feb 2013 18:51:54 +0000 (13:51 -0500)
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.

Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Acked-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_netdev.c

index 5944dd60b9e36bf05fb034b3afeecdd5e3960229..5385474bb526cbb2fe5a090ee31f6120b858e5d2 100644 (file)
@@ -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