Commit cd39f7374d343e6af22d7c929ec87c7406ebd00c

Authored by Aaro Koskinen
Committed by Greg Kroah-Hartman
1 parent aa87afe207

staging: octeon-ethernet: allow to set IRQ smp_affinity freely

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>

Showing 1 changed file with 4 additions and 5 deletions Side-by-side Diff

drivers/staging/octeon/ethernet-rx.c
... ... @@ -80,6 +80,8 @@
80 80  
81 81 static struct cvm_oct_core_state core_state __cacheline_aligned_in_smp;
82 82  
  83 +static int cvm_irq_cpu;
  84 +
83 85 static void cvm_oct_enable_napi(void *_)
84 86 {
85 87 int cpu = smp_processor_id();
... ... @@ -112,11 +114,7 @@
112 114 {
113 115 int cpu = smp_processor_id();
114 116  
115   - /*
116   - * CPU zero is special. It always has the irq enabled when
117   - * waiting for incoming packets.
118   - */
119   - if (cpu == 0) {
  117 + if (cpu == cvm_irq_cpu) {
120 118 enable_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group);
121 119 return;
122 120 }
... ... @@ -135,6 +133,7 @@
135 133 {
136 134 /* Disable the IRQ and start napi_poll. */
137 135 disable_irq_nosync(OCTEON_IRQ_WORKQ0 + pow_receive_group);
  136 + cvm_irq_cpu = smp_processor_id();
138 137 cvm_oct_enable_napi(NULL);
139 138  
140 139 return IRQ_HANDLED;