[PATCH] Re: Loopback address to eth0 interface and rooting goes wrong

2008-01-24 Thread Bjørn Mork
Hello

Gary  gary.manchon (at) gmail.com  found a problem where he was unable
to recover from a bad network interface configuration 
(ifconfig eth0 127.0.0.1), ref 
http://www.uwsg.iu.edu/hypermail/linux/net/0801.2/0009.html

This was confirmed by several people.

I suspect that the problem might be this code in net/ipv4/devinet.c ,
which sets ifa_scope to RT_SCOPE_HOST if you configure a loopback
address (127/8) on any interface.  I guess it's there to protect us from
sending packets with a loopback source address, which woulnd't look too
good:

static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa)
{
struct in_device *in_dev = __in_dev_get_rtnl(dev);

ASSERT_RTNL();

if (!in_dev) {
inet_free_ifa(ifa);
return -ENOBUFS;
}
ipv4_devconf_setall(in_dev);
if (ifa-ifa_dev != in_dev) {
BUG_TRAP(!ifa-ifa_dev);
in_dev_hold(in_dev);
ifa-ifa_dev = in_dev;
}
if (LOOPBACK(ifa-ifa_local))
ifa-ifa_scope = RT_SCOPE_HOST;
return inet_insert_ifa(ifa);
}



The real problem is that there's never anything resetting this scope if
you change the address later.  This patch adds scope reset when changing
the address.

We set the scope to RT_SCOPE_HOST if an IPv4 interface is configured with a 
loopback address (127/8).  This prevents the interface from sending packets 
out the wire.  This patch resets the scope if the address is changed again,
to restore normal functionality.

Signed-off-by: Bjorn Mork [EMAIL PROTECTED]

 devinet.c |1 +
 1 file changed, 1 insertion(+)


--- linux-2.6.24-rc8.orig/net/ipv4/devinet.c	2008-01-16 05:22:48.0 +0100
+++ linux-2.6.24-rc8/net/ipv4/devinet.c	2008-01-23 19:17:30.0 +0100
@@ -753,6 +753,7 @@
 			inet_del_ifa(in_dev, ifap, 0);
 			ifa-ifa_broadcast = 0;
 			ifa-ifa_anycast = 0;
+			ifa-ifa_scope = 0;
 		}
 
 		ifa-ifa_address = ifa-ifa_local = sin-sin_addr.s_addr;



Bjørn


Re: [Bugme-new] [Bug 9806] New: (tun dev) Impossible to deassert IFF_ONE_QUEUE or IFF_NO_PI

2008-01-24 Thread Andrew Morton
 On Wed, 23 Jan 2008 13:13:13 -0800 (PST) [EMAIL PROTECTED] wrote:
 http://bugzilla.kernel.org/show_bug.cgi?id=9806
 
Summary: (tun dev) Impossible to deassert IFF_ONE_QUEUE or
 IFF_NO_PI
Product: Drivers
Version: 2.5
  KernelVersion: 2.6.23
   Platform: All
 OS/Version: Linux
   Tree: Mainline
 Status: NEW
   Severity: normal
   Priority: P1
  Component: Network
 AssignedTo: [EMAIL PROTECTED]
 ReportedBy: [EMAIL PROTECTED]
 
 
 Problem Description:
 
 The TUN/TAP driver only permits one-way transitions of IFF_NO_PI or
 IFF_ONE_QUEUE during the lifetime of a tap/tun interface.  Note that
 tun_set_iff contains
 
  541 if (ifr-ifr_flags  IFF_NO_PI)
  542 tun-flags |= TUN_NO_PI;
  543 
  544 if (ifr-ifr_flags  IFF_ONE_QUEUE)
  545 tun-flags |= TUN_ONE_QUEUE;
 
 This is easily fixed by adding else branches which clear these bits.
 
 Steps to reproduce:
 
 This is easily reproduced by setting an interface persistant using tunctl then
 attempting to open it as IFF_TAP or IFF_TUN, without asserting the IFF_NO_PI
 flag.  The ioctl() will succeed and the ifr.flags word is not modified, but 
 the
 interface remains in IFF_NO_PI mode (as it was set by tunctl).
 

Thanks.   Could you please submit the patch via email?  Send it to
all recipients of this email.

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: bluetooth : lockdep warning on rfcomm

2008-01-24 Thread Dave Young
On Jan 24, 2008 11:02 AM, Dave Young [EMAIL PROTECTED] wrote:
 =
 [ INFO: possible recursive locking detected ]
 2.6.24-rc8-mm1 #8
 -
 bluepush/3213 is trying to acquire lock:
  (sk_lock-AF_BLUETOOTH){--..}, at: [f8978c80]
 l2cap_sock_bind+0x40/0x100 [l2cap]

 but task is already holding lock:
  (sk_lock-AF_BLUETOOTH){--..}, at: [f894a31e]
 rfcomm_sock_connect+0x3e/0xe0 [rfcomm]

 other info that might help us debug this:
 2 locks held by bluepush/3213:
  #0:  (sk_lock-AF_BLUETOOTH){--..}, at: [f894a31e]
 rfcomm_sock_connect+0x3e/0xe0 [rfcomm]
  #1:  (rfcomm_mutex){--..}, at: [f8947556] rfcomm_dlc_open+0x26/0x60 
 [rfcomm]

 stack backtrace:
 Pid: 3213, comm: bluepush Not tainted 2.6.24-rc8-mm1 #8
  [c0132128] ? printk+0x18/0x20
  [c0154437] print_deadlock_bug+0xc7/0xe0
  [c01544bc] check_deadlock+0x6c/0x80
  [c01548fc] validate_chain+0x14c/0x320
  [c0156221] __lock_acquire+0x1c1/0x730
  [c0156d89] lock_acquire+0x79/0xb0
  [f8978c80] ? l2cap_sock_bind+0x40/0x100 [l2cap]
  [c03c05f5] lock_sock_nested+0x55/0x70
  [f8978c80] ? l2cap_sock_bind+0x40/0x100 [l2cap]
  [f8978c80] l2cap_sock_bind+0x40/0x100 [l2cap]
  [c03bdb4a] kernel_bind+0xa/0x10
  [f8947afc] rfcomm_session_create+0x4c/0x110 [rfcomm]
  [f8947509] __rfcomm_dlc_open+0x129/0x150 [rfcomm]
  [f8947568] rfcomm_dlc_open+0x38/0x60 [rfcomm]
  [f894a396] rfcomm_sock_connect+0xb6/0xe0 [rfcomm]
  [c03bcd39] sys_connect+0x99/0xd0
  [c010f509] ? cache_add_dev+0x39/0x1a0
  [c015323d] ? put_lock_stats+0xd/0x30
  [c01532c0] ? lock_release_holdtime+0x60/0x80
  [c018e86c] ? fget+0x7c/0x100
  [c0156b97] ? __lock_release+0x47/0x70
  [c018e86c] ? fget+0x7c/0x100
  [c02611b7] ? copy_from_user+0x37/0x70
  [c03bd855] sys_socketcall+0xa5/0x230
  [c0155659] ? trace_hardirqs_on+0xb9/0x130
  [c010501b] ? restore_nocheck+0x12/0x15


While fixing this issue, another locking dependency confused me. Are
rfcomm_dev_lock and d-lock in same lock class?

The warnings as following:

===
[ INFO: possible circular locking dependency detected ]
2.6.24-rc8-mm1 #8
---
krfcommd/2912 is trying to acquire lock:
 (rfcomm_dev_lock){-.--}, at: [f89d5bf2]
rfcomm_dev_state_change+0x92/0x160 [rfcomm]

but task is already holding lock:
 (d-lock){--..}, at: [f89d15d3] __rfcomm_dlc_close+0x43/0xd0 [rfcomm]

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

- #1 (d-lock){--..}:
   [c0153b13] add_lock_to_list+0x33/0x70
   [c01545a3] check_prev_add+0xd3/0x200
   [f89d5311] rfcomm_dev_add+0x191/0x300 [rfcomm]
   [c0154765] check_prevs_add+0x95/0xe0
   [c01549ef] validate_chain+0x23f/0x320
   [c0156221] __lock_acquire+0x1c1/0x730
   [c0155539] mark_held_locks+0x39/0x80
   [c0156d89] lock_acquire+0x79/0xb0
   [f89d5311] rfcomm_dev_add+0x191/0x300 [rfcomm]
   [c0436749] _spin_lock+0x39/0x80
   [f89d5311] rfcomm_dev_add+0x191/0x300 [rfcomm]
   [f89d5b10] rfcomm_dev_data_ready+0x0/0x50 [rfcomm]
   [f89d5311] rfcomm_dev_add+0x191/0x300 [rfcomm]
   [f89d565e] rfcomm_create_dev+0x6e/0x100 [rfcomm]
   [c03c05fa] lock_sock_nested+0x5a/0x70
   [f89d5ae3] rfcomm_dev_ioctl+0x33/0x60 [rfcomm]
   [f89d4c8c] rfcomm_sock_ioctl+0x2c/0x50 [rfcomm]
   [c03bc001] sock_ioctl+0xc1/0x220
   [c03bbf40] sock_ioctl+0x0/0x220
   [c019a366] vfs_ioctl+0x76/0x90
   [c019a616] do_vfs_ioctl+0x56/0x140
   [c019a762] sys_ioctl+0x62/0x70
   [c0104fba] syscall_call+0x7/0xb
   [] 0x

- #0 (rfcomm_dev_lock){-.--}:
   [c0154504] check_prev_add+0x34/0x200
   [c012a9ab] default_wake_function+0xb/0x10
   [c0154765] check_prevs_add+0x95/0xe0
   [c01549ef] validate_chain+0x23f/0x320
   [c0156221] __lock_acquire+0x1c1/0x730
   [c0156d89] lock_acquire+0x79/0xb0
   [f89d5bf2] rfcomm_dev_state_change+0x92/0x160 [rfcomm]
   [c04361e9] _read_lock+0x39/0x80
   [f89d5bf2] rfcomm_dev_state_change+0x92/0x160 [rfcomm]
   [f89d5bf2] rfcomm_dev_state_change+0x92/0x160 [rfcomm]
   [f89d15e8] __rfcomm_dlc_close+0x58/0xd0 [rfcomm]
   [f89d2523] rfcomm_recv_ua+0x73/0x140 [rfcomm]
   [f89d3151] rfcomm_recv_frame+0x171/0x1e0 [rfcomm]
   [c0155659] trace_hardirqs_on+0xb9/0x130
   [c0436a39] _spin_unlock_irqrestore+0x39/0x70
   [f89d3447] rfcomm_run+0xe7/0x590 [rfcomm]
   [c012] hpet_legacy_next_event+0x20/0x50
   [f89d3360] rfcomm_run+0x0/0x590 [rfcomm]
   [c0146e0c] kthread+0x5c/0xa0
   [c0146db0] kthread+0x0/0xa0
   [c0105c17] kernel_thread_helper+0x7/0x10
   [] 0x

other info that might help us debug this:

2 locks held by krfcommd/2912:
 #0:  (rfcomm_mutex){--..}, at: [f89d33db] rfcomm_run+0x7b/0x590 [rfcomm]
 #1:  (d-lock){--..}, at: [f89d15d3] __rfcomm_dlc_close+0x43/0xd0 [rfcomm]

stack backtrace:
Pid: 2912, 

Re: [IPV4 0/9] TRIE performance patches

2008-01-24 Thread Robert Olsson

Stephen Hemminger writes:

  Dumping by prefix is possible, but unless 32x slower. Dumping in
  address order is just as logical. Like I said, I'm investigating what
  quagga handles.

 How about taking a snapshot to in address order (as you did) to some 
 allocated memory, returning from that memory in prefix order? This would 
 solve the  -EBUSY too and give a consistent view of the routing table at
 the time for the dump/snapshot.

 Cheers
--ro
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[resend][PATCH] Introducing socket mark socket option

2008-01-24 Thread Laszlo Attila Toth
A userspace program may wish to set the mark for each packets its send
without using the netfilter MARK target. Changing the mark can be used
for mark based routing without netfilter or for packet filtering.

It requires CAP_NET_ADMIN capability.

Signed-off-by: Laszlo Attila Toth [EMAIL PROTECTED]
---
 include/asm-alpha/socket.h|2 ++
 include/asm-arm/socket.h  |2 ++
 include/asm-avr32/socket.h|2 ++
 include/asm-blackfin/socket.h |3 +++
 include/asm-cris/socket.h |2 ++
 include/asm-frv/socket.h  |2 ++
 include/asm-h8300/socket.h|2 ++
 include/asm-ia64/socket.h |2 ++
 include/asm-m32r/socket.h |2 ++
 include/asm-m68k/socket.h |2 ++
 include/asm-mips/socket.h |2 ++
 include/asm-parisc/socket.h   |2 ++
 include/asm-powerpc/socket.h  |2 ++
 include/asm-s390/socket.h |2 ++
 include/asm-sh/socket.h   |2 ++
 include/asm-sparc/socket.h|2 ++
 include/asm-sparc64/socket.h  |1 +
 include/asm-v850/socket.h |2 ++
 include/asm-x86/socket.h  |2 ++
 include/asm-xtensa/socket.h   |2 ++
 include/net/route.h   |2 ++
 include/net/sock.h|2 ++
 net/core/sock.c   |   11 +++
 net/ipv4/ip_output.c  |3 +++
 net/ipv4/raw.c|2 ++
 net/ipv6/ip6_output.c |2 ++
 net/ipv6/raw.c|3 +++
 27 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h
index 1fede7f..08c9793 100644
--- a/include/asm-alpha/socket.h
+++ b/include/asm-alpha/socket.h
@@ -60,4 +60,6 @@
 #define SO_SECURITY_ENCRYPTION_TRANSPORT   20
 #define SO_SECURITY_ENCRYPTION_NETWORK 21
 
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h
index 65a1a64..6817be9 100644
--- a/include/asm-arm/socket.h
+++ b/include/asm-arm/socket.h
@@ -52,4 +52,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
diff --git a/include/asm-avr32/socket.h b/include/asm-avr32/socket.h
index a0d0507..35863f2 100644
--- a/include/asm-avr32/socket.h
+++ b/include/asm-avr32/socket.h
@@ -52,4 +52,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* __ASM_AVR32_SOCKET_H */
diff --git a/include/asm-blackfin/socket.h b/include/asm-blackfin/socket.h
index 5213c96..2ca702e 100644
--- a/include/asm-blackfin/socket.h
+++ b/include/asm-blackfin/socket.h
@@ -50,4 +50,7 @@
 #define SO_PASSSEC 34
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
+
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
diff --git a/include/asm-cris/socket.h b/include/asm-cris/socket.h
index 5b18dfd..9df0ca8 100644
--- a/include/asm-cris/socket.h
+++ b/include/asm-cris/socket.h
@@ -54,6 +54,8 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
 
 
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h
index a823bef..e51ca67 100644
--- a/include/asm-frv/socket.h
+++ b/include/asm-frv/socket.h
@@ -52,5 +52,7 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
 
diff --git a/include/asm-h8300/socket.h b/include/asm-h8300/socket.h
index 39911d8..da2520d 100644
--- a/include/asm-h8300/socket.h
+++ b/include/asm-h8300/socket.h
@@ -52,4 +52,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
diff --git a/include/asm-ia64/socket.h b/include/asm-ia64/socket.h
index 9e42ce4..d5ef0aa 100644
--- a/include/asm-ia64/socket.h
+++ b/include/asm-ia64/socket.h
@@ -61,4 +61,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_IA64_SOCKET_H */
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h
index 793d5d3..9a0e200 100644
--- a/include/asm-m32r/socket.h
+++ b/include/asm-m32r/socket.h
@@ -52,4 +52,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_M32R_SOCKET_H */
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h
index 6d21b90..dbc64e9 100644
--- a/include/asm-m68k/socket.h
+++ b/include/asm-m68k/socket.h
@@ -52,4 +52,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36

Re: [resend][PATCH] Introducing socket mark socket option

2008-01-24 Thread Patrick McHardy

Laszlo Attila Toth wrote:

A userspace program may wish to set the mark for each packets its send
without using the netfilter MARK target. Changing the mark can be used
for mark based routing without netfilter or for packet filtering.

It requires CAP_NET_ADMIN capability.



Looks good to me.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 2.6.24-rc8-mm1 : net tcp_input.c warnings

2008-01-24 Thread Ilpo Järvinen
On Thu, 24 Jan 2008, Dave Young wrote:

Hi Dave ( others),

 Thanks.

Thanks a lot, I was first to ignore all these because they occurred 
with newreno, but looked again... :-/

 New warning trigged with your debug patch:

This was probably with the earlier one I sent to you because there's still 
this case remaining which itself is valid:

 P: 5 L: 0 vs 0 S: 0 vs 1 w: 2044790889-2044796616 (0)

...snip... this is still ok state (S+L = P):

 P: 5 L: 0 vs 0 S: 0 vs 3 w: 2044790889-2044796616 (0)
 TCP wq(s)  
 TCP wq(h) +++h+
 l0 s3 f0 p5 seq: su2044790889 hs2044795029 sn2044796616
 [ cut here ]
 WARNING: at net/ipv4/tcp_input.c:2169 tcp_mark_head_lost+0x122/0x150()
 Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event
 snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss eeprom e100 psmouse
 snd_hda_intel snd_pcm snd_timer btusb bluetooth serio_raw snd 3c59x sg
 evdev thermal soundcore rtc_cmos snd_page_alloc rtc_core rtc_lib
 i2c_i801 processor button intel_agp dcdbas pcspkr agpgart
 Pid: 0, comm: swapper Not tainted 2.6.24-rc8-mm1 #8
  [c0132100] ? have_callable_console+0x20/0x30
  [c0131844] warn_on_slowpath+0x54/0x80
  [c03ffe54] ? tcp_print_queue+0x1a4/0x230
  [c0132438] ? vprintk+0x308/0x320
  [c0132438] ? vprintk+0x308/0x320
  [c0132438] ? vprintk+0x308/0x320
  [c036] ? tcp_verify_wq+0x116/0x1c0
  [c03f6052] tcp_mark_head_lost+0x122/0x150
  [c03f60ca] tcp_update_scoreboard+0x4a/0x190
  [c03f6e7a] tcp_fastretrans_alert+0x4da/0x700
  [c03f7e63] tcp_ack+0x1b3/0x3a0
  [c03fa21b] tcp_rcv_established+0x3eb/0x710
  [c0401c05] tcp_v4_do_rcv+0xe5/0x100
  [c04021fb] tcp_v4_rcv+0x5db/0x660
  [c0401fa7] ? tcp_v4_rcv+0x387/0x660
  [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
  [c03e5f44] ip_local_deliver_finish+0x84/0x1d0
  [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
  [c0156b97] ? __lock_release+0x47/0x70
  [c03e6147] ip_local_deliver+0xb7/0xc0
  [c03e6202] ip_rcv_finish+0xb2/0x3c0
  [c03c01d8] ? sock_def_readable+0x48/0xa0
  [c03be061] ? sock_queue_rcv_skb+0xb1/0x1a0
  [c03be0a7] ? sock_queue_rcv_skb+0xf7/0x1a0
  [c03e669f] ip_rcv+0x18f/0x290
  [c042fb10] ? packet_rcv_spkt+0xd0/0x130
  [c03c8da6] netif_receive_skb+0x2b6/0x330
  [c03c8c17] ? netif_receive_skb+0x127/0x330
  [c03c8ea3] ? process_backlog+0x83/0x100
  [c03c8eae] process_backlog+0x8e/0x100
  [c03c90bc] net_rx_action+0x13c/0x230
  [c03c8fd9] ? net_rx_action+0x59/0x230
  [c0136f63] __do_softirq+0x93/0x120
  [c013706a] do_softirq+0x7a/0x80
  [c0137135] irq_exit+0x65/0x90
  [c01078b1] do_IRQ+0x41/0x80
  [c0155659] ? trace_hardirqs_on+0xb9/0x130
  [c01059ca] common_interrupt+0x2e/0x34
  [c0103390] ? mwait_idle_with_hints+0x40/0x50
  [c01033a0] ? mwait_idle+0x0/0x20
  [c01033b2] mwait_idle+0x12/0x20
  [c0103141] cpu_idle+0x61/0x110
  [c04339fd] rest_init+0x5d/0x60
  [c05a47fa] start_kernel+0x1fa/0x260
  [c05a4190] ? unknown_bootoption+0x0/0x130
  ===
 ---[ end trace 14b601818e6903ac ]---
 [ cut here ]
 WARNING: at net/ipv4/tcp_ipv4.c:197 tcp_verify_wq+0x1b6/0x1c0()
 Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event
 snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss eeprom e100 psmouse
 snd_hda_intel snd_pcm snd_timer btusb bluetooth serio_raw snd 3c59x sg
 evdev thermal soundcore rtc_cmos snd_page_alloc rtc_core rtc_lib
 i2c_i801 processor button intel_agp dcdbas pcspkr agpgart
 Pid: 0, comm: swapper Not tainted 2.6.24-rc8-mm1 #8
  [c0132100] ? have_callable_console+0x20/0x30
  [c0131844] warn_on_slowpath+0x54/0x80
  [c01317da] ? print_oops_end_marker+0x2a/0x30
  [c0131849] ? warn_on_slowpath+0x59/0x80
  [c03ffe54] ? tcp_print_queue+0x1a4/0x230
  [c0132438] ? vprintk+0x308/0x320
  [c0132438] ? vprintk+0x308/0x320
  [c0400096] tcp_verify_wq+0x1b6/0x1c0
  [c036] ? tcp_verify_wq+0x116/0x1c0
  [c03f5ffc] tcp_mark_head_lost+0xcc/0x150
  [c03f60ca] tcp_update_scoreboard+0x4a/0x190
  [c03f6e7a] tcp_fastretrans_alert+0x4da/0x700
  [c03f7e63] tcp_ack+0x1b3/0x3a0
  [c03fa21b] tcp_rcv_established+0x3eb/0x710
  [c0401c05] tcp_v4_do_rcv+0xe5/0x100
  [c04021fb] tcp_v4_rcv+0x5db/0x660
  [c0401fa7] ? tcp_v4_rcv+0x387/0x660
  [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
  [c03e5f44] ip_local_deliver_finish+0x84/0x1d0
  [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
  [c0156b97] ? __lock_release+0x47/0x70
  [c03e6147] ip_local_deliver+0xb7/0xc0
  [c03e6202] ip_rcv_finish+0xb2/0x3c0
  [c03c01d8] ? sock_def_readable+0x48/0xa0
  [c03be061] ? sock_queue_rcv_skb+0xb1/0x1a0
  [c03be0a7] ? sock_queue_rcv_skb+0xf7/0x1a0
  [c03e669f] ip_rcv+0x18f/0x290
  [c042fb10] ? packet_rcv_spkt+0xd0/0x130
  [c03c8da6] netif_receive_skb+0x2b6/0x330
  [c03c8c17] ? netif_receive_skb+0x127/0x330
  [c03c8ea3] ? process_backlog+0x83/0x100
  [c03c8eae] process_backlog+0x8e/0x100
  [c03c90bc] net_rx_action+0x13c/0x230
  [c03c8fd9] ? net_rx_action+0x59/0x230
  [c0136f63] __do_softirq+0x93/0x120
  [c013706a] do_softirq+0x7a/0x80
  [c0137135] irq_exit+0x65/0x90
  [c01078b1] do_IRQ+0x41/0x80
  

Re: My 802.3ad is my bond

2008-01-24 Thread Steven Whitehouse
Hi,

On Wed, 2008-01-23 at 09:13 -0800, Jay Vosburgh wrote:
 Steven Whitehouse [EMAIL PROTECTED] wrote:
 [...]
 This commit: ece95f7fefe3afae19e641e1b3f5e64b00d5b948 seems to have
 caused a problem with parsing bond arguments as now only the numeric
 arguments seem to work (in modprobe.conf) and specifying 802.3ad fails.
 When I revert that patch in my local tree all seems ok.
 
   Thanks for the report; I know what the problem here is.  I'll
 get a fix out.
 
 Also I notice that one of my two NICs now reports this:
 
 bonding: bond0: link status definitely down for interface eth0,
 disabling it
 bonding: bond0: Interface eth0 is already enslaved!
 bond0.5: no IPv6 routers present
 
 which I think is also new with this set of bonding updates, before it
 used to use both interfaces ok. I've not worked out which of the other
 patches causes this so far, but I can if its helpful,
 
   That would be helpful, as would some more details: e.g., the
 various options passed to bonding, the complete dmesg log, contents of
 /proc/net/bonding/bond0 [or whatever your interface is called], and
 anything else you think would be helpful.
 
   -J
 
I've been through all the patches now, reverting each in turn and it
seems that I still have the problem. Thats rather odd as I'm sure that I
didn't have only one interface working before. When I get a moment I'll
try and work out whats going on here,

Steve.


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 2.6.24-rc8-mm1 : net tcp_input.c warnings

2008-01-24 Thread Ilpo Järvinen
On Thu, 24 Jan 2008, Ilpo Järvinen wrote:

 And anyway, there were some fackets_out related 
 problems reported as well and this doesn't help for that but I think I've 
 lost track of who was seeing it due to large number of reports :-), could 
 somebody refresh my memory because I currently don't have time to dig it 
 up from archives (at least on this week).

Here's the updated debug patch for net-2.6.25/mm for tracking 
fackets_out inconsistencies (it won't work for trees which don't
include net-2.6.25, mm does of course :-)).

I hope I got it into good shape this time to avoid spurious stacktraces 
but still maintaining 100% accuracy, but it's not a simple oneliner so I 
might have missed something... :-)

I'd suggest that people trying with this first apply the newreno fix of 
the previous mail to avoid already-fixed case from triggering.

-- 
 i.

--
[PATCH] [TCP]: debug S+L (for net-2.5.26 / mm, incompatible with mainline)

---
 include/net/tcp.h |5 ++-
 net/ipv4/tcp_input.c  |   18 +++-
 net/ipv4/tcp_ipv4.c   |  127 +
 net/ipv4/tcp_output.c |   23 +++--
 4 files changed, 165 insertions(+), 8 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 7de4ea3..552aa71 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -272,6 +272,9 @@ DECLARE_SNMP_STAT(struct tcp_mib, tcp_statistics);
 #define TCP_ADD_STATS_BH(field, val)   SNMP_ADD_STATS_BH(tcp_statistics, 
field, val)
 #define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, 
field, val)
 
+extern void tcp_print_queue(struct sock *sk);
+extern voidtcp_verify_wq(struct sock *sk);
+
 extern voidtcp_v4_err(struct sk_buff *skb, u32);
 
 extern voidtcp_shutdown (struct sock *sk, int how);
@@ -768,7 +771,7 @@ static inline __u32 tcp_current_ssthresh(const struct sock 
*sk)
 }
 
 /* Use define here intentionally to get WARN_ON location shown at the caller */
-#define tcp_verify_left_out(tp)WARN_ON(tcp_left_out(tp)  
tp-packets_out)
+#define tcp_verify_left_out(tp)tcp_verify_wq((struct sock *)tp)
 
 extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
 extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 19c449f..c897c93 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1426,8 +1426,10 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff 
*ack_skb,
int first_sack_index;
 
if (!tp-sacked_out) {
-   if (WARN_ON(tp-fackets_out))
+   if (WARN_ON(tp-fackets_out)) {
+   tcp_verify_left_out(tp);
tp-fackets_out = 0;
+   }
tcp_highest_sack_reset(sk);
}
 
@@ -2136,6 +2138,8 @@ static void tcp_mark_head_lost(struct sock *sk, int 
packets, int fast_rexmit)
struct sk_buff *skb;
int cnt;
 
+   tcp_verify_left_out(tp);
+
BUG_TRAP(packets = tp-packets_out);
if (tp-lost_skb_hint) {
skb = tp-lost_skb_hint;
@@ -2501,6 +2505,8 @@ static void tcp_fastretrans_alert(struct sock *sk, int 
pkts_acked, int flag)
(tcp_fackets_out(tp)  tp-reordering));
int fast_rexmit = 0;
 
+   tcp_verify_left_out(tp);
+
if (WARN_ON(!tp-packets_out  tp-sacked_out))
tp-sacked_out = 0;
if (WARN_ON(!tp-sacked_out  tp-fackets_out))
@@ -2645,6 +2651,10 @@ static void tcp_fastretrans_alert(struct sock *sk, int 
pkts_acked, int flag)
if (do_lost || (tcp_is_fack(tp)  tcp_head_timedout(sk)))
tcp_update_scoreboard(sk, fast_rexmit);
tcp_cwnd_down(sk, flag);
+
+   WARN_ON(tcp_write_queue_head(sk) == NULL);
+   WARN_ON(!tp-packets_out);
+
tcp_xmit_retransmit_queue(sk);
 }
 
@@ -2848,6 +2858,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, int 
prior_fackets)
tcp_clear_all_retrans_hints(tp);
}
 
+   tcp_verify_left_out(tp);
+
if (skb  (TCP_SKB_CB(skb)-sacked  TCPCB_SACKED_ACKED))
flag |= FLAG_SACK_RENEGING;
 
@@ -3175,6 +3187,8 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, 
int flag)
prior_fackets = tp-fackets_out;
prior_in_flight = tcp_packets_in_flight(tp);
 
