Skip to content

Commit a83762d

Browse files
sf-hgkdavem330
authored andcommitted
sfc: set and clear interrupt affinity hints
Use cpumask_local_spread to provide interrupt affinity hints for each queue. This will spread interrupts across NUMA local CPUs first, extending to remote nodes if needed. Signed-off-by: Bert Kenward <bkenward@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 263243d commit a83762d

File tree

1 file changed

+36
-0
lines changed
  • drivers/net/ethernet/sfc

1 file changed

+36
-0
lines changed

drivers/net/ethernet/sfc/efx.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,38 @@ static int efx_probe_interrupts(struct efx_nic *efx)
15511551
return 0;
15521552
}
15531553

1554+
#if defined(CONFIG_SMP)
1555+
static void efx_set_interrupt_affinity(struct efx_nic *efx)
1556+
{
1557+
struct efx_channel *channel;
1558+
unsigned int cpu;
1559+
1560+
efx_for_each_channel(channel, efx) {
1561+
cpu = cpumask_local_spread(channel->channel,
1562+
pcibus_to_node(efx->pci_dev->bus));
1563+
irq_set_affinity_hint(channel->irq, cpumask_of(cpu));
1564+
}
1565+
}
1566+
1567+
static void efx_clear_interrupt_affinity(struct efx_nic *efx)
1568+
{
1569+
struct efx_channel *channel;
1570+
1571+
efx_for_each_channel(channel, efx)
1572+
irq_set_affinity_hint(channel->irq, NULL);
1573+
}
1574+
#else
1575+
static void
1576+
efx_set_interrupt_affinity(struct efx_nic *efx __attribute__ ((unused)))
1577+
{
1578+
}
1579+
1580+
static void
1581+
efx_clear_interrupt_affinity(struct efx_nic *efx __attribute__ ((unused)))
1582+
{
1583+
}
1584+
#endif /* CONFIG_SMP */
1585+
15541586
static int efx_soft_enable_interrupts(struct efx_nic *efx)
15551587
{
15561588
struct efx_channel *channel, *end_channel;
@@ -3165,6 +3197,7 @@ static void efx_pci_remove_main(struct efx_nic *efx)
31653197
cancel_work_sync(&efx->reset_work);
31663198

31673199
efx_disable_interrupts(efx);
3200+
efx_clear_interrupt_affinity(efx);
31683201
efx_nic_fini_interrupt(efx);
31693202
efx_fini_port(efx);
31703203
efx->type->fini(efx);
@@ -3314,13 +3347,16 @@ static int efx_pci_probe_main(struct efx_nic *efx)
33143347
rc = efx_nic_init_interrupt(efx);
33153348
if (rc)
33163349
goto fail5;
3350+
3351+
efx_set_interrupt_affinity(efx);
33173352
rc = efx_enable_interrupts(efx);
33183353
if (rc)
33193354
goto fail6;
33203355

33213356
return 0;
33223357

33233358
fail6:
3359+
efx_clear_interrupt_affinity(efx);
33243360
efx_nic_fini_interrupt(efx);
33253361
fail5:
33263362
efx_fini_port(efx);

0 commit comments

Comments
 (0)