Re: [PATCH 1/4] rcu_assign_pointer: null check fix

2008-02-13 Thread Jarek Poplawski
On 13-02-2008 01:50, Stephen Hemminger wrote:
...
 --- a/include/linux/rcupdate.h2008-02-12 14:46:49.0 -0800
 +++ b/include/linux/rcupdate.h2008-02-12 14:56:17.0 -0800
 @@ -178,7 +178,7 @@ struct rcu_head {
  
  #define rcu_assign_pointer(p, v) \
   ({  \
 - if (!(__builtin_constant_p(v)  v))\
 + if (!__builtin_constant_p(v) || v)  \

Isn't it a bit safer with this Paul's version yet?:

 +  if (!__builtin_constant_p(v) || (v))\

Jarek P.
--
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] [IPROUTE2] Update various classifiers' help output for expected CLASSID syntax

2008-02-13 Thread Jarek Poplawski
On 12-02-2008 22:51, PJ Waskiewicz wrote:
 This updates the help output to specify that CLASSID should be hexidecimal.
...
 + fprintf(stderr, \nNOTE: CLASSID is parsed as hexidecimal input.\n);

s/hexidecimal/hexadecimal/g (?)

Regards,
Jarek P.
--
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: BUG: 2.6.25-rc1: iptables postrouting setup causes oops

2008-02-13 Thread Andrew Morton
On Tue, 12 Feb 2008 22:46:01 +1100 Ben Nizette [EMAIL PROTECTED] wrote:

 
 On an AVR32, root over NFS, config attached, running (from a startup
 script):
 
 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
 
 Results in (dmesg extract including a bit of context for good measure):
 -8
 VFS: Mounted root (nfs filesystem).
 Freeing init memory: 72K (9000 - 90012000)
 eth0: no IPv6 routers present
 warning: `dnsmasq' uses 32-bit capabilities (legacy support in use)
 ip_tables: (C) 2000-2006 Netfilter Core Team
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
 Unable to handle kernel paging request at virtual address d76a7138
 ptbr = 91d3b000 pgd = e5f3 pte = 00014370
 Oops: Kernel access of bad area, sig: 11 [#1]
 FRAME_POINTER chip: 0x01f:0x1e82 rev 2
 Modules linked in: nf_conntrack_ipv4(+) nf_conntrack ip_tables
 PC is at kmem_cache_alloc+0x2c/0x54
 LR is at nf_conntrack_l4proto_register+0x34/0x9c [nf_conntrack]

I take it that the above means that the crash is in kmem_cache_alloc()?

 pc : [9004fa78]lr : [c08537d8]Not tainted
 sp : 91eb5e9c  r12: 901cc588  r11: 00d0
 r10: 901e03a0  r9 : 0002  r8 : 91d33800
 r7 : 91eb5e9c  r6 : 901d9138  r5 : 901cc588  r4 : 0007a008
 r3 : 00d0  r2 : 0045  r1 : c085f9c0  r0 : c08c1424
 Flags: qvNzc
 Mode bits: hjmdeG
 CPU Mode: Supervisor
 Process: insmod [250] (task: 91d789c0 thread: 91eb4000)
 Stack: (0x91eb5e9c to 0x91eb6000)
 5e80:c08537d8
 5ea0: 91eb5ec0 c085a6b4  0007a008 fff0 0027 c085f9c0 c08c1424
 5ec0: c0861024 91eb5ee4  c085f654 0007a008 901d31b0 0027 c085f9c0
 5ee0: c08c1424 900358d4 91eb5f94 91d6ddf0 901d31b8 0007a008 91eb5f08 0007a008
 5f00:        
 5f20: 000c    0007 c08df440 91d1c660 c08c19ec
 5f40: c08c16a4 c0881000  00b2 00b2 c085e17c 90022414 0027
 5f60: c08c12c3 c08c1424 c08c1a3c c08c1a14 0027 0025 0006 2ab17000
 5f80: 90047080 91eb5f94 91eb4000  c087ef80 90012132  00072e14
 5fa0: 535e 0007a008 00072858 7f89ff73 8000 91eb4000 0001 2aae23ec
 5fc0: 7f89fd98 7f89fd88 2ab17008 0005edf5 0007a008 0005edf5 0073 7f89fedc
 5fe0: 00072e14 535e 0007a008 00072858 7f89ff73 0002 00059538 2ab17008
 Call trace:
  [c08537d8] nf_conntrack_l4proto_register+0x34/0x9c [nf_conntrack]
  [c0861024] nf_conntrack_l3proto_ipv4_init+0x24/0x108 [nf_conntrack_ipv4]
  [900358d4] sys_init_module+0xf78/0x1028
  [90012132] syscall_return+0x0/0x12
 
 iptable_nat: gave up waiting for init of module nf_conntrack_ipv4.
 iptable_nat: Unknown symbol need_ipv4_conntrack
 8-
 
 iptables version 1.3.8

If so, the bug could be almost anywhere - in slab, or in some random piece
of code which scribbles on slab's data structures.

 Perfectly repeatable.

If my theory is correct, changing pretty much anything in the kernel config
might just make it go away.  But still, it would be most valuable if you
could try running a bisection search, as described in
http://www.kernel.org/doc/local/git-quick.html, 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


Re: RESEND, HTB(?) softlockup, vanilla 2.6.24

2008-02-13 Thread Jarek Poplawski
On 13-02-2008 09:13, Denys Fedoryshchenko wrote:
 It is very difficult to reproduce, happened after running about 1month. No 
 changes done in classes at time of crash.
 
 Kernel 2.6.24 vanilla
 
 I will try to attach also .config
 

Hi Denys,

This report looks very interesting. I don't know how others, but I
plan to study it more soon (on the weekend?), then maybe more
questions. Of course some exemplary tc rules should be helpful.

Thanks,
Jarek P.
--
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: BUG: 2.6.25-rc1: iptables postrouting setup causes oops

2008-02-13 Thread Haavard Skinnemoen
On Wed, 13 Feb 2008 00:48:29 -0800
Andrew Morton [EMAIL PROTECTED] wrote:

 On Tue, 12 Feb 2008 22:46:01 +1100 Ben Nizette [EMAIL PROTECTED] wrote:
 
  
  On an AVR32, root over NFS, config attached, running (from a startup
  script):
  
  iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  
  Results in (dmesg extract including a bit of context for good measure):
  -8
  VFS: Mounted root (nfs filesystem).
  Freeing init memory: 72K (9000 - 90012000)
  eth0: no IPv6 routers present
  warning: `dnsmasq' uses 32-bit capabilities (legacy support in use)

Hmm. What does that mean? What size do capabilities normally have?

  ip_tables: (C) 2000-2006 Netfilter Core Team
  nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
  Unable to handle kernel paging request at virtual address d76a7138
  ptbr = 91d3b000 pgd = e5f3 pte = 00014370

Hmm. It actually found something in the pte? Looks like a swap
entry...but that doesn't make sense at that virtual address. Userspace
is below 0x8000.

  Oops: Kernel access of bad area, sig: 11 [#1]
  FRAME_POINTER chip: 0x01f:0x1e82 rev 2
  Modules linked in: nf_conntrack_ipv4(+) nf_conntrack ip_tables
  PC is at kmem_cache_alloc+0x2c/0x54
  LR is at nf_conntrack_l4proto_register+0x34/0x9c [nf_conntrack]
 
 I take it that the above means that the crash is in kmem_cache_alloc()?

That's correct.

 If so, the bug could be almost anywhere - in slab, or in some random piece
 of code which scribbles on slab's data structures.

Yes, it looks like memory corruption, especially since the page table
appears to be corrupted as well. But I'll have a look and see if the
code that dumps the pte is doing something bogus...

  Perfectly repeatable.
 
 If my theory is correct, changing pretty much anything in the kernel config
 might just make it go away.  But still, it would be most valuable if you
 could try running a bisection search, as described in
 http://www.kernel.org/doc/local/git-quick.html, thanks.

Yes, that would be very valuable.

Haavard
--
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] [IPV6]: Fix hardcoded removing of old module code

2008-02-13 Thread Wang Chen
Rusty hardcoded the old module code.
We can remove it now.

Signed-off-by: Wang Chen [EMAIL PROTECTED]
---
 net/ipv6/af_inet6.c |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index bddac0e..f0aa977 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -752,14 +752,6 @@ static int __init inet6_init(void)
 
BUILD_BUG_ON(sizeof(struct inet6_skb_parm)  sizeof(dummy_skb-cb));
 
-#ifdef MODULE
-#if 0 /* FIXME --RR */
-   if (!mod_member_present(__this_module, can_unload))
- return -EINVAL;
-
-   __this_module.can_unload = ipv6_unload;
-#endif
-#endif
err = proto_register(tcpv6_prot, 1);
if (err)
goto out;
-- WCN

--
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: BUG: 2.6.25-rc1: iptables postrouting setup causes oops

2008-02-13 Thread Andrew Morton
On Wed, 13 Feb 2008 10:10:24 +0100 Haavard Skinnemoen [EMAIL PROTECTED] wrote:

 On Wed, 13 Feb 2008 00:48:29 -0800
 Andrew Morton [EMAIL PROTECTED] wrote:
 
  On Tue, 12 Feb 2008 22:46:01 +1100 Ben Nizette [EMAIL PROTECTED] wrote:
  
   
   On an AVR32, root over NFS, config attached, running (from a startup
   script):
   
   iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
   
   Results in (dmesg extract including a bit of context for good measure):
   -8
   VFS: Mounted root (nfs filesystem).
   Freeing init memory: 72K (9000 - 90012000)
   eth0: no IPv6 routers present
   warning: `dnsmasq' uses 32-bit capabilities (legacy support in use)
 
 Hmm. What does that mean? What size do capabilities normally have?

My near-namesake put than in, but I immediately forgot what it means?
--
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: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Diego Guella

One question below


- Original Message - 
From: Roland Dreier [EMAIL PROTECTED]

To: Steve Wise [EMAIL PROTECTED]
Cc: netdev@vger.kernel.org; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, February 13, 2008 1:26 AM
Subject: Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.



applied, although:

 +static void is_loopback_dst(struct iw_cm_id *cm_id)
 +{
 + struct net_device *dev;
 + 
 + dev = ip_dev_find(init_net, cm_id-remote_addr.sin_addr.s_addr);

 + if (!dev)
 + return 0;


how can a static void function return 0?
%)


 + dev_put(dev);
 + return 1;


same here


--
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] [IRDA] irda_init() nuke useless debug printk

2008-02-13 Thread maximilian attems
On Tue, 12 Feb 2008, David Miller wrote:

 From: maximilian attems [EMAIL PROTECTED]
 Date: Tue, 12 Feb 2008 11:30:47 +0100
 
  irda_init()
  dmesg line is not really informative, thus remove it.
  There are better ways to know that a module is loaded.
  
  Seen on a debian config with IRDA_DEBUG enabled.
  
  Signed-off-by: maximilian attems [EMAIL PROTECTED]
 
 Well if you look at how IRDA_DEBUG is predominantly used,
 it's a function tracer, and that's exactly how it's being
 used here.
 
 Either we decide that this is OK and leave it there, or
 we start moving the whole IRDA tree over to not do this.
 Not something in between.

ack, happy with both.
i could also lower the visibility of that one.

it simply struck out on my sfuzz test runs, had this
dmesg line instead of usual stuff:
-- snipp
NET: Registered protocol family 9
X.25 for Linux Version 0.2
Bridge firewalling registered
PPP generic driver version 2.4.2
NET: Registered protocol family 24
Sangoma WANPIPE Router v1.1 (c) 1995-2000 Sangoma Technologies Inc.
NET: Registered protocol family 4
NET4: DECnet for Linux: V.2.5.68s (C) 1995-2003 Linux DECnet Project Team
DECnet: Routing cache hash table of 1024 buckets, 16Kbytes
NET: Registered protocol family 12
Bluetooth: Core ver 2.11
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
NET: Registered protocol family 15
NET: Registered protocol family 5
irda_init()
NET: Registered protocol family 23
--
--
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/2][NETLABEL]: Move some initialization code into __init section.

2008-02-13 Thread Pavel Emelyanov
Everything that is called from netlbl_init() can be marked with
__init. This moves 620 bytes from .text section to .text.init one.

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

---
 net/netlabel/netlabel_cipso_v4.c   |2 +-
 net/netlabel/netlabel_domainhash.c |2 +-
 net/netlabel/netlabel_mgmt.c   |2 +-
 net/netlabel/netlabel_unlabeled.c  |6 +++---
 net/netlabel/netlabel_user.c   |2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c
index 283ff4a..fdc14a0 100644
--- a/net/netlabel/netlabel_cipso_v4.c
+++ b/net/netlabel/netlabel_cipso_v4.c
@@ -761,7 +761,7 @@ static struct genl_ops netlbl_cipsov4_ops[] = {
  * mechanism.  Returns zero on success, negative values on failure.
  *
  */
-int netlbl_cipsov4_genl_init(void)
+int __init netlbl_cipsov4_genl_init(void)
 {
int ret_val, i;
 
diff --git a/net/netlabel/netlabel_domainhash.c 
b/net/netlabel/netlabel_domainhash.c
index fd46231..02c2f7c 100644
--- a/net/netlabel/netlabel_domainhash.c
+++ b/net/netlabel/netlabel_domainhash.c
@@ -171,7 +171,7 @@ static struct netlbl_dom_map 
*netlbl_domhsh_search_def(const char *domain)
  * values on error.
  *
  */
-int netlbl_domhsh_init(u32 size)
+int __init netlbl_domhsh_init(u32 size)
 {
u32 iter;
struct netlbl_domhsh_tbl *hsh_tbl;
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
index 05d9886..22c1912 100644
--- a/net/netlabel/netlabel_mgmt.c
+++ b/net/netlabel/netlabel_mgmt.c
@@ -588,7 +588,7 @@ static struct genl_ops netlbl_mgmt_genl_ops[] = {
  * mechanism.  Returns zero on success, negative values on failure.
  *
  */
-int netlbl_mgmt_genl_init(void)
+int __init netlbl_mgmt_genl_init(void)
 {
int ret_val, i;
 
diff --git a/net/netlabel/netlabel_unlabeled.c 
b/net/netlabel/netlabel_unlabeled.c
index f0f1322..4478f2f 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -1624,7 +1624,7 @@ static struct genl_ops netlbl_unlabel_genl_ops[] = {
  * mechanism.  Returns zero on success, negative values on failure.
  *
  */
-int netlbl_unlabel_genl_init(void)
+int __init netlbl_unlabel_genl_init(void)
 {
int ret_val, i;
 
@@ -1661,7 +1661,7 @@ static struct notifier_block 
netlbl_unlhsh_netdev_notifier = {
  * non-zero values on error.
  *
  */
-int netlbl_unlabel_init(u32 size)
+int __init netlbl_unlabel_init(u32 size)
 {
u32 iter;
struct netlbl_unlhsh_tbl *hsh_tbl;
@@ -1765,7 +1765,7 @@ unlabel_getattr_nolabel:
  * and to send unlabeled network traffic by default.
  *
  */
-int netlbl_unlabel_defconf(void)
+int __init netlbl_unlabel_defconf(void)
 {
int ret_val;
struct netlbl_dom_map *entry;
diff --git a/net/netlabel/netlabel_user.c b/net/netlabel/netlabel_user.c
index 023fc8f..b17d420 100644
--- a/net/netlabel/netlabel_user.c
+++ b/net/netlabel/netlabel_user.c
@@ -59,7 +59,7 @@
  * non-zero on failure.
  *
  */
-int netlbl_netlink_init(void)
+int __init netlbl_netlink_init(void)
 {
int ret_val;
 
-- 
1.5.3.4

--
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: BUG: 2.6.25-rc1: iptables postrouting setup causes oops

2008-02-13 Thread Haavard Skinnemoen
On Wed, 13 Feb 2008 10:10:24 +0100
Haavard Skinnemoen [EMAIL PROTECTED] wrote:

   ip_tables: (C) 2000-2006 Netfilter Core Team
   nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
   Unable to handle kernel paging request at virtual address d76a7138
   ptbr = 91d3b000 pgd = e5f3 pte = 00014370  
 
 Hmm. It actually found something in the pte? Looks like a swap
 entry...but that doesn't make sense at that virtual address. Userspace
 is below 0x8000.

(...)

  If so, the bug could be almost anywhere - in slab, or in some random piece
  of code which scribbles on slab's data structures.  
 
 Yes, it looks like memory corruption, especially since the page table
 appears to be corrupted as well. But I'll have a look and see if the
 code that dumps the pte is doing something bogus...

Yes, that code is indeed buggy. The below patch should fix it, although
the page tables probably won't contain anything interesting, and it
could still be a memory corruption issue. And it definitely won't fix
the real issue.

I have a couple of patches that will eliminate the need for this fixup
(and probably improve performance as well), but they are probably 2.6.26
material.

Haavard

diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c
index 6560cb1..ce4e429 100644
--- a/arch/avr32/mm/fault.c
+++ b/arch/avr32/mm/fault.c
@@ -189,6 +189,8 @@ no_context:
 
page = sysreg_read(PTBR);
printk(KERN_ALERT ptbr = %08lx, page);
+   if (address = TASK_SIZE)
+   page = (unsigned long)swapper_pg_dir;
if (page) {
page = ((unsigned long *)page)[address  22];
printk( pgd = %08lx, page);
--
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/2][NETLABEL]: Shrink the genl-ops registration code.

2008-02-13 Thread Pavel Emelyanov
Turning them to array and registration in a loop saves
80 lines of code and ~300 bytes from text section.

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

---
 net/netlabel/netlabel_cipso_v4.c  |   43 +++
 net/netlabel/netlabel_mgmt.c  |   79 ++---
 net/netlabel/netlabel_unlabeled.c |   86 ++--
 3 files changed, 64 insertions(+), 144 deletions(-)

diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c
index c7ad64d..283ff4a 100644
--- a/net/netlabel/netlabel_cipso_v4.c
+++ b/net/netlabel/netlabel_cipso_v4.c
@@ -718,36 +718,35 @@ static int netlbl_cipsov4_remove(struct sk_buff *skb, 
struct genl_info *info)
  * NetLabel Generic NETLINK Command Definitions
  */
 
-static struct genl_ops netlbl_cipsov4_genl_c_add = {
+static struct genl_ops netlbl_cipsov4_ops[] = {
+   {
.cmd = NLBL_CIPSOV4_C_ADD,
.flags = GENL_ADMIN_PERM,
.policy = netlbl_cipsov4_genl_policy,
.doit = netlbl_cipsov4_add,
.dumpit = NULL,
-};
-
-static struct genl_ops netlbl_cipsov4_genl_c_remove = {
+   },
+   {
.cmd = NLBL_CIPSOV4_C_REMOVE,
.flags = GENL_ADMIN_PERM,
.policy = netlbl_cipsov4_genl_policy,
.doit = netlbl_cipsov4_remove,
.dumpit = NULL,
-};
-
-static struct genl_ops netlbl_cipsov4_genl_c_list = {
+   },
+   {
.cmd = NLBL_CIPSOV4_C_LIST,
.flags = 0,
.policy = netlbl_cipsov4_genl_policy,
.doit = netlbl_cipsov4_list,
.dumpit = NULL,
-};
-
-static struct genl_ops netlbl_cipsov4_genl_c_listall = {
+   },
+   {
.cmd = NLBL_CIPSOV4_C_LISTALL,
.flags = 0,
.policy = netlbl_cipsov4_genl_policy,
.doit = NULL,
.dumpit = netlbl_cipsov4_listall,
+   },
 };
 
 /*
@@ -764,28 +763,18 @@ static struct genl_ops netlbl_cipsov4_genl_c_listall = {
  */
 int netlbl_cipsov4_genl_init(void)
 {
-   int ret_val;
+   int ret_val, i;
 
ret_val = genl_register_family(netlbl_cipsov4_gnl_family);
if (ret_val != 0)
return ret_val;
 
-   ret_val = genl_register_ops(netlbl_cipsov4_gnl_family,
-   netlbl_cipsov4_genl_c_add);
-   if (ret_val != 0)
-   return ret_val;
-   ret_val = genl_register_ops(netlbl_cipsov4_gnl_family,
-   netlbl_cipsov4_genl_c_remove);
-   if (ret_val != 0)
-   return ret_val;
-   ret_val = genl_register_ops(netlbl_cipsov4_gnl_family,
-   netlbl_cipsov4_genl_c_list);
-   if (ret_val != 0)
-   return ret_val;
-   ret_val = genl_register_ops(netlbl_cipsov4_gnl_family,
-   netlbl_cipsov4_genl_c_listall);
-   if (ret_val != 0)
-   return ret_val;
+   for (i = 0; i  ARRAY_SIZE(netlbl_cipsov4_ops); i++) {
+   ret_val = genl_register_ops(netlbl_cipsov4_gnl_family,
+   netlbl_cipsov4_ops[i]);
+   if (ret_val != 0)
+   return ret_val;
+   }
 
return 0;
 }
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
index e2258dc..05d9886 100644
--- a/net/netlabel/netlabel_mgmt.c
+++ b/net/netlabel/netlabel_mgmt.c
@@ -517,68 +517,63 @@ version_failure:
  * NetLabel Generic NETLINK Command Definitions
  */
 
-static struct genl_ops netlbl_mgmt_genl_c_add = {
+static struct genl_ops netlbl_mgmt_genl_ops[] = {
+   {
.cmd = NLBL_MGMT_C_ADD,
.flags = GENL_ADMIN_PERM,
.policy = netlbl_mgmt_genl_policy,
.doit = netlbl_mgmt_add,
.dumpit = NULL,
-};
-
-static struct genl_ops netlbl_mgmt_genl_c_remove = {
+   },
+   {
.cmd = NLBL_MGMT_C_REMOVE,
.flags = GENL_ADMIN_PERM,
.policy = netlbl_mgmt_genl_policy,
.doit = netlbl_mgmt_remove,
.dumpit = NULL,
-};
-
-static struct genl_ops netlbl_mgmt_genl_c_listall = {
+   },
+   {
.cmd = NLBL_MGMT_C_LISTALL,
.flags = 0,
.policy = netlbl_mgmt_genl_policy,
.doit = NULL,
.dumpit = netlbl_mgmt_listall,
-};
-
-static struct genl_ops netlbl_mgmt_genl_c_adddef = {
+   },
+   {
.cmd = NLBL_MGMT_C_ADDDEF,
.flags = GENL_ADMIN_PERM,
.policy = netlbl_mgmt_genl_policy,
.doit = netlbl_mgmt_adddef,
.dumpit = NULL,
-};
-
-static struct genl_ops netlbl_mgmt_genl_c_removedef = {
+   },
+   {
.cmd = NLBL_MGMT_C_REMOVEDEF,
.flags = GENL_ADMIN_PERM,
.policy = netlbl_mgmt_genl_policy,
.doit = netlbl_mgmt_removedef,
.dumpit = NULL,
-};
-
-static struct genl_ops netlbl_mgmt_genl_c_listdef = {
+   },
+   {
.cmd = NLBL_MGMT_C_LISTDEF,
.flags = 0,
.policy = netlbl_mgmt_genl_policy,
.doit = netlbl_mgmt_listdef,
.dumpit = NULL,
-};
-

[PATCH][AX25] mkiss: ax_bump() locking fix

2008-02-13 Thread Jarek Poplawski
Hi,

This is unchanged patch previously sent here for testing.
I think it should be applied.

Thanks,
Jarek P.



Subject: [PATCH][AX25] mkiss: ax_bump() locking fix

According to one of OOPSes reported by Jann softirq can break
while skb is prepared for netif_rx. The report isn't complete,
so the real reason of the later bug could be different, but
IMHO this locking break in ax_bump is unsafe and unnecessary.

Reported-and-tested-by: Jann Traschewski [EMAIL PROTECTED]
Signed-off-by: Jarek Poplawski [EMAIL PROTECTED]

---

 drivers/net/hamradio/mkiss.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index cfcd15a..30c9b3b 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -289,7 +289,6 @@ static void ax_bump(struct mkiss *ax)
*ax-rbuff = ~0x20;
}
}
-   spin_unlock_bh(ax-buflock);
 
count = ax-rcount;
 
@@ -297,17 +296,17 @@ static void ax_bump(struct mkiss *ax)
printk(KERN_ERR mkiss: %s: memory squeeze, dropping packet.\n,
   ax-dev-name);
ax-stats.rx_dropped++;
+   spin_unlock_bh(ax-buflock);
return;
}
 
-   spin_lock_bh(ax-buflock);
memcpy(skb_put(skb,count), ax-rbuff, count);
-   spin_unlock_bh(ax-buflock);
skb-protocol = ax25_type_trans(skb, ax-dev);
netif_rx(skb);
ax-dev-last_rx = jiffies;
ax-stats.rx_packets++;
ax-stats.rx_bytes += count;
+   spin_unlock_bh(ax-buflock);
 }
 
 static void kiss_unesc(struct mkiss *ax, unsigned char s)
--
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][AX25] ax25_out: check skb for NULL in ax25_kick()

2008-02-13 Thread Jarek Poplawski
Hi,

Here is an official version of testing patch #2 from this thread.
The only difference: ax25-vs is changed only after checking skb is
not NULL (plus a comment). IMHO it could be applied.

Thanks,
Jarek P.



Subject: [AX25] ax25_out: check skb for NULL in ax25_kick()

According to some OOPS reports ax25_kick tries to clone NULL skbs
sometimes. It looks like a race with ax25_clear_queues(). Probably
there is no need to add more than a simple check for this yet.
Another report suggested there are probably also cases where ax25
-paclen == 0 can happen in ax25_output(); this wasn't confirmed
during testing but let's leave this debugging check for some time.


Reported-and-tested-by: Jann Traschewski [EMAIL PROTECTED]
Signed-off-by: Jarek Poplawski [EMAIL PROTECTED]

---

diff -Nurp 2.6.24-mm1-/net/ax25/ax25_out.c 2.6.24-mm1+/net/ax25/ax25_out.c
--- 2.6.24-mm1-/net/ax25/ax25_out.c 2008-01-24 22:58:37.0 +
+++ 2.6.24-mm1+/net/ax25/ax25_out.c 2008-02-13 10:43:50.0 +
@@ -117,6 +117,12 @@ void ax25_output(ax25_cb *ax25, int pacl
unsigned char *p;
int frontlen, len, fragno, ka9qfrag, first = 1;
 
+   if (paclen  16) {
+   WARN_ON_ONCE(1);
+   kfree_skb(skb);
+   return;
+   }
+
if ((skb-len - 1)  paclen) {
if (*skb-data == AX25_P_TEXT) {
skb_pull(skb, 1); /* skip PID */
@@ -251,8 +257,6 @@ void ax25_kick(ax25_cb *ax25)
if (start == end)
return;
 
-   ax25-vs = start;
-
/*
 * Transmit data until either we're out of data to send or
 * the window is full. Send a poll on the final I frame if
@@ -261,8 +265,13 @@ void ax25_kick(ax25_cb *ax25)
 
/*
 * Dequeue the frame and copy it.
+* Check for race with ax25_clear_queues().
 */
skb  = skb_dequeue(ax25-write_queue);
+   if (!skb)
+   return;
+
+   ax25-vs = start;
 
do {
if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) {
--
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/2][NETLABEL]: Shrink the genl-ops registration code.

2008-02-13 Thread Paul Moore
On Wednesday 13 February 2008 6:09:44 am Pavel Emelyanov wrote:
 Turning them to array and registration in a loop saves
 80 lines of code and ~300 bytes from text section.

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

Definitely an improvement, thank you.

Acked-by: Paul Moore [EMAIL PROTECTED]

 ---
  net/netlabel/netlabel_cipso_v4.c  |   43 +++
  net/netlabel/netlabel_mgmt.c  |   79 ++---
  net/netlabel/netlabel_unlabeled.c |   86
 ++-- 3 files changed, 64 insertions(+), 144
 deletions(-)

 diff --git a/net/netlabel/netlabel_cipso_v4.c
 b/net/netlabel/netlabel_cipso_v4.c index c7ad64d..283ff4a 100644
 --- a/net/netlabel/netlabel_cipso_v4.c
 +++ b/net/netlabel/netlabel_cipso_v4.c
 @@ -718,36 +718,35 @@ static int netlbl_cipsov4_remove(struct sk_buff *skb,
 struct genl_info *info) * NetLabel Generic NETLINK Command Definitions
   */

 -static struct genl_ops netlbl_cipsov4_genl_c_add = {
 +static struct genl_ops netlbl_cipsov4_ops[] = {
 + {
   .cmd = NLBL_CIPSOV4_C_ADD,
   .flags = GENL_ADMIN_PERM,
   .policy = netlbl_cipsov4_genl_policy,
   .doit = netlbl_cipsov4_add,
   .dumpit = NULL,
 -};
 -
 -static struct genl_ops netlbl_cipsov4_genl_c_remove = {
 + },
 + {
   .cmd = NLBL_CIPSOV4_C_REMOVE,
   .flags = GENL_ADMIN_PERM,
   .policy = netlbl_cipsov4_genl_policy,
   .doit = netlbl_cipsov4_remove,
   .dumpit = NULL,
 -};
 -
 -static struct genl_ops netlbl_cipsov4_genl_c_list = {
 + },
 + {
   .cmd = NLBL_CIPSOV4_C_LIST,
   .flags = 0,
   .policy = netlbl_cipsov4_genl_policy,
   .doit = netlbl_cipsov4_list,
   .dumpit = NULL,
 -};
 -
 -static struct genl_ops netlbl_cipsov4_genl_c_listall = {
 + },
 + {
   .cmd = NLBL_CIPSOV4_C_LISTALL,
   .flags = 0,
   .policy = netlbl_cipsov4_genl_policy,
   .doit = NULL,
   .dumpit = netlbl_cipsov4_listall,
 + },
  };

  /*
 @@ -764,28 +763,18 @@ static struct genl_ops netlbl_cipsov4_genl_c_listall
 = { */
  int netlbl_cipsov4_genl_init(void)
  {
 - int ret_val;
 + int ret_val, i;

   ret_val = genl_register_family(netlbl_cipsov4_gnl_family);
   if (ret_val != 0)
   return ret_val;

 - ret_val = genl_register_ops(netlbl_cipsov4_gnl_family,
 - netlbl_cipsov4_genl_c_add);
 - if (ret_val != 0)
 - return ret_val;
 - ret_val = genl_register_ops(netlbl_cipsov4_gnl_family,
 - netlbl_cipsov4_genl_c_remove);
 - if (ret_val != 0)
 - return ret_val;
 - ret_val = genl_register_ops(netlbl_cipsov4_gnl_family,
 - netlbl_cipsov4_genl_c_list);
 - if (ret_val != 0)
 - return ret_val;
 - ret_val = genl_register_ops(netlbl_cipsov4_gnl_family,
 - netlbl_cipsov4_genl_c_listall);
 - if (ret_val != 0)
 - return ret_val;
 + for (i = 0; i  ARRAY_SIZE(netlbl_cipsov4_ops); i++) {
 + ret_val = genl_register_ops(netlbl_cipsov4_gnl_family,
 + netlbl_cipsov4_ops[i]);
 + if (ret_val != 0)
 + return ret_val;
 + }

   return 0;
  }
 diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
 index e2258dc..05d9886 100644
 --- a/net/netlabel/netlabel_mgmt.c
 +++ b/net/netlabel/netlabel_mgmt.c
 @@ -517,68 +517,63 @@ version_failure:
   * NetLabel Generic NETLINK Command Definitions
   */

 -static struct genl_ops netlbl_mgmt_genl_c_add = {
 +static struct genl_ops netlbl_mgmt_genl_ops[] = {
 + {
   .cmd = NLBL_MGMT_C_ADD,
   .flags = GENL_ADMIN_PERM,
   .policy = netlbl_mgmt_genl_policy,
   .doit = netlbl_mgmt_add,
   .dumpit = NULL,
 -};
 -
 -static struct genl_ops netlbl_mgmt_genl_c_remove = {
 + },
 + {
   .cmd = NLBL_MGMT_C_REMOVE,
   .flags = GENL_ADMIN_PERM,
   .policy = netlbl_mgmt_genl_policy,
   .doit = netlbl_mgmt_remove,
   .dumpit = NULL,
 -};
 -
 -static struct genl_ops netlbl_mgmt_genl_c_listall = {
 + },
 + {
   .cmd = NLBL_MGMT_C_LISTALL,
   .flags = 0,
   .policy = netlbl_mgmt_genl_policy,
   .doit = NULL,
   .dumpit = netlbl_mgmt_listall,
 -};
 -
 -static struct genl_ops netlbl_mgmt_genl_c_adddef = {
 + },
 + {
   .cmd = NLBL_MGMT_C_ADDDEF,
   .flags = GENL_ADMIN_PERM,
   .policy = netlbl_mgmt_genl_policy,
   .doit = netlbl_mgmt_adddef,
   .dumpit = NULL,
 -};
 -
 -static struct genl_ops netlbl_mgmt_genl_c_removedef = {
 + },
 + {
   .cmd = NLBL_MGMT_C_REMOVEDEF,
   .flags = GENL_ADMIN_PERM,
   .policy = netlbl_mgmt_genl_policy,
   .doit = netlbl_mgmt_removedef,
   .dumpit = NULL,
 -};
 -
 -static struct genl_ops netlbl_mgmt_genl_c_listdef = {
 + },
 + {
   .cmd = NLBL_MGMT_C_LISTDEF,
   .flags = 0,
   .policy = 

Re: [PATCH 2/2][NETLABEL]: Move some initialization code into __init section.

2008-02-13 Thread Paul Moore
On Wednesday 13 February 2008 6:12:06 am Pavel Emelyanov wrote:
 Everything that is called from netlbl_init() can be marked with
 __init. This moves 620 bytes from .text section to .text.init one.

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

I ran into problems with __init and __exit once because I didn't fully 
understand their impact; this caused me to be rather hesitant to make use of 
them.  However, you seem to know what you are doing and these look like 
reasonable changes to me so I'll ack this patch and if we do run into a 
problem the fix should be pretty trivial.

I appreciate you taking the time to find these optimizations, thanks again.

Acked-by: Paul Moore [EMAIL PROTECTED]

 ---
  net/netlabel/netlabel_cipso_v4.c   |2 +-
  net/netlabel/netlabel_domainhash.c |2 +-
  net/netlabel/netlabel_mgmt.c   |2 +-
  net/netlabel/netlabel_unlabeled.c  |6 +++---
  net/netlabel/netlabel_user.c   |2 +-
  5 files changed, 7 insertions(+), 7 deletions(-)

 diff --git a/net/netlabel/netlabel_cipso_v4.c
 b/net/netlabel/netlabel_cipso_v4.c index 283ff4a..fdc14a0 100644
 --- a/net/netlabel/netlabel_cipso_v4.c
 +++ b/net/netlabel/netlabel_cipso_v4.c
 @@ -761,7 +761,7 @@ static struct genl_ops netlbl_cipsov4_ops[] = {
   * mechanism.  Returns zero on success, negative values on failure.
   *
   */
 -int netlbl_cipsov4_genl_init(void)
 +int __init netlbl_cipsov4_genl_init(void)
  {
   int ret_val, i;

 diff --git a/net/netlabel/netlabel_domainhash.c
 b/net/netlabel/netlabel_domainhash.c index fd46231..02c2f7c 100644
 --- a/net/netlabel/netlabel_domainhash.c
 +++ b/net/netlabel/netlabel_domainhash.c
 @@ -171,7 +171,7 @@ static struct netlbl_dom_map
 *netlbl_domhsh_search_def(const char *domain) * values on error.
   *
   */
 -int netlbl_domhsh_init(u32 size)
 +int __init netlbl_domhsh_init(u32 size)
  {
   u32 iter;
   struct netlbl_domhsh_tbl *hsh_tbl;
 diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
 index 05d9886..22c1912 100644
 --- a/net/netlabel/netlabel_mgmt.c
 +++ b/net/netlabel/netlabel_mgmt.c
 @@ -588,7 +588,7 @@ static struct genl_ops netlbl_mgmt_genl_ops[] = {
   * mechanism.  Returns zero on success, negative values on failure.
   *
   */
 -int netlbl_mgmt_genl_init(void)
 +int __init netlbl_mgmt_genl_init(void)
  {
   int ret_val, i;

 diff --git a/net/netlabel/netlabel_unlabeled.c
 b/net/netlabel/netlabel_unlabeled.c index f0f1322..4478f2f 100644
 --- a/net/netlabel/netlabel_unlabeled.c
 +++ b/net/netlabel/netlabel_unlabeled.c
 @@ -1624,7 +1624,7 @@ static struct genl_ops netlbl_unlabel_genl_ops[] = {
   * mechanism.  Returns zero on success, negative values on failure.
   *
   */
 -int netlbl_unlabel_genl_init(void)
 +int __init netlbl_unlabel_genl_init(void)
  {
   int ret_val, i;

 @@ -1661,7 +1661,7 @@ static struct notifier_block
 netlbl_unlhsh_netdev_notifier = { * non-zero values on error.
   *
   */
 -int netlbl_unlabel_init(u32 size)
 +int __init netlbl_unlabel_init(u32 size)
  {
   u32 iter;
   struct netlbl_unlhsh_tbl *hsh_tbl;
 @@ -1765,7 +1765,7 @@ unlabel_getattr_nolabel:
   * and to send unlabeled network traffic by default.
   *
   */
 -int netlbl_unlabel_defconf(void)
 +int __init netlbl_unlabel_defconf(void)
  {
   int ret_val;
   struct netlbl_dom_map *entry;
 diff --git a/net/netlabel/netlabel_user.c b/net/netlabel/netlabel_user.c
 index 023fc8f..b17d420 100644
 --- a/net/netlabel/netlabel_user.c
 +++ b/net/netlabel/netlabel_user.c
 @@ -59,7 +59,7 @@
   * non-zero on failure.
   *
   */
 -int netlbl_netlink_init(void)
 +int __init netlbl_netlink_init(void)
  {
   int ret_val;



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


Re: [PATCH] drivers/base: export gpl (un)register_memory_notifier

2008-02-13 Thread Jan-Bernd Themann
Hi Dave,

On Monday 11 February 2008 17:47, Dave Hansen wrote:
 Also, just ripping down and completely re-doing the entire mass of cards
 every time a 16MB area of memory is added or removed seems like an
 awfully big sledgehammer to me.  I would *HATE* to see anybody else
 using this driver as an example to work off of?  Can't you just keep
 track of which areas the driver is actually *USING* and only worry about
 changing mappings if that intersects with an area having hotplug done on
 it?


to form a base for the eHEA memory add / remove concept discussion:

Explanation of the current eHEA memory add / remove concept:

Constraints imposed by HW / FW:
- eHEA has own MMU
- eHEA  Memory Regions (MRs) are used by the eHEA MMU  to translate virtual
  addresses to absolute addresses (like DMA mapped memory on a PCI bus)
- The number of MRs is limited (not enough to have one MR per packet)
- Registration of MRs is comparativley slow as done via slow firmware call
(H_CALL)
- MRs can have a maximum size of the memory available under linux
- MRs cover a contiguous virtual memory block (no holes)

Because of this there is just one big MR that covers entire kernel memory.
We also need a mapping table from kernel addresses to this
contiguous virtual memory IO space (here called ehea_bmap).

- When memory is added / removed to LPAR (and linux), the MR has to be updated.
  This can only be done by destroying and recreating the MR. There is no H_CALL
  to modify MR size. To find holes in the linux kernel memory layout we have to
  iterate over the memory sections for recreating a ehea_bmap
  (otherwise MR would be bigger then available memory causing the
  registration to fail)

- DLPAR userspace tools, kernel, driver, firmware and HMC are involved in that
  process on System p

Memory add: version without a external memory notifier call
- new memory used in a transfer_xmit will result in a ehea_bmap
  translation miss, which triggers a rebuild and reregistration
  of the ehea_bmap based on the current kernel memory setup.
- advantage: the number of MR rebuilds is reduced significantly compared to
  a rebuild for each 16MB chunk of memory added.

Memory add: version with external notifier call:
- We still need a ehea_bmap (whatever structure it has)

Memory remove with notifier:
- We have to rebuild the ehea_bmap instantly to remove the pages that are
  no longer available. Without doing that, the firmware (pHYP) cannot remove
  that memory from the LPAR. As we don't know if or how many additional 
  sections are to be removed before the DLPAR user space tool tells the 
  firmware to remove the memory, we can't wait with the rebuild.


Our current understanding about the current Memory Hotplug System are
(please correct me
if I'm wrong):

- depends on sparse mem
- only whole memory sections are added / removed
- for each section a memory resource is registered


From the driver side we need:
- some kind of memory notification mechanism.
  For memory add we can live without any external memory notification
  event. For memory remove we do need an external trigger (see explanation
  above).
- a way to iterate over all kernel pages and a way to detect holes in the
  kernel memory layout in order to build up our own ehea_bmap.


Memory notification trigger:
- These triggers exist, an exported register_memory_notifier /
  unregister_memory_notifier would work in this scheme

Functions to use while building ehea_bmap + MRs:
- Use either the functions that are used by the memory hotplug system as
  well, that means using the section defines + functions (section_nr_to_pfn,
  pfn_valid)
- Use currently other not exported functions in kernel/resource.c, like
  walk_memory_resource (where we would still need the maximum possible number
  of pages NR_MEM_SECTIONS)
- Maybe some kind of new interface?

What would you suggest?

Regards,
Jan-Bernd  Christoph
--
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] ehea: add kdump support

2008-02-13 Thread Thomas Klein
This patch adds kdump support to the ehea driver. As the firmware doesn't free
resource handles automatically, the driver has to run an as simple as possible
free resource function in case of a crash shutdown. The function iterates over
two arrays freeing all resource handles which are stored there. The arrays are
kept up-to-date during normal runtime. The crash handler fn is triggered by the
recently introduced PPC crash shutdown reg/unreg functions.


Signed-off-by: Thomas Klein [EMAIL PROTECTED]

---
 drivers/net/ehea/ehea.h  |   34 +-
 drivers/net/ehea/ehea_main.c |  281 ++
 2 files changed, 290 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 88fb53e..7c4ead3 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
 #include asm/io.h

 #define DRV_NAME   ehea
-#define DRV_VERSIONEHEA_0083
+#define DRV_VERSIONEHEA_0087

 /* eHEA capability flags */
 #define DLPAR_PORT_ADD_REM 1
@@ -386,6 +386,13 @@ struct ehea_port_res {


 #define EHEA_MAX_PORTS 16
+
+#define EHEA_NUM_PORTRES_FW_HANDLES6  /* QP handle, SendCQ handle,
+RecvCQ handle, EQ handle,
+SendMR handle, RecvMR handle */
+#define EHEA_NUM_PORT_FW_HANDLES   1  /* EQ handle */
+#define EHEA_NUM_ADAPTER_FW_HANDLES2  /* MR handle, NEQ handle */
+
 struct ehea_adapter {
u64 handle;
struct of_device *ofdev;
@@ -405,6 +412,31 @@ struct ehea_mc_list {
u64 macaddr;
 };

+/* kdump support */
+struct ehea_fw_handle_entry {
+   u64 adh;   /* Adapter Handle */
+   u64 fwh;   /* Firmware Handle */
+};
+
+struct ehea_fw_handle_array {
+   struct ehea_fw_handle_entry *arr;
+   int num_entries;
+   struct semaphore lock;
+};
+
+struct ehea_bcmc_reg_entry {
+   u64 adh;   /* Adapter Handle */
+   u32 port_id;   /* Logical Port Id */
+   u8 reg_type;   /* Registration Type */
+   u64 macaddr;
+};
+
+struct ehea_bcmc_reg_array {
+   struct ehea_bcmc_reg_entry *arr;
+   int num_entries;
+   struct semaphore lock;
+};
+
 #define EHEA_PORT_UP 1
 #define EHEA_PORT_DOWN 0
 #define EHEA_PHY_LINK_UP 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index c051c7e..21af674 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -35,6 +35,7 @@
 #include linux/if_ether.h
 #include linux/notifier.h
 #include linux/reboot.h
+#include asm/kexec.h

 #include net/ip.h

@@ -98,8 +99,10 @@ static int port_name_cnt;
 static LIST_HEAD(adapter_list);
 u64 ehea_driver_flags;
 struct work_struct ehea_rereg_mr_task;
-
 struct semaphore dlpar_mem_lock;
+struct ehea_fw_handle_array ehea_fw_handles;
+struct ehea_bcmc_reg_array ehea_bcmc_regs;
+

 static int __devinit ehea_probe_adapter(struct of_device *dev,
const struct of_device_id *id);
@@ -132,6 +135,160 @@ void ehea_dump(void *adr, int len, char *msg)
}
 }

+static void ehea_update_firmware_handles(void)
+{
+   struct ehea_fw_handle_entry *arr = NULL;
+   struct ehea_adapter *adapter;
+   int num_adapters = 0;
+   int num_ports = 0;
+   int num_portres = 0;
+   int i = 0;
+   int num_fw_handles, k, l;
+
+   /* Determine number of handles */
+   list_for_each_entry(adapter, adapter_list, list) {
+   num_adapters++;
+
+   for (k = 0; k  EHEA_MAX_PORTS; k++) {
+   struct ehea_port *port = adapter-port[k];
+
+   if (!port || (port-state != EHEA_PORT_UP))
+   continue;
+
+   num_ports++;
+   num_portres += port-num_def_qps + port-num_add_tx_qps;
+   }
+   }
+
+   num_fw_handles = num_adapters * EHEA_NUM_ADAPTER_FW_HANDLES +
+num_ports * EHEA_NUM_PORT_FW_HANDLES +
+num_portres * EHEA_NUM_PORTRES_FW_HANDLES;
+
+   if (num_fw_handles) {
+   arr = kzalloc(num_fw_handles * sizeof(*arr), GFP_KERNEL);
+   if (!arr)
+   return;  /* Keep the existing array */
+   } else
+   goto out_update;
+
+   list_for_each_entry(adapter, adapter_list, list) {
+   for (k = 0; k  EHEA_MAX_PORTS; k++) {
+   struct ehea_port *port = adapter-port[k];
+
+   if (!port || (port-state != EHEA_PORT_UP))
+   continue;
+
+   for (l = 0;
+l  port-num_def_qps + port-num_add_tx_qps;
+l++) {
+   struct ehea_port_res *pr = port-port_res[l];
+
+   arr[i].adh = adapter-handle;
+   arr[i++].fwh = 

Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Roland Dreier
   how can a static void function return 0?

good question... I've fixed the patch in my tree.
--
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: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Steve Wise

Roland Dreier wrote:

   how can a static void function return 0?

good question... I've fixed the patch in my tree.


oops.


--
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: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Roland Dreier
Steve, I had to update the patch adding an include and fixing the
function declaration (as below)... but how much testing have you done
with this??

commit 8704e9a8790cc9e394198663c1c9150c899fb9a2
Author: Steve Wise [EMAIL PROTECTED]
Date:   Tue Feb 12 16:09:29 2008 -0600

RDMA/cxgb3: Fail loopback connections

The cxgb3 HW and driver don't support loopback RDMA connections.  So
fail any connection attempt where the destination address is local.

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

diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c 
b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index e9a08fa..320f2b6 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -35,6 +35,7 @@
 #include linux/skbuff.h
 #include linux/timer.h
 #include linux/notifier.h
+#include linux/inetdevice.h
 
 #include net/neighbour.h
 #include net/netevent.h
@@ -1784,6 +1785,17 @@ err:
return err;
 }
 
+static int is_loopback_dst(struct iw_cm_id *cm_id)
+{
+   struct net_device *dev;
+
+   dev = ip_dev_find(init_net, cm_id-remote_addr.sin_addr.s_addr);
+   if (!dev)
+   return 0;
+   dev_put(dev);
+   return 1;
+}
+
 int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 {
int err = 0;
@@ -1791,6 +1803,11 @@ int iwch_connect(struct iw_cm_id *cm_id, struct 
iw_cm_conn_param *conn_param)
struct iwch_ep *ep;
struct rtable *rt;
 
+   if (is_loopback_dst(cm_id)) {
+   err = -ENOSYS;
+   goto out;
+   }
+
ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
if (!ep) {
printk(KERN_ERR MOD %s - cannot alloc ep.\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


Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Steve Wise

Roland Dreier wrote:

Steve, I had to update the patch adding an include and fixing the
function declaration (as below)... but how much testing have you done
with this??



Now I understand.  I thought I'd fixed these!  I fixed them locally in 
the test tree on my victim and then tested, but forgot to update my git 
tree.


Sorry for this.

You want me to resubmit?



commit 8704e9a8790cc9e394198663c1c9150c899fb9a2
Author: Steve Wise [EMAIL PROTECTED]
Date:   Tue Feb 12 16:09:29 2008 -0600

RDMA/cxgb3: Fail loopback connections

The cxgb3 HW and driver don't support loopback RDMA connections.  So

fail any connection attempt where the destination address is local.

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

Signed-off-by: Roland Dreier [EMAIL PROTECTED]

diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c 
b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index e9a08fa..320f2b6 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -35,6 +35,7 @@
 #include linux/skbuff.h
 #include linux/timer.h
 #include linux/notifier.h
+#include linux/inetdevice.h
 
 #include net/neighbour.h

 #include net/netevent.h
@@ -1784,6 +1785,17 @@ err:
return err;
 }
 
+static int is_loopback_dst(struct iw_cm_id *cm_id)

+{
+   struct net_device *dev;
+
+   dev = ip_dev_find(init_net, cm_id-remote_addr.sin_addr.s_addr);
+   if (!dev)
+   return 0;
+   dev_put(dev);
+   return 1;
+}
+
 int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 {
int err = 0;
@@ -1791,6 +1803,11 @@ int iwch_connect(struct iw_cm_id *cm_id, struct 
iw_cm_conn_param *conn_param)
struct iwch_ep *ep;
struct rtable *rt;
 
+	if (is_loopback_dst(cm_id)) {

+   err = -ENOSYS;
+   goto out;
+   }
+
ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
if (!ep) {
printk(KERN_ERR MOD %s - cannot alloc ep.\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


Re: [PATCH] ixgbe: Correctly obtain protocol information on transmit

2008-02-13 Thread Andy Gospodarek
On Tue, Feb 12, 2008 at 03:20:33PM -0800, Auke Kok wrote:
 In reply to RE: [Fwd: [PATCH 2.6.25] ixgbe/igb: correctly obtain protocol
 information on transmit] from Andy Gospodarek:
 
 The driver was incorrectly looking at socket headers for
 protocol information, needed for checksumming offload. Fix
 this by not looking at the socket but frame headers instead.
 
 This disregards extension headers but it's unclear that linux
 generates those anyway.
 
 Tested by Andy Gospodarek.
 
 Signed-off-by: Auke Kok [EMAIL PROTECTED]

This works well for me too.

Signed-off-by: Andy Gospodarek [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


[PATCh TAKE 2] [IPROUTE2] Add addrlabel sub-command.

2008-02-13 Thread YOSHIFUJI Hideaki / 吉藤英明
Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
---
diff --git a/ip/Makefile b/ip/Makefile
index b427d58..d908817 100644
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -1,4 +1,4 @@
-IPOBJ=ip.o ipaddress.o iproute.o iprule.o \
+IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o \
 rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
 ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o \
 ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \
diff --git a/ip/ip.c b/ip/ip.c
index aeb8c68..c4c773f 100644
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -46,8 +46,8 @@ static void usage(void)
fprintf(stderr,
 Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n
ip [ -force ] [-batch filename\n
-where  OBJECT := { link | addr | route | rule | neigh | ntable | tunnel |\n
-   maddr | mroute | monitor | xfrm }\n
+where  OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable 
|\n
+   tunnel | maddr | mroute | monitor | xfrm }\n
OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n
 -f[amily] { inet | inet6 | ipx | dnet | link } |\n
 -o[neline] | -t[imestamp] }\n);
@@ -64,6 +64,7 @@ static const struct cmd {
int (*func)(int argc, char **argv);
 } cmds[] = {
{ address,do_ipaddr },
+   { addrlabel,  do_ipaddrlabel },
{ maddress,   do_multiaddr },
{ route,  do_iproute },
{ rule,   do_iprule },
diff --git a/ip/ip_common.h b/ip/ip_common.h
index 39f2507..1bbd50d 100644
--- a/ip/ip_common.h
+++ b/ip/ip_common.h
@@ -4,6 +4,9 @@ extern int print_linkinfo(const struct sockaddr_nl *who,
 extern int print_addrinfo(const struct sockaddr_nl *who,
  struct nlmsghdr *n,
  void *arg);
+extern int print_addrlabelinfo(const struct sockaddr_nl *who,
+  struct nlmsghdr *n,
+  void *arg);
 extern int print_neigh(const struct sockaddr_nl *who,
   struct nlmsghdr *n, void *arg);
 extern int print_ntable(const struct sockaddr_nl *who,
@@ -23,6 +26,7 @@ extern int print_prefix(const struct sockaddr_nl *who,
 extern int print_rule(const struct sockaddr_nl *who,
  struct nlmsghdr *n, void *arg);
 extern int do_ipaddr(int argc, char **argv);
+extern int do_ipaddrlabel(int argc, char **argv);
 extern int do_iproute(int argc, char **argv);
 extern int do_iprule(int argc, char **argv);
 extern int do_ipneigh(int argc, char **argv);
diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c
new file mode 100644
index 000..1c873e9
--- /dev/null
+++ b/ip/ipaddrlabel.c
@@ -0,0 +1,260 @@
+/*
+ * ipaddrlabel.c   ip addrlabel
+ *
+ * Copyright (C)2007 USAGI/WIDE Project
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *
+ * Based on iprule.c.
+ *
+ * Authors:YOSHIFUJI Hideaki [EMAIL PROTECTED]
+ *
+ */
+
+#include stdio.h
+#include stdlib.h
+#include unistd.h
+#include syslog.h
+#include fcntl.h
+#include sys/socket.h
+#include netinet/in.h
+#include netinet/ip.h
+#include arpa/inet.h
+#include string.h
+#include linux/types.h
+#include linux/if_addrlabel.h
+
+#include rt_names.h
+#include utils.h
+#include ip_common.h
+
+#define IFAL_RTA(r)((struct rtattr*)(((char*)(r)) + 
NLMSG_ALIGN(sizeof(struct ifaddrlblmsg
+#define IFAL_PAYLOAD(n)NLMSG_PAYLOAD(n,sizeof(struct ifaddrlblmsg))
+
+extern struct rtnl_handle rth;
+
+static void usage(void) __attribute__((noreturn));
+
+static void usage(void)
+{
+   fprintf(stderr, Usage: ip addrlabel [ list | add | del | flush ] 
prefix PREFIX [ dev DEV ] [ label LABEL ]\n);
+   exit(-1);
+}
+
+int print_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void 
*arg)
+{
+   FILE *fp = (FILE*)arg;
+   struct ifaddrlblmsg *ifal = NLMSG_DATA(n);
+   int len = n-nlmsg_len;
+   int host_len = -1;
+   struct rtattr *tb[IFAL_MAX+1];
+   char abuf[256];
+
+   if (n-nlmsg_type != RTM_NEWADDRLABEL  n-nlmsg_type != 
RTM_DELADDRLABEL)
+   return 0;
+
+   len -= NLMSG_LENGTH(sizeof(*ifal));
+   if (len  0)
+   return -1;
+
+   parse_rtattr(tb, IFAL_MAX, IFAL_RTA(ifal), len);
+
+   if (ifal-ifal_family == AF_INET)
+   host_len 

Re: [ofa-general] [PATCH 2.6.25] RDMA/cxgb3: Fail loopbackconnections.

2008-02-13 Thread Steve Wise

Steve Wise wrote:

Roland Dreier wrote:

Steve, I had to update the patch adding an include and fixing the
function declaration (as below)... but how much testing have you done
with this??



Now I understand.  I thought I'd fixed these!  I fixed them locally in 
the test tree on my victim and then tested, but forgot to update my git 
tree.


Sorry for this.

You want me to resubmit?



BTW: Testing:  I cloned my git tree, resolved the two compile issues 
(void + include), then built and installed the kernel (2.6.25-rc1 + the 
fixed patch).  I then ensured that a connection to the local address 
caused the ENOSYS error.


I just forgot to pull the updated file back into my stg managed git tree.

:(
--
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: BUG: 2.6.25-rc1: iptables postrouting setup causes oops

2008-02-13 Thread Andrew G. Morgan

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Haavard,

It means your application is not capable(sic) of using the upper 32-bits
of the 64-bit capability sets supported by this newer kernel.

You might consider rebuilding the offending application linking it
against a newer version of libcap:

http://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/

However, it is a warning and, for any existing app that doesn't care
about newly added capabilities, the warning is benign.

Cheers

Andrew

Andrew Morton wrote:
| On Wed, 13 Feb 2008 10:10:24 +0100 Haavard Skinnemoen
[EMAIL PROTECTED] wrote:
|
| On Wed, 13 Feb 2008 00:48:29 -0800
| Andrew Morton [EMAIL PROTECTED] wrote:
|
| On Tue, 12 Feb 2008 22:46:01 +1100 Ben Nizette [EMAIL PROTECTED]
wrote:
|
| On an AVR32, root over NFS, config attached, running (from a startup
| script):
|
| iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
| Results in (dmesg extract including a bit of context for good measure):
| -8
| VFS: Mounted root (nfs filesystem).
| Freeing init memory: 72K (9000 - 90012000)
| eth0: no IPv6 routers present
| warning: `dnsmasq' uses 32-bit capabilities (legacy support in use)
| Hmm. What does that mean? What size do capabilities normally have?
|
| My near-namesake put than in, but I immediately forgot what it means?
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFHsx3n+bHCR3gb8jsRAjlNAKDK4RLJsPsMPN96JJnTj3U25Bx91ACdESeN
2P3V2ISny33KY6v107iHsKU=
=1jND
-END PGP SIGNATURE-
--
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: r8169 auto-negotiation problem

2008-02-13 Thread fgnijuhhu guduggurehug

Thanks for your response.

 Please try a recent kernel. Your r8169 driver is badly outdated.
OK. Now using 2.6.24-1-amd64. The r8169 version still says 2.2LK-NAPI, though.
_
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/--
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/3][NETLABEL]: Compilation for CONFIG_AUDIT=n case.

2008-02-13 Thread Paul Moore
On Wednesday 13 February 2008 1:35:44 am David Miller wrote:
 From: Pavel Emelyanov [EMAIL PROTECTED]
 Date: Thu, 07 Feb 2008 20:20:30 +0300

  The audit_log_start() will expand into an empty do { } while (0)
  construction and the audit_ctx becomes unused.
 
  The solution: push current-audit_context into audit_log_start()
  directly, since it is not required in any other place in the
  calling function.
 
  Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED]

 Applied.