+   tcp_verify_left_out(tp);
+
if (!(flag  FLAG_SLOWPATH)  after(ack, prior_snd_una)) {
/* Window is constant, pure forward advance.
 * No more checks are required.
@@ -3237,6 +3251,8 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, 
int flag)
if ((flag  FLAG_FORWARD_PROGRESS) || !(flag  FLAG_NOT_DUP))
dst_confirm(sk-sk_dst_cache);
 
+   tcp_verify_left_out(tp);
+
return 1;
 
 no_queue:
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 9aea88b..e6e3ad5 100644
--- 

[PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM driver for MPC8323eRDB. Also includes related QE changes and dts entries.

2008-01-24 Thread Poonam_Aggrwal-b10812
Thanks Stephen for your comments, incorporated them.
From: Poonam Aggrwal [EMAIL PROTECTED]

This patch makes necessary changes in the QE and UCC framework to support 
TDM. It also adds support to configure the BRG properly through device 
tree entries. Includes the device tree changes for UCC TDM driver as well.
It also includes device tree entries for UCC TDM driver.

Tested on MPC8323ERDB platform.

Signed-off-by: Poonam Aggrwal [EMAIL PROTECTED]
Signed-off-by: Ashish Kalra [EMAIL PROTECTED]
Signed-off-by: Kim Phillips [EMAIL PROTECTED]
Signed-off-by: Michael Barkowski [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/mpc832x_rdb.dts |   58 +++
 arch/powerpc/sysdev/qe_lib/qe.c   |  184 +--
 arch/powerpc/sysdev/qe_lib/ucc.c  |  265 +
 arch/powerpc/sysdev/qe_lib/ucc_fast.c |   37 +
 include/asm-powerpc/qe.h  |8 +
 include/asm-powerpc/ucc.h |4 +
 include/asm-powerpc/ucc_fast.h|4 +
 7 files changed, 548 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts 
b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index 388c8a7..c0e6283 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -105,6 +105,17 @@
device_type = par_io;
num-ports = 7;
 
+   ucc1pio:[EMAIL PROTECTED] {
+   pio-map = 
+   /* port  pin  dir  open_drain  assignment  has_irq */
+   0  e  2  0  1  0/* CLK11 */
+   3 16  1  0  2  0/* BRG9 */
+   3 1b  1  0  2  0/* BRG3 */
+   0  0  3  0  2  0/* TDMATxD0 */
+   0  4  3  0  2  0/* TDMARxD0 */
+   3 1b  2  0  1  0;  /* CLK1 */
+   };
+
ucc2pio:[EMAIL PROTECTED] {
pio-map = 
/* port  pin  dir  open_drain  assignment  has_irq */
@@ -169,6 +180,36 @@
};
};
 
+   clocks {
+   compatible = fsl,cpm-clocks;
+   /* clock freqs in Hz(for CLK1~CLK24).
+* CLK11 is 1024KHz,
+* all other clocks unused
+* #clock-cells define number of cells
+* used by the clock-frequency.
+* right now only #clock cells=1 is
+* implemented. Provision is there to
+* handle frequencies 4Gig
+*/
+   #clock-cells = 1;
+   clock-frequency = 0 0 0 0 0 0
+  0 0 0 0 d#1024000 0
+  0 0 0 0 0 0
+  0 0 0 0 0 0;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = fsl,cpm-brg;
+   /* input clock sources for all the 16 BRGs.
+* 1-24 for CLK1 to CLK24.
+* BRG9 uses CLK11,BRG1 and BRG2-8 use
+* the QE clock.
+*/
+   fsl,brg-sources = 0 0 0 0 0 0 0 0
+  b 0 0 0 0 0 0 0;
+   reg = 640 7f;
+   };
+
[EMAIL PROTECTED] {
device_type = spi;
compatible = fsl_spi;
@@ -187,6 +228,23 @@
mode = cpu;
};
 
