Skip to content

Commit 5fc111a

Browse files
author
Maxim Levitsky
committed
net: mana: Allow irq_setup() to skip cpus for affinity
JIRA: https://issues.redhat.com/browse/RHEL-109583 commit 845c62c Author: Shradha Gupta <shradhagupta@linux.microsoft.com> Date: Wed Jun 11 07:10:42 2025 -0700 net: mana: Allow irq_setup() to skip cpus for affinity In order to prepare the MANA driver to allocate the MSI-X IRQs dynamically, we need to enhance irq_setup() to allow skipping affinitizing IRQs to the first CPU sibling group. This would be for cases when the number of IRQs is less than or equal to the number of online CPUs. In such cases for dynamically added IRQs the first CPU sibling group would already be affinitized with HWC IRQ. Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Reviewed-by: Yury Norov [NVIDIA] <yury.norov@gmail.com> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
1 parent 7ad8135 commit 5fc111a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/net/ethernet/microsoft/mana/gdma_main.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,8 @@ void mana_gd_free_res_map(struct gdma_resource *r)
14091409
* do the same thing.
14101410
*/
14111411

1412-
static int irq_setup(unsigned int *irqs, unsigned int len, int node)
1412+
static int irq_setup(unsigned int *irqs, unsigned int len, int node,
1413+
bool skip_first_cpu)
14131414
{
14141415
const struct cpumask *next, *prev = cpu_none_mask;
14151416
cpumask_var_t cpus __free(free_cpumask_var);
@@ -1424,11 +1425,18 @@ static int irq_setup(unsigned int *irqs, unsigned int len, int node)
14241425
while (weight > 0) {
14251426
cpumask_andnot(cpus, next, prev);
14261427
for_each_cpu(cpu, cpus) {
1428+
cpumask_andnot(cpus, cpus, topology_sibling_cpumask(cpu));
1429+
--weight;
1430+
1431+
if (unlikely(skip_first_cpu)) {
1432+
skip_first_cpu = false;
1433+
continue;
1434+
}
1435+
14271436
if (len-- == 0)
14281437
goto done;
1438+
14291439
irq_set_affinity_and_hint(*irqs++, topology_sibling_cpumask(cpu));
1430-
cpumask_andnot(cpus, cpus, topology_sibling_cpumask(cpu));
1431-
--weight;
14321440
}
14331441
}
14341442
prev = next;
@@ -1524,7 +1532,7 @@ static int mana_gd_setup_irqs(struct pci_dev *pdev)
15241532
}
15251533
}
15261534

1527-
err = irq_setup(irqs, (nvec - start_irq_index), gc->numa_node);
1535+
err = irq_setup(irqs, nvec - start_irq_index, gc->numa_node, false);
15281536
if (err)
15291537
goto free_irq;
15301538

0 commit comments

Comments
 (0)