Skip to content

Commit f67ffb7

Browse files
author
Maxim Levitsky
committed
net: mana: Allow irq_setup() to skip cpus for affinity
JIRA: https://issues.redhat.com/browse/RHEL-109580 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 08657a4 commit f67ffb7

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
@@ -1408,7 +1408,8 @@ void mana_gd_free_res_map(struct gdma_resource *r)
14081408
* do the same thing.
14091409
*/
14101410

1411-
static int irq_setup(unsigned int *irqs, unsigned int len, int node)
1411+
static int irq_setup(unsigned int *irqs, unsigned int len, int node,
1412+
bool skip_first_cpu)
14121413
{
14131414
const struct cpumask *next, *prev = cpu_none_mask;
14141415
cpumask_var_t cpus __free(free_cpumask_var);
@@ -1423,11 +1424,18 @@ static int irq_setup(unsigned int *irqs, unsigned int len, int node)
14231424
while (weight > 0) {
14241425
cpumask_andnot(cpus, next, prev);
14251426
for_each_cpu(cpu, cpus) {
1427+
cpumask_andnot(cpus, cpus, topology_sibling_cpumask(cpu));
1428+
--weight;
1429+
1430+
if (unlikely(skip_first_cpu)) {
1431+
skip_first_cpu = false;
1432+
continue;
1433+
}
1434+
14261435
if (len-- == 0)
14271436
goto done;
1437+
14281438
irq_set_affinity_and_hint(*irqs++, topology_sibling_cpumask(cpu));
1429-
cpumask_andnot(cpus, cpus, topology_sibling_cpumask(cpu));
1430-
--weight;
14311439
}
14321440
}
14331441
prev = next;
@@ -1523,7 +1531,7 @@ static int mana_gd_setup_irqs(struct pci_dev *pdev)
15231531
}
15241532
}
15251533

1526-
err = irq_setup(irqs, (nvec - start_irq_index), gc->numa_node);
1534+
err = irq_setup(irqs, nvec - start_irq_index, gc->numa_node, false);
15271535
if (err)
15281536
goto free_irq;
15291537

0 commit comments

Comments
 (0)