+   [EMAIL PROTECTED] {
+   device_type = tdm;
+   compatible = fsl,ucc-tdm;
+   model = UCC;
+   device-id = 1;
+   fsl,tdm-num = 1;
+   fsl,si-num = 1;
+   fsl,tdm-tx-clk = CLK1;
+   fsl,tdm-rx-clk = CLK1;
+   fsl,tdm-tx-sync = BRG9;
+   fsl,tdm-rx-sync = BRG9;
+   reg = 2000 200;
+   interrupts = 20;
+   interrupt-parent = qeic;
+   pio-handle = ucc1pio;
+   };
+
[EMAIL PROTECTED] {
device_type = network;
compatible = ucc_geth;
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 1df3b4a..9b9971d 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -149,20 +149,170 @@ EXPORT_SYMBOL(qe_issue_cmd);
  */
 static unsigned int brg_clk = 0;
 
-unsigned int get_brg_clk(void)
+u32 get_brg_clk(enum qe_clock brgclk, enum 

[PATCH 1/1][NETNS] Add missing initialization of nl_info.nl_net in rtm_to_fib6_config()

2008-01-24 Thread Benjamin Thery
Add missing initialization of the new nl_info.nl_net field in 
rtm_to_fib6_config(). This will be needed the store network namespace
associated to the fib6_config struct.

Signed-off-by: Benjamin Thery [EMAIL PROTECTED]
---
 net/ipv6/route.c |1 +
 1 file changed, 1 insertion(+)

Index: net-2.6.25/net/ipv6/route.c
===
--- net-2.6.25.orig/net/ipv6/route.c
+++ net-2.6.25/net/ipv6/route.c
@@ -1955,6 +1955,7 @@ static int rtm_to_fib6_config(struct sk_
 
cfg-fc_nlinfo.pid = NETLINK_CB(skb).pid;
cfg-fc_nlinfo.nlh = nlh;
+   cfg-fc_nlinfo.nl_net = skb-sk-sk_net;
 
if (tb[RTA_GATEWAY]) {
nla_memcpy(cfg-fc_gateway, tb[RTA_GATEWAY], 16);

-- 
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH UCC TDM 2/3 ]Updated: UCC TDM driver for QE based MPC83xx platforms.

2008-01-24 Thread Poonam_Aggrwal-b10812
Incorporated Stephen's comments.

From: Poonam Agarwal-b10812 [EMAIL PROTECTED]

The UCC TDM driver basically multiplexes and demultiplexes data from
different channels. It can interface with for example SLIC kind of devices
to receive TDM data  demultiplex it and send to upper modules. At the
transmit end it receives data for different channels multiplexes it and
sends them on the TDM channel. It internally uses TSA( Time Slot Assigner)
which does multiplexing and demultiplexing, UCC to perform SDMA between
host buffers and the TSA, CMX to connect TSA to UCC.

It can be used by a kernel module which can call tdm_register_client to
get access to a TDM device.

The driver is right now a misc driver with no subsystem as such.
There can be a platform independent TDM layer which is planned to be
done after this. TDM bus sort of thing.

The dts file keeps a track of the TDM devices present on the board.
Depending on them the TDM driver initializes those many driver instances
while coming up.

The driver on the upper level can plug to more than one tdm clients
depending on the availablity of TDM devices. At every new request of a TDM
client to bind with a TDM device, a free driver instance is allocated to
the client.

The interface can be described as follows.

tdm_register_client(struct tdm_client *)
   This API returns a pointer to the structure tdm_client which is of
type
  struct tdm_client {
   u32 client_id;
   u32 (*tdm_read)(u32 client_id, short chn_id, short
*pcm_buffer, short len);
   u32 (*tdm_write)(u32 client_id, short chn_id, short
*pcm_buffer, short len);
   wait_queue_head_t *wakeup_event;
   }

It consists of:
  - client_id: It is basically to identify the particular TDM
device/driver instance.
  - tdm_read: It is a function pointer returned by the TDM driver to be
used to read TDM data from a particular TDM channel.
  - tdm_write: It is a function pointer returned by the TDM driver to be
used to write TDM data to a particular TDM channel.
  - wakeup_event: It is address of a wait_queue event on which the client
keeps on sleeping, and the TDM driver wakes it up periodically. The driver
is configured to
wake up the client after every 10ms.

Once the TDM client gets registered to a TDM driver instance and a TDM
device, it interfaces with the driver using tdm_read, tdm_write and
wakeup_event.

This driver will run on MPC8323E-RDB platforms.

Signed-off-by: Poonam Aggrwal [EMAIL PROTECTED]
Signed-off-by: Ashish Kalra [EMAIL PROTECTED]
Signed-off-by: Kim Phillips [EMAIL PROTECTED]
Signed-off-by: Michael Barkowski [EMAIL PROTECTED]
---
 drivers/misc/Kconfig   |   14 +
 drivers/misc/Makefile  |1 +
 drivers/misc/ucc_tdm.c | 1017 
 drivers/misc/ucc_tdm.h |  221 +++
 4 files changed, 1253 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/ucc_tdm.c
 create mode 100644 drivers/misc/ucc_tdm.h

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index b5e67c0..628b14b 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -232,4 +232,18 @@ config ATMEL_SSC
 
  If unsure, say N.
 
+config UCC_TDM
+   bool Freescale UCC  TDM Driver
+   depends on QUICC_ENGINE  UCC_FAST
+   default n
+   ---help---
+ The TDM driver is for UCC based TDM devices for example, TDM device on
+ MPC832x RDB. Select it to run PowerVoIP on MPC832x RDB board.
+ The TDM driver can interface with SLIC kind of devices to transmit
+ and receive TDM samples. The TDM driver receives Time Division
+ multiplexed samples(for different channels) from the SLIC device,
+ demutiplexes them and sends them to the upper layers. At the transmit
+ end the TDM drivers receives samples for different channels, it
+ multiplexes them and sends them to the SLIC device.
+
 endif # MISC_DEVICES
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 87f2685..6f0c49d 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o
 obj-$(CONFIG_THINKPAD_ACPI)+= thinkpad_acpi.o
 obj-$(CONFIG_FUJITSU_LAPTOP)   += fujitsu-laptop.o
 obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o
+obj-$(CONFIG_UCC_TDM)  += ucc_tdm.o
diff --git a/drivers/misc/ucc_tdm.c b/drivers/misc/ucc_tdm.c
new file mode 100644
index 000..2181132
--- /dev/null
+++ b/drivers/misc/ucc_tdm.c
@@ -0,0 +1,1017 @@
+/*
+ * drivers/misc/ucc_tdm.c
+ *
+ * UCC Based Linux TDM Driver
+ * This driver is designed to support UCC based TDM for PowerPC processors.
+ * This driver can interface with SLIC device to run VOIP kind of
+ * applications.
+ *
+ * Author: Ashish Kalra  Poonam Aggrwal
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by 

Re: 2.6.24-rc8-mm1 : net tcp_input.c warnings

2008-01-24 Thread Krishna Kumar2
Hi Ilpo,

I have tried parallel iperfs with this patch and don't get any more
warnings.
I will run overnight to be sure.

thanks,

- KK

[EMAIL PROTECTED] wrote on 01/24/2008 03:24:18 PM:

 On Thu, 24 Jan 2008, Dave Young wrote:

 Hi Dave ( others),

  Thanks.

 Thanks a lot, I was first to ignore all these because they occurred
 with newreno, but looked again... :-/

  New warning trigged with your debug patch:

 This was probably with the earlier one I sent to you because there's
still
 this case remaining which itself is valid:

  P: 5 L: 0 vs 0 S: 0 vs 1 w: 2044790889-2044796616 (0)

 ...snip... this is still ok state (S+L = P):

  P: 5 L: 0 vs 0 S: 0 vs 3 w: 2044790889-2044796616 (0)
  TCP wq(s)  
  TCP wq(h) +++h+
  l0 s3 f0 p5 seq: su2044790889 hs2044795029 sn2044796616
  [ cut here ]
  WARNING: at net/ipv4/tcp_input.c:2169 tcp_mark_head_lost+0x122/0x150()
  Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event
  snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss eeprom e100 psmouse
  snd_hda_intel snd_pcm snd_timer btusb bluetooth serio_raw snd 3c59x sg
  evdev thermal soundcore rtc_cmos snd_page_alloc rtc_core rtc_lib
  i2c_i801 processor button intel_agp dcdbas pcspkr agpgart
  Pid: 0, comm: swapper Not tainted 2.6.24-rc8-mm1 #8
   [c0132100] ? have_callable_console+0x20/0x30
   [c0131844] warn_on_slowpath+0x54/0x80
   [c03ffe54] ? tcp_print_queue+0x1a4/0x230
   [c0132438] ? vprintk+0x308/0x320
   [c0132438] ? vprintk+0x308/0x320
   [c0132438] ? vprintk+0x308/0x320
   [c036] ? tcp_verify_wq+0x116/0x1c0
   [c03f6052] tcp_mark_head_lost+0x122/0x150
   [c03f60ca] tcp_update_scoreboard+0x4a/0x190
   [c03f6e7a] tcp_fastretrans_alert+0x4da/0x700
   [c03f7e63] tcp_ack+0x1b3/0x3a0
   [c03fa21b] tcp_rcv_established+0x3eb/0x710
   [c0401c05] tcp_v4_do_rcv+0xe5/0x100
   [c04021fb] tcp_v4_rcv+0x5db/0x660
   [c0401fa7] ? tcp_v4_rcv+0x387/0x660
   [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
   [c03e5f44] ip_local_deliver_finish+0x84/0x1d0
   [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
   [c0156b97] ? __lock_release+0x47/0x70
   [c03e6147] ip_local_deliver+0xb7/0xc0
   [c03e6202] ip_rcv_finish+0xb2/0x3c0
   [c03c01d8] ? sock_def_readable+0x48/0xa0
   [c03be061] ? sock_queue_rcv_skb+0xb1/0x1a0
   [c03be0a7] ? sock_queue_rcv_skb+0xf7/0x1a0
   [c03e669f] ip_rcv+0x18f/0x290
   [c042fb10] ? packet_rcv_spkt+0xd0/0x130
   [c03c8da6] netif_receive_skb+0x2b6/0x330
   [c03c8c17] ? netif_receive_skb+0x127/0x330
   [c03c8ea3] ? process_backlog+0x83/0x100
   [c03c8eae] process_backlog+0x8e/0x100
   [c03c90bc] net_rx_action+0x13c/0x230
   [c03c8fd9] ? net_rx_action+0x59/0x230
   [c0136f63] __do_softirq+0x93/0x120
   [c013706a] do_softirq+0x7a/0x80
   [c0137135] irq_exit+0x65/0x90
   [c01078b1] do_IRQ+0x41/0x80
   [c0155659] ? trace_hardirqs_on+0xb9/0x130
   [c01059ca] common_interrupt+0x2e/0x34
   [c0103390] ? mwait_idle_with_hints+0x40/0x50
   [c01033a0] ? mwait_idle+0x0/0x20
   [c01033b2] mwait_idle+0x12/0x20
   [c0103141] cpu_idle+0x61/0x110
   [c04339fd] rest_init+0x5d/0x60
   [c05a47fa] start_kernel+0x1fa/0x260
   [c05a4190] ? unknown_bootoption+0x0/0x130
   ===
  ---[ end trace 14b601818e6903ac ]---
  [ cut here ]
  WARNING: at net/ipv4/tcp_ipv4.c:197 tcp_verify_wq+0x1b6/0x1c0()
  Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event
  snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss eeprom e100 psmouse
  snd_hda_intel snd_pcm snd_timer btusb bluetooth serio_raw snd 3c59x sg
  evdev thermal soundcore rtc_cmos snd_page_alloc rtc_core rtc_lib
  i2c_i801 processor button intel_agp dcdbas pcspkr agpgart
  Pid: 0, comm: swapper Not tainted 2.6.24-rc8-mm1 #8
   [c0132100] ? have_callable_console+0x20/0x30
   [c0131844] warn_on_slowpath+0x54/0x80
   [c01317da] ? print_oops_end_marker+0x2a/0x30
   [c0131849] ? warn_on_slowpath+0x59/0x80
   [c03ffe54] ? tcp_print_queue+0x1a4/0x230
   [c0132438] ? vprintk+0x308/0x320
   [c0132438] ? vprintk+0x308/0x320
   [c0400096] tcp_verify_wq+0x1b6/0x1c0
   [c036] ? tcp_verify_wq+0x116/0x1c0
   [c03f5ffc] tcp_mark_head_lost+0xcc/0x150
   [c03f60ca] tcp_update_scoreboard+0x4a/0x190
   [c03f6e7a] tcp_fastretrans_alert+0x4da/0x700
   [c03f7e63] tcp_ack+0x1b3/0x3a0
   [c03fa21b] tcp_rcv_established+0x3eb/0x710
   [c0401c05] tcp_v4_do_rcv+0xe5/0x100
   [c04021fb] tcp_v4_rcv+0x5db/0x660
   [c0401fa7] ? tcp_v4_rcv+0x387/0x660
   [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
   [c03e5f44] ip_local_deliver_finish+0x84/0x1d0
   [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
   [c0156b97] ? __lock_release+0x47/0x70
   [c03e6147] ip_local_deliver+0xb7/0xc0
   [c03e6202] ip_rcv_finish+0xb2/0x3c0
   [c03c01d8] ? sock_def_readable+0x48/0xa0
   [c03be061] ? sock_queue_rcv_skb+0xb1/0x1a0
   [c03be0a7] ? sock_queue_rcv_skb+0xf7/0x1a0
   [c03e669f] ip_rcv+0x18f/0x290
   [c042fb10] ? packet_rcv_spkt+0xd0/0x130
   [c03c8da6] netif_receive_skb+0x2b6/0x330
   [c03c8c17] ? netif_receive_skb+0x127/0x330
   

[XFRM]: constify 'struct xfrm_type'

2008-01-24 Thread Eric Dumazet
Signed-off-by: Eric Dumazet [EMAIL PROTECTED]

 include/net/xfrm.h  |8 
 net/ipv4/ah4.c  |2 +-
 net/ipv4/esp4.c |2 +-
 net/ipv4/ipcomp.c   |2 +-
 net/ipv4/xfrm4_tunnel.c |2 +-
 net/ipv6/ah6.c  |2 +-
 net/ipv6/esp6.c |2 +-
 net/ipv6/ipcomp6.c  |2 +-
 net/ipv6/mip6.c |4 ++--
 net/ipv6/xfrm6_tunnel.c |2 +-
 net/xfrm/xfrm_state.c   |   16 
 11 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 5ebb9ba..02d9b1e 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -201,7 +201,7 @@ struct xfrm_state
 
/* Reference to data common to all the instances of this
 * transformer. */
-   struct xfrm_type*type;
+   const struct xfrm_type  *type;
struct xfrm_mode*inner_mode;
struct xfrm_mode*outer_mode;
 
@@ -278,7 +278,7 @@ struct xfrm_state_afinfo {
unsigned intproto;
unsigned inteth_proto;
struct module   *owner;
-   struct xfrm_type*type_map[IPPROTO_MAX];
+   const struct xfrm_type  *type_map[IPPROTO_MAX];
struct xfrm_mode*mode_map[XFRM_MODE_MAX];
int (*init_flags)(struct xfrm_state *x);
void(*init_tempsel)(struct xfrm_state *x, struct 
flowi *fl,
@@ -321,8 +321,8 @@ struct xfrm_type
u32 (*get_mtu)(struct xfrm_state *, int size);
 };
 
-extern int xfrm_register_type(struct xfrm_type *type, unsigned short family);
-extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family);
+extern int xfrm_register_type(const struct xfrm_type *type, unsigned short 
family);
+extern int xfrm_unregister_type(const struct xfrm_type *type, unsigned short 
family);
 
 struct xfrm_mode {
/*
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 3003503..4463eeb 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -216,10 +216,10 @@ static void xfrm_state_unlock_afinfo(struct 
xfrm_state_afinfo *afinfo)
write_unlock_bh(xfrm_state_afinfo_lock);
 }
 
-int xfrm_register_type(struct xfrm_type *type, unsigned short family)
+int xfrm_register_type(const struct xfrm_type *type, unsigned short family)
 {
struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family);
-   struct xfrm_type **typemap;
+   const struct xfrm_type **typemap;
int err = 0;
 
if (unlikely(afinfo == NULL))
@@ -235,10 +235,10 @@ int xfrm_register_type(struct xfrm_type *type, unsigned 
short family)
 }
 EXPORT_SYMBOL(xfrm_register_type);
 
-int xfrm_unregister_type(struct xfrm_type *type, unsigned short family)
+int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family)
 {
struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family);
-   struct xfrm_type **typemap;
+   const struct xfrm_type **typemap;
int err = 0;
 
if (unlikely(afinfo == NULL))
@@ -254,11 +254,11 @@ int xfrm_unregister_type(struct xfrm_type *type, unsigned 
short family)
 }
 EXPORT_SYMBOL(xfrm_unregister_type);
 
-static struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family)
+static const struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family)
 {
struct xfrm_state_afinfo *afinfo;
-   struct xfrm_type **typemap;
-   struct xfrm_type *type;
+   const struct xfrm_type **typemap;
+   const struct xfrm_type *type;
int modload_attempted = 0;
 
 retry:
@@ -281,7 +281,7 @@ retry:
return type;
 }
 
-static void xfrm_put_type(struct xfrm_type *type)
+static void xfrm_put_type(const struct xfrm_type *type)
 {
module_put(type-owner);
 }
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index d76803a..9d4555e 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -300,7 +300,7 @@ static void ah_destroy(struct xfrm_state *x)
 }
 
 
-static struct xfrm_type ah_type =
+static const struct xfrm_type ah_type =
 {
.description= AH4,
.owner  = THIS_MODULE,
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 28ea5c7..602779d 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -448,7 +448,7 @@ error:
return -EINVAL;
 }
 
-static struct xfrm_type esp_type =
+static const struct xfrm_type esp_type =
 {
.description= ESP4,
.owner  = THIS_MODULE,
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index f4af99a..b271f87 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -434,7 +434,7 @@ error:
goto out;
 }
 
-static struct xfrm_type ipcomp_type = {
+static const struct xfrm_type ipcomp_type = {
.description= IPCOMP4,
.owner  = THIS_MODULE,
.proto  = IPPROTO_COMP,
diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c
index 3268451..87f77e4 100644
--- a/net/ipv4/xfrm4_tunnel.c
+++ 

Re: [PATCH net-2.6.25] Add packet filtering based on process's security context.

2008-01-24 Thread Tetsuo Handa
Hello.

Are there any remaining questions/problems about this patch?
If none, I want this patch applied to net-2.6.25 tree.

Regards.

---
This patch modifies security_socket_post_accept() and introduces
security_socket_post_recv_datagram() LSM hooks.

Currently, security_socket_post_accept() is called *after* fd_install()
at sys_accept(). This means that userland process might access accept()ed
but not yet properly labeled socket.
I believe this security_socket_post_accept() should be called *before*
fd_install() for the three reasons.

 * The userland process will always access proper context labeled by
   security_socket_post_accept() rather than default context labeled by
   security_inode_alloc() (called from alloc_inode() from new_inode() from
   sock_alloc() from sys_accept()). This gives a security module
   a chance to perform access control based on proper context.

 * If security_socket_post_accept() failed to assign proper context
   (e.g. -ENOMEM), the accept()ed socket can't have proper context.
   Use of void for security_socket_post_accept() deprives a security module
   of a chance to abandon the accept()ed socket.

 * A security module can perform connection filtering based on
   process's security context.
   If security_socket_post_accept() is called after fd_install(),
   it is too late to do so because the accept()ed socket is already visible
   to userland processes.


Currently, there is no way to directly map security context from incoming
packet to user process. This is because the creator or owner of a socket is
not always the receiver of an incoming packet. The userland process who
receives the incoming packet is not known until a process calls sys_recvmsg().
So, I want to add a LSM hook to give a security module a chance to control
after the recipient of the incoming packet is known.

Signed-off-by: Kentaro Takeda [EMAIL PROTECTED]
Signed-off-by: Tetsuo Handa [EMAIL PROTECTED]
---
 include/linux/security.h |   34 +-
 net/core/datagram.c  |   29 -
 net/socket.c |7 +--
 security/dummy.c |   13 ++---
 security/security.c  |   10 --
 5 files changed, 80 insertions(+), 13 deletions(-)

--- net-2.6.25.orig/include/linux/security.h
+++ net-2.6.25/include/linux/security.h
@@ -781,8 +781,12 @@ struct request_sock;
  * @socket_post_accept:
  * This hook allows a security module to copy security
  * information into the newly created socket's inode.
+ * This hook also allows a security module to filter connections
+ * from unwanted peers based on the process accepting this connection.
+ * The connection will be aborted if this hook returns nonzero.
  * @sock contains the listening socket structure.
  * @newsock contains the newly created server socket for connection.
+ * Return 0 if permission is granted.
  * @socket_sendmsg:
  * Check permission before transmitting a message to another socket.
  * @sock contains the socket structure.
@@ -796,6 +800,15 @@ struct request_sock;
  * @size contains the size of message structure.
  * @flags contains the operational flags.
  * Return 0 if permission is granted.  
+ * @socket_post_recv_datagram:
+ * Check permission after receiving a datagram.
+ * This hook allows a security module to filter packets
+ * from unwanted peers based on the process receiving this datagram.
+ * The packet will be discarded if this hook returns nonzero.
+ * @sk contains the socket.
+ * @skb contains the socket buffer.
+ * @flags contains the operational flags.
+ * Return 0 if permission is granted.
  * @socket_getsockname:
  * Check permission before the local address (name) of the socket object
  * @sock is retrieved.
@@ -1387,12 +1400,13 @@ struct security_operations {
   struct sockaddr * address, int addrlen);
int (*socket_listen) (struct socket * sock, int backlog);
int (*socket_accept) (struct socket * sock, struct socket * newsock);
-   void (*socket_post_accept) (struct socket * sock,
-   struct socket * newsock);
+   int (*socket_post_accept) (struct socket *sock, struct socket *newsock);
int (*socket_sendmsg) (struct socket * sock,
   struct msghdr * msg, int size);
int (*socket_recvmsg) (struct socket * sock,
   struct msghdr * msg, int size, int flags);
+   int (*socket_post_recv_datagram) (struct sock *sk, struct sk_buff *skb,
+ unsigned int flags);
int (*socket_getsockname) (struct socket * sock);
int (*socket_getpeername) (struct socket * sock);
int (*socket_getsockopt) (struct socket * sock, int level, int optname);
@@ -2297,10 +2311,12 @@ int security_socket_bind(struct socket *
 int security_socket_connect(struct 

Re: [Lksctp-developers] [PATCH] SCTP: Fix kernel panic while received AUTH chunk with BAD shared key identifier

2008-01-24 Thread Neil Horman
On Tue, Jan 22, 2008 at 05:29:20PM +0900, Wei Yongjun wrote:
 
 
 This patch fix this problem.
 
 Signed-off-by: Wei Yongjun [EMAIL PROTECTED]
 
 --- a/net/sctp/auth.c 2008-01-21 00:03:25.0 -0500
 +++ b/net/sctp/auth.c 2008-01-21 21:31:47.0 -0500
 @@ -420,15 +420,15 @@ struct sctp_shared_key *sctp_auth_get_sh
   const struct sctp_association *asoc,
   __u16 key_id)
  {
 - struct sctp_shared_key *key = NULL;
 + struct sctp_shared_key *key;
  
   /* First search associations set of endpoint pair shared keys */
   key_for_each(key, asoc-endpoint_shared_keys) {
   if (key-key_id == key_id)
 - break;
 + return key;
   }
  
 - return key;
 + return NULL;
  }
  
  /*
 

FWIW, Ack from me.  The assignment of NULL to key can safely be removed, since
key_for_each (which is just list_for_each_entry under the covers does an initial
assignment to key anyway). 

If the endpoint_shared_keys list is empty, or if the key_id being requested does
not exist, the function as it currently stands returns the actuall list_head (in
this case endpoint_shared_keys.  Since that list_head isn't surrounded by an
actuall data structure, the last iteration through list_for_each_entry will do a
container_of on key, and we wind up returning a bogus pointer, instead of NULL,
as we should.  Wei's patch corrects that.

Regards
Neil

Acked-by: Neil Horman [EMAIL PROTECTED]

 
 
 -
 This SF.net email is sponsored by: Microsoft
 Defy all challenges. Microsoft(R) Visual Studio 2008.
 http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
 ___
 Lksctp-developers mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/lksctp-developers
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] netns netfilter: per-netns ip6tables

2008-01-24 Thread Alexey Dobriyan
* Propagate netns from userspace down to xt_find_table_lock()
* Register ip6 tables in netns (modules still use init_net)

Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]
---

 include/linux/netfilter_ipv6/ip6_tables.h |3 +
 net/ipv6/netfilter/ip6_tables.c   |   50 +++---
 net/ipv6/netfilter/ip6table_filter.c  |2 -
 net/ipv6/netfilter/ip6table_mangle.c  |2 -
 net/ipv6/netfilter/ip6table_raw.c |2 -
 5 files changed, 31 insertions(+), 28 deletions(-)

--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -305,7 +305,8 @@ ip6t_get_target(struct ip6t_entry *e)
 #include linux/init.h
 extern void ip6t_init(void) __init;
 
-extern struct xt_table *ip6t_register_table(struct xt_table *table,
+extern struct xt_table *ip6t_register_table(struct net *net,
+   struct xt_table *table,
const struct ip6t_replace *repl);
 extern void ip6t_unregister_table(struct xt_table *table);
 extern unsigned int ip6t_do_table(struct sk_buff *skb,
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -1118,7 +1118,7 @@ static int compat_table_info(const struct xt_table_info 
*info,
 }
 #endif
 
-static int get_info(void __user *user, int *len, int compat)
+static int get_info(struct net *net, void __user *user, int *len, int compat)
 {
char name[IP6T_TABLE_MAXNAMELEN];
struct xt_table *t;
@@ -1138,7 +1138,7 @@ static int get_info(void __user *user, int *len, int 
compat)
if (compat)
xt_compat_lock(AF_INET6);
 #endif
-   t = try_then_request_module(xt_find_table_lock(init_net, AF_INET6, 
name),
+   t = try_then_request_module(xt_find_table_lock(net, AF_INET6, name),
ip6table_%s, name);
if (t  !IS_ERR(t)) {
struct ip6t_getinfo info;
@@ -1178,7 +1178,7 @@ static int get_info(void __user *user, int *len, int 
compat)
 }
 
 static int
-get_entries(struct ip6t_get_entries __user *uptr, int *len)
+get_entries(struct net *net, struct ip6t_get_entries __user *uptr, int *len)
 {
int ret;
struct ip6t_get_entries get;
@@ -1196,7 +1196,7 @@ get_entries(struct ip6t_get_entries __user *uptr, int 
*len)
return -EINVAL;
}
 
-   t = xt_find_table_lock(init_net, AF_INET6, get.name);
+   t = xt_find_table_lock(net, AF_INET6, get.name);
if (t  !IS_ERR(t)) {
struct xt_table_info *private = t-private;
duprintf(t-private-number = %u\n, private-number);
@@ -1217,7 +1217,7 @@ get_entries(struct ip6t_get_entries __user *uptr, int 
*len)
 }
 
 static int
-__do_replace(const char *name, unsigned int valid_hooks,
+__do_replace(struct net *net, const char *name, unsigned int valid_hooks,
 struct xt_table_info *newinfo, unsigned int num_counters,
 void __user *counters_ptr)
 {
@@ -1235,7 +1235,7 @@ __do_replace(const char *name, unsigned int valid_hooks,
goto out;
}
 
-   t = try_then_request_module(xt_find_table_lock(init_net, AF_INET6, 
name),
+   t = try_then_request_module(xt_find_table_lock(net, AF_INET6, name),
ip6table_%s, name);
if (!t || IS_ERR(t)) {
ret = t ? PTR_ERR(t) : -ENOENT;
@@ -1288,7 +1288,7 @@ __do_replace(const char *name, unsigned int valid_hooks,
 }
 
 static int
-do_replace(void __user *user, unsigned int len)
+do_replace(struct net *net, void __user *user, unsigned int len)
 {
int ret;
struct ip6t_replace tmp;
@@ -1322,7 +1322,7 @@ do_replace(void __user *user, unsigned int len)
 
duprintf(ip_tables: Translated table\n);
 
-   ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo,
+   ret = __do_replace(net, tmp.name, tmp.valid_hooks, newinfo,
   tmp.num_counters, tmp.counters);
if (ret)
goto free_newinfo_untrans;
@@ -1358,7 +1358,7 @@ add_counter_to_entry(struct ip6t_entry *e,
 }
 
 static int
-do_add_counters(void __user *user, unsigned int len, int compat)
+do_add_counters(struct net *net, void __user *user, unsigned int len, int 
compat)
 {
unsigned int i;
struct xt_counters_info tmp;
@@ -1410,7 +1410,7 @@ do_add_counters(void __user *user, unsigned int len, int 
compat)
goto free;
}
 
-   t = xt_find_table_lock(init_net, AF_INET6, name);
+   t = xt_find_table_lock(net, AF_INET6, name);
if (!t || IS_ERR(t)) {
ret = t ? PTR_ERR(t) : -ENOENT;
goto free;
@@ -1815,7 +1815,7 @@ out_unlock:
 }
 
 static int
-compat_do_replace(void __user *user, unsigned int len)
+compat_do_replace(struct net *net, void __user *user, unsigned int len)
 {
int ret;
struct compat_ip6t_replace tmp;
@@ -1852,7 +1852,7 @@ compat_do_replace(void __user *user, 

[PATCH 2/5] netns netfilter: per-netns IPv6 FILTER, MANGLE, RAW

2008-01-24 Thread Alexey Dobriyan
Now it's possible to list and manipulate per-netns ip6tables rules.
Filtering decisions are based on init_net's table so far.

P.S.: remove init_net check in inet6_create() to see the effect

Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]
---

 include/net/netns/ipv6.h |6 +
 net/ipv6/netfilter/ip6table_filter.c |   40 +--
 net/ipv6/netfilter/ip6table_mangle.c |   40 +--
 net/ipv6/netfilter/ip6table_raw.c|   38 -
 4 files changed, 92 insertions(+), 32 deletions(-)

--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -31,5 +31,10 @@ struct netns_ipv6 {
struct ipv6_devconf *devconf_all;
struct ipv6_devconf *devconf_dflt;
struct netns_frags  frags;
+#ifdef CONFIG_NETFILTER
+   struct xt_table *ip6table_filter;
+   struct xt_table *ip6table_mangle;
+   struct xt_table *ip6table_raw;
+#endif
 };
 #endif
--- a/net/ipv6/netfilter/ip6table_filter.c
+++ b/net/ipv6/netfilter/ip6table_filter.c
@@ -26,7 +26,7 @@ static struct
struct ip6t_replace repl;
struct ip6t_standard entries[3];
struct ip6t_error term;
-} initial_table __initdata = {
+} initial_table __net_initdata = {
.repl = {
.name = filter,
.valid_hooks = FILTER_VALID_HOOKS,
@@ -51,14 +51,13 @@ static struct
.term = IP6T_ERROR_INIT,/* ERROR */
 };
 
-static struct xt_table __packet_filter = {
+static struct xt_table packet_filter = {
.name   = filter,
.valid_hooks= FILTER_VALID_HOOKS,
.lock   = RW_LOCK_UNLOCKED,
.me = THIS_MODULE,
.af = AF_INET6,
 };
-static struct xt_table *packet_filter;
 
 /* The work comes in here from netfilter.c. */
 static unsigned int
@@ -68,7 +67,7 @@ ip6t_hook(unsigned int hook,
 const struct net_device *out,
 int (*okfn)(struct sk_buff *))
 {
-   return ip6t_do_table(skb, hook, in, out, packet_filter);
+   return ip6t_do_table(skb, hook, in, out, init_net.ipv6.ip6table_filter);
 }
 
 static unsigned int
@@ -88,7 +87,7 @@ ip6t_local_out_hook(unsigned int hook,
}
 #endif
 
-   return ip6t_do_table(skb, hook, in, out, packet_filter);
+   return ip6t_do_table(skb, hook, in, out, init_net.ipv6.ip6table_filter);
 }
 
 static struct nf_hook_ops ip6t_ops[] __read_mostly = {
@@ -119,6 +118,26 @@ static struct nf_hook_ops ip6t_ops[] __read_mostly = {
 static int forward = NF_ACCEPT;
 module_param(forward, bool, );
 
+static int __net_init ip6table_filter_net_init(struct net *net)
+{
+   /* Register table */
+   net-ipv6.ip6table_filter =
+   ip6t_register_table(net, packet_filter, initial_table.repl);
+   if (IS_ERR(net-ipv6.ip6table_filter))
+   return PTR_ERR(net-ipv6.ip6table_filter);
+   return 0;
+}
+
+static void __net_exit ip6table_filter_net_exit(struct net *net)
+{
+   ip6t_unregister_table(net-ipv6.ip6table_filter);
+}
+
+static struct pernet_operations ip6table_filter_net_ops = {
+   .init = ip6table_filter_net_init,
+   .exit = ip6table_filter_net_exit,
+};
+
 static int __init ip6table_filter_init(void)
 {
int ret;
@@ -131,10 +150,9 @@ static int __init ip6table_filter_init(void)
/* Entry 1 is the FORWARD hook */
initial_table.entries[1].target.verdict = -forward - 1;
 
-   /* Register table */
-   packet_filter = ip6t_register_table(init_net, __packet_filter, 
initial_table.repl);
-   if (IS_ERR(packet_filter))
-   return PTR_ERR(packet_filter);
+   ret = register_pernet_subsys(ip6table_filter_net_ops);
+   if (ret  0)
+   return ret;
 
/* Register hooks */
ret = nf_register_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
@@ -144,14 +162,14 @@ static int __init ip6table_filter_init(void)
return ret;
 
  cleanup_table:
-   ip6t_unregister_table(packet_filter);
+   unregister_pernet_subsys(ip6table_filter_net_ops);
return ret;
 }
 
 static void __exit ip6table_filter_fini(void)
 {
nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
-   ip6t_unregister_table(packet_filter);
+   unregister_pernet_subsys(ip6table_filter_net_ops);
 }
 
 module_init(ip6table_filter_init);
--- a/net/ipv6/netfilter/ip6table_mangle.c
+++ b/net/ipv6/netfilter/ip6table_mangle.c
@@ -26,7 +26,7 @@ static struct
struct ip6t_replace repl;
struct ip6t_standard entries[5];
struct ip6t_error term;
-} initial_table __initdata = {
+} initial_table __net_initdata = {
.repl = {
.name = mangle,
.valid_hooks = MANGLE_VALID_HOOKS,
@@ -57,14 +57,13 @@ static struct
.term = IP6T_ERROR_INIT,/* ERROR */
 };
 
-static struct xt_table __packet_mangler = {
+static struct xt_table packet_mangler = {

[PATCH 3/5] netns netfilter: per-netns arp_tables

2008-01-24 Thread Alexey Dobriyan
* Propagate netns from userspace.
* arpt_register_table() registers table in supplied netns.

Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]
---

 include/linux/netfilter_arp/arp_tables.h |3 +
 net/ipv4/netfilter/arp_tables.c  |   55 +--
 net/ipv4/netfilter/arptable_filter.c |2 -
 3 files changed, 34 insertions(+), 26 deletions(-)

--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -271,7 +271,8 @@ struct arpt_error
xt_register_target(tgt); })
 #define arpt_unregister_target(tgt) xt_unregister_target(tgt)
 
-extern struct arpt_table *arpt_register_table(struct arpt_table *table,
+extern struct arpt_table *arpt_register_table(struct net *net,
+ struct arpt_table *table,
  const struct arpt_replace *repl);
 extern void arpt_unregister_table(struct arpt_table *table);
 extern unsigned int arpt_do_table(struct sk_buff *skb,
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -22,6 +22,7 @@
 #include linux/mutex.h
 #include linux/err.h
 #include net/compat.h
+#include net/sock.h
 #include asm/uaccess.h
 
 #include linux/netfilter/x_tables.h
@@ -850,7 +851,7 @@ static int compat_table_info(const struct xt_table_info 
*info,
 }
 #endif
 
-static int get_info(void __user *user, int *len, int compat)
+static int get_info(struct net *net, void __user *user, int *len, int compat)
 {
char name[ARPT_TABLE_MAXNAMELEN];
struct arpt_table *t;
@@ -870,7 +871,7 @@ static int get_info(void __user *user, int *len, int compat)
if (compat)
xt_compat_lock(NF_ARP);
 #endif
-   t = try_then_request_module(xt_find_table_lock(init_net, NF_ARP, name),
+   t = try_then_request_module(xt_find_table_lock(net, NF_ARP, name),
arptable_%s, name);
if (t  !IS_ERR(t)) {
struct arpt_getinfo info;
@@ -908,7 +909,8 @@ static int get_info(void __user *user, int *len, int compat)
return ret;
 }
 
-static int get_entries(struct arpt_get_entries __user *uptr, int *len)
+static int get_entries(struct net *net, struct arpt_get_entries __user *uptr,
+  int *len)
 {
int ret;
struct arpt_get_entries get;
@@ -926,7 +928,7 @@ static int get_entries(struct arpt_get_entries __user 
*uptr, int *len)
return -EINVAL;
}
 
-   t = xt_find_table_lock(init_net, NF_ARP, get.name);
+   t = xt_find_table_lock(net, NF_ARP, get.name);
if (t  !IS_ERR(t)) {
struct xt_table_info *private = t-private;
duprintf(t-private-number = %u\n,
@@ -947,7 +949,8 @@ static int get_entries(struct arpt_get_entries __user 
*uptr, int *len)
return ret;
 }
 
-static int __do_replace(const char *name, unsigned int valid_hooks,
+static int __do_replace(struct net *net, const char *name,
+   unsigned int valid_hooks,
struct xt_table_info *newinfo,
unsigned int num_counters,
void __user *counters_ptr)
@@ -966,7 +969,7 @@ static int __do_replace(const char *name, unsigned int 
valid_hooks,
goto out;
}
 
-   t = try_then_request_module(xt_find_table_lock(init_net, NF_ARP, name),
+   t = try_then_request_module(xt_find_table_lock(net, NF_ARP, name),
arptable_%s, name);
if (!t || IS_ERR(t)) {
ret = t ? PTR_ERR(t) : -ENOENT;
@@ -1019,7 +1022,7 @@ static int __do_replace(const char *name, unsigned int 
valid_hooks,
return ret;
 }
 
-static int do_replace(void __user *user, unsigned int len)
+static int do_replace(struct net *net, void __user *user, unsigned int len)
 {
int ret;
struct arpt_replace tmp;
@@ -1053,7 +1056,7 @@ static int do_replace(void __user *user, unsigned int len)
 
duprintf(arp_tables: Translated table\n);
 
-   ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo,
+   ret = __do_replace(net, tmp.name, tmp.valid_hooks, newinfo,
   tmp.num_counters, tmp.counters);
if (ret)
goto free_newinfo_untrans;
@@ -1080,7 +1083,8 @@ static inline int add_counter_to_entry(struct arpt_entry 
*e,
return 0;
 }
 
-static int do_add_counters(void __user *user, unsigned int len, int compat)
+static int do_add_counters(struct net *net, void __user *user, unsigned int 
len,
+  int compat)
 {
unsigned int i;
struct xt_counters_info tmp;
@@ -1132,7 +1136,7 @@ static int do_add_counters(void __user *user, unsigned 
int len, int compat)
goto free;
}
 
-   t = xt_find_table_lock(init_net, NF_ARP, name);
+   t = xt_find_table_lock(net, NF_ARP, name);
if (!t || IS_ERR(t)) {
ret = t ? PTR_ERR(t) : 

[PATCH 4/5] netns netfilter: per-netns arp_tables FILTER

2008-01-24 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]
---

 include/net/netns/ipv4.h |1 
 net/ipv4/netfilter/arptable_filter.c |   38 +--
 2 files changed, 29 insertions(+), 10 deletions(-)

--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -32,6 +32,7 @@ struct netns_ipv4 {
struct xt_table *iptable_filter;
struct xt_table *iptable_mangle;
struct xt_table *iptable_raw;
+   struct xt_table *arptable_filter;
 #endif
 };
 #endif
--- a/net/ipv4/netfilter/arptable_filter.c
+++ b/net/ipv4/netfilter/arptable_filter.c
@@ -20,7 +20,7 @@ static struct
struct arpt_replace repl;
struct arpt_standard entries[3];
struct arpt_error term;
-} initial_table __initdata = {
+} initial_table __net_initdata = {
.repl = {
.name = filter,
.valid_hooks = FILTER_VALID_HOOKS,
@@ -45,7 +45,7 @@ static struct
.term = ARPT_ERROR_INIT,
 };
 
-static struct arpt_table __packet_filter = {
+static struct arpt_table packet_filter = {
.name   = filter,
.valid_hooks= FILTER_VALID_HOOKS,
.lock   = RW_LOCK_UNLOCKED,
@@ -53,7 +53,6 @@ static struct arpt_table __packet_filter = {
.me = THIS_MODULE,
.af = NF_ARP,
 };
-static struct arpt_table *packet_filter;
 
 /* The work comes in here from netfilter.c */
 static unsigned int arpt_hook(unsigned int hook,
@@ -62,7 +61,7 @@ static unsigned int arpt_hook(unsigned int hook,
  const struct net_device *out,
  int (*okfn)(struct sk_buff *))
 {
-   return arpt_do_table(skb, hook, in, out, packet_filter);
+   return arpt_do_table(skb, hook, in, out, init_net.ipv4.arptable_filter);
 }
 
 static struct nf_hook_ops arpt_ops[] __read_mostly = {
@@ -86,14 +85,33 @@ static struct nf_hook_ops arpt_ops[] __read_mostly = {
},
 };
 
+static int __net_init arptable_filter_net_init(struct net *net)
+{
+   /* Register table */
+   net-ipv4.arptable_filter =
+   arpt_register_table(net, packet_filter, initial_table.repl);
+   if (IS_ERR(net-ipv4.arptable_filter))
+   return PTR_ERR(net-ipv4.arptable_filter);
+   return 0;
+}
+
+static void __net_exit arptable_filter_net_exit(struct net *net)
+{
+   arpt_unregister_table(net-ipv4.arptable_filter);
+}
+
+static struct pernet_operations arptable_filter_net_ops = {
+   .init = arptable_filter_net_init,
+   .exit = arptable_filter_net_exit,
+};
+
 static int __init arptable_filter_init(void)
 {
int ret;
 
-   /* Register table */
-   packet_filter = arpt_register_table(init_net, __packet_filter, 
initial_table.repl);
-   if (IS_ERR(packet_filter))
-   return PTR_ERR(packet_filter);
+   ret = register_pernet_subsys(arptable_filter_net_ops);
+   if (ret  0)
+   return ret;
 
ret = nf_register_hooks(arpt_ops, ARRAY_SIZE(arpt_ops));
if (ret  0)
@@ -101,14 +119,14 @@ static int __init arptable_filter_init(void)
return ret;
 
 cleanup_table:
-   arpt_unregister_table(packet_filter);
+   unregister_pernet_subsys(arptable_filter_net_ops);
return ret;
 }
 
 static void __exit arptable_filter_fini(void)
 {
nf_unregister_hooks(arpt_ops, ARRAY_SIZE(arpt_ops));
-   arpt_unregister_table(packet_filter);
+   unregister_pernet_subsys(arptable_filter_net_ops);
 }
 
 module_init(arptable_filter_init);

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] netns netfilter: put table module on netns stop

2008-01-24 Thread Alexey Dobriyan
When number of entries exceeds number of initial entries, foo-tables code
will pin table module. But during table unregister on netns stop,
that additional pin was forgotten.

Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]
---

 net/ipv4/netfilter/arp_tables.c |3 +++
 net/ipv4/netfilter/ip_tables.c  |3 +++
 net/ipv6/netfilter/ip6_tables.c |3 +++
 3 files changed, 9 insertions(+)

--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -1773,6 +1773,7 @@ void arpt_unregister_table(struct arpt_table *table)
 {
struct xt_table_info *private;
void *loc_cpu_entry;
+   struct module *table_owner = table-me;
 
private = xt_unregister_table(table);
 
@@ -1780,6 +1781,8 @@ void arpt_unregister_table(struct arpt_table *table)
loc_cpu_entry = private-entries[raw_smp_processor_id()];
ARPT_ENTRY_ITERATE(loc_cpu_entry, private-size,
   cleanup_entry, NULL);
+   if (private-number  private-initial_entries)
+   module_put(table_owner);
xt_free_table_info(private);
 }
 
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -2095,12 +2095,15 @@ void ipt_unregister_table(struct xt_table *table)
 {
struct xt_table_info *private;
void *loc_cpu_entry;
+   struct module *table_owner = table-me;
 
private = xt_unregister_table(table);
 
/* Decrease module usage counts and free resources */
loc_cpu_entry = private-entries[raw_smp_processor_id()];
IPT_ENTRY_ITERATE(loc_cpu_entry, private-size, cleanup_entry, NULL);
+   if (private-number  private-initial_entries)
+   module_put(table_owner);
xt_free_table_info(private);
 }
 
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -2120,12 +2120,15 @@ void ip6t_unregister_table(struct xt_table *table)
 {
struct xt_table_info *private;
void *loc_cpu_entry;
+   struct module *table_owner = table-me;
 
private = xt_unregister_table(table);
 
/* Decrease module usage counts and free resources */
loc_cpu_entry = private-entries[raw_smp_processor_id()];
IP6T_ENTRY_ITERATE(loc_cpu_entry, private-size, cleanup_entry, NULL);
+   if (private-number  private-initial_entries)
+   module_put(table_owner);
xt_free_table_info(private);
 }
 

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 2.6.24-rc8-mm1 : net tcp_input.c warnings

2008-01-24 Thread Kamalesh Babulal
On Thu, Jan 24, 2008 at 11:54:18AM +0200, Ilpo Järvinen wrote:
 On Thu, 24 Jan 2008, Dave Young wrote:
 
 Hi Dave ( others),
 
  Thanks.
 
 Thanks a lot, I was first to ignore all these because they occurred 
 with newreno, but looked again... :-/
 
  New warning trigged with your debug patch:
 
 This was probably with the earlier one I sent to you because there's still 
 this case remaining which itself is valid:
 
  P: 5 L: 0 vs 0 S: 0 vs 1 w: 2044790889-2044796616 (0)
 
 ...snip... this is still ok state (S+L = P):
 
  P: 5 L: 0 vs 0 S: 0 vs 3 w: 2044790889-2044796616 (0)
  TCP wq(s)  
  TCP wq(h) +++h+
  l0 s3 f0 p5 seq: su2044790889 hs2044795029 sn2044796616
  [ cut here ]
  WARNING: at net/ipv4/tcp_input.c:2169 tcp_mark_head_lost+0x122/0x150()
  Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event
  snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss eeprom e100 psmouse
  snd_hda_intel snd_pcm snd_timer btusb bluetooth serio_raw snd 3c59x sg
  evdev thermal soundcore rtc_cmos snd_page_alloc rtc_core rtc_lib
  i2c_i801 processor button intel_agp dcdbas pcspkr agpgart
  Pid: 0, comm: swapper Not tainted 2.6.24-rc8-mm1 #8
   [c0132100] ? have_callable_console+0x20/0x30
   [c0131844] warn_on_slowpath+0x54/0x80
   [c03ffe54] ? tcp_print_queue+0x1a4/0x230
   [c0132438] ? vprintk+0x308/0x320
.
.
snip
.
.

  ---[ end trace 14b601818e6903ac ]---
 
 ...But this no longer is, and even more, L: 5 is not valid state at this 
 point all (should only happen if we went to RTO but it would reset S to 
 zero with newreno):
 
  P: 5 L: 5 vs 5 S: 0 vs 3 w: 2044790889-2044796616 (0)
  TCP wq(s) l
  TCP wq(h) +++h+
  l5 s3 f0 p5 seq: su2044790889 hs2044795029 sn2044796616
 
 Surprisingly, it was the first time the WARN_ON for left_out returned 
 correct location. This also explains why the patch I sent to Krishna 
 didn't print anything (it didn't end up into printing because I forgot 
 to add L+SP check into to the state checking if).
 
 ...so please, could you (others than Denys) try this patch, it should 
 solve the issue. And Denys, could you confirm (and if necessary double 
 check) that the kernel you saw this similar problem with is the pure 
 Linus' mainline, i.e., without any net-2.6.25 or mm bits please, if so, 
 that problem persists. And anyway, there were some fackets_out related 
 problems reported as well and this doesn't help for that but I think I've 
 lost track of who was seeing it due to large number of reports :-), could 
 somebody refresh my memory because I currently don't have time to dig it 
 up from archives (at least on this week).
 
 
 -- 
  i.
 
 --
 [PATCH] [TCP]: NewReno must count every skb while marking losses
 
 NewReno should add cnt per skb (as with FACK) instead of depending
 on SACKED_ACKED bits which won't be set with it at all.
 Effectively, NewReno should always exists after the first
 iteration anyway (or immediately if there's already head in
 lost_out.
 
 This was fixed earlier in net-2.6.25 but got reverted among other
 stuff and I didn't notice that this is still necessary (actually
 wasn't even considering this case while trying to figure out the
 reports because I lived with different kind of code than it in
 reality was).
 
 This should solve the WARN_ONs in TCP code that as a result of
 this triggered multiple times in every place we check for this
 invariant.
 
 Special thanks to Dave Young [EMAIL PROTECTED] and
 Krishna Kumar2 [EMAIL PROTECTED] for trying with my debug
 patches.

Hi,

Thanks, after applying the patch the warning is not seen.


  Tested-by: Kamalesh Babulal [EMAIL PROTECTED] 
 Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
 ---
  net/ipv4/tcp_input.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
 index 295490e..aa409a5 100644
 --- a/net/ipv4/tcp_input.c
 +++ b/net/ipv4/tcp_input.c
 @@ -2156,7 +2156,7 @@ static void tcp_mark_head_lost(struct sock *sk, int 
 packets, int fast_rexmit)
   tp-lost_skb_hint = skb;
   tp-lost_cnt_hint = cnt;
 
 - if (tcp_is_fack(tp) ||
 + if (tcp_is_fack(tp) || tcp_is_reno(tp) ||
   (TCP_SKB_CB(skb)-sacked  TCPCB_SACKED_ACKED))
   cnt += tcp_skb_pcount(skb);
 
 -- 
 1.5.2.2


-- 
Thanks  Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-2.6.25][NETNS]: Fix race between put_net() and netlink_kernel_create().

2008-01-24 Thread Pavel Emelyanov
The comment about race free view of the set of network 
namespaces was a bit hasty. Look (there even can be only 
one CPU, as discovered by Alexey Dobriyan and Denis Lunev):

put_net()
  if (atomic_dec_and_test(net-refcnt))
/* true */
  __put_net(net);
queue_work(...);

/*
 * note: the net now has refcnt 0, but still in
 * the global list of net namespaces
 */

== re-schedule ==

register_pernet_subsys(some_ops);
  register_pernet_operations(some_ops);
(*some_ops)-init(net);
  /*
   * we call netlink_kernel_create() here
   * in some places
   */
  netlink_kernel_create();
 sk_alloc();
get_net(net); /* refcnt = 1 */
 /*
  * now we drop the net refcount not to
  * block the net namespace exit in the
  * future (or this can be done on the 
  * error path)
  */
 put_net(sk-sk_net);
 if (atomic_dec_and_test(...))
   /*
* true. BOOOM! The net is
* scheduled for release twice
*/

When thinking on this problem, I decided, that getting and
putting the net in init callback is wrong. If some init
callback needs to have a refcount-less reference on the struct
net, _it_ has to be careful himself, rather than relying on
the infrastructure to handle this correctly.

In case of netlink_kernel_create(), the problem is that the
sk_alloc() gets the given namespace, but passing the info
that we don't want to get it inside this call is too heavy.

Instead, I propose to crate the socket inside an init_net
namespace and then re-attach it to the desired one right
after the socket is created.

After doing this, we also have to be careful on error paths
not to drop the reference on the namespace, we didn't get
the one on.

Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED]
Acked-by: Denis Lunev [EMAIL PROTECTED]

---

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 6b178e1..ff9fb6b 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1344,6 +1344,22 @@ static void netlink_data_ready(struct sock *sk, int len)
  * queueing.
  */
 
+static void __netlink_release(struct sock *sk)
+{
+   /*
+* Last sock_put should drop referrence to sk-sk_net. It has already
+* been dropped in netlink_kernel_create. Taking referrence to stopping
+* namespace is not an option.
+* Take referrence to a socket to remove it from netlink lookup table
+* _alive_ and after that destroy it in the context of init_net.
+*/
+
+   sock_hold(sk);
+   sock_release(sk-sk_socket);
+   sk-sk_net = get_net(init_net);
+   sock_put(sk);
+}
+
 struct sock *
 netlink_kernel_create(struct net *net, int unit, unsigned int groups,
  void (*input)(struct sk_buff *skb),
@@ -1362,8 +1378,18 @@ netlink_kernel_create(struct net *net, int unit, 
unsigned int groups,
if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, sock))
return NULL;
 
-   if (__netlink_create(net, sock, cb_mutex, unit)  0)
-   goto out_sock_release;
+   /*
+* We have to just have a reference on the net from sk, but don't
+* get_net it. Besides, we cannot get and then put the net here.
+* So we create one inside init_net and the move it to net.
+*/
+
+   if (__netlink_create(init_net, sock, cb_mutex, unit)  0)
+   goto out_sock_release_nosk;
+
+   sk = sock-sk;
+   put_net(sk-sk_net);
+   sk-sk_net = net;
 
if (groups  32)
groups = 32;
@@ -1372,7 +1398,6 @@ netlink_kernel_create(struct net *net, int unit, unsigned 
int groups,
if (!listeners)
goto out_sock_release;
 
-   sk = sock-sk;
sk-sk_data_ready = netlink_data_ready;
if (input)
nlk_sk(sk)-netlink_rcv = input;
@@ -1395,14 +1420,14 @@ netlink_kernel_create(struct net *net, int unit, 
unsigned int groups,
nl_table[unit].registered++;
}
netlink_table_ungrab();
-
-   /* Do not hold an extra referrence to a namespace as this socket is
-* internal to a namespace and does not prevent it to stop. */
-   put_net(net);
return sk;
 
 out_sock_release:
kfree(listeners);
+   __netlink_release(sk);
+   return NULL;
+
+out_sock_release_nosk:
sock_release(sock);
return NULL;
 }
@@ -1415,18 +1440,7 @@ netlink_kernel_release(struct sock *sk)
if (sk == NULL || sk-sk_socket == NULL)
return;
 
-   /*
-* Last sock_put should drop referrence to sk-sk_net. It has already
-* been dropped in netlink_kernel_create. Taking referrence to stopping
-* namespace is not an option.
-* Take referrence to a socket to remove it from netlink lookup table
-* _alive_ and after that destroy it in the context of init_net.
-

Re: [Bugme-new] [Bug 9808] New: system hung with htb QoS

2008-01-24 Thread Andrew Morton
 On Thu, 24 Jan 2008 03:03:11 -0800 (PST) [EMAIL PROTECTED] wrote:
 http://bugzilla.kernel.org/show_bug.cgi?id=9808
 
Summary: system hung with htb QoS
Product: Networking
Version: 2.5
  KernelVersion: 2.6.23.9
   Platform: All
 OS/Version: Linux
   Tree: Fedora
 Status: NEW
   Severity: normal
   Priority: P1
  Component: Netfilter/Iptables
 AssignedTo: [EMAIL PROTECTED]
 ReportedBy: [EMAIL PROTECTED]
 
 
 Hi,
 
 I've setup QoS on my ftp server to limit outgoing traffic. Apparently the
 server
 stops responding (no output no keyboard) in an unpredictable manner. Sometimes
 it 
 takes an hour, sometimes up to 4 days for the system to hung.
 
 I have attached my QoS startup script, dmesg output,
 lspci -vvv, iptables that interact with QoS.
 
 I'm also receiving this quite often:
 Jan 15 12:23:17 ftp kernel: e1000: eth0: e1000_clean_tx_irq: Detected Tx Unit
 Hang
 Jan 15 12:23:17 ftp kernel:   Tx Queue 0
 Jan 15 12:23:17 ftp kernel:   TDH  2a
 Jan 15 12:23:17 ftp kernel:   TDT  17
 Jan 15 12:23:17 ftp kernel:   next_to_use  17
 Jan 15 12:23:17 ftp kernel:   next_to_clean2a
 Jan 15 12:23:17 ftp kernel: buffer_info[next_to_clean]
 Jan 15 12:23:17 ftp kernel:   time_stamp   5798144
 Jan 15 12:23:17 ftp kernel:   next_to_watch2d
 Jan 15 12:23:17 ftp kernel:   jiffies  57988ef
 Jan 15 12:23:17 ftp kernel:   next_to_watch.status 0
 Jan 15 12:23:19 ftp kernel: e1000: eth0: e1000_clean_tx_irq: Detected Tx Unit
 Hang
 
 Today for the first time (after applying options to e1000 driver in
 modprobe.conf) I got a kernel panic:
 
 BUG: unable to handle kernel paging request at virtual address a0379120
 EIP: 0060: [c05db2dc] Not Tainted VLI
 EIP is at ip_rcv+0x286/0x4ba
 Kernel panic - not syncing: Fatal exception in interrupt
 
 This is what I wrote on paper cause there wasn't logged anywhere.
 Usually it hungs without a kernel panic.
 
 System in Fedoca Core 8 up2date
 2.6.23.9-85.fc8PAE
 2x Intel(R) Xeon(TM) CPU 3.20GHz
 4G RAM
 
 Without the QoS loaded system never hungs. It must be related to this. However
 the e1000 error I'm receiving must have to do with the e1000 driver. I've seen
 this bug in the past that's why I tried to apply the options in modprobe.conf
 
 any help will be appreciated
 thanx in advance 
 
 Giannis
 
 QoS startup script:
 # default WAN limit
 LIMIT=80mbit
 LOW_LIMIT=50mbit
 
 start() {
 echo -n Starting QoS: (WAN limit set to ${LIMIT})
 tc qdisc del dev eth0 root2 /dev/null  /dev/null
 tc qdisc del dev eth0 ingress 2 /dev/null  /dev/null
 ADD_CLASS=tc class add dev eth0 
 ## uplink
 # install root HTB, point default traffic to 1:25
 tc qdisc add dev eth0 root handle 1: htb  default 25
 
 tc class add dev eth0 parent 1: classid 1:1 htb rate 1000mbit
 # class for outgoing SYN packets + Minimize-Delay TOS
 ${ADD_CLASS} parent 1:1 classid 1:11 htb rate 2mbit ceil 5mbit prio 1
 # class for internal LAN traffic
 ${ADD_CLASS} parent 1:1 classid 1:12 htb rate 500mbit ceil 800mbit prio 2
 # class for WAN traffic
 ${ADD_CLASS} parent 1:1 classid 1:2 htb rate ${LIMIT} ceil ${LIMIT} prio 3
 # class for WAN http traffic
 ${ADD_CLASS} parent 1:2 classid 1:24 htb rate 30mbit ceil ${LIMIT} prio 4
 # default class, rest WAN traffic
 ${ADD_CLASS} parent 1:2 classid 1:25 htb rate 20mbit ceil ${LIMIT} prio 5
 
 tc filter add dev eth0 protocol ip parent 1:0 prio 1 handle 1 fw flowid 1:11
 tc filter add dev eth0 protocol ip parent 1:0 prio 2 handle 2 fw flowid 1:12
 tc filter add dev eth0 protocol ip parent 1:0 prio 4 u32 \
 match ip sport 80 0x flowid 1:24
 
 tc qdisc add dev eth0 parent 1:11 handle 11: sfq perturb 10
 tc qdisc add dev eth0 parent 1:12 handle 12: sfq perturb 10
 tc qdisc add dev eth0 parent 1:24 handle 24: sfq perturb 10
 tc qdisc add dev eth0 parent 1:25 handle 25: sfq perturb 10
 
 echo
 }
 
 stop() {
 echo -n Stopping QoS: 
 tc qdisc del dev eth0 root2 /dev/null  /dev/null
 tc qdisc del dev eth0 ingress 2 /dev/null  /dev/null
 echo
 }
 
 ---
 QoS startup script: http://www.edu.physics.uoc.gr/~bilias/ftp/QoS
 dmesg: http://www.edu.physics.uoc.gr/~bilias/ftp/dmesg
 lspci -vvv: http://www.edu.physics.uoc.gr/~bilias/ftp/lspci
 iptables for QoS: http://www.edu.physics.uoc.gr/~bilias/ftp/iptables
 
 modprobe.conf options for e1000: 
 options e1000 XsumRX=0 Speed=1000 Duplex=2 InterruptThrottleRate=0
 FlowControl=3 RxDescriptors=4096 TxDescriptors=4096 RxIntDelay=0 TxIntDelay=0
 
 
 -- 
 Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
 --- You are receiving this mail because: ---
 You are on the CC list for the bug, or are watching someone who is.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info 

Re: [PATCH net-2.6.25] Add packet filtering based on process's security context.

2008-01-24 Thread Paul Moore
On Thursday 24 January 2008 6:47:55 am Tetsuo Handa wrote:
 Are there any remaining questions/problems about this patch?
 If none, I want this patch applied to net-2.6.25 tree.

Hello,

Taking into consideration that there are no current in-tree users of 
this patch and the only known user of this functionality is TOMOYO, 
which is still dealing with some unresolved VFS issues, I suggest not 
merging this patch at the current time.  My recommendation is to 
continue to work on resolving the VFS issues (which it appears you are 
working on) and then submitting all of the required TOMOYO changes at 
once.

As a general rule, removing functionality from the kernel tends to be 
much more difficult then adding it.

-- 
paul moore
linux security @ hp
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET]: should explicitely initialize atomic_t field in struct dst_ops

2008-01-24 Thread Eric Dumazet
All but one struct dst_ops static initializations miss explicit
initialization of entries field.

As this field is atomic_t, we should use ATOMIC_INIT(0), and not
rely on atomic_t implementation.

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]

 net/ipv4/route.c|2 ++
 net/ipv4/xfrm4_policy.c |1 +
 net/ipv6/route.c|2 ++
 net/ipv6/xfrm6_policy.c |1 +
 4 files changed, 6 insertions(+)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 896c768..163086b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -169,6 +169,7 @@ static struct dst_ops ipv4_dst_ops = {
.update_pmtu =  ip_rt_update_pmtu,
.local_out =ip_local_out,
.entry_size =   sizeof(struct rtable),
+   .entries =  ATOMIC_INIT(0),
 };
 
 #define ECN_OR_COST(class) TC_PRIO_##class
@@ -2498,6 +2499,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = {
.check  =   ipv4_dst_check,
.update_pmtu=   ipv4_rt_blackhole_update_pmtu,
.entry_size =   sizeof(struct rtable),
+   .entries=   ATOMIC_INIT(0),
 };
 
 
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 3783e3e..10ed704 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -247,6 +247,7 @@ static struct dst_ops xfrm4_dst_ops = {
.local_out =__ip_local_out,
.gc_thresh =1024,
.entry_size =   sizeof(struct xfrm_dst),
+   .entries =  ATOMIC_INIT(0),
 };
 
 static struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 4004c5f..8d669bb 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -107,6 +107,7 @@ static struct dst_ops ip6_dst_ops = {
.update_pmtu=   ip6_rt_update_pmtu,
.local_out  =   ip6_local_out,
.entry_size =   sizeof(struct rt6_info),
+   .entries=   ATOMIC_INIT(0),
 };
 
 static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
@@ -120,6 +121,7 @@ static struct dst_ops ip6_dst_blackhole_ops = {
.check  =   ip6_dst_check,
.update_pmtu=   ip6_rt_blackhole_update_pmtu,
.entry_size =   sizeof(struct rt6_info),
+   .entries=   ATOMIC_INIT(0),
 };
 
 struct rt6_info ip6_null_entry = {
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index c25a6b5..7d20199 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -272,6 +272,7 @@ static struct dst_ops xfrm6_dst_ops = {
.local_out =__ip6_local_out,
.gc_thresh =1024,
.entry_size =   sizeof(struct xfrm_dst),
+   .entries =  ATOMIC_INIT(0),
 };
 
 static struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] UCC TDM driver for QE based MPC83xx platforms.

2008-01-24 Thread Timur Tabi

Stephen Rothwell wrote:


+   tdm_ctrl[device_num]-ut_info-uf_info.tdm_tx_clk =
+   (char *) of_get_property(np, fsl,tdm-tx-clk, NULL);

^
We don't normall put spaces here.


Since when?

--
Timur Tabi
Linux kernel developer at Freescale
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM driver for MPC8323eRDB. Also includes related QE changes and dts entries.

2008-01-24 Thread Anton Vorontsov
Hello Poonam,

On Thu, Jan 24, 2008 at 04:00:06PM +0530, Poonam_Aggrwal-b10812 wrote:
 Thanks Stephen for your comments, incorporated them.
 From: Poonam Aggrwal [EMAIL PROTECTED]
 
 This patch makes necessary changes in the QE and UCC framework to support 
 TDM. It also adds support to configure the BRG properly through device 
 tree entries. Includes the device tree changes for UCC TDM driver as well.
 It also includes device tree entries for UCC TDM driver.
 
 Tested on MPC8323ERDB platform.
 
 Signed-off-by: Poonam Aggrwal [EMAIL PROTECTED]
 Signed-off-by: Ashish Kalra [EMAIL PROTECTED]
 Signed-off-by: Kim Phillips [EMAIL PROTECTED]
 Signed-off-by: Michael Barkowski [EMAIL PROTECTED]
 ---
  arch/powerpc/boot/dts/mpc832x_rdb.dts |   58 +++
  arch/powerpc/sysdev/qe_lib/qe.c   |  184 +--
  arch/powerpc/sysdev/qe_lib/ucc.c  |  265 
 +
  arch/powerpc/sysdev/qe_lib/ucc_fast.c |   37 +
  include/asm-powerpc/qe.h  |8 +
  include/asm-powerpc/ucc.h |4 +
  include/asm-powerpc/ucc_fast.h|4 +
  7 files changed, 548 insertions(+), 12 deletions(-)
 
 diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts 
 b/arch/powerpc/boot/dts/mpc832x_rdb.dts
 index 388c8a7..c0e6283 100644
 --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
 +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
 @@ -105,6 +105,17 @@
   device_type = par_io;
   num-ports = 7;
  
 + ucc1pio:[EMAIL PROTECTED] {
 + pio-map = 
 + /* port  pin  dir  open_drain  assignment  has_irq */
 + 0  e  2  0  1  0/* CLK11 */
 + 3 16  1  0  2  0/* BRG9 */
 + 3 1b  1  0  2  0/* BRG3 */
 + 0  0  3  0  2  0/* TDMATxD0 */
 + 0  4  3  0  2  0/* TDMARxD0 */
 + 3 1b  2  0  1  0;  /* CLK1 */
 + };
 +

Can we not introduce new pio-maps in the device trees? There
were debates regarding this, and if I understood everything
correctly, pio-maps considered as a bad taste. Better
do bunch of par_io_config_pin() in the board file. Better
yet fixup the firmware (u-boot) to set up dedicated pins
correctly.


Thanks,

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-2.6.25][IPV6]: Introduce the INET6_TW_MATCH() macro.

2008-01-24 Thread Pavel Emelyanov
We have INET_MATCH, INET_TW_MATCH and INET6_MATCH to test
sockets and twbuckets for matching, but ipv6 twbuckets are
tested manually.

Here's the INET6_TW_MATCH to help with it.

Since the commit b3652b2dc5ec6ccd946ae9136b30c6babb81305a
[IPV6]: Mischecked tw match in __inet6_check_established.
is accepted this patch will not break the __inet6_check_est.
logic.

This will also help with per-namespace socket lookup patches
in the nearest future.

Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED]

---

diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 5d35a4c..c347860 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -465,6 +465,14 @@ static inline struct raw6_sock *raw6_sk(const struct sock 
*sk)
 ipv6_addr_equal(inet6_sk(__sk)-rcv_saddr, (__daddr))  \
 (!((__sk)-sk_bound_dev_if) || ((__sk)-sk_bound_dev_if == (__dif
 
+#define INET6_TW_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif) \
+   (((__sk)-sk_hash == (__hash))   \
+(*((__portpair *)(inet_twsk(__sk)-tw_dport)) == (__ports))\
+((__sk)-sk_family== PF_INET6)  \
+(ipv6_addr_equal(inet6_twsk(__sk)-tw_v6_daddr, (__saddr)))\
+(ipv6_addr_equal(inet6_twsk(__sk)-tw_v6_rcv_saddr, (__daddr)))  \
+(!((__sk)-sk_bound_dev_if) || ((__sk)-sk_bound_dev_if == (__dif
+
 #endif /* __KERNEL__ */
 
 #endif /* _IPV6_H */
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index d0b3447..06b01be 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -80,17 +80,8 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo 
*hashinfo,
}
/* Must check for a TIME_WAIT'er before going to listener hash. */
sk_for_each(sk, node, head-twchain) {
-   const struct inet_timewait_sock *tw = inet_twsk(sk);
-
-   if(*((__portpair *)(tw-tw_dport)) == ports
-  sk-sk_family== PF_INET6) {
-   const struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
-
-   if (ipv6_addr_equal(tw6-tw_v6_daddr, saddr)   
-   ipv6_addr_equal(tw6-tw_v6_rcv_saddr, daddr)   

-   (!sk-sk_bound_dev_if || sk-sk_bound_dev_if == 
dif))
-   goto hit;
-   }
+   if (INET6_TW_MATCH(sk, hash, saddr, daddr, ports, dif))
+   goto hit;
}
read_unlock(lock);
return NULL;
@@ -185,15 +176,9 @@ static int __inet6_check_established(struct 
inet_timewait_death_row *death_row,
 
/* Check TIME-WAIT sockets first. */
sk_for_each(sk2, node, head-twchain) {
-   const struct inet6_timewait_sock *tw6 = inet6_twsk(sk2);
-
tw = inet_twsk(sk2);
 
-   if(*((__portpair *)(tw-tw_dport)) == ports 
-  sk2-sk_family  == PF_INET6   
-  ipv6_addr_equal(tw6-tw_v6_daddr, saddr) 
-  ipv6_addr_equal(tw6-tw_v6_rcv_saddr, daddr) 
-  sk2-sk_bound_dev_if == sk-sk_bound_dev_if) {
+   if (INET6_TW_MATCH(sk2, hash, saddr, daddr, ports, dif)) {
if (twsk_unique(sk, sk2, twp))
goto unique;
else
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM driver for MPC8323eRDB. Also includes related QE changes and dts entries.

2008-01-24 Thread Timur Tabi

Anton Vorontsov wrote:


Can we not introduce new pio-maps in the device trees? There
were debates regarding this, and if I understood everything
correctly, pio-maps considered as a bad taste. Better
do bunch of par_io_config_pin() in the board file. Better
yet fixup the firmware (u-boot) to set up dedicated pins
correctly.


I'm on the fence with respect to pio-maps vs. par_io_config_pin() calls.  The 
problem is that the configuration of these pins is board-specific, but pins are 
used by devices.  A device driver can't call par_io_config_pin(), because the 
calls are different depending on which SoC and which UCC you're using.  The 
platform code can't call par_io_config_pin(), because that configuration depends 
on which drivers are loaded.


In other words, the pin configurations are dependent on the UCC configurations, 
and the UCC configurations are stored in the device tree.  So it makes sense to 
put the pin configurations in the device tree, too.


--
Timur Tabi
Linux kernel developer at Freescale
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[VLAN] set_rx_mode support for unicast address list

2008-01-24 Thread Chris Leech
Reuse the existing logic for multicast list synchronization for the unicast
address list. The core of dev_mc_sync/unsync are split out as
__dev_addr_sync/unsync and moved from dev_mcast.c to dev.c.  These are then
used to implement dev_unicast_sync/unsync as well.

I'm working on cleaning up Intel's FCoE stack, which generates new MAC
addresses from the fibre channel device id assigned by the fabric as per the
current draft specification in T11.  When using such a protocol in a VLAN
environment it would be nice to not always be forced into promiscuous mode,
assuming the underlying Ethernet driver supports multiple unicast addresses as
well.

Signed-off-by: Chris Leech [EMAIL PROTECTED]
---

 include/linux/netdevice.h |4 ++
 net/8021q/vlan_dev.c  |7 ++-
 net/core/dev.c|   96 +
 net/core/dev_mcast.c  |   39 ++
 4 files changed, 110 insertions(+), 36 deletions(-)


diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b0813c3..047d432 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1414,12 +1414,16 @@ extern void dev_set_rx_mode(struct 
net_device *dev);
 extern void__dev_set_rx_mode(struct net_device *dev);
 extern int dev_unicast_delete(struct net_device *dev, void *addr, 
int alen);
 extern int dev_unicast_add(struct net_device *dev, void *addr, int 
alen);
+extern int dev_unicast_sync(struct net_device *to, struct 
net_device *from);
+extern voiddev_unicast_unsync(struct net_device *to, struct 
net_device *from);
 extern int dev_mc_delete(struct net_device *dev, void *addr, int 
alen, int all);
 extern int dev_mc_add(struct net_device *dev, void *addr, int 
alen, int newonly);
 extern int dev_mc_sync(struct net_device *to, struct net_device 
*from);
 extern voiddev_mc_unsync(struct net_device *to, struct net_device 
*from);
 extern int __dev_addr_delete(struct dev_addr_list **list, int 
*count, void *addr, int alen, int all);
 extern int __dev_addr_add(struct dev_addr_list **list, int *count, 
void *addr, int alen, int newonly);
+extern int __dev_addr_sync(struct dev_addr_list **to, int 
*to_count, struct dev_addr_list **from, int *from_count);
+extern void__dev_addr_unsync(struct dev_addr_list **to, int 
*to_count, struct dev_addr_list **from, int *from_count);
 extern voiddev_set_promiscuity(struct net_device *dev, int inc);
 extern voiddev_set_allmulti(struct net_device *dev, int inc);
 extern voidnetdev_state_change(struct net_device *dev);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 8059fa4..77f04e4 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -563,6 +563,7 @@ static int vlan_dev_stop(struct net_device *dev)
struct net_device *real_dev = vlan_dev_info(dev)-real_dev;
 
dev_mc_unsync(real_dev, dev);
+   dev_unicast_unsync(real_dev, dev);
if (dev-flags  IFF_ALLMULTI)
dev_set_allmulti(real_dev, -1);
if (dev-flags  IFF_PROMISC)
@@ -634,9 +635,10 @@ static void vlan_dev_change_rx_flags(struct net_device 
*dev, int change)
dev_set_promiscuity(real_dev, dev-flags  IFF_PROMISC ? 1 : 
-1);
 }
 
-static void vlan_dev_set_multicast_list(struct net_device *vlan_dev)
+static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
 {
dev_mc_sync(vlan_dev_info(vlan_dev)-real_dev, vlan_dev);
+   dev_unicast_sync(vlan_dev_info(vlan_dev)-real_dev, vlan_dev);
 }
 
 /*
@@ -702,7 +704,8 @@ void vlan_setup(struct net_device *dev)
dev-open   = vlan_dev_open;
dev-stop   = vlan_dev_stop;
dev-set_mac_address= vlan_dev_set_mac_address;
-   dev-set_multicast_list = vlan_dev_set_multicast_list;
+   dev-set_rx_mode= vlan_dev_set_rx_mode;
+   dev-set_multicast_list = vlan_dev_set_rx_mode;
dev-change_rx_flags= vlan_dev_change_rx_flags;
dev-do_ioctl   = vlan_dev_ioctl;
dev-destructor = free_netdev;
diff --git a/net/core/dev.c b/net/core/dev.c
index c9c593e..edaff27 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2962,6 +2962,102 @@ int dev_unicast_add(struct net_device *dev, void *addr, 
int alen)
 }
 EXPORT_SYMBOL(dev_unicast_add);
 
+int __dev_addr_sync(struct dev_addr_list **to, int *to_count,
+   struct dev_addr_list **from, int *from_count)
+{
+   struct dev_addr_list *da, *next;
+   int err = 0;
+
+   da = *from;
+   while (da != NULL) {
+   next = da-next;
+   if (!da-da_synced) {
+   err = __dev_addr_add(to, to_count,
+da-da_addr, da-da_addrlen, 0);
+   if (err  0)
+   break;
+   

Re: [IPV4 0/9] TRIE performance patches

2008-01-24 Thread Stephen Hemminger
On Thu, 24 Jan 2008 10:36:45 +0100
Robert Olsson [EMAIL PROTECTED] wrote:

 
 Stephen Hemminger writes:
 
   Dumping by prefix is possible, but unless 32x slower. Dumping in
   address order is just as logical. Like I said, I'm investigating what
   quagga handles.
 
  How about taking a snapshot to in address order (as you did) to some 
  allocated memory, returning from that memory in prefix order? This would 
  solve the  -EBUSY too and give a consistent view of the routing table at
  the time for the dump/snapshot.
 
  Cheers
   --ro

Snapshotting is going to work, because of scale and because the kernel can't
tell when application is going to come back.

-- 
Stephen Hemminger [EMAIL PROTECTED]
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM driver for MPC8323eRDB. Also includes related QE changes and dts entries.

2008-01-24 Thread Anton Vorontsov
On Thu, Jan 24, 2008 at 09:55:31AM -0600, Timur Tabi wrote:
 Anton Vorontsov wrote:
 
 Can we not introduce new pio-maps in the device trees? There
 were debates regarding this, and if I understood everything
 correctly, pio-maps considered as a bad taste. Better
 do bunch of par_io_config_pin() in the board file. Better
 yet fixup the firmware (u-boot) to set up dedicated pins
 correctly.
 
 I'm on the fence with respect to pio-maps vs. par_io_config_pin() calls.  
 The problem is that the configuration of these pins is board-specific, but 
 pins are used by devices.  A device driver can't call par_io_config_pin(), 
 because the calls are different depending on which SoC and which UCC you're 
 using.  The platform code can't call par_io_config_pin(), because that 
 configuration depends on which drivers are loaded.

Are you saying that TDM is sharing same pins with the other QE device,
and we can choose to use/not use some device depending on which driver
is loaded? I think this particular board and patch isn't that case.

Even if someday there will be the case when drivers are mutually
exclusive, i.e. presence of some driver should trigger pins
reconfiguration, then anyway this should be handled differently.

That is, we should not _register_ two mutually exclusive devices
in the first place, so drivers will not probe them. That's board
setup code authority, and pins configuration still should happen
there.

[ Irrelevant to UCCs and this particular case: lately I've
  encountered one interesting case of Par IO usage. FHCI USB needs
  switching between pin's dedicated functions and GPIO functions.
  So, firstly it is using pins as dedicated, and later (at the bus
  reset) driver turns them to act as GPIOs. This is still handled
  without pio-map though, via gpios =  property for that driver. ]

 In other words, the pin configurations are dependent on the UCC 
 configurations, and the UCC configurations are stored in the device tree.  
 So it makes sense to put the pin configurations in the device tree, too.

In that particular case UCC configuration is static, for every UCC.
So, we can set up all pins in the firmware/board file.

Please correct me if I'm wrong.

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM driver for MPC8323eRDB. Also includes related QE changes and dts entries.

2008-01-24 Thread Timur Tabi

Anton Vorontsov wrote:


Are you saying that TDM is sharing same pins with the other QE device,
and we can choose to use/not use some device depending on which driver
is loaded?


No.  I'd have to closely examine the DTS, but I don't think that UCC devices 
share pins at all.  But that isn't my point.



In that particular case UCC configuration is static, for every UCC.
So, we can set up all pins in the firmware/board file.


Yes, but deciding what the UCC does might not be static.  At what point do we 
declare, UCC5 is for eth0 and eth0 only?


The advantage of putting the pin configurations in the device tree is that they 
now become configurable.  I can envision a scenario where UCC5 could be either 
an Ethernet or a UART, depending on the setting of some jumpers on the board. 
That's what the QE was designed for: any UCC can do any task, and you can even 
have a UCC change its purpose while the system is running.  So I don't want the 
pin configurations hard-coded into the kernel.  Having them in the device tree 
gives me some flexibility.


For instance, I have a plan (that I keep postponing) to introduce a new feature 
in U-Boot where U-Boot can determine the settings of some board jumpers and 
modify the device tree accordingly.  The instructions on how to modify the 
device tree would be embedded in the tree itself.  I can't support this feature 
if the kernel calls par_io_config_pin() regardless of what's in the device tree.


--
Timur Tabi
Linux kernel developer at Freescale
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bugme-new] [Bug 9806] New: (tun dev) Impossible to deassert IFF_ONE_QUEUE or IFF_NO_PI

2008-01-24 Thread Nathaniel Filardo
On Jan 24, 2008 3:33 AM, Andrew Morton [EMAIL PROTECTED] wrote:
  On Wed, 23 Jan 2008 13:13:13 -0800 (PST) [EMAIL PROTECTED] wrote:
  http://bugzilla.kernel.org/show_bug.cgi?id=9806
 Thanks.   Could you please submit the patch via email?  Send it to
 all recipients of this email.

Attached.
--nwf;
--- tun.c.orig	2008-01-23 16:09:25.0 -0500
+++ tun.c	2008-01-23 16:12:26.0 -0500
@@ -540,9 +540,13 @@
 
 	if (ifr-ifr_flags  IFF_NO_PI)
 		tun-flags |= TUN_NO_PI;
+	else
+		tun-flags = ~TUN_NO_PI;
 
 	if (ifr-ifr_flags  IFF_ONE_QUEUE)
 		tun-flags |= TUN_ONE_QUEUE;
+	else
+		tun-flags = ~TUN_ONE_QUEUE;
 
 	file-private_data = tun;
 	tun-attached = 1;


Re: [XFRM]: constify 'struct xfrm_type'

2008-01-24 Thread Joe Perches
On Thu, 2008-01-24 at 12:26 +0100, Eric Dumazet wrote:
 - struct xfrm_type *type;
 + const struct xfrm_type *type;

Perhaps const foo * const bar; for most or all of these
conversions?


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM driver for MPC8323eRDB. Also includes related QE changes and dts entries.

2008-01-24 Thread Anton Vorontsov
On Thu, Jan 24, 2008 at 10:33:47AM -0600, Timur Tabi wrote:
 Anton Vorontsov wrote:
 
 Are you saying that TDM is sharing same pins with the other QE device,
 and we can choose to use/not use some device depending on which driver
 is loaded?
 
 No.  I'd have to closely examine the DTS, but I don't think that UCC 
 devices share pins at all.  But that isn't my point.
 
 In that particular case UCC configuration is static, for every UCC.
 So, we can set up all pins in the firmware/board file.
 
 Yes, but deciding what the UCC does might not be static.  At what point do 
 we declare, UCC5 is for eth0 and eth0 only?
 
 The advantage of putting the pin configurations in the device tree is that 
 they now become configurable.  I can envision a scenario where UCC5 could 
 be either an Ethernet or a UART, depending on the setting of some jumpers 
 on the board. That's what the QE was designed for: any UCC can do any task, 
 and you can even have a UCC change its purpose while the system is running. 
 So I don't want the pin configurations hard-coded into the kernel.  Having 
 them in the device tree gives me some flexibility.

If hardware configuration is selected at the bootup time, by jumpers
or switches, it's even easier to do it right. Without pio-map.

 For instance, I have a plan (that I keep postponing) to introduce a new 
 feature in U-Boot where U-Boot can determine the settings of some board 
 jumpers and modify the device tree accordingly. The instructions on how to 
 modify the device tree would be embedded in the tree itself.

Why you need to modify the device tree for that? Let the U-Boot simply
setup pins for the kernel. Regarding kernel overwriting pins
configuration...

 I can't 
 support this feature if the kernel calls par_io_config_pin() regardless of 
 what's in the device tree.

What I've understood from the previous debates, is that ideally kernel
should not touch pins' configuration. Today we're using pio-map solely
to fix up some old firmware misconfiguration. And we can do this in the
board file still. To determine if we need to fixup the firmware or not,
we can use some device tree property instead (firmware version?).

p.s.
I'm neither for pio-map nor against. I just want some consequence
regarding this. Last thread ended with consequence that pio-map is a
bad thing to use...

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [VLAN] set_rx_mode support for unicast address list

2008-01-24 Thread Patrick McHardy

Chris Leech wrote:

Reuse the existing logic for multicast list synchronization for the unicast
address list. The core of dev_mc_sync/unsync are split out as
__dev_addr_sync/unsync and moved from dev_mcast.c to dev.c.  These are then
used to implement dev_unicast_sync/unsync as well.

I'm working on cleaning up Intel's FCoE stack, which generates new MAC
addresses from the fibre channel device id assigned by the fabric as per the
current draft specification in T11.  When using such a protocol in a VLAN
environment it would be nice to not always be forced into promiscuous mode,
assuming the underlying Ethernet driver supports multiple unicast addresses as
well.



Looks good, applied. Thanks Chris.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] netns netfilter: per-netns ip6tables

2008-01-24 Thread Patrick McHardy

Alexey Dobriyan wrote:

* Propagate netns from userspace down to xt_find_table_lock()
* Register ip6 tables in netns (modules still use init_net)

Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]
---

 include/linux/netfilter_ipv6/ip6_tables.h |3 +
 net/ipv6/netfilter/ip6_tables.c   |   50 +++---
 net/ipv6/netfilter/ip6table_filter.c  |2 -
 net/ipv6/netfilter/ip6table_mangle.c  |2 -
 net/ipv6/netfilter/ip6table_raw.c |2 -
 5 files changed, 31 insertions(+), 28 deletions(-)


This adds checkpatch warnings:

WARNING: line over 80 characters
#96: FILE: net/ipv6/netfilter/ip6_tables.c:1361:
+do_add_counters(struct net *net, void __user *user, unsigned int len, 
int compat)


WARNING: line over 80 characters
#229: FILE: net/ipv6/netfilter/ip6table_filter.c:135:
+   packet_filter = ip6t_register_table(init_net, __packet_filter, 
initial_table.repl);


WARNING: line over 80 characters
#242: FILE: net/ipv6/netfilter/ip6table_mangle.c:167:
+   packet_mangler = ip6t_register_table(init_net, 
__packet_mangler, initial_table.repl);


WARNING: line over 80 characters
#255: FILE: net/ipv6/netfilter/ip6table_raw.c:80:
+   packet_raw = ip6t_register_table(init_net, __packet_raw, 
initial_table.repl);


ERROR: Missing Signed-off-by: line(s)

total: 1 errors, 4 warnings, 214 lines checked

I'll fix them up, lets hope that it doesn't cause clashes
with the following patches.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/5] netns netfilter: per-netns arp_tables

2008-01-24 Thread Patrick McHardy

Alexey Dobriyan wrote:

* Propagate netns from userspace.
* arpt_register_table() registers table in supplied netns.


Applied.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] netns netfilter: per-netns arp_tables FILTER

2008-01-24 Thread Patrick McHardy

Alexey Dobriyan wrote:

Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]


Applied.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] netns netfilter: put table module on netns stop

2008-01-24 Thread Patrick McHardy

Alexey Dobriyan wrote:

When number of entries exceeds number of initial entries, foo-tables code
will pin table module. But during table unregister on netns stop,
that additional pin was forgotten.


Applied, thanks.


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Slow OOM in netif_RX function

2008-01-24 Thread Ivan Dichev
Hello,
I got problem with my linux router. It has slow persistent OOM
problems from few months ago.
Every working(I mean days when more traffic is generated) day my
router is leaking with 15-20 MB memory and
after 2 weeks the restart is a MUST.
From /proc/slabinfo I saw that size-2048 and size-512 are growing
rapidly every day when traffic occur.

- /proc/slabinfo 
size-2048  20322  20349   207232 : tunables   24  
120 : slabdata   6780   6783  0
size-512   50984  5101653671 : tunables   32  
160 : slabdata   7288   7288  0


I was wondering who is allocating this mem pools and then I changed
the kernel with 2.6.23-rc12 including  options
CONFIG_DEBUG_SLAB=y
CONFIG_DEBUG_SLAB_LEAK=y


Unfortunately changing the kernel didn't solve the mem leak
Now /proc/slab_allocators is showing that 3c59x driver is allocating
2048 and 512 bytes memory pools
caused by RX function.
- from /proc/slab_allocators --
7612 size-2048: boomerang_rx+0x33b/0x437 [3c59x]
16018 size-512: boomerang_rx+0x165/0x437 [3c59x]

I was thinking that the 3com driver is bogus, .. but not!
After few days I changed the cards with rtl8139 and now 
- from /proc/slab_allocators --
size-2048: 20159 rtl8139_rx+0x155/0x2dc [8139too]
size-1024: 2693 rtl8139_rx+0x155/0x2dc [8139too]
size-512: 50515 rtl8139_rx+0x155/0x2dc [8139too]

the memory leak appear again in the same function(RX).

I did search over the mailing list and found as similar only this
http://www.spinics.net/lists/kernel/old/2003-q4/msg03071.html


For sure it does not depend on kernel version and network
driver(except case if both drivers are bogus :)
Any ideas ?

Ivan

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Patch 2.6.24 1/1]S2io: Support for vlan_rx_kill_vid entry point

2008-01-24 Thread Sreenivasa Honnur
- Added s2io_vlan_rx_kill_vid entry point function for unregistering vlan.
- Fix to aggregate vlan packets. IP offset is incremented by
  4 bytes if the packet contains vlan header.

Signed-off-by: Surjit Reang [EMAIL PROTECTED]
Signed-off-by: Ramkrishna Vepa [EMAIL PROTECTED]
---
diff -Nurp 2-0-26-17/drivers/net/s2io.c 2-0-26-18-1/drivers/net/s2io.c
--- 2-0-26-17/drivers/net/s2io.c2008-01-24 04:22:30.0 +0530
+++ 2-0-26-18-1/drivers/net/s2io.c  2008-01-24 04:32:22.0 +0530
@@ -380,6 +380,19 @@ static void s2io_vlan_rx_register(struct
 /* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */
 static int vlan_strip_flag;
 
+/* Unregister the vlan */
+static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid)
+{
+   unsigned long flags;
+   struct s2io_nic *nic = dev-priv;
+
+   spin_lock_irqsave(nic-tx_lock, flags);
+   if (nic-vlgrp)
+   vlan_group_set_device(nic-vlgrp, vid, NULL);
+
+   spin_unlock_irqrestore(nic-tx_lock, flags);
+}
+
 /*
  * Constants to be programmed into the Xena's registers, to configure
  * the XAUI.
@@ -2905,7 +2918,7 @@ static void rx_intr_handler(struct ring_
struct lro *lro = nic-lro0_n[i];
if (lro-in_use) {
update_L3L4_header(nic, lro);
-   queue_rx_frame(lro-parent);
+   queue_rx_frame(lro-parent, lro-vlan_tag);
clear_lro_session(lro);
}
}
@@ -7177,7 +7190,8 @@ static int rx_osm_handler(struct ring_in
{
lro_append_pkt(sp, lro,
skb, tcp_len);
-   queue_rx_frame(lro-parent);
+   queue_rx_frame(lro-parent,
+   lro-vlan_tag);
clear_lro_session(lro);
sp-mac_control.stats_info-
sw_stat.flush_max_pkts++;
@@ -7188,7 +7202,8 @@ static int rx_osm_handler(struct ring_in
lro-frags_len;
sp-mac_control.stats_info-
 sw_stat.sending_both++;
-   queue_rx_frame(lro-parent);
+   queue_rx_frame(lro-parent,
+   lro-vlan_tag);
clear_lro_session(lro);
goto send_up;
case 0: /* sessions exceeded */
@@ -7214,31 +7229,12 @@ static int rx_osm_handler(struct ring_in
 */
skb-ip_summed = CHECKSUM_NONE;
}
-   } else {
+   } else
skb-ip_summed = CHECKSUM_NONE;
-   }
+
sp-mac_control.stats_info-sw_stat.mem_freed += skb-truesize;
-   if (!sp-lro) {
-   skb-protocol = eth_type_trans(skb, dev);
-   if ((sp-vlgrp  RXD_GET_VLAN_TAG(rxdp-Control_2) 
-   vlan_strip_flag)) {
-   /* Queueing the vlan frame to the upper layer */
-   if (napi)
-   vlan_hwaccel_receive_skb(skb, sp-vlgrp,
-   RXD_GET_VLAN_TAG(rxdp-Control_2));
-   else
-   vlan_hwaccel_rx(skb, sp-vlgrp,
-   RXD_GET_VLAN_TAG(rxdp-Control_2));
-   } else {
-   if (napi)
-   netif_receive_skb(skb);
-   else
-   netif_rx(skb);
-   }
-   } else {
 send_up:
-   queue_rx_frame(skb);
-   }
+   queue_rx_frame(skb, RXD_GET_VLAN_TAG(rxdp-Control_2));
dev-last_rx = jiffies;
 aggregate:
atomic_dec(sp-rx_bufs_left[ring_no]);
@@ -7589,6 +7585,7 @@ s2io_init_nic(struct pci_dev *pdev, cons
SET_ETHTOOL_OPS(dev, netdev_ethtool_ops);
dev-features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
dev-vlan_rx_register = s2io_vlan_rx_register;
+   dev-vlan_rx_kill_vid = (void *)s2io_vlan_rx_kill_vid;
 
/*
 * will use eth_mac_addr() for  dev-set_mac_address
@@ -7845,7 +7842,8 @@ module_init(s2io_starter);
 module_exit(s2io_closer);
 
 static int check_L2_lro_capable(u8 *buffer, struct iphdr **ip,
-   struct tcphdr **tcp, struct RxD_t *rxdp)
+   struct tcphdr **tcp, struct RxD_t *rxdp,
+  

[Patch 2.6.24 1/2]S2io: Fix for LRO Bugs

2008-01-24 Thread Sreenivasa Honnur
Resubmitting patch from Al Viro [EMAIL PROTECTED], with subject -
[PATCH] s2io LRO bugs.
a) initiate_new_session() sets -tcp_ack to ntohl(...); everything
   else stores and expects to find there the net-endian value.
b) check for monotonic timestamps in verify_l3_l4_lro_capable()
   compares the value sitting in TCP option (right there in the skb-data,
   net-endian 32bit) with the value picked from earlier packet.
   Doing that without ntohl() is an interesting idea and it might even
   work occasionally; unfortunately, it's quite broken.

Signed-off-by: Surjit Reang [EMAIL PROTECTED]
Signed-off-by: Ramkrishna Vepa [EMAIL PROTECTED]
---
diff -Nurp 2-0-26-18-1/drivers/net/s2io.c 2-0-26-18-2/drivers/net/s2io.c
--- 2-0-26-18-1/drivers/net/s2io.c  2008-01-24 04:32:22.0 +0530
+++ 2-0-26-18-2/drivers/net/s2io.c  2008-01-24 04:43:36.0 +0530
@@ -7901,7 +7901,7 @@ static void initiate_new_session(struct 
lro-iph = ip;
lro-tcph = tcp;
lro-tcp_next_seq = tcp_pyld_len + ntohl(tcp-seq);
-   lro-tcp_ack = ntohl(tcp-ack_seq);
+   lro-tcp_ack = tcp-ack_seq;
lro-sg_num = 1;
lro-total_len = ntohs(ip-tot_len);
lro-frags_len = 0;
@@ -7911,10 +7911,10 @@ static void initiate_new_session(struct 
 * already been done.
 */
if (tcp-doff == 8) {
-   u32 *ptr;
-   ptr = (u32 *)(tcp+1);
+   __be32 *ptr;
+   ptr = (__be32 *)(tcp+1);
lro-saw_ts = 1;
-   lro-cur_tsval = *(ptr+1);
+   lro-cur_tsval = ntohl(*(ptr+1));
lro-cur_tsecr = *(ptr+2);
}
lro-in_use = 1;
@@ -7940,7 +7940,7 @@ static void update_L3L4_header(struct s2
 
/* Update tsecr field if this session has timestamps enabled */
if (lro-saw_ts) {
-   u32 *ptr = (u32 *)(tcp + 1);
+   __be32 *ptr = (__be32 *)(tcp + 1);
*(ptr+2) = lro-cur_tsecr;
}
 
@@ -7965,10 +7965,10 @@ static void aggregate_new_rx(struct lro 
lro-window = tcp-window;
 
if (lro-saw_ts) {
-   u32 *ptr;
+   __be32 *ptr;
/* Update tsecr and tsval from this packet */
-   ptr = (u32 *) (tcp + 1);
-   lro-cur_tsval = *(ptr + 1);
+   ptr = (__be32 *)(tcp+1);
+   lro-cur_tsval = ntohl(*(ptr+1));
lro-cur_tsecr = *(ptr + 2);
}
 }
@@ -8019,11 +8019,11 @@ static int verify_l3_l4_lro_capable(stru
 
/* Ensure timestamp value increases monotonically */
if (l_lro)
-   if (l_lro-cur_tsval  *((u32 *)(ptr+2)))
+   if (l_lro-cur_tsval  ntohl(*((__be32 *)(ptr+2
return -1;
 
/* timestamp echo reply should be non-zero */
-   if (*((u32 *)(ptr+6)) == 0)
+   if (*((__be32 *)(ptr+6)) == 0)
return -1;
}
 
diff -Nurp 2-0-26-18-1/drivers/net/s2io.h 2-0-26-18-2/drivers/net/s2io.h
--- 2-0-26-18-1/drivers/net/s2io.h  2008-01-24 04:26:10.0 +0530
+++ 2-0-26-18-2/drivers/net/s2io.h  2008-01-24 04:27:28.0 +0530
@@ -799,7 +799,7 @@ struct lro {
__be16  window;
u16 vlan_tag;
u32 cur_tsval;
-   u32 cur_tsecr;
+   __be32  cur_tsecr;
u8  saw_ts;
 } cacheline_aligned;
 

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Patch 2.6.24 3/3]S2io: Version update for [Patch 2.6.24 1/3] [Patch 2.6.24 2/3]

2008-01-24 Thread Sreenivasa Honnur
- Updated version number.

Signed-off-by: Surjit Reang [EMAIL PROTECTED]
Signed-off-by: Ramkrishna Vepa [EMAIL PROTECTED]
---
diff -Nurp 2-0-26-18-2/drivers/net/s2io.c 2-0-26-18-3/drivers/net/s2io.c
--- 2-0-26-18-2/drivers/net/s2io.c  2008-01-24 04:27:23.0 +0530
+++ 2-0-26-18-3/drivers/net/s2io.c  2008-01-24 04:39:07.0 +0530
@@ -84,7 +84,7 @@
 #include s2io.h
 #include s2io-regs.h
 
-#define DRV_VERSION 2.0.26.17
+#define DRV_VERSION 2.0.26.18
 
 /* S2io Driver name  version. */
 static char s2io_driver_name[] = Neterion;

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Patch 2.6.24 1/3]S2io: Support for vlan_rx_kill_vid entry point

2008-01-24 Thread Sreenivasa Honnur
- Added s2io_vlan_rx_kill_vid entry point function for unregistering vlan.
- Fix to aggregate vlan packets. IP offset is incremented by
  4 bytes if the packet contains vlan header.

Signed-off-by: Surjit Reang [EMAIL PROTECTED]
Signed-off-by: Ramkrishna Vepa [EMAIL PROTECTED]
---
diff -Nurp 2-0-26-17/drivers/net/s2io.c 2-0-26-18-1/drivers/net/s2io.c
--- 2-0-26-17/drivers/net/s2io.c2008-01-24 04:22:30.0 +0530
+++ 2-0-26-18-1/drivers/net/s2io.c  2008-01-24 04:32:22.0 +0530
@@ -380,6 +380,19 @@ static void s2io_vlan_rx_register(struct
 /* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */
 static int vlan_strip_flag;
 
+/* Unregister the vlan */
+static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid)
+{
+   unsigned long flags;
+   struct s2io_nic *nic = dev-priv;
+
+   spin_lock_irqsave(nic-tx_lock, flags);
+   if (nic-vlgrp)
+   vlan_group_set_device(nic-vlgrp, vid, NULL);
+
+   spin_unlock_irqrestore(nic-tx_lock, flags);
+}
+
 /*
  * Constants to be programmed into the Xena's registers, to configure
  * the XAUI.
@@ -2905,7 +2918,7 @@ static void rx_intr_handler(struct ring_
struct lro *lro = nic-lro0_n[i];
if (lro-in_use) {
update_L3L4_header(nic, lro);
-   queue_rx_frame(lro-parent);
+   queue_rx_frame(lro-parent, lro-vlan_tag);
clear_lro_session(lro);
}
}
@@ -7177,7 +7190,8 @@ static int rx_osm_handler(struct ring_in
{
lro_append_pkt(sp, lro,
skb, tcp_len);
-   queue_rx_frame(lro-parent);
+   queue_rx_frame(lro-parent,
+   lro-vlan_tag);
clear_lro_session(lro);
sp-mac_control.stats_info-
sw_stat.flush_max_pkts++;
@@ -7188,7 +7202,8 @@ static int rx_osm_handler(struct ring_in
lro-frags_len;
sp-mac_control.stats_info-
 sw_stat.sending_both++;
-   queue_rx_frame(lro-parent);
+   queue_rx_frame(lro-parent,
+   lro-vlan_tag);
clear_lro_session(lro);
goto send_up;
case 0: /* sessions exceeded */
@@ -7214,31 +7229,12 @@ static int rx_osm_handler(struct ring_in
 */
skb-ip_summed = CHECKSUM_NONE;
}
-   } else {
+   } else
skb-ip_summed = CHECKSUM_NONE;
-   }
+
sp-mac_control.stats_info-sw_stat.mem_freed += skb-truesize;
-   if (!sp-lro) {
-   skb-protocol = eth_type_trans(skb, dev);
-   if ((sp-vlgrp  RXD_GET_VLAN_TAG(rxdp-Control_2) 
-   vlan_strip_flag)) {
-   /* Queueing the vlan frame to the upper layer */
-   if (napi)
-   vlan_hwaccel_receive_skb(skb, sp-vlgrp,
-   RXD_GET_VLAN_TAG(rxdp-Control_2));
-   else
-   vlan_hwaccel_rx(skb, sp-vlgrp,
-   RXD_GET_VLAN_TAG(rxdp-Control_2));
-   } else {
-   if (napi)
-   netif_receive_skb(skb);
-   else
-   netif_rx(skb);
-   }
-   } else {
 send_up:
-   queue_rx_frame(skb);
-   }
+   queue_rx_frame(skb, RXD_GET_VLAN_TAG(rxdp-Control_2));
dev-last_rx = jiffies;
 aggregate:
atomic_dec(sp-rx_bufs_left[ring_no]);
@@ -7589,6 +7585,7 @@ s2io_init_nic(struct pci_dev *pdev, cons
SET_ETHTOOL_OPS(dev, netdev_ethtool_ops);
dev-features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
dev-vlan_rx_register = s2io_vlan_rx_register;
+   dev-vlan_rx_kill_vid = (void *)s2io_vlan_rx_kill_vid;
 
/*
 * will use eth_mac_addr() for  dev-set_mac_address
@@ -7845,7 +7842,8 @@ module_init(s2io_starter);
 module_exit(s2io_closer);
 
 static int check_L2_lro_capable(u8 *buffer, struct iphdr **ip,
-   struct tcphdr **tcp, struct RxD_t *rxdp)
+   struct tcphdr **tcp, struct RxD_t *rxdp,
+  

[Patch 2.6.24 2/3]S2io: Fix for LRO Bugs

2008-01-24 Thread Sreenivasa Honnur
Resubmitting patch from Al Viro [EMAIL PROTECTED], with subject -
[PATCH] s2io LRO bugs.
a) initiate_new_session() sets -tcp_ack to ntohl(...); everything
   else stores and expects to find there the net-endian value.
b) check for monotonic timestamps in verify_l3_l4_lro_capable()
   compares the value sitting in TCP option (right there in the skb-data,
   net-endian 32bit) with the value picked from earlier packet.
   Doing that without ntohl() is an interesting idea and it might even
   work occasionally; unfortunately, it's quite broken.

Signed-off-by: Surjit Reang [EMAIL PROTECTED]
Signed-off-by: Ramkrishna Vepa [EMAIL PROTECTED]
---
diff -Nurp 2-0-26-18-1/drivers/net/s2io.c 2-0-26-18-2/drivers/net/s2io.c
--- 2-0-26-18-1/drivers/net/s2io.c  2008-01-24 04:32:22.0 +0530
+++ 2-0-26-18-2/drivers/net/s2io.c  2008-01-24 04:43:36.0 +0530
@@ -7901,7 +7901,7 @@ static void initiate_new_session(struct 
lro-iph = ip;
lro-tcph = tcp;
lro-tcp_next_seq = tcp_pyld_len + ntohl(tcp-seq);
-   lro-tcp_ack = ntohl(tcp-ack_seq);
+   lro-tcp_ack = tcp-ack_seq;
lro-sg_num = 1;
lro-total_len = ntohs(ip-tot_len);
lro-frags_len = 0;
@@ -7911,10 +7911,10 @@ static void initiate_new_session(struct 
 * already been done.
 */
if (tcp-doff == 8) {
-   u32 *ptr;
-   ptr = (u32 *)(tcp+1);
+   __be32 *ptr;
+   ptr = (__be32 *)(tcp+1);
lro-saw_ts = 1;
-   lro-cur_tsval = *(ptr+1);
+   lro-cur_tsval = ntohl(*(ptr+1));
lro-cur_tsecr = *(ptr+2);
}
lro-in_use = 1;
@@ -7940,7 +7940,7 @@ static void update_L3L4_header(struct s2
 
/* Update tsecr field if this session has timestamps enabled */
if (lro-saw_ts) {
-   u32 *ptr = (u32 *)(tcp + 1);
+   __be32 *ptr = (__be32 *)(tcp + 1);
*(ptr+2) = lro-cur_tsecr;
}
 
@@ -7965,10 +7965,10 @@ static void aggregate_new_rx(struct lro 
lro-window = tcp-window;
 
if (lro-saw_ts) {
-   u32 *ptr;
+   __be32 *ptr;
/* Update tsecr and tsval from this packet */
-   ptr = (u32 *) (tcp + 1);
-   lro-cur_tsval = *(ptr + 1);
+   ptr = (__be32 *)(tcp+1);
+   lro-cur_tsval = ntohl(*(ptr+1));
lro-cur_tsecr = *(ptr + 2);
}
 }
@@ -8019,11 +8019,11 @@ static int verify_l3_l4_lro_capable(stru
 
/* Ensure timestamp value increases monotonically */
if (l_lro)
-   if (l_lro-cur_tsval  *((u32 *)(ptr+2)))
+   if (l_lro-cur_tsval  ntohl(*((__be32 *)(ptr+2
return -1;
 
/* timestamp echo reply should be non-zero */
-   if (*((u32 *)(ptr+6)) == 0)
+   if (*((__be32 *)(ptr+6)) == 0)
return -1;
}
 
diff -Nurp 2-0-26-18-1/drivers/net/s2io.h 2-0-26-18-2/drivers/net/s2io.h
--- 2-0-26-18-1/drivers/net/s2io.h  2008-01-24 04:26:10.0 +0530
+++ 2-0-26-18-2/drivers/net/s2io.h  2008-01-24 04:27:28.0 +0530
@@ -799,7 +799,7 @@ struct lro {
__be16  window;
u16 vlan_tag;
u32 cur_tsval;
-   u32 cur_tsecr;
+   __be32  cur_tsecr;
u8  saw_ts;
 } cacheline_aligned;
 

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [XFRM]: constify 'struct xfrm_type'

2008-01-24 Thread Eric Dumazet

Joe Perches a écrit :

On Thu, 2008-01-24 at 12:26 +0100, Eric Dumazet wrote:

-   struct xfrm_type *type;
+   const struct xfrm_type *type;


Perhaps const foo * const bar; for most or all of these
conversions?



Hum...

Having const data is nice because moving them from .data to .rodata,
but what would be practical gains to use a const pointer ???

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Slow OOM in netif_RX function

2008-01-24 Thread Stephen Hemminger
On Thu, 24 Jan 2008 19:28:09 +0200
Ivan Dichev [EMAIL PROTECTED] wrote:

 Hello,
 I got problem with my linux router. It has slow persistent OOM
 problems from few months ago.
 Every working(I mean days when more traffic is generated) day my
 router is leaking with 15-20 MB memory and
 after 2 weeks the restart is a MUST.
 From /proc/slabinfo I saw that size-2048 and size-512 are growing
 rapidly every day when traffic occur.
 
 - /proc/slabinfo 
 size-2048  20322  20349   207232 : tunables   24  
 120 : slabdata   6780   6783  0
 size-512   50984  5101653671 : tunables   32  
 160 : slabdata   7288   7288  0
 
 
 I was wondering who is allocating this mem pools and then I changed
 the kernel with 2.6.23-rc12 including  options
 CONFIG_DEBUG_SLAB=y
 CONFIG_DEBUG_SLAB_LEAK=y
 
 
 Unfortunately changing the kernel didn't solve the mem leak
 Now /proc/slab_allocators is showing that 3c59x driver is allocating
 2048 and 512 bytes memory pools
 caused by RX function.
 - from /proc/slab_allocators --
 7612 size-2048: boomerang_rx+0x33b/0x437 [3c59x]
 16018 size-512: boomerang_rx+0x165/0x437 [3c59x]
 
 I was thinking that the 3com driver is bogus, .. but not!
 After few days I changed the cards with rtl8139 and now 
 - from /proc/slab_allocators --
 size-2048: 20159 rtl8139_rx+0x155/0x2dc [8139too]
 size-1024: 2693 rtl8139_rx+0x155/0x2dc [8139too]
 size-512: 50515 rtl8139_rx+0x155/0x2dc [8139too]
 
 the memory leak appear again in the same function(RX).
 
 I did search over the mailing list and found as similar only this
 http://www.spinics.net/lists/kernel/old/2003-q4/msg03071.html
 
 
 For sure it does not depend on kernel version and network
 driver(except case if both drivers are bogus :)
 Any ideas ?
 
 Ivan
 

Receive packets are allocated by the driver, and then consumed by
the protocols or sockets.  The problem is in the consumer side, so you need
to go looking to see if lots of data is getting queued to some application
that is never reading.  Alternatively, it could be some form of control packet
that is not properly processed by a protocol.

Also look at firewall and classification rules, could be a buggy iptables rule?

-- 
Stephen Hemminger [EMAIL PROTECTED]
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [XFRM]: constify 'struct xfrm_type'

2008-01-24 Thread Joe Perches
On Thu, 2008-01-24 at 19:23 +0100, Eric Dumazet wrote:
 Having const data is nice because moving them from .data to .rodata,
 but what would be practical gains to use a const pointer ???

const data is good, using pointers to const data is good.
using const pointers to const data is good.
using const pointers to data not specified as const is not so good.

Here's what you are doing now.

+static void xfrm_put_type(const struct xfrm_type *type)
[...]
+   const struct xfrm_type *type;

cheers, Joe

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Slow OOM in netif_RX function

2008-01-24 Thread Eric Dumazet

Ivan Dichev a écrit :

Hello,
I got problem with my linux router. It has slow persistent OOM
problems from few months ago.
Every working(I mean days when more traffic is generated) day my
router is leaking with 15-20 MB memory and
after 2 weeks the restart is a MUST.

From /proc/slabinfo I saw that size-2048 and size-512 are growing

rapidly every day when traffic occur.

- /proc/slabinfo 
size-2048  20322  20349   207232 : tunables   24  
120 : slabdata   6780   6783  0
size-512   50984  5101653671 : tunables   32  
160 : slabdata   7288   7288  0



I was wondering who is allocating this mem pools and then I changed
the kernel with 2.6.23-rc12 including  options
CONFIG_DEBUG_SLAB=y
CONFIG_DEBUG_SLAB_LEAK=y


Unfortunately changing the kernel didn't solve the mem leak
Now /proc/slab_allocators is showing that 3c59x driver is allocating
2048 and 512 bytes memory pools
caused by RX function.
- from /proc/slab_allocators --
7612 size-2048: boomerang_rx+0x33b/0x437 [3c59x]
16018 size-512: boomerang_rx+0x165/0x437 [3c59x]

I was thinking that the 3com driver is bogus, .. but not!
After few days I changed the cards with rtl8139 and now 
- from /proc/slab_allocators --
size-2048: 20159 rtl8139_rx+0x155/0x2dc [8139too]
size-1024: 2693 rtl8139_rx+0x155/0x2dc [8139too]
size-512: 50515 rtl8139_rx+0x155/0x2dc [8139too]

the memory leak appear again in the same function(RX).

I did search over the mailing list and found as similar only this
http://www.spinics.net/lists/kernel/old/2003-q4/msg03071.html


For sure it does not depend on kernel version and network
driver(except case if both drivers are bogus :)
Any ideas ?



Could you post your iptable rules iptables -t nat -nvL ; iptables -nvL, and 
full cat /proc/slabinfo ?



--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [XFRM]: constify 'struct xfrm_type'

2008-01-24 Thread Eric Dumazet

Joe Perches a écrit :

On Thu, 2008-01-24 at 19:23 +0100, Eric Dumazet wrote:

Having const data is nice because moving them from .data to .rodata,
but what would be practical gains to use a const pointer ???


const data is good, using pointers to const data is good.


Yes, this is what is done.


using const pointers to const data is good.


const pointers are seldom used in linux kernel, because mostly useless.


using const pointers to data not specified as const is not so good.


You misread the patch. I am not using const pointers at all, but const data.





Here's what you are doing now.

+static void xfrm_put_type(const struct xfrm_type *type)
[...]
+   const struct xfrm_type *type;



Yes, this was the plan, I meant it.

I still dont understand what *you* want to do.

Doing :

int xfrm_unregister_type(const struct xfrm_type * const type, const unsigned 
short family)


instead of :

int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family)

buys nothing for the caller.


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [XFRM]: constify 'struct xfrm_type'

2008-01-24 Thread Joe Perches
On Thu, 2008-01-24 at 20:24 +0100, Eric Dumazet wrote:
 I still dont understand what *you* want to do.

Mark the accesses as * const not const *


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [Bugme-new] [Bug 9808] New: system hung with htb QoS

2008-01-24 Thread Brandeburg, Jesse
Andrew Morton wrote:
 I'm also receiving this quite often:
 Jan 15 12:23:17 ftp kernel: e1000: eth0: e1000_clean_tx_irq:
 Detected Tx Unit Hang Jan 15 12:23:17 ftp kernel:   Tx Queue
 0 
 Jan 15 12:23:17 ftp kernel:   TDH  2a
 Jan 15 12:23:17 ftp kernel:   TDT  17
 Jan 15 12:23:17 ftp kernel:   next_to_use  17
 Jan 15 12:23:17 ftp kernel:   next_to_clean2a
 Jan 15 12:23:17 ftp kernel: buffer_info[next_to_clean]
 Jan 15 12:23:17 ftp kernel:   time_stamp   5798144
 Jan 15 12:23:17 ftp kernel:   next_to_watch2d
 Jan 15 12:23:17 ftp kernel:   jiffies  57988ef
 Jan 15 12:23:17 ftp kernel:   next_to_watch.status 0
 Jan 15 12:23:19 ftp kernel: e1000: eth0: e1000_clean_tx_irq:
 Detected Tx Unit Hang 

Looks like a real hardware hang.

Would you be willing to try the 7.6.15 driver at e1000.sourceforge.net,
it has many more fixes for e1000 than what is available in the in-kernel
driver.  I just posted a patch in the Tracker/Patches area that
patches 7.6.15 to support the e1000_dump code to dump rings when the tx
hang occurs which will help us figure out a) what software did to the
ring, b) if something is messed up in the ring which we know will hang
the hardware


 Today for the first time (after applying options to e1000 driver in
 modprobe.conf) I got a kernel panic:
 
 BUG: unable to handle kernel paging request at virtual address
 a0379120 
 EIP: 0060: [c05db2dc] Not Tainted VLI
 EIP is at ip_rcv+0x286/0x4ba
 Kernel panic - not syncing: Fatal exception in interrupt
 
 This is what I wrote on paper cause there wasn't logged anywhere.
 Usually it hungs without a kernel panic.

Everyone involved will need more information about the panic to make
progress on the panic.

 
 System in Fedoca Core 8 up2date
 2.6.23.9-85.fc8PAE
 2x Intel(R) Xeon(TM) CPU 3.20GHz
 4G RAM
 
 Without the QoS loaded system never hungs. It must be related to
 this. However the e1000 error I'm receiving must have to do with the
 e1000 driver. I've seen this bug in the past that's why I tried to
 apply the options in modprobe.conf 

 modprobe.conf options for e1000:
 options e1000 XsumRX=0 Speed=1000 Duplex=2 InterruptThrottleRate=0
 FlowControl=3 RxDescriptors=4096 TxDescriptors=4096 RxIntDelay=0
 TxIntDelay=0 

Please don't use any of these options unless you must, they seem to have
come from some debian forum that someone just posted a SWAG at changing
parameters that fixed him for some unknown reason.

Get back to us with the debug output, the e1000 issue can be covered on
[EMAIL PROTECTED]
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH UCC TDM 3/3 ] Modified Documentation to explain dts entries for TDM driver

2008-01-24 Thread Scott Wood
On Thu, Jan 24, 2008 at 10:24:13AM +0530, Poonam_Aggrwal-b10812 wrote:
 +  ix) Baud Rate Generator (BRG)
 +
 +  Required properties:
 +  - compatible : shpuld be fsl,cpm-brg
 +  - fsl,brg-sources : define the input clock for all 16 BRGs. The input
 +clock source could be 1 to 24 for CLK1 to CLK24. Zero means that the
 +particular BRG will be driven by QE clock(BRGCLK).

Should also have a clock-frequency property to specify what BRGCLK is.

-Scott
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM driver for MPC8323eRDB. Also includes related QE changes and dts entries.

2008-01-24 Thread Scott Wood
On Thu, Jan 24, 2008 at 10:33:47AM -0600, Timur Tabi wrote: Yes, but
 deciding what the UCC does might not be static.  At what point do we
 declare, UCC5 is for eth0 and eth0 only?

When the board designer decides to hook eth0 up to UCC5.

If the board designer decides to hook multiple devices up to UCC5, we first
smack the board designer, and then set it up to whichever configuration has
been jumpered.

-Scott
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Slow OOM in netif_RX function

2008-01-24 Thread Ivan H. Dichev
Eric Dumazet writes: 


Ivan Dichev a écrit :

Hello,
I got problem with my linux router. It has slow persistent OOM
problems from few months ago.
Every working(I mean days when more traffic is generated) day my
router is leaking with 15-20 MB memory and
after 2 weeks the restart is a MUST.

From /proc/slabinfo I saw that size-2048 and size-512 are growing
rapidly every day when traffic occur. 


- /proc/slabinfo 
size-2048  20322  20349   207232 : tunables   24  120 
: slabdata   6780   6783  0
size-512   50984  5101653671 : tunables   32  160 
: slabdata   7288   7288  0 



I was wondering who is allocating this mem pools and then I changed
the kernel with 2.6.23-rc12 including  options
CONFIG_DEBUG_SLAB=y
CONFIG_DEBUG_SLAB_LEAK=y 



Unfortunately changing the kernel didn't solve the mem leak
Now /proc/slab_allocators is showing that 3c59x driver is allocating
2048 and 512 bytes memory pools
caused by RX function.
- from /proc/slab_allocators --
7612 size-2048: boomerang_rx+0x33b/0x437 [3c59x]
16018 size-512: boomerang_rx+0x165/0x437 [3c59x] 


I was thinking that the 3com driver is bogus, .. but not!
After few days I changed the cards with rtl8139 and now 
- from /proc/slab_allocators --
size-2048: 20159 rtl8139_rx+0x155/0x2dc [8139too]
size-1024: 2693 rtl8139_rx+0x155/0x2dc [8139too]
size-512: 50515 rtl8139_rx+0x155/0x2dc [8139too] 

the memory leak appear again in the same function(RX). 


I did search over the mailing list and found as similar only this
http://www.spinics.net/lists/kernel/old/2003-q4/msg03071.html 



For sure it does not depend on kernel version and network
driver(except case if both drivers are bogus :)
Any ideas ? 



Could you post your iptable rules iptables -t nat -nvL ; iptables -nvL, 
and full cat /proc/slabinfo ? 






Sorry but my firewall is 7000+ lines and I cant paste the rules.
And that's why it's very hard to debug the chains :( 

I have better idea! 


What could happen if I put different Lan card in every slot?
In ex. to-private - 3com
  to-inet- VIA
  to-dmz - rtl8139
And then to look which RX function is consuming the memory.
(boomerang_rx, rtl8139_rx, ... etc) 

With this it will be easier to understand which iptables rules(bound to the 
found interface) have to be watched.
(I am not sure that it will work ?) 

Any other ideas appreciated. 


Ivan Dichev
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bugme-new] [Bug 9808] New: system hung with htb QoS

2008-01-24 Thread Andrew Morton
 On Thu, 24 Jan 2008 12:06:58 -0800 Brandeburg, Jesse [EMAIL PROTECTED] 
 wrote:
 Would you be willing to try the 7.6.15 driver at e1000.sourceforge.net,
 it has many more fixes for e1000 than what is available in the in-kernel
 driver.  I just posted a patch in the Tracker/Patches area that
 patches 7.6.15 to support the e1000_dump code to dump rings when the tx
 hang occurs which will help us figure out a) what software did to the
 ring, b) if something is messed up in the ring which we know will hang
 the hardware

General hand-waving: if you have a debug patch which helps diagnose
rare problems when a tester hits them, please consider just putting
them straight into the mainline tree.

We can always take them out later when everything is resolved, and we
can help ourselves a lot this way. 
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] fib_trie: rescan if key is lost during dump

2008-01-24 Thread Stephen Hemminger
Normally during a dump the key of the last dumped entry is used for
continuation, but since lock is dropped it might be lost. In that case
fallback to the old counter based N^2 behaviour.  This means the dump will end 
up
skipping some routes which matches what FIB_HASH does.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


--- a/include/linux/netlink.h   2008-01-24 13:39:40.0 -0800
+++ b/include/linux/netlink.h   2008-01-24 13:42:05.0 -0800
@@ -219,7 +219,7 @@ struct netlink_callback
int (*dump)(struct sk_buff * skb, struct netlink_callback 
*cb);
int (*done)(struct netlink_callback *cb);
int family;
-   longargs[5];
+   longargs[6];
 };
 
 struct netlink_notify
--- a/net/ipv4/fib_trie.c   2008-01-24 13:39:40.0 -0800
+++ b/net/ipv4/fib_trie.c   2008-01-24 13:44:26.0 -0800
@@ -1743,6 +1743,19 @@ static struct leaf *trie_nextleaf(struct
return leaf_walk_rcu(p, c);
 }
 
+static struct leaf *trie_leafindex(struct trie *t, int index)
+{
+   struct leaf *l = trie_firstleaf(t);
+
+   while (index--  0) {
+   l = trie_nextleaf(l);
+   if (!l)
+   break;
+   }
+   return l;
+}
+
+
 /*
  * Caller must hold RTNL.
  */
@@ -1848,7 +1861,7 @@ static int fn_trie_dump_fa(t_key key, in
struct fib_alias *fa;
__be32 xkey = htonl(key);
 
-   s_i = cb-args[4];
+   s_i = cb-args[5];
i = 0;
 
/* rcu_read_lock is hold by caller */
@@ -1869,12 +1882,12 @@ static int fn_trie_dump_fa(t_key key, in
  plen,
  fa-fa_tos,
  fa-fa_info, NLM_F_MULTI)  0) {
-   cb-args[4] = i;
+   cb-args[5] = i;
return -1;
}
i++;
}
-   cb-args[4] = i;
+   cb-args[5] = i;
return skb-len;
 }
 
@@ -1885,7 +1898,7 @@ static int fn_trie_dump_leaf(struct leaf
struct hlist_node *node;
int i, s_i;
 
-   s_i = cb-args[3];
+   s_i = cb-args[4];
i = 0;
 
/* rcu_read_lock is hold by caller */
@@ -1896,19 +1909,19 @@ static int fn_trie_dump_leaf(struct leaf
}
 
if (i  s_i)
-   cb-args[4] = 0;
+   cb-args[5] = 0;
 
if (list_empty(li-falh))
continue;
 
if (fn_trie_dump_fa(l-key, li-plen, li-falh, tb, skb, cb)  
0) {
-   cb-args[3] = i;
+   cb-args[4] = i;
return -1;
}
i++;
}
 
-   cb-args[3] = i;
+   cb-args[4] = i;
return skb-len;
 }
 
@@ -1918,35 +1931,37 @@ static int fn_trie_dump(struct fib_table
struct leaf *l;
struct trie *t = (struct trie *) tb-tb_data;
t_key key = cb-args[2];
+   int count = cb-args[3];
 
rcu_read_lock();
/* Dump starting at last key.
 * Note: 0.0.0.0/0 (ie default) is first key.
 */
-   if (!key)
+   if (count == 0)
l = trie_firstleaf(t);
else {
+   /* Normally, continue from last key, but if that is missing
+* fallback to using slow rescan
+*/
l = fib_find_node(t, key);
-   if (!l) {
-   /* The table changed during the dump, rather than
-* giving partial data, just make application retry.
-*/
-   rcu_read_unlock();
-   return -EBUSY;
-   }
+   if (!l)
+   l = trie_leafindex(t, count);
}
 
while (l) {
cb-args[2] = l-key;
if (fn_trie_dump_leaf(l, tb, skb, cb)  0) {
+   cb-args[3] = count;
rcu_read_unlock();
return -1;
}
 
+   ++count;
l = trie_nextleaf(l);
-   memset(cb-args[3], 0,
-  sizeof(cb-args) - 3*sizeof(cb-args[0]));
+   memset(cb-args[4], 0,
+  sizeof(cb-args) - 4*sizeof(cb-args[0]));
}
+   cb-args[3] = count;
rcu_read_unlock();
 
return skb-len;
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Slow OOM in netif_RX function

2008-01-24 Thread Francois Romieu
Ivan H. Dichev [EMAIL PROTECTED] :
[...]
 Any other ideas appreciated. 

Plot the slab values and the counters of the iptables rules against time ?

-- 
Ueimor
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.25] RDMA/cxgb3: Fix the T3A workaround checks.

2008-01-24 Thread Steve Wise

RDMA/cxgb3: Fix the T3A workaround checks.

Correctly work around T3A issues by checking hwtype != T3A instead of
hwtype == T3B.  Needed for new hw types.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/cxio_hal.c  |2 +-
 drivers/infiniband/hw/cxgb3/iwch_cm.c   |4 ++--
 drivers/infiniband/hw/cxgb3/iwch_provider.c |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c 
b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index eec6a30..e220b44 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -179,7 +179,7 @@ int cxio_create_cq(struct cxio_rdev *rdev_p, struct t3_cq 
*cq)
setup.size = 1UL  cq-size_log2;
setup.credits = 65535;
setup.credit_thres = 1;
-   if (rdev_p-t3cdev_p-type == T3B)
+   if (rdev_p-t3cdev_p-type != T3A)
setup.ovfl_mode = 0;
else
setup.ovfl_mode = 1;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c 
b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index 20ba372..f8cb0fe 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -1118,7 +1118,7 @@ static int act_open_rpl(struct t3cdev *tdev, struct 
sk_buff *skb, void *ctx)
 status2errno(rpl-status));
connect_reply_upcall(ep, status2errno(rpl-status));
state_set(ep-com, DEAD);
-   if (ep-com.tdev-type == T3B  act_open_has_tid(rpl-status))
+   if (ep-com.tdev-type != T3A  act_open_has_tid(rpl-status))
release_tid(ep-com.tdev, GET_TID(rpl), NULL);
cxgb3_free_atid(ep-com.tdev, ep-atid);
dst_release(ep-dst);
@@ -1249,7 +1249,7 @@ static void reject_cr(struct t3cdev *tdev, u32 hwtid, 
__be32 peer_ip,
skb_trim(skb, sizeof(struct cpl_tid_release));
skb_get(skb);
 
-   if (tdev-type == T3B)
+   if (tdev-type != T3A)
release_tid(tdev, hwtid, skb);
else {
struct cpl_pass_accept_rpl *rpl;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c 
b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 69b1204..df1838f 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -646,7 +646,7 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 
start, u64 length,
if (err)
goto err;
 
-   if (udata  t3b_device(rhp)) {
+   if (udata  !t3a_device(rhp)) {
uresp.pbl_addr = (mhp-attr.pbl_addr -
 rhp-rdev.rnic_info.pbl_base)  3;
PDBG(%s user resp pbl_addr 0x%x\n, __FUNCTION__,
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] SMC91x: Use IRQ save and restore versions of spinlocks

2008-01-24 Thread Kevin Hilman
Under certain circumstances (e.g. kgdb over ethernet), the TX code may
be called with interrupts disabled.  The spin_unlock_irq() calls in
the driver unconditionally re-enable interrupts, which may trigger the
netdev softirq to run and cause spinlock recursion in the net stack.

For example, here's an example path with interrupts disabled:

kgdb exception
  eth_flush_buf
netpoll_send_udp
  netpoll_send_skb  [ takes netdevice-xmit_lock via netif_tx_trylock() ]
smc_hard_start_xmit
  smc_hardware_send_pkt
SMC_ENABLE_INT()
  spin_unlock_irq(lp-lock)

That spin_unlock_irq() will re-enable interrupts, even if they wer
disabled, thus triggering the netdev softirq to run.  The
dev_watchdog() will try to take the netdevice-xmit_lock which is
currently locked by netpoll_send_skb() and then BUG!

Also, use spin_trylock_irqsave() instead of a wrapped version of
spin_trylock.

Signed-off-by: Kevin Hilman [EMAIL PROTECTED]
Acked-by: Nicolas Pitre [EMAIL PROTECTED]

---
 drivers/net/smc91x.c |   42 ++
 1 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 7da7589..475de0f 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -222,21 +222,21 @@ static void PRINT_PKT(u_char *buf, int length)
 /* this enables an interrupt in the interrupt mask register */
 #define SMC_ENABLE_INT(x) do { \
unsigned char mask; \
-   spin_lock_irq(lp-lock);   \
+   spin_lock_irqsave(lp-lock, flags);\
mask = SMC_GET_INT_MASK();  \
mask |= (x);\
SMC_SET_INT_MASK(mask); \
-   spin_unlock_irq(lp-lock); \
+   spin_unlock_irqrestore(lp-lock, flags);   \
 } while (0)
 
 /* this disables an interrupt from the interrupt mask register */
 #define SMC_DISABLE_INT(x) do {
\
unsigned char mask; \
-   spin_lock_irq(lp-lock);   \
+   spin_lock_irqsave(lp-lock, flags);\
mask = SMC_GET_INT_MASK();  \
mask = ~(x);   \
SMC_SET_INT_MASK(mask); \
-   spin_unlock_irq(lp-lock); \
+   spin_unlock_irqrestore(lp-lock, flags);   \
 } while (0)
 
 /*
@@ -547,21 +547,13 @@ static inline void  smc_rcv(struct net_device *dev)
  * any other concurrent access and C would always interrupt B. But life
  * isn't that easy in a SMP world...
  */
-#define smc_special_trylock(lock)  \
-({ \
-   int __ret;  \
-   local_irq_disable();\
-   __ret = spin_trylock(lock); \
-   if (!__ret) \
-   local_irq_enable(); \
-   __ret;  \
-})
-#define smc_special_lock(lock) spin_lock_irq(lock)
-#define smc_special_unlock(lock)   spin_unlock_irq(lock)
+#define smc_special_trylock(lock, flags) spin_trylock_irqsave(lock, flags)
+#define smc_special_lock(lock, flags)  spin_lock_irqsave(lock, flags)
+#define smc_special_unlock(lock, flags)spin_unlock_irqrestore(lock, 
flags)
 #else
-#define smc_special_trylock(lock)  (1)
-#define smc_special_lock(lock) do { } while (0)
-#define smc_special_unlock(lock)   do { } while (0)
+#define smc_special_trylock(lock,flags)(1)
+#define smc_special_lock(lock,flags)   do { } while (0)
+#define smc_special_unlock(lock,flags) do { } while (0)
 #endif
 
 /*
@@ -575,10 +567,11 @@ static void smc_hardware_send_pkt(unsigned long data)
struct sk_buff *skb;
unsigned int packet_no, len;
unsigned char *buf;
+   unsigned long flags;
 
DBG(3, %s: %s\n, dev-name, __FUNCTION__);
 
-   if (!smc_special_trylock(lp-lock)) {
+   if (!smc_special_trylock(lp-lock, flags)) {
netif_stop_queue(dev);
tasklet_schedule(lp-tx_task);
return;
@@ -586,7 +579,7 @@ static void smc_hardware_send_pkt(unsigned long data)
 
skb = lp-pending_tx_skb;
if (unlikely(!skb)) {
-   smc_special_unlock(lp-lock);
+   

Re: [PATCH 2.6.25] RDMA/cxgb3: Fix the T3A workaround checks.

2008-01-24 Thread Roland Dreier
thanks, applied.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 07/14] [rndis_host] Split up rndis_host.c

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 Split up rndis_host.c into rndis_host.h and rndis_base.c. This is done so
 that rndis_wext can reuse common parts with rndis_host.
 
 Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED]

Acked-by: David Brownell [EMAIL PROTECTED]

 ---
 
  drivers/net/usb/rndis_host.c |  223 --
  drivers/net/usb/rndis_host.h |  248 
 ++
  2 files changed, 249 insertions(+), 222 deletions(-)
 
 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index 12daf9c..29d7e3b 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -31,6 +31,7 @@
  #include linux/usb/cdc.h
  
  #include usbnet.h
 +#include rndis_host.h
  
  
  /*
 @@ -56,228 +57,6 @@
   */
  
  /*
 - * CONTROL uses CDC encapsulated commands with funky notifications.
 - *  - control-out:  SEND_ENCAPSULATED
 - *  - interrupt-in:  RESPONSE_AVAILABLE
 - *  - control-in:  GET_ENCAPSULATED
 - *
 - * We'll try to ignore the RESPONSE_AVAILABLE notifications.
 - *
 - * REVISIT some RNDIS implementations seem to have curious issues still
 - * to be resolved.
 - */
 -struct rndis_msg_hdr {
 - __le32  msg_type;   /* RNDIS_MSG_* */
 - __le32  msg_len;
 - // followed by data that varies between messages
 - __le32  request_id;
 - __le32  status;
 - // ... and more
 -} __attribute__ ((packed));
 -
 -/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */
 -#define  CONTROL_BUFFER_SIZE 1025
 -
 -/* RNDIS defines an (absurdly huge) 10 second control timeout,
 - * but ActiveSync seems to use a more usual 5 second timeout
 - * (which matches the USB 2.0 spec).
 - */
 -#define  RNDIS_CONTROL_TIMEOUT_MS(5 * 1000)
 -
 -
 -#define ccpu2 __constant_cpu_to_le32
 -
 -#define RNDIS_MSG_COMPLETION ccpu2(0x8000)
 -
 -/* codes for msg_type field of rndis messages;
 - * only the data channel uses packet messages (maybe batched);
 - * everything else goes on the control channel.
 - */
 -#define RNDIS_MSG_PACKET ccpu2(0x0001)   /* 1-N packets */
 -#define RNDIS_MSG_INIT   ccpu2(0x0002)
 -#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
 -#define RNDIS_MSG_HALT   ccpu2(0x0003)
 -#define RNDIS_MSG_QUERY  ccpu2(0x0004)
 -#define RNDIS_MSG_QUERY_C(RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
 -#define RNDIS_MSG_SETccpu2(0x0005)
 -#define RNDIS_MSG_SET_C  (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
 -#define RNDIS_MSG_RESET  ccpu2(0x0006)
 -#define RNDIS_MSG_RESET_C(RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
 -#define RNDIS_MSG_INDICATE   ccpu2(0x0007)
 -#define RNDIS_MSG_KEEPALIVE  ccpu2(0x0008)
 -#define RNDIS_MSG_KEEPALIVE_C
 (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
 -
 -/* codes for status field of completion messages */
 -#define  RNDIS_STATUS_SUCCESSccpu2(0x)
 -#define  RNDIS_STATUS_FAILUREccpu2(0xc001)
 -#define  RNDIS_STATUS_INVALID_DATA   ccpu2(0xc0010015)
 -#define  RNDIS_STATUS_NOT_SUPPORTED  ccpu2(0xc0bb)
 -#define  RNDIS_STATUS_MEDIA_CONNECT  ccpu2(0x4001000b)
 -#define  RNDIS_STATUS_MEDIA_DISCONNECT   ccpu2(0x4001000c)
 -
 -
 -struct rndis_data_hdr {
 - __le32  msg_type;   /* RNDIS_MSG_PACKET */
 - __le32  msg_len;// rndis_data_hdr + data_len + pad
 - __le32  data_offset;// 36 -- right after header
 - __le32  data_len;   // ... real packet size
 -
 - __le32  oob_data_offset;// zero
 - __le32  oob_data_len;   // zero
 - __le32  num_oob;// zero
 - __le32  packet_data_offset; // zero
 -
 - __le32  packet_data_len;// zero
 - __le32  vc_handle;  // zero
 - __le32  reserved;   // zero
 -} __attribute__ ((packed));
 -
 -struct rndis_init {  /* OUT */
 - // header and:
 - __le32  msg_type;   /* RNDIS_MSG_INIT */
 - __le32  msg_len;// 24
 - __le32  request_id;
 - __le32  major_version;  // of rndis (1.0)
 - __le32  minor_version;
 - __le32  max_transfer_size;
 -} __attribute__ ((packed));
 -
 -struct rndis_init_c {/* IN */
 - // header and:
 - __le32  msg_type;   /* RNDIS_MSG_INIT_C */
 - __le32  msg_len;
 - __le32  request_id;
 - __le32  status;
 - __le32  major_version;  // of rndis (1.0)
 - __le32  minor_version;
 - __le32  device_flags;
 - __le32  medium; // zero == 802.3
 - __le32  max_packets_per_message;
 - __le32  max_transfer_size;
 - __le32  packet_alignment;   // max 7; (1n) bytes
 - __le32  af_list_offset; // 

Re: [PATCH 10/14] [rndis_host] Add rndis_early_init function pointer to 'struct rndis_data'.

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 Function pointer is for rndis minidrivers that need to do work on device right
 after RNDIS_INIT. For example setting device specific configuration parameters
 with OID_GEN_RNDIS_CONFIG_PARAMETER.
 
 Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED]

Could this -- and #11/14 -- instead be generalized a bit,
so they're not RNDIS-specific?  At least in name; the
only user for now would be the rndis_host code.

The generalization would presumably be early_init and
link_change, paired with doc comments reflecting that
they're usable by any driver stack built over the usbnet
framework core.

There's no point IMO to having generalizable hooks be
restricted this way.

- Dave


 ---
 
  drivers/net/usb/rndis_host.c |6 ++
  drivers/net/usb/usbnet.h |3 +++
  2 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index 1d6bf0a..22e5ca1 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -336,6 +336,12 @@ int generic_rndis_bind(struct usbnet *dev, struct 
 usb_interface *intf)
   dev-hard_mtu, tmp, dev-rx_urb_size,
   1  le32_to_cpu(u.init_c-packet_alignment));
  
 + /* module has some device initialization code needs to be done right
 +  * after RNDIS_INIT */
 + if (dev-driver_info-rndis_early_init 
 + dev-driver_info-rndis_early_init(dev) != 0)
 + goto halt_fail_and_release;
 +
   /* Get designated host ethernet address */
   reply_len = ETH_ALEN;
   retval = rndis_query(dev, intf, u.buf, OID_802_3_PERMANENT_ADDRESS,
 diff --git a/drivers/net/usb/usbnet.h b/drivers/net/usb/usbnet.h
 index 0b4bf09..2bc5f76 100644
 --- a/drivers/net/usb/usbnet.h
 +++ b/drivers/net/usb/usbnet.h
 @@ -116,6 +116,9 @@ struct driver_info {
   struct sk_buff  *(*tx_fixup)(struct usbnet *dev,
   struct sk_buff *skb, gfp_t flags);
  
 + /* rndis minidriver early initialization code, can sleep */
 + int (*rndis_early_init)(struct usbnet *dev);
 +
   /* for new devices, use the descriptor-reading code instead */
   int in; /* rx endpoint */
   int out;/* tx endpoint */
 


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/14] RFC: Driver for Wireless RNDIS USB devices.

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 Hello,
 
 This is second try on wireless RNDIS patchset started by Bjorge Dijkstra. 
 Since
 Bjorge has disappeared, I claim maintainership of rndis_wext and this patchset
 until he returns.
 
 This patchset adds support for various 802.11 USB devices based on Broadcom
 4320 chip. Chip uses RNDIS to communicate with the host, so module depend
 heavily on rndis_host/cdc_ether/usbnet and needs some changes on these 
 modules in order to work.
 
 Patches 1-6 are from first patchset:
  1. Fix sparse warning: returning void valued expression
  2. [cdc_ether] Hardwire CDC descriptors when missing
  3. [rndis_host] Use 1KB buffer in rndis_unbind
  4. [rndis_host] Halt device if rndis_bind fails
  5. [rndis_host] Fix rndis packet filter flags
  6. [usbnet] Use wlan device name for RNDIS wireless devices
 
 Of these 1, 3 and 4 are not required for this version of rndis_wext to work.
 
 Actual wireless part is changed from extension on rndis_host to separate 
 driver. Different devices are detected by device specific USB vendor/product 
 IDs as the way done with Windows drivers instead of detecting RNDIS media 
 type 
 like in first patchset.
 
 New patches 7-14:
  7. [rndis_host] Split up rndis_host.c
  8. [rndis_host] export functions
  9. [usbnet] add driver_priv pointer to 'struct usbnet'

So far as I'm concerned patches 1-9 can go in any time.

The other patches I won't ack yet; see below.


 10. [rndis_host] Add rndis_early_init function pointer to 'struct rndis_data'.
 11. [rndis_host] Add rndis_link_change function pointer to 'struct 
 rndis_data'.

Those aren't added to struct rndis_data ... they're added to
the struct at the core of the usbnet framework.  So they should
not be RNDIS-specific ... even though the only current user will
be the RNDIS host code.  Rename those methods and I'll be happy.


 12. Move usbnet.h and rndis_host.h to include/linux/usb

No problem with that, except that fixing #10 and #11 will
break them.


 13. [rndis_host] blacklist known wireless RNDIS devices

That will be a headache over time though ... can't you just
let the probe succeed enough to recogize it's wireless (using
the media flag) and then bail, so the next driver can try?


 14. Add new driver 'rndis_wext' for wireless RNDIS devices.

The real goods!  :)

 
 Patches should be applied in order, series apply cleanly to 2.6.24-rc8.
 
  - Jussi Kivilinna
 


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/14] [rndis_host] blacklist known wireless RNDIS devices

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 Blacklist known wireless RNDIS devices that will be handled by
 rndis_wext module.

This seems destined to become a headache.  Wouldn't it be better
to let the probe progress far enough to detect that it's actually
a WLAN device, and then back out so the next driver can try?

- Dave


 Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED]
 ---
 
  drivers/net/usb/rndis_host.c |  104 
 ++
  1 files changed, 104 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index 1ffbbb3..cd1f953 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -530,6 +530,110 @@ static const struct driver_info rndis_info = {
  /*-*/
  
  static const struct usb_device_idproducts [] = {
 +/*
 + * BLACKLIST !!
 + *
 + * Blacklist RNDIS devices that are handled in separate RNDIS modules.
 + */
 +
 +#define  RNDIS_MASTER_INTERFACE \
 + .bInterfaceClass= USB_CLASS_COMM, \
 + .bInterfaceSubClass = 2 /* ACM */, \
 + .bInterfaceProtocol = 0x0ff
 +
 +/* Wireless RNDIS devices, rndis_wext module */
 +{
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x0411,
 + .idProduct  = 0x00bc,   /* Buffalo WLI-U2-KG125S */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +}, {
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x0baf,
 + .idProduct  = 0x011b,   /* U.S. Robotics USR5421 */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +}, {
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x050d,
 + .idProduct  = 0x011b,   /* Belkin F5D7051 */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +}, {
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x1799,   /* Belkin has two vendor ids */
 + .idProduct  = 0x011b,   /* Belkin F5D7051 */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +}, {
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x13b1,
 + .idProduct  = 0x0014,   /* Linksys WUSB54GSv2 */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +}, {
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x13b1,
 + .idProduct  = 0x0026,   /* Linksys WUSB54GSC */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +}, {
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x0b05,
 + .idProduct  = 0x1717,   /* Asus WL169gE */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +}, {
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x0a5c,
 + .idProduct  = 0xd11b,   /* Eminent EM4045 */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +}, {
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x1690,
 + .idProduct  = 0x0715,   /* BT Voyager 1055 */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +}, {
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x13b1,
 + .idProduct  = 0x000e,   /* Linksys WUSB54GSv1 */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +}, {
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x0baf,
 + .idProduct  = 0x0111,   /* U.S. Robotics USR5420 */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +}, {
 + .match_flags=   USB_DEVICE_ID_MATCH_INT_INFO
 +   | USB_DEVICE_ID_MATCH_DEVICE,
 + .idVendor   = 0x0411,
 + .idProduct  = 0x004b,   /* BUFFALO WLI-USB-G54 */
 + RNDIS_MASTER_INTERFACE,
 + .driver_info= 0,
 +},
 +
 +/*
 + * WHITELIST!!!
 + *
 + * All other RNDIS devices that do not need special OID handling in order
 + * to work.
 + */
  {

Re: [PATCH 04/14] [rndis_host] Halt device if rndis_bind fails.

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 When bind fails after device was initialized, shutdown device properly
 by sending RNDIS_MSG_HALT.
 
 Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED]
 Signed-off-by: Bjorge Dijkstra [EMAIL PROTECTED]

Acked-by: David Brownell [EMAIL PROTECTED]

 ---
 
  drivers/net/usb/rndis_host.c |   12 +---
  1 files changed, 9 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index 42b161c..c686025 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -467,6 +467,7 @@ static int rndis_bind(struct usbnet *dev, struct 
 usb_interface *intf)
   struct rndis_query_c*get_c;
   struct rndis_set*set;
   struct rndis_set_c  *set_c;
 + struct rndis_halt   *halt;
   } u;
   u32 tmp;
   int reply_len;
 @@ -517,7 +518,7 @@ static int rndis_bind(struct usbnet *dev, struct 
 usb_interface *intf)
   dev can't take %u byte packets (max %u)\n,
   dev-hard_mtu, tmp);
   retval = -EINVAL;
 - goto fail_and_release;
 + goto halt_fail_and_release;
   }
   dev-hard_mtu = tmp;
   net-mtu = dev-hard_mtu - net-hard_header_len;
 @@ -539,7 +540,7 @@ static int rndis_bind(struct usbnet *dev, struct 
 usb_interface *intf)
   48, (void **) bp, reply_len);
   if (unlikely(retval 0)) {
   dev_err(intf-dev, rndis get ethaddr, %d\n, retval);
 - goto fail_and_release;
 + goto halt_fail_and_release;
   }
   memcpy(net-dev_addr, bp, ETH_ALEN);
  
 @@ -555,7 +556,7 @@ static int rndis_bind(struct usbnet *dev, struct 
 usb_interface *intf)
   retval = rndis_command(dev, u.header);
   if (unlikely(retval  0)) {
   dev_err(intf-dev, rndis set packet filter, %d\n, retval);
 - goto fail_and_release;
 + goto halt_fail_and_release;
   }
  
   retval = 0;
 @@ -563,6 +564,11 @@ static int rndis_bind(struct usbnet *dev, struct 
 usb_interface *intf)
   kfree(u.buf);
   return retval;
  
 +halt_fail_and_release:
 + memset(u.halt, 0, sizeof *u.halt);
 + u.halt-msg_type = RNDIS_MSG_HALT;
 + u.halt-msg_len = ccpu2(sizeof *u.halt);
 + (void) rndis_command(dev, (void *)u.halt);
  fail_and_release:
   usb_set_intfdata(info-data, NULL);
   usb_driver_release_interface(driver_of(intf), info-data);
 


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/14] [rndis_host] export functions

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 Export rndis_host functions and also rename rndis_bind() to
 generic_rndis_bind() for modules using rndis_host as base.
 
 Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED]

Acked-by: David Brownell [EMAIL PROTECTED]

 ---
 
  drivers/net/usb/rndis_host.c |   20 +---
  drivers/net/usb/rndis_host.h |9 +
  2 files changed, 22 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index 29d7e3b..1d6bf0a 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -60,13 +60,14 @@
   * RNDIS notifications from device: command completion; reverse
   * keepalives; etc
   */
 -static void rndis_status(struct usbnet *dev, struct urb *urb)
 +void rndis_status(struct usbnet *dev, struct urb *urb)
  {
   devdbg(dev, rndis status urb, len %d stat %d,
   urb-actual_length, urb-status);
   // FIXME for keepalives, respond immediately (asynchronously)
   // if not an RNDIS status, do like cdc_status(dev,urb) does
  }
 +EXPORT_SYMBOL_GPL(rndis_status);
  
  /*
   * RPC done RNDIS-style.  Caller guarantees:
 @@ -78,7 +79,7 @@ static void rndis_status(struct usbnet *dev, struct urb 
 *urb)
   * Call context is likely probe(), before interface name is known,
   * which is why we won't try to use it in the diagnostics.
   */
 -static int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf)
 +int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf)
  {
   struct cdc_state*info = (void *) dev-data;
   int master_ifnum;
 @@ -187,6 +188,7 @@ static int rndis_command(struct usbnet *dev, struct 
 rndis_msg_hdr *buf)
   dev_dbg(info-control-dev, rndis response timeout\n);
   return -ETIMEDOUT;
  }
 +EXPORT_SYMBOL_GPL(rndis_command);
  
  /*
   * rndis_query:
 @@ -253,7 +255,7 @@ response_error:
   return -EDOM;
  }
  
 -static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
 +int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf)
  {
   int retval;
   struct net_device   *net = dev-net;
 @@ -377,8 +379,9 @@ fail:
   kfree(u.buf);
   return retval;
  }
 +EXPORT_SYMBOL_GPL(generic_rndis_bind);
  
 -static void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)
 +void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)
  {
   struct rndis_halt   *halt;
  
 @@ -393,11 +396,12 @@ static void rndis_unbind(struct usbnet *dev, struct 
 usb_interface *intf)
  
   usbnet_cdc_unbind(dev, intf);
  }
 +EXPORT_SYMBOL_GPL(rndis_unbind);
  
  /*
   * DATA -- host must not write zlps
   */
 -static int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 +int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
  {
   /* peripheral may have batched packets to us... */
   while (likely(skb-len)) {
 @@ -439,8 +443,9 @@ static int rndis_rx_fixup(struct usbnet *dev, struct 
 sk_buff *skb)
   /* caller will usbnet_skb_return the remaining packet */
   return 1;
  }
 +EXPORT_SYMBOL_GPL(rndis_rx_fixup);
  
 -static struct sk_buff *
 +struct sk_buff *
  rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
  {
   struct rndis_data_hdr   *hdr;
 @@ -485,12 +490,13 @@ fill:
   /* FIXME make the last packet always be short ... */
   return skb;
  }
 +EXPORT_SYMBOL_GPL(rndis_tx_fixup);
  
  
  static const struct driver_info  rndis_info = {
   .description =  RNDIS device,
   .flags =FLAG_ETHER | FLAG_FRAMING_RN | FLAG_NO_SETINT,
 - .bind = rndis_bind,
 + .bind = generic_rndis_bind,
   .unbind =   rndis_unbind,
   .status =   rndis_status,
   .rx_fixup = rndis_rx_fixup,
 diff --git a/drivers/net/usb/rndis_host.h b/drivers/net/usb/rndis_host.h
 index 1386a17..61f1fd8 100644
 --- a/drivers/net/usb/rndis_host.h
 +++ b/drivers/net/usb/rndis_host.h
 @@ -244,5 +244,14 @@ struct rndis_keepalive_c {   /* IN (optionally OUT) 
 */
   RNDIS_PACKET_TYPE_ALL_MULTICAST | \
   RNDIS_PACKET_TYPE_PROMISCUOUS)
  
 +
 +extern void rndis_status(struct usbnet *dev, struct urb *urb);
 +extern int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf);
 +extern int generic_rndis_bind(struct usbnet *dev, struct usb_interface 
 *intf);
 +extern void rndis_unbind(struct usbnet *dev, struct usb_interface *intf);
 +extern int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb);
 +extern struct sk_buff *
 +rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
 +
  #endif   /* __RNDIS_HOST_H */
  
 


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/14] [usbnet] Use wlan device name for RNDIS wireless devices

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 Use wlan device name for RNDIS wireless devices.
 
 Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED]
 Signed-off-by: Bjorge Dijkstra [EMAIL PROTECTED]

