Skip to content

Commit

Permalink
staging: octeon-ethernet: allow to set IRQ smp_affinity freely
Browse files Browse the repository at this point in the history
Currently the driver assumes that CPU 0 is handling all the hard IRQs.
This is wrong in Linux SMP systems where user is allowed to assign to
hardware IRQs to any CPU. The driver will stop working if user sets
smp_affinity so that interrupts end up being handled by other than CPU
0. The patch fixes that.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Aaro Koskinen authored and Greg Kroah-Hartman committed Oct 7, 2013
1 parent aa87afe commit cd39f73
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/staging/octeon/ethernet-rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ struct cvm_oct_core_state {

static struct cvm_oct_core_state core_state __cacheline_aligned_in_smp;

static int cvm_irq_cpu;

static void cvm_oct_enable_napi(void *_)
{
int cpu = smp_processor_id();
Expand Down Expand Up @@ -112,11 +114,7 @@ static void cvm_oct_no_more_work(void)
{
int cpu = smp_processor_id();

/*
* CPU zero is special. It always has the irq enabled when
* waiting for incoming packets.
*/
if (cpu == 0) {
if (cpu == cvm_irq_cpu) {
enable_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group);
return;
}
Expand All @@ -135,6 +133,7 @@ static irqreturn_t cvm_oct_do_interrupt(int cpl, void *dev_id)
{
/* Disable the IRQ and start napi_poll. */
disable_irq_nosync(OCTEON_IRQ_WORKQ0 + pow_receive_group);
cvm_irq_cpu = smp_processor_id();
cvm_oct_enable_napi(NULL);

return IRQ_HANDLED;
Expand Down

0 comments on commit cd39f73

Please sign in to comment.