Sorry I missed these three patches when they were posted because my 
email got screwy and I was dropped from netdev (all of vger.kernel.org 
actually).  I just dug them up in the archives and they looks fine to 
me.  Thanks again Pavel.

(better late than never I suppose, applies to all three patches in the 
patchset)

Acked-by: Paul Moore [EMAIL PROTECTED]

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


Re: [RFC, PATCH]: Pass link level header from/to PPP interface

2008-02-13 Thread Urs Thuermann
Hello Dave,

 But if libpcap and tcpdump can already identify PPP packets
 then, besides consistency, what does this buy us other
 than potential breakage?

My reason for the patch is mostly cleanliness and to make the kernel
match what is described in packet(7).

If you open a PF_PACKET/SOCK_RAW socket and bind it to an interface
you get a fixed type of frame/packet depending on the type of
interface, including the LL header.  Also if you bind to all
interfaces you can look at the interface type to know what type of
packet you get.  But not for PPP interfaces.

I've written a small packet dump util with a packet parser (somewhat
comparable to tcpdump but much smaller), which looks like this

struct sockaddr_ll addr;
...
s = open(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
...
recvfrom(s, buffer, sizeof(buffer), 0, addr, size);
switch (addr.sll_hatype) {
case ARPHRD_ETHER:
case ARPHRD_IEEE80211:
case ARPHRD_LOOPBACK:
parse_ether(buffer);
break;
case ARPHRD_TUNNEL:
parse_ip(buffer);
break;
case ARPHRD_SIT:
parse_ipv6(buffer);
break;

and so on.  Only for PPP I need to switch on the addr.sll_protocol
since with PPP I don't get the PPP header:

case ARPHRD_PPP:
switch (ntohs(addr.sll_protocol))
case ETH_P_IP:
parse_ip(buffer);
break;
case ETH_P_IPV6:
parse_ipv6(buffer);
break;
...
}
break;

With my patch you would write

case ARPHRD_PPP:
parse_ppp(buffer);
break;

and the parse function can show the complete PPP frame with protocol
field.  Without the patch there is no way to see the 2-byte PPP header
and, in contrast to packet(7), SOCK_DGRAM and SOCK_RAW are the same.

Do you consider this strong enough to justify this change?

urs
--
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] drivers/base: export gpl (un)register_memory_notifier

