diff mbox

jme: netpoll support

Message ID 18143736.brt1iGhlQ1@al
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Peter Wu July 17, 2012, 4:29 p.m. UTC
From: Peter Wu <lekensteyn@gmail.com>

This patch adds the netpoll function to support netconsole. Tested and works
fine on my "JMC250 PCI Express Gigabit Ethernet Controller" (PCI ID 0250).

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
---
 drivers/net/ethernet/jme.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

David Miller July 18, 2012, 4:45 p.m. UTC | #1
From: Lekensteyn <lekensteyn@gmail.com>
Date: Tue, 17 Jul 2012 18:29:34 +0200

> From: Peter Wu <lekensteyn@gmail.com>
> 
> This patch adds the netpoll function to support netconsole. Tested and works
> fine on my "JMC250 PCI Express Gigabit Ethernet Controller" (PCI ID 0250).
> 
> Signed-off-by: Peter Wu <lekensteyn@gmail.com>

Applied to net-next

I really wonder if this driver works on SMP systems at all.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guo-Fu Tseng July 19, 2012, 2 a.m. UTC | #2
On Wed, 18 Jul 2012 09:45:24 -0700 (PDT), David Miller wrote
> From: Lekensteyn <lekensteyn@gmail.com>
> Date: Tue, 17 Jul 2012 18:29:34 +0200
> 
> > From: Peter Wu <lekensteyn@gmail.com>
> > 
> > This patch adds the netpoll function to support netconsole. Tested and works
> > fine on my "JMC250 PCI Express Gigabit Ethernet Controller" (PCI ID 0250).
> > 
> > Signed-off-by: Peter Wu <lekensteyn@gmail.com>
> 
> Applied to net-next
> 
> I really wonder if this driver works on SMP systems at all.
Hi davem:

I wrote/tested this driver on SMP system at very beginning.
In face some of the design was aimed for SMP systems.
Is there any obvious bug or something I should be aware of?

Guo-Fu Tseng

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller July 19, 2012, 3:24 a.m. UTC | #3
From: "Guo-Fu Tseng" <cooldavid@cooldavid.org>
Date: Thu, 19 Jul 2012 10:00:10 +0800

> On Wed, 18 Jul 2012 09:45:24 -0700 (PDT), David Miller wrote
>> From: Lekensteyn <lekensteyn@gmail.com>
>> Date: Tue, 17 Jul 2012 18:29:34 +0200
>> 
>> > From: Peter Wu <lekensteyn@gmail.com>
>> > 
>> > This patch adds the netpoll function to support netconsole. Tested and works
>> > fine on my "JMC250 PCI Express Gigabit Ethernet Controller" (PCI ID 0250).
>> > 
>> > Signed-off-by: Peter Wu <lekensteyn@gmail.com>
>> 
>> Applied to net-next
>> 
>> I really wonder if this driver works on SMP systems at all.
> Hi davem:
> 
> I wrote/tested this driver on SMP system at very beginning.
> In face some of the design was aimed for SMP systems.
> Is there any obvious bug or something I should be aware of?

Well, you do no locking in your IRQ handler.

So how can you be sure in jme_free_irq() during jme_close() that the
handler is not running on some cpu somewhere?

That's why drivers like drivers/net/ethernet/broadcom/tg3.c have
a function like tg3_irq_quiesce(), to guarentee that no code path
is executing in the interrupt handler.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Hutchings July 19, 2012, 4:08 a.m. UTC | #4
On Wed, 2012-07-18 at 20:24 -0700, David Miller wrote:
> From: "Guo-Fu Tseng" <cooldavid@cooldavid.org>
> Date: Thu, 19 Jul 2012 10:00:10 +0800
> 
> > On Wed, 18 Jul 2012 09:45:24 -0700 (PDT), David Miller wrote
> >> From: Lekensteyn <lekensteyn@gmail.com>
> >> Date: Tue, 17 Jul 2012 18:29:34 +0200
> >> 
> >> > From: Peter Wu <lekensteyn@gmail.com>
> >> > 
> >> > This patch adds the netpoll function to support netconsole. Tested and works
> >> > fine on my "JMC250 PCI Express Gigabit Ethernet Controller" (PCI ID 0250).
> >> > 
> >> > Signed-off-by: Peter Wu <lekensteyn@gmail.com>
> >> 
> >> Applied to net-next
> >> 
> >> I really wonder if this driver works on SMP systems at all.
> > Hi davem:
> > 
> > I wrote/tested this driver on SMP system at very beginning.
> > In face some of the design was aimed for SMP systems.
> > Is there any obvious bug or something I should be aware of?
> 
> Well, you do no locking in your IRQ handler.
> 
> So how can you be sure in jme_free_irq() during jme_close() that the
> handler is not running on some cpu somewhere?
> 
> That's why drivers like drivers/net/ethernet/broadcom/tg3.c have
> a function like tg3_irq_quiesce(), to guarentee that no code path
> is executing in the interrupt handler.

What on earth are you talking about?  You can never be sure of that with
shared IRQ handlers; so free_irq() wait if necessary.

Ben.
diff mbox

Patch

diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 4ea6580..c911d88 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -2743,6 +2743,17 @@  jme_set_features(struct net_device *netdev, netdev_features_t features)
 	return 0;
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void jme_netpoll(struct net_device *dev)
+{
+	unsigned long flags;
+
+	local_irq_save(flags);
+	jme_intr(dev->irq, dev);
+	local_irq_restore(flags);
+}
+#endif
+
 static int
 jme_nway_reset(struct net_device *netdev)
 {
@@ -2944,6 +2955,9 @@  static const struct net_device_ops jme_netdev_ops = {
 	.ndo_tx_timeout		= jme_tx_timeout,
 	.ndo_fix_features       = jme_fix_features,
 	.ndo_set_features       = jme_set_features,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.ndo_poll_controller	= jme_netpoll,
+#endif
 };
 
 static int __devinit