Acked-by: David Brownell [EMAIL PROTECTED]

 ---
 
  drivers/net/usb/usbnet.c |3 +++
  drivers/net/usb/usbnet.h |2 ++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
 index 8ed1fc5..a2a2d5e 100644
 --- a/drivers/net/usb/usbnet.c
 +++ b/drivers/net/usb/usbnet.c
 @@ -1204,6 +1204,9 @@ usbnet_probe (struct usb_interface *udev, const struct 
 usb_device_id *prod)
   if ((dev-driver_info-flags  FLAG_ETHER) != 0
(net-dev_addr [0]  0x02) == 0)
   strcpy (net-name, eth%d);
 + /* WLAN devices should always be named wlan%d */
 + if ((dev-driver_info-flags  FLAG_WLAN) != 0)
 + strcpy(net-name, wlan%d);
  
   /* maybe the remote can't receive an Ethernet MTU */
   if (net-mtu  (dev-hard_mtu - net-hard_header_len))
 diff --git a/drivers/net/usb/usbnet.h b/drivers/net/usb/usbnet.h
 index 1fae434..29ab92e 100644
 --- a/drivers/net/usb/usbnet.h
 +++ b/drivers/net/usb/usbnet.h
 @@ -87,6 +87,8 @@ struct driver_info {
  #define FLAG_ETHER   0x0020  /* maybe use eth%d names */
  
  #define FLAG_FRAMING_AX 0x0040   /* AX88772/178 packets */
 +#define FLAG_WLAN0x0080  /* use wlan%d names */
 +
  
   /* init device ... can sleep, or cause probe() failure */
   int (*bind)(struct usbnet *, struct usb_interface *);
 


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/14] [rndis_host] Fix rndis packet filter flags.

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 RNDIS packet filter flags are not exactly the same as CDC flags
 so we cannot reuse them.
 
 Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED]
 Signed-off-by: Bjorge Dijkstra [EMAIL PROTECTED]

