All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: octeon-ethernet: don't assume that CPU 0 is special
@ 2013-09-28 19:50 Aaro Koskinen
  2013-09-28 19:50 ` [PATCH 2/2] staging: octeon-ethernet: allow to use only 1 CPU for packet processing Aaro Koskinen
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Aaro Koskinen @ 2013-09-28 19:50 UTC (permalink / raw)
  To: devel, linux-mips, Greg Kroah-Hartman, David Daney; +Cc: richard, Aaro Koskinen

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>
---
 drivers/staging/octeon/ethernet-rx.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
index e14a1bb..de831c1 100644
--- a/drivers/staging/octeon/ethernet-rx.c
+++ b/drivers/staging/octeon/ethernet-rx.c
@@ -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 = -1;
+
 static void cvm_oct_enable_napi(void *_)
 {
 	int cpu = smp_processor_id();
@@ -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;
 	}
@@ -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;
@@ -547,8 +546,9 @@ void cvm_oct_rx_initialize(void)
 	cvmx_write_csr(CVMX_POW_WQ_INT_PC, int_pc.u64);
 
 
-	/* Scheduld NAPI now.  This will indirectly enable interrupts. */
+	/* Schedule NAPI now. */
 	cvm_oct_enable_one_cpu();
+	enable_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group);
 }
 
 void cvm_oct_rx_shutdown(void)
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-10-03 20:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-28 19:50 [PATCH 1/2] staging: octeon-ethernet: don't assume that CPU 0 is special Aaro Koskinen
2013-09-28 19:50 ` [PATCH 2/2] staging: octeon-ethernet: allow to use only 1 CPU for packet processing Aaro Koskinen
2013-09-28 20:40 ` [PATCH 1/2] staging: octeon-ethernet: don't assume that CPU 0 is special Richard Weinberger
2013-09-28 21:12   ` Aaro Koskinen
2013-09-28 21:15 ` Richard Weinberger
2013-09-30 17:23 ` David Daney
2013-09-30 17:23   ` David Daney
2013-09-30 19:35   ` Aaro Koskinen
2013-09-30 19:41     ` David Daney
2013-09-30 19:41       ` David Daney
2013-09-30 19:56       ` Aaro Koskinen
2013-09-30 21:08         ` David Daney
2013-09-30 21:08           ` David Daney
2013-09-30 21:27           ` Aaro Koskinen
2013-10-03 20:36 ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.