2008-02-13 Thread Dave Hansen
On Wed, 2008-02-13 at 16:17 +0100, Jan-Bernd Themann wrote:
 Constraints imposed by HW / FW:
 - eHEA has own MMU
 - eHEA  Memory Regions (MRs) are used by the eHEA MMU  to translate virtual
   addresses to absolute addresses (like DMA mapped memory on a PCI bus)
 - The number of MRs is limited (not enough to have one MR per packet)

Are there enough to have one per 16MB section?

 Our current understanding about the current Memory Hotplug System are
 (please correct me if I'm wrong):
 
 - depends on sparse mem

You're wrong ;).  In mainline, this is true.  There was a version of the
SUSE kernel that did otherwise.  But you can not and should not depend
on this never changing.  But, someone is perfectly free to go out an
implement something better than sparsemem for memory hotplug.  If they
go and do this, your driver may get left behind. 

 - only whole memory sections are added / removed
 - for each section a memory resource is registered

True, and true. (There might be exceptions to the whole sections one,
but that's blatant abuse and should be fixed. :)

 From the driver side we need:
 - some kind of memory notification mechanism.
   For memory add we can live without any external memory notification
   event. For memory remove we do need an external trigger (see explanation
   above).

You can export and use (un)register_memory_notifier.  You just need to
do it in a reasonable way that compiles for randconfig on your
architecture.  Believe me, we don't want to start teaching drivers about
sparsemem.  

 - a way to iterate over all kernel pages and a way to detect holes in the
   kernel memory layout in order to build up our own ehea_bmap.

Look at kernel/resource.c

But, I'm really not convinced that you can actually keep this map
yourselves.  It's not as simple as you think.  What happens if you get
on an LPAR with two sections, one [EMAIL PROTECTED] and another
[EMAIL PROTECTED]  That's quite possible.  I think your vmalloc'd
array will eat all of memory.  

That's why we have SPARSEMEM_EXTREME and SPARSEMEM_VMEMMAP implemented
in the core, so that we can deal with these kinds of problems, once and
*NOT* in every single little driver out there.  

 Functions to use while building ehea_bmap + MRs:
 - Use either the functions that are used by the memory hotplug system as
   well, that means using the section defines + functions (section_nr_to_pfn,
   pfn_valid)

Basically, you can't use anything related to sections outside of the
core code.  You can use things like pfn_valid(), or you can create new
interfaces that are properly abstracted.  

 - Use currently other not exported functions in kernel/resource.c, like
   walk_memory_resource (where we would still need the maximum possible number
   of pages NR_MEM_SECTIONS)

It isn't the act of exporting that's the problem.  It's making sure that
the exports won't be prone to abuse and that people are using them
properly.  You should assume that you can export and use
walk_memory_resource().

Do you know what other operating systems do with this hardware?

In the future, please make an effort to get review from knowledgeable
people about these kinds of things before using them in your driver.
Your company has many, many resources available, and all you need to do
is ask.  All that you have to do is look to the tops of the files of the
functions you are calling.

-- Dave

--
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] [IPROUTE2] Update various classifiers' help output forexpected CLASSID syntax

2008-02-13 Thread Waskiewicz Jr, Peter P
  +   fprintf(stderr, \nNOTE: CLASSID is parsed as hexidecimal 
  +input.\n);
 
 s/hexidecimal/hexadecimal/g (?)

Gah!  Thanks Jarek, I can correct and resend.

-PJ Waskiewicz
--
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] [IPROUTE2] Update various classifiers' help output for expected CLASSID syntax

2008-02-13 Thread PJ Waskiewicz
update: Fix the spelling of hexidecimal

This updates the help output to specify that CLASSID should be hexidecimal.
This makes sure that a user entering flowid 1:10 gets his flow put into
band 15 (0x10) and knows why.

