Skip to content

Commit 845c62c

Browse files
author
Shradha Gupta
committed
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>
1 parent 4607617 commit 845c62c

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
@@ -1329,7 +1329,8 @@ void mana_gd_free_res_map(struct gdma_resource *r)
13291329
* do the same thing.
13301330
*/
13311331

1332-
static int irq_setup(unsigned int *irqs, unsigned int len, int node)
1332+
static int irq_setup(unsigned int *irqs, unsigned int len, int node,
1333+
bool skip_first_cpu)
13331334
{
13341335
const struct cpumask *next, *prev = cpu_none_mask;
13351336
cpumask_var_t cpus __free(free_cpumask_var);
@@ -1344,11 +1345,18 @@ static int irq_setup(unsigned int *irqs, unsigned int len, int node)
13441345
while (weight > 0) {
13451346
cpumask_andnot(cpus, next, prev);
13461347
for_each_cpu(cpu, cpus) {
1348+
cpumask_andnot(cpus, cpus, topology_sibling_cpumask(cpu));
1349+
--weight;
1350+
1351+
if (unlikely(skip_first_cpu)) {
1352+
skip_first_cpu = false;
1353+
continue;
1354+
}
1355+
13471356
if (len-- == 0)
13481357
goto done;
1358+
13491359
irq_set_affinity_and_hint(*irqs++, topology_sibling_cpumask(cpu));
1350-
cpumask_andnot(cpus, cpus, topology_sibling_cpumask(cpu));
1351-
--weight;
13521360
}
13531361
}
13541362
prev = next;
@@ -1444,7 +1452,7 @@ static int mana_gd_setup_irqs(struct pci_dev *pdev)
14441452
}
14451453
}
14461454

1447-
err = irq_setup(irqs, (nvec - start_irq_index), gc->numa_node);
1455+
err = irq_setup(irqs, nvec - start_irq_index, gc->numa_node, false);
14481456
if (err)
14491457
goto free_irq;
14501458

0 commit comments

Comments
 (0)