linux-mips
[Top] [All Lists]

[PATCH v2 1/2] staging: octeon-ethernet: allow to set IRQ smp_affinity f

To: devel@driverdev.osuosl.org, linux-mips@linux-mips.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, David Daney <david.daney@cavium.com>
Subject: [PATCH v2 1/2] staging: octeon-ethernet: allow to set IRQ smp_affinity freely
From: Aaro Koskinen <aaro.koskinen@iki.fi>
Date: Sun, 6 Oct 2013 23:35:15 +0300
Cc: richard@nod.at, Aaro Koskinen <aaro.koskinen@iki.fi>
In-reply-to: <1381091716-23531-1-git-send-email-aaro.koskinen@iki.fi>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1381091716-23531-1-git-send-email-aaro.koskinen@iki.fi>
Sender: linux-mips-bounce@linux-mips.org
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 | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-rx.c 
b/drivers/staging/octeon/ethernet-rx.c
index 8897d2d..0d539eb 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;
+
 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;
-- 
1.8.4.rc3


<Prev in Thread] Current Thread [Next in Thread>