Signed-off-by: Peter P Waskiewicz Jr [EMAIL PROTECTED]
---

 doc/actions/actions-general |3 +++
 tc/f_basic.c|1 +
 tc/f_fw.c   |1 +
 tc/f_route.c|1 +
 tc/f_rsvp.c |1 +
 tc/f_u32.c  |1 +
 6 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/doc/actions/actions-general b/doc/actions/actions-general
index 6561eda..70f7cd6 100644
--- a/doc/actions/actions-general
+++ b/doc/actions/actions-general
@@ -88,6 +88,9 @@ tc filter add dev lo parent : protocol ip prio 8 u32 \
 match ip dst 127.0.0.8/32 flowid 1:12 \
 action ipt -j mark --set-mark 2
 
+NOTE: flowid 1:12 is parsed flowid 0x1:0x12.  Make sure if you want flowid
+decimal 12, then use flowid 1:c.
+
 3) A feature i call pipe
 The motivation is derived from Unix pipe mechanism but applied to packets.
 Essentially take a matching packet and pass it through 
diff --git a/tc/f_basic.c b/tc/f_basic.c
index 19a7edf..aab946b 100644
--- a/tc/f_basic.c
+++ b/tc/f_basic.c
@@ -32,6 +32,7 @@ static void explain(void)
fprintf(stderr, \n);
fprintf(stderr, Where: SELECTOR := SAMPLE SAMPLE ...\n);
fprintf(stderr,FILTERID := X:Y:Z\n);
+   fprintf(stderr, \nNOTE: CLASSID is parsed as hexadecimal input.\n);
 }
 
 static int basic_parse_opt(struct filter_util *qu, char *handle,
diff --git a/tc/f_fw.c b/tc/f_fw.c
index 6d1490b..b511735 100644
--- a/tc/f_fw.c
+++ b/tc/f_fw.c
@@ -28,6 +28,7 @@ static void explain(void)
fprintf(stderr, Usage: ... fw [ classid CLASSID ] [ police POLICE_SPEC 
]\n);
fprintf(stderr,POLICE_SPEC := ... look at TBF\n);
fprintf(stderr,CLASSID := X:Y\n);
+   fprintf(stderr, \nNOTE: CLASSID is parsed as hexadecimal input.\n);
 }
 
 #define usage() return(-1)
diff --git a/tc/f_route.c b/tc/f_route.c
index a41b9d5..67dd49c 100644
--- a/tc/f_route.c
+++ b/tc/f_route.c
@@ -31,6 +31,7 @@ static void explain(void)
fprintf(stderr, [ flowid CLASSID ] [ police 
POLICE_SPEC ]\n);
fprintf(stderr,POLICE_SPEC := ... look at TBF\n);
fprintf(stderr,CLASSID := X:Y\n);
+   fprintf(stderr, \nNOTE: CLASSID is parsed as hexadecimal input.\n);
 }
 
 #define usage() return(-1)
diff --git a/tc/f_rsvp.c b/tc/f_rsvp.c
index 13fcf97..7e1e6d9 100644
--- a/tc/f_rsvp.c
+++ b/tc/f_rsvp.c
@@ -34,6 +34,7 @@ static void explain(void)
fprintf(stderr, u{8|16|32} NUMBER mask MASK at 
OFFSET}\n);
fprintf(stderr,POLICE_SPEC := ... look at TBF\n);
fprintf(stderr,FILTERID := X:Y\n);
+   fprintf(stderr, \nNOTE: CLASSID is parsed as hexadecimal input.\n);
 }
 
 #define usage() return(-1)
diff --git a/tc/f_u32.c b/tc/f_u32.c
index 91f2838..d75e76c 100644
--- a/tc/f_u32.c
+++ b/tc/f_u32.c
@@ -36,6 +36,7 @@ static void explain(void)
fprintf(stderr, Where: SELECTOR := SAMPLE SAMPLE ...\n);
fprintf(stderr,SAMPLE := { ip | ip6 | udp | tcp | icmp | 
u{32|16|8} | mark } SAMPLE_ARGS [divisor DIVISOR]\n);
fprintf(stderr,FILTERID := X:Y:Z\n);
+   fprintf(stderr, \nNOTE: CLASSID is parsed at hexadecimal input.\n);
 }
 
 #define usage() return(-1)

--
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.26]: Add per-connection option to set max TSO frame size

2008-02-13 Thread PJ Waskiewicz
Update: changed max_gso_frame_size and sk_gso_max_size from signed to
unsigned - thanks Stephen!

This patch adds the ability for device drivers to control the size of the
TSO frames being sent to them, per TCP connection.  By setting the
netdevice's max_gso_frame_size value, the socket layer will set the GSO
frame size based on that value.  This will propogate into the TCP layer,
and send TSO's of that size to the hardware.

This can be desirable to help tune the bursty nature of TSO on a
per-adapter basis, where one may have 1 GbE and 10 GbE devices coexisting
in a system, one running multiqueue and the other not, etc.

This can also be desirable for devices that cannot support full 64 KB
TSO's, but still want to benefit from some level of segmentation
offloading.

Signed-off-by: Peter P Waskiewicz Jr [EMAIL PROTECTED]
---

 include/linux/netdevice.h |6 ++
 include/net/sock.h|2 ++
 net/core/dev.c|1 +
 net/core/sock.c   |6 --
 net/ipv4/tcp_output.c |4 ++--
 5 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 047d432..853caca 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -616,6 +616,7 @@ struct net_device
 
/* Partially transmitted GSO packet. */
struct sk_buff  *gso_skb;
+   u16 max_gso_frame_size;
 
/* ingress path synchronizer */
spinlock_t  ingress_lock;
@@ -1475,6 +1476,11 @@ static inline int netif_needs_gso(struct net_device 
*dev, struct sk_buff *skb)
unlikely(skb-ip_summed != CHECKSUM_PARTIAL));
 }
 
+static inline void netif_set_max_gso_size(struct net_device *dev, u16 size)
+{
+   dev-max_gso_frame_size = size;
+}
+
 /* On bonding slaves other than the currently active slave, suppress
  * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
  * ARP on active-backup slaves with arp_validate enabled.
diff --git a/include/net/sock.h b/include/net/sock.h
index 8a7889b..2b07af0 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -151,6 +151,7 @@ struct sock_common {
   *@sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
   *@sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
   *@sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
+  *@sk_gso_max_size: Maximum GSO segment size to build
   *@sk_lingertime: %SO_LINGER l_linger setting
   *@sk_backlog: always used with the per-socket spinlock held
   *@sk_callback_lock: used with the callbacks in the end of this struct
@@ -236,6 +237,7 @@ struct sock {
gfp_t   sk_allocation;
int sk_route_caps;
int sk_gso_type;
+   __u16   sk_gso_max_size;
int sk_rcvlowat;
unsigned long   sk_flags;
unsigned long   sk_lingertime;
diff --git a/net/core/dev.c b/net/core/dev.c
index 9549417..f635b29 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4022,6 +4022,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const 
char *name,
}
 
dev-egress_subqueue_count = queue_count;
+   dev-max_gso_frame_size = 65536;
 
dev-get_stats = internal_stats;
netpoll_netdev_init(dev);
diff --git a/net/core/sock.c b/net/core/sock.c
index 433715f..a8b0ae5 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1076,10 +1076,12 @@ void sk_setup_caps(struct sock *sk, struct dst_entry 
*dst)
if (sk-sk_route_caps  NETIF_F_GSO)
sk-sk_route_caps |= NETIF_F_GSO_SOFTWARE;
if (sk_can_gso(sk)) {
-   if (dst-header_len)
+   if (dst-header_len) {
sk-sk_route_caps = ~NETIF_F_GSO_MASK;
-   else
+   } else {
sk-sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
+   sk-sk_gso_max_size = dst-dev-max_gso_frame_size;
+   }
}
 }
 EXPORT_SYMBOL_GPL(sk_setup_caps);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index ed750f9..8cd128d 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -998,7 +998,7 @@ unsigned int tcp_current_mss(struct sock *sk, int 
large_allowed)
xmit_size_goal = mss_now;
 
if (doing_tso) {
-   xmit_size_goal = (65535 -
+   xmit_size_goal = ((sk-sk_gso_max_size - 1) -
  inet_csk(sk)-icsk_af_ops-net_header_len -
  inet_csk(sk)-icsk_ext_hdr_len -
  tp-tcp_header_len);
@@ -1274,7 +1274,7 @@ static int tcp_tso_should_defer(struct sock *sk, struct 
sk_buff *skb)
limit = min(send_win, cong_win);
 
/* If a full-sized TSO skb can be sent, do it. */
-   if (limit = 65536)
+   if (limit = sk-sk_gso_max_size)
goto send_now;
 
if 

Re: BUG: 2.6.25-rc1: iptables postrouting setup causes oops

2008-02-13 Thread Haavard Skinnemoen
On Wed, 13 Feb 2008 08:42:15 -0800
Andrew G. Morgan [EMAIL PROTECTED] wrote:

 However, it is a warning and, for any existing app that doesn't care
 about newly added capabilities, the warning is benign.

Ok, I see. Thanks for explaining.

Haavard
--
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 to latest iproute to get it to compile on FC5

2008-02-13 Thread Ben Greear

I notice that the latest snapshot and git repository for iproute
will not compile on FC5 due to not finding __constant_hton* symbols
and a lack of the hdlc/ioctl.h file on FC5.

I am attaching a patch that appears to fix the problems for me.

Please consider applying this or something similar.

Signed-off-by:  Ben Greear [EMAIL PROTECTED]


Thanks,
Ben

--
Ben Greear [EMAIL PROTECTED]
Candela Technologies Inc  http://www.candelatech.com

diff --git a/configure b/configure
index dc14e54..f28e4cf 100755
--- a/configure
+++ b/configure
@@ -25,3 +25,22 @@ else
 echo no
 fi
 rm -f /tmp/atmtest.c /tmp/atmtest
+
+echo -n HDLC IOCTL:   
+cat /tmp/hdlctest.c EOF
+#include net/if.h
+#include linux/hdlc/ioctl.h
+int main(int argc, char **argv) {
+return 0;
+}
+EOF
+gcc -I$INCLUDE -o /tmp/hdlctest /tmp/hdlctest.c /dev/null 21
+if [ $? -eq 0 ]
+then
+echo IPROUTE_CONFIG_HDLC:=y Config
+echo yes
+else
+echo no
+fi
+rm -f /tmp/hdlctest.c /tmp/hdlctest
+
diff --git a/include/linux/if.h b/include/linux/if.h
index 40eb61f..9651cc9 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -23,7 +23,10 @@
 #include linux/socket.h		/* for struct sockaddr et al	*/
 
 #define	IFNAMSIZ	16
+
+#ifdef HAVE_HDLC_IOCTL
 #include linux/hdlc/ioctl.h
+#endif
 
 /* Standard interface flags (netdevice-flags). */
 #define	IFF_UP		0x1		/* interface is up		*/