Acked-by: David Brownell [EMAIL PROTECTED]


 ---
 
  drivers/net/usb/rndis_host.c |   23 ++-
  1 files changed, 22 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index c686025..12daf9c 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -256,6 +256,27 @@ struct rndis_keepalive_c {   /* IN (optionally OUT) 
 */
  #define OID_GEN_MAXIMUM_FRAME_SIZE   ccpu2(0x00010106)
  #define OID_GEN_CURRENT_PACKET_FILTERccpu2(0x0001010e)
  
 +/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
 +#define RNDIS_PACKET_TYPE_DIRECTED   ccpu2(0x0001)
 +#define RNDIS_PACKET_TYPE_MULTICAST  ccpu2(0x0002)
 +#define RNDIS_PACKET_TYPE_ALL_MULTICAST  ccpu2(0x0004)
 +#define RNDIS_PACKET_TYPE_BROADCAST  ccpu2(0x0008)
 +#define RNDIS_PACKET_TYPE_SOURCE_ROUTING ccpu2(0x0010)
 +#define RNDIS_PACKET_TYPE_PROMISCUOUSccpu2(0x0020)
 +#define RNDIS_PACKET_TYPE_SMTccpu2(0x0040)
 +#define RNDIS_PACKET_TYPE_ALL_LOCAL  ccpu2(0x0080)
 +#define RNDIS_PACKET_TYPE_GROUP  ccpu2(0x1000)
 +#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL ccpu2(0x2000)
 +#define RNDIS_PACKET_TYPE_FUNCTIONAL ccpu2(0x4000)
 +#define RNDIS_PACKET_TYPE_MAC_FRAME  ccpu2(0x8000)
 +
 +/* default filter used with RNDIS devices */
 +#define RNDIS_DEFAULT_FILTER ( \
 + RNDIS_PACKET_TYPE_DIRECTED | \
 + RNDIS_PACKET_TYPE_BROADCAST | \
 + RNDIS_PACKET_TYPE_ALL_MULTICAST | \
 + RNDIS_PACKET_TYPE_PROMISCUOUS)
 +
  /*
   * RNDIS notifications from device: command completion; reverse
   * keepalives; etc
 @@ -551,7 +572,7 @@ static int rndis_bind(struct usbnet *dev, struct 
 usb_interface *intf)
   u.set-oid = OID_GEN_CURRENT_PACKET_FILTER;
   u.set-len = ccpu2(4);
   u.set-offset = ccpu2((sizeof *u.set) - 8);
 - *(__le32 *)(u.buf + sizeof *u.set) = ccpu2(DEFAULT_FILTER);
 + *(__le32 *)(u.buf + sizeof *u.set) = RNDIS_DEFAULT_FILTER;
  
   retval = rndis_command(dev, u.header);
   if (unlikely(retval  0)) {
 


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/26] atl1: refactor tx processing

2008-01-24 Thread Jay Cliburn
On Tue, 22 Jan 2008 18:31:09 -0600
Jay Cliburn [EMAIL PROTECTED] wrote:

 On Tue, 22 Jan 2008 04:58:17 -0500
 Jeff Garzik [EMAIL PROTECTED] wrote:
 
[...]
  for such a huge patch, this description is very tiny.  [describe]
  what is refactored, and why.

Is this one any better?



From df475e2eea401f9dc18ca23dab538b99fb9e710c Mon Sep 17 00:00:00 2001
From: Jay Cliburn [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 21:36:36 -0600
Subject: [PATCH] atl1: simplify tx packet descriptor

The transmit packet descriptor consists of four 32-bit words, with word 3
upper bits overloaded depending upon the condition of its bits 3 and 4.
The driver currently duplicates all word 2 and some word 3 register bit
definitions unnecessarily and also uses a set of nested structures in its
definition of the TPD without good cause. This patch adds a lengthy
comment describing the TPD, eliminates duplicate TPD bit definitions,
and simplifies the TPD structure itself. It also expands the TSO check
to correctly handle custom checksum versus TSO processing using the revised
TPD definitions. Finally, shorten some variable names in the transmit
processing path to reduce line lengths, rename some variables to better
describe their purpose (e.g., nseg versus m), and add a comment or two
to better describe what the code is doing.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atlx/atl1.c |  265 +--
 drivers/net/atlx/atl1.h |  201 +++-
 2 files changed, 246 insertions(+), 220 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 1f564f0..f4add3c 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -1259,8 +1259,6 @@ static void atl1_intr_tx(struct atl1_adapter *adapter)
dev_kfree_skb_irq(buffer_info-skb);
buffer_info-skb = NULL;
}
-   tpd-buffer_addr = 0;
-   tpd-desc.data = 0;
 
if (++sw_tpd_next_to_clean == tpd_ring-count)
sw_tpd_next_to_clean = 0;
@@ -1282,48 +1280,69 @@ static u16 atl1_tpd_avail(struct atl1_tpd_ring 
*tpd_ring)
 }
 
 static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
-struct tso_param *tso)
+   struct tx_packet_desc *ptpd)
 {
-   /* We enter this function holding a spinlock. */
-   u8 ipofst;
+   /* spinlock held */
+   u8 hdr_len, ip_off;
+   u32 real_len;
int err;
 
