netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jme: netpoll support
@ 2012-07-17 16:29 Lekensteyn
  2012-07-18 16:45 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Lekensteyn @ 2012-07-17 16:29 UTC (permalink / raw)
  To: Guo-Fu Tseng; +Cc: netdev

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(+)

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
-- 
1.7.9.5

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

* Re: [PATCH] jme: netpoll support
  2012-07-17 16:29 [PATCH] jme: netpoll support Lekensteyn
@ 2012-07-18 16:45 ` David Miller
  2012-07-19  2:00   ` Guo-Fu Tseng
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2012-07-18 16:45 UTC (permalink / raw)
  To: lekensteyn; +Cc: cooldavid, netdev

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.

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

* Re: [PATCH] jme: netpoll support
  2012-07-18 16:45 ` David Miller
@ 2012-07-19  2:00   ` Guo-Fu Tseng
  2012-07-19  3:24     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Guo-Fu Tseng @ 2012-07-19  2:00 UTC (permalink / raw)
  To: David Miller, lekensteyn; +Cc: netdev

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

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

* Re: [PATCH] jme: netpoll support
  2012-07-19  2:00   ` Guo-Fu Tseng
@ 2012-07-19  3:24     ` David Miller
  2012-07-19  4:08       ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2012-07-19  3:24 UTC (permalink / raw)
  To: cooldavid; +Cc: lekensteyn, netdev

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.

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

* Re: [PATCH] jme: netpoll support
  2012-07-19  3:24     ` David Miller
@ 2012-07-19  4:08       ` Ben Hutchings
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2012-07-19  4:08 UTC (permalink / raw)
  To: David Miller; +Cc: cooldavid, lekensteyn, netdev

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.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

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

end of thread, other threads:[~2012-07-19  4:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-17 16:29 [PATCH] jme: netpoll support Lekensteyn
2012-07-18 16:45 ` David Miller
2012-07-19  2:00   ` Guo-Fu Tseng
2012-07-19  3:24     ` David Miller
2012-07-19  4:08       ` Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).