netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 3/3] Add netpoll/netconsole support to vlan devices
@ 2006-09-25 23:43 akpm
  2006-09-26  5:34 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2006-09-25 23:43 UTC (permalink / raw)
  To: davem; +Cc: netdev, akpm, jesper.juhl, davem, greearb, mingo, mpm

From: Jesper Juhl <jesper.juhl@gmail.com>

I recently tried running netconsole via a vlan interface without luck,
and decided to do something about it (see patch below).

My interfaces look like this:

eth0      Link encap:Ethernet  HWaddr 00:14:5E:28:3C:2E
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11763760878 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13800040335 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3453951528686 (3.1 TiB)  TX bytes:7086425530052 (6.4 TiB)
          Interrupt:169

eth0.20   Link encap:Ethernet  HWaddr 00:14:5E:28:3C:2E
          inet addr:vvv.xxx.yyy.zzz  Bcast:ggg.hhh.iii.jjj  Mask:255.255.252.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11759883828 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13800040452 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3194985806767 (2.9 TiB)  TX bytes:6975984645540 (6.3 TiB)

Trying to load netconsole fails miserably :

[root@server root]# modprobe netconsole
netconsole=@/eth0,10514@aaa.bbb.ccc.ddd/00:04:23:BF:D9:62
FATAL: Error inserting netconsole
(/lib/modules/2.6.17.8/kernel/drivers/net/netconsole.ko): Invalid argument
[root@server root]# modprobe netconsole
netconsole=@/eth0.20,10514@aaa.bbb.ccc.ddd/00:04:23:BF:D9:62
FATAL: Error inserting netconsole
(/lib/modules/2.6.17.8/kernel/drivers/net/netconsole.ko): Invalid argument

And results in this in dmesg :

netconsole: interface eth0
netconsole: remote port 10514
netconsole: remote IP aaa.bbb.ccc.ddd
netconsole: remote ethernet address 00:04:23:bf:d9:62
netconsole: no IP address for eth0, aborting
netconsole: local port 6665
netconsole: interface eth0.20
netconsole: remote port 10514
netconsole: remote IP aaa.bbb.ccc.ddd
netconsole: remote ethernet address 00:04:23:bf:d9:62
netconsole: eth0.20 doesn't support polling, aborting.

The actual interface is a e1000 and supports polling just fine.
The problem is simply that netpoll won't play with eth0 since it has
no IP and it won't play with eth0.20 either since it's a vlan
interface and doesn't support polling even if the underlying device
does.

This is a problem for me since it means that several of my servers
that are configured like this won't be able to use netconsole.
So I set out to try and fix the problem by making the vlan device
support polling if the underlying device supports polling.

I have met with a resonable success in that the patch below seems to
work. With this patch I can now load netconsole for eth0.20 and log
messages are send just fine and can be recieved on the remote host.

 netconsole: local port 6665
 netconsole: interface eth0.20
 netconsole: remote port 10514
 netconsole: remote IP aaa.bbb.ccc.ddd
 netconsole: remote ethernet address 00:04:23:bf:d9:62
 netconsole: local IP vvv.xxx.yyy.zzz
 netconsole: network logging started

Now, I would very much like to get this merged, but first I would
appreciate some review of the patch. This part of the kernel is not
one I know all too well, so I may have made a number of silly mistakes.
If people would kindly take a look at the patch and point out any
problems with it so I can fix it up and arrive at a version that's
mergable, I'd greatly appreciate it.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Ben Greear <greearb@candelatech.com>
Cc: "David S. Miller" <davem@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 net/8021q/vlan.c     |    5 +++++
 net/8021q/vlan_dev.c |   15 ++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff -puN net/8021q/vlan.c~add-netpoll-netconsole-support-to-vlan-devices net/8021q/vlan.c
--- a/net/8021q/vlan.c~add-netpoll-netconsole-support-to-vlan-devices
+++ a/net/8021q/vlan.c
@@ -11,6 +11,7 @@
  *		Add HW acceleration hooks - David S. Miller <davem@redhat.com>;
  *		Correct all the locking - David S. Miller <davem@redhat.com>;
  *		Use hash table for VLAN groups - David S. Miller <davem@redhat.com>
+ *		Add NETPOLL support - Jesper Juhl
  *
  *		This program is free software; you can redistribute it and/or
  *		modify it under the terms of the GNU General Public License