if (skb_shinfo(skb)-gso_size) {
if (skb_header_cloned(skb)) {
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
if (unlikely(err))
-   return err;
+   return -1;
}
 
if (skb-protocol == ntohs(ETH_P_IP)) {
struct iphdr *iph = ip_hdr(skb);
 
-   iph-tot_len = 0;
+   real_len = (((unsigned char *)iph - skb-data) +
+   ntohs(iph-tot_len));
+   if (real_len  skb-len)
+   pskb_trim(skb, real_len);
+   hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb));
+   if (skb-len == hdr_len) {
+   iph-check = 0;
+   tcp_hdr(skb)-check =
+   ~csum_tcpudp_magic(iph-saddr,
+   iph-daddr, tcp_hdrlen(skb),
+   IPPROTO_TCP, 0);
+   ptpd-word3 |= (iph-ihl  TPD_IPHL_MASK) 
+   TPD_IPHL_SHIFT;
+   ptpd-word3 |= ((tcp_hdrlen(skb)  2) 
+   TPD_TCPHDRLEN_MASK) 
+   TPD_TCPHDRLEN_SHIFT;
+   ptpd-word3 |= 1  TPD_IP_CSUM_SHIFT;
+   ptpd-word3 |= 1  TPD_TCP_CSUM_SHIFT;
+   return 1;
+   }
+
iph-check = 0;
tcp_hdr(skb)-check = ~csum_tcpudp_magic(iph-saddr,
-   iph-daddr, 0, IPPROTO_TCP, 0);
-   ipofst = skb_network_offset(skb);
-   if (ipofst != ETH_HLEN) /* 802.3 frame */
-   tso-tsopl |= 1  TSO_PARAM_ETHTYPE_SHIFT;
-
-   tso-tsopl |= (iph-ihl 
-   TSO_PARAM_IPHL_MASK)  TSO_PARAM_IPHL_SHIFT;
-   tso-tsopl |= ((tcp_hdrlen(skb)  2) 
-   TSO_PARAM_TCPHDRLEN_MASK) 
-   TSO_PARAM_TCPHDRLEN_SHIFT;
-   tso-tsopl |= (skb_shinfo(skb)-gso_size 
-   TSO_PARAM_MSS_MASK)  TSO_PARAM_MSS_SHIFT;
-