@@ -133,6 +136,7 @@ struct if_settings
 {
 	unsigned int type;	/* Type of physical device or protocol */
 	unsigned int size;	/* Size of the data allocated by the caller */
+#ifdef HAVE_HDLC_IOCTL
 	union {
 		/* {atm/eth/dsl}_settings anyone ? */
 		raw_hdlc_proto	 *raw_hdlc;
@@ -145,6 +149,7 @@ struct if_settings
 		sync_serial_settings *sync;
 		te1_settings	 *te1;
 	} ifs_ifsu;
+#endif
 };
 
 /*
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 228eb4e..0eb5b04 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -2,6 +2,7 @@
 #define _IF_TUNNEL_H_
 
 #include linux/types.h
+#include asm/byteorder.h
 
 #define SIOCGETTUNNEL   (SIOCDEVPRIVATE + 0)
 #define SIOCADDTUNNEL   (SIOCDEVPRIVATE + 1)
diff --git a/lib/Makefile b/lib/Makefile
index bc270bf..1c51a42 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,3 +1,9 @@
+include ../Config
+
+ifeq ($(IPROUTE_CONFIG_HDLC),y)
+   CFLAGS += -DHAVE_HDLC_IOCTL
+endif
+
 
 UTILOBJ=utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o inet_proto.o
 


[PATCH 1/3] fib_trie: move statistics to debugfs

2008-02-13 Thread Stephen Hemminger
Don't want /proc/net/fib_trie and /proc/net/fib_triestat to become
permanent kernel space ABI issues, so move to the safer confines of debugfs.

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

---
 net/ipv4/Kconfig|9 ++-
 net/ipv4/fib_trie.c |  127 +---
 2 files changed, 86 insertions(+), 50 deletions(-)

--- a/net/ipv4/Kconfig  2008-02-13 10:58:51.0 -0800
+++ b/net/ipv4/Kconfig  2008-02-13 10:59:06.0 -0800
@@ -85,11 +85,12 @@ endchoice
 config IP_FIB_HASH
def_bool ASK_IP_FIB_HASH || !IP_ADVANCED_ROUTER
 
-config IP_FIB_TRIE_STATS
-   bool FIB TRIE statistics
-   depends on IP_FIB_TRIE
+config IP_FIB_TRIE_DEBUG
+   bool FIB TRIE debugging information
+   depends on IP_FIB_TRIE  DEBUG_FS
---help---
- Keep track of statistics on structure of FIB TRIE table.
+ Provides interface for looking at internal structure, and
+ statistics on for the  FIB TRIE table.
  Useful for testing and measuring TRIE performance.
 
 config IP_MULTIPLE_TABLES
--- a/net/ipv4/fib_trie.c   2008-02-13 10:58:51.0 -0800
+++ b/net/ipv4/fib_trie.c   2008-02-13 11:33:43.0 -0800
@@ -68,6 +68,7 @@
 #include linux/netdevice.h
 #include linux/if_arp.h
 #include linux/proc_fs.h
+#include linux/debugfs.h
 #include linux/rcupdate.h
 #include linux/skbuff.h
 #include linux/netlink.h
@@ -126,7 +127,8 @@ struct tnode {
struct node *child[0];
 };
 
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
+
 struct trie_use_stats {
unsigned int gets;
unsigned int backtrack;
@@ -135,7 +137,6 @@ struct trie_use_stats {
unsigned int null_node_hit;
unsigned int resize_node_skipped;
 };
-#endif
 
 struct trie_stat {
unsigned int totdepth;
@@ -146,10 +147,11 @@ struct trie_stat {
unsigned int prefixes;
unsigned int nodesizes[MAX_STAT_DEPTH];
 };
+#endif
 
 struct trie {
struct node *trie;
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
struct trie_use_stats stats;
 #endif
 };
@@ -588,7 +590,7 @@ static struct node *resize(struct trie *
 
if (IS_ERR(tn)) {
tn = old_tn;
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
t-stats.resize_node_skipped++;
 #endif
break;
@@ -631,7 +633,7 @@ static struct node *resize(struct trie *
tn = halve(t, tn);
if (IS_ERR(tn)) {
tn = old_tn;
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
t-stats.resize_node_skipped++;
 #endif
break;
@@ -1341,7 +1343,7 @@ static int check_leaf(struct trie *t, st
err = fib_semantic_match(li-falh, flp, res,
 htonl(l-key), mask, plen);
 
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
if (err = 0)
t-stats.semantic_match_passed++;
else
@@ -1376,7 +1378,7 @@ static int fn_trie_lookup(struct fib_tab
if (!n)
goto failed;
 
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
t-stats.gets++;
 #endif
 
@@ -1403,7 +1405,7 @@ static int fn_trie_lookup(struct fib_tab
n = tnode_get_child(pn, cindex);
 
if (n == NULL) {
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
t-stats.null_node_hit++;
 #endif
goto backtrace;
@@ -1546,7 +1548,7 @@ backtrace:
pn = parent;
chopped_off = 0;
 
-#ifdef CONFIG_IP_FIB_TRIE_STATS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
t-stats.backtrack++;
 #endif
goto backtrace;
@@ -2022,7 +2024,8 @@ struct fib_table *fib_hash_table(u32 id)
return tb;
 }
 
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_IP_FIB_TRIE_DEBUG
+
 /* Depth first Trie walk iterator */
 struct fib_trie_iter {
struct seq_net_private p;
@@ -2147,7 +2150,7 @@ static void trie_collect_stats(struct tr
 }
 
 /*
- * This outputs /proc/net/fib_triestats
+ * This outputs debugfs/fib/triestats
  */
 static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat)
 {
@@ -2189,7 +2192,6 @@ static void trie_show_stats(struct seq_f
seq_printf(seq, Total size: %u  kB\n, (bytes + 1023) / 1024);
 }
 
-#ifdef CONFIG_IP_FIB_TRIE_STATS
 static void trie_show_usage(struct seq_file *seq,
const struct trie_use_stats *stats)
 {
@@ -2204,7 +2206,7 @@ static void trie_show_usage(struct seq_f
seq_printf(seq, skipped node resize = %u\n\n,
   stats-resize_node_skipped);
 }
-#endif /*  CONFIG_IP_FIB_TRIE_STATS */
+
 
 static void fib_trie_show(struct seq_file *seq, const char *name,
  struct trie 

[PATCH 3/3] fib_trie: print statistics for multiple tables

2008-02-13 Thread Stephen Hemminger
Make debugfs/fib/trie and debugfs/fib/triestat handle
multiple (alternate) route tables.

Note: this usage of seq_file doesn't need/want SEQ_START_TOKEN

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

--- a/net/ipv4/fib_trie.c   2008-02-13 11:41:23.0 -0800
+++ b/net/ipv4/fib_trie.c   2008-02-13 11:41:35.0 -0800
@@ -2029,14 +2029,13 @@ struct fib_table *fib_hash_table(u32 id)
 /* Depth first Trie walk iterator */
 struct fib_trie_iter {
struct seq_net_private p;
-   struct trie *trie_local, *trie_main;
+   struct fib_table *tb;
struct tnode *tnode;
-   struct trie *trie;
unsigned index;
unsigned depth;
 };
 
-static struct node *fib_trie_get_next(struct fib_trie_iter *iter)
+static struct node *trie_get_next(struct fib_trie_iter *iter)
 {
struct tnode *tn = iter-tnode;
unsigned cindex = iter-index;
@@ -2081,34 +2080,29 @@ rescan:
return NULL;
 }
 
-static struct node *fib_trie_get_first(struct fib_trie_iter *iter,
-  struct trie *t)
+static struct node *trie_get_first(struct fib_trie_iter *iter,
+  struct trie *t)
 {
-   struct node *n ;
+   struct node *n;
 
if (!t)
return NULL;
 
n = rcu_dereference(t-trie);
-
-   if (!iter)
+   if (!n)
return NULL;
 
-   if (n) {
-   if (IS_TNODE(n)) {
-   iter-tnode = (struct tnode *) n;
-   iter-trie = t;
-   iter-index = 0;
-   iter-depth = 1;
-   } else {
-   iter-tnode = NULL;
-   iter-trie  = t;
-   iter-index = 0;
-   iter-depth = 0;
-   }
-   return n;
+   if (IS_TNODE(n)) {
+   iter-tnode = (struct tnode *) n;
+   iter-index = 0;
+   iter-depth = 1;
+   } else {
+   iter-tnode = NULL;
+   iter-index = 0;
+   iter-depth = 0;
}
-   return NULL;
+
+   return n;
 }
 
 static void trie_collect_stats(struct trie *t, struct trie_stat *s)
@@ -2119,8 +2113,7 @@ static void trie_collect_stats(struct tr
memset(s, 0, sizeof(*s));
 
rcu_read_lock();
-   for (n = fib_trie_get_first(iter, t); n;
-n = fib_trie_get_next(iter)) {
+   for (n = trie_get_first(iter, t); n; n = trie_get_next(iter)) {
if (IS_LEAF(n)) {
struct leaf *l = (struct leaf *)n;
struct leaf_info *li;
@@ -2207,35 +2200,46 @@ static void trie_show_usage(struct seq_f
   stats-resize_node_skipped);
 }
 
-
-static void fib_trie_show(struct seq_file *seq, const char *name,
- struct trie *trie)
+static void fib_table_print(struct seq_file *seq, struct fib_table *tb)
 {
-   struct trie_stat stat;
-
-   trie_collect_stats(trie, stat);
-   seq_printf(seq, %s:\n, name);
-   trie_show_stats(seq, stat);
-   trie_show_usage(seq, trie-stats);
+   if (tb-tb_id == RT_TABLE_LOCAL)
+   seq_puts(seq, Local:\n);
+   else if (tb-tb_id == RT_TABLE_MAIN)
+   seq_puts(seq, Main:\n);
+   else
+   seq_printf(seq, Id %d:\n, tb-tb_id);
 }
 
+
 static int fib_triestat_seq_show(struct seq_file *seq, void *v)
 {
struct net *net = (struct net *)seq-private;
-   struct fib_table *tb;
+   unsigned int h;
 
seq_printf(seq,
   Basic info: size of leaf:
%Zd bytes, size of tnode: %Zd bytes.\n,
   sizeof(struct leaf), sizeof(struct tnode));
 
-   tb = fib_get_table(net, RT_TABLE_LOCAL);
-   if (tb)
-   fib_trie_show(seq, Local, (struct trie *) tb-tb_data);
-
-   tb = fib_get_table(net, RT_TABLE_MAIN);
-   if (tb)
-   fib_trie_show(seq, Main, (struct trie *) tb-tb_data);
+   for (h = 0; h  FIB_TABLE_HASHSZ; h++) {
+   struct hlist_head *head = net-ipv4.fib_table_hash[h];
+   struct hlist_node *node;
+   struct fib_table *tb;
+
+   hlist_for_each_entry_rcu(tb, node, head, tb_hlist) {
+   struct trie *t = (struct trie *) tb-tb_data;
+   struct trie_stat stat;
+
+   if (!t)
+   continue;
+
+   fib_table_print(seq, tb);
+
+   trie_collect_stats(t, stat);
+   trie_show_stats(seq, stat);
+   trie_show_usage(seq, t-stats);
+   }
+   }
 
return 0;
 }
@@ -2265,23 +2269,30 @@ static const struct file_operations fib_
.release = fib_triestat_seq_release,
 };
 
-static struct node *fib_trie_get_idx(struct fib_trie_iter *iter,
- loff_t 

64bit counters: iproute(netlink) vs ifconfig

2008-02-13 Thread Krzysztof Oledzki

Hello,

Just discovered that counters returned by the ip tool are truncated:

# ip -s link show bond0
1: bond0: BROADCAST,MULTICAST,MASTER,UP,LOWER_UP mtu 1500 qdisc noqueue
link/ether 00:1d:09:67:6e:2f brd ff:ff:ff:ff:ff:ff
RX: bytes  packets  errors  dropped overrun mcast
2485605521 9010211  0   0   0   6
TX: bytes  packets  errors  dropped carrier collsns
3023237974 9345397  0   0   0   0

# ifconfig bond0
bond0 Link encap:Ethernet  HWaddr 00:1D:09:67:6E:2F
  inet addr:192.168.152.62  Bcast:192.168.152.255  Mask:255.255.255.0
  inet6 addr: fe80::21d:9ff:fe67:6e2f/64 Scope:Link
  UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
  RX packets:9010367 errors:0 dropped:351 overruns:0 frame:0
  TX packets:9345521 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0
  RX bytes:2485631020 (2370.4 Mb)  TX bytes:7318232294 (6979.2 Mb)

Is it possible to get 64-bit counters in ip via netlink? Struct 
rtnl_link_stats does not look very optimistic, as it has rx_bytes/tx_bytes 
defined with __u32.


Best regards,

Krzysztof Olędzki

Re: Patch to latest iproute to get it to compile on FC5

2008-02-13 Thread Stephen Hemminger
On Wed, 13 Feb 2008 11:32:32 -0800
Ben Greear [EMAIL PROTECTED] wrote:

 I notice that the latest snapshot and git repository for iproute
 will not compile on FC5 due to not finding __constant_hton* symbols
 and a lack of the hdlc/ioctl.h file on FC5.
 
 I am attaching a patch that appears to fix the problems for me.
 
 Please consider applying this or something similar.
 
 Signed-off-by:  Ben Greear [EMAIL PROTECTED]
 
 
 Thanks,
 Ben
 

No. please don't change the configure script.
And the linux/if.h comes from kernel stripped headers so it should
not get crufted up by ifdef's.

Short term fix is to include stripped hdlc header if needed.
Long fix is to get rid of hdlc dependency if possible.

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


[PATCH 2/3] fib_trie: improve output format for /proc/net/fib_trie

2008-02-13 Thread Stephen Hemminger
Make output format prettier (more tree like).

   local:
   --- 0.0.0.0/0
 |--- 10.111.111.0/24
 |  +-- 10.111.111.0/32 link broadcast
 |  |--- 10.111.111.254/31
 |  |  +-- 10.111.111.254/32 host local
 |  |  +-- 10.111.111.255/32 link broadcast
 |--- 127.0.0.0/8
 |  |--- 127.0.0.0/31
 |  |  +-- 127.0.0.0/32 link broadcast
 |  |  +-- 127.0.0.0/8 host local
 |  |  +-- 127.0.0.1/32 host local
 |  +-- 127.255.255.255/32 link broadcast
 |--- 192.168.1.0/24
 |  |--- 192.168.1.0/28
 |  |  +-- 192.168.1.0/32 link broadcast
 |  |  +-- 192.168.1.9/32 host local
 |  +-- 192.168.1.255/32 link broadcast
   main:
   --- 0.0.0.0/0
 |--- 0.0.0.0/4
 |  +-- 0.0.0.0/0 universe unicast
 |  +-- 10.111.111.0/24 link unicast
 +-- 169.254.0.0/16 link unicast
 +-- 192.168.1.0/24 link unicast
   
Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
---
 net/ipv4/fib_trie.c |  106 ++
 1 files changed, 55 insertions(+), 51 deletions(-)

--- a/net/ipv4/fib_trie.c   2008-02-13 11:33:43.0 -0800
+++ b/net/ipv4/fib_trie.c   2008-02-13 11:41:23.0 -0800
@@ -2334,46 +2334,57 @@ static void fib_trie_seq_stop(struct seq
rcu_read_unlock();
 }
 
+/* print left side of tree */
 static void seq_indent(struct seq_file *seq, int n)
 {
-   while (n--  0) seq_puts(seq,);
+   while (n--  0)
+   seq_puts(seq,   |);
 }
 
-static inline const char *rtn_scope(char *buf, size_t len, enum rt_scope_t s)
+static const char *rtn_type_names[__RTN_MAX] = {
+   [RTN_UNSPEC]= unspec,
+   [RTN_UNICAST]   = unicast,
+   [RTN_LOCAL] = local,
+   [RTN_BROADCAST] = broadcast,
+   [RTN_ANYCAST]   = anycast,
+   [RTN_MULTICAST] = multicast,
+   [RTN_BLACKHOLE] = blackhole,
+   [RTN_UNREACHABLE] = unreachable,
+   [RTN_PROHIBIT]  = prohibit,
+   [RTN_THROW] = throw,
+   [RTN_NAT]   = nat,
+   [RTN_XRESOLVE]  = xresolve,
+};
+
+static void fib_trie_show_alias(struct seq_file *seq, const struct fib_alias 
*fa)
 {
-   switch (s) {
-   case RT_SCOPE_UNIVERSE: return universe;
-   case RT_SCOPE_SITE: return site;
-   case RT_SCOPE_LINK: return link;
-   case RT_SCOPE_HOST: return host;
-   case RT_SCOPE_NOWHERE:  return nowhere;
+   switch (fa-fa_scope) {
+   case RT_SCOPE_UNIVERSE:
+   seq_puts(seq, universe);
+   break;
+   case RT_SCOPE_SITE:
+   seq_puts(seq,  site);
+   break;
+   case RT_SCOPE_LINK:
+   seq_puts(seq,  link);
+   break;
+   case RT_SCOPE_HOST:
+   seq_puts(seq,  host);
+   break;
+   case RT_SCOPE_NOWHERE:
+   seq_puts(seq,  nowhere);
+   break;
default:
-   snprintf(buf, len, scope=%d, s);
-   return buf;
+   seq_printf(seq, scope:%d, fa-fa_scope);
}
-}
 
-static const char *rtn_type_names[__RTN_MAX] = {
-   [RTN_UNSPEC] = UNSPEC,
-   [RTN_UNICAST] = UNICAST,
-   [RTN_LOCAL] = LOCAL,
-   [RTN_BROADCAST] = BROADCAST,
-   [RTN_ANYCAST] = ANYCAST,
-   [RTN_MULTICAST] = MULTICAST,
-   [RTN_BLACKHOLE] = BLACKHOLE,
-   [RTN_UNREACHABLE] = UNREACHABLE,
-   [RTN_PROHIBIT] = PROHIBIT,
-   [RTN_THROW] = THROW,
-   [RTN_NAT] = NAT,
-   [RTN_XRESOLVE] = XRESOLVE,
-};
+   if (fa-fa_type  __RTN_MAX  rtn_type_names[fa-fa_type])
+   seq_printf(seq,  %s, rtn_type_names[fa-fa_type]);
+   else
+   seq_printf(seq,  type:%u, fa-fa_type);
 
-static inline const char *rtn_type(char *buf, size_t len, unsigned t)
-{
-   if (t  __RTN_MAX  rtn_type_names[t])
-   return rtn_type_names[t];
-   snprintf(buf, len, type %u, t);
-   return buf;
+   if (fa-fa_tos)
+   seq_printf(seq,  tos:%#x, fa-fa_tos);
 }
 
 /* Pretty print the trie */
@@ -2396,10 +2407,8 @@ static int fib_trie_seq_show(struct seq_
struct tnode *tn = (struct tnode *) n;
__be32 prf = htonl(mask_pfx(tn-key, tn-pos));
 
-   seq_indent(seq, iter-depth-1);
-   seq_printf(seq,   +-- %d.%d.%d.%d/%d %d %d %d\n,
-  NIPQUAD(prf), tn-pos, tn-bits, tn-full_children,
-  tn-empty_children);
+   seq_indent(seq, iter-depth - 1);
+   seq_printf(seq, --- %d.%d.%d.%d/%d\n, NIPQUAD(prf), tn-pos);
 
} else {
struct leaf *l = (struct leaf *) n;
@@ -2407,24 +2416,19 @@ static int fib_trie_seq_show(struct seq_
struct hlist_node *node;
__be32 val = htonl(l-key);
 
-   seq_indent(seq, iter-depth);
-   seq_printf(seq,   |-- %d.%d.%d.%d\n, NIPQUAD(val));
-
hlist_for_each_entry_rcu(li, node, l-list, hlist) {

[PATCH 0/3] fib_trie: update (redo)

2008-02-13 Thread Stephen Hemminger
This supersedes yesterday's changes. It doesn't change list.h
because that seems to make people queasy, even if it is a clone
of existing code.  Moves the trie related special files to debugfs.

-- 
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 to latest iproute to get it to compile on FC5

2008-02-13 Thread Ben Greear

Stephen Hemminger wrote:

On Wed, 13 Feb 2008 11:32:32 -0800
Ben Greear [EMAIL PROTECTED] wrote:


I notice that the latest snapshot and git repository for iproute
will not compile on FC5 due to not finding __constant_hton* symbols
and a lack of the hdlc/ioctl.h file on FC5.

I am attaching a patch that appears to fix the problems for me.

Please consider applying this or something similar.

Signed-off-by:  Ben Greear [EMAIL PROTECTED]


Thanks,
Ben



I added include/linux/hdlc/ioctl.h to the santized headers in the
current git.



That seems to fix the hdlc issue, but it still will not link due to missing
symbols:

gcc -Wl,-export-dynamic  ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o 
rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o 
ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o ipxfrm.o xfrm_state.o xfrm_policy.o 
xfrm_monitor.o iplink_vlan.o link_veth.o ../lib/libnetlink.a ../lib/libutil.a  
-lresolv -L../lib -lnetlink -lutil -ldl -o ip
iptunnel.o: In function `parse_args':
iptunnel.c:(.text+0x2c6): undefined reference to `__constant_htons'
iptunnel.c:(.text+0x404): undefined reference to `__constant_htons'
iptunnel.c:(.text+0x48d): undefined reference to `__constant_htons'
iptunnel.c:(.text+0x4a6): undefined reference to `__constant_htons'
iptunnel.c:(.text+0x4e2): undefined reference to `__constant_htons'
iptunnel.o:iptunnel.c:(.text+0x4fb): more undefined references to 
`__constant_htons' follow
collect2: ld returned 1 exit status
make[1]: *** [ip] Error 1
make[1]: Leaving directory `/root/iproute2/ip'
make: *** [all] Error 2


The attached patch fixes this.

Thanks,
Ben


--
Ben Greear [EMAIL PROTECTED]
Candela Technologies Inc  http://www.candelatech.com

diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 228eb4e..0eb5b04 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -2,6 +2,7 @@
 #define _IF_TUNNEL_H_
 
 #include linux/types.h
+#include asm/byteorder.h
 
 #define SIOCGETTUNNEL   (SIOCDEVPRIVATE + 0)
 #define SIOCADDTUNNEL   (SIOCDEVPRIVATE + 1)


Re: [PATCh TAKE 2] [IPROUTE2] Add addrlabel sub-command.

2008-02-13 Thread Stephen Hemminger
On Thu, 14 Feb 2008 03:20:12 +1100 (EST)
YOSHIFUJI Hideaki / 吉藤英明  [EMAIL PROTECTED] wrote:

 Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
 ---
 diff --git a/ip/Makefile b/ip/Makefile
 index b427d58..d908817 100644
 --- a/ip/Makefile
 +++ b/ip/Makefile
 @@ -1,4 +1,4 @@
 -IPOBJ=ip.o ipaddress.o iproute.o iprule.o \
 +IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o \
  rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
  ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o \
  ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \
 diff --git a/ip/ip.c b/ip/ip.c
 index aeb8c68..c4c773f 100644
 --- a/ip/ip.c
 +++ b/ip/ip.c
 @@ -46,8 +46,8 @@ static void usage(void)
   fprintf(stderr,
  Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n
 ip [ -force ] [-batch filename\n
 -where  OBJECT := { link | addr | route | rule | neigh | ntable | tunnel |\n
 -   maddr | mroute | monitor | xfrm }\n
 +where  OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable 
 |\n
 +   tunnel | maddr | mroute | monitor | xfrm }\n
 OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] 
 |\n
  -f[amily] { inet | inet6 | ipx | dnet | link } |\n
  -o[neline] | -t[imestamp] }\n);
 @@ -64,6 +64,7 @@ static const struct cmd {
   int (*func)(int argc, char **argv);
  } cmds[] = {
   { address,do_ipaddr },
 + { addrlabel,  do_ipaddrlabel },
   { maddress,   do_multiaddr },
   { route,  do_iproute },
   { rule,   do_iprule },
 diff --git a/ip/ip_common.h b/ip/ip_common.h
 index 39f2507..1bbd50d 100644
 --- a/ip/ip_common.h
 +++ b/ip/ip_common.h
 @@ -4,6 +4,9 @@ extern int print_linkinfo(const struct sockaddr_nl *who,
  extern int print_addrinfo(const struct sockaddr_nl *who,
 struct nlmsghdr *n,
 void *arg);
 +extern int print_addrlabelinfo(const struct sockaddr_nl *who,
 +struct nlmsghdr *n,
 +void *arg);
  extern int print_neigh(const struct sockaddr_nl *who,
  struct nlmsghdr *n, void *arg);
  extern int print_ntable(const struct sockaddr_nl *who,
 @@ -23,6 +26,7 @@ extern int print_prefix(const struct sockaddr_nl *who,
  extern int print_rule(const struct sockaddr_nl *who,
 struct nlmsghdr *n, void *arg);
  extern int do_ipaddr(int argc, char **argv);
 +extern int do_ipaddrlabel(int argc, char **argv);
  extern int do_iproute(int argc, char **argv);
  extern int do_iprule(int argc, char **argv);
  extern int do_ipneigh(int argc, char **argv);
 diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c
 new file mode 100644
 index 000..1c873e9
 --- /dev/null
 +++ b/ip/ipaddrlabel.c
 @@ -0,0 +1,260 @@
 +/*
 + * ipaddrlabel.c ip addrlabel
 + *
 + * Copyright (C)2007 USAGI/WIDE Project
 + *
 + * 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.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 + *
 + *
 + * Based on iprule.c.
 + *
 + * Authors:  YOSHIFUJI Hideaki [EMAIL PROTECTED]
 + *
 + */
 +
 +#include stdio.h
 +#include stdlib.h
 +#include unistd.h
 +#include syslog.h
 +#include fcntl.h
 +#include sys/socket.h
 +#include netinet/in.h
 +#include netinet/ip.h
 +#include arpa/inet.h
 +#include string.h
 +#include linux/types.h
 +#include linux/if_addrlabel.h
 +
 +#include rt_names.h
 +#include utils.h
 +#include ip_common.h
 +
 +#define IFAL_RTA(r)  ((struct rtattr*)(((char*)(r)) + 
 NLMSG_ALIGN(sizeof(struct ifaddrlblmsg
 +#define IFAL_PAYLOAD(n)  NLMSG_PAYLOAD(n,sizeof(struct ifaddrlblmsg))
 +
 +extern struct rtnl_handle rth;
 +
 +static void usage(void) __attribute__((noreturn));
 +
 +static void usage(void)
 +{
 + fprintf(stderr, Usage: ip addrlabel [ list | add | del | flush ] 
 prefix PREFIX [ dev DEV ] [ label LABEL ]\n);
 + exit(-1);
 +}
 +
 +int print_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void 
 *arg)
 +{
 + FILE *fp = (FILE*)arg;
 + struct ifaddrlblmsg *ifal = NLMSG_DATA(n);
 + int len = n-nlmsg_len;
 + int host_len = -1;
 + struct rtattr *tb[IFAL_MAX+1];
 + char abuf[256];
 +
 + if (n-nlmsg_type != RTM_NEWADDRLABEL  n-nlmsg_type != 
 RTM_DELADDRLABEL)
 + return 0;
 +
 + len -= 

Re: 64bit counters: iproute(netlink) vs ifconfig

2008-02-13 Thread Stephen Hemminger
On Wed, 13 Feb 2008 21:20:59 +0100 (CET)
Krzysztof Oledzki [EMAIL PROTECTED] wrote:

 Hello,
 
 Just discovered that counters returned by the ip tool are truncated:
 
 # ip -s link show bond0
 1: bond0: BROADCAST,MULTICAST,MASTER,UP,LOWER_UP mtu 1500 qdisc noqueue
  link/ether 00:1d:09:67:6e:2f brd ff:ff:ff:ff:ff:ff
  RX: bytes  packets  errors  dropped overrun mcast
  2485605521 9010211  0   0   0   6
  TX: bytes  packets  errors  dropped carrier collsns
  3023237974 9345397  0   0   0   0
 
 # ifconfig bond0
 bond0 Link encap:Ethernet  HWaddr 00:1D:09:67:6E:2F
inet addr:192.168.152.62  Bcast:192.168.152.255  Mask:255.255.255.0
inet6 addr: fe80::21d:9ff:fe67:6e2f/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
RX packets:9010367 errors:0 dropped:351 overruns:0 frame:0
TX packets:9345521 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2485631020 (2370.4 Mb)  TX bytes:7318232294 (6979.2 Mb)
 
 Is it possible to get 64-bit counters in ip via netlink? Struct 
 rtnl_link_stats does not look very optimistic, as it has rx_bytes/tx_bytes 
 defined with __u32.
 
 Best regards,
 
   Krzysztof Olędzki

The problem is the kernel binary API is now hard coded to 32 bit values.

-- 
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 to latest iproute to get it to compile on FC5

2008-02-13 Thread Stephen Hemminger
On Wed, 13 Feb 2008 11:32:32 -0800
Ben Greear [EMAIL PROTECTED] wrote:

 I notice that the latest snapshot and git repository for iproute
 will not compile on FC5 due to not finding __constant_hton* symbols
 and a lack of the hdlc/ioctl.h file on FC5.
 
 I am attaching a patch that appears to fix the problems for me.
 
 Please consider applying this or something similar.
 
 Signed-off-by:  Ben Greear [EMAIL PROTECTED]
 
 
 Thanks,
 Ben
 

I added include/linux/hdlc/ioctl.h to the santized headers in the
current git.

-- 
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] [IPROUTE2] Update various classifiers' help output for expected CLASSID syntax

2008-02-13 Thread Stephen Hemminger
On Wed, 13 Feb 2008 03:49:09 -0800
PJ Waskiewicz [EMAIL PROTECTED] wrote:

 update: Fix the spelling of hexidecimal
 
 This updates the help output to specify that CLASSID should be hexidecimal.
 This makes sure that a user entering flowid 1:10 gets his flow put into
 band 15 (0x10) and knows why.
 
 Signed-off-by: Peter P Waskiewicz Jr [EMAIL PROTECTED]
 ---
 
  doc/actions/actions-general |3 +++
  tc/f_basic.c|1 +
  tc/f_fw.c   |1 +
  tc/f_route.c|1 +
  tc/f_rsvp.c |1 +
  tc/f_u32.c  |1 +
  6 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/doc/actions/actions-general b/doc/actions/actions-general
 index 6561eda..70f7cd6 100644
 --- a/doc/actions/actions-general
 +++ b/doc/actions/actions-general
 @@ -88,6 +88,9 @@ tc filter add dev lo parent : protocol ip prio 8 u32 \
  match ip dst 127.0.0.8/32 flowid 1:12 \
  action ipt -j mark --set-mark 2
  
 +NOTE: flowid 1:12 is parsed flowid 0x1:0x12.  Make sure if you want flowid
 +decimal 12, then use flowid 1:c.
 +
  3) A feature i call pipe
  The motivation is derived from Unix pipe mechanism but applied to packets.
  Essentially take a matching packet and pass it through 
 diff --git a/tc/f_basic.c b/tc/f_basic.c
 index 19a7edf..aab946b 100644
 --- a/tc/f_basic.c
 +++ b/tc/f_basic.c
 @@ -32,6 +32,7 @@ static void explain(void)
   fprintf(stderr, \n);
   fprintf(stderr, Where: SELECTOR := SAMPLE SAMPLE ...\n);
   fprintf(stderr,FILTERID := X:Y:Z\n);
 + fprintf(stderr, \nNOTE: CLASSID is parsed as hexadecimal input.\n);
  }
  
  static int basic_parse_opt(struct filter_util *qu, char *handle,
 diff --git a/tc/f_fw.c b/tc/f_fw.c
 index 6d1490b..b511735 100644
 --- a/tc/f_fw.c
 +++ b/tc/f_fw.c
 @@ -28,6 +28,7 @@ static void explain(void)
   fprintf(stderr, Usage: ... fw [ classid CLASSID ] [ police POLICE_SPEC 
 ]\n);
   fprintf(stderr,POLICE_SPEC := ... look at TBF\n);
   fprintf(stderr,CLASSID := X:Y\n);
 + fprintf(stderr, \nNOTE: CLASSID is parsed as hexadecimal input.\n);
  }
  
  #define usage() return(-1)
 diff --git a/tc/f_route.c b/tc/f_route.c
 index a41b9d5..67dd49c 100644
 --- a/tc/f_route.c
 +++ b/tc/f_route.c
 @@ -31,6 +31,7 @@ static void explain(void)
   fprintf(stderr, [ flowid CLASSID ] [ police 
 POLICE_SPEC ]\n);
   fprintf(stderr,POLICE_SPEC := ... look at TBF\n);
   fprintf(stderr,CLASSID := X:Y\n);
 + fprintf(stderr, \nNOTE: CLASSID is parsed as hexadecimal input.\n);
  }
  
  #define usage() return(-1)
 diff --git a/tc/f_rsvp.c b/tc/f_rsvp.c
 index 13fcf97..7e1e6d9 100644
 --- a/tc/f_rsvp.c
 +++ b/tc/f_rsvp.c
 @@ -34,6 +34,7 @@ static void explain(void)
   fprintf(stderr, u{8|16|32} NUMBER mask MASK at 
 OFFSET}\n);
   fprintf(stderr,POLICE_SPEC := ... look at TBF\n);
   fprintf(stderr,FILTERID := X:Y\n);
 + fprintf(stderr, \nNOTE: CLASSID is parsed as hexadecimal input.\n);
  }
  
  #define usage() return(-1)
 diff --git a/tc/f_u32.c b/tc/f_u32.c
 index 91f2838..d75e76c 100644
 --- a/tc/f_u32.c
 +++ b/tc/f_u32.c
 @@ -36,6 +36,7 @@ static void explain(void)
   fprintf(stderr, Where: SELECTOR := SAMPLE SAMPLE ...\n);
   fprintf(stderr,SAMPLE := { ip | ip6 | udp | tcp | icmp | 
 u{32|16|8} | mark } SAMPLE_ARGS [divisor DIVISOR]\n);
   fprintf(stderr,FILTERID := X:Y:Z\n);
 + fprintf(stderr, \nNOTE: CLASSID is parsed at hexadecimal input.\n);
  }
  
  #define usage() return(-1)
 
 --
 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
 

applied

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


[PATCH] [resend] 3c509: convert to isa_driver and pnp_driver v5

2008-02-13 Thread Ondrej Zary
Hello,
this patch converts 3c509 driver to isa_driver and pnp_driver. The result is 
that autoloading using udev and hibernation works with ISA PnP cards. It also 
adds hibernation support for non-PnP ISA cards.

xcvr module parameter was removed as its value was not used.

Tested using 3 ISA cards in various combinations of PnP and non-PnP modes. 
EISA and MCA only compile-tested.

Signed-off-by: Ondrej Zary [EMAIL PROTECTED]

--- linux-2.6.24-orig/drivers/net/3c509.c   2008-01-27 19:48:19.0 
+0100
+++ linux-2.6.24-pentium/drivers/net/3c509.c2008-02-10 21:52:04.0 
+0100
@@ -54,25 +54,24 @@
v1.19a 28Oct2002 Davud Ruggiero [EMAIL PROTECTED]
- Increase *read_eeprom udelay to workaround oops with 
2 cards.
v1.19b 08Nov2002 Marc Zyngier [EMAIL PROTECTED]
-   - Introduce driver model for EISA cards.
+   - Introduce driver model for EISA cards.
+   v1.20  04Feb2008 Ondrej Zary [EMAIL PROTECTED]
+   - convert to isa_driver and pnp_driver and some cleanups
 */
 
 #define DRV_NAME   3c509
-#define DRV_VERSION1.19b
-#define DRV_RELDATE08Nov2002
+#define DRV_VERSION1.20
+#define DRV_RELDATE04Feb2008
 
 /* A few values that may be tweaked. */
 
 /* Time in jiffies before concluding the transmitter is hung. */
 #define TX_TIMEOUT  (400*HZ/1000)
-/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
-static int max_interrupt_work = 10;
 
 #include linux/module.h
-#ifdef CONFIG_MCA
 #include linux/mca.h
-#endif
-#include linux/isapnp.h
+#include linux/isa.h
+#include linux/pnp.h
 #include linux/string.h
 #include linux/interrupt.h
 #include linux/errno.h
@@ -97,10 +96,6 @@
 
 static char version[] __initdata = DRV_NAME .c: DRV_VERSION   DRV_RELDATE 
 [EMAIL PROTECTED];
 
-#if defined(CONFIG_PM)  (defined(CONFIG_MCA) || defined(CONFIG_EISA))
-#define EL3_SUSPEND
-#endif
-
 #ifdef EL3_DEBUG
 static int el3_debug = EL3_DEBUG;
 #else
@@ -111,6 +106,7 @@
  * a global variable so that the mca/eisa probe routines can increment
  * it */
 static int el3_cards = 0;
+#define EL3_MAX_CARDS 8
 
 /* To minimize the size of the driver source I only define operating
constants if they are used several times.  You'll need the manual
@@ -119,7 +115,7 @@
 #define EL3_DATA 0x00
 #define EL3_CMD 0x0e
 #define EL3_STATUS 0x0e
-#define EEPROM_READ 0x80
+#defineEEPROM_READ 0x80
 
 #define EL3_IO_EXTENT  16
 
@@ -168,23 +164,31 @@
  */
 #define SKB_QUEUE_SIZE 64
 
+enum el3_cardtype { EL3_ISA, EL3_PNP, EL3_MCA, EL3_EISA };
+
 struct el3_private {
struct net_device_stats stats;
-   struct net_device *next_dev;
spinlock_t lock;
/* skb send-queue */
int head, size;
struct sk_buff *queue[SKB_QUEUE_SIZE];
-   enum {
-   EL3_MCA,
-   EL3_PNP,
-   EL3_EISA,
-   } type; /* type of device */
-   struct device *dev;
+   enum el3_cardtype type;
 };
-static int id_port __initdata = 0x110; /* Start with 0x110 to avoid new sound 
cards.*/
-static struct net_device *el3_root_dev;
+static int id_port;
+static int current_tag;
+static struct net_device *el3_devs[EL3_MAX_CARDS];
+
+/* Parameters that may be passed into the module. */
+static int debug = -1;
+static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1};
+/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
+static int max_interrupt_work = 10;
+#ifdef CONFIG_PNP
+static int nopnp;
+#endif
 
+static int __init el3_common_init(struct net_device *dev);
+static void el3_common_remove(struct net_device *dev);
 static ushort id_read_eeprom(int index);
 static ushort read_eeprom(int ioaddr, int index);
 static int el3_open(struct net_device *dev);
@@ -199,23 +203,279 @@
 static void el3_down(struct net_device *dev);
 static void el3_up(struct net_device *dev);
 static const struct ethtool_ops ethtool_ops;
-#ifdef EL3_SUSPEND
+#ifdef CONFIG_PM
 static int el3_suspend(struct device *, pm_message_t);
 static int el3_resume(struct device *);
-#else
-#define el3_suspend NULL
-#define el3_resume NULL
 #endif
 
 
 /* generic device remove for all device types */
-#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
 static int el3_device_remove (struct device *device);
-#endif
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void el3_poll_controller(struct net_device *dev);
 #endif
 
+/* Return 0 on success, 1 on error, 2 when found already detected PnP card */
+static int el3_isa_id_sequence(__be16 *phys_addr)
+{
+   short lrs_state = 0xff;
+   int i;
+
+   /* ISA boards are detected by sending the ID sequence to the
+  ID_PORT.  We find cards past the first by setting the 'current_tag'
+  on cards as they are found.  Cards with their tag set will not
+  respond to subsequent ID sequences. */
+
+   outb(0x00, id_port);
+   outb(0x00, 

[2.6 patch] unexport __inet_hash_connect

2008-02-13 Thread Adrian Bunk
This patch removes the unused EXPORT_SYMBOL_GPL(__inet_hash_connect).

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---
ffa30930d4ba630514fd93ded245456f05358140 diff --git 
a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 9cac6c0..e6a0072 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -494,7 +494,6 @@ out:
return ret;
}
 }
-EXPORT_SYMBOL_GPL(__inet_hash_connect);
 
 /*
  * Bind a port for a connect operation and hash it.

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


[2.6 patch] unexport inet_listen_wlock

2008-02-13 Thread Adrian Bunk
This patch removes the no linger used EXPORT_SYMBOL(inet_listen_wlock).

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---
08c580a0a3219ce72f5c534c8868e75c4c224e01 diff --git 
a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index e6a0072..1aba606 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -120,8 +120,6 @@ void inet_listen_wlock(struct inet_hashinfo *hashinfo)
}
 }
 
-EXPORT_SYMBOL(inet_listen_wlock);
-
 /*
  * Don't inline this cruft. Here are some nice properties to exploit here. The
  * BSD API does not allow a listening sock to specify the remote port nor the

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


[2.6 patch] make s2io.c:init_tti() static

2008-02-13 Thread Adrian Bunk
This patch makes the needlessly global init_tti() static.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

This patch has been sent on:
- 30 Jan 2008

1e8c2b07be955b181814e4c24366517a66557908 
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 5fab7d7..bc94e84 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -1088,7 +1088,7 @@ static int s2io_print_pci_mode(struct s2io_nic *nic)
  *  '-1' on failure
  */
 
-int init_tti(struct s2io_nic *nic, int link)
+static int init_tti(struct s2io_nic *nic, int link)
 {
struct XENA_dev_config __iomem *bar0 = nic-bar0;
register u64 val64 = 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: [2.6 patch] make s2io.c:init_tti() static

2008-02-13 Thread Ramkrishna Vepa
Please apply. Looks good.

Ram

 -Original Message-
 From: Adrian Bunk [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, February 13, 2008 1:31 PM
 To: Surjit Reang; Sreenivasa Honnur; Ramkrishna Vepa; Rastapur
Santosh;
 Sivakumar Subramani
 Cc: netdev@vger.kernel.org; [EMAIL PROTECTED]
 Subject: [2.6 patch] make s2io.c:init_tti() static
 
 This patch makes the needlessly global init_tti() static.
 
 Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
 
 ---
 
 This patch has been sent on:
 - 30 Jan 2008
 
 1e8c2b07be955b181814e4c24366517a66557908
 diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
 index 5fab7d7..bc94e84 100644
 --- a/drivers/net/s2io.c
 +++ b/drivers/net/s2io.c
 @@ -1088,7 +1088,7 @@ static int s2io_print_pci_mode(struct s2io_nic
*nic)
   *  '-1' on failure
   */
 
 -int init_tti(struct s2io_nic *nic, int link)
 +static int init_tti(struct s2io_nic *nic, int link)
  {
   struct XENA_dev_config __iomem *bar0 = nic-bar0;
   register u64 val64 = 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


[PATCH 1/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Paul E. McKenney
Hello!

This is an updated version of the patch posted last November:

http://archives.free.net.ph/message/20071201.003721.cd6ff17c.en.html

This new version permits arguments with side effects, for example:

rcu_assign_pointer(global_p, p++);

and also verifies that the arguments are pointers, while still avoiding
the unnecessary memory barrier when assigning NULL to a pointer.
This memory-barrier avoidance means that rcu_assign_pointer() is now only
permitted for pointers (not array indexes), and so this version emits a
compiler warning if the first argument is not a pointer.  I built a make
allyesconfig version on an x86 system, and received no such warnings.
If RCU is ever applied to array indexes, then the second patch in this
series should be applied, and the resulting rcu_assign_index() be used.

Given the rather surprising history of subtlely broken implementations of
rcu_assign_pointer(), I took the precaution of generating a full set of
test cases and verified that memory barriers and compiler warnings were
emitted when required.  I guess it is the simple things that get you...

Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
---

 rcupdate.h |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff -urpNa -X dontdiff linux-2.6.24/include/linux/rcupdate.h 
linux-2.6.24-rap/include/linux/rcupdate.h
--- linux-2.6.24/include/linux/rcupdate.h   2008-01-24 14:58:37.0 
-0800
+++ linux-2.6.24-rap/include/linux/rcupdate.h   2008-02-13 13:36:47.0 
-0800
@@ -270,12 +270,20 @@ extern struct lockdep_map rcu_lock_map;
  * structure after the pointer assignment.  More importantly, this
  * call documents which pointers will be dereferenced by RCU read-side
  * code.
+ *
+ * Throws a compiler warning for non-pointer arguments.
+ *
+ * Does not insert a memory barrier for a NULL pointer.
  */
 
-#define rcu_assign_pointer(p, v)   ({ \
-   smp_wmb(); \
-   (p) = (v); \
-   })
+#define rcu_assign_pointer(p, v)   \
+   ({ \
+   typeof(*p) *_p1 = (v); \
+   \
+   if (!__builtin_constant_p(v) || (_p1 != NULL)) \
+   smp_wmb(); \
+   (p) = _p1; \
+   })
 
 /**
  * synchronize_sched - block until all CPUs have exited any non-preemptive
--
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/2] add rcu_assign_index() if ever needed

2008-02-13 Thread Paul E. McKenney
Hello again!

This is a speculative patch that as far as I can tell is not yet required.
If anyone applies RCU to a data structure allocated out of an array, using
array indexes in place of pointers to link the array elements together,
then the rcu_assign_index() function in this patch will be needed to
assign a given element's array index to the RCU-traversed index.  The
implementation is exactly that of the old rcu_assign_pointer(), so is
extremely well tested.

The existing rcu_assign_pointer() will emit a compiler warning in cases
where rcu_assign_index() is required.

Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
---

 rcupdate.h |   18 ++
 1 file changed, 18 insertions(+)

diff -urpNa -X dontdiff linux-2.6.24-rap/include/linux/rcupdate.h 
linux-2.6.24-rai/include/linux/rcupdate.h
--- linux-2.6.24-rap/include/linux/rcupdate.h   2008-02-13 13:36:47.0 
-0800
+++ linux-2.6.24-rai/include/linux/rcupdate.h   2008-02-13 10:55:40.0 
-0800
@@ -286,6 +286,24 @@ extern struct lockdep_map rcu_lock_map;
})
 
 /**
+ * rcu_assign_index - assign (publicize) a index of a newly
+ * initialized array elementg that will be dereferenced by RCU
+ * read-side critical sections.  Returns the value assigned.
+ *
+ * Inserts memory barriers on architectures that require them
+ * (pretty much all of them other than x86), and also prevents
+ * the compiler from reordering the code that initializes the
+ * structure after the index assignment.  More importantly, this
+ * call documents which indexes will be dereferenced by RCU read-side
+ * code.
+ */
+
+#define rcu_assign_index(p, v) ({ \
+   smp_wmb(); \
+   (p) = (v); \
+   })
+
+/**
  * synchronize_sched - block until all CPUs have exited any non-preemptive
  * kernel code sequences.
  *
--
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/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Andrew Morton
On Wed, 13 Feb 2008 14:00:24 -0800
Paul E. McKenney [EMAIL PROTECTED] wrote:

 Hello!
 
 This is an updated version of the patch posted last November:
 
   http://archives.free.net.ph/message/20071201.003721.cd6ff17c.en.html
 
 This new version permits arguments with side effects, for example:
 
   rcu_assign_pointer(global_p, p++);
 
 and also verifies that the arguments are pointers, while still avoiding
 the unnecessary memory barrier when assigning NULL to a pointer.
 This memory-barrier avoidance means that rcu_assign_pointer() is now only
 permitted for pointers (not array indexes), and so this version emits a
 compiler warning if the first argument is not a pointer.  I built a make
 allyesconfig version on an x86 system, and received no such warnings.
 If RCU is ever applied to array indexes, then the second patch in this
 series should be applied, and the resulting rcu_assign_index() be used.
 
 Given the rather surprising history of subtlely broken implementations of
 rcu_assign_pointer(), I took the precaution of generating a full set of
 test cases and verified that memory barriers and compiler warnings were
 emitted when required.  I guess it is the simple things that get you...
 
 Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
 ---
 
  rcupdate.h |   16 
  1 file changed, 12 insertions(+), 4 deletions(-)
 
 diff -urpNa -X dontdiff linux-2.6.24/include/linux/rcupdate.h 
 linux-2.6.24-rap/include/linux/rcupdate.h
 --- linux-2.6.24/include/linux/rcupdate.h 2008-01-24 14:58:37.0 
 -0800
 +++ linux-2.6.24-rap/include/linux/rcupdate.h 2008-02-13 13:36:47.0 
 -0800

whoop, ancient kernel alert.

 @@ -270,12 +270,20 @@ extern struct lockdep_map rcu_lock_map;
   * structure after the pointer assignment.  More importantly, this
   * call documents which pointers will be dereferenced by RCU read-side
   * code.
 + *
 + * Throws a compiler warning for non-pointer arguments.
 + *
 + * Does not insert a memory barrier for a NULL pointer.
   */
  
 -#define rcu_assign_pointer(p, v) ({ \
 - smp_wmb(); \
 - (p) = (v); \
 - })
 +#define rcu_assign_pointer(p, v) \
 + ({ \
 + typeof(*p) *_p1 = (v); \
 + \
 + if (!__builtin_constant_p(v) || (_p1 != NULL)) \
 + smp_wmb(); \
 + (p) = _p1; \
 + })

Someone already merged the dont-do-it-for-NULL patch so I reworked this
appropriately.  Was too lazy to update the changelog though.

--
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: BUG: 2.6.25-rc1: iptables postrouting setup causes oops

2008-02-13 Thread Ben Nizette

On Wed, 2008-02-13 at 00:48 -0800, Andrew Morton wrote:
 On Tue, 12 Feb 2008 22:46:01 +1100 Ben Nizette [EMAIL PROTECTED] wrote:

  Perfectly repeatable.
 
 If my theory is correct, changing pretty much anything in the kernel config
 might just make it go away.  But still, it would be most valuable if you
 could try running a bisection search, as described in
 http://www.kernel.org/doc/local/git-quick.html, thanks.
 

Hm, not as stable a bug as I'd thought.  I have performed a number of
bisections with different start points and they have not converged on
the same patch twice.  Even bisections with the _same_ start point
didn't always converge on the same patch.

What ever the problem is it isn't immediately apparent in latest git so
I guess we'll just have to keep our eyes peeled.

Thanks,
--Ben.
--
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/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Paul E. McKenney
On Wed, Feb 13, 2008 at 02:35:37PM -0800, Stephen Hemminger wrote:
 On Wed, 13 Feb 2008 14:00:24 -0800
 Paul E. McKenney [EMAIL PROTECTED] wrote:
 
  Hello!
  
  This is an updated version of the patch posted last November:
  
  http://archives.free.net.ph/message/20071201.003721.cd6ff17c.en.html
  
  This new version permits arguments with side effects, for example:
  
  rcu_assign_pointer(global_p, p++);
  
  and also verifies that the arguments are pointers, while still avoiding
  the unnecessary memory barrier when assigning NULL to a pointer.
  This memory-barrier avoidance means that rcu_assign_pointer() is now only
  permitted for pointers (not array indexes), and so this version emits a
  compiler warning if the first argument is not a pointer.  I built a make
  allyesconfig version on an x86 system, and received no such warnings.
  If RCU is ever applied to array indexes, then the second patch in this
  series should be applied, and the resulting rcu_assign_index() be used.
  
  Given the rather surprising history of subtlely broken implementations of
  rcu_assign_pointer(), I took the precaution of generating a full set of
  test cases and verified that memory barriers and compiler warnings were
  emitted when required.  I guess it is the simple things that get you...
  
  Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
  ---
  
   rcupdate.h |   16 
   1 file changed, 12 insertions(+), 4 deletions(-)
  
  diff -urpNa -X dontdiff linux-2.6.24/include/linux/rcupdate.h 
  linux-2.6.24-rap/include/linux/rcupdate.h
  --- linux-2.6.24/include/linux/rcupdate.h   2008-01-24 14:58:37.0 
  -0800
  +++ linux-2.6.24-rap/include/linux/rcupdate.h   2008-02-13 
  13:36:47.0 -0800
  @@ -270,12 +270,20 @@ extern struct lockdep_map rcu_lock_map;
* structure after the pointer assignment.  More importantly, this
* call documents which pointers will be dereferenced by RCU read-side
* code.
  + *
  + * Throws a compiler warning for non-pointer arguments.
  + *
  + * Does not insert a memory barrier for a NULL pointer.
*/
   
  -#define rcu_assign_pointer(p, v)   ({ \
  -   smp_wmb(); \
  -   (p) = (v); \
  -   })
  +#define rcu_assign_pointer(p, v)   \
  +   ({ \
  +   typeof(*p) *_p1 = (v); \
  +   \
  +   if (!__builtin_constant_p(v) || (_p1 != NULL)) \
  +   smp_wmb(); \
  +   (p) = _p1; \
  +   })
   
   /**
* synchronize_sched - block until all CPUs have exited any non-preemptive
 
 Will this still work if p is unsigned long?

Hello, Steve,

If p is unsigned long, then use rcu_assign_index() from the next patch in
the set.  Looks like Andrew has applied it to -mm -- so please make sure
that he is aware if you do use it.

Thanx, Paul
--
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: [RFC, PATCH]: Pass link level header from/to PPP interface

2008-02-13 Thread David Miller
From: Urs Thuermann [EMAIL PROTECTED]
Date: 13 Feb 2008 17:56:00 +0100

 Do you consider this strong enough to justify this change?

Can tcpdump and libpcap already handle PPP properly?
--
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] fib_trie: rcu_assign_pointer warning fix

2008-02-13 Thread Paul E. McKenney
On Tue, Feb 12, 2008 at 08:46:30PM +0100, Jarek Poplawski wrote:
 On Tue, Feb 12, 2008 at 08:32:18PM +0100, Jarek Poplawski wrote:
 ...
  It seems the above version of this macro uses the barrier for 0, but
  if I miss something, or for these other: documenting reasons,
 
 ...or __builtin_constants could be used for indexing (?!),

Yep.  For example:

elem[0].next = 1;
rcu_assign_index(global_index, 0);

Thanx, Paul

  then of
  course you are right.
 
 Jarek P.
--
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/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Paul E. McKenney
On Wed, Feb 13, 2008 at 02:42:33PM -0800, Stephen Hemminger wrote:
 On Wed, 13 Feb 2008 14:41:34 -0800
 Paul E. McKenney [EMAIL PROTECTED] wrote:
 
  On Wed, Feb 13, 2008 at 02:35:37PM -0800, Stephen Hemminger wrote:
   On Wed, 13 Feb 2008 14:00:24 -0800
   Paul E. McKenney [EMAIL PROTECTED] wrote:
   
Hello!

This is an updated version of the patch posted last November:


http://archives.free.net.ph/message/20071201.003721.cd6ff17c.en.html

This new version permits arguments with side effects, for example:

rcu_assign_pointer(global_p, p++);

and also verifies that the arguments are pointers, while still avoiding
the unnecessary memory barrier when assigning NULL to a pointer.
This memory-barrier avoidance means that rcu_assign_pointer() is now 
only
permitted for pointers (not array indexes), and so this version emits a
compiler warning if the first argument is not a pointer.  I built a 
make
allyesconfig version on an x86 system, and received no such warnings.
If RCU is ever applied to array indexes, then the second patch in this
series should be applied, and the resulting rcu_assign_index() be used.

Given the rather surprising history of subtlely broken implementations 
of
rcu_assign_pointer(), I took the precaution of generating a full set of
test cases and verified that memory barriers and compiler warnings were
emitted when required.  I guess it is the simple things that get you...

Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
---

 rcupdate.h |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff -urpNa -X dontdiff linux-2.6.24/include/linux/rcupdate.h 
linux-2.6.24-rap/include/linux/rcupdate.h
--- linux-2.6.24/include/linux/rcupdate.h   2008-01-24 
14:58:37.0 -0800
+++ linux-2.6.24-rap/include/linux/rcupdate.h   2008-02-13 
13:36:47.0 -0800
@@ -270,12 +270,20 @@ extern struct lockdep_map rcu_lock_map;
  * structure after the pointer assignment.  More importantly, this
  * call documents which pointers will be dereferenced by RCU read-side
  * code.
+ *
+ * Throws a compiler warning for non-pointer arguments.
+ *
+ * Does not insert a memory barrier for a NULL pointer.
  */
 
-#define rcu_assign_pointer(p, v)   ({ \
-   smp_wmb(); \
-   (p) = (v); \
-   })
+#define rcu_assign_pointer(p, v)   \
+   ({ \
+   typeof(*p) *_p1 = (v); \
+   \
+   if (!__builtin_constant_p(v) || (_p1 != NULL)) \
+   smp_wmb(); \
+   (p) = _p1; \
+   })
 
 /**
  * synchronize_sched - block until all CPUs have exited any 
non-preemptive
   
   Will this still work if p is unsigned long?
  
  Hello, Steve,
  
  If p is unsigned long, then use rcu_assign_index() from the next patch in
  the set.  Looks like Andrew has applied it to -mm -- so please make sure
  that he is aware if you do use it.
 
 Make sure fib_trie still works and doesn't get warnings.

Ah.  It does take a bit to get fib_trie into one's build -- allyesconfig
doesn't cut it.  Please accept my apologies for my confusion!!!

Once fib_trie is configured, I do indeed get:

net/ipv4/fib_trie.c: In function ‘node_set_parent’:
net/ipv4/fib_trie.c:182: warning: comparison between pointer and integer

So, given that node-parent is an unsigned long, I changed node_set_parent()
to the following:

static inline void node_set_parent(struct node *node, struct tnode *ptr)
{
rcu_assign_index(node-parent, (unsigned long)ptr | NODE_TYPE(node));
}

This removes the warnings.  I am a little ambivalent about this, as
this is really a pointer in disguise rather than an array index, but
patch below.  I suppose that another option would be to make node-parent
be a void* and provide appropriate accessor functions/macros.

Thoughts?

Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
---

 fib_trie.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff -urpNa -X dontdiff linux-2.6.25-rc1/net/ipv4/fib_trie.c 
linux-2.6.25-rc1-fib_trie-warn.compile/net/ipv4/fib_trie.c
--- linux-2.6.25-rc1/net/ipv4/fib_trie.c2008-02-13 14:38:12.0 
-0800
+++ linux-2.6.25-rc1-fib_trie-warn.compile/net/ipv4/fib_trie.c  2008-02-13 
15:22:02.0 -0800
@@ -179,8 +179,7 @@ static inline struct tnode *node_parent_
 
 static inline void node_set_parent(struct node *node, struct tnode *ptr)
 {
-   rcu_assign_pointer(node-parent,
-  (unsigned long)ptr | NODE_TYPE(node));
+   rcu_assign_index(node-parent, (unsigned long)ptr | NODE_TYPE(node));
 }
 
 static inline struct node 

Re: [PATCH 1/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread David Miller
From: Andrew Morton [EMAIL PROTECTED]
Date: Wed, 13 Feb 2008 15:52:45 -0800

 On Wed, 13 Feb 2008 15:37:44 -0800
 Paul E. McKenney [EMAIL PROTECTED] wrote:
 
  Ah.  It does take a bit to get fib_trie into one's build -- allyesconfig
  doesn't cut it.
 
 This is not good.  The sole purpose of allmodconfig and allyesconfig is for
 compilation and linkage coverage testing.  Hence we should aim to get as
 much code as possible included in those cases.

Well, in this case there is a choice, either you use one routing
lookup datastructure or the other.  It's not purposefully being hidden
from the everything builds :-)
--
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


Network namespace and tc?

2008-02-13 Thread Stephen Hemminger
It looks like tc filter won't work on alternate namespaces:
/* Add/change/delete/get a filter node */

static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
{
...

if (net != init_net)
return -EINVAL;


Haven't played with namespace virtualization yet, but what else is
not supported?  Where is this documented?
--
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/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Andrew Morton
On Wed, 13 Feb 2008 15:37:44 -0800
Paul E. McKenney [EMAIL PROTECTED] wrote:

 Ah.  It does take a bit to get fib_trie into one's build -- allyesconfig
 doesn't cut it.

This is not good.  The sole purpose of allmodconfig and allyesconfig is for
compilation and linkage coverage testing.  Hence we should aim to get as
much code as possible included in those cases.

--
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/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Stephen Hemminger
On Wed, 13 Feb 2008 15:37:44 -0800
Paul E. McKenney [EMAIL PROTECTED] wrote:

 On Wed, Feb 13, 2008 at 02:42:33PM -0800, Stephen Hemminger wrote:
  On Wed, 13 Feb 2008 14:41:34 -0800
  Paul E. McKenney [EMAIL PROTECTED] wrote:
  
   On Wed, Feb 13, 2008 at 02:35:37PM -0800, Stephen Hemminger wrote:
On Wed, 13 Feb 2008 14:00:24 -0800
Paul E. McKenney [EMAIL PROTECTED] wrote:

 Hello!
 
 This is an updated version of the patch posted last November:
 
   
 http://archives.free.net.ph/message/20071201.003721.cd6ff17c.en.html
 
 This new version permits arguments with side effects, for example:
 
   rcu_assign_pointer(global_p, p++);
 
 and also verifies that the arguments are pointers, while still 
 avoiding
 the unnecessary memory barrier when assigning NULL to a pointer.
 This memory-barrier avoidance means that rcu_assign_pointer() is now 
 only
 permitted for pointers (not array indexes), and so this version emits 
 a
 compiler warning if the first argument is not a pointer.  I built a 
 make
 allyesconfig version on an x86 system, and received no such warnings.
 If RCU is ever applied to array indexes, then the second patch in this
 series should be applied, and the resulting rcu_assign_index() be 
 used.
 
 Given the rather surprising history of subtlely broken 
 implementations of
 rcu_assign_pointer(), I took the precaution of generating a full set 
 of
 test cases and verified that memory barriers and compiler warnings 
 were
 emitted when required.  I guess it is the simple things that get 
 you...
 
 Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
 ---
 
  rcupdate.h |   16 
  1 file changed, 12 insertions(+), 4 deletions(-)
 
 diff -urpNa -X dontdiff linux-2.6.24/include/linux/rcupdate.h 
 linux-2.6.24-rap/include/linux/rcupdate.h
 --- linux-2.6.24/include/linux/rcupdate.h 2008-01-24 
 14:58:37.0 -0800
 +++ linux-2.6.24-rap/include/linux/rcupdate.h 2008-02-13 
 13:36:47.0 -0800
 @@ -270,12 +270,20 @@ extern struct lockdep_map rcu_lock_map;
   * structure after the pointer assignment.  More importantly, this
   * call documents which pointers will be dereferenced by RCU 
 read-side
   * code.
 + *
 + * Throws a compiler warning for non-pointer arguments.
 + *
 + * Does not insert a memory barrier for a NULL pointer.
   */
  
 -#define rcu_assign_pointer(p, v) ({ \
 - smp_wmb(); \
 - (p) = (v); \
 - })
 +#define rcu_assign_pointer(p, v) \
 + ({ \
 + typeof(*p) *_p1 = (v); \
 + \
 + if (!__builtin_constant_p(v) || (_p1 != NULL)) \
 + smp_wmb(); \
 + (p) = _p1; \
 + })
  
  /**
   * synchronize_sched - block until all CPUs have exited any 
 non-preemptive

Will this still work if p is unsigned long?
   
   Hello, Steve,
   
   If p is unsigned long, then use rcu_assign_index() from the next patch in
   the set.  Looks like Andrew has applied it to -mm -- so please make sure
   that he is aware if you do use it.
  
  Make sure fib_trie still works and doesn't get warnings.
 
 Ah.  It does take a bit to get fib_trie into one's build -- allyesconfig
 doesn't cut it.  Please accept my apologies for my confusion!!!
 
 Once fib_trie is configured, I do indeed get:
 
 net/ipv4/fib_trie.c: In function ‘node_set_parent’:
 net/ipv4/fib_trie.c:182: warning: comparison between pointer and integer
 
 So, given that node-parent is an unsigned long, I changed node_set_parent()
 to the following:
 
 static inline void node_set_parent(struct node *node, struct tnode *ptr)
 {
   rcu_assign_index(node-parent, (unsigned long)ptr | NODE_TYPE(node));
 }
 
 This removes the warnings.  I am a little ambivalent about this, as
 this is really a pointer in disguise rather than an array index, but
 patch below.  I suppose that another option would be to make node-parent
 be a void* and provide appropriate accessor functions/macros.
 
 Thoughts?
 
 Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]

Maybe cast both sides to void * in this case:

static inline void node_set_parent(struct node *node, struct tnode *ptr)
{
rcu_assign_pointer((void *) node-parent, (void *)((unsigned long)ptr | 
NODE_TYPE(node)));
}

-- 
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 1/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Stephen Hemminger
On Wed, 13 Feb 2008 15:52:45 -0800
Andrew Morton [EMAIL PROTECTED] wrote:

 On Wed, 13 Feb 2008 15:37:44 -0800
 Paul E. McKenney [EMAIL PROTECTED] wrote:
 
  Ah.  It does take a bit to get fib_trie into one's build -- allyesconfig
  doesn't cut it.
 
 This is not good.  The sole purpose of allmodconfig and allyesconfig is for
 compilation and linkage coverage testing.  Hence we should aim to get as
 much code as possible included in those cases.
 

The current model is compile time choice. It is on my long term list
to make this a runtime option.

-- 
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 1/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Andrew Morton
On Wed, 13 Feb 2008 15:57:38 -0800 (PST)
David Miller [EMAIL PROTECTED] wrote:

 From: Andrew Morton [EMAIL PROTECTED]
 Date: Wed, 13 Feb 2008 15:52:45 -0800
 
  On Wed, 13 Feb 2008 15:37:44 -0800
  Paul E. McKenney [EMAIL PROTECTED] wrote:
  
   Ah.  It does take a bit to get fib_trie into one's build -- allyesconfig
   doesn't cut it.
  
  This is not good.  The sole purpose of allmodconfig and allyesconfig is for
  compilation and linkage coverage testing.  Hence we should aim to get as
  much code as possible included in those cases.
 
 Well, in this case there is a choice, either you use one routing
 lookup datastructure or the other.  It's not purposefully being hidden
 from the everything builds :-)

oic.  yes, that is a bit of a problem.  Oh well.

`make randconfig' seems to be able to enable CONFIG_IP_FIB_TRIE about one
time in eight ;)

--
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/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Paul E. McKenney
On Wed, Feb 13, 2008 at 03:51:58PM -0800, Stephen Hemminger wrote:
 On Wed, 13 Feb 2008 15:37:44 -0800
 Paul E. McKenney [EMAIL PROTECTED] wrote:
  On Wed, Feb 13, 2008 at 02:42:33PM -0800, Stephen Hemminger wrote:
   On Wed, 13 Feb 2008 14:41:34 -0800
   Paul E. McKenney [EMAIL PROTECTED] wrote:
   
On Wed, Feb 13, 2008 at 02:35:37PM -0800, Stephen Hemminger wrote:
 On Wed, 13 Feb 2008 14:00:24 -0800
 Paul E. McKenney [EMAIL PROTECTED] wrote:
 
  Hello!
  
  This is an updated version of the patch posted last November:
  
  
  http://archives.free.net.ph/message/20071201.003721.cd6ff17c.en.html
  
  This new version permits arguments with side effects, for example:
  
  rcu_assign_pointer(global_p, p++);
  
  and also verifies that the arguments are pointers, while still 
  avoiding
  the unnecessary memory barrier when assigning NULL to a pointer.
  This memory-barrier avoidance means that rcu_assign_pointer() is 
  now only
  permitted for pointers (not array indexes), and so this version 
  emits a
  compiler warning if the first argument is not a pointer.  I built a 
  make
  allyesconfig version on an x86 system, and received no such 
  warnings.
  If RCU is ever applied to array indexes, then the second patch in 
  this
  series should be applied, and the resulting rcu_assign_index() be 
  used.
  
  Given the rather surprising history of subtlely broken 
  implementations of
  rcu_assign_pointer(), I took the precaution of generating a full 
  set of
  test cases and verified that memory barriers and compiler warnings 
  were
  emitted when required.  I guess it is the simple things that get 
  you...
  
  Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
  ---
  
   rcupdate.h |   16 
   1 file changed, 12 insertions(+), 4 deletions(-)
  
  diff -urpNa -X dontdiff linux-2.6.24/include/linux/rcupdate.h 
  linux-2.6.24-rap/include/linux/rcupdate.h
  --- linux-2.6.24/include/linux/rcupdate.h   2008-01-24 
  14:58:37.0 -0800
  +++ linux-2.6.24-rap/include/linux/rcupdate.h   2008-02-13 
  13:36:47.0 -0800
  @@ -270,12 +270,20 @@ extern struct lockdep_map rcu_lock_map;
* structure after the pointer assignment.  More importantly, this
* call documents which pointers will be dereferenced by RCU 
  read-side
* code.
  + *
  + * Throws a compiler warning for non-pointer arguments.
  + *
  + * Does not insert a memory barrier for a NULL pointer.
*/
   
  -#define rcu_assign_pointer(p, v)   ({ \
  -   smp_wmb(); \
  -   (p) = (v); \
  -   })
  +#define rcu_assign_pointer(p, v)   \
  +   ({ \
  +   typeof(*p) *_p1 = (v); \
  +   \
  +   if (!__builtin_constant_p(v) || (_p1 != NULL)) \
  +   smp_wmb(); \
  +   (p) = _p1; \
  +   })
   
   /**
* synchronize_sched - block until all CPUs have exited any 
  non-preemptive
 
 Will this still work if p is unsigned long?

Hello, Steve,

If p is unsigned long, then use rcu_assign_index() from the next patch 
in
the set.  Looks like Andrew has applied it to -mm -- so please make sure
that he is aware if you do use it.
   
   Make sure fib_trie still works and doesn't get warnings.
  
  Ah.  It does take a bit to get fib_trie into one's build -- allyesconfig
  doesn't cut it.  Please accept my apologies for my confusion!!!
  
  Once fib_trie is configured, I do indeed get:
  
  net/ipv4/fib_trie.c: In function ‘node_set_parent’:
  net/ipv4/fib_trie.c:182: warning: comparison between pointer and integer
  
  So, given that node-parent is an unsigned long, I changed node_set_parent()
  to the following:
  
  static inline void node_set_parent(struct node *node, struct tnode *ptr)
  {
  rcu_assign_index(node-parent, (unsigned long)ptr | NODE_TYPE(node));
  }
  
  This removes the warnings.  I am a little ambivalent about this, as
  this is really a pointer in disguise rather than an array index, but
  patch below.  I suppose that another option would be to make node-parent
  be a void* and provide appropriate accessor functions/macros.
  
  Thoughts?
  
  Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
 
 Maybe cast both sides to void * in this case:
 
 static inline void node_set_parent(struct node *node, struct tnode *ptr)
 {
   rcu_assign_pointer((void *) node-parent, (void *)((unsigned long)ptr | 
 NODE_TYPE(node)));
 }

That gets me the following:

net/ipv4/fib_trie.c: In function ‘node_set_parent’:
net/ipv4/fib_trie.c:182: error: invalid lvalue 

Re: [PATCH 1/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Stephen Hemminger
On Wed, 13 Feb 2008 16:14:04 -0800
Paul E. McKenney [EMAIL PROTECTED] wrote:

 On Wed, Feb 13, 2008 at 03:51:58PM -0800, Stephen Hemminger wrote:
  On Wed, 13 Feb 2008 15:37:44 -0800
  Paul E. McKenney [EMAIL PROTECTED] wrote:
   On Wed, Feb 13, 2008 at 02:42:33PM -0800, Stephen Hemminger wrote:
On Wed, 13 Feb 2008 14:41:34 -0800
Paul E. McKenney [EMAIL PROTECTED] wrote:

 On Wed, Feb 13, 2008 at 02:35:37PM -0800, Stephen Hemminger wrote:
  On Wed, 13 Feb 2008 14:00:24 -0800
  Paul E. McKenney [EMAIL PROTECTED] wrote:
  
   Hello!
   
   This is an updated version of the patch posted last November:
   
 
   http://archives.free.net.ph/message/20071201.003721.cd6ff17c.en.html
   
   This new version permits arguments with side effects, for example:
   
 rcu_assign_pointer(global_p, p++);
   
   and also verifies that the arguments are pointers, while still 
   avoiding
   the unnecessary memory barrier when assigning NULL to a pointer.
   This memory-barrier avoidance means that rcu_assign_pointer() is 
   now only
   permitted for pointers (not array indexes), and so this version 
   emits a
   compiler warning if the first argument is not a pointer.  I built 
   a make
   allyesconfig version on an x86 system, and received no such 
   warnings.
   If RCU is ever applied to array indexes, then the second patch in 
   this
   series should be applied, and the resulting rcu_assign_index() be 
   used.
   
   Given the rather surprising history of subtlely broken 
   implementations of
   rcu_assign_pointer(), I took the precaution of generating a full 
   set of
   test cases and verified that memory barriers and compiler 
   warnings were
   emitted when required.  I guess it is the simple things that get 
   you...
   
   Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
   ---
   
rcupdate.h |   16 
1 file changed, 12 insertions(+), 4 deletions(-)
   
   diff -urpNa -X dontdiff linux-2.6.24/include/linux/rcupdate.h 
   linux-2.6.24-rap/include/linux/rcupdate.h
   --- linux-2.6.24/include/linux/rcupdate.h 2008-01-24 
   14:58:37.0 -0800
   +++ linux-2.6.24-rap/include/linux/rcupdate.h 2008-02-13 
   13:36:47.0 -0800
   @@ -270,12 +270,20 @@ extern struct lockdep_map rcu_lock_map;
 * structure after the pointer assignment.  More importantly, 
   this
 * call documents which pointers will be dereferenced by RCU 
   read-side
 * code.
   + *
   + * Throws a compiler warning for non-pointer arguments.
   + *
   + * Does not insert a memory barrier for a NULL pointer.
 */

   -#define rcu_assign_pointer(p, v) ({ \
   - smp_wmb(); \
   - (p) = (v); \
   - })
   +#define rcu_assign_pointer(p, v) \
   + ({ \
   + typeof(*p) *_p1 = (v); \
   + \
   + if (!__builtin_constant_p(v) || (_p1 != NULL)) \
   + smp_wmb(); \
   + (p) = _p1; \
   + })