@@ -512,6 +513,10 @@ static struct net_device *register_vlan_
 	}
 	new_dev->hard_header_parse = real_dev->hard_header_parse;
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	new_dev->poll_controller = real_dev->poll_controller;
+#endif
+
 	VLAN_DEV_INFO(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */
 	VLAN_DEV_INFO(new_dev)->real_dev = real_dev;
 	VLAN_DEV_INFO(new_dev)->dent = NULL;
diff -puN net/8021q/vlan_dev.c~add-netpoll-netconsole-support-to-vlan-devices net/8021q/vlan_dev.c
--- a/net/8021q/vlan_dev.c~add-netpoll-netconsole-support-to-vlan-devices
+++ a/net/8021q/vlan_dev.c
@@ -12,7 +12,8 @@
  *              Oct 20, 2001:  Ard van Breeman:
  *                - Fix MC-list, finally.
  *                - Flush MC-list on VLAN destroy.
- *                
+ *		Aug 31, 2006: Jesper Juhl
+ *		  - Add NETPOLL support.
  *
  *		This program is free software; you can redistribute it and/or
  *		modify it under the terms of the GNU General Public License
@@ -489,6 +490,12 @@ int vlan_dev_hard_start_xmit(struct sk_b
 	stats->tx_bytes += skb->len;
 
 	skb->dev = VLAN_DEV_INFO(dev)->real_dev;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	if (irqs_disabled()) {
+		skb->dev->hard_start_xmit(skb, skb->dev);
+		return 0;
+	}
+#endif
 	dev_queue_xmit(skb);
 
 	return 0;
@@ -513,6 +520,12 @@ int vlan_dev_hwaccel_hard_start_xmit(str
 	stats->tx_bytes += skb->len;
 
 	skb->dev = VLAN_DEV_INFO(dev)->real_dev;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	if (irqs_disabled()) {
+		skb->dev->hard_start_xmit(skb, skb->dev);
+		return 0;
+	}
+#endif
 	dev_queue_xmit(skb);
 
 	return 0;
_

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

* Re: [patch 3/3] Add netpoll/netconsole support to vlan devices
  2006-09-25 23:43 [patch 3/3] Add netpoll/netconsole support to vlan devices akpm
@ 2006-09-26  5:34 ` David Miller
  2006-09-26  8:15   ` Jesper Juhl
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2006-09-26  5:34 UTC (permalink / raw)
  To: akpm; +Cc: netdev, jesper.juhl, davem, greearb, mingo, mpm

From: akpm@osdl.org
Date: Mon, 25 Sep 2006 16:43:10 -0700

> +#ifdef CONFIG_NET_POLL_CONTROLLER
> +	new_dev->poll_controller = real_dev->poll_controller;
> +#endif
> +

I don't see how this part can be correct.  If netpoll actually
calls new_dev->poll_controller it will pass new_dev in
(ie. the VLAN device) yet this method is for real_dev.

If the only side effect of this assignment is that netpoll recognizes
the device as being usable with netpoll, that's really a nasty way to
accomplish that.

In any event, propagating this method pointer to the wrong device
structure is a bug.

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

* Re: [patch 3/3] Add netpoll/netconsole support to vlan devices
  2006-09-26  5:34 ` David Miller
@ 2006-09-26  8:15   ` Jesper Juhl
  0 siblings, 0 replies; 3+ messages in thread
From: Jesper Juhl @ 2006-09-26  8:15 UTC (permalink / raw)
  To: David Miller; +Cc: akpm, netdev, davem, greearb, mingo, mpm

On 26/09/06, David Miller <davem@davemloft.net> wrote:
> From: akpm@osdl.org
> Date: Mon, 25 Sep 2006 16:43:10 -0700
>
> > +#ifdef CONFIG_NET_POLL_CONTROLLER
> > +     new_dev->poll_controller = real_dev->poll_controller;
> > +#endif
> > +
>
> I don't see how this part can be correct.  If netpoll actually
> calls new_dev->poll_controller it will pass new_dev in
> (ie. the VLAN device) yet this method is for real_dev.
>
> If the only side effect of this assignment is that netpoll recognizes
> the device as being usable with netpoll, that's really a nasty way to
> accomplish that.
>
It was the only way I could find to accomplish that. If you know of a
better way I'd appreciate a hint :)

> In any event, propagating this method pointer to the wrong device
> structure is a bug.
>
Ok, then the patch as it stands is dead. I'll try to find another way.
Thank you for your comments.

-- 
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

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

end of thread, other threads:[~2006-09-26  8:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-25 23:43 [patch 3/3] Add netpoll/netconsole support to vlan devices akpm
2006-09-26  5:34 ` David Miller
2006-09-26  8:15   ` Jesper Juhl

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).