Re: [PATCH 09/26] atl1: refactor tx processing

2008-01-24 Thread Chris Snook

Jay Cliburn wrote:

On Tue, 22 Jan 2008 18:31:09 -0600
Jay Cliburn [EMAIL PROTECTED] wrote:


On Tue, 22 Jan 2008 04:58:17 -0500
Jeff Garzik [EMAIL PROTECTED] wrote:


[...]

for such a huge patch, this description is very tiny.  [describe]
what is refactored, and why.


Is this one any better?


This satisfies me.

Acked-by: Chris Snook [EMAIL PROTECTED]


From df475e2eea401f9dc18ca23dab538b99fb9e710c Mon Sep 17 00:00:00 2001
From: Jay Cliburn [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 21:36:36 -0600
Subject: [PATCH] atl1: simplify tx packet descriptor

The transmit packet descriptor consists of four 32-bit words, with word 3
upper bits overloaded depending upon the condition of its bits 3 and 4.
The driver currently duplicates all word 2 and some word 3 register bit
definitions unnecessarily and also uses a set of nested structures in its
definition of the TPD without good cause. This patch adds a lengthy
comment describing the TPD, eliminates duplicate TPD bit definitions,
and simplifies the TPD structure itself. It also expands the TSO check
to correctly handle custom checksum versus TSO processing using the revised
TPD definitions. Finally, shorten some variable names in the transmit
processing path to reduce line lengths, rename some variables to better
describe their purpose (e.g., nseg versus m), and add a comment or two
to better describe what the code is doing.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/14] Fix sparse warning: returning void-valued expression

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 From: Bjorge Dijkstra [EMAIL PROTECTED]
 
 rndis_unbind and usbnet_cdc_unbind don't return anything.
 
 Signed-off-by: Bjorge Dijkstra [EMAIL PROTECTED]
 Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED]

