net/mlx4_core: Move affinity hints to mlx4_core ownership
Now that EQs management is in the sole responsibility of mlx4_core, the IRQ affinity hints configuration should be in its hands as well. request_irq is called only once by the first consumer (maybe mlx4_ib), so mlx4_en passes the affinity mask too late. We also need to request vectors according to the cores we want to run on. mlx4_core distribution of IRQs to cores is straight forward, EQ(i)->IRQ will set affinity hint to core i. Consumers need to request EQ vectors, according to their cores considerations (NUMA). Signed-off-by: Ido Shamay <idos@mellanox.com> Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
c66fa19c40
commit
de1618034a
@@ -2481,6 +2481,36 @@ err_uar_table_free:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int mlx4_init_affinity_hint(struct mlx4_dev *dev, int port, int eqn)
|
||||
{
|
||||
int requested_cpu = 0;
|
||||
struct mlx4_priv *priv = mlx4_priv(dev);
|
||||
struct mlx4_eq *eq;
|
||||
int off = 0;
|
||||
int i;
|
||||
|
||||
if (eqn > dev->caps.num_comp_vectors)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 1; i < port; i++)
|
||||
off += mlx4_get_eqs_per_port(dev, i);
|
||||
|
||||
requested_cpu = eqn - off - !!(eqn > MLX4_EQ_ASYNC);
|
||||
|
||||
/* Meaning EQs are shared, and this call comes from the second port */
|
||||
if (requested_cpu < 0)
|
||||
return 0;
|
||||
|
||||
eq = &priv->eq_table.eq[eqn];
|
||||
|
||||
if (!zalloc_cpumask_var(&eq->affinity_mask, GFP_KERNEL))
|
||||
return -ENOMEM;
|
||||
|
||||
cpumask_set_cpu(requested_cpu, eq->affinity_mask);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mlx4_enable_msi_x(struct mlx4_dev *dev)
|
||||
{
|
||||
struct mlx4_priv *priv = mlx4_priv(dev);
|
||||
@@ -2525,9 +2555,15 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
|
||||
if (MLX4_IS_LEGACY_EQ_MODE(dev->caps)) {
|
||||
bitmap_fill(priv->eq_table.eq[i].actv_ports.ports,
|
||||
dev->caps.num_ports);
|
||||
/* We don't set affinity hint when there
|
||||
* aren't enough EQs
|
||||
*/
|
||||
} else {
|
||||
set_bit(port,
|
||||
priv->eq_table.eq[i].actv_ports.ports);
|
||||
if (mlx4_init_affinity_hint(dev, port + 1, i))
|
||||
mlx4_warn(dev, "Couldn't init hint cpumask for EQ %d\n",
|
||||
i);
|
||||
}
|
||||
/* We divide the Eqs evenly between the two ports.
|
||||
* (dev->caps.num_comp_vectors / dev->caps.num_ports)
|
||||
|
Reference in New Issue
Block a user