/**
 * synchronize_sched - block until all CPUs have exited any 
   non-preemptive
  
  Will this still work if p is unsigned long?
 
 Hello, Steve,
 
 If p is unsigned long, then use rcu_assign_index() from the next 
 patch in
 the set.  Looks like Andrew has applied it to -mm -- so please make 
 sure
 that he is aware if you do use it.

Make sure fib_trie still works and doesn't get warnings.
   
   Ah.  It does take a bit to get fib_trie into one's build -- allyesconfig
   doesn't cut it.  Please accept my apologies for my confusion!!!
   
   Once fib_trie is configured, I do indeed get:
   
   net/ipv4/fib_trie.c: In function ‘node_set_parent’:
   net/ipv4/fib_trie.c:182: warning: comparison between pointer and 
   integer
   
   So, given that node-parent is an unsigned long, I changed 
   node_set_parent()
   to the following:
   
   static inline void node_set_parent(struct node *node, struct tnode *ptr)
   {
 rcu_assign_index(node-parent, (unsigned long)ptr | NODE_TYPE(node));
   }
   
   This removes the warnings.  I am a little ambivalent about this, as
   this is really a pointer in disguise rather than an array index, but
   patch below.  I suppose that another option would be to make node-parent
   be a void* and provide appropriate accessor functions/macros.
   
   Thoughts?
   
   Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
  
  Maybe cast both sides to void * in this case:
  
  static inline void node_set_parent(struct node *node, struct tnode *ptr)
  {
  rcu_assign_pointer((void *) node-parent, (void 

Re: [PATCH 1/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Paul E. McKenney
On Wed, Feb 13, 2008 at 04:27:00PM -0800, Stephen Hemminger wrote:
 On Wed, 13 Feb 2008 16:14:04 -0800
 Paul E. McKenney [EMAIL PROTECTED] wrote:
  On Wed, Feb 13, 2008 at 03:51:58PM -0800, Stephen Hemminger wrote:

[ . . . ]

   Maybe cast both sides to void * in this case:
   
   static inline void node_set_parent(struct node *node, struct tnode *ptr)
   {
 rcu_assign_pointer((void *) node-parent, (void *)((unsigned long)ptr | 
   NODE_TYPE(node)));
   }
  
  That gets me the following:
  
  net/ipv4/fib_trie.c: In function ‘node_set_parent’:
  net/ipv4/fib_trie.c:182: error: invalid lvalue in assignment
  
  However, as with much in computing, an extra level of indirection fixes
  things.  Your call as to whether or not the cure is preferable to the
  disease.  ;-)
  
  Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
  ---
  
   fib_trie.c |4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
  
  diff -urpNa -X dontdiff linux-2.6.25-rc1/net/ipv4/fib_trie.c 
  linux-2.6.25-rc1-fib_trie-warn.compile/net/ipv4/fib_trie.c
  --- linux-2.6.25-rc1/net/ipv4/fib_trie.c2008-02-13 14:38:12.0 
  -0800
  +++ linux-2.6.25-rc1-fib_trie-warn.compile/net/ipv4/fib_trie.c  
  2008-02-13 16:10:07.0 -0800
  @@ -179,8 +179,8 @@ static inline struct tnode *node_parent_
   
   static inline void node_set_parent(struct node *node, struct tnode *ptr)
   {
  -   rcu_assign_pointer(node-parent,
  -  (unsigned long)ptr | NODE_TYPE(node));
  +   rcu_assign_pointer((*(void **)node-parent),
  +  (void *)((unsigned long)ptr | NODE_TYPE(node)));
   }
 
 That is heading towards ugly...  Maybe not using the macro at all (for this 
 case) would be best:
 
 static inline void node_set_parent(struct node *node, struct tnode *ptr)
 {
   smp_wmb();
   node-parent = (unsigned long)ptr | NODE_TYPE(node);
 }

Or, alternatively, the rcu_assign_index() patch sent earlier to avoid
the bare memory barrier?

Thanx, Paul
--
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] Fix station address detection in smc

2008-02-13 Thread Chuck Ebbert
Megahertz EM1144 PCMCIA ethernet adapter needs special handling
because it has two VERS_1 tuples and the station address is in
the second one. Conversion to generic handling of these fields
broke it. Reverting that fixes the device.

  https://bugzilla.redhat.com/show_bug.cgi?id=233255

Thanks go to Jon Stanley for not giving up on this one until the
problem was found.

Signed-off-by: Chuck Ebbert [EMAIL PROTECTED]

---

This was broken for over a year before the problem was found...

--- b/drivers/net/pcmcia/smc91c92_cs.c  Tue Dec 05 06:09:21 2006 +0500
+++ a/drivers/net/pcmcia/smc91c92_cs.c  Tue Dec 05 06:09:20 2006 +0500
@@ -560,8 +560,16 @@

 /* Read the station address from the CIS.  It is stored as the last
(fourth) string in the Version 1 Version/ID tuple. */
+tuple-DesiredTuple = CISTPL_VERS_1;
+if (first_tuple(link, tuple, parse) != CS_SUCCESS) {
+   rc = -1;
+   goto free_cfg_mem;
+}
+/* Ugh -- the EM1144 card has two VERS_1 tuples!?! */
+if (next_tuple(link, tuple, parse) != CS_SUCCESS)
+   first_tuple(link, tuple, parse);
+if (parse-version_1.ns  3) {
+   station_addr = parse-version_1.str + parse-version_1.ofs[3];
-if (link-prod_id[3]) {
-   station_addr = link-prod_id[3];
if (cvt_ascii_address(dev, station_addr) == 0) {
rc = 0;
goto free_cfg_mem;
--
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][AX25] ax25_out: check skb for NULL in ax25_kick()

2008-02-13 Thread Jann Traschewski
Applied and stable with Kernel 2.6.24.2 since 12 hours.
Regards,
Jann

 -Ursprüngliche Nachricht-
 Von: Jarek Poplawski [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 13. Februar 2008 12:56
 An: David Miller
 Cc: Jann Traschewski; Bernard Pidoux F6BVP; Ralf Baechle; 
 netdev@vger.kernel.org
 Betreff: [PATCH][AX25] ax25_out: check skb for NULL in ax25_kick()
 
 Hi,
 
 Here is an official version of testing patch #2 from this thread.
 The only difference: ax25-vs is changed only after checking 
 skb is not NULL (plus a comment). IMHO it could be applied.
 
 Thanks,
 Jarek P.
 
 
 
 Subject: [AX25] ax25_out: check skb for NULL in ax25_kick()
 
 According to some OOPS reports ax25_kick tries to clone NULL 
 skbs sometimes. It looks like a race with 
 ax25_clear_queues(). Probably there is no need to add more 
 than a simple check for this yet.
 Another report suggested there are probably also cases where ax25
 -paclen == 0 can happen in ax25_output(); this wasn't confirmed
 during testing but let's leave this debugging check for some time.
 
 
 Reported-and-tested-by: Jann Traschewski [EMAIL PROTECTED]
 Signed-off-by: Jarek Poplawski [EMAIL PROTECTED]
 
 ---
 
 diff -Nurp 2.6.24-mm1-/net/ax25/ax25_out.c 
 2.6.24-mm1+/net/ax25/ax25_out.c
 --- 2.6.24-mm1-/net/ax25/ax25_out.c   2008-01-24 
 22:58:37.0 +
 +++ 2.6.24-mm1+/net/ax25/ax25_out.c   2008-02-13 
 10:43:50.0 +
 @@ -117,6 +117,12 @@ void ax25_output(ax25_cb *ax25, int pacl
   unsigned char *p;
   int frontlen, len, fragno, ka9qfrag, first = 1;
  
 + if (paclen  16) {
 + WARN_ON_ONCE(1);
 + kfree_skb(skb);
 + return;
 + }
 +
   if ((skb-len - 1)  paclen) {
   if (*skb-data == AX25_P_TEXT) {
   skb_pull(skb, 1); /* skip PID */
 @@ -251,8 +257,6 @@ void ax25_kick(ax25_cb *ax25)
   if (start == end)
   return;
  
 - ax25-vs = start;
 -
   /*
* Transmit data until either we're out of data to send or
* the window is full. Send a poll on the final I frame 
 if @@ -261,8 +265,13 @@ void ax25_kick(ax25_cb *ax25)
  
   /*
* Dequeue the frame and copy it.
 +  * Check for race with ax25_clear_queues().
*/
   skb  = skb_dequeue(ax25-write_queue);
 + if (!skb)
 + return;
 +
 + ax25-vs = start;
  
   do {
   if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) {

--
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/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Stephen Hemminger
On Wed, 13 Feb 2008 16:42:53 -0800
Paul E. McKenney [EMAIL PROTECTED] wrote:

 On Wed, Feb 13, 2008 at 04:27:00PM -0800, Stephen Hemminger wrote:
  On Wed, 13 Feb 2008 16:14:04 -0800
  Paul E. McKenney [EMAIL PROTECTED] wrote:
   On Wed, Feb 13, 2008 at 03:51:58PM -0800, Stephen Hemminger wrote:
 
 [ . . . ]
 
Maybe cast both sides to void * in this case:

static inline void node_set_parent(struct node *node, struct tnode *ptr)
{
rcu_assign_pointer((void *) node-parent, (void *)((unsigned 
long)ptr | NODE_TYPE(node)));
}
   
   That gets me the following:
   
 net/ipv4/fib_trie.c: In function ‘node_set_parent’:
 net/ipv4/fib_trie.c:182: error: invalid lvalue in assignment
   
   However, as with much in computing, an extra level of indirection fixes
   things.  Your call as to whether or not the cure is preferable to the
   disease.  ;-)
   
   Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
   ---
   
fib_trie.c |4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
   
   diff -urpNa -X dontdiff linux-2.6.25-rc1/net/ipv4/fib_trie.c 
   linux-2.6.25-rc1-fib_trie-warn.compile/net/ipv4/fib_trie.c
   --- linux-2.6.25-rc1/net/ipv4/fib_trie.c  2008-02-13 14:38:12.0 
   -0800
   +++ linux-2.6.25-rc1-fib_trie-warn.compile/net/ipv4/fib_trie.c
   2008-02-13 16:10:07.0 -0800
   @@ -179,8 +179,8 @@ static inline struct tnode *node_parent_

static inline void node_set_parent(struct node *node, struct tnode *ptr)
{
   - rcu_assign_pointer(node-parent,
   -(unsigned long)ptr | NODE_TYPE(node));
   + rcu_assign_pointer((*(void **)node-parent),
   +(void *)((unsigned long)ptr | NODE_TYPE(node)));
}
  
  That is heading towards ugly...  Maybe not using the macro at all (for this 
  case) would be best:
  
  static inline void node_set_parent(struct node *node, struct tnode *ptr)
  {
  smp_wmb();
  node-parent = (unsigned long)ptr | NODE_TYPE(node);
  }
 
 Or, alternatively, the rcu_assign_index() patch sent earlier to avoid
 the bare memory barrier?
 
   Thanx, Paul

I am fine with rcu_assign_index(), and add a comment in node_set_parent.
--
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] Fix tcp_v4_send_synack() comment

2008-02-13 Thread Kris Katterjohn

Hey everyone,

I've attached a patch that fixes the comment above tcp_v4_send_synack() 
in ipv4/tcp_ipv4.c.


Signed-off-by: Kris Katterjohn [EMAIL PROTECTED]

Thanks,
Kris Katterjohn
--- net/ipv4/tcp_ipv4.c	2008-02-10 23:51:11.0 -0600
+++ net/ipv4/tcp_ipv4.c	2008-02-13 18:31:44.0 -0600
@@ -735,7 +735,7 @@ static void tcp_v4_reqsk_send_ack(struct
 }
 
 /*
- *	Send a SYN-ACK after having received an ACK.
+ *	Send a SYN-ACK after having received a SYN.
  *	This still operates on a request_sock only, not on a big
  *	socket.
  */


Re: [PATCH 1/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Paul E. McKenney
On Wed, Feb 13, 2008 at 04:53:56PM -0800, Stephen Hemminger wrote:
 On Wed, 13 Feb 2008 16:42:53 -0800
 Paul E. McKenney [EMAIL PROTECTED] wrote:
  On Wed, Feb 13, 2008 at 04:27:00PM -0800, Stephen Hemminger wrote:

[ . . . ]

   That is heading towards ugly...  Maybe not using the macro at all (for 
   this case) would be best:
   
   static inline void node_set_parent(struct node *node, struct tnode *ptr)
   {
 smp_wmb();
 node-parent = (unsigned long)ptr | NODE_TYPE(node);
   }
  
  Or, alternatively, the rcu_assign_index() patch sent earlier to avoid
  the bare memory barrier?
  
  Thanx, Paul
 
 I am fine with rcu_assign_index(), and add a comment in node_set_parent.

OK, how about the following?

Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
---

 fib_trie.c |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff -urpNa -X dontdiff linux-2.6.25-rc1/net/ipv4/fib_trie.c 
linux-2.6.25-rc1-fib_trie-warn.compile/net/ipv4/fib_trie.c
--- linux-2.6.25-rc1/net/ipv4/fib_trie.c2008-02-13 14:38:12.0 
-0800
+++ linux-2.6.25-rc1-fib_trie-warn.compile/net/ipv4/fib_trie.c  2008-02-13 
17:31:16.0 -0800
@@ -96,6 +96,14 @@ typedef unsigned int t_key;
 #define IS_TNODE(n) (!(n-parent  T_LEAF))
 #define IS_LEAF(n) (n-parent  T_LEAF)
 
+/*
+ * The parent fields in struct node and struct leaf are really pointers,
+ * but with the possibility that the T_LEAF bit is set.  Therefore, both
+ * the C compiler and RCU see them as integers rather than pointers.
+ * This in turn means that rcu_assign_index() must be used to assign
+ * values to these fields, rather than the usual rcu_assign_pointer().
+ */
+
 struct node {
unsigned long parent;
t_key key;
@@ -179,8 +187,7 @@ static inline struct tnode *node_parent_
 
 static inline void node_set_parent(struct node *node, struct tnode *ptr)
 {
-   rcu_assign_pointer(node-parent,
-  (unsigned long)ptr | NODE_TYPE(node));
+   rcu_assign_index(node-parent, (unsigned long)ptr | NODE_TYPE(node));
 }
 
 static inline struct node *tnode_get_child(struct tnode *tn, unsigned int i)
--
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/2] remove rcu_assign_pointer(NULL) penalty with type/macro safety

2008-02-13 Thread Stephen Hemminger
On Wed, 13 Feb 2008 17:34:27 -0800
Paul E. McKenney [EMAIL PROTECTED] wrote:

 On Wed, Feb 13, 2008 at 04:53:56PM -0800, Stephen Hemminger wrote:
  On Wed, 13 Feb 2008 16:42:53 -0800
  Paul E. McKenney [EMAIL PROTECTED] wrote:
   On Wed, Feb 13, 2008 at 04:27:00PM -0800, Stephen Hemminger wrote:
 
 [ . . . ]
 
That is heading towards ugly...  Maybe not using the macro at all (for 
this case) would be best:

static inline void node_set_parent(struct node *node, struct tnode *ptr)
{
smp_wmb();
node-parent = (unsigned long)ptr | NODE_TYPE(node);
}
   
   Or, alternatively, the rcu_assign_index() patch sent earlier to avoid
   the bare memory barrier?
   
 Thanx, Paul
  
  I am fine with rcu_assign_index(), and add a comment in node_set_parent.
 
 OK, how about the following?
 
 Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
 ---
 
  fib_trie.c |   11 +--
  1 file changed, 9 insertions(+), 2 deletions(-)
 
 diff -urpNa -X dontdiff linux-2.6.25-rc1/net/ipv4/fib_trie.c 
 linux-2.6.25-rc1-fib_trie-warn.compile/net/ipv4/fib_trie.c
 --- linux-2.6.25-rc1/net/ipv4/fib_trie.c  2008-02-13 14:38:12.0 
 -0800
 +++ linux-2.6.25-rc1-fib_trie-warn.compile/net/ipv4/fib_trie.c
 2008-02-13 17:31:16.0 -0800
 @@ -96,6 +96,14 @@ typedef unsigned int t_key;
  #define IS_TNODE(n) (!(n-parent  T_LEAF))
  #define IS_LEAF(n) (n-parent  T_LEAF)
  
 +/*
 + * The parent fields in struct node and struct leaf are really pointers,
 + * but with the possibility that the T_LEAF bit is set.  Therefore, both
 + * the C compiler and RCU see them as integers rather than pointers.
 + * This in turn means that rcu_assign_index() must be used to assign
 + * values to these fields, rather than the usual rcu_assign_pointer().
 + */
 +
  struct node {
   unsigned long parent;
   t_key key;
 @@ -179,8 +187,7 @@ static inline struct tnode *node_parent_
  
  static inline void node_set_parent(struct node *node, struct tnode *ptr)
  {
 - rcu_assign_pointer(node-parent,
 -(unsigned long)ptr | NODE_TYPE(node));
 + rcu_assign_index(node-parent, (unsigned long)ptr | NODE_TYPE(node));
  }
  
  static inline struct node *tnode_get_child(struct tnode *tn, unsigned int i)

Yes, thats great.
--
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 patch] unexport __inet_hash_connect

2008-02-13 Thread David Miller
From: Adrian Bunk [EMAIL PROTECTED]
Date: Wed, 13 Feb 2008 23:29:46 +0200

 This patch removes the unused EXPORT_SYMBOL_GPL(__inet_hash_connect).
 
 Signed-off-by: Adrian Bunk [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: [2.6 patch] unexport inet_listen_wlock

2008-02-13 Thread David Miller
From: Adrian Bunk [EMAIL PROTECTED]
Date: Wed, 13 Feb 2008 23:29:48 +0200

 This patch removes the no linger used EXPORT_SYMBOL(inet_listen_wlock).
 
 Signed-off-by: Adrian Bunk [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


Dealing with limited resources and DMA Engine copies

2008-02-13 Thread Olof Johansson
Hi,

My DMA Engine has a limited resource: It's got a descriptor ring, so
it's not always possible to add a new descriptor to it (i.e. it might be
full). While allocating a huge ring will help, eventually I'm sure I
will hit a case where it'll overflow.

I thought this was going to be taken care of automatically by the fact
that you return your max(?) number of descriptors in the channel
allocation function, but it looks like that value is discarded in
dma_client_chan_alloc().

So, I just got a couple of spurious:
dma_cookie  0
dma_cookie  0

...on the console and the connection terminated. Looks like that came
from tcp_recvmsg(). Ouch.

How about falling back to the cpu-based copy in case of failure? Or would
you prefer that I sleep locally in my driver and wait on a descriptor
slot to open up?


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


[RFC] sky2: don't request unused i/o region

2008-02-13 Thread Stephen Hemminger
The sky2 driver only uses the PCI memory region (0) not the 
available I/O region.  Some users want to use lots of boards, and the
I/O space gets exhausted.

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

--- a/drivers/net/sky2.c2008-02-13 18:58:21.0 -0800
+++ b/drivers/net/sky2.c2008-02-13 18:58:55.0 -0800
@@ -4135,9 +4135,9 @@ static int __devinit sky2_probe(struct p
goto err_out;
}
 
-   err = pci_request_regions(pdev, DRV_NAME);
+   err = pci_request_region(pdev, 0, DRV_NAME);
if (err) {
-   dev_err(pdev-dev, cannot obtain PCI resources\n);
+   dev_err(pdev-dev, cannot obtain PCI resource\n);
goto err_out_disable;
}
 
--
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] igb: fix legacy mode irq issue

2008-02-13 Thread Andy Gospodarek

I booted an igb kernel with the option pci=nomsi and instantly noticed
that interrupts no longer worked on my igb device.  I took a look at the
interrupt initialization and quickly discovered a comment stating:

DO NOT USE EIAME or IAME in legacy mode

It seemed a bit odd that bits to enable IAM were being set in legacy
interrupt mode, so I dropped out the following parts and interrupts
began working fine again.

Signed-off-by: Andy Gospodarek [EMAIL PROTECTED]
---

 igb_main.c |3 ---
 1 files changed, 3 deletions(-)

diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index f3c144d..be5da09 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -472,9 +471,6 @@ static int igb_request_irq(struct igb_adapter *adapter)
goto request_done;
}
 
-   /* enable IAM, auto-mask */
-   wr32(E1000_IAM, IMS_ENABLE_MASK);
-
 request_done:
return err;
 }
--
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/2] add rcu_assign_index() if ever needed

2008-02-13 Thread Andrew Morton
On Thu, 14 Feb 2008 09:02:09 +0530 Gautham R Shenoy [EMAIL PROTECTED] wrote:

   /**
  + * rcu_assign_index - assign (publicize) a index of a newly
  + * initialized array elementg that will be dereferenced by RCU
    
 
 I hope Andrew got that one while porting against the latest -mm :)

I don't actually read the comments - I just like to make sure they're
there ;)
--
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 to latest iproute to get it to compile on FC5

2008-02-13 Thread Ben Greear

Here's another try at the patch to make the __constant_htonl methods
be included, but without changing any of the .h files.  I tested this on
an FC2 system, and it compiles fine.

Interesting to me, it seems you are not supposed to #include 
asm/byteorder.h directly,
but when I tried the suggested endian.h, it didn't actually fix the 
problem.


Signed-off-by:  Ben Greear [EMAIL PROTECTED]

--
Ben Greear [EMAIL PROTECTED] 
Candela Technologies Inc  http://www.candelatech.com



diff --git a/ip/iptunnel.c b/ip/iptunnel.c
index 3b466bf..2b2b78e 100644
--- a/ip/iptunnel.c
+++ b/ip/iptunnel.c
@@ -34,6 +34,7 @@
 #include ip_common.h
 #include tunnel.h
 
+#include asm/byteorder.h
 static void usage(void) __attribute__((noreturn));
 
 static void usage(void)


Re: [RFC] sky2: don't request unused i/o region

2008-02-13 Thread Jeff Garzik

Stephen Hemminger wrote:
The sky2 driver only uses the PCI memory region (0) not the 
available I/O region.  Some users want to use lots of boards, and the

I/O space gets exhausted.

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

--- a/drivers/net/sky2.c2008-02-13 18:58:21.0 -0800
+++ b/drivers/net/sky2.c2008-02-13 18:58:55.0 -0800
@@ -4135,9 +4135,9 @@ static int __devinit sky2_probe(struct p
goto err_out;
}
 
-	err = pci_request_regions(pdev, DRV_NAME);

+   err = pci_request_region(pdev, 0, DRV_NAME);
if (err) {
-   dev_err(pdev-dev, cannot obtain PCI resources\n);
+   dev_err(pdev-dev, cannot obtain PCI resource\n);


Your description of the problem does not match the fix.

PCI resources are already allocated to the device (or not) by this point 
in the code.  pci_request_region/regions is purely internal kernel 
software resource reservation -- protecting drivers from themselves, and 
arguably not really needed anymore on modern buses.


Thus, I cannot see how this patch can possibly exhaust I/O space -- 
the relevant PCI resources are allocated to the device, or not, 
regardless of these function calls.


As long as there is no resource conflict, you can have 1 million boards 
and still use pci_request_regions().


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