Acked-by: David Brownell [EMAIL PROTECTED]

 ---
 
  drivers/net/usb/rndis_host.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index 1ebe325..96ef6a9 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -585,7 +585,7 @@ static void rndis_unbind(struct usbnet *dev, struct 
 usb_interface *intf)
   kfree(halt);
   }
  
 - return usbnet_cdc_unbind(dev, intf);
 + usbnet_cdc_unbind(dev, intf);
  }
  
  /*
 


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/14] [cdc_ether] Hardwire CDC descriptors when missing

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 From: Bjorge Dijkstra [EMAIL PROTECTED]
 
 Just as ActiveSync devices, some regular RNDIS devices also lack
 the CDC descriptors (e.g. devices based on BCM4320 WLAN chip).
 This patch hardwires the CDC descriptors for all RNDIS style devices
 when they are missing.
 
 Signed-off-by: Bjorge Dijkstra [EMAIL PROTECTED]
 Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED]

Acked-by: David Brownell [EMAIL PROTECTED]

 ---
 
  drivers/net/usb/cdc_ether.c |   10 +-
  1 files changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
 index a42acc3..97c17bb 100644
 --- a/drivers/net/usb/cdc_ether.c
 +++ b/drivers/net/usb/cdc_ether.c
 @@ -228,15 +228,16 @@ next_desc:
   buf += buf [0];
   }
  
 - /* Microsoft ActiveSync based RNDIS devices lack the CDC descriptors,
 -  * so we'll hard-wire the interfaces and not check for descriptors.
 + /* Microsoft ActiveSync based and some regular RNDIS devices lack the
 +  * CDC descriptors, so we'll hard-wire the interfaces and not check
 +  * for descriptors.
*/
 - if (is_activesync(intf-cur_altsetting-desc)  !info-u) {
 + if (rndis  !info-u) {
   info-control = usb_ifnum_to_if(dev-udev, 0);
   info-data = usb_ifnum_to_if(dev-udev, 1);
   if (!info-control || !info-data) {
   dev_dbg(intf-dev,
 - activesync: master #0/%p slave #1/%p\n,
 + rndis: master #0/%p slave #1/%p\n,
   info-control,
   info-data);
   goto bad_desc;
 @@ -316,7 +317,6 @@ void usbnet_cdc_unbind(struct usbnet *dev, struct 
 usb_interface *intf)
  }
  EXPORT_SYMBOL_GPL(usbnet_cdc_unbind);
  
 -
  /*-
   *
   * Communications Device Class, Ethernet Control model
 


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/14] [rndis_host] Use 1KB buffer in rndis_unbind

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 rndis_command requires the caller to pass in a buffer of at least 1KB.
 
 Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED]
 Signed-off-by: Bjorge Dijkstra [EMAIL PROTECTED]

Acked-by: David Brownell [EMAIL PROTECTED]

 ---
 
  drivers/net/usb/rndis_host.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index 96ef6a9..42b161c 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -577,7 +577,7 @@ static void rndis_unbind(struct usbnet *dev, struct 
 usb_interface *intf)
   struct rndis_halt   *halt;
  
   /* try to clear any rndis state/activity (no i/o from stack!) */
 - halt = kzalloc(sizeof *halt, GFP_KERNEL);
 + halt = kzalloc(CONTROL_BUFFER_SIZE, GFP_KERNEL);
   if (halt) {
   halt-msg_type = RNDIS_MSG_HALT;
   halt-msg_len = ccpu2(sizeof *halt);
 


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/14] [usbnet] add driver_priv pointer to 'struct usbnet'

2008-01-24 Thread David Brownell
On Saturday 19 January 2008, Jussi Kivilinna wrote:
 Add a private data pointer to usbnet for rndis_wext module to use.
 
 Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED]

Acked-by: David Brownell [EMAIL PROTECTED]

 ---
 
  drivers/net/usb/usbnet.h |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/net/usb/usbnet.h b/drivers/net/usb/usbnet.h
 index 29ab92e..0b4bf09 100644
 --- a/drivers/net/usb/usbnet.h
 +++ b/drivers/net/usb/usbnet.h
 @@ -31,6 +31,7 @@ struct usbnet {
   struct usb_interface*intf;
   struct driver_info  *driver_info;
   const char  *driver_name;
 + void*driver_priv;
   wait_queue_head_t   *wait;
   struct mutexphy_mutex;
   unsigned char   suspend_count;
 


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 2.6.24-rc8-mm1 : net tcp_input.c warnings

2008-01-24 Thread Dave Young
On Jan 24, 2008 5:54 PM, Ilpo Järvinen [EMAIL PROTECTED] wrote:
 On Thu, 24 Jan 2008, Dave Young wrote:

 Hi Dave ( others),

  Thanks.

 Thanks a lot, I was first to ignore all these because they occurred
 with newreno, but looked again... :-/

  New warning trigged with your debug patch:

 This was probably with the earlier one I sent to you because there's still
 this case remaining which itself is valid:

  P: 5 L: 0 vs 0 S: 0 vs 1 w: 2044790889-2044796616 (0)

 ...snip... this is still ok state (S+L = P):


  P: 5 L: 0 vs 0 S: 0 vs 3 w: 2044790889-2044796616 (0)
  TCP wq(s)  
  TCP wq(h) +++h+
  l0 s3 f0 p5 seq: su2044790889 hs2044795029 sn2044796616
  [ cut here ]
  WARNING: at net/ipv4/tcp_input.c:2169 tcp_mark_head_lost+0x122/0x150()
  Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event
  snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss eeprom e100 psmouse
  snd_hda_intel snd_pcm snd_timer btusb bluetooth serio_raw snd 3c59x sg
  evdev thermal soundcore rtc_cmos snd_page_alloc rtc_core rtc_lib
  i2c_i801 processor button intel_agp dcdbas pcspkr agpgart
  Pid: 0, comm: swapper Not tainted 2.6.24-rc8-mm1 #8
   [c0132100] ? have_callable_console+0x20/0x30
   [c0131844] warn_on_slowpath+0x54/0x80
   [c03ffe54] ? tcp_print_queue+0x1a4/0x230
   [c0132438] ? vprintk+0x308/0x320
   [c0132438] ? vprintk+0x308/0x320
   [c0132438] ? vprintk+0x308/0x320
   [c036] ? tcp_verify_wq+0x116/0x1c0
   [c03f6052] tcp_mark_head_lost+0x122/0x150
   [c03f60ca] tcp_update_scoreboard+0x4a/0x190
   [c03f6e7a] tcp_fastretrans_alert+0x4da/0x700
   [c03f7e63] tcp_ack+0x1b3/0x3a0
   [c03fa21b] tcp_rcv_established+0x3eb/0x710
   [c0401c05] tcp_v4_do_rcv+0xe5/0x100
   [c04021fb] tcp_v4_rcv+0x5db/0x660
   [c0401fa7] ? tcp_v4_rcv+0x387/0x660
   [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
   [c03e5f44] ip_local_deliver_finish+0x84/0x1d0
   [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
   [c0156b97] ? __lock_release+0x47/0x70
   [c03e6147] ip_local_deliver+0xb7/0xc0
   [c03e6202] ip_rcv_finish+0xb2/0x3c0
   [c03c01d8] ? sock_def_readable+0x48/0xa0
   [c03be061] ? sock_queue_rcv_skb+0xb1/0x1a0
   [c03be0a7] ? sock_queue_rcv_skb+0xf7/0x1a0
   [c03e669f] ip_rcv+0x18f/0x290
   [c042fb10] ? packet_rcv_spkt+0xd0/0x130
   [c03c8da6] netif_receive_skb+0x2b6/0x330
   [c03c8c17] ? netif_receive_skb+0x127/0x330
   [c03c8ea3] ? process_backlog+0x83/0x100
   [c03c8eae] process_backlog+0x8e/0x100
   [c03c90bc] net_rx_action+0x13c/0x230
   [c03c8fd9] ? net_rx_action+0x59/0x230
   [c0136f63] __do_softirq+0x93/0x120
   [c013706a] do_softirq+0x7a/0x80
   [c0137135] irq_exit+0x65/0x90
   [c01078b1] do_IRQ+0x41/0x80
   [c0155659] ? trace_hardirqs_on+0xb9/0x130
   [c01059ca] common_interrupt+0x2e/0x34
   [c0103390] ? mwait_idle_with_hints+0x40/0x50
   [c01033a0] ? mwait_idle+0x0/0x20
   [c01033b2] mwait_idle+0x12/0x20
   [c0103141] cpu_idle+0x61/0x110
   [c04339fd] rest_init+0x5d/0x60
   [c05a47fa] start_kernel+0x1fa/0x260
   [c05a4190] ? unknown_bootoption+0x0/0x130
   ===
  ---[ end trace 14b601818e6903ac ]---
  [ cut here ]
  WARNING: at net/ipv4/tcp_ipv4.c:197 tcp_verify_wq+0x1b6/0x1c0()
  Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event
  snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss eeprom e100 psmouse
  snd_hda_intel snd_pcm snd_timer btusb bluetooth serio_raw snd 3c59x sg
  evdev thermal soundcore rtc_cmos snd_page_alloc rtc_core rtc_lib
  i2c_i801 processor button intel_agp dcdbas pcspkr agpgart
  Pid: 0, comm: swapper Not tainted 2.6.24-rc8-mm1 #8
   [c0132100] ? have_callable_console+0x20/0x30
   [c0131844] warn_on_slowpath+0x54/0x80
   [c01317da] ? print_oops_end_marker+0x2a/0x30
   [c0131849] ? warn_on_slowpath+0x59/0x80
   [c03ffe54] ? tcp_print_queue+0x1a4/0x230
   [c0132438] ? vprintk+0x308/0x320
   [c0132438] ? vprintk+0x308/0x320
   [c0400096] tcp_verify_wq+0x1b6/0x1c0
   [c036] ? tcp_verify_wq+0x116/0x1c0
   [c03f5ffc] tcp_mark_head_lost+0xcc/0x150
   [c03f60ca] tcp_update_scoreboard+0x4a/0x190
   [c03f6e7a] tcp_fastretrans_alert+0x4da/0x700
   [c03f7e63] tcp_ack+0x1b3/0x3a0
   [c03fa21b] tcp_rcv_established+0x3eb/0x710
   [c0401c05] tcp_v4_do_rcv+0xe5/0x100
   [c04021fb] tcp_v4_rcv+0x5db/0x660
   [c0401fa7] ? tcp_v4_rcv+0x387/0x660
   [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
   [c03e5f44] ip_local_deliver_finish+0x84/0x1d0
   [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
   [c0156b97] ? __lock_release+0x47/0x70
   [c03e6147] ip_local_deliver+0xb7/0xc0
   [c03e6202] ip_rcv_finish+0xb2/0x3c0
   [c03c01d8] ? sock_def_readable+0x48/0xa0
   [c03be061] ? sock_queue_rcv_skb+0xb1/0x1a0
   [c03be0a7] ? sock_queue_rcv_skb+0xf7/0x1a0
   [c03e669f] ip_rcv+0x18f/0x290
   [c042fb10] ? packet_rcv_spkt+0xd0/0x130
   [c03c8da6] netif_receive_skb+0x2b6/0x330
   [c03c8c17] ? netif_receive_skb+0x127/0x330
   [c03c8ea3] ? process_backlog+0x83/0x100
   [c03c8eae] process_backlog+0x8e/0x100
   [c03c90bc] net_rx_action+0x13c/0x230
   

Re: [PATCH] SMC91x: don't flag spurious interrupts when polling

2008-01-24 Thread Nicolas Pitre
On Thu, 24 Jan 2008, Kevin Hilman wrote:

 When using polling, smc_poll_controller() can call smc_interrupt()
 when there are likely to be no real interrups.  This will trigger the
 spurious interrupt printk whenever the driver is being polled.
 
 This adds an 'is_polling' flags, and doesn't trigger the spurious
 warning when in polling mode.
 
 Signed-off-by: Kevin Hilman [EMAIL PROTECTED]
 Signed-off-by: Nicolas Pitre [EMAIL PROTECTED]

NAK

Kevin: you sent the wrong patch !


Nicolas
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] SMC91x: don't flag spurious interrupts when polling

2008-01-24 Thread Kevin Hilman
When using polling, smc_poll_controller() can call smc_interrupt()
when there are likely to be no real interrups.  This will trigger the
spurious interrupt printk whenever the driver is being polled.

This adds an 'is_polling' flags, and doesn't trigger the spurious
warning when in polling mode.

Signed-off-by: Kevin Hilman [EMAIL PROTECTED]
Signed-off-by: Nicolas Pitre [EMAIL PROTECTED]
---
 drivers/net/smc91x.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 7da7589..64ef6c1 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -1350,8 +1350,12 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
  */
 static void smc_poll_controller(struct net_device *dev)
 {
+   struct smc_local *lp = netdev_priv(dev);
+   void __iomem *ioaddr = lp-base;
+
disable_irq(dev-irq);
-   smc_interrupt(dev-irq, dev);
+   if (SMC_GET_INT()  SMC_GET_INT_MASK())
+   smc_interrupt(dev-irq, dev);
enable_irq(dev-irq);
 }
 #endif
-- 
1.5.3.7

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] phylib: Add Realtek 821x eth PHY support

2008-01-24 Thread Kim Phillips
this PHY present on the MPC8315E and MPC837xE RDB boards.

Signed-off-by: Johnson Leung [EMAIL PROTECTED]
Signed-off-by: Kevin Lam [EMAIL PROTECTED]
Signed-off-by: Joe D'Abbraccio [EMAIL PROTECTED]
Signed-off-by: Kim Phillips [EMAIL PROTECTED]
---
 drivers/net/phy/Kconfig   |5 +++
 drivers/net/phy/Makefile  |1 +
 drivers/net/phy/realtek.c |   80 +
 3 files changed, 86 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/phy/realtek.c

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 7fe03ce..f4ca059 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -60,6 +60,11 @@ config ICPLUS_PHY
---help---
  Currently supports the IP175C PHY.
 
+config REALTEK_PHY
+   tristate Drivers for Realtek PHYs
+   ---help---
+ Supports the Realtek 821x PHY.
+
 config FIXED_PHY
bool Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs
---help---
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index 3d6cc7b..5997d6e 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -12,5 +12,6 @@ obj-$(CONFIG_SMSC_PHY)+= smsc.o
 obj-$(CONFIG_VITESSE_PHY)  += vitesse.o
 obj-$(CONFIG_BROADCOM_PHY) += broadcom.o
 obj-$(CONFIG_ICPLUS_PHY)   += icplus.o
+obj-$(CONFIG_REALTEK_PHY)  += realtek.o
 obj-$(CONFIG_FIXED_PHY)+= fixed.o
 obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
new file mode 100644
index 000..a052a67
--- /dev/null
+++ b/drivers/net/phy/realtek.c
@@ -0,0 +1,80 @@
+/*
+ * drivers/net/phy/realtek.c
+ *
+ * Driver for Realtek PHYs
+ *
+ * Author: Johnson Leung [EMAIL PROTECTED]
+ *
+ * Copyright (c) 2004 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+#include linux/phy.h
+
+#define RTL821x_PHYSR  0x11
+#define RTL821x_PHYSR_DUPLEX   0x2000
+#define RTL821x_PHYSR_SPEED0xc000
+#define RTL821x_INER   0x12
+#define RTL821x_INER_INIT  0x6400
+#define RTL821x_INSR   0x13
+
+MODULE_DESCRIPTION(Realtek PHY driver);
+MODULE_AUTHOR(Johnson Leung);
+MODULE_LICENSE(GPL);
+
+static int rtl821x_ack_interrupt(struct phy_device *phydev)
+{
+   int err;
+
+   err = phy_read(phydev, RTL821x_INSR);
+
+   return (err  0) ? err : 0;
+}
+
+static int rtl821x_config_intr(struct phy_device *phydev)
+{
+   int err;
+
+   if (phydev-interrupts == PHY_INTERRUPT_ENABLED)
+   err = phy_write(phydev, RTL821x_INER,
+   RTL821x_INER_INIT);
+   else
+   err = phy_write(phydev, RTL821x_INER, 0);
+
+   return err;
+}
+
+/* RTL8211B */
+static struct phy_driver rtl821x_driver = {
+   .phy_id = 0x001cc912,
+   .name   = RTL821x Gigabit Ethernet,
+   .phy_id_mask= 0x001f,
+   .features   = PHY_GBIT_FEATURES,
+   .flags  = PHY_HAS_INTERRUPT,
+   .config_aneg= genphy_config_aneg,
+   .read_status= genphy_read_status,
+   .ack_interrupt  = rtl821x_ack_interrupt,
+   .config_intr= rtl821x_config_intr,
+   .driver = { .owner = THIS_MODULE,},
+};
+
+static int __init realtek_init(void)
+{
+   int ret;
+
+   ret = phy_driver_register(rtl821x_driver);
+
+   return ret;
+}
+
+static void __exit realtek_exit(void)
+{
+   phy_driver_unregister(rtl821x_driver);
+}
+
+module_init(realtek_init);
+module_exit(realtek_exit);
-- 
1.5.2.2

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2.6.25 1/1]S2io: Multiqueue network device support implementation

2008-01-24 Thread Ramkrishna Vepa
  [Ram] I am assuming that this is with regards to msi-x interrupts.
We
 
 Yes.
 
 And avoiding bouncing locks for device state between CPUs.
 
  have done away with handling tx completion in the interrupt handler,
and
  are instead handling them in the context of the transmit. The slow
path,
  straggling transmit completions will be handled in the timer
context.
 
 Ok -- hopefully you don't have bad corner cases from this when the
pipe
 is not fully filled and then causing longer latencies on completion.
 Old NAPI sometimes suffered from such problems.
[Ram] We have hit the driver pretty hard during testing and have not
encountered any problems either on the network or host.

Ram
 
 -Andi
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2.6.25 1/1]S2io: Multiqueue network device support implementation

2008-01-24 Thread Ramkrishna Vepa
 From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
 On Behalf Of David Miller
 Sent: Wednesday, January 23, 2008 11:30 PM
 
 From: Andi Kleen [EMAIL PROTECTED]
 Date: Thu, 24 Jan 2008 08:25:49 +0100
 
   have done away with handling tx completion in the interrupt
handler,
 and
   are instead handling them in the context of the transmit. The slow
 path,
   straggling transmit completions will be handled in the timer
context.
 
  Ok -- hopefully you don't have bad corner cases from this when the
pipe
  is not fully filled and then causing longer latencies on completion.
  Old NAPI sometimes suffered from such problems.
 
 BTW, such a TX completion timer will stall TCP sockets when the TX
 queue of the device is partially filled and then sending stops.
 
 TX ring SKB liberation really must be done in a very small finite
 amount of time in order to avoid this problem properly.
 
 Deferring it to HZ granular timers doesn't give a quick enough
 response, especially at high packet rates.
[Ram] We could add a lower granular tx completion interrupt instead, to
handle all the transmit fifos. But this will be a fall back in the event
the completions do not happen in the context of the transmit.

Ram
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] PS3: gelic: Add wireless support for PS3

2008-01-24 Thread John W. Linville
On Thu, Jan 24, 2008 at 08:49:45PM -0500, Dan Williams wrote:
 On Thu, 2008-01-24 at 14:51 +0900, Masakazu Mokuno wrote:
  Hi
  
  PS3: gelic: Add wireless support for PS3
  
  This is the version 2 of the re-worked (rewritten) version of the
  wireless support driver for PS3.  The version 1 of the new driver was
  submitted on 13th Dec. 2007 (and the old one was submitted to net-dev ML
  in June 2007).
  
  Major differences with the old driver are:
- The new driver has a separate ethX interface from ethernet.
  They share the same MAC address.
- Thus we can use both ethernet and wireless simultaenously.
- The new driver returns AP's cipher information by the common IE
  format in the scan information.
- Cipher selection is done via the common wireless extension way
 
 Looks like all my issues have been addressed.  Thanks!  Lets get this in
 2.6.25 :)
 
 Acked-by: Dan Williams [EMAIL PROTECTED]

ACK -- please merge it with the other patches through the powerpc tree.

Thanks,

John
-- 
John W. Linville
[EMAIL PROTECTED]
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/26] atl1: refactor tx processing

2008-01-24 Thread Jeff Garzik

Jay Cliburn wrote:

On Tue, 22 Jan 2008 18:31:09 -0600
Jay Cliburn [EMAIL PROTECTED] wrote:


On Tue, 22 Jan 2008 04:58:17 -0500
Jeff Garzik [EMAIL PROTECTED] wrote:


[...]

for such a huge patch, this description is very tiny.  [describe]
what is refactored, and why.


Is this one any better?




From df475e2eea401f9dc18ca23dab538b99fb9e710c Mon Sep 17 00:00:00 2001

From: Jay Cliburn [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 21:36:36 -0600
Subject: [PATCH] atl1: simplify tx packet descriptor

The transmit packet descriptor consists of four 32-bit words, with word 3
upper bits overloaded depending upon the condition of its bits 3 and 4.
The driver currently duplicates all word 2 and some word 3 register bit
definitions unnecessarily and also uses a set of nested structures in its
definition of the TPD without good cause. This patch adds a lengthy
comment describing the TPD, eliminates duplicate TPD bit definitions,
and simplifies the TPD structure itself. It also expands the TSO check
to correctly handle custom checksum versus TSO processing using the revised
TPD definitions. Finally, shorten some variable names in the transmit
processing path to reduce line lengths, rename some variables to better
describe their purpose (e.g., nseg versus m), and add a comment or two
to better describe what the code is doing.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---
 drivers/net/atlx/atl1.c |  265 +--
 drivers/net/atlx/atl1.h |  201 +++-
 2 files changed, 246 insertions(+), 220 deletions(-)


Yep, better.

Jeff



--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] PS3: gelic: Add wireless support for PS3

2008-01-24 Thread Masakazu Mokuno

On Thu, 24 Jan 2008 21:47:25 -0500
John W. Linville [EMAIL PROTECTED] wrote:

 On Thu, Jan 24, 2008 at 08:49:45PM -0500, Dan Williams wrote:
  On Thu, 2008-01-24 at 14:51 +0900, Masakazu Mokuno wrote:
   Hi
   
   PS3: gelic: Add wireless support for PS3
   
   This is the version 2 of the re-worked (rewritten) version of the
   wireless support driver for PS3.  The version 1 of the new driver was
   submitted on 13th Dec. 2007 (and the old one was submitted to net-dev ML
   in June 2007).
   
   Major differences with the old driver are:
 - The new driver has a separate ethX interface from ethernet.
   They share the same MAC address.
 - Thus we can use both ethernet and wireless simultaenously.
 - The new driver returns AP's cipher information by the common IE
   format in the scan information.
 - Cipher selection is done via the common wireless extension way
  
  Looks like all my issues have been addressed.  Thanks!  Lets get this in
  2.6.25 :)
  
  Acked-by: Dan Williams [EMAIL PROTECTED]
 
 ACK -- please merge it with the other patches through the powerpc tree.
 
 Thanks,
 
 John

Thank you, John, Dan.

I'll ask Paul to merge this if the wired part of dependent gelic patches
gets acked from network people.


-- 
Masakazu MOKUNO

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH UCC TDM 3/3 ] Modified Documentation to explain dtsentries for TDM driver

2008-01-24 Thread Aggrwal Poonam
Hi Scott

The device tree already has a brg-frequency  property in qe node which
is the value of BRGCLK. The function get_brg_clk uses this property to
find the value of BRGCLK.
In case this value is 0(some older u-boots populate bus-frequency
property of qe and not the brg-frequency), get_brg_clk  uses
bus-frequency/2 as BRGCLK.


With Regards
Poonam 
 
 

-Original Message-
From: Wood Scott 
Sent: Friday, January 25, 2008 1:42 AM
To: Aggrwal Poonam
Cc: Gala Kumar; [EMAIL PROTECTED]; [EMAIL PROTECTED];
netdev@vger.kernel.org; [EMAIL PROTECTED]; [EMAIL PROTECTED];
Barkowski Michael; Cutler Richard; Tabi Timur; Kalra Ashish
Subject: Re: [PATCH UCC TDM 3/3 ] Modified Documentation to explain
dtsentries for TDM driver

On Thu, Jan 24, 2008 at 10:24:13AM +0530, Poonam_Aggrwal-b10812 wrote:
 +  ix) Baud Rate Generator (BRG)
 +
 +  Required properties:
 +  - compatible : shpuld be fsl,cpm-brg
 +  - fsl,brg-sources : define the input clock for all 16 BRGs. The
input
 +clock source could be 1 to 24 for CLK1 to CLK24. Zero means that
the
 +particular BRG will be driven by QE clock(BRGCLK).

Should also have a clock-frequency property to specify what BRGCLK is.

-Scott
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pull request: wireless-2.6 'upstream' 2008-01-24

2008-01-24 Thread John W. Linville
On Thu, Jan 24, 2008 at 02:53:43PM -0500, John W. Linville wrote:

 The cfg80211 API change breaks ath5k, so I have listed it as depends
 on BROKEN.  I am assured that the ath5k team has agreed to fix
 this ASAP.  Meanwhile we wanted to have it in place so that we can
 start shaking-out problems with other drivers.

Looks like this might have broken more than I expected, and there
may be some refactoring of the wireless rndis bits too.  So, let's
hold off on this request.  I'll post a new one in the next day or so.

Thanks,

John
-- 
John W. Linville
[EMAIL PROTECTED]
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM driver for MPC8323eRDB. Also includes related QE changes and dts entries.

2008-01-24 Thread Aggrwal Poonam
Hello Anton/Tabi

I am not sure which is the best place to configure the pins. Because
some drivers do it in one way and some in the other.
I actually tried to make the driver similar to ucc_geth because it is a
QE driver. The driver has no platform code in the platform files similar
to ucc_geth. It is probed along with all the QE devices thorugh
of_platform_bus_probe.
And the pins are configured for all the QE devices using  par_io_init.
I thought this to be the most consistent way at that time.

How should we close this point?
Can we go ahead with the pio-map?

Infact the discussion in this thread was very good and I got to know a
lot of rationales behind this.

Please suggest.

Thanks and Regards
Poonam

From: Anton Vorontsov [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 24, 2008 10:53 PM
To: Tabi Timur
Cc: Aggrwal Poonam; Gala Kumar; [EMAIL PROTECTED];
[EMAIL PROTECTED]; netdev@vger.kernel.org;
[EMAIL PROTECTED]; [EMAIL PROTECTED]; Barkowski Michael;
Cutler Richard; Kalra Ashish
Subject: Re: [PATCH UCC TDM 1/3 Updated] Platform changes for UCC TDM
driver for MPC8323eRDB. Also includes related QE changes and dts
entries.

On Thu, Jan 24, 2008 at 10:33:47AM -0600, Timur Tabi wrote:
 Anton Vorontsov wrote:
 
 Are you saying that TDM is sharing same pins with the other QE 
 device, and we can choose to use/not use some device depending on 
 which driver is loaded?
 
 No.  I'd have to closely examine the DTS, but I don't think that UCC 
 devices share pins at all.  But that isn't my point.
 
 In that particular case UCC configuration is static, for every UCC.
 So, we can set up all pins in the firmware/board file.
 
 Yes, but deciding what the UCC does might not be static.  At what 
 point do we declare, UCC5 is for eth0 and eth0 only?
 
 The advantage of putting the pin configurations in the device tree is 
 that they now become configurable.  I can envision a scenario where 
 UCC5 could be either an Ethernet or a UART, depending on the setting 
 of some jumpers on the board. That's what the QE was designed for: any

 UCC can do any task, and you can even have a UCC change its purpose
while the system is running.
 So I don't want the pin configurations hard-coded into the kernel.  
 Having them in the device tree gives me some flexibility.

If hardware configuration is selected at the bootup time, by jumpers or
switches, it's even easier to do it right. Without pio-map.

 For instance, I have a plan (that I keep postponing) to introduce a 
 new feature in U-Boot where U-Boot can determine the settings of some 
 board jumpers and modify the device tree accordingly. The instructions

 on how to modify the device tree would be embedded in the tree itself.

Why you need to modify the device tree for that? Let the U-Boot simply
setup pins for the kernel. Regarding kernel overwriting pins
configuration...

 I can't
 support this feature if the kernel calls par_io_config_pin() 
 regardless of what's in the device tree.

What I've understood from the previous debates, is that ideally kernel
should not touch pins' configuration. Today we're using pio-map solely
to fix up some old firmware misconfiguration. And we can do this in the
board file still. To determine if we need to fixup the firmware or not,
we can use some device tree property instead (firmware version?).

p.s.
I'm neither for pio-map nor against. I just want some consequence
regarding this. Last thread ended with consequence that pio-map is a bad
thing to use...

--
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: pull request: wireless-2.6 'upstream' 2008-01-24

2008-01-24 Thread David Miller
From: John W. Linville [EMAIL PROTECTED]
Date: Thu, 24 Jan 2008 22:57:51 -0500

 On Thu, Jan 24, 2008 at 02:53:43PM -0500, John W. Linville wrote:
 
  The cfg80211 API change breaks ath5k, so I have listed it as depends
  on BROKEN.  I am assured that the ath5k team has agreed to fix
  this ASAP.  Meanwhile we wanted to have it in place so that we can
  start shaking-out problems with other drivers.
 
 Looks like this might have broken more than I expected, and there
 may be some refactoring of the wireless rndis bits too.  So, let's
 hold off on this request.  I'll post a new one in the next day or so.

Ok.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: bluetooth : lockdep warning on rfcomm

2008-01-24 Thread Dave Young
On Jan 24, 2008 5:25 PM, Dave Young [EMAIL PROTECTED] wrote:

 On Jan 24, 2008 11:02 AM, Dave Young [EMAIL PROTECTED] wrote:
  =
  [ INFO: possible recursive locking detected ]
  2.6.24-rc8-mm1 #8
  -
  bluepush/3213 is trying to acquire lock:
   (sk_lock-AF_BLUETOOTH){--..}, at: [f8978c80]
  l2cap_sock_bind+0x40/0x100 [l2cap]
 
  but task is already holding lock:
   (sk_lock-AF_BLUETOOTH){--..}, at: [f894a31e]
  rfcomm_sock_connect+0x3e/0xe0 [rfcomm]
 
  other info that might help us debug this:
  2 locks held by bluepush/3213:
   #0:  (sk_lock-AF_BLUETOOTH){--..}, at: [f894a31e]
  rfcomm_sock_connect+0x3e/0xe0 [rfcomm]
   #1:  (rfcomm_mutex){--..}, at: [f8947556] rfcomm_dlc_open+0x26/0x60 
  [rfcomm]
 
  stack backtrace:
  Pid: 3213, comm: bluepush Not tainted 2.6.24-rc8-mm1 #8
   [c0132128] ? printk+0x18/0x20
   [c0154437] print_deadlock_bug+0xc7/0xe0
   [c01544bc] check_deadlock+0x6c/0x80
   [c01548fc] validate_chain+0x14c/0x320
   [c0156221] __lock_acquire+0x1c1/0x730
   [c0156d89] lock_acquire+0x79/0xb0
   [f8978c80] ? l2cap_sock_bind+0x40/0x100 [l2cap]
   [c03c05f5] lock_sock_nested+0x55/0x70
   [f8978c80] ? l2cap_sock_bind+0x40/0x100 [l2cap]
   [f8978c80] l2cap_sock_bind+0x40/0x100 [l2cap]
   [c03bdb4a] kernel_bind+0xa/0x10
   [f8947afc] rfcomm_session_create+0x4c/0x110 [rfcomm]
   [f8947509] __rfcomm_dlc_open+0x129/0x150 [rfcomm]
   [f8947568] rfcomm_dlc_open+0x38/0x60 [rfcomm]
   [f894a396] rfcomm_sock_connect+0xb6/0xe0 [rfcomm]
   [c03bcd39] sys_connect+0x99/0xd0
   [c010f509] ? cache_add_dev+0x39/0x1a0
   [c015323d] ? put_lock_stats+0xd/0x30
   [c01532c0] ? lock_release_holdtime+0x60/0x80
   [c018e86c] ? fget+0x7c/0x100
   [c0156b97] ? __lock_release+0x47/0x70
   [c018e86c] ? fget+0x7c/0x100
   [c02611b7] ? copy_from_user+0x37/0x70
   [c03bd855] sys_socketcall+0xa5/0x230
   [c0155659] ? trace_hardirqs_on+0xb9/0x130
   [c010501b] ? restore_nocheck+0x12/0x15
 

 While fixing this issue, another locking dependency confused me. Are
 rfcomm_dev_lock and d-lock in same lock class?

 The warnings as following:

 ===
 [ INFO: possible circular locking dependency detected ]
 2.6.24-rc8-mm1 #8
 ---
 krfcommd/2912 is trying to acquire lock:
  (rfcomm_dev_lock){-.--}, at: [f89d5bf2]
 rfcomm_dev_state_change+0x92/0x160 [rfcomm]

 but task is already holding lock:
  (d-lock){--..}, at: [f89d15d3] __rfcomm_dlc_close+0x43/0xd0 [rfcomm]

 which lock already depends on the new lock.

Answer to myself, the reason is that lockdep think this as a lock order problem.

in rfcomm_device_add the lock order is :
rfcomm_dev_lock -- dlc lock
but in __rfcomm_dlc_close is :
dlc lock -- rfcomm_dev_lock (- state_change-rfcomm_dev_get)



 the existing dependency chain (in reverse order) is:

 - #1 (d-lock){--..}:
[c0153b13] add_lock_to_list+0x33/0x70
[c01545a3] check_prev_add+0xd3/0x200
[f89d5311] rfcomm_dev_add+0x191/0x300 [rfcomm]
[c0154765] check_prevs_add+0x95/0xe0
[c01549ef] validate_chain+0x23f/0x320
[c0156221] __lock_acquire+0x1c1/0x730
[c0155539] mark_held_locks+0x39/0x80
[c0156d89] lock_acquire+0x79/0xb0
[f89d5311] rfcomm_dev_add+0x191/0x300 [rfcomm]
[c0436749] _spin_lock+0x39/0x80
[f89d5311] rfcomm_dev_add+0x191/0x300 [rfcomm]
[f89d5b10] rfcomm_dev_data_ready+0x0/0x50 [rfcomm]
[f89d5311] rfcomm_dev_add+0x191/0x300 [rfcomm]
[f89d565e] rfcomm_create_dev+0x6e/0x100 [rfcomm]
[c03c05fa] lock_sock_nested+0x5a/0x70
[f89d5ae3] rfcomm_dev_ioctl+0x33/0x60 [rfcomm]
[f89d4c8c] rfcomm_sock_ioctl+0x2c/0x50 [rfcomm]
[c03bc001] sock_ioctl+0xc1/0x220
[c03bbf40] sock_ioctl+0x0/0x220
[c019a366] vfs_ioctl+0x76/0x90
[c019a616] do_vfs_ioctl+0x56/0x140
[c019a762] sys_ioctl+0x62/0x70
[c0104fba] syscall_call+0x7/0xb
[] 0x

 - #0 (rfcomm_dev_lock){-.--}:
[c0154504] check_prev_add+0x34/0x200
[c012a9ab] default_wake_function+0xb/0x10
[c0154765] check_prevs_add+0x95/0xe0
[c01549ef] validate_chain+0x23f/0x320
[c0156221] __lock_acquire+0x1c1/0x730
[c0156d89] lock_acquire+0x79/0xb0
[f89d5bf2] rfcomm_dev_state_change+0x92/0x160 [rfcomm]
[c04361e9] _read_lock+0x39/0x80
[f89d5bf2] rfcomm_dev_state_change+0x92/0x160 [rfcomm]
[f89d5bf2] rfcomm_dev_state_change+0x92/0x160 [rfcomm]
[f89d15e8] __rfcomm_dlc_close+0x58/0xd0 [rfcomm]
[f89d2523] rfcomm_recv_ua+0x73/0x140 [rfcomm]
[f89d3151] rfcomm_recv_frame+0x171/0x1e0 [rfcomm]
[c0155659] trace_hardirqs_on+0xb9/0x130
[c0436a39] _spin_unlock_irqrestore+0x39/0x70
[f89d3447] rfcomm_run+0xe7/0x590 [rfcomm]
[c012] hpet_legacy_next_event+0x20/0x50
[f89d3360] 

[PATCH] SMC91x: poll_controller(): check for interrupts before calling handler

2008-01-24 Thread Kevin Hilman
When using polling, smc_poll_controller() can call smc_interrupt()
when there are likely to be no real interrups.  This will trigger the
spurious interrupt printk whenever the driver is being polled.

Instead, check for actual interrupts before calling smc_interrupt()

Signed-off-by: Kevin Hilman [EMAIL PROTECTED]
Signed-off-by: Nicolas Pitre [EMAIL PROTECTED]
---
 drivers/net/smc91x.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 7da7589..64ef6c1 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -1350,8 +1350,12 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
  */
 static void smc_poll_controller(struct net_device *dev)
 {
+   struct smc_local *lp = netdev_priv(dev);
+   void __iomem *ioaddr = lp-base;
+
disable_irq(dev-irq);
-   smc_interrupt(dev-irq, dev);
+   if (SMC_GET_INT()  SMC_GET_INT_MASK())
+   smc_interrupt(dev-irq, dev);
enable_irq(dev-irq);
 }
 #endif
-- 
1.5.3.7

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html