Netdev List
 help / color / mirror / Atom feed
* Re: Receive side performance issue with multi-10-GigE and NUMA
From: Bill Fink @ 2009-09-02  5:11 UTC (permalink / raw)
  To: Neil Horman; +Cc: Linux Network Developers, brice, gallatin
In-Reply-To: <20090827175151.GC4762@hmsreliant.think-freely.org>

On Thu, 27 Aug 2009, Neil Horman wrote:

> On Thu, Aug 27, 2009 at 01:44:29PM -0400, Bill Fink wrote:
> > On Wed, 26 Aug 2009, Neil Horman wrote:
> > 
> > > On Wed, Aug 26, 2009 at 07:00:13AM -0400, Neil Horman wrote:
> > > > On Wed, Aug 26, 2009 at 03:10:57AM -0400, Bill Fink wrote:
> > > > 
> > > > > Fortunately, in this specific case, the SuperMicro X8DAH+-F system
> > > > > does have a serial console, and after a fair amount of effort I was
> > > > > able to get it to work as desired, and was able to finally capture
> > > > > a backtrace of the kernel oops.  BTW I believe the reason the
> > > > > kexec/kdump didn't work was probably because it couldn't find
> > > > > a /proc/vmcore file, although I don't know why that would be,
> > > > > and the Fedora 10 /etc/init.d/kdump script will then just boot
> > > > > up normally if it fails to find the /proc/vmcore file (or it's
> > > > > zero size).
> > > > > 
> > > > I take care of kdump for fedora and RHEL.  If you file a bug on this, I'd be
> > > > happy to look into it further.
> > > > 
> > > > > The following shows a simple ping test usage of the skb_sources
> > > > > tracing feature:
> > > > > 
> > > > > [root@xeontest1 tracing]# numactl --membind=1 taskset -c 4 ping -c 5 -s 1472 192.168.1.10
> > > > > PING 192.168.1.10 (192.168.1.10) 1472(1500) bytes of data.
> > > > > 1480 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=0.139 ms
> > > > > 1480 bytes from 192.168.1.10: icmp_seq=2 ttl=64 time=0.182 ms
> > > > > 1480 bytes from 192.168.1.10: icmp_seq=3 ttl=64 time=0.178 ms
> > > > > 1480 bytes from 192.168.1.10: icmp_seq=4 ttl=64 time=0.188 ms
> > > > > 1480 bytes from 192.168.1.10: icmp_seq=5 ttl=64 time=0.178 ms
> > > > > 
> > > > > --- 192.168.1.10 ping statistics ---
> > > > > 5 packets transmitted, 5 received, 0% packet loss, time 3999ms
> > > > > rtt min/avg/max/mdev = 0.139/0.173/0.188/0.017 ms
> > > > > 
> > > > > [root@xeontest1 tracing]# cat trace
> > > > > # tracer: skb_sources
> > > > > #
> > > > > #       PID     ANID    CNID    IFC     RXQ     CCPU    LEN
> > > > > #        |       |       |       |       |       |       |
> > > > >         4217    1       1       eth2    0       4       1500
> > > > >         4217    1       1       eth2    0       4       1500
> > > > >         4217    1       1       eth2    0       4       1500
> > > > >         4217    1       1       eth2    0       4       1500
> > > > >         4217    1       1       eth2    0       4       1500
> > > > > 
> > > > > All is as was expected.
> > > > > 
> > > > > But if I try an actual nuttcp performance test (even rate limited
> > > > > to 1 Mbps), I get the following kernel oops:
> > > > > 
> > > > thank you, I think I see the problem, I'll have a patch for you in just a bit
> > > > 
> > > > Thanks
> > > > Neil
> > > > 
> > > > > [root@xeontest1 tracing]# numactl --membind=1 nuttcp -In2 -Ri1m -xc4/0 192.168.1.10
> > > > > BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
> > > > > IP: [<ffffffff810b01ab>] probe_skb_dequeue+0xf7/0x152
> > > > > PGD 337d12067 PUD 337d11067 PMD 0
> > > > > Oops: 0000 [#1] SMP
> > > > > last sysfs file: /sys/devices/pci0000:80/0000:80:07.0/0000:8b:00.0/0000:8c:04.0e
> > > > > CPU 4
> > > > > Modules linked in: w83627ehf hwmon_vid coretemp hwmon ipv6 dm_multipath uinput ]
> > > > > Pid: 4222, comm: nuttcp Not tainted 2.6.31-rc6-bf #3 X8DAH
> > > > > RIP: 0010:[<ffffffff810b01ab>]  [<ffffffff810b01ab>] probe_skb_dequeue+0xf7/0x12
> > > > > RSP: 0018:ffff8801a5811a88  EFLAGS: 00010213
> > > > > RAX: 0000000000000000 RBX: ffff88033906d154 RCX: 000000000000000d
> > > > > RDX: 000000000000f88c RSI: 000000000000000b RDI: ffff8803383d3044
> > > > > RBP: ffff8801a5811ab8 R08: 0000000000000001 R09: ffff8801ab311a00
> > > > > R10: 0000000000000005 R11: ffffc9000080e2b0 R12: ffff880337c45400
> > > > > R13: ffff88033906d150 R14: 0000000000000014 R15: ffffffff818bb890
> > > > > FS:  00007fa976d326f0(0000) GS:ffffc90000800000(0000) knlGS:0000000000000000
> > > > > CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> > > > > CR2: 0000000000000038 CR3: 000000033801e000 CR4: 00000000000006e0
> > > > > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > > > > DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> > > > > Process nuttcp (pid: 4222, threadinfo ffff8801a5810000, task ffff8801ab2e5d00)
> > > > > Stack:
> > > > >  ffff8801a5811ab8 ffff8801b35d4ab0 0000000000000014 0000000000000000
> > > > > <0> 0000000000000014 0000000000000014 ffff8801a5811b18 ffffffff81366ae8
> > > > > <0> ffff8801a5811ed8 0000001439084000 ffff880337c45400 00000001001416ef
> > > > > Call Trace:
> > > > >  [<ffffffff81366ae8>] skb_copy_datagram_iovec+0x50/0x1f5
> > > > >  [<ffffffff813ac875>] tcp_rcv_established+0x278/0x6db
> > > > >  [<ffffffff813b3ef5>] tcp_v4_do_rcv+0x1b8/0x366
> > > > >  [<ffffffff8135f99e>] ? release_sock+0xab/0xb4
> > > > >  [<ffffffff8136004d>] ? sk_wait_data+0xc8/0xd6
> > > > >  [<ffffffff813a32d6>] tcp_prequeue_process+0x79/0x8f
> > > > >  [<ffffffff813a455d>] tcp_recvmsg+0x4e8/0xaa0
> > > > >  [<ffffffff8135ec90>] sock_common_recvmsg+0x37/0x4c
> > > > >  [<ffffffff8135cb06>] __sock_recvmsg+0x72/0x7f
> > > > >  [<ffffffff8135cbdd>] sock_aio_read+0xca/0xda
> > > > >  [<ffffffff810d9536>] ? vma_merge+0x2a0/0x318
> > > > >  [<ffffffff810f6d4f>] do_sync_read+0xec/0x132
> > > > >  [<ffffffff81067ddc>] ? autoremove_wake_function+0x0/0x3d
> > > > >  [<ffffffff811b646c>] ? security_file_permission+0x16/0x18
> > > > >  [<ffffffff810f785c>] vfs_read+0xc0/0x107
> > > > >  [<ffffffff810f7971>] sys_read+0x4c/0x75
> > > > >  [<ffffffff81011c82>] system_call_fastpath+0x16/0x1b
> > > > > Code: 44 89 73 30 89 43 14 41 0f b7 84 24 ac 00 00 00 89 43 28 65 8b 04 25 98 e
> > > > > RIP  [<ffffffff810b01ab>] probe_skb_dequeue+0xf7/0x152
> > > > >  RSP <ffff8801a5811a88>
> > > > > CR2: 0000000000000038
> > > 
> > > 
> > > 
> > > Here  you go, I think this will fix your oops.
> > > 
> > > 
> > >     Fix NULL pointer deref in skb sources ftracer
> > >     
> > >     Its possible that skb->sk will be null in this path, so we shouldn't just assume
> > >     we can pass it to sock_net
> > >     
> > >     Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> > > 
> > >  trace_skb_sources.c |    6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/kernel/trace/trace_skb_sources.c b/kernel/trace/trace_skb_sources.c
> > > index 40eb071..8bf518f 100644
> > > --- a/kernel/trace/trace_skb_sources.c
> > > +++ b/kernel/trace/trace_skb_sources.c
> > > @@ -29,7 +29,7 @@ static void probe_skb_dequeue(const struct sk_buff *skb, int len)
> > >  	struct ring_buffer_event *event;
> > >  	struct trace_skb_event *entry;
> > >  	struct trace_array *tr = skb_trace;
> > > -	struct net_device *dev;
> > > +	struct net_device *dev = NULL;
> > >  
> > >  	if (!trace_skb_source_enabled)
> > >  		return;
> > > @@ -50,7 +50,9 @@ static void probe_skb_dequeue(const struct sk_buff *skb, int len)
> > >  	entry->event_data.rx_queue = skb->queue_mapping;
> > >  	entry->event_data.ccpu = smp_processor_id();
> > >  
> > > -	dev = dev_get_by_index(sock_net(skb->sk), skb->iif);
> > > +	if (skb->sk)
> > > +		dev = dev_get_by_index(sock_net(skb->sk), skb->iif);
> > > +
> > >  	if (dev) {
> > >  		memcpy(entry->event_data.ifname, dev->name, IFNAMSIZ);
> > >  		dev_put(dev);
> > 
> > 
> > 
> > On the positive side, it did fix the oops.  But the results of the
> > skb_sources tracing was not that useful.
> > 
> > [root@xeontest1 tracing]# numactl --membind=1 nuttcp -In2 -xc4/0 192.168.1.10 & ps ax | grep nuttcp
> >  5521 ttyS0    S      0:00 nuttcp -In2 -xc4/0 192.168.1.10
> > n2: 11819.0786 MB /  10.01 sec = 9905.6427 Mbps 26 %TX 37 %RX 0 retrans 0.18 msRTT
> > 
> > First off, only 10 trace entries were made:
> > 
> > [root@xeontest1 tracing]# wc trace
> > 14 90 334 trace
> > 
> > And here they are:
> > 
> > [root@xeontest1 tracing]# cat trace
> > # tracer: skb_sources
> > #
> > #       PID     ANID    CNID    IFC     RXQ     CCPU    LEN
> > #        |       |       |       |       |       |       |
> >         5521    0       0       Unknown 0       3       888
> >         5521    0       0       Unknown 0       3       896
> >         5521    0       0       Unknown 0       3       20
> >         5521    0       0       Unknown 0       3       888
> >         5521    0       0       Unknown 0       3       896
> >         5521    0       0       Unknown 0       3       20
> >         5521    1       1       Unknown 0       4       20
> >         5521    1       1       Unknown 0       4       11
> >         5521    1       1       Unknown 0       4       540
> >         5521    1       1       Unknown 0       4       0
> > 
> > Even for these 10 entries, why is the IFC Unknown, and the LENs
> > seem to be wrong too.
> > 
> > 						-Bill
> > 
> I'm not sure why you're getting Unknown Interface names.  Nominally that
> indicates that the skb->iif value in the skb was incorrect or otherwise not set,
> which shouldn't be the case.  As for the lengths that just seems wrong.  That
> length value is taken directly from skb->len, so if its not right, it seems like
> its not getting set correctly someplace.
> 
> As you may have seen we're removing the ftrace module, and replacing it with the
> use of raw trace events.  When I have that working, I'll see if I get simmilar
> results.  I never did in my local testing of the ftrace module, but perhaps its
> related to load or something.

IIUC I should keep the first of your original three ftrace patches,
revert all the rest, and then apply your very latest patch that
augments the skb_copy_datagram_iovec TRACE_EVENT.  Do I have that
basically correct?

Then I just need to ask how do I use this new method?

						-Thanks

						-Bill

^ permalink raw reply

* Re: 100Mbit ethernet performance on embedded devices
From: Aras Vaichas @ 2009-09-02  5:09 UTC (permalink / raw)
  To: Johannes Stezenbach; +Cc: linux-embedded, netdev
In-Reply-To: <20090819145057.GA25400@sig21.net>

On Thu, Aug 20, 2009 at 12:50 AM, Johannes Stezenbach <js@sig21.net> wrote:
>
> Hi,
>
> a while ago I was working on a SoC with 200MHz ARM926EJ-S CPU
> and integrated 100Mbit ethernet core, connected on internal
> (fast) memory bus, with DMA.  With iperf I measured:
>
>  TCP RX ~70Mbit/sec  (iperf -s on SoC, iperf -c on destop PC)
>  TCP TX ~56Mbit/sec  (iperf -s on destop PC, iperf -c o SoC)
>
> What I'm interested in are some numbers for similar hardware,
> to find out if my hardware and/or ethernet driver can be improved,
> or if the CPU will always be the limiting factor.
> I'd also be interested to know if hardware checksumming
> support would improve throughput noticably in such a system,
> or if it is only useful for 1Gbit and above.
>
> Did anyone actually manage to get close to 100Mbit/sec
> with similar CPU resources?

No, but I can share results.

AT91RM9200 (ARM920T), 180MHz
Davicom 9161 PHY
Linux 2.6.26.3

CONFIG_NETFILTER=y
CONFIG_NETFILTER_ADVANCED=y

# uptime; iperf -s; uptime
 00:07:33 up 7 min, load average: 0.02, 0.10, 0.07
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 169.254.0.235 port 5001 connected with 169.254.0.2 port 50762
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec  58.6 MBytes  49.1 Mbits/sec

 00:07:46 up 7 min, load average: 0.17, 0.13, 0.08

^ permalink raw reply

* [PATCH 5/5] net: file_operations should be const
From: Stephen Hemminger @ 2009-09-02  5:25 UTC (permalink / raw)
  To: David Miller, Samuel Ortiz
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20090902052500.808557262@vyatta.com>

[-- Attachment #1: const-file-ops.patch --]
[-- Type: text/plain, Size: 4787 bytes --]

All instances of file_operations should be const.

Signed-off-by: Stephen Hemminger <shemminger-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>


---
 net/ipv6/ip6mr.c                        |    4 ++--
 net/irda/irnet/irnet_ppp.h              |    2 +-
 net/irda/irproc.c                       |   14 +++++++-------
 net/key/af_key.c                        |    2 +-
 net/mac80211/rc80211_minstrel_debugfs.c |    2 +-
 net/mac80211/rc80211_pid_debugfs.c      |    2 +-
 net/xfrm/xfrm_proc.c                    |    2 +-
 7 files changed, 14 insertions(+), 14 deletions(-)

--- a/net/ipv6/ip6mr.c	2009-09-01 22:06:18.049861877 -0700
+++ b/net/ipv6/ip6mr.c	2009-09-01 22:06:45.101130517 -0700
@@ -217,7 +217,7 @@ static int ip6mr_vif_open(struct inode *
 			    sizeof(struct ipmr_vif_iter));
 }
 
-static struct file_operations ip6mr_vif_fops = {
+static const struct file_operations ip6mr_vif_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = ip6mr_vif_open,
 	.read    = seq_read,
@@ -341,7 +341,7 @@ static int ipmr_mfc_open(struct inode *i
 			    sizeof(struct ipmr_mfc_iter));
 }
 
-static struct file_operations ip6mr_mfc_fops = {
+static const struct file_operations ip6mr_mfc_fops = {
 	.owner	 = THIS_MODULE,
 	.open    = ipmr_mfc_open,
 	.read    = seq_read,
--- a/net/irda/irnet/irnet_ppp.h	2009-09-01 22:06:18.066775983 -0700
+++ b/net/irda/irnet/irnet_ppp.h	2009-09-01 22:07:01.768232028 -0700
@@ -95,7 +95,7 @@ static int
 /**************************** VARIABLES ****************************/
 
 /* Filesystem callbacks (to call us) */
-static struct file_operations irnet_device_fops =
+static const struct file_operations irnet_device_fops =
 {
 	.owner		= THIS_MODULE,
 	.read		= dev_irnet_read,
--- a/net/irda/irproc.c	2009-09-01 22:06:18.083862409 -0700
+++ b/net/irda/irproc.c	2009-09-01 22:07:33.742884934 -0700
@@ -34,21 +34,21 @@
 #include <net/irda/irlap.h>
 #include <net/irda/irlmp.h>
 
-extern struct file_operations discovery_seq_fops;
-extern struct file_operations irlap_seq_fops;
-extern struct file_operations irlmp_seq_fops;
-extern struct file_operations irttp_seq_fops;
-extern struct file_operations irias_seq_fops;
+extern const struct file_operations discovery_seq_fops;
+extern const struct file_operations irlap_seq_fops;
+extern const struct file_operations irlmp_seq_fops;
+extern const struct file_operations irttp_seq_fops;
+extern const struct file_operations irias_seq_fops;
 
 struct irda_entry {
 	const char *name;
-	struct file_operations *fops;
+	const struct file_operations *fops;
 };
 
 struct proc_dir_entry *proc_irda;
 EXPORT_SYMBOL(proc_irda);
 
-static struct irda_entry irda_dirs[] = {
+static const struct irda_entry irda_dirs[] = {
 	{"discovery",	&discovery_seq_fops},
 	{"irttp",	&irttp_seq_fops},
 	{"irlmp",	&irlmp_seq_fops},
--- a/net/key/af_key.c	2009-09-01 22:06:18.103861872 -0700
+++ b/net/key/af_key.c	2009-09-01 22:07:53.008956985 -0700
@@ -3718,7 +3718,7 @@ static int pfkey_seq_open(struct inode *
 			    sizeof(struct seq_net_private));
 }
 
-static struct file_operations pfkey_proc_ops = {
+static const struct file_operations pfkey_proc_ops = {
 	.open	 = pfkey_seq_open,
 	.read	 = seq_read,
 	.llseek	 = seq_lseek,
--- a/net/mac80211/rc80211_minstrel_debugfs.c	2009-09-01 22:06:18.119862498 -0700
+++ b/net/mac80211/rc80211_minstrel_debugfs.c	2009-09-01 22:08:22.747241542 -0700
@@ -139,7 +139,7 @@ minstrel_stats_release(struct inode *ino
 	return 0;
 }
 
-static struct file_operations minstrel_stat_fops = {
+static const struct file_operations minstrel_stat_fops = {
 	.owner = THIS_MODULE,
 	.open = minstrel_stats_open,
 	.read = minstrel_stats_read,
--- a/net/mac80211/rc80211_pid_debugfs.c	2009-09-01 22:06:18.135862300 -0700
+++ b/net/mac80211/rc80211_pid_debugfs.c	2009-09-01 22:08:28.843245757 -0700
@@ -198,7 +198,7 @@ static ssize_t rate_control_pid_events_r
 
 #undef RC_PID_PRINT_BUF_SIZE
 
-static struct file_operations rc_pid_fop_events = {
+static const struct file_operations rc_pid_fop_events = {
 	.owner = THIS_MODULE,
 	.read = rate_control_pid_events_read,
 	.poll = rate_control_pid_events_poll,
--- a/net/xfrm/xfrm_proc.c	2009-09-01 22:06:18.169862213 -0700
+++ b/net/xfrm/xfrm_proc.c	2009-09-01 22:08:48.707830315 -0700
@@ -60,7 +60,7 @@ static int xfrm_statistics_seq_open(stru
 	return single_open_net(inode, file, xfrm_statistics_seq_show);
 }
 
-static struct file_operations xfrm_statistics_seq_fops = {
+static const struct file_operations xfrm_statistics_seq_fops = {
 	.owner	 = THIS_MODULE,
 	.open	 = xfrm_statistics_seq_open,
 	.read	 = seq_read,

-- 

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: Receive side performance issue with multi-10-GigE and NUMA
From: Bill Fink @ 2009-09-02  5:28 UTC (permalink / raw)
  To: Bill Fink; +Cc: Neil Horman, Linux Network Developers, brice, gallatin
In-Reply-To: <20090827133242.d02acece.billfink@mindspring.com>

On Thu, 27 Aug 2009, Bill Fink wrote:

> On Wed, 26 Aug 2009, Neil Horman wrote:
> 
> > On Wed, Aug 26, 2009 at 03:10:57AM -0400, Bill Fink wrote:
> > > 
> > > Fortunately, in this specific case, the SuperMicro X8DAH+-F system
> > > does have a serial console, and after a fair amount of effort I was
> > > able to get it to work as desired, and was able to finally capture
> > > a backtrace of the kernel oops.  BTW I believe the reason the
> > > kexec/kdump didn't work was probably because it couldn't find
> > > a /proc/vmcore file, although I don't know why that would be,
> > > and the Fedora 10 /etc/init.d/kdump script will then just boot
> > > up normally if it fails to find the /proc/vmcore file (or it's
> > > zero size).
> > > 
> > I take care of kdump for fedora and RHEL.  If you file a bug on this, I'd be
> > happy to look into it further.
> 
> It's odd.  kexec/kdump works fine with the 2.6.29.6-217.2.3.fc11.x86_64
> kernel from Fedora 11 (running on the Fedora 10 system).  I will try
> again with the kernel-2.6.31-0.174.rc7.git2.fc12.src.rpm from Fedora 12,
> in case it has some secret sauce in one of the Fedora patches to make
> the Fedora /etc/init.d/kdump script happy.  kexec/kdump is my preferred
> method of dealing with kernel oopses if I can get it to work.

The Fedora 12 kernel-2.6.31-0.174.rc7.git2 kernel didn't help with
the kexec/kdump issue, so I may file a bug if I can't figure anything
out.

Also that kernel had a huge performance hit on my tests.  Where I
usually get ~100 Gbps of aggregate transmit performance, I was instead
getting a mere 3 Gbps, with individual streams only getting about
200 to 400 Mbps.  If I get a chance, I'll have to try the vanilla
version to see if it has the same issue (a vanilla 2.6.31-rc6 is
fine).

						-Thanks

						-Bill

^ permalink raw reply

* [PATCH 0/5] More const ops cleanups
From: Stephen Hemminger @ 2009-09-02  5:25 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Many places were not using const when defining/using structures
that only contain initialized values.

-- 


^ permalink raw reply

* [PATCH 2/5] net: seq_operations should be const
From: Stephen Hemminger @ 2009-09-02  5:25 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20090902052500.808557262@vyatta.com>

[-- Attachment #1: const-seq-ops.patch --]
[-- Type: text/plain, Size: 978 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


---
 net/ipv6/ip6mr.c |    2 +-
 net/key/af_key.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/net/ipv6/ip6mr.c	2009-09-01 21:37:24.504215187 -0700
+++ b/net/ipv6/ip6mr.c	2009-09-01 22:22:22.223174601 -0700
@@ -204,7 +204,7 @@ static int ip6mr_vif_seq_show(struct seq
 	return 0;
 }
 
-static struct seq_operations ip6mr_vif_seq_ops = {
+static const struct seq_operations ip6mr_vif_seq_ops = {
 	.start = ip6mr_vif_seq_start,
 	.next  = ip6mr_vif_seq_next,
 	.stop  = ip6mr_vif_seq_stop,
--- a/net/key/af_key.c	2009-09-01 21:37:24.520180026 -0700
+++ b/net/key/af_key.c	2009-09-01 22:22:22.230177877 -0700
@@ -3705,7 +3705,7 @@ static void pfkey_seq_stop(struct seq_fi
 	read_unlock(&pfkey_table_lock);
 }
 
-static struct seq_operations pfkey_seq_ops = {
+static const struct seq_operations pfkey_seq_ops = {
 	.start	= pfkey_seq_start,
 	.next	= pfkey_seq_next,
 	.stop	= pfkey_seq_stop,

-- 


^ permalink raw reply

* [PATCH 4/5] inet: inet_connection_sock_af_ops const
From: Stephen Hemminger @ 2009-09-02  5:25 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20090902052500.808557262@vyatta.com>

[-- Attachment #1: const-inet-connect-sock-af-ops.patch --]
[-- Type: text/plain, Size: 4169 bytes --]

The function block inet_connect_sock_af_ops contains no data
make it constant.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


---
 include/net/transp_v6.h |    2 +-
 net/dccp/ipv4.c         |    2 +-
 net/dccp/ipv6.c         |    8 ++++----
 net/ipv4/tcp_ipv4.c     |    2 +-
 net/ipv6/tcp_ipv6.c     |    8 ++++----
 5 files changed, 11 insertions(+), 11 deletions(-)

--- a/net/dccp/ipv4.c	2009-09-01 21:54:11.398740410 -0700
+++ b/net/dccp/ipv4.c	2009-09-01 21:55:22.254758800 -0700
@@ -880,7 +880,7 @@ discard_and_relse:
 	goto discard_it;
 }
 
-static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = {
+static const struct inet_connection_sock_af_ops dccp_ipv4_af_ops = {
 	.queue_xmit	   = ip_queue_xmit,
 	.send_check	   = dccp_v4_send_check,
 	.rebuild_header	   = inet_sk_rebuild_header,
--- a/net/dccp/ipv6.c	2009-09-01 21:54:11.414740438 -0700
+++ b/net/dccp/ipv6.c	2009-09-01 21:55:41.734738880 -0700
@@ -35,8 +35,8 @@
 
 /* The per-net dccp.v6_ctl_sk is used for sending RSTs and ACKs */
 
-static struct inet_connection_sock_af_ops dccp_ipv6_mapped;
-static struct inet_connection_sock_af_ops dccp_ipv6_af_ops;
+static const struct inet_connection_sock_af_ops dccp_ipv6_mapped;
+static const struct inet_connection_sock_af_ops dccp_ipv6_af_ops;
 
 static void dccp_v6_hash(struct sock *sk)
 {
@@ -1055,7 +1055,7 @@ failure:
 	return err;
 }
 
-static struct inet_connection_sock_af_ops dccp_ipv6_af_ops = {
+static const struct inet_connection_sock_af_ops dccp_ipv6_af_ops = {
 	.queue_xmit	   = inet6_csk_xmit,
 	.send_check	   = dccp_v6_send_check,
 	.rebuild_header	   = inet6_sk_rebuild_header,
@@ -1076,7 +1076,7 @@ static struct inet_connection_sock_af_op
 /*
  *	DCCP over IPv4 via INET6 API
  */
-static struct inet_connection_sock_af_ops dccp_ipv6_mapped = {
+static const struct inet_connection_sock_af_ops dccp_ipv6_mapped = {
 	.queue_xmit	   = ip_queue_xmit,
 	.send_check	   = dccp_v4_send_check,
 	.rebuild_header	   = inet_sk_rebuild_header,
--- a/net/ipv4/tcp_ipv4.c	2009-09-01 21:55:56.583740315 -0700
+++ b/net/ipv4/tcp_ipv4.c	2009-09-01 21:56:04.623737423 -0700
@@ -1754,7 +1754,7 @@ int tcp_v4_tw_remember_stamp(struct inet
 	return 0;
 }
 
-struct inet_connection_sock_af_ops ipv4_specific = {
+const struct inet_connection_sock_af_ops ipv4_specific = {
 	.queue_xmit	   = ip_queue_xmit,
 	.send_check	   = tcp_v4_send_check,
 	.rebuild_header	   = inet_sk_rebuild_header,
--- a/net/ipv6/tcp_ipv6.c	2009-09-01 21:55:56.599803712 -0700
+++ b/net/ipv6/tcp_ipv6.c	2009-09-01 21:56:23.615764198 -0700
@@ -75,8 +75,8 @@ static void	tcp_v6_reqsk_send_ack(struct
 
 static int	tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb);
 
-static struct inet_connection_sock_af_ops ipv6_mapped;
-static struct inet_connection_sock_af_ops ipv6_specific;
+static const struct inet_connection_sock_af_ops ipv6_mapped;
+static const struct inet_connection_sock_af_ops ipv6_specific;
 #ifdef CONFIG_TCP_MD5SIG
 static const struct tcp_sock_af_ops tcp_sock_ipv6_specific;
 static const struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific;
@@ -1760,7 +1760,7 @@ static int tcp_v6_remember_stamp(struct 
 	return 0;
 }
 
-static struct inet_connection_sock_af_ops ipv6_specific = {
+static const struct inet_connection_sock_af_ops ipv6_specific = {
 	.queue_xmit	   = inet6_csk_xmit,
 	.send_check	   = tcp_v6_send_check,
 	.rebuild_header	   = inet6_sk_rebuild_header,
@@ -1792,7 +1792,7 @@ static const struct tcp_sock_af_ops tcp_
  *	TCP over IPv4 via INET6 API
  */
 
-static struct inet_connection_sock_af_ops ipv6_mapped = {
+static const struct inet_connection_sock_af_ops ipv6_mapped = {
 	.queue_xmit	   = ip_queue_xmit,
 	.send_check	   = tcp_v4_send_check,
 	.rebuild_header	   = inet_sk_rebuild_header,
--- a/include/net/transp_v6.h	2009-09-01 21:59:47.126112194 -0700
+++ b/include/net/transp_v6.h	2009-09-01 21:59:55.797799523 -0700
@@ -51,7 +51,7 @@ extern int			datagram_send_ctl(struct ne
 /*
  *	address family specific functions
  */
-extern struct inet_connection_sock_af_ops ipv4_specific;
+extern const struct inet_connection_sock_af_ops ipv4_specific;
 
 extern void inet6_destroy_sock(struct sock *sk);
 

-- 


^ permalink raw reply

* [PATCH 3/5] tcp: MD5 operations should be const
From: Stephen Hemminger @ 2009-09-02  5:25 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20090902052500.808557262@vyatta.com>

[-- Attachment #1: const-md5-ops.patch --]
[-- Type: text/plain, Size: 3439 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


---
 include/linux/tcp.h |    6 +++---
 net/ipv4/tcp_ipv4.c |    4 ++--
 net/ipv6/tcp_ipv6.c |   10 +++++-----
 3 files changed, 10 insertions(+), 10 deletions(-)

--- a/include/linux/tcp.h	2009-09-01 21:45:24.022174846 -0700
+++ b/include/linux/tcp.h	2009-09-01 21:52:18.131739158 -0700
@@ -233,7 +233,7 @@ struct tcp_request_sock {
 	struct inet_request_sock 	req;
 #ifdef CONFIG_TCP_MD5SIG
 	/* Only used by TCP MD5 Signature so far. */
-	struct tcp_request_sock_ops	*af_specific;
+	const struct tcp_request_sock_ops *af_specific;
 #endif
 	u32			 	rcv_isn;
 	u32			 	snt_isn;
@@ -401,9 +401,9 @@ struct tcp_sock {
 
 #ifdef CONFIG_TCP_MD5SIG
 /* TCP AF-Specific parts; only used by MD5 Signature support so far */
-	struct tcp_sock_af_ops	*af_specific;
+	const struct tcp_sock_af_ops	*af_specific;
 
-/* TCP MD5 Signagure Option information */
+/* TCP MD5 Signature Option information */
 	struct tcp_md5sig_info	*md5sig_info;
 #endif
 };
--- a/net/ipv4/tcp_ipv4.c	2009-09-01 21:45:24.039229254 -0700
+++ b/net/ipv4/tcp_ipv4.c	2009-09-01 22:22:23.997230300 -0700
@@ -1195,7 +1195,7 @@ struct request_sock_ops tcp_request_sock
 };
 
 #ifdef CONFIG_TCP_MD5SIG
-static struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = {
+static const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = {
 	.md5_lookup	=	tcp_v4_reqsk_md5_lookup,
 	.calc_md5_hash	=	tcp_v4_md5_hash_skb,
 };
@@ -1774,7 +1774,7 @@ struct inet_connection_sock_af_ops ipv4_
 };
 
 #ifdef CONFIG_TCP_MD5SIG
-static struct tcp_sock_af_ops tcp_sock_ipv4_specific = {
+static const struct tcp_sock_af_ops tcp_sock_ipv4_specific = {
 	.md5_lookup		= tcp_v4_md5_lookup,
 	.calc_md5_hash		= tcp_v4_md5_hash_skb,
 	.md5_add		= tcp_v4_md5_add_func,
--- a/net/ipv6/tcp_ipv6.c	2009-09-01 21:45:24.055740485 -0700
+++ b/net/ipv6/tcp_ipv6.c	2009-09-01 22:22:23.988774018 -0700
@@ -78,8 +78,8 @@ static int	tcp_v6_do_rcv(struct sock *sk
 static struct inet_connection_sock_af_ops ipv6_mapped;
 static struct inet_connection_sock_af_ops ipv6_specific;
 #ifdef CONFIG_TCP_MD5SIG
-static struct tcp_sock_af_ops tcp_sock_ipv6_specific;
-static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific;
+static const struct tcp_sock_af_ops tcp_sock_ipv6_specific;
+static const struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific;
 #else
 static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk,
 						   struct in6_addr *addr)
@@ -894,7 +894,7 @@ struct request_sock_ops tcp6_request_soc
 };
 
 #ifdef CONFIG_TCP_MD5SIG
-static struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
+static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
 	.md5_lookup	=	tcp_v6_reqsk_md5_lookup,
 	.calc_md5_hash	=	tcp_v6_md5_hash_skb,
 };
@@ -1780,7 +1780,7 @@ static struct inet_connection_sock_af_op
 };
 
 #ifdef CONFIG_TCP_MD5SIG
-static struct tcp_sock_af_ops tcp_sock_ipv6_specific = {
+static const struct tcp_sock_af_ops tcp_sock_ipv6_specific = {
 	.md5_lookup	=	tcp_v6_md5_lookup,
 	.calc_md5_hash	=	tcp_v6_md5_hash_skb,
 	.md5_add	=	tcp_v6_md5_add_func,
@@ -1812,7 +1812,7 @@ static struct inet_connection_sock_af_op
 };
 
 #ifdef CONFIG_TCP_MD5SIG
-static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific = {
+static const struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific = {
 	.md5_lookup	=	tcp_v4_md5_lookup,
 	.calc_md5_hash	=	tcp_v4_md5_hash_skb,
 	.md5_add	=	tcp_v6_md5_add_func,

-- 


^ permalink raw reply

* [PATCH 1/5] netdev: drivers should make ethtool_ops const
From: Stephen Hemminger @ 2009-09-02  5:25 UTC (permalink / raw)
  To: David Miller, Roland Dreier
  Cc: netdev, linux-wireless, Dhananjay Phadke, David Brownell
In-Reply-To: <20090902052500.808557262@vyatta.com>

[-- Attachment #1: ethtool-ops-const --]
[-- Type: text/plain, Size: 25282 bytes --]

No need to put ethtool_ops in data, they should be const.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 arch/um/drivers/net_kern.c              |    2 +-
 drivers/firewire/net.c                  |    2 +-
 drivers/ieee1394/eth1394.c              |    2 +-
 drivers/infiniband/hw/nes/nes_nic.c     |    2 +-
 drivers/net/arm/ep93xx_eth.c            |    2 +-
 drivers/net/arm/ixp4xx_eth.c            |    2 +-
 drivers/net/arm/ks8695net.c             |    2 +-
 drivers/net/atl1c/atl1c_ethtool.c       |    2 +-
 drivers/net/atl1e/atl1e_ethtool.c       |    2 +-
 drivers/net/atlx/atl2.c                 |    2 +-
 drivers/net/benet/be.h                  |    2 +-
 drivers/net/benet/be_ethtool.c          |    2 +-
 drivers/net/bfin_mac.c                  |    2 +-
 drivers/net/bnx2x_main.c                |    2 +-
 drivers/net/enic/enic_main.c            |    2 +-
 drivers/net/igb/igb_ethtool.c           |    2 +-
 drivers/net/ipg.c                       |    2 +-
 drivers/net/korina.c                    |    2 +-
 drivers/net/ks8842.c                    |    2 +-
 drivers/net/macb.c                      |    2 +-
 drivers/net/netxen/netxen_nic.h         |    2 +-
 drivers/net/netxen/netxen_nic_ethtool.c |    2 +-
 drivers/net/ps3_gelic_net.c             |    2 +-
 drivers/net/ps3_gelic_wireless.c        |    2 +-
 drivers/net/sfc/ethtool.c               |    2 +-
 drivers/net/tehuti.c                    |    2 +-
 drivers/net/usb/asix.c                  |    4 ++--
 drivers/net/usb/catc.c                  |    2 +-
 drivers/net/usb/dm9601.c                |    2 +-
 drivers/net/usb/hso.c                   |    2 +-
 drivers/net/usb/kaweth.c                |    2 +-
 drivers/net/usb/mcs7830.c               |    2 +-
 drivers/net/usb/pegasus.c               |    2 +-
 drivers/net/usb/rtl8150.c               |    2 +-
 drivers/net/usb/smsc95xx.c              |    2 +-
 drivers/net/usb/usbnet.c                |    2 +-
 drivers/net/veth.c                      |    2 +-
 drivers/net/virtio_net.c                |    2 +-
 drivers/net/wireless/libertas/dev.h     |    2 +-
 drivers/net/wireless/libertas/ethtool.c |    2 +-
 drivers/net/xen-netfront.c              |    4 ++--
 drivers/s390/net/qeth_l2_main.c         |    4 ++--
 drivers/s390/net/qeth_l3_main.c         |    2 +-
 drivers/staging/at76_usb/at76_usb.c     |    2 +-
 drivers/staging/octeon/ethernet-mdio.c  |    2 +-
 drivers/staging/octeon/ethernet-mdio.h  |    2 +-
 drivers/staging/sxg/sxg.h               |    2 +-
 drivers/staging/sxg/sxg_ethtool.c       |    2 +-
 drivers/usb/gadget/u_ether.c            |    2 +-
 49 files changed, 52 insertions(+), 52 deletions(-)

--- a/arch/um/drivers/net_kern.c	2009-09-01 21:23:22.140759558 -0700
+++ b/arch/um/drivers/net_kern.c	2009-09-01 21:24:04.767783955 -0700
@@ -285,7 +285,7 @@ static void uml_net_get_drvinfo(struct n
 	strcpy(info->version, "42");
 }
 
-static struct ethtool_ops uml_net_ethtool_ops = {
+static const struct ethtool_ops uml_net_ethtool_ops = {
 	.get_drvinfo	= uml_net_get_drvinfo,
 	.get_link	= ethtool_op_get_link,
 };
--- a/drivers/firewire/net.c	2009-09-01 21:23:22.192204648 -0700
+++ b/drivers/firewire/net.c	2009-09-01 21:24:12.452795687 -0700
@@ -1342,7 +1342,7 @@ static void fwnet_get_drvinfo(struct net
 	strcpy(info->bus_info, "ieee1394");
 }
 
-static struct ethtool_ops fwnet_ethtool_ops = {
+static const struct ethtool_ops fwnet_ethtool_ops = {
 	.get_drvinfo = fwnet_get_drvinfo,
 };
 
--- a/drivers/ieee1394/eth1394.c	2009-09-01 21:23:22.225179879 -0700
+++ b/drivers/ieee1394/eth1394.c	2009-09-01 21:24:19.511858188 -0700
@@ -173,7 +173,7 @@ static netdev_tx_t ether1394_tx(struct s
 				struct net_device *dev);
 static void ether1394_iso(struct hpsb_iso *iso);
 
-static struct ethtool_ops ethtool_ops;
+static const struct ethtool_ops ethtool_ops;
 
 static int ether1394_write(struct hpsb_host *host, int srcid, int destid,
 			   quadlet_t *data, u64 addr, size_t len, u16 flags);
--- a/drivers/infiniband/hw/nes/nes_nic.c	2009-09-01 21:23:22.274178784 -0700
+++ b/drivers/infiniband/hw/nes/nes_nic.c	2009-09-01 21:24:33.351892895 -0700
@@ -1508,7 +1508,7 @@ static int nes_netdev_set_settings(struc
 }
 
 
-static struct ethtool_ops nes_ethtool_ops = {
+static const struct ethtool_ops nes_ethtool_ops = {
 	.get_link = ethtool_op_get_link,
 	.get_settings = nes_netdev_get_settings,
 	.set_settings = nes_netdev_set_settings,
--- a/drivers/net/arm/ep93xx_eth.c	2009-09-01 21:23:22.305179810 -0700
+++ b/drivers/net/arm/ep93xx_eth.c	2009-09-01 21:24:39.380961916 -0700
@@ -762,7 +762,7 @@ static u32 ep93xx_get_link(struct net_de
 	return mii_link_ok(&ep->mii);
 }
 
-static struct ethtool_ops ep93xx_ethtool_ops = {
+static const struct ethtool_ops ep93xx_ethtool_ops = {
 	.get_drvinfo		= ep93xx_get_drvinfo,
 	.get_settings		= ep93xx_get_settings,
 	.set_settings		= ep93xx_set_settings,
--- a/drivers/net/arm/ixp4xx_eth.c	2009-09-01 21:23:22.336175120 -0700
+++ b/drivers/net/arm/ixp4xx_eth.c	2009-09-01 21:24:45.928279805 -0700
@@ -802,7 +802,7 @@ static int ixp4xx_nway_reset(struct net_
 	return phy_start_aneg(port->phydev);
 }
 
-static struct ethtool_ops ixp4xx_ethtool_ops = {
+static const struct ethtool_ops ixp4xx_ethtool_ops = {
 	.get_drvinfo = ixp4xx_get_drvinfo,
 	.get_settings = ixp4xx_get_settings,
 	.set_settings = ixp4xx_set_settings,
--- a/drivers/net/arm/ks8695net.c	2009-09-01 21:23:22.367175272 -0700
+++ b/drivers/net/arm/ks8695net.c	2009-09-01 21:24:51.848932190 -0700
@@ -1063,7 +1063,7 @@ ks8695_get_drvinfo(struct net_device *nd
 		sizeof(info->bus_info));
 }
 
-static struct ethtool_ops ks8695_ethtool_ops = {
+static const struct ethtool_ops ks8695_ethtool_ops = {
 	.get_msglevel	= ks8695_get_msglevel,
 	.set_msglevel	= ks8695_set_msglevel,
 	.get_settings	= ks8695_get_settings,
--- a/drivers/net/atl1c/atl1c_ethtool.c	2009-09-01 21:23:22.398179343 -0700
+++ b/drivers/net/atl1c/atl1c_ethtool.c	2009-09-01 21:24:58.264953214 -0700
@@ -294,7 +294,7 @@ static int atl1c_nway_reset(struct net_d
 	return 0;
 }
 
-static struct ethtool_ops atl1c_ethtool_ops = {
+static const struct ethtool_ops atl1c_ethtool_ops = {
 	.get_settings           = atl1c_get_settings,
 	.set_settings           = atl1c_set_settings,
 	.get_drvinfo            = atl1c_get_drvinfo,
--- a/drivers/net/atl1e/atl1e_ethtool.c	2009-09-01 21:23:22.429737472 -0700
+++ b/drivers/net/atl1e/atl1e_ethtool.c	2009-09-01 21:25:06.161739683 -0700
@@ -378,7 +378,7 @@ static int atl1e_nway_reset(struct net_d
 	return 0;
 }
 
-static struct ethtool_ops atl1e_ethtool_ops = {
+static const struct ethtool_ops atl1e_ethtool_ops = {
 	.get_settings           = atl1e_get_settings,
 	.set_settings           = atl1e_set_settings,
 	.get_drvinfo            = atl1e_get_drvinfo,
--- a/drivers/net/atlx/atl2.c	2009-09-01 21:23:22.461737471 -0700
+++ b/drivers/net/atlx/atl2.c	2009-09-01 21:25:29.371737969 -0700
@@ -2094,7 +2094,7 @@ static int atl2_nway_reset(struct net_de
 	return 0;
 }
 
-static struct ethtool_ops atl2_ethtool_ops = {
+static const struct ethtool_ops atl2_ethtool_ops = {
 	.get_settings		= atl2_get_settings,
 	.set_settings		= atl2_set_settings,
 	.get_drvinfo		= atl2_get_drvinfo,
--- a/drivers/net/benet/be.h	2009-09-01 21:23:22.493739757 -0700
+++ b/drivers/net/benet/be.h	2009-09-01 21:25:44.899803221 -0700
@@ -259,7 +259,7 @@ struct be_adapter {
 	bool promiscuous;
 };
 
-extern struct ethtool_ops be_ethtool_ops;
+extern const struct ethtool_ops be_ethtool_ops;
 
 #define drvr_stats(adapter)		(&adapter->stats.drvr_stats)
 
--- a/drivers/net/benet/be_ethtool.c	2009-09-01 21:23:22.524737107 -0700
+++ b/drivers/net/benet/be_ethtool.c	2009-09-01 21:25:53.630800706 -0700
@@ -332,7 +332,7 @@ be_set_pauseparam(struct net_device *net
 	return status;
 }
 
-struct ethtool_ops be_ethtool_ops = {
+const struct ethtool_ops be_ethtool_ops = {
 	.get_settings = be_get_settings,
 	.get_drvinfo = be_get_drvinfo,
 	.get_link = ethtool_op_get_link,
--- a/drivers/net/bfin_mac.c	2009-09-01 21:23:22.555737483 -0700
+++ b/drivers/net/bfin_mac.c	2009-09-01 21:26:00.102325056 -0700
@@ -491,7 +491,7 @@ static void bfin_mac_ethtool_getdrvinfo(
 	strcpy(info->bus_info, dev_name(&dev->dev));
 }
 
-static struct ethtool_ops bfin_mac_ethtool_ops = {
+static const struct ethtool_ops bfin_mac_ethtool_ops = {
 	.get_settings = bfin_mac_ethtool_getsettings,
 	.set_settings = bfin_mac_ethtool_setsettings,
 	.get_link = ethtool_op_get_link,
--- a/drivers/net/bnx2x_main.c	2009-09-01 21:23:22.587737636 -0700
+++ b/drivers/net/bnx2x_main.c	2009-09-01 21:26:08.591759739 -0700
@@ -10606,7 +10606,7 @@ static int bnx2x_phys_id(struct net_devi
 	return 0;
 }
 
-static struct ethtool_ops bnx2x_ethtool_ops = {
+static const struct ethtool_ops bnx2x_ethtool_ops = {
 	.get_settings		= bnx2x_get_settings,
 	.set_settings		= bnx2x_set_settings,
 	.get_drvinfo		= bnx2x_get_drvinfo,
--- a/drivers/net/enic/enic_main.c	2009-09-01 21:23:22.618737189 -0700
+++ b/drivers/net/enic/enic_main.c	2009-09-01 21:26:14.917742055 -0700
@@ -256,7 +256,7 @@ static void enic_set_msglevel(struct net
 	enic->msg_enable = value;
 }
 
-static struct ethtool_ops enic_ethtool_ops = {
+static const struct ethtool_ops enic_ethtool_ops = {
 	.get_settings = enic_get_settings,
 	.get_drvinfo = enic_get_drvinfo,
 	.get_msglevel = enic_get_msglevel,
--- a/drivers/net/igb/igb_ethtool.c	2009-09-01 21:23:22.650737465 -0700
+++ b/drivers/net/igb/igb_ethtool.c	2009-09-01 21:26:20.874754655 -0700
@@ -2016,7 +2016,7 @@ static void igb_get_strings(struct net_d
 	}
 }
 
-static struct ethtool_ops igb_ethtool_ops = {
+static const struct ethtool_ops igb_ethtool_ops = {
 	.get_settings           = igb_get_settings,
 	.set_settings           = igb_set_settings,
 	.get_drvinfo            = igb_get_drvinfo,
--- a/drivers/net/ipg.c	2009-09-01 21:23:22.713737071 -0700
+++ b/drivers/net/ipg.c	2009-09-01 21:26:30.551740998 -0700
@@ -2186,7 +2186,7 @@ static int ipg_nway_reset(struct net_dev
 	return rc;
 }
 
-static struct ethtool_ops ipg_ethtool_ops = {
+static const struct ethtool_ops ipg_ethtool_ops = {
 	.get_settings = ipg_get_settings,
 	.set_settings = ipg_set_settings,
 	.nway_reset   = ipg_nway_reset,
--- a/drivers/net/korina.c	2009-09-01 21:23:22.745739152 -0700
+++ b/drivers/net/korina.c	2009-09-01 21:26:36.337830745 -0700
@@ -743,7 +743,7 @@ static u32 netdev_get_link(struct net_de
 	return mii_link_ok(&lp->mii_if);
 }
 
-static struct ethtool_ops netdev_ethtool_ops = {
+static const struct ethtool_ops netdev_ethtool_ops = {
 	.get_drvinfo            = netdev_get_drvinfo,
 	.get_settings           = netdev_get_settings,
 	.set_settings           = netdev_set_settings,
--- a/drivers/net/ks8842.c	2009-09-01 21:23:22.776738076 -0700
+++ b/drivers/net/ks8842.c	2009-09-01 21:26:42.541748592 -0700
@@ -619,7 +619,7 @@ static const struct net_device_ops ks884
 	.ndo_validate_addr	= eth_validate_addr
 };
 
-static struct ethtool_ops ks8842_ethtool_ops = {
+static const struct ethtool_ops ks8842_ethtool_ops = {
 	.get_link		= ethtool_op_get_link,
 };
 
--- a/drivers/net/macb.c	2009-09-01 21:23:22.812112323 -0700
+++ b/drivers/net/macb.c	2009-09-01 21:26:47.647878323 -0700
@@ -1079,7 +1079,7 @@ static void macb_get_drvinfo(struct net_
 	strcpy(info->bus_info, dev_name(&bp->pdev->dev));
 }
 
-static struct ethtool_ops macb_ethtool_ops = {
+static const struct ethtool_ops macb_ethtool_ops = {
 	.get_settings		= macb_get_settings,
 	.set_settings		= macb_set_settings,
 	.get_drvinfo		= macb_get_drvinfo,
--- a/drivers/net/netxen/netxen_nic.h	2009-09-01 21:23:22.844098830 -0700
+++ b/drivers/net/netxen/netxen_nic.h	2009-09-01 21:26:54.259228132 -0700
@@ -1410,6 +1410,6 @@ extern void netxen_change_ringparam(stru
 extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr,
 				int *valp);
 
-extern struct ethtool_ops netxen_nic_ethtool_ops;
+extern const struct ethtool_ops netxen_nic_ethtool_ops;
 
 #endif				/* __NETXEN_NIC_H_ */
--- a/drivers/net/netxen/netxen_nic_ethtool.c	2009-09-01 21:23:22.877777568 -0700
+++ b/drivers/net/netxen/netxen_nic_ethtool.c	2009-09-01 21:27:01.074946492 -0700
@@ -963,7 +963,7 @@ static int netxen_nic_set_flags(struct n
 	return 0;
 }
 
-struct ethtool_ops netxen_nic_ethtool_ops = {
+const struct ethtool_ops netxen_nic_ethtool_ops = {
 	.get_settings = netxen_nic_get_settings,
 	.set_settings = netxen_nic_set_settings,
 	.get_drvinfo = netxen_nic_get_drvinfo,
--- a/drivers/net/ps3_gelic_net.c	2009-09-01 21:23:22.909740667 -0700
+++ b/drivers/net/ps3_gelic_net.c	2009-09-01 21:27:08.779740619 -0700
@@ -1346,7 +1346,7 @@ done:
 	return status;
 }
 
-static struct ethtool_ops gelic_ether_ethtool_ops = {
+static const struct ethtool_ops gelic_ether_ethtool_ops = {
 	.get_drvinfo	= gelic_net_get_drvinfo,
 	.get_settings	= gelic_ether_get_settings,
 	.get_link	= ethtool_op_get_link,
--- a/drivers/net/ps3_gelic_wireless.c	2009-09-01 21:23:22.943207129 -0700
+++ b/drivers/net/ps3_gelic_wireless.c	2009-09-01 21:27:22.891080433 -0700
@@ -2714,7 +2714,7 @@ static const struct net_device_ops gelic
 #endif
 };
 
-static struct ethtool_ops gelic_wl_ethtool_ops = {
+static const struct ethtool_ops gelic_wl_ethtool_ops = {
 	.get_drvinfo	= gelic_net_get_drvinfo,
 	.get_link	= gelic_wl_get_link,
 	.get_tx_csum	= ethtool_op_get_tx_csum,
--- a/drivers/net/sfc/ethtool.c	2009-09-01 21:23:22.975775116 -0700
+++ b/drivers/net/sfc/ethtool.c	2009-09-01 21:27:31.123840332 -0700
@@ -731,7 +731,7 @@ static void efx_ethtool_get_pauseparam(s
 }
 
 
-struct ethtool_ops efx_ethtool_ops = {
+const struct ethtool_ops efx_ethtool_ops = {
 	.get_settings		= efx_ethtool_get_settings,
 	.set_settings		= efx_ethtool_set_settings,
 	.get_drvinfo		= efx_ethtool_get_drvinfo,
--- a/drivers/net/tehuti.c	2009-09-01 21:23:23.042174817 -0700
+++ b/drivers/net/tehuti.c	2009-09-01 21:27:52.563962512 -0700
@@ -2428,7 +2428,7 @@ static void bdx_get_ethtool_stats(struct
  */
 static void bdx_ethtool_ops(struct net_device *netdev)
 {
-	static struct ethtool_ops bdx_ethtool_ops = {
+	static const struct ethtool_ops bdx_ethtool_ops = {
 		.get_settings = bdx_get_settings,
 		.get_drvinfo = bdx_get_drvinfo,
 		.get_link = ethtool_op_get_link,
--- a/drivers/net/usb/asix.c	2009-09-01 21:23:23.075778923 -0700
+++ b/drivers/net/usb/asix.c	2009-09-01 21:28:10.900360956 -0700
@@ -731,7 +731,7 @@ static int asix_ioctl (struct net_device
 /* We need to override some ethtool_ops so we require our
    own structure so we don't interfere with other usbnet
    devices that may be connected at the same time. */
-static struct ethtool_ops ax88172_ethtool_ops = {
+static const struct ethtool_ops ax88172_ethtool_ops = {
 	.get_drvinfo		= asix_get_drvinfo,
 	.get_link		= asix_get_link,
 	.get_msglevel		= usbnet_get_msglevel,
@@ -873,7 +873,7 @@ out:
 	return ret;
 }
 
-static struct ethtool_ops ax88772_ethtool_ops = {
+static const struct ethtool_ops ax88772_ethtool_ops = {
 	.get_drvinfo		= asix_get_drvinfo,
 	.get_link		= asix_get_link,
 	.get_msglevel		= usbnet_get_msglevel,
--- a/drivers/net/usb/catc.c	2009-09-01 21:23:23.142740822 -0700
+++ b/drivers/net/usb/catc.c	2009-09-01 21:28:23.187998866 -0700
@@ -698,7 +698,7 @@ static int catc_get_settings(struct net_
 	return 0;
 }
 
-static struct ethtool_ops ops = {
+static const struct ethtool_ops ops = {
 	.get_drvinfo = catc_get_drvinfo,
 	.get_settings = catc_get_settings,
 	.get_link = ethtool_op_get_link
--- a/drivers/net/usb/dm9601.c	2009-09-01 21:23:23.174779035 -0700
+++ b/drivers/net/usb/dm9601.c	2009-09-01 21:28:27.970768780 -0700
@@ -356,7 +356,7 @@ static int dm9601_ioctl(struct net_devic
 	return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
 }
 
-static struct ethtool_ops dm9601_ethtool_ops = {
+static const struct ethtool_ops dm9601_ethtool_ops = {
 	.get_drvinfo	= dm9601_get_drvinfo,
 	.get_link	= dm9601_get_link,
 	.get_msglevel	= usbnet_get_msglevel,
--- a/drivers/net/usb/hso.c	2009-09-01 21:23:23.206924285 -0700
+++ b/drivers/net/usb/hso.c	2009-09-01 21:28:32.857738210 -0700
@@ -829,7 +829,7 @@ static void hso_get_drvinfo(struct net_d
 	usb_make_path(odev->parent->usb, info->bus_info, sizeof info->bus_info);
 }
 
-static struct ethtool_ops ops = {
+static const struct ethtool_ops ops = {
 	.get_drvinfo = hso_get_drvinfo,
 	.get_link = ethtool_op_get_link
 };
--- a/drivers/net/usb/kaweth.c	2009-09-01 21:23:23.240799685 -0700
+++ b/drivers/net/usb/kaweth.c	2009-09-01 21:28:37.504884609 -0700
@@ -778,7 +778,7 @@ static u32 kaweth_get_link(struct net_de
 	return kaweth->linkstate;
 }
 
-static struct ethtool_ops ops = {
+static const struct ethtool_ops ops = {
 	.get_drvinfo	= kaweth_get_drvinfo,
 	.get_link	= kaweth_get_link
 };
--- a/drivers/net/usb/mcs7830.c	2009-09-01 21:23:23.272740317 -0700
+++ b/drivers/net/usb/mcs7830.c	2009-09-01 21:28:42.591361634 -0700
@@ -449,7 +449,7 @@ static void mcs7830_get_regs(struct net_
 	mcs7830_get_reg(dev, 0, regs->len, data);
 }
 
-static struct ethtool_ops mcs7830_ethtool_ops = {
+static const struct ethtool_ops mcs7830_ethtool_ops = {
 	.get_drvinfo		= mcs7830_get_drvinfo,
 	.get_regs_len		= mcs7830_get_regs_len,
 	.get_regs		= mcs7830_get_regs,
--- a/drivers/net/usb/pegasus.c	2009-09-01 21:23:23.305799714 -0700
+++ b/drivers/net/usb/pegasus.c	2009-09-01 21:28:51.980749292 -0700
@@ -1174,7 +1174,7 @@ static void pegasus_set_msglevel(struct 
 	pegasus->msg_enable = v;
 }
 
-static struct ethtool_ops ops = {
+static const struct ethtool_ops ops = {
 	.get_drvinfo = pegasus_get_drvinfo,
 	.get_settings = pegasus_get_settings,
 	.set_settings = pegasus_set_settings,
--- a/drivers/net/usb/rtl8150.c	2009-09-01 21:23:23.337740661 -0700
+++ b/drivers/net/usb/rtl8150.c	2009-09-01 21:28:56.895273704 -0700
@@ -865,7 +865,7 @@ static int rtl8150_get_settings(struct n
 	return 0;
 }
 
-static struct ethtool_ops ops = {
+static const struct ethtool_ops ops = {
 	.get_drvinfo = rtl8150_get_drvinfo,
 	.get_settings = rtl8150_get_settings,
 	.get_link = ethtool_op_get_link
--- a/drivers/net/usb/smsc95xx.c	2009-09-01 21:23:23.369801502 -0700
+++ b/drivers/net/usb/smsc95xx.c	2009-09-01 21:29:00.964124094 -0700
@@ -625,7 +625,7 @@ static int smsc95xx_ethtool_set_tx_csum(
 	return smsc95xx_set_csums(dev);
 }
 
-static struct ethtool_ops smsc95xx_ethtool_ops = {
+static const struct ethtool_ops smsc95xx_ethtool_ops = {
 	.get_link	= usbnet_get_link,
 	.nway_reset	= usbnet_nway_reset,
 	.get_drvinfo	= usbnet_get_drvinfo,
--- a/drivers/net/usb/usbnet.c	2009-09-01 21:23:23.401801199 -0700
+++ b/drivers/net/usb/usbnet.c	2009-09-01 21:29:08.106772310 -0700
@@ -854,7 +854,7 @@ void usbnet_set_msglevel (struct net_dev
 EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
 
 /* drivers may override default ethtool_ops in their bind() routine */
-static struct ethtool_ops usbnet_ethtool_ops = {
+static const struct ethtool_ops usbnet_ethtool_ops = {
 	.get_settings		= usbnet_get_settings,
 	.set_settings		= usbnet_set_settings,
 	.get_link		= usbnet_get_link,
--- a/drivers/net/veth.c	2009-09-01 21:23:23.433800886 -0700
+++ b/drivers/net/veth.c	2009-09-01 21:29:12.191020944 -0700
@@ -129,7 +129,7 @@ static int veth_set_tx_csum(struct net_d
 	return 0;
 }
 
-static struct ethtool_ops veth_ethtool_ops = {
+static const struct ethtool_ops veth_ethtool_ops = {
 	.get_settings		= veth_get_settings,
 	.get_drvinfo		= veth_get_drvinfo,
 	.get_link		= ethtool_op_get_link,
--- a/drivers/net/virtio_net.c	2009-09-01 21:23:23.465800230 -0700
+++ b/drivers/net/virtio_net.c	2009-09-01 21:29:16.754013613 -0700
@@ -798,7 +798,7 @@ static void virtnet_vlan_rx_kill_vid(str
 		dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid);
 }
 
-static struct ethtool_ops virtnet_ethtool_ops = {
+static const struct ethtool_ops virtnet_ethtool_ops = {
 	.set_tx_csum = virtnet_set_tx_csum,
 	.set_sg = ethtool_op_set_sg,
 	.set_tso = ethtool_op_set_tso,
--- a/drivers/net/wireless/libertas/dev.h	2009-09-01 21:23:23.499800950 -0700
+++ b/drivers/net/wireless/libertas/dev.h	2009-09-01 21:29:21.529757543 -0700
@@ -14,7 +14,7 @@
 #include "defs.h"
 #include "hostcmd.h"
 
-extern struct ethtool_ops lbs_ethtool_ops;
+extern const struct ethtool_ops lbs_ethtool_ops;
 
 #define	MAX_BSSID_PER_CHANNEL		16
 
--- a/drivers/net/wireless/libertas/ethtool.c	2009-09-01 21:23:23.532780220 -0700
+++ b/drivers/net/wireless/libertas/ethtool.c	2009-09-01 21:29:28.396212516 -0700
@@ -183,7 +183,7 @@ static int lbs_ethtool_set_wol(struct ne
 	return lbs_host_sleep_cfg(priv, criteria, (struct wol_config *)NULL);
 }
 
-struct ethtool_ops lbs_ethtool_ops = {
+const struct ethtool_ops lbs_ethtool_ops = {
 	.get_drvinfo = lbs_ethtool_get_drvinfo,
 	.get_eeprom =  lbs_ethtool_get_eeprom,
 	.get_eeprom_len = lbs_ethtool_get_eeprom_len,
--- a/drivers/net/xen-netfront.c	2009-09-01 21:23:23.565740506 -0700
+++ b/drivers/net/xen-netfront.c	2009-09-01 21:29:39.899887569 -0700
@@ -51,7 +51,7 @@
 #include <xen/interface/memory.h>
 #include <xen/interface/grant_table.h>
 
-static struct ethtool_ops xennet_ethtool_ops;
+static const struct ethtool_ops xennet_ethtool_ops;
 
 struct netfront_cb {
 	struct page *page;
@@ -1627,7 +1627,7 @@ static void backend_changed(struct xenbu
 	}
 }
 
-static struct ethtool_ops xennet_ethtool_ops =
+static const struct ethtool_ops xennet_ethtool_ops =
 {
 	.set_tx_csum = ethtool_op_set_tx_csum,
 	.set_sg = xennet_set_sg,
--- a/drivers/s390/net/qeth_l2_main.c	2009-09-01 21:23:23.614740730 -0700
+++ b/drivers/s390/net/qeth_l2_main.c	2009-09-01 21:29:48.813744958 -0700
@@ -863,7 +863,7 @@ static void qeth_l2_remove_device(struct
 	return;
 }
 
-static struct ethtool_ops qeth_l2_ethtool_ops = {
+static const struct ethtool_ops qeth_l2_ethtool_ops = {
 	.get_link = ethtool_op_get_link,
 	.get_strings = qeth_core_get_strings,
 	.get_ethtool_stats = qeth_core_get_ethtool_stats,
@@ -872,7 +872,7 @@ static struct ethtool_ops qeth_l2_ethtoo
 	.get_settings = qeth_core_ethtool_get_settings,
 };
 
-static struct ethtool_ops qeth_l2_osn_ops = {
+static const struct ethtool_ops qeth_l2_osn_ops = {
 	.get_strings = qeth_core_get_strings,
 	.get_ethtool_stats = qeth_core_get_ethtool_stats,
 	.get_stats_count = qeth_core_get_stats_count,
--- a/drivers/s390/net/qeth_l3_main.c	2009-09-01 21:23:23.665740346 -0700
+++ b/drivers/s390/net/qeth_l3_main.c	2009-09-01 21:29:58.282953727 -0700
@@ -2946,7 +2946,7 @@ static int qeth_l3_ethtool_set_tso(struc
 	return 0;
 }
 
-static struct ethtool_ops qeth_l3_ethtool_ops = {
+static const struct ethtool_ops qeth_l3_ethtool_ops = {
 	.get_link = ethtool_op_get_link,
 	.get_tx_csum = ethtool_op_get_tx_csum,
 	.set_tx_csum = ethtool_op_set_tx_hw_csum,
--- a/drivers/staging/at76_usb/at76_usb.c	2009-09-01 21:23:23.729799604 -0700
+++ b/drivers/staging/at76_usb/at76_usb.c	2009-09-01 21:30:08.712050545 -0700
@@ -3396,7 +3396,7 @@ static u32 at76_ethtool_get_link(struct 
 	return priv->mac_state == MAC_CONNECTED;
 }
 
-static struct ethtool_ops at76_ethtool_ops = {
+static const struct ethtool_ops at76_ethtool_ops = {
 	.get_drvinfo = at76_ethtool_get_drvinfo,
 	.get_link = at76_ethtool_get_link,
 };
--- a/drivers/staging/octeon/ethernet-mdio.c	2009-09-01 21:23:23.762799959 -0700
+++ b/drivers/staging/octeon/ethernet-mdio.c	2009-09-01 21:30:12.140749658 -0700
@@ -170,7 +170,7 @@ static u32 cvm_oct_get_link(struct net_d
 	return ret;
 }
 
-struct ethtool_ops cvm_oct_ethtool_ops = {
+struct const ethtool_ops cvm_oct_ethtool_ops = {
 	.get_drvinfo = cvm_oct_get_drvinfo,
 	.get_settings = cvm_oct_get_settings,
 	.set_settings = cvm_oct_set_settings,
--- a/drivers/staging/octeon/ethernet-mdio.h	2009-09-01 21:23:23.794740804 -0700
+++ b/drivers/staging/octeon/ethernet-mdio.h	2009-09-01 21:30:16.177000766 -0700
@@ -41,6 +41,6 @@
 #include <net/xfrm.h>
 #endif /* CONFIG_XFRM */
 
-extern struct ethtool_ops cvm_oct_ethtool_ops;
+extern const struct ethtool_ops cvm_oct_ethtool_ops;
 int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 int cvm_oct_mdio_setup_device(struct net_device *dev);
--- a/drivers/staging/sxg/sxg.h	2009-09-01 21:23:23.826800190 -0700
+++ b/drivers/staging/sxg/sxg.h	2009-09-01 21:30:21.450752540 -0700
@@ -782,6 +782,6 @@ struct slic_crash_info {
 #define SIOCSLICSETINTAGG        (SIOCDEVPRIVATE+10)
 #define SIOCSLICTRACEDUMP        (SIOCDEVPRIVATE+11)
 
-extern struct ethtool_ops sxg_nic_ethtool_ops;
+extern const struct ethtool_ops sxg_nic_ethtool_ops;
 #define SXG_COMPLETE_SLOW_SEND_LIMIT	128
 #endif /*  __SXG_DRIVER_H__ */
--- a/drivers/staging/sxg/sxg_ethtool.c	2009-09-01 21:23:23.858740712 -0700
+++ b/drivers/staging/sxg/sxg_ethtool.c	2009-09-01 21:30:27.490902621 -0700
@@ -300,7 +300,7 @@ static int sxg_nic_get_eeprom(struct net
 	return 0;
 }
 
-struct ethtool_ops sxg_nic_ethtool_ops = {
+const struct ethtool_ops sxg_nic_ethtool_ops = {
 	.get_settings = sxg_nic_get_settings,
 	.set_settings = sxg_nic_set_settings,
 	.get_drvinfo = sxg_nic_get_drvinfo,
--- a/drivers/usb/gadget/u_ether.c	2009-09-01 21:23:23.890775071 -0700
+++ b/drivers/usb/gadget/u_ether.c	2009-09-01 21:30:36.693948879 -0700
@@ -181,7 +181,7 @@ static void eth_get_drvinfo(struct net_d
  *   - ... probably more ethtool ops
  */
 
-static struct ethtool_ops ops = {
+static const struct ethtool_ops ops = {
 	.get_drvinfo = eth_get_drvinfo,
 	.get_link = ethtool_op_get_link,
 };

-- 


^ permalink raw reply

* Re: [PATCH 14/19] tulip: convert drivers to netdev_tx_t
From: Grant Grundler @ 2009-09-02  5:48 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev, Grant Grundler, Kyle McMartin
In-Reply-To: <20090901055129.814907029@vyatta.com>

On Mon, Aug 31, 2009 at 10:50:53PM -0700, Stephen Hemminger wrote:
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> ---
>  drivers/net/tulip/de2104x.c     |    3 ++-
>  drivers/net/tulip/de4x5.c       |   11 +++++------
>  drivers/net/tulip/dmfe.c        |    5 +++--
>  drivers/net/tulip/tulip_core.c  |    5 +++--
>  drivers/net/tulip/uli526x.c     |    6 ++++--
>  drivers/net/tulip/winbond-840.c |    4 ++--
>  drivers/net/tulip/xircom_cb.c   |    6 ++++--
>  7 files changed, 23 insertions(+), 17 deletions(-)
> 
> --- a/drivers/net/tulip/de2104x.c	2009-08-29 23:10:19.609527457 -0700
> +++ b/drivers/net/tulip/de2104x.c	2009-08-29 23:12:54.117527675 -0700
> @@ -599,7 +599,8 @@ next:
>  		netif_wake_queue(de->dev);
>  }
>  
> -static int de_start_xmit (struct sk_buff *skb, struct net_device *dev)
> +static netdev_tx_t de_start_xmit (struct sk_buff *skb,
> +					struct net_device *dev)

Stephen,
The patches look harmless and I'm inclined to ACK them...but google can't find
any context or explanation for "netdev_tx_t". URL to email which proposed
netdev_tx_t?

thanks,
grant
>  {
>  	struct de_private *de = netdev_priv(dev);
>  	unsigned int entry, tx_free;
> --- a/drivers/net/tulip/de4x5.c	2009-08-29 23:10:19.553491700 -0700
> +++ b/drivers/net/tulip/de4x5.c	2009-08-29 23:12:54.125526807 -0700
> @@ -895,7 +895,8 @@ static struct {
>  ** Public Functions
>  */
>  static int     de4x5_open(struct net_device *dev);
> -static int     de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev);
> +static netdev_tx_t de4x5_queue_pkt(struct sk_buff *skb,
> +					 struct net_device *dev);
>  static irqreturn_t de4x5_interrupt(int irq, void *dev_id);
>  static int     de4x5_close(struct net_device *dev);
>  static struct  net_device_stats *de4x5_get_stats(struct net_device *dev);
> @@ -1456,18 +1457,16 @@ de4x5_sw_reset(struct net_device *dev)
>  /*
>  ** Writes a socket buffer address to the next available transmit descriptor.
>  */
> -static int
> +static netdev_tx_t
>  de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev)
>  {
>      struct de4x5_private *lp = netdev_priv(dev);
>      u_long iobase = dev->base_addr;
> -    int status = NETDEV_TX_OK;
>      u_long flags = 0;
>  
>      netif_stop_queue(dev);
> -    if (!lp->tx_enable) {                   /* Cannot send for now */
> +    if (!lp->tx_enable)                   /* Cannot send for now */
>  	return NETDEV_TX_LOCKED;
> -    }
>  
>      /*
>      ** Clean out the TX ring asynchronously to interrupts - sometimes the
> @@ -1521,7 +1520,7 @@ de4x5_queue_pkt(struct sk_buff *skb, str
>  
>      lp->cache.lock = 0;
>  
> -    return status;
> +    return NETDEV_TX_OK;
>  }
>  
>  /*
> --- a/drivers/net/tulip/dmfe.c	2009-08-29 23:10:19.521492310 -0700
> +++ b/drivers/net/tulip/dmfe.c	2009-08-29 23:12:54.129527736 -0700
> @@ -311,7 +311,7 @@ static u8 SF_mode;		/* Special Function:
>  
>  /* function declaration ------------------------------------- */
>  static int dmfe_open(struct DEVICE *);
> -static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *);
> +static netdev_tx_t dmfe_start_xmit(struct sk_buff *, struct DEVICE *);
>  static int dmfe_stop(struct DEVICE *);
>  static void dmfe_set_filter_mode(struct DEVICE *);
>  static const struct ethtool_ops netdev_ethtool_ops;
> @@ -661,7 +661,8 @@ static void dmfe_init_dm910x(struct DEVI
>   *	Send a packet to media from the upper layer.
>   */
>  
> -static int dmfe_start_xmit(struct sk_buff *skb, struct DEVICE *dev)
> +static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb,
> +					 struct DEVICE *dev)
>  {
>  	struct dmfe_board_info *db = netdev_priv(dev);
>  	struct tx_desc *txptr;
> --- a/drivers/net/tulip/tulip_core.c	2009-08-29 23:10:19.589491808 -0700
> +++ b/drivers/net/tulip/tulip_core.c	2009-08-29 23:12:54.129527736 -0700
> @@ -256,7 +256,8 @@ const char tulip_media_cap[32] =
>  static void tulip_tx_timeout(struct net_device *dev);
>  static void tulip_init_ring(struct net_device *dev);
>  static void tulip_free_ring(struct net_device *dev);
> -static int tulip_start_xmit(struct sk_buff *skb, struct net_device *dev);
> +static netdev_tx_t tulip_start_xmit(struct sk_buff *skb,
> +					  struct net_device *dev);
>  static int tulip_open(struct net_device *dev);
>  static int tulip_close(struct net_device *dev);
>  static void tulip_up(struct net_device *dev);
> @@ -645,7 +646,7 @@ static void tulip_init_ring(struct net_d
>  	tp->tx_ring[i-1].buffer2 = cpu_to_le32(tp->tx_ring_dma);
>  }
>  
> -static int
> +static netdev_tx_t
>  tulip_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  {
>  	struct tulip_private *tp = netdev_priv(dev);
> --- a/drivers/net/tulip/uli526x.c	2009-08-29 23:10:19.637530461 -0700
> +++ b/drivers/net/tulip/uli526x.c	2009-08-29 23:12:54.133492067 -0700
> @@ -215,7 +215,8 @@ static int mode = 8;
>  
>  /* function declaration ------------------------------------- */
>  static int uli526x_open(struct net_device *);
> -static int uli526x_start_xmit(struct sk_buff *, struct net_device *);
> +static netdev_tx_t uli526x_start_xmit(struct sk_buff *,
> +					    struct net_device *);
>  static int uli526x_stop(struct net_device *);
>  static void uli526x_set_filter_mode(struct net_device *);
>  static const struct ethtool_ops netdev_ethtool_ops;
> @@ -567,7 +568,8 @@ static void uli526x_init(struct net_devi
>   *	Send a packet to media from the upper layer.
>   */
>  
> -static int uli526x_start_xmit(struct sk_buff *skb, struct net_device *dev)
> +static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb,
> +					    struct net_device *dev)
>  {
>  	struct uli526x_board_info *db = netdev_priv(dev);
>  	struct tx_desc *txptr;
> --- a/drivers/net/tulip/winbond-840.c	2009-08-29 23:10:19.537492110 -0700
> +++ b/drivers/net/tulip/winbond-840.c	2009-08-29 23:12:54.133492067 -0700
> @@ -333,7 +333,7 @@ static void init_registers(struct net_de
>  static void tx_timeout(struct net_device *dev);
>  static int alloc_ringdesc(struct net_device *dev);
>  static void free_ringdesc(struct netdev_private *np);
> -static int  start_tx(struct sk_buff *skb, struct net_device *dev);
> +static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev);
>  static irqreturn_t intr_handler(int irq, void *dev_instance);
>  static void netdev_error(struct net_device *dev, int intr_status);
>  static int  netdev_rx(struct net_device *dev);
> @@ -997,7 +997,7 @@ static void free_ringdesc(struct netdev_
>  
>  }
>  
> -static int start_tx(struct sk_buff *skb, struct net_device *dev)
> +static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
>  {
>  	struct netdev_private *np = netdev_priv(dev);
>  	unsigned entry;
> --- a/drivers/net/tulip/xircom_cb.c	2009-08-29 23:10:19.505491812 -0700
> +++ b/drivers/net/tulip/xircom_cb.c	2009-08-29 23:12:54.137512691 -0700
> @@ -113,7 +113,8 @@ struct xircom_private {
>  static int xircom_probe(struct pci_dev *pdev, const struct pci_device_id *id);
>  static void xircom_remove(struct pci_dev *pdev);
>  static irqreturn_t xircom_interrupt(int irq, void *dev_instance);
> -static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev);
> +static netdev_tx_t xircom_start_xmit(struct sk_buff *skb,
> +					   struct net_device *dev);
>  static int xircom_open(struct net_device *dev);
>  static int xircom_close(struct net_device *dev);
>  static void xircom_up(struct xircom_private *card);
> @@ -384,7 +385,8 @@ static irqreturn_t xircom_interrupt(int 
>  	return IRQ_HANDLED;
>  }
>  
> -static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev)
> +static netdev_tx_t xircom_start_xmit(struct sk_buff *skb,
> +					   struct net_device *dev)
>  {
>  	struct xircom_private *card;
>  	unsigned long flags;
> 
> -- 

^ permalink raw reply

* Re: [PATCH 14/19] tulip: convert drivers to netdev_tx_t
From: Stephen Hemminger @ 2009-09-02  6:04 UTC (permalink / raw)
  To: Grant Grundler; +Cc: David Miller, netdev, Grant Grundler, Kyle McMartin
In-Reply-To: <20090902054801.GB28972@lackof.org>

On Tue, 1 Sep 2009 23:48:01 -0600
Grant Grundler <grundler@parisc-linux.org> wrote:

> On Mon, Aug 31, 2009 at 10:50:53PM -0700, Stephen Hemminger wrote:
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> > ---
> >  drivers/net/tulip/de2104x.c     |    3 ++-
> >  drivers/net/tulip/de4x5.c       |   11 +++++------
> >  drivers/net/tulip/dmfe.c        |    5 +++--
> >  drivers/net/tulip/tulip_core.c  |    5 +++--
> >  drivers/net/tulip/uli526x.c     |    6 ++++--
> >  drivers/net/tulip/winbond-840.c |    4 ++--
> >  drivers/net/tulip/xircom_cb.c   |    6 ++++--
> >  7 files changed, 23 insertions(+), 17 deletions(-)
> > 
> > --- a/drivers/net/tulip/de2104x.c	2009-08-29 23:10:19.609527457 -0700
> > +++ b/drivers/net/tulip/de2104x.c	2009-08-29 23:12:54.117527675 -0700
> > @@ -599,7 +599,8 @@ next:
> >  		netif_wake_queue(de->dev);
> >  }
> >  
> > -static int de_start_xmit (struct sk_buff *skb, struct net_device *dev)
> > +static netdev_tx_t de_start_xmit (struct sk_buff *skb,
> > +					struct net_device *dev)
> 
> Stephen,
> The patches look harmless and I'm inclined to ACK them...but google can't find
> any context or explanation for "netdev_tx_t". URL to email which proposed
> netdev_tx_t?
> 
> thanks,
> grant

>From patch series intro:

> This is a little change over a lot of files. It changes the
> return value of network device transmit from an integer to
> an enum type (like irqreturn_t).  This allows compiler to warn
> about stupid code that tries to return -ENOBUFS or other mistakes
> like that. All the code that did that is gone, but it would
> be better to try and do some decent type checking.
> 
> This patch converts all the x86 drivers (except staging).
> Other drivers will work but produce a warning until converted.

^ permalink raw reply

* Re: [PATCH 14/19] tulip: convert drivers to netdev_tx_t
From: Grant Grundler @ 2009-09-02  6:08 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev, Kyle McMartin
In-Reply-To: <20090902054801.GB28972@lackof.org>

On Tue, Sep 01, 2009 at 11:48:01PM -0600, Grant Grundler wrote:
> On Mon, Aug 31, 2009 at 10:50:53PM -0700, Stephen Hemminger wrote:
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> > ---
> >  drivers/net/tulip/de2104x.c     |    3 ++-
> >  drivers/net/tulip/de4x5.c       |   11 +++++------
> >  drivers/net/tulip/dmfe.c        |    5 +++--
> >  drivers/net/tulip/tulip_core.c  |    5 +++--
> >  drivers/net/tulip/uli526x.c     |    6 ++++--
> >  drivers/net/tulip/winbond-840.c |    4 ++--
> >  drivers/net/tulip/xircom_cb.c   |    6 ++++--
> >  7 files changed, 23 insertions(+), 17 deletions(-)
> > 
> > --- a/drivers/net/tulip/de2104x.c	2009-08-29 23:10:19.609527457 -0700
> > +++ b/drivers/net/tulip/de2104x.c	2009-08-29 23:12:54.117527675 -0700
> > @@ -599,7 +599,8 @@ next:
> >  		netif_wake_queue(de->dev);
> >  }
> >  
> > -static int de_start_xmit (struct sk_buff *skb, struct net_device *dev)
> > +static netdev_tx_t de_start_xmit (struct sk_buff *skb,
> > +					struct net_device *dev)
> 
> Stephen,
> The patches look harmless and I'm inclined to ACK them...but google can't find
> any context or explanation for "netdev_tx_t". URL to email which proposed
> netdev_tx_t?

Finally found it...archives just had to catch up:
    http://thread.gmane.org/gmane.linux.network/136658/

ACKed-by: Grant Grundler <grundler@parisc-linux.org>

thanks,
grant

> 
> thanks,
> grant
> >  {
> >  	struct de_private *de = netdev_priv(dev);
> >  	unsigned int entry, tx_free;
> > --- a/drivers/net/tulip/de4x5.c	2009-08-29 23:10:19.553491700 -0700
> > +++ b/drivers/net/tulip/de4x5.c	2009-08-29 23:12:54.125526807 -0700
> > @@ -895,7 +895,8 @@ static struct {
> >  ** Public Functions
> >  */
> >  static int     de4x5_open(struct net_device *dev);
> > -static int     de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev);
> > +static netdev_tx_t de4x5_queue_pkt(struct sk_buff *skb,
> > +					 struct net_device *dev);
> >  static irqreturn_t de4x5_interrupt(int irq, void *dev_id);
> >  static int     de4x5_close(struct net_device *dev);
> >  static struct  net_device_stats *de4x5_get_stats(struct net_device *dev);
> > @@ -1456,18 +1457,16 @@ de4x5_sw_reset(struct net_device *dev)
> >  /*
> >  ** Writes a socket buffer address to the next available transmit descriptor.
> >  */
> > -static int
> > +static netdev_tx_t
> >  de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev)
> >  {
> >      struct de4x5_private *lp = netdev_priv(dev);
> >      u_long iobase = dev->base_addr;
> > -    int status = NETDEV_TX_OK;
> >      u_long flags = 0;
> >  
> >      netif_stop_queue(dev);
> > -    if (!lp->tx_enable) {                   /* Cannot send for now */
> > +    if (!lp->tx_enable)                   /* Cannot send for now */
> >  	return NETDEV_TX_LOCKED;
> > -    }
> >  
> >      /*
> >      ** Clean out the TX ring asynchronously to interrupts - sometimes the
> > @@ -1521,7 +1520,7 @@ de4x5_queue_pkt(struct sk_buff *skb, str
> >  
> >      lp->cache.lock = 0;
> >  
> > -    return status;
> > +    return NETDEV_TX_OK;
> >  }
> >  
> >  /*
> > --- a/drivers/net/tulip/dmfe.c	2009-08-29 23:10:19.521492310 -0700
> > +++ b/drivers/net/tulip/dmfe.c	2009-08-29 23:12:54.129527736 -0700
> > @@ -311,7 +311,7 @@ static u8 SF_mode;		/* Special Function:
> >  
> >  /* function declaration ------------------------------------- */
> >  static int dmfe_open(struct DEVICE *);
> > -static int dmfe_start_xmit(struct sk_buff *, struct DEVICE *);
> > +static netdev_tx_t dmfe_start_xmit(struct sk_buff *, struct DEVICE *);
> >  static int dmfe_stop(struct DEVICE *);
> >  static void dmfe_set_filter_mode(struct DEVICE *);
> >  static const struct ethtool_ops netdev_ethtool_ops;
> > @@ -661,7 +661,8 @@ static void dmfe_init_dm910x(struct DEVI
> >   *	Send a packet to media from the upper layer.
> >   */
> >  
> > -static int dmfe_start_xmit(struct sk_buff *skb, struct DEVICE *dev)
> > +static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb,
> > +					 struct DEVICE *dev)
> >  {
> >  	struct dmfe_board_info *db = netdev_priv(dev);
> >  	struct tx_desc *txptr;
> > --- a/drivers/net/tulip/tulip_core.c	2009-08-29 23:10:19.589491808 -0700
> > +++ b/drivers/net/tulip/tulip_core.c	2009-08-29 23:12:54.129527736 -0700
> > @@ -256,7 +256,8 @@ const char tulip_media_cap[32] =
> >  static void tulip_tx_timeout(struct net_device *dev);
> >  static void tulip_init_ring(struct net_device *dev);
> >  static void tulip_free_ring(struct net_device *dev);
> > -static int tulip_start_xmit(struct sk_buff *skb, struct net_device *dev);
> > +static netdev_tx_t tulip_start_xmit(struct sk_buff *skb,
> > +					  struct net_device *dev);
> >  static int tulip_open(struct net_device *dev);
> >  static int tulip_close(struct net_device *dev);
> >  static void tulip_up(struct net_device *dev);
> > @@ -645,7 +646,7 @@ static void tulip_init_ring(struct net_d
> >  	tp->tx_ring[i-1].buffer2 = cpu_to_le32(tp->tx_ring_dma);
> >  }
> >  
> > -static int
> > +static netdev_tx_t
> >  tulip_start_xmit(struct sk_buff *skb, struct net_device *dev)
> >  {
> >  	struct tulip_private *tp = netdev_priv(dev);
> > --- a/drivers/net/tulip/uli526x.c	2009-08-29 23:10:19.637530461 -0700
> > +++ b/drivers/net/tulip/uli526x.c	2009-08-29 23:12:54.133492067 -0700
> > @@ -215,7 +215,8 @@ static int mode = 8;
> >  
> >  /* function declaration ------------------------------------- */
> >  static int uli526x_open(struct net_device *);
> > -static int uli526x_start_xmit(struct sk_buff *, struct net_device *);
> > +static netdev_tx_t uli526x_start_xmit(struct sk_buff *,
> > +					    struct net_device *);
> >  static int uli526x_stop(struct net_device *);
> >  static void uli526x_set_filter_mode(struct net_device *);
> >  static const struct ethtool_ops netdev_ethtool_ops;
> > @@ -567,7 +568,8 @@ static void uli526x_init(struct net_devi
> >   *	Send a packet to media from the upper layer.
> >   */
> >  
> > -static int uli526x_start_xmit(struct sk_buff *skb, struct net_device *dev)
> > +static netdev_tx_t uli526x_start_xmit(struct sk_buff *skb,
> > +					    struct net_device *dev)
> >  {
> >  	struct uli526x_board_info *db = netdev_priv(dev);
> >  	struct tx_desc *txptr;
> > --- a/drivers/net/tulip/winbond-840.c	2009-08-29 23:10:19.537492110 -0700
> > +++ b/drivers/net/tulip/winbond-840.c	2009-08-29 23:12:54.133492067 -0700
> > @@ -333,7 +333,7 @@ static void init_registers(struct net_de
> >  static void tx_timeout(struct net_device *dev);
> >  static int alloc_ringdesc(struct net_device *dev);
> >  static void free_ringdesc(struct netdev_private *np);
> > -static int  start_tx(struct sk_buff *skb, struct net_device *dev);
> > +static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev);
> >  static irqreturn_t intr_handler(int irq, void *dev_instance);
> >  static void netdev_error(struct net_device *dev, int intr_status);
> >  static int  netdev_rx(struct net_device *dev);
> > @@ -997,7 +997,7 @@ static void free_ringdesc(struct netdev_
> >  
> >  }
> >  
> > -static int start_tx(struct sk_buff *skb, struct net_device *dev)
> > +static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
> >  {
> >  	struct netdev_private *np = netdev_priv(dev);
> >  	unsigned entry;
> > --- a/drivers/net/tulip/xircom_cb.c	2009-08-29 23:10:19.505491812 -0700
> > +++ b/drivers/net/tulip/xircom_cb.c	2009-08-29 23:12:54.137512691 -0700
> > @@ -113,7 +113,8 @@ struct xircom_private {
> >  static int xircom_probe(struct pci_dev *pdev, const struct pci_device_id *id);
> >  static void xircom_remove(struct pci_dev *pdev);
> >  static irqreturn_t xircom_interrupt(int irq, void *dev_instance);
> > -static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev);
> > +static netdev_tx_t xircom_start_xmit(struct sk_buff *skb,
> > +					   struct net_device *dev);
> >  static int xircom_open(struct net_device *dev);
> >  static int xircom_close(struct net_device *dev);
> >  static void xircom_up(struct xircom_private *card);
> > @@ -384,7 +385,8 @@ static irqreturn_t xircom_interrupt(int 
> >  	return IRQ_HANDLED;
> >  }
> >  
> > -static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev)
> > +static netdev_tx_t xircom_start_xmit(struct sk_buff *skb,
> > +					   struct net_device *dev)
> >  {
> >  	struct xircom_private *card;
> >  	unsigned long flags;
> > 
> > -- 

^ permalink raw reply

* RE: [RFC] Virtual Machine Device Queues(VMDq) support on KVM
From: Xin, Xiaohui @ 2009-09-02  6:45 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: mst@redhat.com, netdev@vger.kernel.org,
	virtualization@lists.linux-foundation.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, mingo@elte.hu, linux-mm@kvack.org,
	akpm@linux-foundation.org, hpa@zytor.com,
	gregory.haskins@gmail.com
In-Reply-To: <20090901090518.1193e412@nehalam>

>* Code is easier to review than bullet points.

	Yes. We'd send the code soon.

>* Direct I/O has to be safe when page is shared by multiple threads,
> and has to be non-blocking since network I/O can take indeterminately
> long (think big queue's, tunneling, ...)

In the situation, one queue pair NIC is assigned to only one guest, the pages 
are locked and a KVM guest will not swapped out.


>* In the past attempts at Direct I/O on network have always had SMP
> TLB issues. The page has to be flipped or marked as COW on all CPU's
> and the cost of the Inter Processor Interrupt to steal the page has
> been slower than copying

It may be, we have not thought about this more . Thanks.

Thanks
Xiaohui

-----Original Message-----
From: Stephen Hemminger [mailto:shemminger@vyatta.com] 
Sent: Wednesday, September 02, 2009 12:05 AM
To: Xin, Xiaohui
Cc: mst@redhat.com; netdev@vger.kernel.org; virtualization@lists.linux-foundation.org; kvm@vger.kernel.org; linux-kernel@vger.kernel.org; mingo@elte.hu; linux-mm@kvack.org; akpm@linux-foundation.org; hpa@zytor.com; gregory.haskins@gmail.com
Subject: Re: [RFC] Virtual Machine Device Queues(VMDq) support on KVM

On Tue, 1 Sep 2009 14:58:19 +0800
"Xin, Xiaohui" <xiaohui.xin@intel.com> wrote:

>               [RFC] Virtual Machine Device Queues (VMDq) support on KVM
> 
> Network adapter with VMDq technology presents multiple pairs of tx/rx queues,
> and renders network L2 sorting mechanism based on MAC addresses and VLAN tags
> for each tx/rx queue pair. Here we present a generic framework, in which network
> traffic to/from a tx/rx queue pair can be directed from/to a KVM guest without
> any software copy.
> 
> Actually this framework can apply to traditional network adapters which have
> just one tx/rx queue pair. And applications using the same user/kernel interface
> can utilize this framework to send/receive network traffic directly thru a tx/rx
> queue pair in a network adapter.
> 
> We use virtio-net architecture to illustrate the framework.
> 
> 
> |--------------------|     pop               add_buf    |----------------|
> |    Qemu process    |  <---------    TX   <----------  | Guest Kernel   |
> |                    |  --------->         ---------->  |                |
> |    Virtio-net      |     push              get_buf    |                |
> |  (Backend service) |  --------->    RX   ---------->  |  Virtio-net    |
> |                    |  <---------         <----------  |    driver      |
> |                    |     push              get_buf    |                |
> |--------------------|                                  |----------------|
>                    |
>                    |
>                    | AIO (read & write) combined with Direct I/O
>                    |   (which substitute synced file operations)
> |-----------------------------------------------------------------------|
> |     Host kernel  | read: copy-less with directly mapped user          |
> |                  |       space to kernel, payload directly DMAed      |
> |                  |       into user space                              |
> |                  | write: copy-less with directly mapped user         |
> |                  |       space to kernel, payload directly hooked     |
> |                  |       to a skb                                     |
> |                  |                                                    |
> |  (a likely       |                                                    |
> |   queue pair     |                                                    |
> |   instance)      |                                                    |
> |      |           |                                                    |
> | NIC driver <-->  TUN/TAP driver                                       |
> |-----------------------------------------------------------------------|
>        |
>        |
>    traditional adapter or a tx/rx queue pair
> 
> The basic idea is to utilize the kernel Asynchronous I/O combined with Direct
> I/O to implements copy-less TUN/TAP device. AIO and Direct I/O is not new to
> kernel, we still can see it in SCSI tape driver.
> 
> With traditional file operations, a copying of payload contents from/to the
> kernel DMA address to/from a user buffer is needed. That's what the copying we
> want to save.
> 
> The proposed framework is like this:
> A TUN/TAP device is bound to a traditional NIC adapter or a tx/rx queue pair in
> host side. KVM virto-net Backend service, the user space program submits
> asynchronous read/write I/O requests to the host kernel through TUN/TAP device.
> The requests are corresponding to the vqueue elements include both transmission
> & receive. They can be queued in one AIO request and later, the completion will
> be notified through the underlying packets tx/rx processing of the rx/tx queue
> pair.
> 
> Detailed path:
> 
> To guest Virtio-net driver, packets receive corresponding to asynchronous read
> I/O requests of Backend service.
> 
> 1) Guest Virtio-net driver provides header and payload address through the
> receive vqueue to Virtio-net backend service.
> 
> 2) Virtio-net backend service encapsulates multiple vqueue elements into
> multiple AIO control blocks and composes them into one AIO read request.
> 
> 3) Virtio-net backend service uses io_submit() syscall to pass the request to
> the TUN/TAP device.
> 
> 4) Virtio-net backend service uses io_getevents() syscall to check the
> completion of the request.
> 
> 5) The TUN/TAP driver receives packets from the queue pair of NIC, and prepares
> for Direct I/O.
>    A modified NIC driver may render a skb which header is allocated in host
> kernel, but the payload buffer is directly mapped from user space buffer which
> are rendered through the AIO request by the Backend service. get_user_pages()
> may do this. For one AIO read request, the TUN/TAP driver maintains a list for
> the directly mapped buffers, and a NIC driver tries to get the buffers as
> payload buffer to compose the new skbs. Of course, if getting the buffers
> fails, then kernel allocated buffers are used.
> 
> 6) Modern NIC cards now mostly have the header split feature. The NIC queue
> pair then may directly DMA the payload into the user spaces mapped payload
> buffers.
> Thus a zero-copy for payload is implemented in packet receiving.
> 
> 7) The TUN/TAP driver manually copy the host header to space user mapped.
> 
> 8) aio_complete() to notify the Virtio-net backend service for io_getevents().
> 
> 
> To guest Virtio-net driver, packets send corresponding to asynchronous write
> I/O requests of backend. The path is similar to packet receive.
> 
> 1) Guest Virtio-net driver provides header and payload address filled with
> contents through the transmit vqueue to Virtio-net backed service.
> 
> 2) Virtio-net backend service encapsulates the vqueue elements into multiple
> AIO control blocks and composes them into one AIO write request.
> 
> 3) Virtio-net backend service uses the io_submit() syscall to pass the
> requests to the TUN/TAP device.
> 
> 4) Virtio-net backend service uses io_getevents() syscall to check the request
> completion.
> 
> 5) The TUN/TAP driver gets the write requests and allocates skbs for it. The
> header contents are copied into the skb header. The directly mapped user space
> buffer is easily hooked into skb. Thus a zero copy for payload is implemented
> in packet sending.
> 
> 6) aio_complete() to notify the Virtio-net backend service for io_getevents().
> 
> The proposed framework is described as above.
> 
> Consider the modifications to the kernel and qemu:
> 
> To kernel:
> 1) The TUN/TAP driver may be modified a lot to implement AIO device operations
> and to implement directly user space mapping into kernel. Code to maintain the
> directly mapped user buffers should be in. It's just a modification for driver.
> 
> 2) The NIC driver may be modified to compose skb differently and slightly data
> structure change to add user directly mapped buffer pointer.
> Here, maybe it's better for a NIC driver to present an interface for an rx/tx
> queue pair instance which will also apply to traditional hardware, the kernel
> interface should not be changed to make the other components happy.
> The abstraction is useful, though it is not needed immediately here.
> 
> 3) The skb shared info structure may be modified a little to contain the user
> directly mapped info.
> 
> To Qemu:
> 1) The Virtio-net backend service may be modified to handle AIO read/write
> requests from the vqueues.
> 2) Maybe a separate pthread to handle the AIO request triggering is needed.
> 
> Any comments are appreciated here.

* Code is easier to review than bullet points.

* Direct I/O has to be safe when page is shared by multiple threads,
  and has to be non-blocking since network I/O can take indeterminately
  long (think big queue's, tunneling, ...)

* In the past attempts at Direct I/O on network have always had SMP
  TLB issues. The page has to be flipped or marked as COW on all CPU's
  and the cost of the Inter Processor Interrupt to steal the page has
  been slower than copying



-- 

^ permalink raw reply

* Re: [PATCH] sky2: fix management of driver LED
From: Rene Mayrhofer @ 2009-09-02  7:28 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, mikem, netdev, leitner, hofer
In-Reply-To: <20090901213325.69b3348b@nehalam>

[-- Attachment #1: Type: Text/Plain, Size: 1500 bytes --]

On Wednesday 02 September 2009 06:33:25 am Stephen Hemminger wrote:
> On Tue, 01 Sep 2009 17:44:37 -0700 (PDT)
>
> David Miller <davem@davemloft.net> wrote:
> > From: Stephen Hemminger <shemminger@linux-foundation.org>
> > Date: Mon, 31 Aug 2009 10:31:41 -0700
> >
> > > Observed by Mike McCormack.
> > >
> > > The LED bit here is just a software controlled value used to
> > > turn on one of the LED's on some boards. The register value was wrong,
> > > which could have been causing some power control issues.
> > > Get rid of problematic define use the correct mask.
> > >
> > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >
> > Applied.
>
> If these power management fixes do fix all the reported problems,
> then I will consider back porting (probably to 2.6.31.1).

They don't, unfortunately (nonetheless, they should be applied). The bug is 
still reproducible with this patch applied to the latest net-next version of 
sky2.[ch]. I am currently working on setting up a test environment to 
reproduce the bug and access the system console (serial line) as well as hard 
power reset. Both you and Mike (and David if it helps) will get the necessary 
access so that you can debug more efficiently on the system itself (without me 
being in the middle, slowing things down). I hope to have everything ready in 
an hour.

best regards,
Rene

-- 
-------------------------------------------------
Gibraltar firewall       http://www.gibraltar.at/

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: [PATCH] sky2: fix management of driver LED
From: David Miller @ 2009-09-02  7:33 UTC (permalink / raw)
  To: shemminger; +Cc: mikem, netdev, rene.mayrhofer, leitner
In-Reply-To: <20090901213325.69b3348b@nehalam>

From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Tue, 1 Sep 2009 21:33:25 -0700

> On Tue, 01 Sep 2009 17:44:37 -0700 (PDT)
> David Miller <davem@davemloft.net> wrote:
> 
>> From: Stephen Hemminger <shemminger@linux-foundation.org>
>> Date: Mon, 31 Aug 2009 10:31:41 -0700
>> 
>> > Observed by Mike McCormack.
>> > 
>> > The LED bit here is just a software controlled value used to
>> > turn on one of the LED's on some boards. The register value was wrong,
>> > which could have been causing some power control issues.
>> > Get rid of problematic define use the correct mask.
>> > 
>> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>> 
>> Applied.
> 
> If these power management fixes do fix all the reported problems,
> then I will consider back porting (probably to 2.6.31.1).

Good idea.

^ permalink raw reply

* Re: [PATCH 00/18] tg3: 5717 support part 2
From: David Miller @ 2009-09-02  7:45 UTC (permalink / raw)
  To: mcarlson; +Cc: netdev, andy
In-Reply-To: <1251867296.5911@xw6200>

From: "Matt Carlson" <mcarlson@broadcom.com>
Date: Tue, 1 Sep 2009 15:47:49 -0700

> This patchset implements the bulk of the support for the 5717 asic rev.
> The only item left to address is rx producer ring handling, which I've left
> to the patchset following this one.
> 
> Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
> Reviewed-by: Benjamin Li <benli@broadcom.com>

Looks great, all applied to net-next-2.6, thanks!

^ permalink raw reply

* Re: [PATCH 0/5] More const ops cleanups
From: David Miller @ 2009-09-02  7:46 UTC (permalink / raw)
  To: shemminger; +Cc: netdev
In-Reply-To: <20090902052500.808557262@vyatta.com>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Tue, 01 Sep 2009 22:25:00 -0700

> Many places were not using const when defining/using structures
> that only contain initialized values.

All applied to net-next-2.6

Nice work Stephen.

^ permalink raw reply

* Re: H.245v10+ support in nf_conntrack_h323?
From: Andreas Jaggi @ 2009-09-02  8:05 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: Mark Brown, Jing Min Zhao, netdev
In-Reply-To: <4A9D11A3.5070809@trash.net>

On Tue, Sep 01, 2009 at 02:20:51PM +0200, Patrick McHardy wrote:
> Its unfortunately necessary to drop packets in some cases after parsing
> errors when the helper might have already (partially) mangled the
> packet.

Do the helpers also mangle packets when there is no NAT involved?
(in out setup we don't use NAT, btw)
If they don't, would it be reasonable to return NF_ACCEPT when there is
no NAT. For example like in the patch below?

> You could try this patch in combination with ulogd and the pcap output
> plugin to capture the packets which are dropped by the helper for
> analysis.

Unfortunately the videoconferencing system is currently not available
for testing (and might be so for while). But I can have some tcpdumps from
both sides of the Linux Gateway from which I can extract the packets that
were dropped by the H.323 helper.

Andreas


--- a/net/netfilter/nf_conntrack_h323_main.c	2009-05-19 01:52:34.000000000 +0200
+++ b/net/netfilter/nf_conntrack_h323_main.c	2009-09-01 17:36:08.000000000 +0200
@@ -596,8 +596,12 @@
 		}
 
 		/* Process H.245 signal */
-		if (process_h245(skb, ct, ctinfo, &data, dataoff, &mscm) < 0)
-			goto drop;
+		if (process_h245(skb, ct, ctinfo, &data, dataoff, &mscm) < 0) {
+			if (ct->status & IPS_NAT_MASK)
+				goto drop;
+			else
+				break;
+		}
 	}
 
 	spin_unlock_bh(&nf_h323_lock);
@@ -1141,8 +1145,12 @@
 		}
 
 		/* Process Q.931 signal */
-		if (process_q931(skb, ct, ctinfo, &data, dataoff, &q931) < 0)
-			goto drop;
+		if (process_q931(skb, ct, ctinfo, &data, dataoff, &q931) < 0) {
+			if (ct->status & IPS_NAT_MASK)
+				goto drop;
+			else
+				break;
+		}
 	}
 
 	spin_unlock_bh(&nf_h323_lock);
@@ -1716,7 +1724,8 @@
 	}
 
 	/* Process RAS message */
-	if (process_ras(skb, ct, ctinfo, &data, &ras) < 0)
+	if ((process_ras(skb, ct, ctinfo, &data, &ras) < 0) &&
+	    (ct->status & IPS_NAT_MASK))
 		goto drop;
 
       accept:

^ permalink raw reply

* Re: [NET] Add proc file to display the state of all qdiscs.
From: Jarek Poplawski @ 2009-09-02  8:14 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: eric.dumazet, David Miller, Patrick McHardy, netdev
In-Reply-To: <alpine.DEB.1.10.0909011943430.12066@V090114053VZO-1>

[Resent with fixed netdev@ address]

On 02-09-2009 01:52, Christoph Lameter wrote:
> [NET] Add proc file to display the state of all qdiscs
> 
> TC is a complicated tool and it currently does not allow the display of all
> qdisc states. It does not support multiple tx queues and also not
> localhost, nor does it display the current operating state of the queues.

I think, tc should've no problem with displaying summary stats of
multiqueue qdiscs or even all of them separately, as mentioned by
Patrick. And, maybe I still miss something, but there should be
nothing special with tc vs. localhost either.

> 
> This functionality could be added to tc / netlink but the tool is already
> complex to handle. The simple proc file here allows easy scanning by
> scripts and other tools. However, tc still needs to be updated to allow
> the modifications of multiqueue TX settings. tc's main focus is the
> configuration of qdiscs. The qdisc_stats file just shows the current
> state.
> 
> This patch adds
> 
> 	/proc/net/qdisc_stats
> 
> which displays the current state of all qdiscs on the system.
> 
> F.e.
> 
> $ cat /proc/net/qdisc_stats
> Queue    Device  State   Bytes  Packets Qlen Blog   Drops Requeue Overlimit
> TX0/root     lo   -          0        0    0    0       0       0       0
>  RX/root     lo   -          0        0    0    0       0       0       0
> TX0/root   eth0   -       5518       60    0    0       0       0       0
> TX1/root   eth0   -       2549       37    0    0       0       0       0
> TX2/root   eth0   -      63625      272    0    0       0       0       0
> TX3/root   eth0   -       1580       21    0    0       0       0       0
> TX4/root   eth0   R   88979440   260183    0 3532   43176    2111       0
> TX5/root   eth0   -       4698       56    0    0       0       0       0
> TX6/root   eth0   - 3598883129 10523140    0    0       0       0       0
> TX7/root   eth0   -       1750       21    0    0       0       0       0

As I wrote earlier, it's a nice work, but since it makes a new API I
guess we shouldn't hurry with merging this patch, and publish it as an
RFC first.

Then my humble suggestions would be to reserve more space for most of
the columns to make it readable not only for scripts when more TX#,
bytes, packets etc. Users of non-default qdiscs would also miss things
like: q->ops->id, q->handle, and q->parent at least. Plus, as I
mentioned earlier, q->qstats.qlen update with q->q.qlen (or using it
directly) is needed.

Jarek P.

> 
> Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
> 
> ---
>  net/sched/sch_api.c |  130 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 130 insertions(+)
> 
> Index: linux-2.6/net/sched/sch_api.c
> ===================================================================
> --- linux-2.6.orig/net/sched/sch_api.c	2009-09-01 12:27:24.000000000 -0500
> +++ linux-2.6/net/sched/sch_api.c	2009-09-01 14:39:27.000000000 -0500
> @@ -1699,6 +1699,135 @@ static const struct file_operations psch
>  	.llseek = seq_lseek,
>  	.release = single_release,
>  };
> +
> +static void dump_qdisc(struct seq_file *seq, struct net_device *dev,
> +				struct Qdisc *q, char *inout, char *text)
> +{
> +	char state[5];
> +	char *p = state;
> +
> +	if (test_bit(__QDISC_STATE_RUNNING, &q->state))
> +		*p++ = 'R';
> +	if (test_bit(__QDISC_STATE_SCHED, &q->state))
> +		*p++ = 'S';
> +	if (test_bit(__QDISC_STATE_DEACTIVATED, &q->state))
> +		*p++ = 'D';
> +	if (q->state == 0)
> +		*p++ = '-';
> +	*p = 0;
> +
> +	seq_printf(seq, "%3s/%2s %6s %3s %10lld %8d %4d %4d %7d %7d %7d\n",
> +		inout, text, dev->name, state,
> +		q->bstats.bytes, q->bstats.packets,
> +		q->qstats.qlen, q->qstats.backlog, q->qstats.drops,
> +		q->qstats.requeues, q->qstats.overlimits);
> +}
> +
> +static void dump_qdisc_root(struct seq_file *seq, struct net_device *dev,
> +					 struct Qdisc *root, char *inout)
> +{
> +	struct Qdisc *q;
> +	int n = 0;
> +
> +	if (!root)
> +		return;
> +
> +	dump_qdisc(seq, dev, root, inout, "root");
> +
> +	list_for_each_entry(q, &root->list, list) {
> +		char buffer[10];
> +
> +		sprintf(buffer,"Q%d", ++n);
> +		dump_qdisc(seq, dev, q, inout, buffer);
> +	}
> +}
> +
> +
> +static void qdisc_seq_out(struct seq_file *seq, struct net_device *dev)
> +{
> +	struct netdev_queue *dev_queue;
> +	int i;
> +
> +	for (i = 0; i < dev->real_num_tx_queues; i++) {
> +		char buffer[10];
> +
> +		dev_queue = netdev_get_tx_queue(dev, i);
> +		sprintf(buffer, "TX%d", i);
> +		dump_qdisc_root(seq, dev, dev_queue->qdisc_sleeping, buffer);
> +	}
> +	dev_queue = &dev->rx_queue;
> +	dump_qdisc_root(seq, dev, dev_queue->qdisc_sleeping, "RX");
> +}
> +
> +static int qdisc_seq_show(struct seq_file *seq, void *v)
> +{
> +	if (v == SEQ_START_TOKEN) {
> +		seq_printf(seq, "Queue    Device  State   Bytes  Packets "
> +			"Qlen Blog   Drops Requeue Overlimit\n");
> +	} else
> +		qdisc_seq_out(seq, v);
> +
> +	return 0;
> +}
> +
> +static void *qdisc_seq_start(struct seq_file *seq, loff_t *pos)
> +	__acquires(dev_base_lock)
> +{
> +	struct net *net = seq_file_net(seq);
> +	loff_t off;
> +	struct net_device *dev;
> +
> +	read_lock(&dev_base_lock);
> +
> +	if (!*pos)
> +		return SEQ_START_TOKEN;
> +
> +	off = 1;
> +
> +	for_each_netdev(net, dev)
> +		if (off++ == *pos)
> +			return dev;
> +
> +	return NULL;
> +}
> +
> +static void *qdisc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
> +{
> +	struct net *net = seq_file_net(seq);
> +
> +	++*pos;
> +	return v == SEQ_START_TOKEN ?
> +		first_net_device(net) : next_net_device((struct net_device *)v);
> +}
> +
> +static void qdisc_seq_stop(struct seq_file *seq, void *v)
> +	__releases(dev_base_lock)
> +{
> +	read_unlock(&dev_base_lock);
> +}
> +
> +
> +static const struct seq_operations qdisc_seq_ops = {
> +	.start	= qdisc_seq_start,
> +	.next	= qdisc_seq_next,
> +	.stop	= qdisc_seq_stop,
> +	.show	= qdisc_seq_show,
> +};
> +
> +static int qdisc_open(struct inode *inode, struct file *file)
> +{
> +	return seq_open_net(inode, file, &qdisc_seq_ops,
> +			sizeof(struct seq_net_private));
> +}
> +
> +
> +static const struct file_operations qdisc_fops = {
> +	.owner = THIS_MODULE,
> +	.open = qdisc_open,
> +	.read = seq_read,
> +	.llseek = seq_lseek,
> +	.release = seq_release,
> +};
>  #endif
> 
>  static int __init pktsched_init(void)
> @@ -1706,6 +1835,7 @@ static int __init pktsched_init(void)
>  	register_qdisc(&pfifo_qdisc_ops);
>  	register_qdisc(&bfifo_qdisc_ops);
>  	proc_net_fops_create(&init_net, "psched", 0, &psched_fops);
> +	proc_net_fops_create(&init_net, "qdisc_stats", 0, &qdisc_fops);
> 
>  	rtnl_register(PF_UNSPEC, RTM_NEWQDISC, tc_modify_qdisc, NULL);
>  	rtnl_register(PF_UNSPEC, RTM_DELQDISC, tc_get_qdisc, NULL);
> 
> --
> 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
> 

^ permalink raw reply

* Re: [NET] Add proc file to display the state of all qdiscs.
From: Eric Dumazet @ 2009-09-02  8:28 UTC (permalink / raw)
  To: Jarek Poplawski; +Cc: Christoph Lameter, David Miller, Patrick McHardy, netdev
In-Reply-To: <20090902081429.GB4878@ff.dom.local>

Jarek Poplawski a écrit :
> [Resent with fixed netdev@ address]
> 
> On 02-09-2009 01:52, Christoph Lameter wrote:
>> [NET] Add proc file to display the state of all qdiscs
>>
>> TC is a complicated tool and it currently does not allow the display of all
>> qdisc states. It does not support multiple tx queues and also not
>> localhost, nor does it display the current operating state of the queues.
> 
> I think, tc should've no problem with displaying summary stats of
> multiqueue qdiscs or even all of them separately, as mentioned by
> Patrick. And, maybe I still miss something, but there should be
> nothing special with tc vs. localhost either.
>

I made a patch, but for a 8 queue device (bnx2), here is the "tc -s -d qdisc" result :

$ tc -s -d qdisc show
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 51814 bytes 459 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0


Same name "eth0" is displayed, that might confuse parsers...

What naming convention should we choose for multiqueue devices ?


^ permalink raw reply

* Re: [NET] Add proc file to display the state of all qdiscs.
From: David Miller @ 2009-09-02  8:30 UTC (permalink / raw)
  To: eric.dumazet; +Cc: jarkao2, cl, kaber, netdev
In-Reply-To: <4A9E2CC7.1010103@gmail.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 02 Sep 2009 10:28:55 +0200

> What naming convention should we choose for multiqueue devices ?

We could give an index field to multiple root qdiscs assigned
to a device.

^ permalink raw reply

* Re: [PATCH 5/5] net: file_operations should be const
From: Samuel Ortiz @ 2009-09-02  8:55 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev, linux-wireless
In-Reply-To: <20090902052538.601908379@vyatta.com>

On Tue, 2009-09-01 at 22:25 -0700, Stephen Hemminger wrote:
> plain text document attachment (const-file-ops.patch)
> All instances of file_operations should be const.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
For the IrDA parts:
Acked-by: Samuel Ortiz <samuel@sortiz.org>

> 
> ---
>  net/ipv6/ip6mr.c                        |    4 ++--
>  net/irda/irnet/irnet_ppp.h              |    2 +-
>  net/irda/irproc.c                       |   14 +++++++-------
>  net/key/af_key.c                        |    2 +-
>  net/mac80211/rc80211_minstrel_debugfs.c |    2 +-
>  net/mac80211/rc80211_pid_debugfs.c      |    2 +-
>  net/xfrm/xfrm_proc.c                    |    2 +-
>  7 files changed, 14 insertions(+), 14 deletions(-)
> 
> --- a/net/ipv6/ip6mr.c	2009-09-01 22:06:18.049861877 -0700
> +++ b/net/ipv6/ip6mr.c	2009-09-01 22:06:45.101130517 -0700
> @@ -217,7 +217,7 @@ static int ip6mr_vif_open(struct inode *
>  			    sizeof(struct ipmr_vif_iter));
>  }
>  
> -static struct file_operations ip6mr_vif_fops = {
> +static const struct file_operations ip6mr_vif_fops = {
>  	.owner	 = THIS_MODULE,
>  	.open    = ip6mr_vif_open,
>  	.read    = seq_read,
> @@ -341,7 +341,7 @@ static int ipmr_mfc_open(struct inode *i
>  			    sizeof(struct ipmr_mfc_iter));
>  }
>  
> -static struct file_operations ip6mr_mfc_fops = {
> +static const struct file_operations ip6mr_mfc_fops = {
>  	.owner	 = THIS_MODULE,
>  	.open    = ipmr_mfc_open,
>  	.read    = seq_read,
> --- a/net/irda/irnet/irnet_ppp.h	2009-09-01 22:06:18.066775983 -0700
> +++ b/net/irda/irnet/irnet_ppp.h	2009-09-01 22:07:01.768232028 -0700
> @@ -95,7 +95,7 @@ static int
>  /**************************** VARIABLES ****************************/
>  
>  /* Filesystem callbacks (to call us) */
> -static struct file_operations irnet_device_fops =
> +static const struct file_operations irnet_device_fops =
>  {
>  	.owner		= THIS_MODULE,
>  	.read		= dev_irnet_read,
> --- a/net/irda/irproc.c	2009-09-01 22:06:18.083862409 -0700
> +++ b/net/irda/irproc.c	2009-09-01 22:07:33.742884934 -0700
> @@ -34,21 +34,21 @@
>  #include <net/irda/irlap.h>
>  #include <net/irda/irlmp.h>
>  
> -extern struct file_operations discovery_seq_fops;
> -extern struct file_operations irlap_seq_fops;
> -extern struct file_operations irlmp_seq_fops;
> -extern struct file_operations irttp_seq_fops;
> -extern struct file_operations irias_seq_fops;
> +extern const struct file_operations discovery_seq_fops;
> +extern const struct file_operations irlap_seq_fops;
> +extern const struct file_operations irlmp_seq_fops;
> +extern const struct file_operations irttp_seq_fops;
> +extern const struct file_operations irias_seq_fops;
>  
>  struct irda_entry {
>  	const char *name;
> -	struct file_operations *fops;
> +	const struct file_operations *fops;
>  };
>  
>  struct proc_dir_entry *proc_irda;
>  EXPORT_SYMBOL(proc_irda);
>  
> -static struct irda_entry irda_dirs[] = {
> +static const struct irda_entry irda_dirs[] = {
>  	{"discovery",	&discovery_seq_fops},
>  	{"irttp",	&irttp_seq_fops},
>  	{"irlmp",	&irlmp_seq_fops},
> --- a/net/key/af_key.c	2009-09-01 22:06:18.103861872 -0700
> +++ b/net/key/af_key.c	2009-09-01 22:07:53.008956985 -0700
> @@ -3718,7 +3718,7 @@ static int pfkey_seq_open(struct inode *
>  			    sizeof(struct seq_net_private));
>  }
>  
> -static struct file_operations pfkey_proc_ops = {
> +static const struct file_operations pfkey_proc_ops = {
>  	.open	 = pfkey_seq_open,
>  	.read	 = seq_read,
>  	.llseek	 = seq_lseek,
> --- a/net/mac80211/rc80211_minstrel_debugfs.c	2009-09-01 22:06:18.119862498 -0700
> +++ b/net/mac80211/rc80211_minstrel_debugfs.c	2009-09-01 22:08:22.747241542 -0700
> @@ -139,7 +139,7 @@ minstrel_stats_release(struct inode *ino
>  	return 0;
>  }
>  
> -static struct file_operations minstrel_stat_fops = {
> +static const struct file_operations minstrel_stat_fops = {
>  	.owner = THIS_MODULE,
>  	.open = minstrel_stats_open,
>  	.read = minstrel_stats_read,
> --- a/net/mac80211/rc80211_pid_debugfs.c	2009-09-01 22:06:18.135862300 -0700
> +++ b/net/mac80211/rc80211_pid_debugfs.c	2009-09-01 22:08:28.843245757 -0700
> @@ -198,7 +198,7 @@ static ssize_t rate_control_pid_events_r
>  
>  #undef RC_PID_PRINT_BUF_SIZE
>  
> -static struct file_operations rc_pid_fop_events = {
> +static const struct file_operations rc_pid_fop_events = {
>  	.owner = THIS_MODULE,
>  	.read = rate_control_pid_events_read,
>  	.poll = rate_control_pid_events_poll,
> --- a/net/xfrm/xfrm_proc.c	2009-09-01 22:06:18.169862213 -0700
> +++ b/net/xfrm/xfrm_proc.c	2009-09-01 22:08:48.707830315 -0700
> @@ -60,7 +60,7 @@ static int xfrm_statistics_seq_open(stru
>  	return single_open_net(inode, file, xfrm_statistics_seq_show);
>  }
>  
> -static struct file_operations xfrm_statistics_seq_fops = {
> +static const struct file_operations xfrm_statistics_seq_fops = {
>  	.owner	 = THIS_MODULE,
>  	.open	 = xfrm_statistics_seq_open,
>  	.read	 = seq_read,
> 


^ permalink raw reply

* [PATCH] NET: Fix possible corruption in bpqether driver
From: Ralf Baechle @ 2009-09-02  8:58 UTC (permalink / raw)
  To: David S. Miller, netdev; +Cc: linux-hams, Thomas Osterried, Jann Traschewski

The bpq ether driver is modifying the data art of the skb by first
dropping the KISS byte (a command byte for the radio) then prepending the
length + 4 of the remaining AX.25 packet to be transmitted as a little
endian 16-bit number.  If the high byte of the length has a different
value than the dropped KISS byte users of clones of the skb may observe
this as corruption.  This was observed with by running listen(8) -a which
uses a packet socket which clones transmit packets.  The corruption will
then typically be displayed for as a KISS "TX Delay" command for AX.25
packets in the range of 252..508 bytes or any other KISS command for
yet larger packets.

Fixed by using skb_cow to create a private copy should the skb be cloned.
Using skb_cow also allows us to cleanup the old logic to ensure sufficient
headroom in the skb.

While at it, replace a return of 0 from bpq_xmit with the proper constant
NETDEV_TX_OK which is now being used everywhere else in this function.

Affected: all 2.2, 2.4 and 2.6 kernels.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Reported-by: Jann Traschewski <jann@gmx.de>

 drivers/net/hamradio/bpqether.c |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index abcd19a..184a528 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -249,7 +249,6 @@ drop:
  */
 static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct sk_buff *newskb;
 	unsigned char *ptr;
 	struct bpqdev *bpq;
 	int size;
@@ -263,28 +262,23 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
 		return NETDEV_TX_OK;
 	}
 
-	skb_pull(skb, 1);
+	skb_pull(skb, 1);			/* Drop KISS byte */
 	size = skb->len;
 
 	/*
-	 * The AX.25 code leaves enough room for the ethernet header, but
-	 * sendto() does not.
+	 * We're about to mess with the skb which may still shared with the
+	 * generic networking code so unshare and ensure it's got enough
+	 * space for the BPQ headers.
 	 */
-	if (skb_headroom(skb) < AX25_BPQ_HEADER_LEN) {	/* Ough! */
-		if ((newskb = skb_realloc_headroom(skb, AX25_BPQ_HEADER_LEN)) == NULL) {
-			printk(KERN_WARNING "bpqether: out of memory\n");
-			kfree_skb(skb);
-			return NETDEV_TX_OK;
-		}
-
-		if (skb->sk != NULL)
-			skb_set_owner_w(newskb, skb->sk);
-
+	if (skb_cow(skb, AX25_BPQ_HEADER_LEN)) {
+		if (net_ratelimit())
+			pr_err("bpqether: out of memory\n");
 		kfree_skb(skb);
-		skb = newskb;
+
+		return NETDEV_TX_OK;
 	}
 
-	ptr = skb_push(skb, 2);
+	ptr = skb_push(skb, 2);			/* Make space for length */
 
 	*ptr++ = (size + 5) % 256;
 	*ptr++ = (size + 5) / 256;
@@ -305,7 +299,8 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
   
 	dev_queue_xmit(skb);
 	netif_wake_queue(dev);
-	return 0;
+
+	return NETDEV_TX_OK;
 }
 
 /*

^ permalink raw reply related

* about packets forwarding
From: wu xiaofei @ 2009-09-02  9:03 UTC (permalink / raw)
  To: netdev
In-Reply-To: <f4f837ab0909020127o3359ed03j224ef51a0673bcd9@mail.gmail.com>

Hello,

I have something to ask here.

The topology of the network is as follows.
There are six Nodes (A, B, C, D, M, N).

  M
  |
  A
 / \
B   D
 \ /
  C
  |
  N

M-A, C-N are wired links.
A-B, B-C, A-D, D-C are wireless links.

Node M wnats to communicate with node N. Because the wireless links
are not very reliable, I want to forward the packets through A-B-C and
A-D-C simultaneously (When Node A receives packets(from Node M) from
its wired interface eth0, It will forward the same packets to its
wireless interfaces wlan0 and wlan1 simultaneously) . How to implement
this?

--
Regards,
 Wu

^ permalink raw reply

* [PATCH 1/2] fec: fix recursive locking of mii_lock
From: Uwe Kleine-König @ 2009-09-02  9:14 UTC (permalink / raw)
  To: linux-rt-users
  Cc: Greg Ungerer, Ben Hutchings, Patrick McHardy, Sascha Hauer,
	Matt Waddel, netdev, Tim Sander
In-Reply-To: <20090831132200.GA21836@pengutronix.de>

mii_discover_phy is only called by fec_enet_mii (via mip->mii_func).  So
&fep->mii_lock is already held and mii_discover_phy must not call
mii_queue which locks &fep->mii_lock, too.

This was noticed by lockdep:

	=============================================
	[ INFO: possible recursive locking detected ]
	2.6.31-rc8-00038-g37d0892 #109
	---------------------------------------------
	swapper/1 is trying to acquire lock:
	 (&fep->mii_lock){-.....}, at: [<c01569f8>] mii_queue+0x2c/0xcc

	but task is already holding lock:
	 (&fep->mii_lock){-.....}, at: [<c0156328>] fec_enet_interrupt+0x78/0x460

	other info that might help us debug this:
	2 locks held by swapper/1:
	 #0:  (rtnl_mutex){+.+.+.}, at: [<c0183534>] rtnl_lock+0x18/0x20
	 #1:  (&fep->mii_lock){-.....}, at: [<c0156328>] fec_enet_interrupt+0x78/0x460

	stack backtrace:
	Backtrace:
	[<c00226fc>] (dump_backtrace+0x0/0x108) from [<c01eac14>] (dump_stack+0x18/0x1c)
	 r6:c781d118 r5:c03e41d8 r4:00000001
	[<c01eabfc>] (dump_stack+0x0/0x1c) from [<c005bae4>] (__lock_acquire+0x1a20/0x1a88)
	[<c005a0c4>] (__lock_acquire+0x0/0x1a88) from [<c005bbac>] (lock_acquire+0x60/0x74)
	[<c005bb4c>] (lock_acquire+0x0/0x74) from [<c01edda8>] (_spin_lock_irqsave+0x54/0x68)
	 r7:60000093 r6:c01569f8 r5:c785e468 r4:00000000
	[<c01edd54>] (_spin_lock_irqsave+0x0/0x68) from [<c01569f8>] (mii_queue+0x2c/0xcc)
	 r7:c785e468 r6:c0156b24 r5:600a0000 r4:c785e000
	[<c01569cc>] (mii_queue+0x0/0xcc) from [<c0156b78>] (mii_discover_phy+0x54/0xa8)
	 r8:00000002 r7:00000032 r6:c785e000 r5:c785e360 r4:c785e000
	[<c0156b24>] (mii_discover_phy+0x0/0xa8) from [<c0156354>] (fec_enet_interrupt+0xa4/0x460)
	 r5:c785e360 r4:c077a170
	[<c01562b0>] (fec_enet_interrupt+0x0/0x460) from [<c0066674>] (handle_IRQ_event+0x48/0x120)
	[<c006662c>] (handle_IRQ_event+0x0/0x120) from [<c0068438>] (handle_level_irq+0x94/0x11c)
	...

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Greg Ungerer <gerg@uclinux.org>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Matt Waddel <Matt.Waddel@freescale.com>
Cc: netdev@vger.kernel.org
Cc: Tim Sander <tim01@vlsi.informatik.tu-darmstadt.de>
---
 drivers/net/fec.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index c9fd82d..ef82606 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -637,16 +637,15 @@ unlock:
 }
 
 static int
-mii_queue(struct net_device *dev, int regval, void (*func)(uint, struct net_device *))
+mii_queue_unlocked(struct net_device *dev, int regval,
+		void (*func)(uint, struct net_device *))
 {
 	struct fec_enet_private *fep;
-	unsigned long	flags;
 	mii_list_t	*mip;
 	int		retval;
 
 	/* Add PHY address to register command */
 	fep = netdev_priv(dev);
-	spin_lock_irqsave(&fep->mii_lock, flags);
 
 	regval |= fep->phy_addr << 23;
 	retval = 0;
@@ -667,6 +666,19 @@ mii_queue(struct net_device *dev, int regval, void (*func)(uint, struct net_devi
 		retval = 1;
 	}
 
+	return retval;
+}
+
+static int
+mii_queue(struct net_device *dev, int regval,
+		void (*func)(uint, struct net_device *))
+{
+	struct fec_enet_private *fep;
+	unsigned long   flags;
+	int             retval;
+	fep = netdev_priv(dev);
+	spin_lock_irqsave(&fep->mii_lock, flags);
+	retval = mii_queue_unlocked(dev, regval, func);
 	spin_unlock_irqrestore(&fep->mii_lock, flags);
 	return retval;
 }
@@ -1373,11 +1385,11 @@ mii_discover_phy(uint mii_reg, struct net_device *dev)
 
 			/* Got first part of ID, now get remainder */
 			fep->phy_id = phytype << 16;
-			mii_queue(dev, mk_mii_read(MII_REG_PHYIR2),
+			mii_queue_unlocked(dev, mk_mii_read(MII_REG_PHYIR2),
 							mii_discover_phy3);
 		} else {
 			fep->phy_addr++;
-			mii_queue(dev, mk_mii_read(MII_REG_PHYIR1),
+			mii_queue_unlocked(dev, mk_mii_read(MII_REG_PHYIR1),
 							mii_discover_phy);
 		}
 	} else {
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox