[IPV6]: Make fib6_init to return an error code.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d63bddbe90c4fd924b2155ca92a879393d856170
Commit: d63bddbe90c4fd924b2155ca92a879393d856170
Parent: 5a3e55d68ec5baac578bf32ba67607088c763657
Author: Daniel Lezcano [EMAIL PROTECTED]
AuthorDate: Fri Dec 7 00:40:34 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:56:45 2008 -0800

[IPV6]: Make fib6_init to return an error code.

If there is an error in the initialization function, nothing is
followed up to the caller. So I add a return value to be set for the
init function.

Signed-off-by: Daniel Lezcano [EMAIL PROTECTED]
Acked-by: Benjamin Thery [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/ip6_fib.h |2 +-
 net/ipv6/ip6_fib.c|   14 +++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 4cefcff..5d39ce9 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -224,7 +224,7 @@ extern void fib6_run_gc(unsigned long 
dummy);
 
 extern voidfib6_gc_cleanup(void);
 
-extern voidfib6_init(void);
+extern int fib6_init(void);
 
 extern voidfib6_rules_init(void);
 extern voidfib6_rules_cleanup(void);
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 31b60a0..c100b44 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1473,16 +1473,24 @@ void fib6_run_gc(unsigned long dummy)
spin_unlock_bh(fib6_gc_lock);
 }
 
-void __init fib6_init(void)
+int __init fib6_init(void)
 {
+   int ret;
fib6_node_kmem = kmem_cache_create(fib6_nodes,
   sizeof(struct fib6_node),
   0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
   NULL);
-
fib6_tables_init();
 
-   __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib);
+   ret = __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib);
+   if (ret)
+   goto out_kmem_cache_create;
+out:
+   return ret;
+
+out_kmem_cache_create:
+   kmem_cache_destroy(fib6_node_kmem);
+   goto out;
 }
 
 void fib6_gc_cleanup(void)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[X25]: use LIST_HEAD instead of LIST_HEAD_INIT

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0e3cf7e9164048b79e7375bd66c9ef350e5b5bd7
Commit: 0e3cf7e9164048b79e7375bd66c9ef350e5b5bd7
Parent: 14d0e7b74e05a1983f5b607e90bc9bafa5ce9eb3
Author: Denis Cheng [EMAIL PROTECTED]
AuthorDate: Fri Dec 7 00:50:43 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:56:53 2008 -0800

[X25]: use LIST_HEAD instead of LIST_HEAD_INIT

single list_head variable initialized with LIST_HEAD_INIT could almost
always can be replaced with LIST_HEAD declaration, this shrinks the code
and looks better.

Signed-off-by: Denis Cheng [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/x25/x25_forward.c |2 +-
 net/x25/x25_link.c|2 +-
 net/x25/x25_route.c   |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/x25/x25_forward.c b/net/x25/x25_forward.c
index 3447803..056a55f 100644
--- a/net/x25/x25_forward.c
+++ b/net/x25/x25_forward.c
@@ -12,7 +12,7 @@
 #include linux/init.h
 #include net/x25.h
 
-struct list_head x25_forward_list = LIST_HEAD_INIT(x25_forward_list);
+LIST_HEAD(x25_forward_list);
 DEFINE_RWLOCK(x25_forward_list_lock);
 
 int x25_forward_call(struct x25_address *dest_addr, struct x25_neigh *from,
diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c
index 753f2b6..e4e1b6e 100644
--- a/net/x25/x25_link.c
+++ b/net/x25/x25_link.c
@@ -30,7 +30,7 @@
 #include linux/init.h
 #include net/x25.h
 
-static struct list_head x25_neigh_list = LIST_HEAD_INIT(x25_neigh_list);
+static LIST_HEAD(x25_neigh_list);
 static DEFINE_RWLOCK(x25_neigh_list_lock);
 
 static void x25_t20timer_expiry(unsigned long);
diff --git a/net/x25/x25_route.c b/net/x25/x25_route.c
index 86b5b4d..2c999cc 100644
--- a/net/x25/x25_route.c
+++ b/net/x25/x25_route.c
@@ -21,7 +21,7 @@
 #include linux/init.h
 #include net/x25.h
 
-struct list_head x25_route_list = LIST_HEAD_INIT(x25_route_list);
+LIST_HEAD(x25_route_list);
 DEFINE_RWLOCK(x25_route_list_lock);
 
 /*
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SNMP]: Remove unused devconf macros.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cbbb90e68cd073b8d63b491166066e347902b7e9
Commit: cbbb90e68cd073b8d63b491166066e347902b7e9
Parent: b5e78337b50c0f3adda7faadb92f62bbdd5ffb56
Author: Pavel Emelyanov [EMAIL PROTECTED]
AuthorDate: Fri Dec 7 23:56:57 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:56:55 2008 -0800

[SNMP]: Remove unused devconf macros.

The SNMP_INC_STATS_OFFSET_BH is used only by ICMP6_INC_STATS_OFFSET_BH.
The ICMP6_INC_STATS_OFFSET_BH is unused.

Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/ipv6.h |8 
 include/net/snmp.h |2 --
 2 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index a84f3f6..38df94b 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -143,14 +143,6 @@ DECLARE_SNMP_STAT(struct icmpv6msg_mib, 
icmpv6msg_statistics);
 #define ICMP6_INC_STATS_BH(idev, field)_DEVINC(icmpv6, _BH, idev, 
field)
 #define ICMP6_INC_STATS_USER(idev, field) _DEVINC(icmpv6, _USER, idev, field)
 
-#define ICMP6_INC_STATS_OFFSET_BH(idev, field, offset) ({  
\
-   struct inet6_dev *_idev = idev; 
\
-   __typeof__(offset) _offset = (offset);  
\
-   if (likely(_idev != NULL))  
\
-   SNMP_INC_STATS_OFFSET_BH(_idev-stats.icmpv6, field, _offset);  
\
-   SNMP_INC_STATS_OFFSET_BH(icmpv6_statistics, field, _offset);
\
-})
-
 #define ICMP6MSGOUT_INC_STATS(idev, field) \
_DEVINC(icmpv6msg, , idev, field +256)
 #define ICMP6MSGOUT_INC_STATS_BH(idev, field) \
diff --git a/include/net/snmp.h b/include/net/snmp.h
index ea206bf..9c5793d 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -134,8 +134,6 @@ struct linux_mib {
 
 #define SNMP_INC_STATS_BH(mib, field)  \
(per_cpu_ptr(mib[0], raw_smp_processor_id())-mibs[field]++)
-#define SNMP_INC_STATS_OFFSET_BH(mib, field, offset)   \
-   (per_cpu_ptr(mib[0], raw_smp_processor_id())-mibs[field + (offset)]++)
 #define SNMP_INC_STATS_USER(mib, field) \
(per_cpu_ptr(mib[1], raw_smp_processor_id())-mibs[field]++)
 #define SNMP_INC_STATS(mib, field) \
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET] sysctl: make the sys.net.core sysctls per-namespace

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=024626e36d75fc8c6e32d50d4c68bfc3b8df5fdf
Commit: 024626e36d75fc8c6e32d50d4c68bfc3b8df5fdf
Parent: cbbb90e68cd073b8d63b491166066e347902b7e9
Author: Pavel Emelyanov [EMAIL PROTECTED]
AuthorDate: Sat Dec 8 00:09:24 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:56:56 2008 -0800

[NET] sysctl: make the sys.net.core sysctls per-namespace

Making them per-namespace is required for the following
two reasons:

 First, some ctl values have a per-namespace meaning.
 Second, making them writable from the sub-namespace
 is an isolation hole.

So I introduce the pernet operations to create these
tables. For init_net I use the existing statically
declared tables, for sub-namespace they are duplicated
and the write bits are removed from the mode.

Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/net_namespace.h |3 ++
 net/core/sysctl_net_core.c  |   50 ++
 2 files changed, 48 insertions(+), 5 deletions(-)

diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index f97b2a4..d593611 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -37,6 +37,9 @@ struct net {
 
struct sock *rtnl;  /* rtnetlink socket */
 
+   /* core sysctls */
+   struct ctl_table_header *sysctl_core_hdr;
+
/* List of all packet sockets. */
rwlock_tpacket_sklist_lock;
struct hlist_head   packet_sklist;
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index e322713..57a7ead 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -151,18 +151,58 @@ static struct ctl_table net_core_table[] = {
{ .ctl_name = 0 }
 };
 
-static __initdata struct ctl_path net_core_path[] = {
+static __net_initdata struct ctl_path net_core_path[] = {
{ .procname = net, .ctl_name = CTL_NET, },
{ .procname = core, .ctl_name = NET_CORE, },
{ },
 };
 
-static __init int sysctl_core_init(void)
+static __net_init int sysctl_core_net_init(struct net *net)
 {
-   struct ctl_table_header *hdr;
+   struct ctl_table *tbl, *tmp;
+
+   tbl = net_core_table;
+   if (net != init_net) {
+   tbl = kmemdup(tbl, sizeof(net_core_table), GFP_KERNEL);
+   if (tbl == NULL)
+   goto err_dup;
+
+   for (tmp = tbl; tmp-procname; tmp++)
+   tmp-mode = ~0222;
+   }
+
+   net-sysctl_core_hdr = register_net_sysctl_table(net,
+   net_core_path, tbl);
+   if (net-sysctl_core_hdr == NULL)
+   goto err_reg;
 
-   hdr = register_sysctl_paths(net_core_path, net_core_table);
-   return hdr == NULL ? -ENOMEM : 0;
+   return 0;
+
+err_reg:
+   if (tbl != net_core_table)
+   kfree(tbl);
+err_dup:
+   return -ENOMEM;
+}
+
+static __net_exit void sysctl_core_net_exit(struct net *net)
+{
+   struct ctl_table *tbl;
+
+   tbl = net-sysctl_core_hdr-ctl_table_arg;
+   unregister_net_sysctl_table(net-sysctl_core_hdr);
+   BUG_ON(tbl == net_core_table);
+   kfree(tbl);
+}
+
+static __net_initdata struct pernet_operations sysctl_core_ops = {
+   .init = sysctl_core_net_init,
+   .exit = sysctl_core_net_exit,
+};
+
+static __init int sysctl_core_init(void)
+{
+   return register_pernet_subsys(sysctl_core_ops);
 }
 
 __initcall(sysctl_core_init);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV6]: create route6 proc init-fini functions

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=75314fb38364c81a573cd222f74d792409a7afba
Commit: 75314fb38364c81a573cd222f74d792409a7afba
Parent: b8e1f9b5c37e77cc8f978a58859b35fe5edd5542
Author: Daniel Lezcano [EMAIL PROTECTED]
AuthorDate: Sat Dec 8 00:13:32 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:56:58 2008 -0800

[IPV6]: create route6 proc init-fini functions

Make the proc creation/destruction to be a separate function. That
allows to remove the #ifdef CONFIG_PROC_FS in the init/fini function
and make them more readable.

Signed-off-by: Daniel Lezcano [EMAIL PROTECTED]
Acked-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv6/route.c |   58 +
 1 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6f833ca..dbdae14 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2358,6 +2358,40 @@ static const struct file_operations rt6_stats_seq_fops = 
{
.llseek  = seq_lseek,
.release = single_release,
 };
+
+static int ipv6_route_proc_init(struct net *net)
+{
+   int ret = -ENOMEM;
+   if (!proc_net_fops_create(net, ipv6_route,
+ 0, ipv6_route_proc_fops))
+   goto out;
+
+   if (!proc_net_fops_create(net, rt6_stats,
+ S_IRUGO, rt6_stats_seq_fops))
+   goto out_ipv6_route;
+
+   ret = 0;
+out:
+   return ret;
+out_ipv6_route:
+   proc_net_remove(net, ipv6_route);
+   goto out;
+}
+
+static void ipv6_route_proc_fini(struct net *net)
+{
+   proc_net_remove(net, ipv6_route);
+   proc_net_remove(net, rt6_stats);
+}
+#else
+static inline int ipv6_route_proc_init(struct net *net)
+{
+   return 0;
+}
+static inline void ipv6_route_proc_fini(struct net *net)
+{
+   return ;
+}
 #endif /* CONFIG_PROC_FS */
 
 #ifdef CONFIG_SYSCTL
@@ -2484,21 +2518,14 @@ int __init ip6_route_init(void)
if (ret)
goto out_kmem_cache;
 
-#ifdef CONFIG_PROC_FS
-   ret = -ENOMEM;
-   if (!proc_net_fops_create(init_net, ipv6_route,
- 0, ipv6_route_proc_fops))
+   ret = ipv6_route_proc_init(init_net);
+   if (ret)
goto out_fib6_init;
 
-   if (!proc_net_fops_create(init_net, rt6_stats,
- S_IRUGO, rt6_stats_seq_fops))
-   goto out_proc_ipv6_route;
-#endif
-
 #ifdef CONFIG_XFRM
ret = xfrm6_init();
if (ret)
-   goto out_proc_rt6_stats;
+   goto out_proc_init;
 #endif
 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
ret = fib6_rules_init();
@@ -2522,14 +2549,10 @@ xfrm6_init:
 #endif
 #ifdef CONFIG_XFRM
xfrm6_fini();
-out_proc_rt6_stats:
 #endif
-#ifdef CONFIG_PROC_FS
-   proc_net_remove(init_net, rt6_stats);
-out_proc_ipv6_route:
-   proc_net_remove(init_net, ipv6_route);
+out_proc_init:
+   ipv6_route_proc_fini(init_net);
 out_fib6_init:
-#endif
rt6_ifdown(NULL);
fib6_gc_cleanup();
 out_kmem_cache:
@@ -2542,8 +2565,7 @@ void ip6_route_cleanup(void)
 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
fib6_rules_cleanup();
 #endif
-   proc_net_remove(init_net, ipv6_route);
-   proc_net_remove(init_net, rt6_stats);
+   ipv6_route_proc_fini(init_net);
 #ifdef CONFIG_XFRM
xfrm6_fini();
 #endif
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV4]: no need pass pointer to a default into fib_detect_death

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c17860a039bbde134324ad6f9331500635f5799d
Commit: c17860a039bbde134324ad6f9331500635f5799d
Parent: 7e5449c21562f1554d2c355db1ec9d3e4f434288
Author: Denis V. Lunev [EMAIL PROTECTED]
AuthorDate: Sat Dec 8 00:22:13 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:00 2008 -0800

[IPV4]: no need pass pointer to a default into fib_detect_death

ipv4: no need pass pointer to a default into fib_detect_death

Signed-off-by: Denis V. Lunev [EMAIL PROTECTED]
Acked-by: Alexey Kuznetsov [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/fib_hash.c  |4 ++--
 net/ipv4/fib_lookup.h|2 +-
 net/ipv4/fib_semantics.c |6 +++---
 net/ipv4/fib_trie.c  |4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index 638185e..143a521 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -314,7 +314,7 @@ fn_hash_select_default(struct fib_table *tb, const struct 
flowi *flp, struct fib
if (next_fi != res-fi)
break;
} else if (!fib_detect_death(fi, order, last_resort,
-last_idx, 
fn_hash_last_dflt)) {
+last_idx, 
fn_hash_last_dflt)) {
if (res-fi)
fib_info_put(res-fi);
res-fi = fi;
@@ -332,7 +332,7 @@ fn_hash_select_default(struct fib_table *tb, const struct 
flowi *flp, struct fib
goto out;
}
 
-   if (!fib_detect_death(fi, order, last_resort, last_idx, 
fn_hash_last_dflt)) {
+   if (!fib_detect_death(fi, order, last_resort, last_idx, 
fn_hash_last_dflt)) {
if (res-fi)
fib_info_put(res-fi);
res-fi = fi;
diff --git a/net/ipv4/fib_lookup.h b/net/ipv4/fib_lookup.h
index eef9eec..6c9dd42 100644
--- a/net/ipv4/fib_lookup.h
+++ b/net/ipv4/fib_lookup.h
@@ -36,6 +36,6 @@ extern struct fib_alias *fib_find_alias(struct list_head *fah,
u8 tos, u32 prio);
 extern int fib_detect_death(struct fib_info *fi, int order,
struct fib_info **last_resort,
-   int *last_idx, int *dflt);
+   int *last_idx, int dflt);
 
 #endif /* _FIB_LOOKUP_H */
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index ec9b0dd..bbd4a24 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -346,7 +346,7 @@ struct fib_alias *fib_find_alias(struct list_head *fah, u8 
tos, u32 prio)
 }
 
 int fib_detect_death(struct fib_info *fi, int order,
-struct fib_info **last_resort, int *last_idx, int *dflt)
+struct fib_info **last_resort, int *last_idx, int dflt)
 {
struct neighbour *n;
int state = NUD_NONE;
@@ -358,10 +358,10 @@ int fib_detect_death(struct fib_info *fi, int order,
}
if (state==NUD_REACHABLE)
return 0;
-   if ((stateNUD_VALID)  order != *dflt)
+   if ((stateNUD_VALID)  order != dflt)
return 0;
if ((stateNUD_VALID) ||
-   (*last_idx0  order  *dflt)) {
+   (*last_idx0  order  dflt)) {
*last_resort = fi;
*last_idx = order;
}
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 13a80aa..d48a9bb 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1830,7 +1830,7 @@ fn_trie_select_default(struct fib_table *tb, const struct 
flowi *flp, struct fib
if (next_fi != res-fi)
break;
} else if (!fib_detect_death(fi, order, last_resort,
-last_idx, trie_last_dflt)) {
+last_idx, trie_last_dflt)) {
if (res-fi)
fib_info_put(res-fi);
res-fi = fi;
@@ -1846,7 +1846,7 @@ fn_trie_select_default(struct fib_table *tb, const struct 
flowi *flp, struct fib
goto out;
}
 
-   if (!fib_detect_death(fi, order, last_resort, last_idx, 
trie_last_dflt)) {
+   if (!fib_detect_death(fi, order, last_resort, last_idx, 
trie_last_dflt)) {
if (res-fi)
fib_info_put(res-fi);
res-fi = fi;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TFRC]: Move comment.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=78282d2af598a1840934e2049a5c196885647f6a
Commit: 78282d2af598a1840934e2049a5c196885647f6a
Parent: c69bce20dda7f79160856a338298d65a284ba303
Author: Gerrit Renker [EMAIL PROTECTED]
AuthorDate: Sat Dec 8 15:08:08 2007 -0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:03 2008 -0800

[TFRC]: Move comment.

Moved up the comment Receiver routines above the first occurrence of
RX history routines.

Signed-off-by: Gerrit Renker [EMAIL PROTECTED]
Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/dccp/ccids/lib/packet_history.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/dccp/ccids/lib/packet_history.c 
b/net/dccp/ccids/lib/packet_history.c
index 4eddb2d..54cd23e 100644
--- a/net/dccp/ccids/lib/packet_history.c
+++ b/net/dccp/ccids/lib/packet_history.c
@@ -114,6 +114,11 @@ u32 tfrc_tx_hist_rtt(struct tfrc_tx_hist_entry *head, 
const u64 seqno,
 EXPORT_SYMBOL_GPL(tfrc_tx_hist_rtt);
 
 
+/*
+ * Receiver History Routines
+ */
+static struct kmem_cache *tfrc_rx_hist_slab;
+
 /**
  * tfrc_rx_hist_index - index to reach n-th entry after loss_start
  */
@@ -131,11 +136,6 @@ static inline struct tfrc_rx_hist_entry *
return h-ring[tfrc_rx_hist_index(h, h-loss_count)];
 }
 
-/*
- * Receiver History Routines
- */
-static struct kmem_cache *tfrc_rx_hist_slab;
-
 void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h,
 const struct sk_buff *skb,
 const u32 ndp)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPSEC]: Add xfrm_input_state helper

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=005011211f559113686938c2c252b8ee1ab855b5
Commit: 005011211f559113686938c2c252b8ee1ab855b5
Parent: 385ac2e3f226c09cb71733df1899658e33a7850f
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Tue Dec 11 01:53:43 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:05 2008 -0800

[IPSEC]: Add xfrm_input_state helper

This patch adds the xfrm_input_state helper function which returns the
current xfrm state being processed on the input path given an sk_buff.
This is currently only used by xfrm_input but will be used by ESP upon
asynchronous resumption.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/xfrm.h|5 +
 net/xfrm/xfrm_input.c |2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 503d0d2..fe881b6 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1317,4 +1317,9 @@ static inline void xfrm_states_delete(struct xfrm_state 
**states, int n)
 }
 #endif
 
+static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
+{
+   return skb-sp-xvec[skb-sp-len - 1];
+}
+
 #endif /* _NET_XFRM_H */
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 8b2b1b5..8624cbd 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -109,7 +109,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 
spi, int encap_type)
/* A negative encap_type indicates async resumption. */
if (encap_type  0) {
async = 1;
-   x = skb-sp-xvec[skb-sp-len - 1];
+   x = xfrm_input_state(skb);
seq = XFRM_SKB_CB(skb)-seq;
goto resume;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET]: dst_ifdown() cleanup

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=64b7d96167977850f4a24e52dd0a76b03c6542cf
Commit: 64b7d96167977850f4a24e52dd0a76b03c6542cf
Parent: 005011211f559113686938c2c252b8ee1ab855b5
Author: Eric Dumazet [EMAIL PROTECTED]
AuthorDate: Tue Dec 11 02:00:30 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:05 2008 -0800

[NET]: dst_ifdown() cleanup

This cleanup shrinks size of net/core/dst.o on i386 from 1299 to 1289 bytes.
(This is because dev_hold()/dev_put() are doing atomic_inc()/atomic_dec() 
and
force compiler to re-evaluate memory contents.)

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/core/dst.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/core/dst.c b/net/core/dst.c
index 5c6cfc4..7eceeba 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -284,8 +284,8 @@ static inline void dst_ifdown(struct dst_entry *dst, struct 
net_device *dev,
dev_put(dev);
if (dst-neighbour  dst-neighbour-dev == dev) {
dst-neighbour-dev = dst-dev;
+   dev_hold(dst-dev);
dev_put(dev);
-   dev_hold(dst-neighbour-dev);
}
}
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[INET]: Use BUILD_BUG_ON in inet_timewait_sock.c checks

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=95c9382a345262637d3e5c7da5f09f0f46daa930
Commit: 95c9382a345262637d3e5c7da5f09f0f46daa930
Parent: 1f9e636ea21bd648a5cbd2f744a1d39a5e183b20
Author: Pavel Emelyanov [EMAIL PROTECTED]
AuthorDate: Tue Dec 11 02:12:36 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:08 2008 -0800

[INET]: Use BUILD_BUG_ON in inet_timewait_sock.c checks

Make the INET_TWDR_TWKILL_SLOTS vs sizeof(twdr-thread_slots)
check nicer.

Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/inet_timewait_sock.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index a60b99e..d43e787 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -194,16 +194,14 @@ out:
 
 EXPORT_SYMBOL_GPL(inet_twdr_hangman);
 
-extern void twkill_slots_invalid(void);
-
 void inet_twdr_twkill_work(struct work_struct *work)
 {
struct inet_timewait_death_row *twdr =
container_of(work, struct inet_timewait_death_row, twkill_work);
int i;
 
-   if ((INET_TWDR_TWKILL_SLOTS - 1)  (sizeof(twdr-thread_slots) * 8))
-   twkill_slots_invalid();
+   BUILD_BUG_ON((INET_TWDR_TWKILL_SLOTS - 1) 
+   (sizeof(twdr-thread_slots) * 8));
 
while (twdr-thread_slots) {
spin_lock_bh(twdr-death_lock);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV6]: make the protocol initialization to return an error code

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7f4e4868f3ce0e946f116c28fa4fe033be5e4ba9
Commit: 7f4e4868f3ce0e946f116c28fa4fe033be5e4ba9
Parent: 87c3efbfdd1f98af14a1f60ff19f73d9a8d8da98
Author: Daniel Lezcano [EMAIL PROTECTED]
AuthorDate: Tue Dec 11 02:25:35 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:13 2008 -0800

[IPV6]: make the protocol initialization to return an error code

This patchset makes the different protocols to return an error code, so
the af_inet6 module can check the initialization was correct or not.

The raw6 was taken into account to be consistent with the rest of the
protocols, but the registration is at the same place.
Because the raw6 has its own init function, the proto and the ops structure
can be moved inside the raw6.c file.

Signed-off-by: Daniel Lezcano [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/ipv6.h   |2 +-
 include/net/transp_v6.h  |   12 +--
 net/ipv6/af_inet6.c  |   77 +++--
 net/ipv6/ipv6_sockglue.c |3 +-
 net/ipv6/raw.c   |   52 +++
 net/ipv6/tcp_ipv6.c  |   36 +
 net/ipv6/udp.c   |   26 +--
 net/ipv6/udplite.c   |   25 --
 8 files changed, 168 insertions(+), 65 deletions(-)

diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 4d91065..f2adedf 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -545,7 +545,7 @@ extern int  compat_ipv6_getsockopt(struct 
sock *sk,
char __user *optval,
int __user *optlen);
 
-extern voidipv6_packet_init(void);
+extern int ipv6_packet_init(void);
 
 extern voidipv6_packet_cleanup(void);
 
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index aa9a4a6..27394e0 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -23,10 +23,14 @@ extern int  ipv6_frag_init(void);
 extern voidipv6_frag_exit(void);
 
 /* transport protocols */
-extern voidrawv6_init(void);
-extern voidudpv6_init(void);
-extern voidudplitev6_init(void);
-extern voidtcpv6_init(void);
+extern int rawv6_init(void);
+extern voidrawv6_exit(void);
+extern int udpv6_init(void);
+extern voidudpv6_exit(void);
+extern int udplitev6_init(void);
+extern voidudplitev6_exit(void);
+extern int tcpv6_init(void);
+extern voidtcpv6_exit(void);
 
 extern int udpv6_connect(struct sock *sk,
  struct sockaddr *uaddr,
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 53b06de..34c2053 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -529,42 +529,6 @@ static struct net_proto_family inet6_family_ops = {
.owner  = THIS_MODULE,
 };
 
-/* Same as inet6_dgram_ops, sans udp_poll.  */
-static const struct proto_ops inet6_sockraw_ops = {
-   .family= PF_INET6,
-   .owner = THIS_MODULE,
-   .release   = inet6_release,
-   .bind  = inet6_bind,
-   .connect   = inet_dgram_connect,/* ok   */
-   .socketpair= sock_no_socketpair,/* a do nothing */
-   .accept= sock_no_accept,/* a do nothing */
-   .getname   = inet6_getname,
-   .poll  = datagram_poll, /* ok   */
-   .ioctl = inet6_ioctl,   /* must change  */
-   .listen= sock_no_listen,/* ok   */
-   .shutdown  = inet_shutdown, /* ok   */
-   .setsockopt= sock_common_setsockopt,/* ok   */
-   .getsockopt= sock_common_getsockopt,/* ok   */
-   .sendmsg   = inet_sendmsg,  /* ok   */
-   .recvmsg   = sock_common_recvmsg,   /* ok   */
-   .mmap  = sock_no_mmap,
-   .sendpage  = sock_no_sendpage,
-#ifdef CONFIG_COMPAT
-   .compat_setsockopt = compat_sock_common_setsockopt,
-   .compat_getsockopt = compat_sock_common_getsockopt,
-#endif
-};
-
-static struct inet_protosw rawv6_protosw = {
-   .type   = SOCK_RAW,
-   .protocol   = IPPROTO_IP,   /* wild card */
-   .prot   = rawv6_prot,

[NETNS]: separate af_packet netns data

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2aaef4e47fef8a6c0bc7fc5d9d3eea4af290e04c
Commit: 2aaef4e47fef8a6c0bc7fc5d9d3eea4af290e04c
Parent: a0a53c8ba95451feef6c1975016f0a1eb3044ad4
Author: Denis V. Lunev [EMAIL PROTECTED]
AuthorDate: Tue Dec 11 04:19:54 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:15 2008 -0800

[NETNS]: separate af_packet netns data

Signed-off-by: Denis V. Lunev [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/net_namespace.h |6 ++
 include/net/netns/packet.h  |   15 +++
 net/packet/af_packet.c  |   28 ++--
 3 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index d943fd4..18da0af 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -9,6 +9,7 @@
 #include linux/list.h
 
 #include net/netns/unix.h
+#include net/netns/packet.h
 
 struct proc_dir_entry;
 struct net_device;
@@ -43,10 +44,7 @@ struct net {
struct ctl_table_header *sysctl_core_hdr;
int sysctl_somaxconn;
 
-   /* List of all packet sockets. */
-   rwlock_tpacket_sklist_lock;
-   struct hlist_head   packet_sklist;
-
+   struct netns_packet packet;
struct netns_unix   unx;
 };
 
diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h
new file mode 100644
index 000..637daf6
--- /dev/null
+++ b/include/net/netns/packet.h
@@ -0,0 +1,15 @@
+/*
+ * Packet network namespace
+ */
+#ifndef __NETNS_PACKET_H__
+#define __NETNS_PACKET_H__
+
+#include linux/list.h
+#include linux/spinlock.h
+
+struct netns_packet {
+   rwlock_tsklist_lock;
+   struct hlist_head   sklist;
+};
+
+#endif /* __NETNS_PACKET_H__ */
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index ace29f1..485af56 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -803,9 +803,9 @@ static int packet_release(struct socket *sock)
net = sk-sk_net;
po = pkt_sk(sk);
 
-   write_lock_bh(net-packet_sklist_lock);
+   write_lock_bh(net-packet.sklist_lock);
sk_del_node_init(sk);
-   write_unlock_bh(net-packet_sklist_lock);
+   write_unlock_bh(net-packet.sklist_lock);
 
/*
 *  Unhook packet receive handler.
@@ -1015,9 +1015,9 @@ static int packet_create(struct net *net, struct socket 
*sock, int protocol)
po-running = 1;
}
 
-   write_lock_bh(net-packet_sklist_lock);
-   sk_add_node(sk, net-packet_sklist);
-   write_unlock_bh(net-packet_sklist_lock);
+   write_lock_bh(net-packet.sklist_lock);
+   sk_add_node(sk, net-packet.sklist);
+   write_unlock_bh(net-packet.sklist_lock);
return(0);
 out:
return err;
@@ -1452,8 +1452,8 @@ static int packet_notifier(struct notifier_block *this, 
unsigned long msg, void
struct net_device *dev = data;
struct net *net = dev-nd_net;
 
-   read_lock(net-packet_sklist_lock);
-   sk_for_each(sk, node, net-packet_sklist) {
+   read_lock(net-packet.sklist_lock);
+   sk_for_each(sk, node, net-packet.sklist) {
struct packet_sock *po = pkt_sk(sk);
 
switch (msg) {
@@ -1492,7 +1492,7 @@ static int packet_notifier(struct notifier_block *this, 
unsigned long msg, void
break;
}
}
-   read_unlock(net-packet_sklist_lock);
+   read_unlock(net-packet.sklist_lock);
return NOTIFY_DONE;
 }
 
@@ -1862,7 +1862,7 @@ static inline struct sock *packet_seq_idx(struct net 
*net, loff_t off)
struct sock *s;
struct hlist_node *node;
 
-   sk_for_each(s, node, net-packet_sklist) {
+   sk_for_each(s, node, net-packet.sklist) {
if (!off--)
return s;
}
@@ -1872,7 +1872,7 @@ static inline struct sock *packet_seq_idx(struct net 
*net, loff_t off)
 static void *packet_seq_start(struct seq_file *seq, loff_t *pos)
 {
struct net *net = seq_file_net(seq);
-   read_lock(net-packet_sklist_lock);
+   read_lock(net-packet.sklist_lock);
return *pos ? packet_seq_idx(net, *pos - 1) : SEQ_START_TOKEN;
 }
 
@@ -1881,14 +1881,14 @@ static void *packet_seq_next(struct seq_file *seq, void 
*v, loff_t *pos)
struct net *net = seq-private;
++*pos;
return  (v == SEQ_START_TOKEN)
-   ? sk_head(net-packet_sklist)
+   ? sk_head(net-packet.sklist)
: sk_next((struct sock*)v) ;
 }
 
 static void packet_seq_stop(struct seq_file *seq, void *v)
 {
struct net *net = seq-private;
-   read_unlock(net-packet_sklist_lock);
+   read_unlock(net-packet.sklist_lock);
 }
 
 static int packet_seq_show(struct seq_file *seq, void *v)
@@ -1940,8 +1940,8 @@ 

[TFRC]: Loss interval code needs the macros/inlines that were moved

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8995a238ef6869bc5c80240440bc58452c7af283
Commit: 8995a238ef6869bc5c80240440bc58452c7af283
Parent: df8f83fdd6369e1ba85f089fd6fe26bb2ddcb36f
Author: Gerrit Renker [EMAIL PROTECTED]
AuthorDate: Wed Dec 12 12:28:40 2007 -0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:16 2008 -0800

[TFRC]: Loss interval code needs the macros/inlines that were moved

This moves the inlines (which were previously declared as macros) back into
packet_history.h since the loss detection code needs to be able to read 
entries
from the RX history in order to create the relevant loss entries: it needs 
at
least tfrc_rx_hist_loss_prev() and tfrc_rx_hist_last_rcv(), which in turn
require the definition of the other inlines (macros).

Signed-off-by: Gerrit Renker [EMAIL PROTECTED]
Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/dccp/ccids/lib/packet_history.c |   35 ---
 net/dccp/ccids/lib/packet_history.h |   35 +++
 2 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/net/dccp/ccids/lib/packet_history.c 
b/net/dccp/ccids/lib/packet_history.c
index 727b17d..dd2cf2d 100644
--- a/net/dccp/ccids/lib/packet_history.c
+++ b/net/dccp/ccids/lib/packet_history.c
@@ -151,23 +151,6 @@ void tfrc_rx_packet_history_exit(void)
}
 }
 
-/**
- * tfrc_rx_hist_index - index to reach n-th entry after loss_start
- */
-static inline u8 tfrc_rx_hist_index(const struct tfrc_rx_hist *h, const u8 n)
-{
-   return (h-loss_start + n)  TFRC_NDUPACK;
-}
-
-/**
- * tfrc_rx_hist_last_rcv - entry with highest-received-seqno so far
- */
-static inline struct tfrc_rx_hist_entry *
-   tfrc_rx_hist_last_rcv(const struct tfrc_rx_hist *h)
-{
-   return h-ring[tfrc_rx_hist_index(h, h-loss_count)];
-}
-
 void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h,
 const struct sk_buff *skb,
 const u32 ndp)
@@ -183,24 +166,6 @@ void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h,
 }
 EXPORT_SYMBOL_GPL(tfrc_rx_hist_add_packet);
 
-/**
- * tfrc_rx_hist_entry - return the n-th history entry after loss_start
- */
-static inline struct tfrc_rx_hist_entry *
-   tfrc_rx_hist_entry(const struct tfrc_rx_hist *h, const u8 n)
-{
-   return h-ring[tfrc_rx_hist_index(h, n)];
-}
-
-/**
- * tfrc_rx_hist_loss_prev - entry with highest-received-seqno before loss was 
detected
- */
-static inline struct tfrc_rx_hist_entry *
-   tfrc_rx_hist_loss_prev(const struct tfrc_rx_hist *h)
-{
-   return h-ring[h-loss_start];
-}
-
 /* has the packet contained in skb been seen before? */
 int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb)
 {
diff --git a/net/dccp/ccids/lib/packet_history.h 
b/net/dccp/ccids/lib/packet_history.h
index 3dfd182..e58b0fc 100644
--- a/net/dccp/ccids/lib/packet_history.h
+++ b/net/dccp/ccids/lib/packet_history.h
@@ -84,6 +84,41 @@ struct tfrc_rx_hist {
 #define rtt_sample_prev  loss_start
 };
 
+/**
+ * tfrc_rx_hist_index - index to reach n-th entry after loss_start
+ */
+static inline u8 tfrc_rx_hist_index(const struct tfrc_rx_hist *h, const u8 n)
+{
+   return (h-loss_start + n)  TFRC_NDUPACK;
+}
+
+/**
+ * tfrc_rx_hist_last_rcv - entry with highest-received-seqno so far
+ */
+static inline struct tfrc_rx_hist_entry *
+   tfrc_rx_hist_last_rcv(const struct tfrc_rx_hist *h)
+{
+   return h-ring[tfrc_rx_hist_index(h, h-loss_count)];
+}
+
+/**
+ * tfrc_rx_hist_entry - return the n-th history entry after loss_start
+ */
+static inline struct tfrc_rx_hist_entry *
+   tfrc_rx_hist_entry(const struct tfrc_rx_hist *h, const 
u8 n)
+{
+   return h-ring[tfrc_rx_hist_index(h, n)];
+}
+
+/**
+ * tfrc_rx_hist_loss_prev - entry with highest-received-seqno before loss was 
detected
+ */
+static inline struct tfrc_rx_hist_entry *
+   tfrc_rx_hist_loss_prev(const struct tfrc_rx_hist *h)
+{
+   return h-ring[h-loss_start];
+}
+
 extern void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h,
const struct sk_buff *skb, const u32 ndp);
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TFRC]: Migrate TX history to singly-linked lis

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=276f2edc52e309b38a216245952e05880e182c83
Commit: 276f2edc52e309b38a216245952e05880e182c83
Parent: ea4f76ae13b4240dac304ed50636391d6b22e9c5
Author: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
AuthorDate: Wed Nov 28 11:15:40 2007 -0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:55:11 2008 -0800

[TFRC]: Migrate TX history to singly-linked lis

This patch was based on another made by Gerrit Renker, his changelog was:

--
The patch set migrates TFRC TX history to a singly-linked list.

The details are:
 * use of a consistent naming scheme (all TFRC functions now begin with 
`tfrc_');
 * allocation and cleanup are taken care of internally;
 * provision of a lookup function, which is used by the CCID TX 
infrastructure
   to determine the time a packet was sent (in turn used for RTT sampling);
 * integration of the new interface with the present use in CCID3.
--

Simplifications I did:

. removing the tfrc_tx_hist_head that had a pointer to the list head and
  another for the slabcache.
. No need for creating a slabcache for each CCID that wants to use the TFRC
  tx history routines, create a single slabcache when the dccp_tfrc_lib 
module
  init routine is called.

Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/dccp/ccids/ccid3.c  |   57 --
 net/dccp/ccids/ccid3.h  |3 +-
 net/dccp/ccids/lib/loss_interval.c  |   12 ++--
 net/dccp/ccids/lib/packet_history.c |  138 ---
 net/dccp/ccids/lib/packet_history.h |   79 
 5 files changed, 102 insertions(+), 187 deletions(-)

diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 42893b1..f73542a 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -49,7 +49,6 @@ static int ccid3_debug;
 #define ccid3_pr_debug(format, a...)
 #endif
 
-static struct dccp_tx_hist *ccid3_tx_hist;
 static struct dccp_rx_hist *ccid3_rx_hist;
 
 /*
@@ -389,28 +388,18 @@ static void ccid3_hc_tx_packet_sent(struct sock *sk, int 
more,
unsigned int len)
 {
struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
-   struct dccp_tx_hist_entry *packet;
 
ccid3_hc_tx_update_s(hctx, len);
 
-   packet = dccp_tx_hist_entry_new(ccid3_tx_hist, GFP_ATOMIC);
-   if (unlikely(packet == NULL)) {
+   if (tfrc_tx_hist_add(hctx-ccid3hctx_hist, dccp_sk(sk)-dccps_gss))
DCCP_CRIT(packet history - out of memory!);
-   return;
-   }
-   dccp_tx_hist_add_entry(hctx-ccid3hctx_hist, packet);
-
-   packet-dccphtx_tstamp = ktime_get_real();
-   packet-dccphtx_seqno  = dccp_sk(sk)-dccps_gss;
-   packet-dccphtx_rtt= hctx-ccid3hctx_rtt;
-   packet-dccphtx_sent   = 1;
 }
 
 static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
 {
struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
struct ccid3_options_received *opt_recv;
-   struct dccp_tx_hist_entry *packet;
+   struct tfrc_tx_hist_entry *packet;
ktime_t now;
unsigned long t_nfb;
u32 pinv, r_sample;
@@ -425,16 +414,19 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, 
struct sk_buff *skb)
switch (hctx-ccid3hctx_state) {
case TFRC_SSTATE_NO_FBACK:
case TFRC_SSTATE_FBACK:
-   /* get packet from history to look up t_recvdata */
-   packet = dccp_tx_hist_find_entry(hctx-ccid3hctx_hist,
- DCCP_SKB_CB(skb)-dccpd_ack_seq);
-   if (unlikely(packet == NULL)) {
-   DCCP_WARN(%s(%p), seqno %llu(%s) doesn't exist 
- in history!\n,  dccp_role(sk), sk,
-   (unsigned long long)DCCP_SKB_CB(skb)-dccpd_ack_seq,
-   dccp_packet_name(DCCP_SKB_CB(skb)-dccpd_type));
+   /* estimate RTT from history if ACK number is valid */
+   packet = tfrc_tx_hist_find_entry(hctx-ccid3hctx_hist,
+
DCCP_SKB_CB(skb)-dccpd_ack_seq);
+   if (packet == NULL) {
+   DCCP_WARN(%s(%p): %s with bogus ACK-%llu\n, 
dccp_role(sk), sk,
+ 
dccp_packet_name(DCCP_SKB_CB(skb)-dccpd_type),
+ (unsigned long 
long)DCCP_SKB_CB(skb)-dccpd_ack_seq);
return;
}
+   /*
+* Garbage-collect older (irrelevant) entries
+*/
+   tfrc_tx_hist_purge(packet-next);
 
  

[IPSEC]: Make xfrm_lookup flags argument a bit-field

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=815f4e57e9fc67456624ecde0515a901368c78d2
Commit: 815f4e57e9fc67456624ecde0515a901368c78d2
Parent: 3f71c81ac37b27b824e9ce18fe17438dc2af4a16
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Wed Dec 12 10:36:59 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:21 2008 -0800

[IPSEC]: Make xfrm_lookup flags argument a bit-field

This patch introduces an enum for bits in the flags argument of xfrm_lookup.
This is so that we can cram more information into it later.

Since all current users use just the values 0 and 1, XFRM_LOOKUP_WAIT has
been added with the value 1  0 to represent the current meaning of flags.

The test in __xfrm_lookup has been changed accordingly.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/dst.h  |5 +
 net/xfrm/xfrm_policy.c |2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/include/net/dst.h b/include/net/dst.h
index e86b9a0..aaa2dbb 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -265,6 +265,11 @@ static inline struct dst_entry *dst_check(struct dst_entry 
*dst, u32 cookie)
 
 extern voiddst_init(void);
 
+/* Flags for xfrm_lookup flags argument. */
+enum {
+   XFRM_LOOKUP_WAIT = 1  0,
+};
+
 struct flowi;
 #ifndef CONFIG_XFRM
 static inline int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 95dc581..3d516d5 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1565,7 +1565,7 @@ restart:
xfrm_pol_put(policy);
return -EREMOTE;
}
-   if (err == -EAGAIN  flags) {
+   if (err == -EAGAIN  (flags  XFRM_LOOKUP_WAIT)) {
DECLARE_WAITQUEUE(wait, current);
 
add_wait_queue(km_waitq, wait);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPSEC]: Added xfrm_decode_session_reverse and xfrmX_policy_check_reverse

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d5422efe680fc55010c6ddca2370ca9548a96355
Commit: d5422efe680fc55010c6ddca2370ca9548a96355
Parent: 815f4e57e9fc67456624ecde0515a901368c78d2
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Wed Dec 12 10:44:16 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:22 2008 -0800

[IPSEC]: Added xfrm_decode_session_reverse and xfrmX_policy_check_reverse

RFC 4301 requires us to relookup ICMP traffic that does not match any
policies using the reverse of its payload.  This patch adds the functions
xfrm_decode_session_reverse and xfrmX_policy_check_reverse so we can get
the reverse flow to perform such a lookup.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/xfrm.h|1 +
 include/net/xfrm.h  |   63 +++---
 net/ipv4/xfrm4_policy.c |   10 +++---
 net/ipv6/xfrm6_policy.c |   10 +++---
 net/xfrm/xfrm_policy.c  |   17 
 5 files changed, 80 insertions(+), 21 deletions(-)

diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index b58adc5..c0e41e0 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -114,6 +114,7 @@ enum
XFRM_POLICY_IN  = 0,
XFRM_POLICY_OUT = 1,
XFRM_POLICY_FWD = 2,
+   XFRM_POLICY_MASK = 3,
XFRM_POLICY_MAX = 3
 };
 
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index fe881b6..d6dae5a 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -239,7 +239,8 @@ struct xfrm_policy_afinfo {
int (*get_saddr)(xfrm_address_t *saddr, 
xfrm_address_t *daddr);
struct dst_entry*(*find_bundle)(struct flowi *fl, struct 
xfrm_policy *policy);
void(*decode_session)(struct sk_buff *skb,
- struct flowi *fl);
+ struct flowi *fl,
+ int reverse);
int (*get_tos)(struct flowi *fl);
int (*fill_dst)(struct xfrm_dst *xdst,
struct net_device *dev);
@@ -844,14 +845,23 @@ xfrm_state_addr_cmp(struct xfrm_tmpl *tmpl, struct 
xfrm_state *x, unsigned short
 #ifdef CONFIG_XFRM
 extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, 
unsigned short family);
 
-static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff 
*skb, unsigned short family)
+static inline int __xfrm_policy_check2(struct sock *sk, int dir,
+  struct sk_buff *skb,
+  unsigned int family, int reverse)
 {
+   int ndir = dir | (reverse ? XFRM_POLICY_MASK + 1 : 0);
+
if (sk  sk-sk_policy[XFRM_POLICY_IN])
-   return __xfrm_policy_check(sk, dir, skb, family);
+   return __xfrm_policy_check(sk, ndir, skb, family);
 
return  (!xfrm_policy_count[dir]  !skb-sp) ||
(skb-dst-flags  DST_NOPOLICY) ||
-   __xfrm_policy_check(sk, dir, skb, family);
+   __xfrm_policy_check(sk, ndir, skb, family);
+}
+
+static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff 
*skb, unsigned short family)
+{
+   return __xfrm_policy_check2(sk, dir, skb, family, 0);
 }
 
 static inline int xfrm4_policy_check(struct sock *sk, int dir, struct sk_buff 
*skb)
@@ -864,7 +874,34 @@ static inline int xfrm6_policy_check(struct sock *sk, int 
dir, struct sk_buff *s
return xfrm_policy_check(sk, dir, skb, AF_INET6);
 }
 
-extern int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, unsigned 
short family);
+static inline int xfrm4_policy_check_reverse(struct sock *sk, int dir,
+struct sk_buff *skb)
+{
+   return __xfrm_policy_check2(sk, dir, skb, AF_INET, 1);
+}
+
+static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir,
+struct sk_buff *skb)
+{
+   return __xfrm_policy_check2(sk, dir, skb, AF_INET6, 1);
+}
+
+extern int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
+unsigned int family, int reverse);
+
+static inline int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
+ unsigned int family)
+{
+   return __xfrm_decode_session(skb, fl, family, 0);
+}
+
+static inline int xfrm_decode_session_reverse(struct sk_buff *skb,
+ struct flowi *fl,
+ unsigned int family)
+{
+   return __xfrm_decode_session(skb, fl, family, 1);
+}
+
 extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);
 
 static inline int 

[BNX2]: Enable S/G for jumbo RX.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=84eaa1877137def7fe01340f2abbad510aa890f5
Commit: 84eaa1877137def7fe01340f2abbad510aa890f5
Parent: 1db82f2aec0766edd4a4f8d86283e91559350de7
Author: Michael Chan [EMAIL PROTECTED]
AuthorDate: Wed Dec 12 11:19:57 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:32 2008 -0800

[BNX2]: Enable S/G for jumbo RX.

If the MTU requires more than 1 page for the SKB, enable the page ring
and calculate the size of the page ring.  This will guarantee order-0
allocation regardless of the MTU size.

Fixup loopback test packet size so that we don't deal with the pages
during loopback test.

Signed-off-by: Michael Chan [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/net/bnx2.c |   21 +++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 6c0fc8a..ae081c8 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -4493,15 +4493,32 @@ static u32 bnx2_find_max_ring(u32 ring_size, u32 
max_size)
 static void
 bnx2_set_rx_ring_size(struct bnx2 *bp, u32 size)
 {
-   u32 rx_size;
+   u32 rx_size, rx_space, jumbo_size;
 
/* 8 for CRC and VLAN */
rx_size = bp-dev-mtu + ETH_HLEN + bp-rx_offset + 8;
 
+   rx_space = SKB_DATA_ALIGN(rx_size + BNX2_RX_ALIGN) + NET_SKB_PAD +
+   sizeof(struct skb_shared_info);
+
bp-rx_copy_thresh = RX_COPY_THRESH;
bp-rx_pg_ring_size = 0;
bp-rx_max_pg_ring = 0;
bp-rx_max_pg_ring_idx = 0;
+   if (rx_space  PAGE_SIZE) {
+   int pages = PAGE_ALIGN(bp-dev-mtu - 40)  PAGE_SHIFT;
+
+   jumbo_size = size * pages;
+   if (jumbo_size  MAX_TOTAL_RX_PG_DESC_CNT)
+   jumbo_size = MAX_TOTAL_RX_PG_DESC_CNT;
+
+   bp-rx_pg_ring_size = jumbo_size;
+   bp-rx_max_pg_ring = bnx2_find_max_ring(jumbo_size,
+   MAX_RX_PG_RINGS);
+   bp-rx_max_pg_ring_idx = (bp-rx_max_pg_ring * RX_DESC_CNT) - 1;
+   rx_size = RX_COPY_THRESH + bp-rx_offset;
+   bp-rx_copy_thresh = 0;
+   }
 
bp-rx_buf_use_size = rx_size;
/* hw alignment */
@@ -4881,7 +4898,7 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode)
else
return -EINVAL;
 
-   pkt_size = 1514;
+   pkt_size = min(bp-dev-mtu + ETH_HLEN, bp-rx_jumbo_thresh - 4);
skb = netdev_alloc_skb(bp-dev, pkt_size);
if (!skb)
return -ENOMEM;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[BNX2]: Restructure IRQ datastructures.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6d866ffc69b0c3e584782f212a3f783708d31e9a
Commit: 6d866ffc69b0c3e584782f212a3f783708d31e9a
Parent: ead7270b993bed77cb45a5bc786a879679e2b16a
Author: Michael Chan [EMAIL PROTECTED]
AuthorDate: Thu Dec 20 19:56:09 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:34 2008 -0800

[BNX2]: Restructure IRQ datastructures.

Add a table to keep track of multiple IRQs and restructure the IRQ
request and free functions so that they can be easily expanded to
handle multiple IRQs.

Signed-off-by: Michael Chan [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/net/bnx2.c |   55 +++
 drivers/net/bnx2.h |   12 +++
 2 files changed, 45 insertions(+), 22 deletions(-)

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index f19a1e9..83cdbde 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -5234,18 +5234,15 @@ static int
 bnx2_request_irq(struct bnx2 *bp)
 {
struct net_device *dev = bp-dev;
-   int rc = 0;
-
-   if (bp-flags  USING_MSI_FLAG) {
-   irq_handler_t   fn = bnx2_msi;
-
-   if (bp-flags  ONE_SHOT_MSI_FLAG)
-   fn = bnx2_msi_1shot;
+   unsigned long flags;
+   struct bnx2_irq *irq = bp-irq_tbl[0];
+   int rc;
 
-   rc = request_irq(bp-pdev-irq, fn, 0, dev-name, dev);
-   } else
-   rc = request_irq(bp-pdev-irq, bnx2_interrupt,
-IRQF_SHARED, dev-name, dev);
+   if (bp-flags  USING_MSI_FLAG)
+   flags = 0;
+   else
+   flags = IRQF_SHARED;
+   rc = request_irq(irq-vector, irq-handler, flags, dev-name, dev);
return rc;
 }
 
@@ -5254,12 +5251,31 @@ bnx2_free_irq(struct bnx2 *bp)
 {
struct net_device *dev = bp-dev;
 
+   free_irq(bp-irq_tbl[0].vector, dev);
if (bp-flags  USING_MSI_FLAG) {
-   free_irq(bp-pdev-irq, dev);
pci_disable_msi(bp-pdev);
bp-flags = ~(USING_MSI_FLAG | ONE_SHOT_MSI_FLAG);
-   } else
-   free_irq(bp-pdev-irq, dev);
+   }
+}
+
+static void
+bnx2_setup_int_mode(struct bnx2 *bp, int dis_msi)
+{
+   bp-irq_tbl[0].handler = bnx2_interrupt;
+   strcpy(bp-irq_tbl[0].name, bp-dev-name);
+
+   if ((bp-flags  MSI_CAP_FLAG)  !dis_msi) {
+   if (pci_enable_msi(bp-pdev) == 0) {
+   bp-flags |= USING_MSI_FLAG;
+   if (CHIP_NUM(bp) == CHIP_NUM_5709) {
+   bp-flags |= ONE_SHOT_MSI_FLAG;
+   bp-irq_tbl[0].handler = bnx2_msi_1shot;
+   } else
+   bp-irq_tbl[0].handler = bnx2_msi;
+   }
+   }
+
+   bp-irq_tbl[0].vector = bp-pdev-irq;
 }
 
 /* Called with rtnl_lock */
@@ -5278,15 +5294,8 @@ bnx2_open(struct net_device *dev)
if (rc)
return rc;
 
+   bnx2_setup_int_mode(bp, disable_msi);
napi_enable(bp-napi);
-
-   if ((bp-flags  MSI_CAP_FLAG)  !disable_msi) {
-   if (pci_enable_msi(bp-pdev) == 0) {
-   bp-flags |= USING_MSI_FLAG;
-   if (CHIP_NUM(bp) == CHIP_NUM_5709)
-   bp-flags |= ONE_SHOT_MSI_FLAG;
-   }
-   }
rc = bnx2_request_irq(bp);
 
if (rc) {
@@ -5325,6 +5334,8 @@ bnx2_open(struct net_device *dev)
bnx2_disable_int(bp);
bnx2_free_irq(bp);
 
+   bnx2_setup_int_mode(bp, 1);
+
rc = bnx2_init_nic(bp);
 
if (!rc)
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 1f244fa..1accf00 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6494,6 +6494,15 @@ struct flash_spec {
u8  *name;
 };
 
+#define BNX2_MAX_MSIX_HW_VEC   9
+#define BNX2_MAX_MSIX_VEC  1
+
+struct bnx2_irq {
+   irq_handler_t   handler;
+   u16 vector;
+   charname[16];
+};
+
 struct bnx2 {
/* Fields used in the tx and intr/napi performance paths are grouped */
/* together in the beginning of the structure. */
@@ -6721,6 +6730,9 @@ struct bnx2 {
u32 flash_size;
 
int status_stats_size;
+
+   struct bnx2_irq irq_tbl[BNX2_MAX_MSIX_VEC];
+   int irq_nvecs;
 };
 
 static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[BNX2]: Enable new tx ring.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=57851d84533655db6948e25c54df19ecb673bf2f
Commit: 57851d84533655db6948e25c54df19ecb673bf2f
Parent: c76c04758b8fd24a1c38b19742e3437e954e945b
Author: Michael Chan [EMAIL PROTECTED]
AuthorDate: Thu Dec 20 20:01:44 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:39 2008 -0800

[BNX2]: Enable new tx ring.

Enable new tx ring and add new MSIX handler and NAPI poll function
for the new tx ring.  Enable MSIX when the hardware supports it.

Signed-off-by: Michael Chan [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/net/bnx2.c |   87 +++
 drivers/net/bnx2.h |2 +-
 2 files changed, 81 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 4fc9d16..0120df4 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -598,7 +598,7 @@ bnx2_alloc_mem(struct bnx2 *bp)
for (i = 1; i  BNX2_MAX_MSIX_VEC; i++) {
struct bnx2_napi *bnapi = bp-bnx2_napi[i];
 
-   bnapi-status_blk = (void *)
+   bnapi-status_blk_msix = (void *)
((unsigned long) bp-status_blk +
 BNX2_SBLK_MSIX_ALIGN_SIZE * i);
bnapi-int_num = i  24;
@@ -2388,10 +2388,11 @@ bnx2_get_hw_tx_cons(struct bnx2_napi *bnapi)
return cons;
 }
 
-static void
-bnx2_tx_int(struct bnx2 *bp, struct bnx2_napi *bnapi)
+static int
+bnx2_tx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
 {
u16 hw_cons, sw_cons, sw_ring_cons;
+   int tx_pkt = 0;
 
hw_cons = bnx2_get_hw_tx_cons(bnapi);
sw_cons = bnapi-tx_cons;
@@ -2442,6 +2443,9 @@ bnx2_tx_int(struct bnx2 *bp, struct bnx2_napi *bnapi)
sw_cons = NEXT_TX_BD(sw_cons);
 
dev_kfree_skb(skb);
+   tx_pkt++;
+   if (tx_pkt == budget)
+   break;
 
hw_cons = bnx2_get_hw_tx_cons(bnapi);
}
@@ -2463,6 +2467,7 @@ bnx2_tx_int(struct bnx2 *bp, struct bnx2_napi *bnapi)
netif_wake_queue(bp-dev);
netif_tx_unlock(bp-dev);
}
+   return tx_pkt;
 }
 
 static void
@@ -2875,6 +2880,23 @@ bnx2_interrupt(int irq, void *dev_instance)
return IRQ_HANDLED;
 }
 
+static irqreturn_t
+bnx2_tx_msix(int irq, void *dev_instance)
+{
+   struct net_device *dev = dev_instance;
+   struct bnx2 *bp = netdev_priv(dev);
+   struct bnx2_napi *bnapi = bp-bnx2_napi[BNX2_TX_VEC];
+
+   prefetch(bnapi-status_blk_msix);
+
+   /* Return here if interrupt is disabled. */
+   if (unlikely(atomic_read(bp-intr_sem) != 0))
+   return IRQ_HANDLED;
+
+   netif_rx_schedule(dev, bnapi-napi);
+   return IRQ_HANDLED;
+}
+
 #define STATUS_ATTN_EVENTS (STATUS_ATTN_BITS_LINK_STATE | \
 STATUS_ATTN_BITS_TIMER_ABORT)
 
@@ -2895,6 +2917,29 @@ bnx2_has_work(struct bnx2_napi *bnapi)
return 0;
 }
 
+static int bnx2_tx_poll(struct napi_struct *napi, int budget)
+{
+   struct bnx2_napi *bnapi = container_of(napi, struct bnx2_napi, napi);
+   struct bnx2 *bp = bnapi-bp;
+   int work_done = 0;
+   struct status_block_msix *sblk = bnapi-status_blk_msix;
+
+   do {
+   work_done += bnx2_tx_int(bp, bnapi, budget - work_done);
+   if (unlikely(work_done = budget))
+   return work_done;
+
+   bnapi-last_status_idx = sblk-status_idx;
+   rmb();
+   } while (bnx2_get_hw_tx_cons(bnapi) != bnapi-hw_tx_cons);
+
+   netif_rx_complete(bp-dev, napi);
+   REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi-int_num |
+  BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
+  bnapi-last_status_idx);
+   return work_done;
+}
+
 static int bnx2_poll_work(struct bnx2 *bp, struct bnx2_napi *bnapi,
  int work_done, int budget)
 {
@@ -2916,7 +2961,7 @@ static int bnx2_poll_work(struct bnx2 *bp, struct 
bnx2_napi *bnapi,
}
 
if (bnx2_get_hw_tx_cons(bnapi) != bnapi-hw_tx_cons)
-   bnx2_tx_int(bp, bnapi);
+   bnx2_tx_int(bp, bnapi, 0);
 
if (bnx2_get_hw_rx_cons(bnapi) != bnapi-rx_cons)
work_done += bnx2_rx_int(bp, bnapi, budget - work_done);
@@ -5399,10 +5444,35 @@ bnx2_free_irq(struct bnx2 *bp)
 static void
 bnx2_enable_msix(struct bnx2 *bp)
 {
+   int i, rc;
+   struct msix_entry msix_ent[BNX2_MAX_MSIX_VEC];
+
bnx2_setup_msix_tbl(bp);
REG_WR(bp, BNX2_PCI_MSIX_CONTROL, BNX2_MAX_MSIX_HW_VEC - 1);
REG_WR(bp, BNX2_PCI_MSIX_TBL_OFF_BIR, BNX2_PCI_GRC_WINDOW2_BASE);
REG_WR(bp, BNX2_PCI_MSIX_PBA_OFF_BIT, BNX2_PCI_GRC_WINDOW3_BASE);
+
+   for (i = 0; i  BNX2_MAX_MSIX_VEC; 

[IPSEC]: Do not let packets pass when ICMP flag is off

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=aebcf82c1fe9231be5cb4f9c1362d5db39e7d7b2
Commit: aebcf82c1fe9231be5cb4f9c1362d5db39e7d7b2
Parent: bb72845e699d3c84e5f861b51db686107a51dea5
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Wed Dec 12 18:54:16 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:43 2008 -0800

[IPSEC]: Do not let packets pass when ICMP flag is off

This fixes a logical error in ICMP policy checks which lets
packets through if the state ICMP flag is off.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/icmp.c |7 +--
 net/ipv6/icmp.c |7 +--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index c41f3cc..ce5b4be 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -977,10 +977,13 @@ int icmp_rcv(struct sk_buff *skb)
struct icmphdr *icmph;
struct rtable *rt = (struct rtable *)skb-dst;
 
-   if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)  skb-sp 
-   skb-sp-xvec[skb-sp-len - 1]-props.flags  XFRM_STATE_ICMP) {
+   if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
int nh;
 
+   if (!(skb-sp  skb-sp-xvec[skb-sp-len - 1]-props.flags 
+XFRM_STATE_ICMP))
+   goto drop;
+
if (!pskb_may_pull(skb, sizeof(*icmph) + sizeof(struct iphdr)))
goto drop;
 
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 1659d2f..c3bbd86 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -644,10 +644,13 @@ static int icmpv6_rcv(struct sk_buff *skb)
struct icmp6hdr *hdr;
int type;
 
-   if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)  skb-sp 
-   skb-sp-xvec[skb-sp-len - 1]-props.flags  XFRM_STATE_ICMP) {
+   if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
int nh;
 
+   if (!(skb-sp  skb-sp-xvec[skb-sp-len - 1]-props.flags 
+XFRM_STATE_ICMP))
+   goto drop_no_count;
+
if (!pskb_may_pull(skb, sizeof(*hdr) + sizeof(*orig_hdr)))
goto drop_no_count;
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[DCCP]: Allow to parse options on Request Sockets

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8b819412481494fb6861c08d360b75fabcbbfbbf
Commit: 8b819412481494fb6861c08d360b75fabcbbfbbf
Parent: 7913350663e2756ecb91dd3a7c773806b943426e
Author: Gerrit Renker [EMAIL PROTECTED]
AuthorDate: Thu Dec 13 12:29:24 2007 -0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:50 2008 -0800

[DCCP]: Allow to parse options on Request Sockets

The option parsing code currently only parses on full sk's. This causes a 
problem for
options sent during the initial handshake (in particular timestamps and 
feature-negotiation
options). Therefore, this patch extends the option parsing code with an 
additional argument
for request_socks: if it is non-NULL, options are parsed on the request 
socket, otherwise
the normal path (parsing on the sk) is used.

Subsequent patches, which implement feature negotiation during connection 
setup, make use
of this facility.

Signed-off-by: Gerrit Renker [EMAIL PROTECTED]
Signed-off-by: Ian McDonald [EMAIL PROTECTED]
Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/dccp.h |5 +++--
 net/dccp/input.c |6 +++---
 net/dccp/ipv4.c  |8 
 net/dccp/ipv6.c  |8 
 net/dccp/options.c   |   34 +++---
 5 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index c676021..7214031 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -407,8 +407,6 @@ struct dccp_opt_pend {
 
 extern void dccp_minisock_init(struct dccp_minisock *dmsk);
 
-extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb);
-
 struct dccp_request_sock {
struct inet_request_sock dreq_inet_rsk;
__u64dreq_iss;
@@ -423,6 +421,9 @@ static inline struct dccp_request_sock *dccp_rsk(const 
struct request_sock *req)
 
 extern struct inet_timewait_death_row dccp_death_row;
 
+extern int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
+ struct sk_buff *skb);
+
 struct dccp_options_received {
u32 dccpor_ndp; /* only 24 bits */
u32 dccpor_timestamp;
diff --git a/net/dccp/input.c b/net/dccp/input.c
index dacd4fd..08392ed 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -369,7 +369,7 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff 
*skb,
if (dccp_check_seqno(sk, skb))
goto discard;
 
-   if (dccp_parse_options(sk, skb))
+   if (dccp_parse_options(sk, NULL, skb))
goto discard;
 
if (DCCP_SKB_CB(skb)-dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
@@ -427,7 +427,7 @@ static int dccp_rcv_request_sent_state_process(struct sock 
*sk,
goto out_invalid_packet;
}
 
-   if (dccp_parse_options(sk, skb))
+   if (dccp_parse_options(sk, NULL, skb))
goto out_invalid_packet;
 
/* Obtain usec RTT sample from SYN exchange (used by CCID 3) */
@@ -609,7 +609,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff 
*skb,
/*
 * Step 8: Process options and mark acknowledgeable
 */
-   if (dccp_parse_options(sk, skb))
+   if (dccp_parse_options(sk, NULL, skb))
goto discard;
 
if (dcb-dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index db17b83..02fc91c 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -600,11 +600,12 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff 
*skb)
if (req == NULL)
goto drop;
 
-   if (dccp_parse_options(sk, skb))
-   goto drop_and_free;
-
dccp_reqsk_init(req, skb);
 
+   dreq = dccp_rsk(req);
+   if (dccp_parse_options(sk, dreq, skb))
+   goto drop_and_free;
+
if (security_inet_conn_request(sk, skb, req))
goto drop_and_free;
 
@@ -621,7 +622,6 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff 
*skb)
 * In fact we defer setting S.GSR, S.SWL, S.SWH to
 * dccp_create_openreq_child.
 */
-   dreq = dccp_rsk(req);
dreq-dreq_isr = dcb-dccpd_seq;
dreq-dreq_iss = dccp_v4_init_sequence(skb);
dreq-dreq_service = service;
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index a08e2cb..f42b75c 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -415,11 +415,12 @@ static int dccp_v6_conn_request(struct sock *sk, struct 
sk_buff *skb)
if (req == NULL)
goto drop;
 
-   if (dccp_parse_options(sk, skb))
-   goto drop_and_free;
-
dccp_reqsk_init(req, skb);
 
+   dreq = dccp_rsk(req);
+   if 

[IPV6] sit: Rebinding of SIT tunnels to other interfaces

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8a4a50f98bc13670bee94c40b94bc169e1263cd9
Commit: 8a4a50f98bc13670bee94c40b94bc169e1263cd9
Parent: ee34c1eb35923cc98b1c47488a615bf51a2a2afb
Author: Michal Schmidt [EMAIL PROTECTED]
AuthorDate: Thu Dec 13 09:47:00 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:56 2008 -0800

[IPV6] sit: Rebinding of SIT tunnels to other interfaces

This is similar to the change already done for IPIP tunnels.

Once created, a SIT tunnel can't be bound to another device.
To reproduce:

# create a tunnel:
ip tunnel add tunneltest0 mode sit remote 10.0.0.1 dev eth0
# try to change the bounding device from eth0 to eth1:
ip tunnel change tunneltest0 dev eth1
# show the result:
ip tunnel show tunneltest0

tunneltest0: ipv6/ip  remote 10.0.0.1  local any  dev eth0  ttl inherit

Notice the bound device has not changed from eth0 to eth1.

This patch fixes it. When changing the binding, it also recalculates the
MTU according to the new bound device's MTU.

Signed-off-by: Michal Schmidt [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv6/sit.c |   70 +--
 1 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index b3b8513..1c6fddb 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -669,6 +669,42 @@ tx_error:
return 0;
 }
 
+static void ipip6_tunnel_bind_dev(struct net_device *dev)
+{
+   struct net_device *tdev = NULL;
+   struct ip_tunnel *tunnel;
+   struct iphdr *iph;
+
+   tunnel = netdev_priv(dev);
+   iph = tunnel-parms.iph;
+
+   if (iph-daddr) {
+   struct flowi fl = { .nl_u = { .ip4_u =
+ { .daddr = iph-daddr,
+   .saddr = iph-saddr,
+   .tos = RT_TOS(iph-tos) } },
+   .oif = tunnel-parms.link,
+   .proto = IPPROTO_IPV6 };
+   struct rtable *rt;
+   if (!ip_route_output_key(rt, fl)) {
+   tdev = rt-u.dst.dev;
+   ip_rt_put(rt);
+   }
+   dev-flags |= IFF_POINTOPOINT;
+   }
+
+   if (!tdev  tunnel-parms.link)
+   tdev = __dev_get_by_index(init_net, tunnel-parms.link);
+
+   if (tdev) {
+   dev-hard_header_len = tdev-hard_header_len + sizeof(struct 
iphdr);
+   dev-mtu = tdev-mtu - sizeof(struct iphdr);
+   if (dev-mtu  IPV6_MIN_MTU)
+   dev-mtu = IPV6_MIN_MTU;
+   }
+   dev-iflink = tunnel-parms.link;
+}
+
 static int
 ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
 {
@@ -740,6 +776,11 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq 
*ifr, int cmd)
if (cmd == SIOCCHGTUNNEL) {
t-parms.iph.ttl = p.iph.ttl;
t-parms.iph.tos = p.iph.tos;
+   if (t-parms.link != p.link) {
+   t-parms.link = p.link;
+   ipip6_tunnel_bind_dev(dev);
+   netdev_state_change(dev);
+   }
}
if (copy_to_user(ifr-ifr_ifru.ifru_data, t-parms, 
sizeof(p)))
err = -EFAULT;
@@ -808,12 +849,9 @@ static void ipip6_tunnel_setup(struct net_device *dev)
 
 static int ipip6_tunnel_init(struct net_device *dev)
 {
-   struct net_device *tdev = NULL;
struct ip_tunnel *tunnel;
-   struct iphdr *iph;
 
tunnel = netdev_priv(dev);
-   iph = tunnel-parms.iph;
 
tunnel-dev = dev;
strcpy(tunnel-parms.name, dev-name);
@@ -821,31 +859,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
memcpy(dev-dev_addr, tunnel-parms.iph.saddr, 4);
memcpy(dev-broadcast, tunnel-parms.iph.daddr, 4);
 
-   if (iph-daddr) {
-   struct flowi fl = { .nl_u = { .ip4_u =
- { .daddr = iph-daddr,
-   .saddr = iph-saddr,
-   .tos = RT_TOS(iph-tos) } },
-   .oif = tunnel-parms.link,
-   .proto = IPPROTO_IPV6 };
-   struct rtable *rt;
-   if (!ip_route_output_key(rt, fl)) {
-   tdev = rt-u.dst.dev;
-   ip_rt_put(rt);
-   }
-   dev-flags |= IFF_POINTOPOINT;
-   }
-
-   if (!tdev  tunnel-parms.link)
-   tdev = 

[IEEE80211]: Use htons() where appropriate.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4e39430ae33dfd9b0f47e5a89028352382c3dd34
Commit: 4e39430ae33dfd9b0f47e5a89028352382c3dd34
Parent: b98999dc382a4e59a250f2ac9e32beca668cba0b
Author: YOSHIFUJI Hideaki [EMAIL PROTECTED]
AuthorDate: Wed Dec 12 03:52:26 2007 +0900
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:02 2008 -0800

[IEEE80211]: Use htons() where appropriate.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ieee80211/ieee80211_rx.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c
index 21c0fad..13b12a6 100644
--- a/net/ieee80211/ieee80211_rx.c
+++ b/net/ieee80211/ieee80211_rx.c
@@ -45,7 +45,7 @@ static void ieee80211_monitor_rx(struct ieee80211_device 
*ieee,
skb_reset_mac_header(skb);
skb_pull(skb, ieee80211_get_hdrlen(fc));
skb-pkt_type = PACKET_OTHERHOST;
-   skb-protocol = __constant_htons(ETH_P_80211_RAW);
+   skb-protocol = htons(ETH_P_80211_RAW);
memset(skb-cb, 0, sizeof(skb-cb));
netif_rx(skb);
 }
@@ -800,7 +800,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct 
sk_buff *skb,
if (skb2 != NULL) {
/* send to wireless media */
skb2-dev = dev;
-   skb2-protocol = __constant_htons(ETH_P_802_3);
+   skb2-protocol = htons(ETH_P_802_3);
skb_reset_mac_header(skb2);
skb_reset_network_header(skb2);
/* skb2-network_header += ETH_HLEN; */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SUNRPC]: Use htonl() where appropriate.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8d614434ab77b440b69e66a9bd44e46e7194c34a
Commit: 8d614434ab77b440b69e66a9bd44e46e7194c34a
Parent: ae445d172ab4d342a0a9d64df499cca8d5ad61b3
Author: YOSHIFUJI Hideaki [EMAIL PROTECTED]
AuthorDate: Wed Dec 12 03:55:42 2007 +0900
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:05 2008 -0800

[SUNRPC]: Use htonl() where appropriate.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/sunrpc/xprtrdma/rpc_rdma.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index ee8de7a..1aa1580 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -380,7 +380,7 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst)
headerp-rm_xid = rqst-rq_xid;
headerp-rm_vers = xdr_one;
headerp-rm_credit = htonl(r_xprt-rx_buf.rb_max_requests);
-   headerp-rm_type = __constant_htonl(RDMA_MSG);
+   headerp-rm_type = htonl(RDMA_MSG);
 
/*
 * Chunks needed for results?
@@ -458,11 +458,11 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst)
RPCRDMA_INLINE_PAD_VALUE(rqst));
 
if (padlen) {
-   headerp-rm_type = __constant_htonl(RDMA_MSGP);
+   headerp-rm_type = htonl(RDMA_MSGP);
headerp-rm_body.rm_padded.rm_align =
htonl(RPCRDMA_INLINE_PAD_VALUE(rqst));
headerp-rm_body.rm_padded.rm_thresh =
-   __constant_htonl(RPCRDMA_INLINE_PAD_THRESH);
+   htonl(RPCRDMA_INLINE_PAD_THRESH);
headerp-rm_body.rm_padded.rm_pempty[0] = xdr_zero;
headerp-rm_body.rm_padded.rm_pempty[1] = xdr_zero;
headerp-rm_body.rm_padded.rm_pempty[2] = xdr_zero;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RXRPC]: Use cpu_to_be32() where appropriate.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ae445d172ab4d342a0a9d64df499cca8d5ad61b3
Commit: ae445d172ab4d342a0a9d64df499cca8d5ad61b3
Parent: f831e90971dc942a9f2fcc918a5739eb6d4ef4c5
Author: YOSHIFUJI Hideaki [EMAIL PROTECTED]
AuthorDate: Wed Dec 12 03:55:22 2007 +0900
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:04 2008 -0800

[RXRPC]: Use cpu_to_be32() where appropriate.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/rxrpc/ar-connection.c |2 +-
 net/rxrpc/ar-input.c  |4 ++--
 net/rxrpc/rxkad.c |4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/rxrpc/ar-connection.c b/net/rxrpc/ar-connection.c
index d6667f7..3869a58 100644
--- a/net/rxrpc/ar-connection.c
+++ b/net/rxrpc/ar-connection.c
@@ -651,7 +651,7 @@ rxrpc_incoming_connection(struct rxrpc_transport *trans,
 
candidate-trans = trans;
candidate-epoch = hdr-epoch;
-   candidate-cid = hdr-cid  __constant_cpu_to_be32(RXRPC_CIDMASK);
+   candidate-cid = hdr-cid  cpu_to_be32(RXRPC_CIDMASK);
candidate-service_id = hdr-serviceId;
candidate-security_ix = hdr-securityIndex;
candidate-in_clientflag = RXRPC_CLIENT_INITIATED;
diff --git a/net/rxrpc/ar-input.c b/net/rxrpc/ar-input.c
index f446d9b..f8a699e 100644
--- a/net/rxrpc/ar-input.c
+++ b/net/rxrpc/ar-input.c
@@ -595,7 +595,7 @@ dead_call:
read_unlock_bh(conn-lock);
 
if (sp-hdr.flags  RXRPC_CLIENT_INITIATED 
-   sp-hdr.seq == __constant_cpu_to_be32(1)) {
+   sp-hdr.seq == cpu_to_be32(1)) {
_debug(incoming call);
skb_queue_tail(conn-trans-local-accept_queue, skb);
rxrpc_queue_work(conn-trans-local-acceptor);
@@ -774,7 +774,7 @@ cant_route_call:
_debug(can't route call);
if (sp-hdr.flags  RXRPC_CLIENT_INITIATED 
sp-hdr.type == RXRPC_PACKET_TYPE_DATA) {
-   if (sp-hdr.seq == __constant_cpu_to_be32(1)) {
+   if (sp-hdr.seq == cpu_to_be32(1)) {
_debug(first packet);
skb_queue_tail(local-accept_queue, skb);
rxrpc_queue_work(local-acceptor);
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
index 8e69d69..f48434a 100644
--- a/net/rxrpc/rxkad.c
+++ b/net/rxrpc/rxkad.c
@@ -284,7 +284,7 @@ static int rxkad_secure_packet(const struct rxrpc_call 
*call,
 
/* calculate the security checksum */
x = htonl(call-channel  (32 - RXRPC_CIDSHIFT));
-   x |= sp-hdr.seq  __constant_cpu_to_be32(0x3fff);
+   x |= sp-hdr.seq  cpu_to_be32(0x3fff);
tmpbuf.x[0] = sp-hdr.callNumber;
tmpbuf.x[1] = x;
 
@@ -518,7 +518,7 @@ static int rxkad_verify_packet(const struct rxrpc_call 
*call,
 
/* validate the security checksum */
x = htonl(call-channel  (32 - RXRPC_CIDSHIFT));
-   x |= sp-hdr.seq  __constant_cpu_to_be32(0x3fff);
+   x |= sp-hdr.seq  cpu_to_be32(0x3fff);
tmpbuf.x[0] = call-call_id;
tmpbuf.x[1] = x;
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV4]: Create ipv4_is_type(__be32 addr) functions

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2658fa803111dae1353602e7f586de8e537803e2
Commit: 2658fa803111dae1353602e7f586de8e537803e2
Parent: 586f12115264b767ea6a48ce081ca25a39c1e3dd
Author: Joe Perches [EMAIL PROTECTED]
AuthorDate: Sun Dec 16 13:42:49 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:13 2008 -0800

[IPV4]: Create ipv4_is_type(__be32 addr) functions

Change IPV4 specific macros LOOPBACK MULTICAST LOCAL_MCAST BADCLASS
and ZERONET macros to inline functions ipv4_is_type(__be32 addr)

Adds type safety and arguably some readability.

Changes since last submission:

Removed ipv4_addr_octets function
Used hex constants
Converted recently added rfc3330 macros

Signed-off-by: Joe Perches [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/in.h |   87 
 1 files changed, 74 insertions(+), 13 deletions(-)

diff --git a/include/linux/in.h b/include/linux/in.h
index a8f00ca..f8d6073 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -246,21 +246,82 @@ struct sockaddr_in {
 #include asm/byteorder.h 
 
 #ifdef __KERNEL__
-/* Some random defines to make it easier in the kernel.. */
-#define LOOPBACK(x)(((x)  htonl(0xff00)) == htonl(0x7f00))
-#define MULTICAST(x)   (((x)  htonl(0xf000)) == htonl(0xe000))
-#define BADCLASS(x)(((x)  htonl(0xf000)) == htonl(0xf000))
-#define ZERONET(x) (((x)  htonl(0xff00)) == htonl(0x))
-#define LOCAL_MCAST(x) (((x)  htonl(0xFF00)) == htonl(0xE000))
+
+static inline bool ipv4_is_loopback(__be32 addr)
+{
+   return (addr  htonl(0xff00)) == htonl(0x7f00);
+}
+
+static inline bool ipv4_is_multicast(__be32 addr)
+{
+   return (addr  htonl(0xf000)) == htonl(0xe000);
+}
+
+static inline bool ipv4_is_local_multicast(__be32 addr)
+{
+   return (addr  htonl(0xff00)) == htonl(0xe000);
+}
+
+static inline bool ipv4_is_badclass(__be32 addr)
+{
+   return (addr  htonl(0xf000)) == htonl(0xf000);
+}
+
+static inline bool ipv4_is_zeronet(__be32 addr)
+{
+   return (addr  htonl(0xff00)) == htonl(0x);
+}
+
+#define LOOPBACK(x)ipv4_is_loopback(x)
+#define MULTICAST(x)   ipv4_is_multicast(x)
+#define BADCLASS(x)ipv4_is_badclass(x)
+#define ZERONET(x) ipv4_is_zeronet(x)
+#define LOCAL_MCAST(x) ipv4_is_local_multicast(x)
 
 /* Special-Use IPv4 Addresses (RFC3330) */
-#define PRIVATE_10(x)  (((x)  htonl(0xff00)) == htonl(0x0A00))
-#define LINKLOCAL_169(x) (((x)  htonl(0x)) == htonl(0xA9FE))
-#define PRIVATE_172(x) (((x)  htonl(0xfff0)) == htonl(0xAC10))
-#define TEST_192(x)(((x)  htonl(0xff00)) == htonl(0xC200))
-#define ANYCAST_6TO4(x)(((x)  htonl(0xff00)) == htonl(0xC0586300))
-#define PRIVATE_192(x) (((x)  htonl(0x)) == htonl(0xC0A8))
-#define TEST_198(x)(((x)  htonl(0xfffe)) == htonl(0xC612))
+
+static inline bool ipv4_is_private_10(__be32 addr)
+{
+   return (addr  htonl(0xff00)) == htonl(0x0a00);
+}
+
+static inline bool ipv4_is_private_172(__be32 addr)
+{
+   return (addr  htonl(0xfff0)) == htonl(0xac10);
+}
+
+static inline bool ipv4_is_private_192(__be32 addr)
+{
+   return (addr  htonl(0x)) == htonl(0xc0a8);
+}
+
+static inline bool ipv4_is_linklocal_169(__be32 addr)
+{
+   return (addr  htonl(0x)) == htonl(0xa9fe);
+}
+
+static inline bool ipv4_is_anycast_6to4(__be32 addr)
+{
+   return (addr  htonl(0xff00)) == htonl(0xc0586300);
+}
+
+static inline bool ipv4_is_test_192(__be32 addr)
+{
+   return (addr  htonl(0xff00)) == htonl(0xc200);
+}
+
+static inline bool ipv4_is_test_198(__be32 addr)
+{
+   return (addr  htonl(0xfffe)) == htonl(0xc612);
+}
 #endif
 
+#define PRIVATE_10(x)  ipv4_is_private_10(x)
+#define LINKLOCAL_169(x)   ipv4_is_linklocal_169(x)
+#define PRIVATE_172(x) ipv4_is_private_172(x)
+#define TEST_192(x)ipv4_is_test_192(x)
+#define ANYCAST_6TO4(x)ipv4_is_anycast_6to4(x)
+#define PRIVATE_192(x) ipv4_is_private_192(x)
+#define TEST_198(x)ipv4_is_test_198(x)
+
 #endif /* _LINUX_IN_H */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV4] include/net: Use ipv4_is_type

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3db8cda362dced00caf19865ffda3fa1028c59bc
Commit: 3db8cda362dced00caf19865ffda3fa1028c59bc
Parent: 2658fa803111dae1353602e7f586de8e537803e2
Author: Joe Perches [EMAIL PROTECTED]
AuthorDate: Sun Dec 16 13:43:24 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:14 2008 -0800

[IPV4] include/net: Use ipv4_is_type

Signed-off-by: Joe Perches [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/addrconf.h |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index c56827d..1c3a560 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -252,10 +252,12 @@ static inline int ipv6_addr_is_ll_all_routers(const 
struct in6_addr *addr)
 
 static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr)
 {
-   eui[0] = (ZERONET(addr) || PRIVATE_10(addr) || LOOPBACK(addr) ||
- LINKLOCAL_169(addr) || PRIVATE_172(addr) || TEST_192(addr) ||
- ANYCAST_6TO4(addr) || PRIVATE_192(addr) || TEST_198(addr) ||
- MULTICAST(addr) || BADCLASS(addr)) ? 0x00 : 0x02;
+   eui[0] = (ipv4_is_zeronet(addr) || ipv4_is_private_10(addr) ||
+ ipv4_is_loopback(addr) || ipv4_is_linklocal_169(addr) ||
+ ipv4_is_private_172(addr) || ipv4_is_test_192(addr) ||
+ ipv4_is_anycast_6to4(addr) || ipv4_is_private_192(addr) ||
+ ipv4_is_test_198(addr) || ipv4_is_multicast(addr) ||
+ ipv4_is_badclass(addr)) ? 0x00 : 0x02;
eui[1] = 0;
eui[2] = 0x5E;
eui[3] = 0xFE;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV4] sctp: Use ipv4_is_type

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b5cb2bbc4c6cb489941be881e8adfe136ee45b8e
Commit: b5cb2bbc4c6cb489941be881e8adfe136ee45b8e
Parent: 37ef8dd7f3f2f228336e3779e7cec762d90e1f00
Author: Joe Perches [EMAIL PROTECTED]
AuthorDate: Sun Dec 16 13:46:59 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:17 2008 -0800

[IPV4] sctp: Use ipv4_is_type

Signed-off-by: Joe Perches [EMAIL PROTECTED]
Acked-by: Vlad Yasevich [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/sctp/constants.h |   36 ++--
 net/sctp/protocol.c  |   12 +++-
 2 files changed, 13 insertions(+), 35 deletions(-)

diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 05f22a6..fefcba6 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -365,36 +365,12 @@ typedef enum {
  * Also, RFC 8.4, non-unicast addresses are not considered valid SCTP
  * addresses.
  */
-#define IS_IPV4_UNUSABLE_ADDRESS(a) \
-   ((htonl(INADDR_BROADCAST) == *a) || \
-   (MULTICAST(*a)) || \
-   (((unsigned char *)(a))[0] == 0) || \
-   unsigned char *)(a))[0] == 198)  \
-   (((unsigned char *)(a))[1] == 18)  \
-   (((unsigned char *)(a))[2] == 0)) || \
-   unsigned char *)(a))[0] == 192)  \
-   (((unsigned char *)(a))[1] == 88)  \
-   (((unsigned char *)(a))[2] == 99)))
-
-/* IPv4 Link-local addresses: 169.254.0.0/16.  */
-#define IS_IPV4_LINK_ADDRESS(a) \
-   unsigned char *)(a))[0] == 169)  \
-   (((unsigned char *)(a))[1] == 254))
-
-/* RFC 1918 Address Allocation for Private Internets defines the IPv4
- * private address space as the following:
- *
- * 10.0.0.0 - 10.255.255.255 (10/8 prefix)
- * 172.16.0.0.0 - 172.31.255.255 (172.16/12 prefix)
- * 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
- */
-#define IS_IPV4_PRIVATE_ADDRESS(a) \
-   unsigned char *)(a))[0] == 10) || \
-   unsigned char *)(a))[0] == 172)  \
-   (((unsigned char *)(a))[1] = 16)  \
-   (((unsigned char *)(a))[1]  32)) || \
-   unsigned char *)(a))[0] == 192)  \
-   (((unsigned char *)(a))[1] == 168)))
+#define IS_IPV4_UNUSABLE_ADDRESS(a)\
+   ((htonl(INADDR_BROADCAST) == a) ||  \
+ipv4_is_multicast(a) ||\
+ipv4_is_zeronet(a) ||  \
+ipv4_is_test_198(a) || \
+ipv4_is_anycast_6to4(a))
 
 /* Flags used for the bind address copy functions.  */
 #define SCTP_ADDR6_ALLOWED 0x0001  /* IPv6 address is allowed by
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index d50f610..dc22d71 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -359,7 +359,7 @@ static int sctp_v4_addr_valid(union sctp_addr *addr,
  const struct sk_buff *skb)
 {
/* Is this a non-unicast address or a unusable SCTP address? */
-   if (IS_IPV4_UNUSABLE_ADDRESS(addr-v4.sin_addr.s_addr))
+   if (IS_IPV4_UNUSABLE_ADDRESS(addr-v4.sin_addr.s_addr))
return 0;
 
/* Is this a broadcast address? */
@@ -408,13 +408,15 @@ static sctp_scope_t sctp_v4_scope(union sctp_addr *addr)
 */
 
/* Check for unusable SCTP addresses. */
-   if (IS_IPV4_UNUSABLE_ADDRESS(addr-v4.sin_addr.s_addr)) {
+   if (IS_IPV4_UNUSABLE_ADDRESS(addr-v4.sin_addr.s_addr)) {
retval =  SCTP_SCOPE_UNUSABLE;
-   } else if (LOOPBACK(addr-v4.sin_addr.s_addr)) {
+   } else if (ipv4_is_loopback(addr-v4.sin_addr.s_addr)) {
retval = SCTP_SCOPE_LOOPBACK;
-   } else if (IS_IPV4_LINK_ADDRESS(addr-v4.sin_addr.s_addr)) {
+   } else if (ipv4_is_linklocal_169(addr-v4.sin_addr.s_addr)) {
retval = SCTP_SCOPE_LINK;
-   } else if (IS_IPV4_PRIVATE_ADDRESS(addr-v4.sin_addr.s_addr)) {
+   } else if (ipv4_is_private_10(addr-v4.sin_addr.s_addr) ||
+  ipv4_is_private_172(addr-v4.sin_addr.s_addr) ||
+  ipv4_is_private_192(addr-v4.sin_addr.s_addr)) {
retval = SCTP_SCOPE_PRIVATE;
} else {
retval = SCTP_SCOPE_GLOBAL;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV4]: Remove unused IPV4TYPE macros

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2d4d29802ff76de5af6123ef26c24ab512181223
Commit: 2d4d29802ff76de5af6123ef26c24ab512181223
Parent: 6360a02af1599e46b023ccbb85545ed97c6f662c
Author: Joe Perches [EMAIL PROTECTED]
AuthorDate: Sun Dec 16 13:48:11 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:18 2008 -0800

[IPV4]: Remove unused IPV4TYPE macros

Signed-off-by: Joe Perches [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/in.h |   14 --
 1 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/include/linux/in.h b/include/linux/in.h
index f8d6073..27d8a5a 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -272,12 +272,6 @@ static inline bool ipv4_is_zeronet(__be32 addr)
return (addr  htonl(0xff00)) == htonl(0x);
 }
 
-#define LOOPBACK(x)ipv4_is_loopback(x)
-#define MULTICAST(x)   ipv4_is_multicast(x)
-#define BADCLASS(x)ipv4_is_badclass(x)
-#define ZERONET(x) ipv4_is_zeronet(x)
-#define LOCAL_MCAST(x) ipv4_is_local_multicast(x)
-
 /* Special-Use IPv4 Addresses (RFC3330) */
 
 static inline bool ipv4_is_private_10(__be32 addr)
@@ -316,12 +310,4 @@ static inline bool ipv4_is_test_198(__be32 addr)
 }
 #endif
 
-#define PRIVATE_10(x)  ipv4_is_private_10(x)
-#define LINKLOCAL_169(x)   ipv4_is_linklocal_169(x)
-#define PRIVATE_172(x) ipv4_is_private_172(x)
-#define TEST_192(x)ipv4_is_test_192(x)
-#define ANYCAST_6TO4(x)ipv4_is_anycast_6to4(x)
-#define PRIVATE_192(x) ipv4_is_private_192(x)
-#define TEST_198(x)ipv4_is_test_198(x)
-
 #endif /* _LINUX_IN_H */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CCID3]: Implement rfc3448bis changes to feedback reception

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d8d1252f744cb7cebd6ba3a4b7feec31ff23ccde
Commit: d8d1252f744cb7cebd6ba3a4b7feec31ff23ccde
Parent: 5bd370a63daf62bb5520c258f04e91a4d9d274dd
Author: Gerrit Renker [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 12:48:47 2007 -0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:22 2008 -0800

[CCID3]: Implement rfc3448bis changes to feedback reception

This implements the algorithm to update the allowed sending rate X upon
receiving feedback packets, as described in draft rfc3448bis, 4.2/4.3.

Signed-off-by: Gerrit Renker [EMAIL PROTECTED]
Signed-off-by: Ian McDonald [EMAIL PROTECTED]
Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/dccp/ccids/ccid3.c |   47 ++-
 1 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index a93a556..1156fef 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -429,40 +429,46 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, 
struct sk_buff *skb)
if (pinv == ~0U || pinv == 0)  /* see RFC 4342, 8.5   */
hctx-ccid3hctx_p = 0;
else   /* can not exceed 100% */
-   hctx-ccid3hctx_p = 100 / pinv;
+   hctx-ccid3hctx_p = scaled_div(1, pinv);
/*
 * Validate new RTT sample and update moving average
 */
r_sample = dccp_sample_rtt(sk, r_sample);
hctx-ccid3hctx_rtt = tfrc_ewma(hctx-ccid3hctx_rtt, r_sample, 9);
-
+   /*
+* Update allowed sending rate X as per draft rfc3448bis-00, 4.2/3
+*/
if (hctx-ccid3hctx_state == TFRC_SSTATE_NO_FBACK) {
-   /*
-* Larger Initial Windows [RFC 4342, sec. 5]
-*/
-   hctx-ccid3hctx_x= rfc3390_initial_rate(sk);
-   hctx-ccid3hctx_t_ld = now;
+   ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK);
 
-   ccid3_update_send_interval(hctx);
+   if (hctx-ccid3hctx_t_rto == 0) {
+   /*
+* Initial feedback packet: Larger Initial Windows (4.2)
+*/
+   hctx-ccid3hctx_x= rfc3390_initial_rate(sk);
+   hctx-ccid3hctx_t_ld = now;
 
-   ccid3_pr_debug(%s(%p), s=%u, MSS=%u, 
-  R_sample=%uus, X=%u\n, dccp_role(sk),
-  sk, hctx-ccid3hctx_s,
-  dccp_sk(sk)-dccps_mss_cache, r_sample,
-  (unsigned)(hctx-ccid3hctx_x  6));
+   ccid3_update_send_interval(hctx);
 
-   ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK);
-   } else {
+   goto done_computing_x;
+   } else if (hctx-ccid3hctx_p == 0) {
+   /*
+* First feedback after nofeedback timer expiry (4.3)
+*/
+   goto done_computing_x;
+   }
+   }
 
-   /* Update sending rate (step 4 of [RFC 3448, 4.3]) */
-   if (hctx-ccid3hctx_p  0)
-   hctx-ccid3hctx_x_calc =
+   /* Update sending rate (step 4 of [RFC 3448, 4.3]) */
+   if (hctx-ccid3hctx_p  0)
+   hctx-ccid3hctx_x_calc =
tfrc_calc_x(hctx-ccid3hctx_s,
hctx-ccid3hctx_rtt,
hctx-ccid3hctx_p);
-   ccid3_hc_tx_update_x(sk, now);
+   ccid3_hc_tx_update_x(sk, now);
 
-   ccid3_pr_debug(%s(%p), RTT=%uus (sample=%uus), s=%u, 
+done_computing_x:
+   ccid3_pr_debug(%s(%p), RTT=%uus (sample=%uus), s=%u, 
   p=%u, X_calc=%u, X_recv=%u, X=%u\n,
   dccp_role(sk),
   sk, hctx-ccid3hctx_rtt, r_sample,
@@ -470,7 +476,6 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct 
sk_buff *skb)
   hctx-ccid3hctx_x_calc,
   (unsigned)(hctx-ccid3hctx_x_recv  6),
   (unsigned)(hctx-ccid3hctx_x  6));
-   }
 
/* unschedule no feedback timer */
sk_stop_timer(sk, hctx-ccid3hctx_no_feedback_timer);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CCID3]: Nofeedback timer according to rfc3448bis

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=52515e77a7a69867c479db4c9efb6be832b82179
Commit: 52515e77a7a69867c479db4c9efb6be832b82179
Parent: d8d1252f744cb7cebd6ba3a4b7feec31ff23ccde
Author: Gerrit Renker [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 12:57:43 2007 -0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:23 2008 -0800

[CCID3]: Nofeedback timer according to rfc3448bis

This implements the changes to the nofeedback timer handling suggested
in draft rfc3448bis00, section 4.4. In particular, these changes mean:

 * better handling of the lossless case (p == 0)
 * the timestamp for computing t_ld becomes obsolete
 * much more recent document (RFC 3448 is almost 5 years old)
 * concepts in rfc3448bis arose from a real, working implementation
   (cf. sec. 12)

Signed-off-by: Gerrit Renker [EMAIL PROTECTED]
Signed-off-by: Ian McDonald [EMAIL PROTECTED]
Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/dccp/ccids/ccid3.c |   63 ++--
 1 files changed, 29 insertions(+), 34 deletions(-)

diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 1156fef..d292f23 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -131,12 +131,11 @@ static u32 ccid3_hc_tx_idle_rtt(struct ccid3_hc_tx_sock 
*hctx, ktime_t now)
  *
  */
 static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp)
-
 {
struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
__u64 min_rate = 2 * hctx-ccid3hctx_x_recv;
const  __u64 old_x = hctx-ccid3hctx_x;
-   ktime_t now = stamp? *stamp : ktime_get_real();
+   ktime_t now = stamp ? *stamp : ktime_get_real();
 
/*
 * Handle IDLE periods: do not reduce below RFC3390 initial sending rate
@@ -230,27 +229,27 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long 
data)
ccid3_pr_debug(%s(%p, state=%s) - entry \n, dccp_role(sk), sk,
   ccid3_tx_state_name(hctx-ccid3hctx_state));
 
-   switch (hctx-ccid3hctx_state) {
-   case TFRC_SSTATE_NO_FBACK:
-   /* RFC 3448, 4.4: Halve send rate directly */
+   if (hctx-ccid3hctx_state == TFRC_SSTATE_FBACK)
+   ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK);
+   else if (hctx-ccid3hctx_state != TFRC_SSTATE_NO_FBACK)
+   goto out;
+
+   /*
+* Determine new allowed sending rate X as per draft rfc3448bis-00, 4.4
+*/
+   if (hctx-ccid3hctx_t_rto == 0 ||   /* no feedback received yet */
+   hctx-ccid3hctx_p == 0) {
+
+   /* halve send rate directly */
hctx-ccid3hctx_x = max(hctx-ccid3hctx_x / 2,
(((__u64)hctx-ccid3hctx_s)  6) /
TFRC_T_MBI);
-
-   ccid3_pr_debug(%s(%p, state=%s), updated tx rate to %u 
-  bytes/s\n, dccp_role(sk), sk,
-  ccid3_tx_state_name(hctx-ccid3hctx_state),
-  (unsigned)(hctx-ccid3hctx_x  6));
-   /* The value of R is still undefined and so we can not recompute
-* the timeout value. Keep initial value as per [RFC 4342, 5]. 
*/
-   t_nfb = TFRC_INITIAL_TIMEOUT;
ccid3_update_send_interval(hctx);
-   break;
-   case TFRC_SSTATE_FBACK:
+   } else {
/*
-*  Modify the cached value of X_recv [RFC 3448, 4.4]
+*  Modify the cached value of X_recv
 *
-*  If (p == 0 || X_calc  2 * X_recv)
+*  If (X_calc  2 * X_recv)
 *X_recv = max(X_recv / 2, s / (2 * t_mbi));
 *  Else
 *X_recv = X_calc / 4;
@@ -259,32 +258,28 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long 
data)
 */
BUG_ON(hctx-ccid3hctx_p  !hctx-ccid3hctx_x_calc);
 
-   if (hctx-ccid3hctx_p == 0 ||
-   (hctx-ccid3hctx_x_calc  (hctx-ccid3hctx_x_recv  5))) {
-
+   if (hctx-ccid3hctx_x_calc  (hctx-ccid3hctx_x_recv  5))
hctx-ccid3hctx_x_recv =
max(hctx-ccid3hctx_x_recv / 2,
(((__u64)hctx-ccid3hctx_s)  6) /
  (2 * TFRC_T_MBI));
-   } else {
+   else {
hctx-ccid3hctx_x_recv = hctx-ccid3hctx_x_calc;
hctx-ccid3hctx_x_recv = 4;
}
-   /* Now recalculate X [RFC 3448, 4.3, step (4)] */
ccid3_hc_tx_update_x(sk, NULL);
-   /*
-* Schedule no feedback 

introduce WEXT scan capabilities

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=374fdfbc67837c1f4369eedb0f371ce3e6cce832
Commit: 374fdfbc67837c1f4369eedb0f371ce3e6cce832
Parent: c49e5ea322c2fb43f430abb3c4a49eae1394287e
Author: Dan Williams [EMAIL PROTECTED]
AuthorDate: Wed Dec 12 10:25:07 2007 -0500
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:25 2008 -0800

introduce WEXT scan capabilities

Introduce scan capabilities to WEXT so that userspace can do intelligent
things with scan behavior such as handling hidden SSIDs more gracefully.
If the driver reports a specific scan capability, the driver must
respect the options specified in the iw_scan_req structure when handling
the SIOCSIWSCAN call, unless it's mode or state does not allow it to do
so, in which case it must return an error.

This version switches to Dave Kilroy's suggestion of claiming unused
padding space for the scan_capa field.

Signed-off-by: Dan Williams [EMAIL PROTECTED]
Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/net/wireless/hostap/hostap_ioctl.c |3 +++
 drivers/net/wireless/ipw2200.c |2 ++
 include/linux/wireless.h   |   13 +
 net/mac80211/ieee80211_ioctl.c |2 ++
 4 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c 
b/drivers/net/wireless/hostap/hostap_ioctl.c
index d8f5efc..3a57d48 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -1089,6 +1089,9 @@ static int prism2_ioctl_giwrange(struct net_device *dev,
range-enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
 
+   if (local-sta_fw_ver = PRISM2_FW_VER(1,3,1))
+   range-scan_capa = IW_SCAN_CAPA_ESSID;
+
return 0;
 }
 
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 003f73f..be31304 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -8912,6 +8912,8 @@ static int ipw_wx_get_range(struct net_device *dev,
range-enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
 
+   range-scan_capa = IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE;
+
IPW_DEBUG_WX(GET Range\n);
return 0;
 }
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 0987aa7..74e84ca 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -541,6 +541,16 @@
 /* Maximum size of returned data */
 #define IW_SCAN_MAX_DATA   4096/* In bytes */
 
+/* Scan capability flags - in (struct iw_range *)-scan_capa */
+#define IW_SCAN_CAPA_NONE  0x00
+#define IW_SCAN_CAPA_ESSID 0x01
+#define IW_SCAN_CAPA_BSSID 0x02
+#define IW_SCAN_CAPA_CHANNEL   0x04
+#define IW_SCAN_CAPA_MODE  0x08
+#define IW_SCAN_CAPA_RATE  0x10
+#define IW_SCAN_CAPA_TYPE  0x20
+#define IW_SCAN_CAPA_TIME  0x40
+
 /* Max number of char in custom event - use multiple of them if needed */
 #define IW_CUSTOM_MAX  256 /* In bytes */
 
@@ -963,6 +973,9 @@ struct  iw_range
__u16   old_num_channels;
__u8old_num_frequency;
 
+   /* Scan capabilities */
+   __u8scan_capa;  /* IW_SCAN_CAPA_* bit field */
+
/* Wireless event capability bitmasks */
__u32   event_capa[6];
 
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 161f3bd..04ddce7 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -218,6 +218,8 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,
IW_EVENT_CAPA_SET(range-event_capa, SIOCGIWAP);
IW_EVENT_CAPA_SET(range-event_capa, SIOCGIWSCAN);
 
+   range-scan_capa |= IW_SCAN_CAPA_ESSID;
+
return 0;
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: ip_tables: move compat offset calculation to x_tables

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b386d9f5960a9afce7f077edf2095fccfbb1a8e6
Commit: b386d9f5960a9afce7f077edf2095fccfbb1a8e6
Parent: 73cd598df46a73d6f02063f2520df115a9b88aa5
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 21:47:48 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:31 2008 -0800

[NETFILTER]: ip_tables: move compat offset calculation to x_tables

Its needed by ip6_tables and arp_tables as well.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/netfilter/x_tables.h |4 ++
 net/ipv4/netfilter/ip_tables.c |   67 ---
 net/netfilter/x_tables.c   |   58 +++
 3 files changed, 70 insertions(+), 59 deletions(-)

diff --git a/include/linux/netfilter/x_tables.h 
b/include/linux/netfilter/x_tables.h
index 8ab754e..b99ede5 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -424,6 +424,10 @@ struct compat_xt_counters_info
 extern void xt_compat_lock(int af);
 extern void xt_compat_unlock(int af);
 
+extern int xt_compat_add_offset(int af, unsigned int offset, short delta);
+extern void xt_compat_flush_offsets(int af);
+extern short xt_compat_calc_jump(int af, unsigned int offset);
+
 extern int xt_compat_match_offset(struct xt_match *match);
 extern int xt_compat_match_from_user(struct xt_entry_match *m,
 void **dstptr, int *size);
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index d8caa1e..07be12c 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1014,63 +1014,12 @@ copy_entries_to_user(unsigned int total_size,
 }
 
 #ifdef CONFIG_COMPAT
-struct compat_delta {
-   struct compat_delta *next;
-   unsigned int offset;
-   short delta;
-};
-
-static struct compat_delta *compat_offsets;
-
-static int compat_add_offset(unsigned int offset, short delta)
-{
-   struct compat_delta *tmp;
-
-   tmp = kmalloc(sizeof(struct compat_delta), GFP_KERNEL);
-   if (!tmp)
-   return -ENOMEM;
-   tmp-offset = offset;
-   tmp-delta = delta;
-   if (compat_offsets) {
-   tmp-next = compat_offsets-next;
-   compat_offsets-next = tmp;
-   } else {
-   compat_offsets = tmp;
-   tmp-next = NULL;
-   }
-   return 0;
-}
-
-static void compat_flush_offsets(void)
-{
-   struct compat_delta *tmp, *next;
-
-   if (compat_offsets) {
-   for (tmp = compat_offsets; tmp; tmp = next) {
-   next = tmp-next;
-   kfree(tmp);
-   }
-   compat_offsets = NULL;
-   }
-}
-
-static short compat_calc_jump(unsigned int offset)
-{
-   struct compat_delta *tmp;
-   short delta;
-
-   for (tmp = compat_offsets, delta = 0; tmp; tmp = tmp-next)
-   if (tmp-offset  offset)
-   delta += tmp-delta;
-   return delta;
-}
-
 static void compat_standard_from_user(void *dst, void *src)
 {
int v = *(compat_int_t *)src;
 
if (v  0)
-   v += compat_calc_jump(v);
+   v += xt_compat_calc_jump(AF_INET, v);
memcpy(dst, v, sizeof(v));
 }
 
@@ -1079,7 +1028,7 @@ static int compat_standard_to_user(void __user *dst, void 
*src)
compat_int_t cv = *(int *)src;
 
if (cv  0)
-   cv -= compat_calc_jump(cv);
+   cv -= xt_compat_calc_jump(AF_INET, cv);
return copy_to_user(dst, cv, sizeof(cv)) ? -EFAULT : 0;
 }
 
@@ -1104,7 +1053,7 @@ static int compat_calc_entry(struct ipt_entry *e,
t = ipt_get_target(e);
off += xt_compat_target_offset(t-u.kernel.target);
newinfo-size -= off;
-   ret = compat_add_offset(entry_offset, off);
+   ret = xt_compat_add_offset(AF_INET, entry_offset, off);
if (ret)
return ret;
 
@@ -1167,7 +1116,7 @@ static int get_info(void __user *user, int *len, int 
compat)
if (compat) {
struct xt_table_info tmp;
ret = compat_table_info(private, tmp);
-   compat_flush_offsets();
+   xt_compat_flush_offsets(AF_INET);
private = tmp;
}
 #endif
@@ -1631,7 +1580,7 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry 
*e,
 
off += xt_compat_target_offset(target);
*size += off;
-   ret = compat_add_offset(entry_offset, off);
+   ret = xt_compat_add_offset(AF_INET, entry_offset, off);
if (ret)
goto out;
 
@@ -1797,7 +1746,7 @@ translate_compat_table(const char *name,
ret = COMPAT_IPT_ENTRY_ITERATE(entry0, total_size,
   

[NETFILTER]: ip6_tables: move entry, match and target checks to seperate functions

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f173c8a1f2c0ca39f45bb15b82ad5e6fe908556d
Commit: f173c8a1f2c0ca39f45bb15b82ad5e6fe908556d
Parent: 72f36ec14fb5006886bc0655ec2b43bf1ad53a26
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 21:48:17 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:32 2008 -0800

[NETFILTER]: ip6_tables: move entry, match and target checks to seperate 
functions

Resync with ip_tables.c as preparation for compat support.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv6/netfilter/ip6_tables.c |  129 +--
 1 files changed, 82 insertions(+), 47 deletions(-)

diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index b73e6b6..655c221 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -607,11 +607,55 @@ cleanup_match(struct ip6t_entry_match *m, unsigned int *i)
 }
 
 static inline int
-check_match(struct ip6t_entry_match *m,
-   const char *name,
-   const struct ip6t_ip6 *ipv6,
-   unsigned int hookmask,
-   unsigned int *i)
+check_entry(struct ip6t_entry *e, const char *name)
+{
+   struct ip6t_entry_target *t;
+
+   if (!ip6_checkentry(e-ipv6)) {
+   duprintf(ip_tables: ip check failed %p %s.\n, e, name);
+   return -EINVAL;
+   }
+
+   if (e-target_offset + sizeof(struct ip6t_entry_target) 
+   e-next_offset)
+   return -EINVAL;
+
+   t = ip6t_get_target(e);
+   if (e-target_offset + t-u.target_size  e-next_offset)
+   return -EINVAL;
+
+   return 0;
+}
+
+static inline int check_match(struct ip6t_entry_match *m, const char *name,
+ const struct ip6t_ip6 *ipv6,
+ unsigned int hookmask, unsigned int *i)
+{
+   struct xt_match *match;
+   int ret;
+
+   match = m-u.kernel.match;
+   ret = xt_check_match(match, AF_INET6, m-u.match_size - sizeof(*m),
+name, hookmask, ipv6-proto,
+ipv6-invflags  IP6T_INV_PROTO);
+   if (!ret  m-u.kernel.match-checkentry
+!m-u.kernel.match-checkentry(name, ipv6, match, m-data,
+ hookmask)) {
+   duprintf(ip_tables: check failed for `%s'.\n,
+m-u.kernel.match-name);
+   ret = -EINVAL;
+   }
+   if (!ret)
+   (*i)++;
+   return ret;
+}
+
+static inline int
+find_check_match(struct ip6t_entry_match *m,
+const char *name,
+const struct ip6t_ip6 *ipv6,
+unsigned int hookmask,
+unsigned int *i)
 {
struct xt_match *match;
int ret;
@@ -620,86 +664,77 @@ check_match(struct ip6t_entry_match *m,
m-u.user.revision),
ip6t_%s, m-u.user.name);
if (IS_ERR(match) || !match) {
-   duprintf(check_match: `%s' not found\n, m-u.user.name);
+   duprintf(find_check_match: `%s' not found\n, m-u.user.name);
return match ? PTR_ERR(match) : -ENOENT;
}
m-u.kernel.match = match;
 
-   ret = xt_check_match(match, AF_INET6, m-u.match_size - sizeof(*m),
-name, hookmask, ipv6-proto,
-ipv6-invflags  IP6T_INV_PROTO);
+   ret = check_match(m, name, ipv6, hookmask, i);
if (ret)
goto err;
 
-   if (m-u.kernel.match-checkentry
-!m-u.kernel.match-checkentry(name, ipv6, match,  m-data,
- hookmask)) {
-   duprintf(ip_tables: check failed for `%s'.\n,
-m-u.kernel.match-name);
-   ret = -EINVAL;
-   goto err;
-   }
-
-   (*i)++;
return 0;
 err:
module_put(m-u.kernel.match-me);
return ret;
 }
 
-static inline int
-check_entry(struct ip6t_entry *e, const char *name, unsigned int size,
-   unsigned int *i)
+static inline int check_target(struct ip6t_entry *e, const char *name)
 {
struct ip6t_entry_target *t;
struct xt_target *target;
int ret;
-   unsigned int j;
 
-   if (!ip6_checkentry(e-ipv6)) {
-   duprintf(ip_tables: ip check failed %p %s.\n, e, name);
-   return -EINVAL;
+   t = ip6t_get_target(e);
+   target = t-u.kernel.target;
+   ret = xt_check_target(target, AF_INET6, t-u.target_size - sizeof(*t),
+ name, e-comefrom, e-ipv6.proto,
+ e-ipv6.invflags  IP6T_INV_PROTO);
+   if (!ret  t-u.kernel.target-checkentry
+

[NETFILTER]: ip6_tables: move IP6T_SO_GET_INFO handling to seperate function

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=433665c9d110d783ea4043c59657f0437fcc31dd
Commit: 433665c9d110d783ea4043c59657f0437fcc31dd
Parent: ed1a6f5e77441c4020b8541b3f03f03e37d638e1
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 21:50:05 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:35 2008 -0800

[NETFILTER]: ip6_tables: move IP6T_SO_GET_INFO handling to seperate function

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv6/netfilter/ip6_tables.c |   89 --
 1 files changed, 47 insertions(+), 42 deletions(-)

diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 02be4fc..681316e 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -1037,6 +1037,50 @@ copy_entries_to_user(unsigned int total_size,
return ret;
 }
 
+static int get_info(void __user *user, int *len)
+{
+   char name[IP6T_TABLE_MAXNAMELEN];
+   struct xt_table *t;
+   int ret;
+
+   if (*len != sizeof(struct ip6t_getinfo)) {
+   duprintf(length %u != %u\n, *len,
+sizeof(struct ip6t_getinfo));
+   return -EINVAL;
+   }
+
+   if (copy_from_user(name, user, sizeof(name)) != 0)
+   return -EFAULT;
+
+   name[IP6T_TABLE_MAXNAMELEN-1] = '\0';
+
+   t = try_then_request_module(xt_find_table_lock(AF_INET6, name),
+   ip6table_%s, name);
+   if (t  !IS_ERR(t)) {
+   struct ip6t_getinfo info;
+   struct xt_table_info *private = t-private;
+
+   info.valid_hooks = t-valid_hooks;
+   memcpy(info.hook_entry, private-hook_entry,
+  sizeof(info.hook_entry));
+   memcpy(info.underflow, private-underflow,
+  sizeof(info.underflow));
+   info.num_entries = private-number;
+   info.size = private-size;
+   memcpy(info.name, name, sizeof(info.name));
+
+   if (copy_to_user(user, info, *len) != 0)
+   ret = -EFAULT;
+   else
+   ret = 0;
+
+   xt_table_unlock(t);
+   module_put(t-me);
+   } else
+   ret = t ? PTR_ERR(t) : -ENOENT;
+   return ret;
+}
+
 static int
 get_entries(const struct ip6t_get_entries *entries,
struct ip6t_get_entries __user *uptr)
@@ -1274,48 +1318,9 @@ do_ip6t_get_ctl(struct sock *sk, int cmd, void __user 
*user, int *len)
return -EPERM;
 
switch (cmd) {
-   case IP6T_SO_GET_INFO: {
-   char name[IP6T_TABLE_MAXNAMELEN];
-   struct xt_table *t;
-
-   if (*len != sizeof(struct ip6t_getinfo)) {
-   duprintf(length %u != %u\n, *len,
-sizeof(struct ip6t_getinfo));
-   ret = -EINVAL;
-   break;
-   }
-
-   if (copy_from_user(name, user, sizeof(name)) != 0) {
-   ret = -EFAULT;
-   break;
-   }
-   name[IP6T_TABLE_MAXNAMELEN-1] = '\0';
-
-   t = try_then_request_module(xt_find_table_lock(AF_INET6, name),
-   ip6table_%s, name);
-   if (t  !IS_ERR(t)) {
-   struct ip6t_getinfo info;
-   struct xt_table_info *private = t-private;
-
-   info.valid_hooks = t-valid_hooks;
-   memcpy(info.hook_entry, private-hook_entry,
-  sizeof(info.hook_entry));
-   memcpy(info.underflow, private-underflow,
-  sizeof(info.underflow));
-   info.num_entries = private-number;
-   info.size = private-size;
-   memcpy(info.name, name, sizeof(info.name));
-
-   if (copy_to_user(user, info, *len) != 0)
-   ret = -EFAULT;
-   else
-   ret = 0;
-   xt_table_unlock(t);
-   module_put(t-me);
-   } else
-   ret = t ? PTR_ERR(t) : -ENOENT;
-   }
-   break;
+   case IP6T_SO_GET_INFO:
+   ret = get_info(user, len);
+   break;
 
case IP6T_SO_GET_ENTRIES: {
struct ip6t_get_entries get;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CCID3]: Redundant debugging output / documentation

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=db64196038e79b0460245d558e54ff4a21a52d1f
Commit: db64196038e79b0460245d558e54ff4a21a52d1f
Parent: 8a9c7e92e0ca97632126feee32ba2698b4eb6c8f
Author: Gerrit Renker [EMAIL PROTECTED]
AuthorDate: Wed Dec 12 13:57:14 2007 -0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:57:18 2008 -0800

[CCID3]: Redundant debugging output / documentation

Each time feedback is sent two lines are printed:

ccid3_hc_rx_send_feedback: client ... - entry
ccid3_hc_rx_send_feedback: Interval ...usec, X_recv=..., 1/p=...

The first line is redundant and thus removed.

Further, documentation of ccid3_hc_rx_sock (capitalisation) is made 
consistent.

Signed-off-by: Gerrit Renker [EMAIL PROTECTED]
Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/dccp/ccids/ccid3.c |2 --
 net/dccp/ccids/ccid3.h |4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index f8644bf..8266dfd 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -685,8 +685,6 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk,
ktime_t now;
s64 delta = 0;
 
-   ccid3_pr_debug(%s(%p) - entry \n, dccp_role(sk), sk);
-
if (unlikely(hcrx-ccid3hcrx_state == TFRC_RSTATE_TERM))
return;
 
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h
index 3c33dc6..6ceeb80 100644
--- a/net/dccp/ccids/ccid3.h
+++ b/net/dccp/ccids/ccid3.h
@@ -135,9 +135,9 @@ enum ccid3_hc_rx_states {
  *
  *  @ccid3hcrx_x_recv  -  Receiver estimate of send rate (RFC 3448 4.3)
  *  @ccid3hcrx_rtt  -  Receiver estimate of rtt (non-standard)
- *  @ccid3hcrx_p  -  current loss event rate (RFC 3448 5.4)
+ *  @ccid3hcrx_p  -  Current loss event rate (RFC 3448 5.4)
  *  @ccid3hcrx_last_counter  -  Tracks window counter (RFC 4342, 8.1)
- *  @ccid3hcrx_state  -  receiver state, one of %ccid3_hc_rx_states
+ *  @ccid3hcrx_state  -  Receiver state, one of %ccid3_hc_rx_states
  *  @ccid3hcrx_bytes_recv  -  Total sum of DCCP payload bytes
  *  @ccid3hcrx_tstamp_last_feedback  -  Time at which last feedback was sent
  *  @ccid3hcrx_tstamp_last_ack  -  Time at which last feedback was sent
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: ip_tables: remove ipchains compatibility hack

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6d6a55f42d93eeba7add62c3ad6a5409c6fd24ae
Commit: 6d6a55f42d93eeba7add62c3ad6a5409c6fd24ae
Parent: da4d0f6b3d3c7bcd00e097d48416e0a1dfde2a0f
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 21:53:18 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:42 2008 -0800

[NETFILTER]: ip_tables: remove ipchains compatibility hack

ipchains support has been removed years ago. kill last remains.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/netfilter/ip_tables.c |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 98c65ac..439b292 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1263,10 +1263,6 @@ do_replace(void __user *user, unsigned int len)
if (copy_from_user(tmp, user, sizeof(tmp)) != 0)
return -EFAULT;
 
-   /* Hack: Causes ipchains to give correct error msg --RR */
-   if (len != sizeof(tmp) + tmp.size)
-   return -ENOPROTOOPT;
-
/* overflow check */
if (tmp.num_counters = INT_MAX / sizeof(struct xt_counters))
return -ENOMEM;
@@ -1794,10 +1790,6 @@ compat_do_replace(void __user *user, unsigned int len)
if (copy_from_user(tmp, user, sizeof(tmp)) != 0)
return -EFAULT;
 
-   /* Hack: Causes ipchains to give correct error msg --RR */
-   if (len != sizeof(tmp) + tmp.size)
-   return -ENOPROTOOPT;
-
/* overflow check */
if (tmp.size = INT_MAX / num_possible_cpus())
return -ENOMEM;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: arp_tables: use XT_ALIGN

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0495cf957bfacbca123cb4c4e1c4cf0e265f522e
Commit: 0495cf957bfacbca123cb4c4e1c4cf0e265f522e
Parent: 03dafbbdf8a5e8a9e3e347a393930ed49506d00b
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 21:55:34 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:44 2008 -0800

[NETFILTER]: arp_tables: use XT_ALIGN

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/netfilter_arp/arp_tables.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/netfilter_arp/arp_tables.h 
b/include/linux/netfilter_arp/arp_tables.h
index e44811b..7ade26b 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -280,6 +280,6 @@ extern unsigned int arpt_do_table(struct sk_buff *skb,
  const struct net_device *out,
  struct arpt_table *table);
 
-#define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1))  
~(__alignof__(struct arpt_entry)-1))
+#define ARPT_ALIGN(s) XT_ALIGN(s)
 #endif /*__KERNEL__*/
 #endif /* _ARPTABLES_H */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: arp_tables: move entry and target checks to seperate functions

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fb5b6095f320bd5a615049aa5fe8827ae9d1bf80
Commit: fb5b6095f320bd5a615049aa5fe8827ae9d1bf80
Parent: 70f0bfcf6a24e259d51f62354f866f42f8a3d317
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 21:56:33 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:46 2008 -0800

[NETFILTER]: arp_tables: move entry and target checks to seperate functions

Resync with ip_tables.c as preparation for compat support.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/netfilter/arp_tables.c |   58 +++---
 1 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index cafb35a..b0f4331 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -435,12 +435,9 @@ static int mark_source_chains(struct xt_table_info 
*newinfo,
return 1;
 }
 
-static inline int check_entry(struct arpt_entry *e, const char *name, unsigned 
int size,
- unsigned int *i)
+static inline int check_entry(struct arpt_entry *e, const char *name)
 {
struct arpt_entry_target *t;
-   struct arpt_target *target;
-   int ret;
 
if (!arp_checkentry(e-arp)) {
duprintf(arp_tables: arp check failed %p %s.\n, e, name);
@@ -454,30 +451,57 @@ static inline int check_entry(struct arpt_entry *e, const 
char *name, unsigned i
if (e-target_offset + t-u.target_size  e-next_offset)
return -EINVAL;
 
+   return 0;
+}
+
+static inline int check_target(struct arpt_entry *e, const char *name)
+{
+   struct arpt_entry_target *t;
+   struct arpt_target *target;
+   int ret;
+
+   t = arpt_get_target(e);
+   target = t-u.kernel.target;
+
+   ret = xt_check_target(target, NF_ARP, t-u.target_size - sizeof(*t),
+ name, e-comefrom, 0, 0);
+   if (!ret  t-u.kernel.target-checkentry
+!t-u.kernel.target-checkentry(name, e, target, t-data,
+  e-comefrom)) {
+   duprintf(arp_tables: check failed for `%s'.\n,
+t-u.kernel.target-name);
+   ret = -EINVAL;
+   }
+   return ret;
+}
+
+static inline int
+find_check_entry(struct arpt_entry *e, const char *name, unsigned int size,
+unsigned int *i)
+{
+   struct arpt_entry_target *t;
+   struct arpt_target *target;
+   int ret;
+
+   ret = check_entry(e, name);
+   if (ret)
+   return ret;
+
+   t = arpt_get_target(e);
target = try_then_request_module(xt_find_target(NF_ARP, t-u.user.name,
t-u.user.revision),
 arpt_%s, t-u.user.name);
if (IS_ERR(target) || !target) {
-   duprintf(check_entry: `%s' not found\n, t-u.user.name);
+   duprintf(find_check_entry: `%s' not found\n, t-u.user.name);
ret = target ? PTR_ERR(target) : -ENOENT;
goto out;
}
t-u.kernel.target = target;
 
-   ret = xt_check_target(target, NF_ARP, t-u.target_size - sizeof(*t),
- name, e-comefrom, 0, 0);
+   ret = check_target(e, name);
if (ret)
goto err;
 
-   if (t-u.kernel.target-checkentry
-!t-u.kernel.target-checkentry(name, e, target, t-data,
-  e-comefrom)) {
-   duprintf(arp_tables: check failed for `%s'.\n,
-t-u.kernel.target-name);
-   ret = -EINVAL;
-   goto err;
-   }
-
(*i)++;
return 0;
 err:
@@ -611,7 +635,7 @@ static int translate_table(const char *name,
/* Finally, each sanity check must pass */
i = 0;
ret = ARPT_ENTRY_ITERATE(entry0, newinfo-size,
-check_entry, name, size, i);
+find_check_entry, name, size, i);
 
if (ret != 0) {
ARPT_ENTRY_ITERATE(entry0, newinfo-size,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: arp_tables: resync get_entries() with ip_tables

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=11f6dff8af95d8d1d14bef70d384029c5acf6e04
Commit: 11f6dff8af95d8d1d14bef70d384029c5acf6e04
Parent: 41acd975b954ad6ec4943d77e5920f2eeaf54518
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 22:26:38 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:48 2008 -0800

[NETFILTER]: arp_tables: resync get_entries() with ip_tables

Resync get_entries() with ip_tables.c by moving the checks from the
setsockopt handler to the function itself.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/netfilter/arp_tables.c |   39 +++
 1 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index 33e8d53..029df76 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -825,23 +825,35 @@ static int get_info(void __user *user, int *len)
return ret;
 }
 
-static int get_entries(const struct arpt_get_entries *entries,
-  struct arpt_get_entries __user *uptr)
+static int get_entries(struct arpt_get_entries __user *uptr, int *len)
 {
int ret;
+   struct arpt_get_entries get;
struct arpt_table *t;
 
-   t = xt_find_table_lock(NF_ARP, entries-name);
+   if (*len  sizeof(get)) {
+   duprintf(get_entries: %u  %Zu\n, *len, sizeof(get));
+   return -EINVAL;
+   }
+   if (copy_from_user(get, uptr, sizeof(get)) != 0)
+   return -EFAULT;
+   if (*len != sizeof(struct arpt_get_entries) + get.size) {
+   duprintf(get_entries: %u != %Zu\n, *len,
+sizeof(struct arpt_get_entries) + get.size);
+   return -EINVAL;
+   }
+
+   t = xt_find_table_lock(NF_ARP, get.name);
if (t  !IS_ERR(t)) {
struct xt_table_info *private = t-private;
duprintf(t-private-number = %u\n,
 private-number);
-   if (entries-size == private-size)
+   if (get.size == private-size)
ret = copy_entries_to_user(private-size,
   t, uptr-entrytable);
else {
duprintf(get_entries: I've got %u not %u!\n,
-private-size, entries-size);
+private-size, get.size);
ret = -EINVAL;
}
module_put(t-me);
@@ -1055,22 +1067,9 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, 
void __user *user, int *len
ret = get_info(user, len);
break;
 
-   case ARPT_SO_GET_ENTRIES: {
-   struct arpt_get_entries get;
-
-   if (*len  sizeof(get)) {
-   duprintf(get_entries: %u  %Zu\n, *len, sizeof(get));
-   ret = -EINVAL;
-   } else if (copy_from_user(get, user, sizeof(get)) != 0) {
-   ret = -EFAULT;
-   } else if (*len != sizeof(struct arpt_get_entries) + get.size) {
-   duprintf(get_entries: %u != %Zu\n, *len,
-sizeof(struct arpt_get_entries) + get.size);
-   ret = -EINVAL;
-   } else
-   ret = get_entries(get, user);
+   case ARPT_SO_GET_ENTRIES:
+   ret = get_entries(user, len);
break;
-   }
 
case ARPT_SO_GET_REVISION_TARGET: {
struct xt_get_revision rev;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: ctnetlink: add support for secmark

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=37fccd8577d38e249dde71512fb38d2f6a4d9d3c
Commit: 37fccd8577d38e249dde71512fb38d2f6a4d9d3c
Parent: 0f417ce989f84cfd5418e3b316064bfbb2708196
Author: Pablo Neira Ayuso [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 22:28:41 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:52 2008 -0800

[NETFILTER]: ctnetlink: add support for secmark

This patch adds support for James Morris' connsecmark.

Signed-off-by: Pablo Neira Ayuso [EMAIL PROTECTED]
Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/netfilter/nf_conntrack_common.h |4 
 include/linux/netfilter/nfnetlink_conntrack.h |1 +
 net/netfilter/nf_conntrack_netlink.c  |   22 ++
 net/netfilter/xt_CONNSECMARK.c|5 -
 4 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/include/linux/netfilter/nf_conntrack_common.h 
b/include/linux/netfilter/nf_conntrack_common.h
index 19747e8..bad1eb7 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -133,6 +133,10 @@ enum ip_conntrack_events
/* NAT sequence adjustment */
IPCT_NATSEQADJ_BIT = 13,
IPCT_NATSEQADJ = (1  IPCT_NATSEQADJ_BIT),
+
+   /* Secmark is set */
+   IPCT_SECMARK_BIT = 14,
+   IPCT_SECMARK = (1  IPCT_SECMARK_BIT),
 };
 
 enum ip_conntrack_expect_events {
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h 
b/include/linux/netfilter/nfnetlink_conntrack.h
index c19d976..e3e1533 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -39,6 +39,7 @@ enum ctattr_type {
CTA_TUPLE_MASTER,
CTA_NAT_SEQ_ADJ_ORIG,
CTA_NAT_SEQ_ADJ_REPLY,
+   CTA_SECMARK,
__CTA_MAX
 };
 #define CTA_MAX (__CTA_MAX - 1)
diff --git a/net/netfilter/nf_conntrack_netlink.c 
b/net/netfilter/nf_conntrack_netlink.c
index 94027c8..d4eedc6 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -254,6 +254,22 @@ nla_put_failure:
 #define ctnetlink_dump_mark(a, b) (0)
 #endif
 
+#ifdef CONFIG_NF_CONNTRACK_SECMARK
+static inline int
+ctnetlink_dump_secmark(struct sk_buff *skb, const struct nf_conn *ct)
+{
+   __be32 mark = htonl(ct-secmark);
+
+   NLA_PUT(skb, CTA_SECMARK, sizeof(u_int32_t), mark);
+   return 0;
+
+nla_put_failure:
+   return -1;
+}
+#else
+#define ctnetlink_dump_secmark(a, b) (0)
+#endif
+
 #define master_tuple(ct) (ct-master-tuplehash[IP_CT_DIR_ORIGINAL].tuple)
 
 static inline int
@@ -392,6 +408,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
ctnetlink_dump_protoinfo(skb, ct)  0 ||
ctnetlink_dump_helpinfo(skb, ct)  0 ||
ctnetlink_dump_mark(skb, ct)  0 ||
+   ctnetlink_dump_secmark(skb, ct)  0 ||
ctnetlink_dump_id(skb, ct)  0 ||
ctnetlink_dump_use(skb, ct)  0 ||
ctnetlink_dump_master(skb, ct)  0 ||
@@ -493,6 +510,11 @@ static int ctnetlink_conntrack_event(struct notifier_block 
*this,
 ctnetlink_dump_mark(skb, ct)  0)
goto nla_put_failure;
 #endif
+#ifdef CONFIG_NF_CONNTRACK_SECMARK
+   if ((events  IPCT_SECMARK || ct-secmark)
+ctnetlink_dump_secmark(skb, ct)  0)
+   goto nla_put_failure;
+#endif
 
if (events  IPCT_COUNTER_FILLING 
(ctnetlink_dump_counters(skb, ct, IP_CT_DIR_ORIGINAL)  0 ||
diff --git a/net/netfilter/xt_CONNSECMARK.c b/net/netfilter/xt_CONNSECMARK.c
index 2c265e8..2333f7e 100644
--- a/net/netfilter/xt_CONNSECMARK.c
+++ b/net/netfilter/xt_CONNSECMARK.c
@@ -20,6 +20,7 @@
 #include linux/netfilter/x_tables.h
 #include linux/netfilter/xt_CONNSECMARK.h
 #include net/netfilter/nf_conntrack.h
+#include net/netfilter/nf_conntrack_ecache.h
 
 #define PFX CONNSECMARK: 
 
@@ -40,8 +41,10 @@ static void secmark_save(const struct sk_buff *skb)
enum ip_conntrack_info ctinfo;
 
ct = nf_ct_get(skb, ctinfo);
-   if (ct  !ct-secmark)
+   if (ct  !ct-secmark) {
ct-secmark = skb-secmark;
+   nf_conntrack_event_cache(IPCT_SECMARK, skb);
+   }
}
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: nf_nat_proto_gre: add missing module reference

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3ee9e760387c38558df976bc2905959826adf331
Commit: 3ee9e760387c38558df976bc2905959826adf331
Parent: d978e5daec544ec72b28bf72a30dc9ac3da23a35
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 22:37:20 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:55 2008 -0800

[NETFILTER]: nf_nat_proto_gre: add missing module reference

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/netfilter/nf_nat_proto_gre.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/netfilter/nf_nat_proto_gre.c 
b/net/ipv4/netfilter/nf_nat_proto_gre.c
index b820f99..945e0ae 100644
--- a/net/ipv4/netfilter/nf_nat_proto_gre.c
+++ b/net/ipv4/netfilter/nf_nat_proto_gre.c
@@ -138,6 +138,7 @@ gre_manip_pkt(struct sk_buff *skb, unsigned int iphdroff,
 static struct nf_nat_protocol gre __read_mostly = {
.name   = GRE,
.protonum   = IPPROTO_GRE,
+   .me = THIS_MODULE,
.manip_pkt  = gre_manip_pkt,
.in_range   = gre_in_range,
.unique_tuple   = gre_unique_tuple,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: nf_nat: mark NAT protocols const

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b628a0866860d44652362aafe403e5b5895583d
Commit: 2b628a0866860d44652362aafe403e5b5895583d
Parent: 3ee9e760387c38558df976bc2905959826adf331
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 22:37:36 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:56 2008 -0800

[NETFILTER]: nf_nat: mark NAT protocols const

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/netfilter/nf_nat_protocol.h   |   18 +-
 net/ipv4/netfilter/nf_nat_core.c  |   20 ++--
 net/ipv4/netfilter/nf_nat_proto_gre.c |2 +-
 net/ipv4/netfilter/nf_nat_proto_icmp.c|2 +-
 net/ipv4/netfilter/nf_nat_proto_tcp.c |2 +-
 net/ipv4/netfilter/nf_nat_proto_udp.c |2 +-
 net/ipv4/netfilter/nf_nat_proto_unknown.c |2 +-
 net/netfilter/nf_conntrack_netlink.c  |2 +-
 8 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/include/net/netfilter/nf_nat_protocol.h 
b/include/net/netfilter/nf_nat_protocol.h
index 04578bf..4aa0edb 100644
--- a/include/net/netfilter/nf_nat_protocol.h
+++ b/include/net/netfilter/nf_nat_protocol.h
@@ -46,21 +46,21 @@ struct nf_nat_protocol
 };
 
 /* Protocol registration. */
-extern int nf_nat_protocol_register(struct nf_nat_protocol *proto);
-extern void nf_nat_protocol_unregister(struct nf_nat_protocol *proto);
+extern int nf_nat_protocol_register(const struct nf_nat_protocol *proto);
+extern void nf_nat_protocol_unregister(const struct nf_nat_protocol *proto);
 
-extern struct nf_nat_protocol *nf_nat_proto_find_get(u_int8_t protocol);
-extern void nf_nat_proto_put(struct nf_nat_protocol *proto);
+extern const struct nf_nat_protocol *nf_nat_proto_find_get(u_int8_t protocol);
+extern void nf_nat_proto_put(const struct nf_nat_protocol *proto);
 
 /* Built-in protocols. */
-extern struct nf_nat_protocol nf_nat_protocol_tcp;
-extern struct nf_nat_protocol nf_nat_protocol_udp;
-extern struct nf_nat_protocol nf_nat_protocol_icmp;
-extern struct nf_nat_protocol nf_nat_unknown_protocol;
+extern const struct nf_nat_protocol nf_nat_protocol_tcp;
+extern const struct nf_nat_protocol nf_nat_protocol_udp;
+extern const struct nf_nat_protocol nf_nat_protocol_icmp;
+extern const struct nf_nat_protocol nf_nat_unknown_protocol;
 
 extern int init_protocols(void) __init;
 extern void cleanup_protocols(void);
-extern struct nf_nat_protocol *find_nat_proto(u_int16_t protonum);
+extern const struct nf_nat_protocol *find_nat_proto(u_int16_t protonum);
 
 extern int nf_nat_port_range_to_nlattr(struct sk_buff *skb,
   const struct nf_nat_range *range);
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index 4ee67e9..a772445 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -42,18 +42,18 @@ static int nf_nat_vmalloced;
 static struct hlist_head *bysource;
 
 #define MAX_IP_NAT_PROTO 256
-static struct nf_nat_protocol *nf_nat_protos[MAX_IP_NAT_PROTO];
+static const struct nf_nat_protocol *nf_nat_protos[MAX_IP_NAT_PROTO];
 
-static inline struct nf_nat_protocol *
+static inline const struct nf_nat_protocol *
 __nf_nat_proto_find(u_int8_t protonum)
 {
return rcu_dereference(nf_nat_protos[protonum]);
 }
 
-struct nf_nat_protocol *
+const struct nf_nat_protocol *
 nf_nat_proto_find_get(u_int8_t protonum)
 {
-   struct nf_nat_protocol *p;
+   const struct nf_nat_protocol *p;
 
rcu_read_lock();
p = __nf_nat_proto_find(protonum);
@@ -66,7 +66,7 @@ nf_nat_proto_find_get(u_int8_t protonum)
 EXPORT_SYMBOL_GPL(nf_nat_proto_find_get);
 
 void
-nf_nat_proto_put(struct nf_nat_protocol *p)
+nf_nat_proto_put(const struct nf_nat_protocol *p)
 {
module_put(p-me);
 }
@@ -105,7 +105,7 @@ static int
 in_range(const struct nf_conntrack_tuple *tuple,
 const struct nf_nat_range *range)
 {
-   struct nf_nat_protocol *proto;
+   const struct nf_nat_protocol *proto;
int ret = 0;
 
/* If we are supposed to map IPs, then we must be in the
@@ -226,7 +226,7 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple,
 struct nf_conn *ct,
 enum nf_nat_manip_type maniptype)
 {
-   struct nf_nat_protocol *proto;
+   const struct nf_nat_protocol *proto;
 
/* 1) If this srcip/proto/src-proto-part is currently mapped,
   and that same mapping gives a unique tuple within the given
@@ -355,7 +355,7 @@ manip_pkt(u_int16_t proto,
  enum nf_nat_manip_type maniptype)
 {
struct iphdr *iph;
-   struct nf_nat_protocol *p;
+   const struct nf_nat_protocol *p;
 
if (!skb_make_writable(skb, iphdroff + sizeof(*iph)))
return 0;
@@ -515,7 +515,7 @@ int nf_nat_icmp_reply_translation(struct nf_conn *ct,
 

[NETFILTER]: nf_log: remove incomprehensible comment

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a7c42955e036127f793ad955d3ec718494efb1eb
Commit: a7c42955e036127f793ad955d3ec718494efb1eb
Parent: 7b2f9631e789c3e7d59201c21f09a24cd6ce3b1a
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 22:39:27 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:00 2008 -0800

[NETFILTER]: nf_log: remove incomprehensible comment

Whatever that comment tries to say, I don't get it and it looks like
a leftover from the time when RCU wasn't used properly.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/netfilter/nf_log.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index ed9116d..4f5f288 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -91,7 +91,6 @@ void nf_log_packet(int pf,
va_start(args, fmt);
vsnprintf(prefix, sizeof(prefix), fmt, args);
va_end(args);
-   /* We must read logging before nf_logfn[pf] */
logger-logfn(pf, hooknum, skb, in, out, loginfo, prefix);
} else if (net_ratelimit()) {
printk(KERN_WARNING nf_log_packet: can\'t log since 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: x_tables: use %u format specifiers

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=df54aae02210e1acf3a1d2ffac9b29003835710c
Commit: df54aae02210e1acf3a1d2ffac9b29003835710c
Parent: 051578ccbcdad3b24b621dfb652194e36759e8d5
Author: Jan Engelhardt [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 22:43:15 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:07 2008 -0800

[NETFILTER]: x_tables: use %u format specifiers

Use %u format specifiers as -family is unsigned.

Signed-off-by: Jan Engelhardt [EMAIL PROTECTED]
Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/netfilter/ipt_CLUSTERIP.c |2 +-
 net/netfilter/xt_CONNMARK.c|2 +-
 net/netfilter/xt_CONNSECMARK.c |2 +-
 net/netfilter/xt_connbytes.c   |2 +-
 net/netfilter/xt_connmark.c|2 +-
 net/netfilter/xt_conntrack.c   |2 +-
 net/netfilter/xt_helper.c  |2 +-
 net/netfilter/xt_state.c   |2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c 
b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index dc1e7b4..a48e264 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -414,7 +414,7 @@ clusterip_tg_check(const char *tablename, const void 
*e_void,
 
if (nf_ct_l3proto_try_module_get(target-family)  0) {
printk(KERN_WARNING can't load conntrack support for 
-   proto=%d\n, target-family);
+   proto=%u\n, target-family);
return false;
}
 
diff --git a/net/netfilter/xt_CONNMARK.c b/net/netfilter/xt_CONNMARK.c
index d96ee3e..ec2eb34 100644
--- a/net/netfilter/xt_CONNMARK.c
+++ b/net/netfilter/xt_CONNMARK.c
@@ -95,7 +95,7 @@ connmark_tg_check(const char *tablename, const void *entry,
}
if (nf_ct_l3proto_try_module_get(target-family)  0) {
printk(KERN_WARNING can't load conntrack support for 
-   proto=%d\n, target-family);
+   proto=%u\n, target-family);
return false;
}
return true;
diff --git a/net/netfilter/xt_CONNSECMARK.c b/net/netfilter/xt_CONNSECMARK.c
index 2333f7e..024106b 100644
--- a/net/netfilter/xt_CONNSECMARK.c
+++ b/net/netfilter/xt_CONNSECMARK.c
@@ -106,7 +106,7 @@ connsecmark_tg_check(const char *tablename, const void 
*entry,
 
if (nf_ct_l3proto_try_module_get(target-family)  0) {
printk(KERN_WARNING can't load conntrack support for 
-   proto=%d\n, target-family);
+   proto=%u\n, target-family);
return false;
}
return true;
diff --git a/net/netfilter/xt_connbytes.c b/net/netfilter/xt_connbytes.c
index 752b7d8..7d4940a 100644
--- a/net/netfilter/xt_connbytes.c
+++ b/net/netfilter/xt_connbytes.c
@@ -111,7 +111,7 @@ connbytes_mt_check(const char *tablename, const void *ip,
 
if (nf_ct_l3proto_try_module_get(match-family)  0) {
printk(KERN_WARNING can't load conntrack support for 
-   proto=%d\n, match-family);
+   proto=%u\n, match-family);
return false;
}
 
diff --git a/net/netfilter/xt_connmark.c b/net/netfilter/xt_connmark.c
index b5c0f2f..8ad875b 100644
--- a/net/netfilter/xt_connmark.c
+++ b/net/netfilter/xt_connmark.c
@@ -61,7 +61,7 @@ connmark_mt_check(const char *tablename, const void *ip,
}
if (nf_ct_l3proto_try_module_get(match-family)  0) {
printk(KERN_WARNING can't load conntrack support for 
-   proto=%d\n, match-family);
+   proto=%u\n, match-family);
return false;
}
return true;
diff --git a/net/netfilter/xt_conntrack.c b/net/netfilter/xt_conntrack.c
index eb7e135..8c1d448 100644
--- a/net/netfilter/xt_conntrack.c
+++ b/net/netfilter/xt_conntrack.c
@@ -117,7 +117,7 @@ conntrack_mt_check(const char *tablename, const void *ip,
 {
if (nf_ct_l3proto_try_module_get(match-family)  0) {
printk(KERN_WARNING can't load conntrack support for 
-   proto=%d\n, match-family);
+   proto=%u\n, match-family);
return false;
}
return true;
diff --git a/net/netfilter/xt_helper.c b/net/netfilter/xt_helper.c
index f342788..5d063e5 100644
--- a/net/netfilter/xt_helper.c
+++ b/net/netfilter/xt_helper.c
@@ -66,7 +66,7 @@ helper_mt_check(const char *tablename, const void *inf,
 
if (nf_ct_l3proto_try_module_get(match-family)  0) {
printk(KERN_WARNING can't load conntrack support for 
-   proto=%d\n, match-family);
+  

[NETFILTER]: Introduce nf_inet_address

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=643a2c15a407faf08101a20e1a3461160711899d
Commit: 643a2c15a407faf08101a20e1a3461160711899d
Parent: df54aae02210e1acf3a1d2ffac9b29003835710c
Author: Jan Engelhardt [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 22:43:50 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:07 2008 -0800

[NETFILTER]: Introduce nf_inet_address

A few netfilter modules provide their own union of IPv4 and IPv6
address storage. Will unify that in this patch series.

(1/4): Rename union nf_conntrack_address to union nf_inet_addr and
move it to x_tables.h.

Signed-off-by: Jan Engelhardt [EMAIL PROTECTED]
Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/netfilter.h   |6 
 include/linux/netfilter/nf_conntrack_h323.h |6 ++--
 include/net/netfilter/nf_conntrack_expect.h |4 +-
 include/net/netfilter/nf_conntrack_tuple.h  |   17 -
 net/ipv4/netfilter/nf_nat_h323.c|   10 
 net/netfilter/nf_conntrack_expect.c |4 +-
 net/netfilter/nf_conntrack_ftp.c|2 +-
 net/netfilter/nf_conntrack_h323_main.c  |   34 +-
 net/netfilter/nf_conntrack_sip.c|8 +++---
 net/netfilter/xt_connlimit.c|   20 
 10 files changed, 55 insertions(+), 56 deletions(-)

diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 1a84873..d190d56 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -48,6 +48,12 @@ enum nf_inet_hooks {
NF_INET_NUMHOOKS
 };
 
+union nf_inet_addr {
+   u_int32_t   all[4];
+   __be32  ip;
+   __be32  ip6[4];
+};
+
 #ifdef __KERNEL__
 #ifdef CONFIG_NETFILTER
 
diff --git a/include/linux/netfilter/nf_conntrack_h323.h 
b/include/linux/netfilter/nf_conntrack_h323.h
index aabd24a..26f9226 100644
--- a/include/linux/netfilter/nf_conntrack_h323.h
+++ b/include/linux/netfilter/nf_conntrack_h323.h
@@ -31,7 +31,7 @@ struct nf_conn;
 
 extern int get_h225_addr(struct nf_conn *ct, unsigned char *data,
 TransportAddress *taddr,
-union nf_conntrack_address *addr, __be16 *port);
+union nf_inet_addr *addr, __be16 *port);
 extern void nf_conntrack_h245_expect(struct nf_conn *new,
 struct nf_conntrack_expect *this);
 extern void nf_conntrack_q931_expect(struct nf_conn *new,
@@ -39,12 +39,12 @@ extern void nf_conntrack_q931_expect(struct nf_conn *new,
 extern int (*set_h245_addr_hook) (struct sk_buff *skb,
  unsigned char **data, int dataoff,
  H245_TransportAddress *taddr,
- union nf_conntrack_address *addr,
+ union nf_inet_addr *addr,
  __be16 port);
 extern int (*set_h225_addr_hook) (struct sk_buff *skb,
  unsigned char **data, int dataoff,
  TransportAddress *taddr,
- union nf_conntrack_address *addr,
+ union nf_inet_addr *addr,
  __be16 port);
 extern int (*set_sig_addr_hook) (struct sk_buff *skb,
 struct nf_conn *ct,
diff --git a/include/net/netfilter/nf_conntrack_expect.h 
b/include/net/netfilter/nf_conntrack_expect.h
index b47c04f..6c3fd25 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -73,8 +73,8 @@ void nf_ct_unexpect_related(struct nf_conntrack_expect *exp);
nf_ct_expect_related.  You will have to call put afterwards. */
 struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me);
 void nf_ct_expect_init(struct nf_conntrack_expect *, int,
-  union nf_conntrack_address *,
-  union nf_conntrack_address *,
+  union nf_inet_addr *,
+  union nf_inet_addr *,
   u_int8_t, __be16 *, __be16 *);
 void nf_ct_expect_put(struct nf_conntrack_expect *exp);
 int nf_ct_expect_related(struct nf_conntrack_expect *expect);
diff --git a/include/net/netfilter/nf_conntrack_tuple.h 
b/include/net/netfilter/nf_conntrack_tuple.h
index c48e390..45cb17c 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -10,6 +10,7 @@
 #ifndef _NF_CONNTRACK_TUPLE_H
 #define _NF_CONNTRACK_TUPLE_H
 
+#include linux/netfilter/x_tables.h
 #include linux/netfilter/nf_conntrack_tuple_common.h
 
 /* A `tuple' is a structure containing the information to uniquely
@@ -20,15 +21,7 @@
   non-manipulatable lines, for the benefit of the NAT code.
 */
 

[NETFILTER]: xt_hashlimit: speedup hash_dst()

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e2f82ac3fcca59751b65124544d11ed8be4a
Commit: e2f82ac3fcca59751b65124544d11ed8be4a
Parent: 22c2d8bca212a655c120fd6617328ffa3480afad
Author: Eric Dumazet [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 22:45:13 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:10 2008 -0800

[NETFILTER]: xt_hashlimit: speedup hash_dst()

1) Using jhash2() instead of jhash() is a litle bit faster if applicable.

2) Thanks to jhash, hash value uses full 32 bits.
   Instead of returning hash % size (implying a divide)
   we return the high 32 bits of the (hash * size) that will
   give results between [0 and size-1] and same hash distribution.

  On most cpus, a multiply is less expensive than a divide, by an order
  of magnitude.

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/netfilter/xt_hashlimit.c |   11 ++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 951d4c8..651c1d2 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -105,7 +105,16 @@ static inline bool dst_cmp(const struct dsthash_ent *ent,
 static u_int32_t
 hash_dst(const struct xt_hashlimit_htable *ht, const struct dsthash_dst *dst)
 {
-   return jhash(dst, sizeof(*dst), ht-rnd) % ht-cfg.size;
+   u_int32_t hash = jhash2((const u32 *)dst,
+   sizeof(*dst)/sizeof(u32),
+   ht-rnd);
+   /*
+* Instead of returning hash % ht-cfg.size (implying a divide)
+* we return the high 32 bits of the (hash * ht-cfg.size) that will
+* give results between [0 and cfg.size-1] and same hash distribution,
+* but using a multiply, less expensive than a divide
+*/
+   return ((u64)hash * ht-cfg.size)  32;
 }
 
 static struct dsthash_ent *
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: ctnetlink: use netlink attribute helpers

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=77236b6e33b06aaf756a86ed1965ca7d460b1b53
Commit: 77236b6e33b06aaf756a86ed1965ca7d460b1b53
Parent: 838965ba22066c7fcdbacfc543c387d0eb76c14c
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 22:29:45 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:58:54 2008 -0800

[NETFILTER]: ctnetlink: use netlink attribute helpers

Use NLA_PUT_BE32, nla_get_be32() etc.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |   10 +--
 net/ipv4/netfilter/nf_conntrack_proto_icmp.c   |   18 ++---
 net/ipv4/netfilter/nf_nat_core.c   |   12 +--
 net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c |   18 ++---
 net/netfilter/nf_conntrack_core.c  |   10 +--
 net/netfilter/nf_conntrack_netlink.c   |   87 ++--
 net/netfilter/nf_conntrack_proto_tcp.c |   22 +++---
 7 files changed, 70 insertions(+), 107 deletions(-)

diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c 
b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index cd2d845..78e6495 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -363,10 +363,8 @@ getorigdst(struct sock *sk, int optval, void __user *user, 
int *len)
 static int ipv4_tuple_to_nlattr(struct sk_buff *skb,
const struct nf_conntrack_tuple *tuple)
 {
-   NLA_PUT(skb, CTA_IP_V4_SRC, sizeof(u_int32_t),
-   tuple-src.u3.ip);
-   NLA_PUT(skb, CTA_IP_V4_DST, sizeof(u_int32_t),
-   tuple-dst.u3.ip);
+   NLA_PUT_BE32(skb, CTA_IP_V4_SRC, tuple-src.u3.ip);
+   NLA_PUT_BE32(skb, CTA_IP_V4_DST, tuple-dst.u3.ip);
return 0;
 
 nla_put_failure:
@@ -384,8 +382,8 @@ static int ipv4_nlattr_to_tuple(struct nlattr *tb[],
if (!tb[CTA_IP_V4_SRC] || !tb[CTA_IP_V4_DST])
return -EINVAL;
 
-   t-src.u3.ip = *(__be32 *)nla_data(tb[CTA_IP_V4_SRC]);
-   t-dst.u3.ip = *(__be32 *)nla_data(tb[CTA_IP_V4_DST]);
+   t-src.u3.ip = nla_get_be32(tb[CTA_IP_V4_SRC]);
+   t-dst.u3.ip = nla_get_be32(tb[CTA_IP_V4_DST]);
 
return 0;
 }
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c 
b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
index 4153e04..3e2e5cd 100644
--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
@@ -234,12 +234,9 @@ icmp_error(struct sk_buff *skb, unsigned int dataoff,
 static int icmp_tuple_to_nlattr(struct sk_buff *skb,
const struct nf_conntrack_tuple *t)
 {
-   NLA_PUT(skb, CTA_PROTO_ICMP_ID, sizeof(u_int16_t),
-   t-src.u.icmp.id);
-   NLA_PUT(skb, CTA_PROTO_ICMP_TYPE, sizeof(u_int8_t),
-   t-dst.u.icmp.type);
-   NLA_PUT(skb, CTA_PROTO_ICMP_CODE, sizeof(u_int8_t),
-   t-dst.u.icmp.code);
+   NLA_PUT_BE16(skb, CTA_PROTO_ICMP_ID, t-src.u.icmp.id);
+   NLA_PUT_U8(skb, CTA_PROTO_ICMP_TYPE, t-dst.u.icmp.type);
+   NLA_PUT_U8(skb, CTA_PROTO_ICMP_CODE, t-dst.u.icmp.code);
 
return 0;
 
@@ -261,12 +258,9 @@ static int icmp_nlattr_to_tuple(struct nlattr *tb[],
|| !tb[CTA_PROTO_ICMP_ID])
return -EINVAL;
 
-   tuple-dst.u.icmp.type =
-   *(u_int8_t *)nla_data(tb[CTA_PROTO_ICMP_TYPE]);
-   tuple-dst.u.icmp.code =
-   *(u_int8_t *)nla_data(tb[CTA_PROTO_ICMP_CODE]);
-   tuple-src.u.icmp.id =
-   *(__be16 *)nla_data(tb[CTA_PROTO_ICMP_ID]);
+   tuple-dst.u.icmp.type = nla_get_u8(tb[CTA_PROTO_ICMP_TYPE]);
+   tuple-dst.u.icmp.code = nla_get_u8(tb[CTA_PROTO_ICMP_CODE]);
+   tuple-src.u.icmp.id = nla_get_be16(tb[CTA_PROTO_ICMP_ID]);
 
if (tuple-dst.u.icmp.type = sizeof(invmap)
|| !invmap[tuple-dst.u.icmp.type])
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index 746c2ef..4ee67e9 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -547,10 +547,8 @@ int
 nf_nat_port_range_to_nlattr(struct sk_buff *skb,
const struct nf_nat_range *range)
 {
-   NLA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(__be16),
-   range-min.tcp.port);
-   NLA_PUT(skb, CTA_PROTONAT_PORT_MAX, sizeof(__be16),
-   range-max.tcp.port);
+   NLA_PUT_BE16(skb, CTA_PROTONAT_PORT_MIN, range-min.tcp.port);
+   NLA_PUT_BE16(skb, CTA_PROTONAT_PORT_MAX, range-max.tcp.port);
 
return 0;
 
@@ -568,8 +566,7 @@ nf_nat_port_nlattr_to_range(struct nlattr *tb[], struct 
nf_nat_range *range)
 
if (tb[CTA_PROTONAT_PORT_MIN]) {
ret = 1;
-   range-min.tcp.port =
-   *(__be16 

[NETFILTER]: xt_hashlimit: reduce overhead without IPv6

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7b21e09d1c17ef0296ec5a6df231a6c5c87b2fd7
Commit: 7b21e09d1c17ef0296ec5a6df231a6c5c87b2fd7
Parent: e2f82ac3fcca59751b65124544d11ed8be4a
Author: Eric Dumazet [EMAIL PROTECTED]
AuthorDate: Mon Dec 17 22:45:28 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:11 2008 -0800

[NETFILTER]: xt_hashlimit: reduce overhead without IPv6

This patch generalizes the (CONFIG_IP6_NF_IPTABLES || 
CONFIG_IP6_NF_IPTABLES_MODULE)
test done in hashlimit_init_dst() to all the xt_hashlimit module.

This permits a size reduction of struct dsthash_dst. This saves memory and
cpu for IPV4 only hosts.

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/netfilter/xt_hashlimit.c |   20 +---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 651c1d2..c35d220 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -20,8 +20,11 @@
 #include linux/mm.h
 #include linux/in.h
 #include linux/ip.h
+#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
 #include linux/ipv6.h
 #include net/ipv6.h
+#endif
+
 #include net/net_namespace.h
 
 #include linux/netfilter/x_tables.h
@@ -48,10 +51,12 @@ struct dsthash_dst {
__be32 src;
__be32 dst;
} ip;
+#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
struct {
__be32 src[4];
__be32 dst[4];
} ip6;
+#endif
} addr;
__be16 src_port;
__be16 dst_port;
@@ -599,6 +604,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = {
.destroy= hashlimit_mt_destroy,
.me = THIS_MODULE
},
+#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
{
.name   = hashlimit,
.family = AF_INET6,
@@ -613,6 +619,7 @@ static struct xt_match hashlimit_mt_reg[] __read_mostly = {
.destroy= hashlimit_mt_destroy,
.me = THIS_MODULE
},
+#endif
 };
 
 /* PROC stuff */
@@ -675,6 +682,7 @@ static int dl_seq_real_show(struct dsthash_ent *ent, int 
family,
 ntohs(ent-dst.dst_port),
 ent-rateinfo.credit, ent-rateinfo.credit_cap,
 ent-rateinfo.cost);
+#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
case AF_INET6:
return seq_printf(s, %ld  NIP6_FMT :%u-
 NIP6_FMT :%u %u %u %u\n,
@@ -685,6 +693,7 @@ static int dl_seq_real_show(struct dsthash_ent *ent, int 
family,
 ntohs(ent-dst.dst_port),
 ent-rateinfo.credit, ent-rateinfo.credit_cap,
 ent-rateinfo.cost);
+#endif
default:
BUG();
return 0;
@@ -756,14 +765,17 @@ static int __init hashlimit_mt_init(void)
entry\n);
goto err3;
}
+   err = 0;
+#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
hashlimit_procdir6 = proc_mkdir(ip6t_hashlimit, init_net.proc_net);
if (!hashlimit_procdir6) {
printk(KERN_ERR xt_hashlimit: unable to create proc dir 
entry\n);
-   goto err4;
+   err = -ENOMEM;
}
-   return 0;
-err4:
+#endif
+   if (!err)
+   return 0;
remove_proc_entry(ipt_hashlimit, init_net.proc_net);
 err3:
kmem_cache_destroy(hashlimit_cachep);
@@ -777,7 +789,9 @@ err1:
 static void __exit hashlimit_mt_exit(void)
 {
remove_proc_entry(ipt_hashlimit, init_net.proc_net);
+#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
remove_proc_entry(ip6t_hashlimit, init_net.proc_net);
+#endif
kmem_cache_destroy(hashlimit_cachep);
xt_unregister_matches(hashlimit_mt_reg, ARRAY_SIZE(hashlimit_mt_reg));
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NIU]: Use print_mac

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2caf62f6cae46e36b1c4a1b0f2d9ef82af89cad2
Commit: 2caf62f6cae46e36b1c4a1b0f2d9ef82af89cad2
Parent: d66453722873e1595b7934acbdcd5cdfa6982d6c
Author: Joe Perches [EMAIL PROTECTED]
AuthorDate: Thu Dec 20 04:07:35 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:15 2008 -0800

[NIU]: Use print_mac

Signed-off-by: Joe Perches [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/net/niu.c |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 5f6beab..2fe14b0 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -7588,12 +7588,10 @@ static void __devinit niu_assign_netdev_ops(struct 
net_device *dev)
 static void __devinit niu_device_announce(struct niu *np)
 {
struct net_device *dev = np-dev;
-   int i;
+   DECLARE_MAC_BUF(mac);
 
-   pr_info(%s: NIU Ethernet , dev-name);
-   for (i = 0; i  6; i++)
-   printk(%2.2x%c, dev-dev_addr[i],
-  i == 5 ? '\n' : ':');
+   pr_info(%s: NIU Ethernet %s\n,
+   dev-name, print_mac(mac, dev-dev_addr));
 
pr_info(%s: Port type[%s] mode[%s:%s] XCVR[%s] phy[%s]\n,
dev-name,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


mac80211: pass in PS_POLL frames

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=98f0b0a3a412eade153c7cf00c6b863600980d89
Commit: 98f0b0a3a412eade153c7cf00c6b863600980d89
Parent: d647b36a69bf0a630ebf981bde3c0651e2779e5e
Author: Ron Rindjunsky [EMAIL PROTECTED]
AuthorDate: Tue Dec 18 17:23:53 2007 +0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:16 2008 -0800

mac80211: pass in PS_POLL frames

This patch fixes should_drop_frame function to pass in ps poll control
frames required for power save functioanlity. Interface types that do not
have interest for PS POLL frames now drop it in handler.

Signed-off-by: Ron Rindjunsky [EMAIL PROTECTED]
Acked-by: Johannes Berg [EMAIL PROTECTED]
Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/mac80211/rx.c   |   11 +--
 net/mac80211/util.c |7 ++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 9cd59ec..e65da57 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -61,8 +61,10 @@ static inline int should_drop_frame(struct 
ieee80211_rx_status *status,
return 1;
if (unlikely(skb-len  16 + present_fcs_len + radiotap_len))
return 1;
-   if ((hdr-frame_control  cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
-   cpu_to_le16(IEEE80211_FTYPE_CTL))
+   if (((hdr-frame_control  cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
+   cpu_to_le16(IEEE80211_FTYPE_CTL)) 
+   ((hdr-frame_control  cpu_to_le16(IEEE80211_FCTL_STYPE)) !=
+   cpu_to_le16(IEEE80211_STYPE_PSPOLL)))
return 1;
return 0;
 }
@@ -896,6 +898,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
 static ieee80211_txrx_result
 ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
 {
+   struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx-dev);
struct sk_buff *skb;
int no_pending_pkts;
DECLARE_MAC_BUF(mac);
@@ -906,6 +909,10 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
   !(rx-flags  IEEE80211_TXRXD_RXRA_MATCH)))
return TXRX_CONTINUE;
 
+   if ((sdata-type != IEEE80211_IF_TYPE_AP) 
+   (sdata-type != IEEE80211_IF_TYPE_VLAN))
+   return TXRX_DROP;
+
skb = skb_dequeue(rx-sta-tx_filtered);
if (!skb) {
skb = skb_dequeue(rx-sta-ps_tx_buf);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 7b278e9..fb7fd89 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -135,13 +135,16 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t 
len)
 {
u16 fc;
 
-   if (len  24)
+/* drop ACK/CTS frames and incorrect hdr len (ctrl) */
+   if (len  16)
return NULL;
 
fc = le16_to_cpu(hdr-frame_control);
 
switch (fc  IEEE80211_FCTL_FTYPE) {
case IEEE80211_FTYPE_DATA:
+   if (len  24) /* drop incorrect hdr len (data) */
+   return NULL;
switch (fc  (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
case IEEE80211_FCTL_TODS:
return hdr-addr1;
@@ -154,6 +157,8 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t 
len)
}
break;
case IEEE80211_FTYPE_MGMT:
+   if (len  24) /* drop incorrect hdr len (mgmt) */
+   return NULL;
return hdr-addr3;
case IEEE80211_FTYPE_CTL:
if ((fc  IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCTP]: ADD-IP updates the states where ASCONFs can be sent

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ba8a06daed7d7c8785c92c343da9e202e6988fda
Commit: ba8a06daed7d7c8785c92c343da9e202e6988fda
Parent: df21857714398acb8b24a8bb5a6d2286dd9c59ef
Author: Vlad Yasevich [EMAIL PROTECTED]
AuthorDate: Thu Dec 20 14:11:11 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:22 2008 -0800

[SCTP]: ADD-IP updates the states where ASCONFs can be sent

   C4)  Both ASCONF and ASCONF-ACK Chunks MUST NOT be sent in any SCTP
state except ESTABLISHED, SHUTDOWN-PENDING, SHUTDOWN-RECEIVED,
and SHUTDOWN-SENT.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/sctp/sm_statetable.c |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c
index a93a4bc..e6016e4 100644
--- a/net/sctp/sm_statetable.c
+++ b/net/sctp/sm_statetable.c
@@ -457,11 +457,11 @@ static const sctp_sm_table_entry_t 
chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][
/* SCTP_STATE_ESTABLISHED */ \
TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
/* SCTP_STATE_SHUTDOWN_PENDING */ \
-   TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+   TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
/* SCTP_STATE_SHUTDOWN_SENT */ \
-   TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+   TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
/* SCTP_STATE_SHUTDOWN_RECEIVED */ \
-   TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+   TYPE_SCTP_FUNC(sctp_sf_do_asconf), \
/* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
 } /* TYPE_SCTP_ASCONF */
@@ -478,11 +478,11 @@ static const sctp_sm_table_entry_t 
chunk_event_table[SCTP_NUM_BASE_CHUNK_TYPES][
/* SCTP_STATE_ESTABLISHED */ \
TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
/* SCTP_STATE_SHUTDOWN_PENDING */ \
-   TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+   TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
/* SCTP_STATE_SHUTDOWN_SENT */ \
-   TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+   TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
/* SCTP_STATE_SHUTDOWN_RECEIVED */ \
-   TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
+   TYPE_SCTP_FUNC(sctp_sf_do_asconf_ack), \
/* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \
 } /* TYPE_SCTP_ASCONF_ACK */
@@ -691,11 +691,11 @@ chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
/* SCTP_STATE_ESTABLISHED */ \
TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
/* SCTP_STATE_SHUTDOWN_PENDING */ \
-   TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
+   TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
/* SCTP_STATE_SHUTDOWN_SENT */ \
-   TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
+   TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
/* SCTP_STATE_SHUTDOWN_RECEIVED */ \
-   TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
+   TYPE_SCTP_FUNC(sctp_sf_do_prm_asconf), \
/* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
TYPE_SCTP_FUNC(sctp_sf_error_shutdown), \
 } /* TYPE_SCTP_PRIMITIVE_REQUESTHEARTBEAT */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCTP]: Implement ADD-IP special case processing for ABORT chunk

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=75205f478331cc64ce729ea72d3c8c1837fb59cb
Commit: 75205f478331cc64ce729ea72d3c8c1837fb59cb
Parent: f57d96b2e92d209ab3991bba9a44e0d6ef7614a8
Author: Vlad Yasevich [EMAIL PROTECTED]
AuthorDate: Thu Dec 20 14:12:59 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:24 2008 -0800

[SCTP]: Implement ADD-IP special case processing for ABORT chunk

ADD-IP spec has a special case for processing ABORTs:
F4) ... One special consideration is that ABORT
Chunks arriving destined to the IP address being deleted MUST be
ignored (see Section 5.3.1 for further details).

Check if the address we received on is in the DEL state, and if
so, ignore the ABORT.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/sctp/structs.h |2 +
 net/sctp/bind_addr.c   |   26 ++
 net/sctp/sm_statefuns.c|   52 ---
 3 files changed, 76 insertions(+), 4 deletions(-)

diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 2528f8a..4d591bf 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1200,6 +1200,8 @@ int sctp_add_bind_addr(struct sctp_bind_addr *, union 
sctp_addr *,
 int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
 int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
 struct sctp_sock *);
+int sctp_bind_addr_state(const struct sctp_bind_addr *bp,
+const union sctp_addr *addr);
 union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr  *bp,
const union sctp_addr   *addrs,
int addrcnt,
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index 4326611..13fbfb4 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -353,6 +353,32 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp,
return match;
 }
 
+/* Get the state of the entry in the bind_addr_list */
+int sctp_bind_addr_state(const struct sctp_bind_addr *bp,
+const union sctp_addr *addr)
+{
+   struct sctp_sockaddr_entry *laddr;
+   struct sctp_af *af;
+   int state = -1;
+
+   af = sctp_get_af_specific(addr-sa.sa_family);
+   if (unlikely(!af))
+   return state;
+
+   rcu_read_lock();
+   list_for_each_entry_rcu(laddr, bp-address_list, list) {
+   if (!laddr-valid)
+   continue;
+   if (af-cmp_addr(laddr-a, addr)) {
+   state = laddr-state;
+   break;
+   }
+   }
+   rcu_read_unlock();
+
+   return state;
+}
+
 /* Find the first address in the bind address list that is not present in
  * the addrs packed array.
  */
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index a1be9d9..0c9f37e 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -143,6 +143,12 @@ static sctp_ierror_t sctp_sf_authenticate(const struct 
sctp_endpoint *ep,
const sctp_subtype_t type,
struct sctp_chunk *chunk);
 
+static sctp_disposition_t __sctp_sf_do_9_1_abort(const struct sctp_endpoint 
*ep,
+   const struct sctp_association *asoc,
+   const sctp_subtype_t type,
+   void *arg,
+   sctp_cmd_seq_t *commands);
+
 /* Small helper function that checks if the chunk length
  * is of the appropriate length.  The 'required_length' argument
  * is set to be the size of a specific chunk we are testing.
@@ -2073,11 +2079,20 @@ sctp_disposition_t sctp_sf_shutdown_pending_abort(
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_abort_chunk_t)))
return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
 
+   /* ADD-IP: Special case for ABORT chunks
+* F4)  One special consideration is that ABORT Chunks arriving
+* destined to the IP address being deleted MUST be
+* ignored (see Section 5.3.1 for further details).
+*/
+   if (SCTP_ADDR_DEL ==
+   sctp_bind_addr_state(asoc-base.bind_addr, chunk-dest))
+   return sctp_sf_discard_chunk(ep, asoc, type, arg, commands);
+
/* Stop the T5-shutdown guard timer.  */
sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD));
 
-   return sctp_sf_do_9_1_abort(ep, asoc, type, arg, commands);
+   return __sctp_sf_do_9_1_abort(ep, asoc, type, arg, commands);
 }
 
 /*
@@ -2109,6 +2124,15 @@ sctp_disposition_t 

[INET]: Uninline the inet_twsk_put function.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7054fb9376e111d0edc06efcedbac6930a6caf76
Commit: 7054fb9376e111d0edc06efcedbac6930a6caf76
Parent: 77a5ba55dab7b4ece12f37c717022819e3f77b44
Author: Pavel Emelyanov [EMAIL PROTECTED]
AuthorDate: Thu Dec 20 15:32:54 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:28 2008 -0800

[INET]: Uninline the inet_twsk_put function.

This one is not that big, but is widely used: saves 1200 bytes
from net/ipv4/built-in.o

add/remove: 1/0 grow/shrink: 1/12 up/down: 97/-1300 (-1203)
function old new   delta
inet_twsk_put  -  87 +87
__inet_lookup_listener   274 284 +10
tcp_sacktag_write_queue 22552254  -1
tcp_time_wait482 411 -71
__inet_check_established 796 722 -74
tcp_v4_err   973 898 -75
__inet_twsk_kill 230 154 -76
inet_twsk_deschedule 180 103 -77
tcp_v4_do_rcv462 384 -78
inet_hash_connect686 607 -79
inet_twdr_do_twkill_work 236 150 -86
inet_twdr_twcal_tick 395 307 -88
tcp_v4_rcv  17441480-264
tcp_timewait_state_process   975 644-331

Export it for ipv6 module.

Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/inet_timewait_sock.h |   14 +-
 net/ipv4/inet_timewait_sock.c|   15 +++
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index abaff05..67e9250 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -193,19 +193,7 @@ static inline __be32 inet_rcv_saddr(const struct sock *sk)
inet_sk(sk)-rcv_saddr : inet_twsk(sk)-tw_rcv_saddr;
 }
 
-static inline void inet_twsk_put(struct inet_timewait_sock *tw)
-{
-   if (atomic_dec_and_test(tw-tw_refcnt)) {
-   struct module *owner = tw-tw_prot-owner;
-   twsk_destructor((struct sock *)tw);
-#ifdef SOCK_REFCNT_DEBUG
-   printk(KERN_DEBUG %s timewait_sock %p released\n,
-  tw-tw_prot-name, tw);
-#endif
-   kmem_cache_free(tw-tw_prot-twsk_prot-twsk_slab, tw);
-   module_put(owner);
-   }
-}
+extern void inet_twsk_put(struct inet_timewait_sock *tw);
 
 extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
  const int state);
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index d43e787..1b7db42 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -48,6 +48,21 @@ static void __inet_twsk_kill(struct inet_timewait_sock *tw,
inet_twsk_put(tw);
 }
 
+void inet_twsk_put(struct inet_timewait_sock *tw)
+{
+   if (atomic_dec_and_test(tw-tw_refcnt)) {
+   struct module *owner = tw-tw_prot-owner;
+   twsk_destructor((struct sock *)tw);
+#ifdef SOCK_REFCNT_DEBUG
+   printk(KERN_DEBUG %s timewait_sock %p released\n,
+  tw-tw_prot-name, tw);
+#endif
+   kmem_cache_free(tw-tw_prot-twsk_prot-twsk_slab, tw);
+   module_put(owner);
+   }
+}
+EXPORT_SYMBOL_GPL(inet_twsk_put);
+
 /*
  * Enter the time wait state. This is called with locally disabled BH.
  * Essentially we whip up a timewait bucket, copy the relevant info into it
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TG3]: Replace some magic 5704S constants

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c98f6e3be1d1b9bc9299d84da4f0b1ea9a50f392
Commit: c98f6e3be1d1b9bc9299d84da4f0b1ea9a50f392
Parent: ba4d07a8483e6ec0de3194960f8aca862711454c
Author: Matt Carlson [EMAIL PROTECTED]
AuthorDate: Thu Dec 20 20:08:32 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:32 2008 -0800

[TG3]: Replace some magic 5704S constants

This patch replaces magic values with preprocessor definitions for
the sg_dig_ctrl and sg_dig_status registers.  This is preparatory work
for the next patch.

Signed-off-by: Matt Carlson [EMAIL PROTECTED]
Signed-off-by: Michael Chan [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/net/tg3.c |   23 ---
 drivers/net/tg3.h |7 +++
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 5b83a54..6575e9b 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2683,7 +2683,7 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 
mac_status)
sg_dig_ctrl = tr32(SG_DIG_CTRL);
 
if (tp-link_config.autoneg != AUTONEG_ENABLE) {
-   if (sg_dig_ctrl  (1  31)) {
+   if (sg_dig_ctrl  SG_DIG_USING_HW_AUTONEG) {
if (workaround) {
u32 val = serdes_cfg;
 
@@ -2693,7 +2693,8 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 
mac_status)
val |= 0x401;
tw32_f(MAC_SERDES_CFG, val);
}
-   tw32_f(SG_DIG_CTRL, 0x01388400);
+
+   tw32_f(SG_DIG_CTRL, SG_DIG_COMMON_SETUP);
}
if (mac_status  MAC_STATUS_PCS_SYNCED) {
tg3_setup_flow_control(tp, 0, 0);
@@ -2703,13 +2704,13 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, 
u32 mac_status)
}
 
/* Want auto-negotiation.  */
-   expected_sg_dig_ctrl = 0x81388400;
+   expected_sg_dig_ctrl = SG_DIG_USING_HW_AUTONEG | SG_DIG_COMMON_SETUP;
 
/* Pause capability */
-   expected_sg_dig_ctrl |= (1  11);
+   expected_sg_dig_ctrl |= SG_DIG_PAUSE_CAP;
 
/* Asymettric pause */
-   expected_sg_dig_ctrl |= (1  12);
+   expected_sg_dig_ctrl |= SG_DIG_ASYM_PAUSE;
 
if (sg_dig_ctrl != expected_sg_dig_ctrl) {
if ((tp-tg3_flags2  TG3_FLG2_PARALLEL_DETECT) 
@@ -2724,7 +2725,7 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 
mac_status)
 restart_autoneg:
if (workaround)
tw32_f(MAC_SERDES_CFG, serdes_cfg | 0xc011000);
-   tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl | (1  30));
+   tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl | SG_DIG_SOFT_RESET);
udelay(5);
tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl);
 
@@ -2735,22 +2736,22 @@ restart_autoneg:
sg_dig_status = tr32(SG_DIG_STATUS);
mac_status = tr32(MAC_STATUS);
 
-   if ((sg_dig_status  (1  1)) 
+   if ((sg_dig_status  SG_DIG_AUTONEG_COMPLETE) 
(mac_status  MAC_STATUS_PCS_SYNCED)) {
u32 local_adv, remote_adv;
 
local_adv = ADVERTISE_PAUSE_CAP;
remote_adv = 0;
-   if (sg_dig_status  (1  19))
+   if (sg_dig_status  SG_DIG_PARTNER_PAUSE_CAPABLE)
remote_adv |= LPA_PAUSE_CAP;
-   if (sg_dig_status  (1  20))
+   if (sg_dig_status  SG_DIG_PARTNER_ASYM_PAUSE)
remote_adv |= LPA_PAUSE_ASYM;
 
tg3_setup_flow_control(tp, local_adv, remote_adv);
current_link_up = 1;
tp-serdes_counter = 0;
tp-tg3_flags2 = ~TG3_FLG2_PARALLEL_DETECT;
-   } else if (!(sg_dig_status  (1  1))) {
+   } else if (!(sg_dig_status  SG_DIG_AUTONEG_COMPLETE)) {
if (tp-serdes_counter)
tp-serdes_counter--;
else {
@@ -2765,7 +2766,7 @@ restart_autoneg:
tw32_f(MAC_SERDES_CFG, val);
}
 
-   tw32_f(SG_DIG_CTRL, 0x01388400);
+   tw32_f(SG_DIG_CTRL, SG_DIG_COMMON_SETUP);
udelay(40);
 
/* Link parallel detection - link is up */
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index ac47c17..3938eb3 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -545,6 +545,8 @@
 #define  SG_DIG_FIBER_MODE  0x8000
 #define  

[TG3]: Update version to 3.87

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=255f97b3117cbe10b2493f7f12d66a81dfbcdf43
Commit: 255f97b3117cbe10b2493f7f12d66a81dfbcdf43
Parent: ef167e27039eeaea6d3cdd5c547b082e89840bdd
Author: Matt Carlson [EMAIL PROTECTED]
AuthorDate: Thu Dec 20 20:10:38 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:35 2008 -0800

[TG3]: Update version to 3.87

This patch updates the version number to 3.87.

Signed-off-by: Matt Carlson [EMAIL PROTECTED]
Signed-off-by: Michael Chan [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/net/tg3.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index b2f505d..a9f1640 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
 
 #define DRV_MODULE_NAMEtg3
 #define PFX DRV_MODULE_NAME: 
-#define DRV_MODULE_VERSION 3.86
-#define DRV_MODULE_RELDATE November 9, 2007
+#define DRV_MODULE_VERSION 3.87
+#define DRV_MODULE_RELDATE December 20, 2007
 
 #define TG3_DEF_MAC_MODE   0
 #define TG3_DEF_RX_MODE0
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


net/wireless/Kconfig: whitespace corrections

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d6084cb61dce1e78e7079a1756df0de71dc8599c
Commit: d6084cb61dce1e78e7079a1756df0de71dc8599c
Parent: c27f9830f367a041ca976ccd102f590d27d4deb2
Author: John W. Linville [EMAIL PROTECTED]
AuthorDate: Fri Dec 21 00:43:34 2007 -0500
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:55 2008 -0800

net/wireless/Kconfig: whitespace corrections

Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/wireless/Kconfig |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
index 6426055..7927090 100644
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -6,13 +6,13 @@ config NL80211
depends on CFG80211
default y
---help---
- This option turns on the new netlink interface
- (nl80211) support in cfg80211.
+ This option turns on the new netlink interface
+ (nl80211) support in cfg80211.
 
- If =n, drivers using mac80211 will be configured via
- wireless extension support provided by that subsystem.
+ If =n, drivers using mac80211 will be configured via
+ wireless extension support provided by that subsystem.
 
- If unsure, say Y.
+ If unsure, say Y.
 
 config WIRELESS_EXT
bool Wireless extensions
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TCP]: Convert several length variable to unsigned.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9cb5734e5b9b26097c7fa28a9c6426a204cc15e3
Commit: 9cb5734e5b9b26097c7fa28a9c6426a204cc15e3
Parent: c40896de50c73e7835b34f23bea96625edd9d6c4
Author: YOSHIFUJI Hideaki [EMAIL PROTECTED]
AuthorDate: Sat Jan 12 02:16:03 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:56 2008 -0800

[TCP]: Convert several length variable to unsigned.

Several length variables cannot be negative, so convert int to
unsigned int.  This also allows us to do sane shift operations
on those variables.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/tcp.h   |6 --
 net/ipv4/tcp_ipv4.c |6 +++---
 net/ipv6/tcp_ipv6.c |8 
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 5ec1cac..13ebe11 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1155,7 +1155,8 @@ extern int
tcp_v4_calc_md5_hash(char *md5_hash,
 struct dst_entry *dst,
 struct request_sock *req,
 struct tcphdr *th,
-int protocol, int tcplen);
+int protocol,
+unsigned int tcplen);
 extern struct tcp_md5sig_key   *tcp_v4_md5_lookup(struct sock *sk,
   struct sock *addr_sk);
 
@@ -1404,7 +1405,8 @@ struct tcp_sock_af_ops {
  struct dst_entry *dst,
  struct request_sock *req,
  struct tcphdr *th,
- int protocol, int len);
+ int protocol,
+ unsigned int len);
int (*md5_add) (struct sock *sk,
struct sock *addr_sk,
u8 *newkey,
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index fc9bdd8..9aea88b 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -99,7 +99,7 @@ static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct 
sock *sk,
 static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
   __be32 saddr, __be32 daddr,
   struct tcphdr *th, int protocol,
-  int tcplen);
+  unsigned int tcplen);
 #endif
 
 struct inet_hashinfo __cacheline_aligned tcp_hashinfo = {
@@ -1020,7 +1020,7 @@ static int tcp_v4_parse_md5_keys(struct sock *sk, char 
__user *optval,
 static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
   __be32 saddr, __be32 daddr,
   struct tcphdr *th, int protocol,
-  int tcplen)
+  unsigned int tcplen)
 {
struct scatterlist sg[4];
__u16 data_len;
@@ -1113,7 +1113,7 @@ int tcp_v4_calc_md5_hash(char *md5_hash, struct 
tcp_md5sig_key *key,
 struct dst_entry *dst,
 struct request_sock *req,
 struct tcphdr *th, int protocol,
-int tcplen)
+unsigned int tcplen)
 {
__be32 saddr, daddr;
 
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 0268e11..00c0839 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -733,7 +733,7 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct 
tcp_md5sig_key *key,
   struct in6_addr *saddr,
   struct in6_addr *daddr,
   struct tcphdr *th, int protocol,
-  int tcplen)
+  unsigned int tcplen)
 {
struct scatterlist sg[4];
__u16 data_len;
@@ -818,7 +818,7 @@ static int tcp_v6_calc_md5_hash(char *md5_hash, struct 
tcp_md5sig_key *key,
struct dst_entry *dst,
struct request_sock *req,
struct tcphdr *th, int protocol,
-   int tcplen)
+   unsigned int tcplen)
 {
struct in6_addr *saddr, *daddr;
 
@@ -985,7 +985,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct 
sk_buff *skb)
struct tcphdr *th = tcp_hdr(skb), *t1;
struct sk_buff 

[INET]: Avoid an integer divide in rt_garbage_collect()

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b790cedd24a7f7d1639072b3faf35f1f56cb38ea
Commit: b790cedd24a7f7d1639072b3faf35f1f56cb38ea
Parent: 9cb5734e5b9b26097c7fa28a9c6426a204cc15e3
Author: Eric Dumazet [EMAIL PROTECTED]
AuthorDate: Fri Dec 21 01:49:07 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:57 2008 -0800

[INET]: Avoid an integer divide in rt_garbage_collect()

Since 'goal' is a signed int, compiler may emit an integer divide
to compute goal/2.

Using a right shift is OK here and less expensive.

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/route.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1cc6c23..933b093 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -851,14 +851,14 @@ static int rt_garbage_collect(void)
equilibrium = ipv4_dst_ops.gc_thresh;
goal = atomic_read(ipv4_dst_ops.entries) - equilibrium;
if (goal  0) {
-   equilibrium += min_t(unsigned int, goal / 2, 
rt_hash_mask + 1);
+   equilibrium += min_t(unsigned int, goal  1, 
rt_hash_mask + 1);
goal = atomic_read(ipv4_dst_ops.entries) - equilibrium;
}
} else {
/* We are in dangerous area. Try to reduce cache really
 * aggressively.
 */
-   goal = max_t(unsigned int, goal / 2, rt_hash_mask + 1);
+   goal = max_t(unsigned int, goal  1, rt_hash_mask + 1);
equilibrium = atomic_read(ipv4_dst_ops.entries) - goal;
}
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TCP]: Avoid a divide in tcp_mtu_probing()

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8beb5c5f12c8484c59edf9b691f2c4bb4d31f3a0
Commit: 8beb5c5f12c8484c59edf9b691f2c4bb4d31f3a0
Parent: 829942c18704250fce4d5eca787065a3ee7c685d
Author: Eric Dumazet [EMAIL PROTECTED]
AuthorDate: Fri Dec 21 05:58:29 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:00 2008 -0800

[TCP]: Avoid a divide in tcp_mtu_probing()

tcp_mtu_to_mss() being signed, compiler might emit an integer divide
to compute tcp_mtu_to_mss()/2 .

Using a right shift is OK here and less expensive.

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/tcp_timer.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index ea111e9..ea85bc0 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -125,7 +125,7 @@ static void tcp_mtu_probing(struct inet_connection_sock 
*icsk, struct sock *sk)
struct tcp_sock *tp = tcp_sk(sk);
int mss;
 
-   mss = tcp_mtu_to_mss(sk, icsk-icsk_mtup.search_low)/2;
+   mss = tcp_mtu_to_mss(sk, icsk-icsk_mtup.search_low)  
1;
mss = min(sysctl_tcp_base_mss, mss);
mss = max(mss, 68 - tp-tcp_header_len);
icsk-icsk_mtup.search_low = tcp_mss_to_mtu(sk, mss);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SOCK] Avoid divides in sk_stream_pages() and __sk_stream_mem_reclaim()

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=21371f768bf7127ee45bfaadd17899df6a439e8f
Commit: 21371f768bf7127ee45bfaadd17899df6a439e8f
Parent: b15c4bcd15741b31019379298edfca28dc78029d
Author: Eric Dumazet [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 20:57:56 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:05 2008 -0800

[SOCK] Avoid divides in sk_stream_pages() and __sk_stream_mem_reclaim()

sk_forward_alloc being signed, we should take care of divides by
SK_STREAM_MEM_QUANTUM we do in sk_stream_pages() and
__sk_stream_mem_reclaim()

This patchs introduces SK_STREAM_MEM_QUANTUM_SHIFT, defined
as ilog2(SK_STREAM_MEM_QUANTUM), to be able to use right
shifts instead of plain divides.

This should help compiler to choose right shifts instead of
expensive divides (as seen with CONFIG_CC_OPTIMIZE_FOR_SIZE=y on x86)

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/sock.h |3 ++-
 net/core/stream.c  |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index e178b49..d27ba6f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -716,10 +716,11 @@ extern void __sk_stream_mem_reclaim(struct sock *sk);
 extern int sk_stream_mem_schedule(struct sock *sk, int size, int kind);
 
 #define SK_STREAM_MEM_QUANTUM ((int)PAGE_SIZE)
+#define SK_STREAM_MEM_QUANTUM_SHIFT ilog2(SK_STREAM_MEM_QUANTUM)
 
 static inline int sk_stream_pages(int amt)
 {
-   return DIV_ROUND_UP(amt, SK_STREAM_MEM_QUANTUM);
+   return (amt + SK_STREAM_MEM_QUANTUM - 1)  SK_STREAM_MEM_QUANTUM_SHIFT;
 }
 
 static inline void sk_stream_mem_reclaim(struct sock *sk)
diff --git a/net/core/stream.c b/net/core/stream.c
index 5586879..bf188ff 100644
--- a/net/core/stream.c
+++ b/net/core/stream.c
@@ -196,7 +196,7 @@ EXPORT_SYMBOL(sk_stream_error);
 
 void __sk_stream_mem_reclaim(struct sock *sk)
 {
-   atomic_sub(sk-sk_forward_alloc / SK_STREAM_MEM_QUANTUM,
+   atomic_sub(sk-sk_forward_alloc  SK_STREAM_MEM_QUANTUM_SHIFT,
   sk-sk_prot-memory_allocated);
sk-sk_forward_alloc = SK_STREAM_MEM_QUANTUM - 1;
if (*sk-sk_prot-memory_pressure 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[LIBERTAS]: Remove last stray user of MAC_FMT.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=15ca36fb994923b454df44e5d7aa14b84ce5aee4
Commit: 15ca36fb994923b454df44e5d7aa14b84ce5aee4
Parent: d9727bb2d516bc16bafee4216eec91cd2be5f30a
Author: David S. Miller [EMAIL PROTECTED]
AuthorDate: Thu Dec 27 16:43:38 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:08 2008 -0800

[LIBERTAS]: Remove last stray user of MAC_FMT.

Reported by Denis V. Lunev

Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/net/wireless/libertas/debugfs.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/libertas/debugfs.c 
b/drivers/net/wireless/libertas/debugfs.c
index 0bda0b5..95dd4ed 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -243,7 +243,8 @@ static void libertas_parse_bssid(char *buf, size_t count,
if (!hold)
return;
hold += 6;
-   sscanf(hold, MAC_FMT, mac, mac+1, mac+2, mac+3, mac+4, mac+5);
+   sscanf(hold, %02x:%02x:%02x:%02x:%02x:%02x,
+  mac, mac+1, mac+2, mac+3, mac+4, mac+5);
memcpy(scan_cfg-bssid, mac, ETH_ALEN);
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPSEC]: Move all calls to xfrm_audit_state_icvfail to xfrm_input

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9dd3245a2ac1834797191072705015e6a12f55bf
Commit: 9dd3245a2ac1834797191072705015e6a12f55bf
Parent: 0883ae0e5599656b5f3b0e9ce474e01dee7dfee4
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Sun Dec 30 21:10:30 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:10 2008 -0800

[IPSEC]: Move all calls to xfrm_audit_state_icvfail to xfrm_input

Let's nip the code duplication in the bud :)

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/ah4.c|4 +---
 net/ipv4/esp4.c   |1 -
 net/ipv6/ah6.c|4 +---
 net/ipv6/esp6.c   |1 -
 net/xfrm/xfrm_input.c |5 -
 5 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index ec8de0a..d76803a 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -179,10 +179,8 @@ static int ah_input(struct xfrm_state *x, struct sk_buff 
*skb)
err = ah_mac_digest(ahp, skb, ah-auth_data);
if (err)
goto unlock;
-   if (memcmp(ahp-work_icv, auth_data, ahp-icv_trunc_len)) {
-   xfrm_audit_state_icvfail(x, skb, IPPROTO_AH);
+   if (memcmp(ahp-work_icv, auth_data, ahp-icv_trunc_len))
err = -EBADMSG;
-   }
}
 unlock:
spin_unlock(x-lock);
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index b334c76..28ea5c7 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -191,7 +191,6 @@ static int esp_input(struct xfrm_state *x, struct sk_buff 
*skb)
BUG();
 
if (unlikely(memcmp(esp-auth.work_icv, sum, alen))) {
-   xfrm_audit_state_icvfail(x, skb, IPPROTO_ESP);
err = -EBADMSG;
goto unlock;
}
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 2d32772..fb0d07a 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -380,10 +380,8 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff 
*skb)
err = ah_mac_digest(ahp, skb, ah-auth_data);
if (err)
goto unlock;
-   if (memcmp(ahp-work_icv, auth_data, ahp-icv_trunc_len)) {
-   xfrm_audit_state_icvfail(x, skb, IPPROTO_AH);
+   if (memcmp(ahp-work_icv, auth_data, ahp-icv_trunc_len))
err = -EBADMSG;
-   }
}
 unlock:
spin_unlock(x-lock);
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index e10f10b..5bd5292 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -186,7 +186,6 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff 
*skb)
BUG();
 
if (unlikely(memcmp(esp-auth.work_icv, sum, alen))) {
-   xfrm_audit_state_icvfail(x, skb, IPPROTO_ESP);
ret = -EBADMSG;
goto unlock;
}
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 1b250f3..039e701 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -186,8 +186,11 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 
spi, int encap_type)
 resume:
spin_lock(x-lock);
if (nexthdr = 0) {
-   if (nexthdr == -EBADMSG)
+   if (nexthdr == -EBADMSG) {
+   xfrm_audit_state_icvfail(x, skb,
+x-type-proto);
x-stats.integrity_failed++;
+   }
XFRM_INC_STATS(LINUX_MIB_XFRMINSTATEPROTOERROR);
goto drop_unlock;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ATM]: Convert struct class_device to struct device

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ef39592f786b6d56d9faf988a3f18786eeb050b3
Commit: ef39592f786b6d56d9faf988a3f18786eeb050b3
Parent: 6fe5452b3bb53e5bf5f37590b280ee73dc1e61b6
Author: Kay Sievers [EMAIL PROTECTED]
AuthorDate: Sun Dec 30 23:16:06 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:12 2008 -0800

[ATM]: Convert struct class_device to struct device

Signed-off-by: Kay Sievers [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]
---
 include/linux/atmdev.h |4 +-
 net/atm/atm_sysfs.c|   66 ++-
 2 files changed, 38 insertions(+), 32 deletions(-)

diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 2096e5c..a3d07c2 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -359,7 +359,7 @@ struct atm_dev {
struct proc_dir_entry *proc_entry; /* proc entry */
char *proc_name;/* proc entry name */
 #endif
-   struct class_device class_dev;  /* sysfs class device */
+   struct device class_dev;/* sysfs device */
struct list_head dev_list;  /* linkage */
 };
 
@@ -461,7 +461,7 @@ static inline void atm_dev_put(struct atm_dev *dev)
BUG_ON(!test_bit(ATM_DF_REMOVED, dev-flags));
if (dev-ops-dev_close)
dev-ops-dev_close(dev);
-   class_device_put(dev-class_dev);
+   put_device(dev-class_dev);
}
 }
 
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
index 9ef07ed..1b88311 100644
--- a/net/atm/atm_sysfs.c
+++ b/net/atm/atm_sysfs.c
@@ -9,13 +9,15 @@
 
 #define to_atm_dev(cldev) container_of(cldev, struct atm_dev, class_dev)
 
-static ssize_t show_type(struct class_device *cdev, char *buf)
+static ssize_t show_type(struct device *cdev,
+struct device_attribute *attr, char *buf)
 {
struct atm_dev *adev = to_atm_dev(cdev);
return sprintf(buf, %s\n, adev-type);
 }
 
-static ssize_t show_address(struct class_device *cdev, char *buf)
+static ssize_t show_address(struct device *cdev,
+   struct device_attribute *attr, char *buf)
 {
char *pos = buf;
struct atm_dev *adev = to_atm_dev(cdev);
@@ -28,7 +30,8 @@ static ssize_t show_address(struct class_device *cdev, char 
*buf)
return pos - buf;
 }
 
-static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
+static ssize_t show_atmaddress(struct device *cdev,
+  struct device_attribute *attr, char *buf)
 {
unsigned long flags;
char *pos = buf;
@@ -54,7 +57,8 @@ static ssize_t show_atmaddress(struct class_device *cdev, 
char *buf)
return pos - buf;
 }
 
-static ssize_t show_carrier(struct class_device *cdev, char *buf)
+static ssize_t show_carrier(struct device *cdev,
+   struct device_attribute *attr, char *buf)
 {
char *pos = buf;
struct atm_dev *adev = to_atm_dev(cdev);
@@ -65,7 +69,8 @@ static ssize_t show_carrier(struct class_device *cdev, char 
*buf)
return pos - buf;
 }
 
-static ssize_t show_link_rate(struct class_device *cdev, char *buf)
+static ssize_t show_link_rate(struct device *cdev,
+ struct device_attribute *attr, char *buf)
 {
char *pos = buf;
struct atm_dev *adev = to_atm_dev(cdev);
@@ -90,22 +95,23 @@ static ssize_t show_link_rate(struct class_device *cdev, 
char *buf)
return pos - buf;
 }
 
-static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
-static CLASS_DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
-static CLASS_DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
-static CLASS_DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
-static CLASS_DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
-
-static struct class_device_attribute *atm_attrs[] = {
-   class_device_attr_atmaddress,
-   class_device_attr_address,
-   class_device_attr_carrier,
-   class_device_attr_type,
-   class_device_attr_link_rate,
+static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
+static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
+static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
+static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
+static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
+
+static struct device_attribute *atm_attrs[] = {
+   dev_attr_atmaddress,
+   dev_attr_address,
+   dev_attr_carrier,
+   dev_attr_type,
+   dev_attr_link_rate,
NULL
 };
 
-static int atm_uevent(struct class_device *cdev, struct kobj_uevent_env *env)
+
+static int atm_uevent(struct device *cdev, struct kobj_uevent_env *env)
 {
struct atm_dev *adev;
 
@@ -122,7 +128,7 @@ static int atm_uevent(struct class_device *cdev, struct 

[ETH]: Combine format_addr() with print_mac().

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7ffc49a6ee92b7138c2ee28073a8e10e58335d62
Commit: 7ffc49a6ee92b7138c2ee28073a8e10e58335d62
Parent: 21371f768bf7127ee45bfaadd17899df6a439e8f
Author: Michael Chan [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 21:28:09 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:05 2008 -0800

[ETH]: Combine format_addr() with print_mac().

print_mac() used many most net drivers and format_addr() used by
net-sysfs.c are very similar and they can be intergrated.

format_addr() is also identically redefined in the qla4xxx iscsi
driver.

Export a new function sysfs_format_mac() to be used by net-sysfs,
qla4xxx and others in the future.  Both print_mac() and
sysfs_format_mac() call _format_mac_addr() to do the formatting.

Changed print_mac() to use unsigned char * to be consistent with
net_device struct's dev_addr.  Added buffer length overrun checking
as suggested by Joe Perches.

Signed-off-by: Michael Chan [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/scsi/qla4xxx/ql4_os.c |   14 +-
 include/linux/if_ether.h  |8 +---
 net/core/net-sysfs.c  |   15 ++-
 net/ethernet/eth.c|   30 +++---
 4 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index f55b9f7..d3f8664 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -173,18 +173,6 @@ static void qla4xxx_conn_stop(struct iscsi_cls_conn *conn, 
int flag)
printk(KERN_ERR iscsi: invalid stop flag %d\n, flag);
 }
 
-static ssize_t format_addr(char *buf, const unsigned char *addr, int len)
-{
-   int i;
-   char *cp = buf;
-
-   for (i = 0; i  len; i++)
-   cp += sprintf(cp, %02x%c, addr[i],
- i == (len - 1) ? '\n' : ':');
-   return cp - buf;
-}
-
-
 static int qla4xxx_host_get_param(struct Scsi_Host *shost,
  enum iscsi_host_param param, char *buf)
 {
@@ -193,7 +181,7 @@ static int qla4xxx_host_get_param(struct Scsi_Host *shost,
 
switch (param) {
case ISCSI_HOST_PARAM_HWADDRESS:
-   len = format_addr(buf, ha-my_mac, MAC_ADDR_LEN);
+   len = sysfs_format_mac(buf, ha-my_mac, MAC_ADDR_LEN);
break;
case ISCSI_HOST_PARAM_IPADDRESS:
len = sprintf(buf, %d.%d.%d.%d\n, ha-ip_address[0],
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index cc002cb..7a1e011 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -124,12 +124,14 @@ int eth_header_parse(const struct sk_buff *skb, unsigned 
char *haddr);
 extern struct ctl_table ether_table[];
 #endif
 
+extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
+
 /*
  * Display a 6 byte device address (MAC) in a readable format.
  */
-#define MAC_FMT %02x:%02x:%02x:%02x:%02x:%02x
-extern char *print_mac(char *buf, const u8 *addr);
-#define DECLARE_MAC_BUF(var) char var[18] __maybe_unused
+extern char *print_mac(char *buf, const unsigned char *addr);
+#define MAC_BUF_SIZE   18
+#define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused
 
 #endif
 
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index e41f4b9..7635d3f 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -95,17 +95,6 @@ NETDEVICE_SHOW(type, fmt_dec);
 NETDEVICE_SHOW(link_mode, fmt_dec);
 
 /* use same locking rules as GIFHWADDR ioctl's */
-static ssize_t format_addr(char *buf, const unsigned char *addr, int len)
-{
-   int i;
-   char *cp = buf;
-
-   for (i = 0; i  len; i++)
-   cp += sprintf(cp, %02x%c, addr[i],
- i == (len - 1) ? '\n' : ':');
-   return cp - buf;
-}
-
 static ssize_t show_address(struct device *dev, struct device_attribute *attr,
char *buf)
 {
@@ -114,7 +103,7 @@ static ssize_t show_address(struct device *dev, struct 
device_attribute *attr,
 
read_lock(dev_base_lock);
if (dev_isalive(net))
-   ret = format_addr(buf, net-dev_addr, net-addr_len);
+   ret = sysfs_format_mac(buf, net-dev_addr, net-addr_len);
read_unlock(dev_base_lock);
return ret;
 }
@@ -124,7 +113,7 @@ static ssize_t show_broadcast(struct device *dev,
 {
struct net_device *net = to_net_dev(dev);
if (dev_isalive(net))
-   return format_addr(buf, net-broadcast, net-addr_len);
+   return sysfs_format_mac(buf, net-broadcast, net-addr_len);
return -EINVAL;
 }
 
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 6b2e454..a7b4175 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -359,10 +359,34 @@ struct net_device 

[IPV6]: Remove useless code from fib6_del_route().

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a06b494b61de44617dd58612164bdde56fca7bfb
Commit: a06b494b61de44617dd58612164bdde56fca7bfb
Parent: f624357959001c9156ee7a475283fc6041f78e0e
Author: Gui Jianfeng [EMAIL PROTECTED]
AuthorDate: Sun Dec 30 23:27:10 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:17 2008 -0800

[IPV6]: Remove useless code from fib6_del_route().

There are useless codes in fib6_del_route(). The following patch has
been tested, every thing looks fine, as usual.

Signed-off-by: Gui Jianfeng [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv6/ip6_fib.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index df05c6f..7165a5e 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1126,9 +1126,6 @@ static void fib6_del_route(struct fib6_node *fn, struct 
rt6_info **rtp,
 
rt-u.dst.rt6_next = NULL;
 
-   if (fn-leaf == NULL  fn-fn_flagsRTN_TL_ROOT)
-   fn-leaf = ip6_null_entry;
-
/* If it was last route, expunge its radix tree node */
if (fn-leaf == NULL) {
fn-fn_flags = ~RTN_RTINFO;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NEIGH]: Remove unused method from include/net/neighbour.h

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f624357959001c9156ee7a475283fc6041f78e0e
Commit: f624357959001c9156ee7a475283fc6041f78e0e
Parent: 04ce99c4839a86f4ef476f811cced8d1f11999e4
Author: Rami Rosen [EMAIL PROTECTED]
AuthorDate: Sun Dec 30 23:25:31 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:17 2008 -0800

[NEIGH]: Remove unused method from include/net/neighbour.h

Signed-off-by: Rami Rosen [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/neighbour.h |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 11590f2..a9dda29 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -292,10 +292,6 @@ static inline int neigh_is_connected(struct neighbour 
*neigh)
return neigh-nud_stateNUD_CONNECTED;
 }
 
-static inline int neigh_is_valid(struct neighbour *neigh)
-{
-   return neigh-nud_stateNUD_VALID;
-}
 
 static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff 
*skb)
 {
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV4]: Remove unused multipath cached routing defintion in net/flow.h

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=61f1ab41b8ede8e2a26c349a4e3372100545c5ec
Commit: 61f1ab41b8ede8e2a26c349a4e3372100545c5ec
Parent: 95766fff6b9a78d11fc2d3812dd035381690b55d
Author: Rami Rosen [EMAIL PROTECTED]
AuthorDate: Mon Dec 31 04:22:09 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:20 2008 -0800

[IPV4]: Remove unused multipath cached routing defintion in net/flow.h

Signed-off-by: Rami Rosen [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/flow.h |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/include/net/flow.h b/include/net/flow.h
index af59fa5..ad16e00 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -48,7 +48,6 @@ struct flowi {
 
__u8proto;
__u8flags;
-#define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01
union {
struct {
__be16  sport;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TCP]: Rename update_send_head include related increment to it

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=66f5fe624fa5f1d4574d2dd2bc0c72a17a92079c
Commit: 66f5fe624fa5f1d4574d2dd2bc0c72a17a92079c
Parent: 3ccd3130b3f681a4aef6392327256786b3b6aa04
Author: Ilpo Järvinen [EMAIL PROTECTED]
AuthorDate: Mon Dec 31 04:43:57 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:21 2008 -0800

[TCP]: Rename update_send_head  include related increment to it

There's very little need to have the packets_out incrementing in
a separate function. Also name the combined function
appropriately.

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/tcp_output.c |   32 
 1 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 7a4834a..1ca638b 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -61,29 +61,22 @@ int sysctl_tcp_base_mss __read_mostly = 512;
 /* By default, RFC2861 behavior.  */
 int sysctl_tcp_slow_start_after_idle __read_mostly = 1;
 
-static inline void tcp_packets_out_inc(struct sock *sk,
-  const struct sk_buff *skb)
-{
-   struct tcp_sock *tp = tcp_sk(sk);
-   int orig = tp-packets_out;
-
-   tp-packets_out += tcp_skb_pcount(skb);
-   if (!orig)
-   inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
- inet_csk(sk)-icsk_rto, TCP_RTO_MAX);
-}
-
-static void update_send_head(struct sock *sk, struct sk_buff *skb)
+static void tcp_event_new_data_sent(struct sock *sk, struct sk_buff *skb)
 {
struct tcp_sock *tp = tcp_sk(sk);
+   unsigned int prior_packets = tp-packets_out;
 
tcp_advance_send_head(sk, skb);
tp-snd_nxt = TCP_SKB_CB(skb)-end_seq;
-   tcp_packets_out_inc(sk, skb);
 
/* Don't override Nagle indefinately with F-RTO */
if (tp-frto_counter == 2)
tp-frto_counter = 3;
+
+   tp-packets_out += tcp_skb_pcount(skb);
+   if (!prior_packets)
+   inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
+ inet_csk(sk)-icsk_rto, TCP_RTO_MAX);
 }
 
 /* SND.NXT, if window was not shrunk.
@@ -1410,7 +1403,7 @@ static int tcp_mtu_probe(struct sock *sk)
/* Decrement cwnd here because we are sending
* effectively two packets. */
tp-snd_cwnd--;
-   update_send_head(sk, nskb);
+   tcp_event_new_data_sent(sk, nskb);
 
icsk-icsk_mtup.probe_size = tcp_mss_to_mtu(sk, nskb-len);
tp-mtu_probe.probe_seq_start = TCP_SKB_CB(nskb)-seq;
@@ -1494,7 +1487,7 @@ static int tcp_write_xmit(struct sock *sk, unsigned int 
mss_now, int nonagle)
/* Advance the send_head.  This one is sent out.
 * This call will increment packets_out.
 */
-   update_send_head(sk, skb);
+   tcp_event_new_data_sent(sk, skb);
 
tcp_minshall_update(tp, mss_now, skb);
sent_pkts++;
@@ -1553,7 +1546,7 @@ void tcp_push_one(struct sock *sk, unsigned int mss_now)
TCP_SKB_CB(skb)-when = tcp_time_stamp;
 
if (likely(!tcp_transmit_skb(sk, skb, 1, sk-sk_allocation))) {
-   update_send_head(sk, skb);
+   tcp_event_new_data_sent(sk, skb);
tcp_cwnd_validate(sk);
return;
}
@@ -2528,9 +2521,8 @@ int tcp_write_wakeup(struct sock *sk)
TCP_SKB_CB(skb)-flags |= TCPCB_FLAG_PSH;
TCP_SKB_CB(skb)-when = tcp_time_stamp;
err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC);
-   if (!err) {
-   update_send_head(sk, skb);
-   }
+   if (!err)
+   tcp_event_new_data_sent(sk, skb);
return err;
} else {
if (tp-urg_mode 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TCP]: Remove TCPCB_URG TCPCB_AT_TAIL as unnecessary

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4828e7f49a402930e8b3e72de695c8d37e0f98ee
Commit: 4828e7f49a402930e8b3e72de695c8d37e0f98ee
Parent: cadbd0313bc897f5917d013174cdf9077edf4aa5
Author: Ilpo Järvinen [EMAIL PROTECTED]
AuthorDate: Mon Dec 31 04:50:19 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:23 2008 -0800

[TCP]: Remove TCPCB_URG  TCPCB_AT_TAIL as unnecessary

The snd_up check should be enough. I suspect this has been
there to provide a minor optimization in clean_rtx_queue which
used to have a small if (!-sacked) block which could skip
snd_up check among the other work.

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/tcp.h |4 
 net/ipv4/tcp.c|1 -
 net/ipv4/tcp_input.c  |3 +--
 net/ipv4/tcp_output.c |7 +++
 4 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 6a732d4..48081ad 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -578,10 +578,6 @@ struct tcp_skb_cb {
 #define TCPCB_EVER_RETRANS 0x80/* Ever retransmitted frame */
 #define TCPCB_RETRANS  (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS)
 
-#define TCPCB_URG  0x20/* Urgent pointer advanced here */
-
-#define TCPCB_AT_TAIL  (TCPCB_URG)
-
__u16   urg_ptr;/* Valid w/URG flags is set.*/
__u32   ack_seq;/* Sequence number ACK'd*/
 };
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2cbfa6d..34085e3 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -497,7 +497,6 @@ static inline void tcp_mark_urg(struct tcp_sock *tp, int 
flags,
if (flags  MSG_OOB) {
tp-urg_mode = 1;
tp-snd_up = tp-write_seq;
-   TCP_SKB_CB(skb)-sacked |= TCPCB_URG;
}
 }
 
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 7bac1fa..1e7fd81 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2821,8 +2821,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int 
prior_fackets)
if (sacked  TCPCB_LOST)
tp-lost_out -= acked_pcount;
 
-   if (unlikely((sacked  TCPCB_URG)  tp-urg_mode 
-!before(end_seq, tp-snd_up)))
+   if (unlikely(tp-urg_mode  !before(end_seq, tp-snd_up)))
tp-urg_mode = 0;
 
tp-packets_out -= acked_pcount;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 821fae2..cd21528 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -711,7 +711,6 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 
len, unsigned int mss
TCP_SKB_CB(skb)-flags = flags  ~(TCPCB_FLAG_FIN|TCPCB_FLAG_PSH);
TCP_SKB_CB(buff)-flags = flags;
TCP_SKB_CB(buff)-sacked = TCP_SKB_CB(skb)-sacked;
-   TCP_SKB_CB(skb)-sacked = ~TCPCB_AT_TAIL;
 
if (!skb_shinfo(skb)-nr_frags  skb-ip_summed != CHECKSUM_PARTIAL) {
/* Copy and checksum data tail into the new buffer. */
@@ -1726,7 +1725,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, 
struct sk_buff *skb, int m
/* All done, get rid of second SKB and account for it so
 * packet counting does not break.
 */
-   TCP_SKB_CB(skb)-sacked |= 
TCP_SKB_CB(next_skb)-sacked(TCPCB_EVER_RETRANS|TCPCB_AT_TAIL);
+   TCP_SKB_CB(skb)-sacked |= TCP_SKB_CB(next_skb)-sacked  
TCPCB_EVER_RETRANS;
if (TCP_SKB_CB(next_skb)-sackedTCPCB_SACKED_RETRANS)
tp-retrans_out -= tcp_skb_pcount(next_skb);
if (TCP_SKB_CB(next_skb)-sackedTCPCB_LOST)
@@ -2475,7 +2474,7 @@ static int tcp_xmit_probe_skb(struct sock *sk, int urgent)
skb_reserve(skb, MAX_TCP_HEADER);
skb-csum = 0;
TCP_SKB_CB(skb)-flags = TCPCB_FLAG_ACK;
-   TCP_SKB_CB(skb)-sacked = urgent;
+   TCP_SKB_CB(skb)-sacked = 0;
skb_shinfo(skb)-gso_segs = 1;
skb_shinfo(skb)-gso_size = 0;
skb_shinfo(skb)-gso_type = 0;
@@ -2527,7 +2526,7 @@ int tcp_write_wakeup(struct sock *sk)
} else {
if (tp-urg_mode 
between(tp-snd_up, tp-snd_una+1, 
tp-snd_una+0x))
-   tcp_xmit_probe_skb(sk, TCPCB_URG);
+   tcp_xmit_probe_skb(sk, 1);
return tcp_xmit_probe_skb(sk, 0);
}
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TCP]: Remove unnecessary local variable

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d436d68630a74ba3c898ff1b53591ddc4eb7f2bf
Commit: d436d68630a74ba3c898ff1b53591ddc4eb7f2bf
Parent: 409d22b470532cb92b91b9aeb7257357a176b849
Author: Ilpo Järvinen [EMAIL PROTECTED]
AuthorDate: Mon Dec 31 14:58:00 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:26 2008 -0800

[TCP]: Remove unnecessary local variable

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/tcp_output.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index b3110fc..f6d279a 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -995,9 +995,8 @@ unsigned int tcp_current_mss(struct sock *sk, int 
large_allowed)
 static void tcp_cwnd_validate(struct sock *sk)
 {
struct tcp_sock *tp = tcp_sk(sk);
-   __u32 packets_out = tp-packets_out;
 
-   if (packets_out = tp-snd_cwnd) {
+   if (tp-packets_out = tp-snd_cwnd) {
/* Network is feed fully. */
tp-snd_cwnd_used = 0;
tp-snd_cwnd_stamp = tcp_time_stamp;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TCP]: Urgent parameter effect can be simplified.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=19773b4923ed0e21e3289361dba5e69e1ce6e00b
Commit: 19773b4923ed0e21e3289361dba5e69e1ce6e00b
Parent: f038ac8f9b9735358ef410d45f4cff1da810c1cb
Author: Ilpo Järvinen [EMAIL PROTECTED]
AuthorDate: Thu Jan 3 20:38:05 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:33 2008 -0800

[TCP]: Urgent parameter effect can be simplified.

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/tcp_output.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f6d279a..6c7cd0a 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2488,7 +2488,7 @@ static int tcp_xmit_probe_skb(struct sock *sk, int urgent)
 * end to send an ack.  Don't queue or clone SKB, just
 * send it.
 */
-   TCP_SKB_CB(skb)-seq = urgent ? tp-snd_una : tp-snd_una - 1;
+   TCP_SKB_CB(skb)-seq = tp-snd_una - !urgent;
TCP_SKB_CB(skb)-end_seq = TCP_SKB_CB(skb)-seq;
TCP_SKB_CB(skb)-when = tcp_time_stamp;
return tcp_transmit_skb(sk, skb, 0, GFP_ATOMIC);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CONNECTOR]: clean up {,__}cn_rx_skb()

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=00f5e06c032507206c4ac0c846ad82b75ae7665b
Commit: 00f5e06c032507206c4ac0c846ad82b75ae7665b
Parent: fd00eeccd92b7b4b5ca95bd988c195efb4e5ec29
Author: Li Zefan [EMAIL PROTECTED]
AuthorDate: Fri Jan 4 01:55:01 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:38 2008 -0800

[CONNECTOR]: clean up {,__}cn_rx_skb()

- __cn_rx_skb() does nothing but calls cn_call_callback(), it doesn't
check skb and msg sizes as the comment suggests, but cn_rx_skb() checks
those sizes.

- In cn_rx_skb() Local variable 'len' is not used. 'len' is probably
intended to be passed to skb_pull(), but here skb_pull() is not needed,
instead skb_free() is called.

Signed-off-by: Li Zefan [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/connector/connector.c |   30 --
 1 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index edf1349..37976dc 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -182,33 +182,14 @@ static int cn_call_callback(struct cn_msg *msg, void 
(*destruct_data)(void *), v
 }
 
 /*
- * Skb receive helper - checks skb and msg size and calls callback
- * helper.
- */
-static int __cn_rx_skb(struct sk_buff *skb, struct nlmsghdr *nlh)
-{
-   u32 pid, uid, seq, group;
-   struct cn_msg *msg;
-
-   pid = NETLINK_CREDS(skb)-pid;
-   uid = NETLINK_CREDS(skb)-uid;
-   seq = nlh-nlmsg_seq;
-   group = NETLINK_CB((skb)).dst_group;
-   msg = NLMSG_DATA(nlh);
-
-   return cn_call_callback(msg, (void (*)(void *))kfree_skb, skb);
-}
-
-/*
  * Main netlink receiving function.
  *
- * It checks skb and netlink header sizes and calls the skb receive
- * helper with a shared skb.
+ * It checks skb, netlink header and msg sizes, and calls callback helper.
  */
 static void cn_rx_skb(struct sk_buff *__skb)
 {
+   struct cn_msg *msg;
struct nlmsghdr *nlh;
-   u32 len;
int err;
struct sk_buff *skb;
 
@@ -224,11 +205,8 @@ static void cn_rx_skb(struct sk_buff *__skb)
return;
}
 
-   len = NLMSG_ALIGN(nlh-nlmsg_len);
-   if (len  skb-len)
-   len = skb-len;
-
-   err = __cn_rx_skb(skb, nlh);
+   msg = NLMSG_DATA(nlh);
+   err = cn_call_callback(msg, (void (*)(void *))kfree_skb, skb);
if (err  0)
kfree_skb(skb);
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CONNECTOR]: Cleanup struct cn_queue_dev

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=96a899655e2c3ba53f083eda69706ee4eb05271f
Commit: 96a899655e2c3ba53f083eda69706ee4eb05271f
Parent: 00f5e06c032507206c4ac0c846ad82b75ae7665b
Author: Li Zefan [EMAIL PROTECTED]
AuthorDate: Fri Jan 4 01:59:20 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:39 2008 -0800

[CONNECTOR]: Cleanup struct cn_queue_dev

Struct member netlink_groups is never used, and I don't see how it can
be useful.

Signed-off-by: Li Zefan [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/connector/cn_queue.c |1 -
 include/linux/connector.h|1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index 12ceed5..dbda08c 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -146,7 +146,6 @@ struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct 
sock *nls)
spin_lock_init(dev-queue_lock);
 
dev-nls = nls;
-   dev-netlink_groups = 0;
 
dev-cn_queue = create_workqueue(dev-name);
if (!dev-cn_queue) {
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 13fc454..7e18311 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -112,7 +112,6 @@ struct cn_queue_dev {
struct list_head queue_list;
spinlock_t queue_lock;
 
-   int netlink_groups;
struct sock *nls;
 };
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETNS]: Should build with CONFIG_SYSCTL=n

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2a75de0c1de2dde9ef41aeb45a21048681421b8a
Commit: 2a75de0c1de2dde9ef41aeb45a21048681421b8a
Parent: 6e32814bc89e7103e2b75b841155faf51f60a8f1
Author: Eric Dumazet [EMAIL PROTECTED]
AuthorDate: Sat Jan 5 23:08:49 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:40 2008 -0800

[NETNS]: Should build with CONFIG_SYSCTL=n

Previous NETNS patches broke CONFIG_SYSCTL=n case

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/netns/ipv4.h |2 ++
 net/ipv4/devinet.c   |   17 ++---
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index e06d7cf..61a28ff 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -8,7 +8,9 @@ struct ctl_table_header;
 struct ipv4_devconf;
 
 struct netns_ipv4 {
+#ifdef CONFIG_SYSCTL
struct ctl_table_header *forw_hdr;
+#endif
struct ipv4_devconf *devconf_all;
struct ipv4_devconf *devconf_dflt;
 };
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 44cb252..03db15b 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1542,7 +1542,6 @@ static void devinet_sysctl_unregister(struct in_device 
*idev)
__devinet_sysctl_unregister(idev-cnf);
neigh_sysctl_unregister(idev-arp_parms);
 }
-#endif
 
 static struct ctl_table ctl_forward_entry[] = {
{
@@ -1565,18 +1564,20 @@ static __net_initdata struct ctl_path net_ipv4_path[] = 
{
{ .procname = ipv4, .ctl_name = NET_IPV4, },
{ },
 };
+#endif
 
 static __net_init int devinet_init_net(struct net *net)
 {
int err;
-   struct ctl_table *tbl;
struct ipv4_devconf *all, *dflt;
+#ifdef CONFIG_SYSCTL
+   struct ctl_table *tbl = ctl_forward_entry;
struct ctl_table_header *forw_hdr;
+#endif
 
err = -ENOMEM;
all = ipv4_devconf;
dflt = ipv4_devconf_dflt;
-   tbl = ctl_forward_entry;
 
if (net != init_net) {
all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
@@ -1587,6 +1588,7 @@ static __net_init int devinet_init_net(struct net *net)
if (dflt == NULL)
goto err_alloc_dflt;
 
+#ifdef CONFIG_SYSCTL
tbl = kmemdup(tbl, sizeof(ctl_forward_entry), GFP_KERNEL);
if (tbl == NULL)
goto err_alloc_ctl;
@@ -1594,6 +1596,7 @@ static __net_init int devinet_init_net(struct net *net)
tbl[0].data = all-data[NET_IPV4_CONF_FORWARDING - 1];
tbl[0].extra1 = all;
tbl[0].extra2 = net;
+#endif
}
 
 #ifdef CONFIG_SYSCTL
@@ -1611,9 +1614,9 @@ static __net_init int devinet_init_net(struct net *net)
forw_hdr = register_net_sysctl_table(net, net_ipv4_path, tbl);
if (forw_hdr == NULL)
goto err_reg_ctl;
+   net-ipv4.forw_hdr = forw_hdr;
 #endif
 
-   net-ipv4.forw_hdr = forw_hdr;
net-ipv4.devconf_all = all;
net-ipv4.devconf_dflt = dflt;
return 0;
@@ -1626,8 +1629,8 @@ err_reg_dflt:
 err_reg_all:
if (tbl != ctl_forward_entry)
kfree(tbl);
-#endif
 err_alloc_ctl:
+#endif
if (dflt != ipv4_devconf_dflt)
kfree(dflt);
 err_alloc_dflt:
@@ -1639,15 +1642,15 @@ err_alloc_all:
 
 static __net_exit void devinet_exit_net(struct net *net)
 {
+#ifdef CONFIG_SYSCTL
struct ctl_table *tbl;
 
tbl = net-ipv4.forw_hdr-ctl_table_arg;
-#ifdef CONFIG_SYSCTL
unregister_net_sysctl_table(net-ipv4.forw_hdr);
__devinet_sysctl_unregister(net-ipv4.devconf_dflt);
__devinet_sysctl_unregister(net-ipv4.devconf_all);
-#endif
kfree(tbl);
+#endif
kfree(net-ipv4.devconf_dflt);
kfree(net-ipv4.devconf_all);
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[CCID3]: Kill some bloat

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c4e18dade1f878db33ed38927de22e63d550970d
Commit: c4e18dade1f878db33ed38927de22e63d550970d
Parent: cf35f43e6e41b160d8dedd80a127210fd3be9ada
Author: Ilpo Järvinen [EMAIL PROTECTED]
AuthorDate: Sat Jan 5 23:13:58 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:44 2008 -0800

[CCID3]: Kill some bloat

Without a number of CONFIG.*DEBUG:

net/dccp/ccids/ccid3.c:
  ccid3_hc_tx_update_x  | -170
  ccid3_hc_tx_packet_sent   | -175
  ccid3_hc_tx_packet_recv   | -169
  ccid3_hc_tx_no_feedback_timer | -192
  ccid3_hc_tx_send_packet   | -144
 5 functions changed, 850 bytes removed, diff: -850

net/dccp/ccids/ccid3.c:
  ccid3_update_send_interval | +191
 1 function changed, 191 bytes added, diff: +191

net/dccp/ccids/ccid3.o:
 6 functions changed, 191 bytes added, 850 bytes removed, diff: -659

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/dccp/ccids/ccid3.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index d292f23..e76f460 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -97,7 +97,7 @@ static inline u64 rfc3390_initial_rate(struct sock *sk)
 /*
  * Recalculate t_ipi and delta (should be called whenever X changes)
  */
-static inline void ccid3_update_send_interval(struct ccid3_hc_tx_sock *hctx)
+static void ccid3_update_send_interval(struct ccid3_hc_tx_sock *hctx)
 {
/* Calculate new t_ipi = s / X_inst (X_inst is in 64 * bytes/second) */
hctx-ccid3hctx_t_ipi = scaled_div32(((u64)hctx-ccid3hctx_s)  6,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET]: Remove obsolete comment

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a067d9ac39cd207b5a0994c73199a56e7d5a17a3
Commit: a067d9ac39cd207b5a0994c73199a56e7d5a17a3
Parent: c4e18dade1f878db33ed38927de22e63d550970d
Author: Ilpo Järvinen [EMAIL PROTECTED]
AuthorDate: Sat Jan 5 23:17:49 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:45 2008 -0800

[NET]: Remove obsolete comment

It seems that ip_build_xmit is no longer used in here and
ip_append_data is used.

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/ip_output.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 6dd1d9c..8950d18 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1341,8 +1341,6 @@ static int ip_reply_glue_bits(void *dptr, char *to, int 
offset,
  *
  * Should run single threaded per socket because it uses the sock
  * structure to pass arguments.
- *
- * LATER: switch from ip_build_xmit to ip_append_*
  */
 void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg 
*arg,
   unsigned int len)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


rc80211-pid: export human-readable target_pf value to debugfs

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=426706c0791904766e10bef512d86786f2f62857
Commit: 426706c0791904766e10bef512d86786f2f62857
Parent: 69f817b654d683265118188bbfb8bc0d8978cce6
Author: Stefano Brivio [EMAIL PROTECTED]
AuthorDate: Sun Dec 23 04:39:17 2007 +0100
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:50 2008 -0800

rc80211-pid: export human-readable target_pf value to debugfs

Export the non-shifted target_pf value to debugfs, so that it's 
human-readable.

Signed-off-by: Stefano Brivio [EMAIL PROTECTED]
Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/mac80211/rc80211_pid.h  |2 +-
 net/mac80211/rc80211_pid_algo.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/rc80211_pid.h b/net/mac80211/rc80211_pid.h
index 425eb70..81aa4ea 100644
--- a/net/mac80211/rc80211_pid.h
+++ b/net/mac80211/rc80211_pid.h
@@ -38,7 +38,7 @@
  * link quality is good, the controller will fail to adjust failed frames
  * percentage to the target. This is intentional.
  */
-#define RC_PID_TARGET_PF (11  RC_PID_ARITH_SHIFT)
+#define RC_PID_TARGET_PF 11
 
 /* Rate behaviour normalization quantity over time. */
 #define RC_PID_NORM_OFFSET 3
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index 631e468..b84e514 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -210,7 +210,7 @@ static void rate_control_pid_sample(struct rc_pid_info 
*pinfo,
rate_control_pid_normalize(pinfo, mode-num_rates);
 
/* Compute the proportional, integral and derivative errors. */
-   err_prop = pinfo-target - pf;
+   err_prop = (pinfo-target  RC_PID_ARITH_SHIFT) - pf;
 
err_avg = spinfo-err_avg_sc  pinfo-smoothing_shift;
spinfo-err_avg_sc = spinfo-err_avg_sc - err_avg + err_prop;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


mac80211: restructure __ieee80211_rx

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6368e4b18d5c71c73eecd96d568e726b80e5bce1
Commit: 6368e4b18d5c71c73eecd96d568e726b80e5bce1
Parent: f704662fb7cd81bfdc441207e788860ae4685e95
Author: Ron Rindjunsky [EMAIL PROTECTED]
AuthorDate: Mon Dec 24 13:36:39 2007 +0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:57 2008 -0800

mac80211: restructure __ieee80211_rx

This patch makes a separation between Rx frame pre-handling which stays in
__ieee80211_rx and Rx frame handlers, moving to 
__ieee80211_rx_handle_packet.
Although this separation has no affect in regular mode of operation, this 
kind
of mechanism will be used in A-MPDU frames reordering as it allows 
accumulation
of frames during pre-handling, dispatching them to later handling when 
necessary.

Signed-off-by: Ron Rindjunsky [EMAIL PROTECTED]
Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/mac80211/rx.c |   86 ++--
 1 files changed, 50 insertions(+), 36 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 306e6fc..a58a94b 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -288,11 +288,11 @@ ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx)
return TXRX_CONTINUE;
 }
 
-static ieee80211_txrx_result
-ieee80211_rx_h_load_stats(struct ieee80211_txrx_data *rx)
+
+u32 ieee80211_rx_load_stats(struct ieee80211_local *local,
+ struct sk_buff *skb,
+ struct ieee80211_rx_status *status)
 {
-   struct ieee80211_local *local = rx-local;
-   struct sk_buff *skb = rx-skb;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb-data;
u32 load = 0, hdrtime;
struct ieee80211_rate *rate;
@@ -306,7 +306,7 @@ ieee80211_rx_h_load_stats(struct ieee80211_txrx_data *rx)
 
rate = mode-rates[0];
for (i = 0; i  mode-num_rates; i++) {
-   if (mode-rates[i].val == rx-u.rx.status-rate) {
+   if (mode-rates[i].val == status-rate) {
rate = mode-rates[i];
break;
}
@@ -331,15 +331,13 @@ ieee80211_rx_h_load_stats(struct ieee80211_txrx_data *rx)
/* Divide channel_use by 8 to avoid wrapping around the counter */
load = CHAN_UTIL_SHIFT;
local-channel_use_raw += load;
-   rx-u.rx.load = load;
 
-   return TXRX_CONTINUE;
+   return load;
 }
 
 ieee80211_rx_handler ieee80211_rx_pre_handlers[] =
 {
ieee80211_rx_h_parse_qos,
-   ieee80211_rx_h_load_stats,
NULL
 };
 
@@ -1613,11 +1611,11 @@ static int prepare_for_handlers(struct 
ieee80211_sub_if_data *sdata,
 }
 
 /*
- * This is the receive path handler. It is called by a low level driver when an
- * 802.11 MPDU is received from the hardware.
+ * This is the actual Rx frames handler. as it blongs to Rx path it must
+ * be called with rcu_read_lock protection.
  */
-void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
-   struct ieee80211_rx_status *status)
+void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, struct sk_buff *skb,
+   struct ieee80211_rx_status *status, u32 load)
 {
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_sub_if_data *sdata;
@@ -1625,37 +1623,19 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct 
sk_buff *skb,
struct ieee80211_hdr *hdr;
struct ieee80211_txrx_data rx;
u16 type;
-   int prepres;
+   int prepares;
struct ieee80211_sub_if_data *prev = NULL;
struct sk_buff *skb_new;
u8 *bssid;
int hdrlen;
 
-   /*
-* key references and virtual interfaces are protected using RCU
-* and this requires that we are in a read-side RCU section during
-* receive processing
-*/
-   rcu_read_lock();
-
-   /*
-* Frames with failed FCS/PLCP checksum are not returned,
-* all other frames are returned without radiotap header
-* if it was previously present.
-* Also, frames with less than 16 bytes are dropped.
-*/
-   skb = ieee80211_rx_monitor(local, skb, status);
-   if (!skb) {
-   rcu_read_unlock();
-   return;
-   }
-
hdr = (struct ieee80211_hdr *) skb-data;
memset(rx, 0, sizeof(rx));
rx.skb = skb;
rx.local = local;
 
rx.u.rx.status = status;
+   rx.u.rx.load = load;
rx.fc = le16_to_cpu(hdr-frame_control);
type = rx.fc  IEEE80211_FCTL_FTYPE;
 
@@ -1714,11 +1694,11 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct 
sk_buff *skb,
continue;
 
rx.flags |= IEEE80211_TXRXD_RXRA_MATCH;
-   prepres = prepare_for_handlers(sdata, 

[TCP]: Perform setting of common control fields in one place

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e870a8efcddaaa3da7e180b6ae21239fb96aa2bb
Commit: e870a8efcddaaa3da7e180b6ae21239fb96aa2bb
Parent: 19773b4923ed0e21e3289361dba5e69e1ce6e00b
Author: Ilpo Järvinen [EMAIL PROTECTED]
AuthorDate: Thu Jan 3 20:39:01 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:34 2008 -0800

[TCP]: Perform setting of common control fields in one place

In case of segments which are purely for control without any
data (SYN/ACK/FIN/RST), many fields are set to common values
in multiple places.

i386 results:

$ gcc --version
gcc (GCC) 4.1.2 20070626 (Red Hat 4.1.2-13)

$ codiff tcp_output.o.old tcp_output.o.new
net/ipv4/tcp_output.c:
  tcp_xmit_probe_skb|  -48
  tcp_send_ack  |  -56
  tcp_retransmit_skb|  -79
  tcp_connect   |  -43
  tcp_send_active_reset |  -35
  tcp_make_synack   |  -42
  tcp_send_fin  |  -48
 7 functions changed, 351 bytes removed

net/ipv4/tcp_output.c:
  tcp_init_nondata_skb |  +90
 1 function changed, 90 bytes added

tcp_output.o.mid:
 8 functions changed, 90 bytes added, 351 bytes removed, diff: -261

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/tcp_output.c |   91 +++-
 1 files changed, 36 insertions(+), 55 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 6c7cd0a..89f0188 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -327,6 +327,26 @@ static inline void TCP_ECN_send(struct sock *sk, struct 
sk_buff *skb,
}
 }
 
+/* Constructs common control bits of non-data skb. If SYN/FIN is present,
+ * auto increment end seqno.
+ */
+static void tcp_init_nondata_skb(struct sk_buff *skb, u32 seq, u8 flags)
+{
+   skb-csum = 0;
+
+   TCP_SKB_CB(skb)-flags = flags;
+   TCP_SKB_CB(skb)-sacked = 0;
+
+   skb_shinfo(skb)-gso_segs = 1;
+   skb_shinfo(skb)-gso_size = 0;
+   skb_shinfo(skb)-gso_type = 0;
+
+   TCP_SKB_CB(skb)-seq = seq;
+   if (flags  (TCPCB_FLAG_SYN | TCPCB_FLAG_FIN))
+   seq++;
+   TCP_SKB_CB(skb)-end_seq = seq;
+}
+
 static void tcp_build_and_update_options(__be32 *ptr, struct tcp_sock *tp,
 __u32 tstamp, __u8 **md5_hash)
 {
@@ -1864,12 +1884,10 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff 
*skb)
(TCP_SKB_CB(skb)-flags  TCPCB_FLAG_FIN) 
tp-snd_una == (TCP_SKB_CB(skb)-end_seq - 1)) {
if (!pskb_trim(skb, 0)) {
-   TCP_SKB_CB(skb)-seq = TCP_SKB_CB(skb)-end_seq - 1;
-   skb_shinfo(skb)-gso_segs = 1;
-   skb_shinfo(skb)-gso_size = 0;
-   skb_shinfo(skb)-gso_type = 0;
+   /* Reuse, even though it does some unnecessary work */
+   tcp_init_nondata_skb(skb, TCP_SKB_CB(skb)-end_seq - 1,
+TCP_SKB_CB(skb)-flags);
skb-ip_summed = CHECKSUM_NONE;
-   skb-csum = 0;
}
}
 
@@ -2068,16 +2086,9 @@ void tcp_send_fin(struct sock *sk)
 
/* Reserve space for headers and prepare control bits. */
skb_reserve(skb, MAX_TCP_HEADER);
-   skb-csum = 0;
-   TCP_SKB_CB(skb)-flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_FIN);
-   TCP_SKB_CB(skb)-sacked = 0;
-   skb_shinfo(skb)-gso_segs = 1;
-   skb_shinfo(skb)-gso_size = 0;
-   skb_shinfo(skb)-gso_type = 0;
-
/* FIN eats a sequence byte, write_seq advanced by 
tcp_queue_skb(). */
-   TCP_SKB_CB(skb)-seq = tp-write_seq;
-   TCP_SKB_CB(skb)-end_seq = TCP_SKB_CB(skb)-seq + 1;
+   tcp_init_nondata_skb(skb, tp-write_seq,
+TCPCB_FLAG_ACK | TCPCB_FLAG_FIN);
tcp_queue_skb(sk, skb);
}
__tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_OFF);
@@ -2101,16 +2112,9 @@ void tcp_send_active_reset(struct sock *sk, gfp_t 
priority)
 
/* Reserve space for headers and prepare control bits. */
skb_reserve(skb, MAX_TCP_HEADER);
-   skb-csum = 0;
-   TCP_SKB_CB(skb)-flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_RST);
-   TCP_SKB_CB(skb)-sacked = 0;
-   skb_shinfo(skb)-gso_segs = 1;
-   skb_shinfo(skb)-gso_size = 0;
-   skb_shinfo(skb)-gso_type = 0;
-
+   tcp_init_nondata_skb(skb, tcp_acceptable_seq(sk),
+TCPCB_FLAG_ACK | TCPCB_FLAG_RST);
/* Send it off. */
-   TCP_SKB_CB(skb)-seq = tcp_acceptable_seq(sk);
-   TCP_SKB_CB(skb)-end_seq = TCP_SKB_CB(skb)-seq;
TCP_SKB_CB(skb)-when = 

mac80211: A-MPDU Rx adding basic functionality

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=07db218396650933abff3c5c1ad1e2a6e0cfedeb
Commit: 07db218396650933abff3c5c1ad1e2a6e0cfedeb
Parent: 5aae2880618471cfa679ca22531b88990bee9bf8
Author: Ron Rindjunsky [EMAIL PROTECTED]
AuthorDate: Tue Dec 25 17:00:33 2007 +0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:59 2008 -0800

mac80211: A-MPDU Rx adding basic functionality

This patch adds the basic needed abilities and functions for A-MPDU Rx 
session
changed functions:
 - ieee80211_sta_process_addba_request - Rx A-MPDU initialization enabled
 - ieee80211_stop - stops all A-MPDU Rx in case interface goes down
added functions:
 - ieee80211_send_delba - used for sending out Del BA in A-MPDU sessions
 - ieee80211_sta_stop_rx_BA_session - stopping Rx A-MPDU session
 - sta_rx_agg_session_timer_expired - stops A-MPDU Rx use if load is too
low

Signed-off-by: Ron Rindjunsky [EMAIL PROTECTED]
Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/ieee80211.h|7 ++
 net/mac80211/ieee80211.c |9 ++
 net/mac80211/ieee80211_i.h   |3 +
 net/mac80211/ieee80211_sta.c |  221 +++--
 net/mac80211/sta_info.c  |3 +
 5 files changed, 232 insertions(+), 11 deletions(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 3e64159..4d5a4c9 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -472,6 +472,13 @@ enum ieee80211_back_actioncode {
WLAN_ACTION_DELBA = 2,
 };
 
+/* BACK (block-ack) parties */
+enum ieee80211_back_parties {
+   WLAN_BACK_RECIPIENT = 0,
+   WLAN_BACK_INITIATOR = 1,
+   WLAN_BACK_TIMER = 2,
+};
+
 /* A-MSDU 802.11n */
 #define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
 
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 9c14e3d..2011c72 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -292,9 +292,18 @@ static int ieee80211_stop(struct net_device *dev)
struct ieee80211_sub_if_data *sdata;
struct ieee80211_local *local = wdev_priv(dev-ieee80211_ptr);
struct ieee80211_if_init_conf conf;
+   struct sta_info *sta;
+   int i;
 
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
+   list_for_each_entry(sta, local-sta_list, list) {
+   for (i = 0; i   STA_TID_NUM; i++)
+   ieee80211_sta_stop_rx_ba_session(sta-dev, sta-addr,
+   i, WLAN_BACK_RECIPIENT,
+   WLAN_REASON_QSTA_LEAVE_QBSS);
+   }
+
netif_stop_queue(dev);
 
/*
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index baf53c0..740d69d 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -767,6 +767,9 @@ int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap 
*ht_cap_ie,
 int ieee80211_ht_addt_info_ie_to_ht_bss_info(
struct ieee80211_ht_addt_info *ht_add_info_ie,
struct ieee80211_ht_bss_info *bss_info);
+void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *da,
+   u16 tid, u16 initiator, u16 reason);
+void sta_rx_agg_session_timer_expired(unsigned long data);
 /* ieee80211_iface.c */
 int ieee80211_if_add(struct net_device *dev, const char *name,
 struct net_device **new_dev, int type);
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 5b8f484..d5a7683 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -64,6 +64,11 @@
 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
 #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
 
+/* next values represent the buffer size for A-MPDU frame.
+ * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) */
+#define IEEE80211_MIN_AMPDU_BUF 0x8
+#define IEEE80211_MAX_AMPDU_BUF 0x40
+
 static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst,
 u8 *ssid, size_t ssid_len);
 static struct ieee80211_sta_bss *
@@ -1005,7 +1010,8 @@ static void ieee80211_send_addba_resp(struct net_device 
*dev, u8 *da, u16 tid,
struct ieee80211_mgmt *mgmt;
u16 capab;
 
-   skb = dev_alloc_skb(sizeof(*mgmt) + local-hw.extra_tx_headroom);
+   skb = dev_alloc_skb(sizeof(*mgmt) + local-hw.extra_tx_headroom + 1 +
+   sizeof(mgmt-u.action.u.addba_resp));
if (!skb) {
printk(KERN_DEBUG %s: failed to allocate buffer 
   for addba resp frame\n, dev-name);
@@ -1047,9 +1053,14 @@ static void ieee80211_sta_process_addba_request(struct 
net_device *dev,
size_t len)
 {
struct ieee80211_local 

mac80211: A-MPDU Rx MLME data initialization

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=16c5f15c73e97e22a1fcc6518da32bdcf98aec3d
Commit: 16c5f15c73e97e22a1fcc6518da32bdcf98aec3d
Parent: 07db218396650933abff3c5c1ad1e2a6e0cfedeb
Author: Ron Rindjunsky [EMAIL PROTECTED]
AuthorDate: Tue Dec 25 17:00:34 2007 +0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:01:00 2008 -0800

mac80211: A-MPDU Rx MLME data initialization

This patch initialize A-MPDU MLME data for Rx sessions.

Signed-off-by: Ron Rindjunsky [EMAIL PROTECTED]
Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/mac80211/sta_info.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 60ca078..1257c7a 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -136,6 +136,7 @@ struct sta_info * sta_info_add(struct ieee80211_local 
*local,
   struct net_device *dev, u8 *addr, gfp_t gfp)
 {
struct sta_info *sta;
+   int i;
DECLARE_MAC_BUF(mac);
 
sta = kzalloc(sizeof(*sta), gfp);
@@ -155,6 +156,19 @@ struct sta_info * sta_info_add(struct ieee80211_local 
*local,
memcpy(sta-addr, addr, ETH_ALEN);
sta-local = local;
sta-dev = dev;
+   spin_lock_init(sta-ampdu_mlme.ampdu_rx);
+   for (i = 0; i  STA_TID_NUM; i++) {
+   /* timer_to_tid must be initialized with identity mapping to
+* enable session_timer's data differentiation. refer to
+* sta_rx_agg_session_timer_expired for useage */
+   sta-timer_to_tid[i] = i;
+   /* rx timers */
+   sta-ampdu_mlme.tid_rx[i].session_timer.function =
+   sta_rx_agg_session_timer_expired;
+   sta-ampdu_mlme.tid_rx[i].session_timer.data =
+   (unsigned long)sta-timer_to_tid[i];
+   init_timer(sta-ampdu_mlme.tid_rx[i].session_timer);
+   }
skb_queue_head_init(sta-ps_tx_buf);
skb_queue_head_init(sta-tx_filtered);
__sta_info_get(sta);/* sta used by caller, decremented by
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


rc80211-pid: simplify and fix shift_adjust

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fa44327c06492c9bd625dbc8dbe35e5d5965fec6
Commit: fa44327c06492c9bd625dbc8dbe35e5d5965fec6
Parent: ca5fbca924b845863ab9da00ac90b3384445f497
Author: Stefano Brivio [EMAIL PROTECTED]
AuthorDate: Sun Dec 23 04:41:19 2007 +0100
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:52 2008 -0800

rc80211-pid: simplify and fix shift_adjust

Simplify and fix rate_control_pid_shift_adjust(). A bug prevented correct
mapping of sorted rates, and readability was seriously flawed.

Signed-off-by: Stefano Brivio [EMAIL PROTECTED]
Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/mac80211/rc80211_pid_algo.c |   34 --
 1 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index b84e514..3e26280 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -74,29 +74,27 @@ static int rate_control_pid_shift_adjust(struct 
rc_pid_rateinfo *r,
 {
int i, j, k, tmp;
 
-   if (cur + adj  0)
-   return 0;
-   if (cur + adj = l)
-   return l - 1;
+   j = r[cur].rev_index;
+   i = j + adj;
 
-   i = r[cur + adj].rev_index;
+   if (i  0)
+   return r[0].index;
+   if (i = l - 1)
+   return r[l - 1].index;
 
-   j = r[cur].rev_index;
+   tmp = i;
 
if (adj  0) {
-   tmp = i;
-   for (k = j; k = i; k--)
-   if (r[k].diff = r[j].diff)
-   tmp = k;
-   return r[tmp].index;
-   } else if (adj  0) {
-   tmp = i;
-   for (k = i + 1; k + i  l; k++)
-   if (r[k].diff = r[i].diff)
-   tmp = k;
-   return r[tmp].index;
+   for (k = j; k = i; k--)
+   if (r[k].diff = r[j].diff)
+   tmp = k;
+   } else {
+   for (k = i + 1; k + i  l; k++)
+   if (r[k].diff = r[i].diff)
+   tmp = k;
}
-   return cur + adj;
+
+   return r[tmp].index;
 }
 
 static void rate_control_pid_adjust_rate(struct ieee80211_local *local,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


rc80211_pid should respect fixed rates.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=df26e7ea049abe5104062f1f3e9ee7ede9d5104f
Commit: df26e7ea049abe5104062f1f3e9ee7ede9d5104f
Parent: 4b475898ec9dc6e62cebcb8fc0b3495c986a4590
Author: Andrew Lutomirski [EMAIL PROTECTED]
AuthorDate: Thu Jan 3 21:05:37 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:01:04 2008 -0800

rc80211_pid should respect fixed rates.

I would argue that mac80211 should handle fixed rates outside the rate
control code, which would also allow them to take effect immediately
instead of during the rate control callback, but this is pretty close
to correct.

Signed-Off-By: Andy Lutomirski [EMAIL PROTECTED]
Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/mac80211/rc80211_pid_algo.c |   12 
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index 0995bb9..66cae53 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -108,10 +108,6 @@ static void rate_control_pid_adjust_rate(struct 
ieee80211_local *local,
int back = (adj  0) ? 1 : -1;
 
sdata = IEEE80211_DEV_TO_SUB_IF(sta-dev);
-   if (sdata-bss  sdata-bss-force_unicast_rateidx  -1) {
-   /* forced unicast rate - do not change STA rate */
-   return;
-   }
 
mode = local-oper_hw_mode;
maxrate = sdata-bss ? sdata-bss-max_ratectrl_rateidx : -1;
@@ -241,6 +237,7 @@ static void rate_control_pid_tx_status(void *priv, struct 
net_device *dev,
 {
struct ieee80211_local *local = wdev_priv(dev-ieee80211_ptr);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb-data;
+   struct ieee80211_sub_if_data *sdata;
struct rc_pid_info *pinfo = priv;
struct sta_info *sta;
struct rc_pid_sta_info *spinfo;
@@ -251,6 +248,13 @@ static void rate_control_pid_tx_status(void *priv, struct 
net_device *dev,
if (!sta)
return;
 
+   /* Don't update the state if we're not controlling the rate. */
+   sdata = IEEE80211_DEV_TO_SUB_IF(sta-dev);
+   if (sdata-bss  sdata-bss-force_unicast_rateidx  -1) {
+   sta-txrate = sdata-bss-max_ratectrl_rateidx;
+   return;
+   }
+
/* Ignore all frames that were sent with a different rate than the rate
 * we currently advise mac80211 to use. */
if (status-control.rate != local-oper_hw_mode-rates[sta-txrate])
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] use SK_MEM_QUANTUM_SHIFT in __sk_mem_reclaim()

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=680a5a5086443b9547b32b04f40af8f9d717f711
Commit: 680a5a5086443b9547b32b04f40af8f9d717f711
Parent: d436d68630a74ba3c898ff1b53591ddc4eb7f2bf
Author: Eric Dumazet [EMAIL PROTECTED]
AuthorDate: Mon Dec 31 15:00:50 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:27 2008 -0800

[PATCH] use SK_MEM_QUANTUM_SHIFT in __sk_mem_reclaim()

Avoid an expensive divide (as done in commit
18030477e70a826b91608aee40a987bbd368fec6 but lost in commit
23821d2653111d20e75472c8c5003df1a55309a8)

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/core/sock.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index 8c184c4..3804e7d 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1476,7 +1476,7 @@ void __sk_mem_reclaim(struct sock *sk)
 {
struct proto *prot = sk-sk_prot;
 
-   atomic_sub(sk-sk_forward_alloc / SK_MEM_QUANTUM,
+   atomic_sub(sk-sk_forward_alloc  SK_MEM_QUANTUM_SHIFT,
   prot-memory_allocated);
sk-sk_forward_alloc = SK_MEM_QUANTUM - 1;
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET]: Simple ctl_table to ctl_path conversions.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b5ccd792fa413f9336273cb8fa3b9dd3a7ec1735
Commit: b5ccd792fa413f9336273cb8fa3b9dd3a7ec1735
Parent: cb7928a528264a69b29b6001b490b64607ed0557
Author: Pavel Emelyanov [EMAIL PROTECTED]
AuthorDate: Wed Jan 9 00:30:05 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:01:07 2008 -0800

[NET]: Simple ctl_table to ctl_path conversions.

This patch includes many places, that only required
replacing the ctl_table-s with appropriate ctl_paths
and call register_sysctl_paths().

Nothing special was done with them.

Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/appletalk/sysctl_net_atalk.c |   24 +---
 net/bridge/br_netfilter.c|   24 +---
 net/dccp/sysctl.c|   36 +++-
 net/ipx/sysctl_net_ipx.c |   24 +---
 net/irda/irsysctl.c  |   28 +---
 net/llc/sysctl_net_llc.c |   24 +---
 net/netrom/sysctl_net_netrom.c   |   24 +---
 net/rose/sysctl_net_rose.c   |   24 +---
 net/sctp/sysctl.c|   24 +---
 net/x25/sysctl_net_x25.c |   24 +---
 10 files changed, 52 insertions(+), 204 deletions(-)

diff --git a/net/appletalk/sysctl_net_atalk.c b/net/appletalk/sysctl_net_atalk.c
index 7df1778..621805d 100644
--- a/net/appletalk/sysctl_net_atalk.c
+++ b/net/appletalk/sysctl_net_atalk.c
@@ -49,31 +49,17 @@ static struct ctl_table atalk_table[] = {
{ 0 },
 };
 
-static struct ctl_table atalk_dir_table[] = {
-   {
-   .ctl_name   = NET_ATALK,
-   .procname   = appletalk,
-   .mode   = 0555,
-   .child  = atalk_table,
-   },
-   { 0 },
-};
-
-static struct ctl_table atalk_root_table[] = {
-   {
-   .ctl_name   = CTL_NET,
-   .procname   = net,
-   .mode   = 0555,
-   .child  = atalk_dir_table,
-   },
-   { 0 },
+static struct ctl_path atalk_path[] = {
+   { .procname = net, .ctl_name = CTL_NET, },
+   { .procname = appletalk, .ctl_name = NET_ATALK, },
+   { }
 };
 
 static struct ctl_table_header *atalk_table_header;
 
 void atalk_register_sysctl(void)
 {
-   atalk_table_header = register_sysctl_table(atalk_root_table);
+   atalk_table_header = register_sysctl_paths(atalk_path, atalk_table);
 }
 
 void atalk_unregister_sysctl(void)
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 859fe4d..141f069 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -967,24 +967,10 @@ static ctl_table brnf_table[] = {
{ .ctl_name = 0 }
 };
 
-static ctl_table brnf_bridge_table[] = {
-   {
-   .ctl_name   = NET_BRIDGE,
-   .procname   = bridge,
-   .mode   = 0555,
-   .child  = brnf_table,
-   },
-   { .ctl_name = 0 }
-};
-
-static ctl_table brnf_net_table[] = {
-   {
-   .ctl_name   = CTL_NET,
-   .procname   = net,
-   .mode   = 0555,
-   .child  = brnf_bridge_table,
-   },
-   { .ctl_name = 0 }
+static struct ctl_path brnf_path[] = {
+   { .procname = net, .ctl_name = CTL_NET, },
+   { .procname = bridge, .ctl_name = NET_BRIDGE, },
+   { }
 };
 #endif
 
@@ -996,7 +982,7 @@ int __init br_netfilter_init(void)
if (ret  0)
return ret;
 #ifdef CONFIG_SYSCTL
-   brnf_sysctl_header = register_sysctl_table(brnf_net_table);
+   brnf_sysctl_header = register_sysctl_paths(brnf_path, brnf_table);
if (brnf_sysctl_header == NULL) {
printk(KERN_WARNING
   br_netfilter: can't register to sysctl.\n);
diff --git a/net/dccp/sysctl.c b/net/dccp/sysctl.c
index c62c050..2129599 100644
--- a/net/dccp/sysctl.c
+++ b/net/dccp/sysctl.c
@@ -100,41 +100,19 @@ static struct ctl_table dccp_default_table[] = {
{ .ctl_name = 0, }
 };
 
-static struct ctl_table dccp_table[] = {
-   {
-   .ctl_name   = NET_DCCP_DEFAULT,
-   .procname   = default,
-   .mode   = 0555,
-   .child  = dccp_default_table,
-   },
-   { .ctl_name = 0, },
-};
-
-static struct ctl_table dccp_dir_table[] = {
-   {
-   .ctl_name   = NET_DCCP,
-   .procname   = dccp,
-   .mode   = 0555,
-   .child  = dccp_table,
-   },
-   { .ctl_name = 0, },
-};
-
-static struct ctl_table dccp_root_table[] = {
-   {
-   

[TIPC]: Use tipc_port_unlock

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4cec72c890d3a465eed08c24a4a2bfe25650318f
Commit: 4cec72c890d3a465eed08c24a4a2bfe25650318f
Parent: cdcb006fbe7a74b5f7827f5c5c27e11399a2fab7
Author: Julia Lawall [EMAIL PROTECTED]
AuthorDate: Tue Jan 8 23:48:20 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:01:05 2008 -0800

[TIPC]: Use tipc_port_unlock

The file net/tipc/port.c takes a lock using the function tipc_port_lock and
then releases the lock sometimes using tipc_port_unlock and sometimes using
spin_unlock_bh(p_ptr-publ.lock).  tipc_port_unlock simply does the
spin_unlock_bh, but it seems cleaner to use it everywhere.

The problem was fixed using the following semantic patch.
(http://www.emn.fr/x-info/coccinelle/)

// smpl
@@
struct port *p_ptr;
@@

   p_ptr = tipc_port_lock(...)
   ...
(
   p_ptr = tipc_port_lock(...);
|
?- spin_unlock_bh(p_ptr-publ.lock);
+  tipc_port_unlock(p_ptr);
)
// /smpl

Signed-off-by: Julia Lawall [EMAIL PROTECTED]
Acked-by: Jon Paul Maloy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/tipc/port.c |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/net/tipc/port.c b/net/tipc/port.c
index 7608815..f508614 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -340,7 +340,7 @@ int tipc_portunreliable(u32 ref, unsigned int *isunreliable)
if (!p_ptr)
return -EINVAL;
*isunreliable = port_unreliable(p_ptr);
-   spin_unlock_bh(p_ptr-publ.lock);
+   tipc_port_unlock(p_ptr);
return TIPC_OK;
 }
 
@@ -369,7 +369,7 @@ int tipc_portunreturnable(u32 ref, unsigned int 
*isunrejectable)
if (!p_ptr)
return -EINVAL;
*isunrejectable = port_unreturnable(p_ptr);
-   spin_unlock_bh(p_ptr-publ.lock);
+   tipc_port_unlock(p_ptr);
return TIPC_OK;
 }
 
@@ -843,7 +843,7 @@ static void port_dispatcher_sigh(void *dummy)
u32 peer_port = port_peerport(p_ptr);
u32 peer_node = port_peernode(p_ptr);
 
-   spin_unlock_bh(p_ptr-publ.lock);
+   tipc_port_unlock(p_ptr);
if (unlikely(!connected)) {
if (unlikely(published))
goto reject;
@@ -867,7 +867,7 @@ static void port_dispatcher_sigh(void *dummy)
case TIPC_DIRECT_MSG:{
tipc_msg_event cb = up_ptr-msg_cb;
 
-   spin_unlock_bh(p_ptr-publ.lock);
+   tipc_port_unlock(p_ptr);
if (unlikely(connected))
goto reject;
if (unlikely(!cb))
@@ -882,7 +882,7 @@ static void port_dispatcher_sigh(void *dummy)
case TIPC_NAMED_MSG:{
tipc_named_msg_event cb = up_ptr-named_msg_cb;
 
-   spin_unlock_bh(p_ptr-publ.lock);
+   tipc_port_unlock(p_ptr);
if (unlikely(connected))
goto reject;
if (unlikely(!cb))
@@ -913,7 +913,7 @@ err:
u32 peer_port = port_peerport(p_ptr);
u32 peer_node = port_peernode(p_ptr);
 
-   spin_unlock_bh(p_ptr-publ.lock);
+   tipc_port_unlock(p_ptr);
if (!connected || !cb)
break;
if (msg_origport(msg) != peer_port)
@@ -929,7 +929,7 @@ err:
case TIPC_DIRECT_MSG:{
tipc_msg_err_event cb = up_ptr-err_cb;
 
-   spin_unlock_bh(p_ptr-publ.lock);
+   tipc_port_unlock(p_ptr);
if (connected || !cb)
break;
skb_pull(buf, msg_hdr_sz(msg));
@@ -942,7 +942,7 @@ err:
tipc_named_msg_err_event cb =
up_ptr-named_err_cb;
 
-   spin_unlock_bh(p_ptr-publ.lock);
+   tipc_port_unlock(p_ptr);
if (connected || !cb)
break;
dseq.type =  msg_nametype(msg);
@@ -1107,7 +1107,7 @@ int tipc_portimportance(u32 ref, unsigned int *importance)
if (!p_ptr)
return -EINVAL;
*importance = (unsigned 

mac80211: make PID rate control algorithm the default

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c21b39aca4f8f4975784e54cd3a1b80bab80dcc0
Commit: c21b39aca4f8f4975784e54cd3a1b80bab80dcc0
Parent: b92edbe0b8a36a833c16b0cbafb6e899b81ffc08
Author: Stefano Brivio [EMAIL PROTECTED]
AuthorDate: Wed Dec 19 01:26:16 2007 +0100
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:41 2008 -0800

mac80211: make PID rate control algorithm the default

This makes the new PID TX rate control algorithm the default instead of the
rc80211_simple rate control algorithm. The simple algorithm was flawed in
several ways: it wasn't responsive at all and didn't age the information it 
was
relying on properly. The PID algorithm allows us to tune characteristics 
such
as responsiveness by adjusting parameters and was found to generally behave
better.

The default algorithm can be overridden to select simple instead. Which
ever algorithm is the default is included as part of the mac80211
module automatically. The other algorithm (simple vs. pid) can
be selected for inclusion as well. If EMBEDDED is selected then
the choice is available to have no default specified and neither
algorithm included in mac80211. The default algorithm can be set
through a modparam.

While at it, mark rc80211-simple as deprecated, and schedule it
for removal.

Signed-off-by: Stefano Brivio [EMAIL PROTECTED]
Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 Documentation/feature-removal-schedule.txt |8 +++
 net/mac80211/Kconfig   |   72 +++-
 net/mac80211/Makefile  |4 +-
 net/mac80211/ieee80211.c   |   12 ++--
 net/mac80211/ieee80211_rate.c  |   24 +++--
 5 files changed, 93 insertions(+), 27 deletions(-)

diff --git a/Documentation/feature-removal-schedule.txt 
b/Documentation/feature-removal-schedule.txt
index 0927425..a6cf8f6 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -314,3 +314,11 @@ Why:   No in-kernel drivers will depend on it any 
longer.
 Who:   John W. Linville [EMAIL PROTECTED]
 
 ---
+
+What:  rc80211-simple rate control algorithm for mac80211
+When:  2.6.26
+Files: net/mac80211/rc80211-simple.c
+Why:   This algorithm was provided for reference but always exhibited bad
+   responsiveness and performance and has some serious flaws. It has been
+   replaced by rc80211-pid.
+Who:   Stefano Brivio [EMAIL PROTECTED]
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 9f8663b..297f4d9 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -13,29 +13,75 @@ config MAC80211
This option enables the hardware independent IEEE 802.11
networking stack.
 
-config MAC80211_RCSIMPLE
-   bool 'simple' rate control algorithm if EMBEDDED
+config MAC80211_RC_DEFAULT_CHOICE
+   bool Choose default rate control algorithm if EMBEDDED
default y
depends on MAC80211
-   help
- This option allows you to turn off the 'simple' rate
- control algorithm in mac80211. If you do turn it off,
- you absolutely need another rate control algorithm.
+   ---help---
+ This options enables selection of a default rate control
+ algorithm to be built into the mac80211 module.  Alternate
+ rate control algorithms might be built into the mac80211
+ module as well.
+
+choice
+   prompt Default rate control algorithm
+   default MAC80211_RC_DEFAULT_PID
+   depends on MAC80211  MAC80211_RC_DEFAULT_CHOICE
+   ---help---
+ This option selects the default rate control algorithm
+ mac80211 will use. Note that this default can still be
+ overriden through the ieee80211_default_rc_algo module
+ parameter.
+
+config MAC80211_RC_DEFAULT_PID
+   bool PID controller based rate control algorithm
+   select MAC80211_RC_PID
+   ---help---
+ Select the PID controller based rate control as the
+ default rate control algorithm. You should choose
+ this unless you know what you are doing.
+
+config MAC80211_RC_DEFAULT_SIMPLE
+   bool Simple rate control algorithm
+   select MAC80211_RC_SIMPLE
+   ---help---
+ Select the simple rate control as the default rate
+ control algorithm. Note that this is a non-responsive,
+ dumb algorithm. You should choose the PID rate control
+ instead.
+
+endchoice
 
- Say Y unless you know you will have another algorithm
- available.
+config MAC80211_RC_DEFAULT
+   string
+   depends on MAC80211
+   default pid if MAC80211_RC_DEFAULT_PID
+   default simple if MAC80211_RC_DEFAULT_SIMPLE
+   default 
 
-config MAC80211_RCPID

[NETNS]: Pass fib_rules_ops into default_pref method.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=868d13ac811746e28e4c806f2b1bd8575796f9af
Commit: 868d13ac811746e28e4c806f2b1bd8575796f9af
Parent: f8c26b8d589867aed8251db2935f8aa03aa68717
Author: Denis V. Lunev [EMAIL PROTECTED]
AuthorDate: Thu Jan 10 03:18:25 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:01:22 2008 -0800

[NETNS]: Pass fib_rules_ops into default_pref method.

fib_rules_ops contains operations and the list of configured rules. ops will
become per/namespace soon, so we need them to be known in the default_pref
callback.

Acked-by: Benjamin Thery [EMAIL PROTECTED]
Acked-by: Daniel Lezcano [EMAIL PROTECTED]
Signed-off-by: Denis V. Lunev [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/fib_rules.h |2 +-
 net/core/fib_rules.c|2 +-
 net/decnet/dn_rules.c   |2 +-
 net/ipv4/fib_rules.c|2 +-
 net/ipv6/fib6_rules.c   |2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index f7351b0..e9a074c 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -56,7 +56,7 @@ struct fib_rules_ops
int (*fill)(struct fib_rule *, struct sk_buff *,
struct nlmsghdr *,
struct fib_rule_hdr *);
-   u32 (*default_pref)(void);
+   u32 (*default_pref)(struct fib_rules_ops *ops);
size_t  (*nlmsg_payload)(struct fib_rule *);
 
/* Called after modifications to the rules set, must flush
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index ada9c81..e12e9f5 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -285,7 +285,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct 
nlmsghdr* nlh, void *arg)
rule-table = frh_get_table(frh, tb);
 
if (!rule-pref  ops-default_pref)
-   rule-pref = ops-default_pref();
+   rule-pref = ops-default_pref(ops);
 
err = -EINVAL;
if (tb[FRA_GOTO]) {
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index 0b5e2b9..c1fae23 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -212,7 +212,7 @@ nla_put_failure:
return -ENOBUFS;
 }
 
-static u32 dn_fib_rule_default_pref(void)
+static u32 dn_fib_rule_default_pref(struct fib_rules_ops *ops)
 {
struct list_head *pos;
struct fib_rule *rule;
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index eac3f71..afe669d 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -245,7 +245,7 @@ nla_put_failure:
return -ENOBUFS;
 }
 
-static u32 fib4_rule_default_pref(void)
+static u32 fib4_rule_default_pref(struct fib_rules_ops *ops)
 {
struct list_head *pos;
struct fib_rule *rule;
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index e4d7e5a..76437a1 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -223,7 +223,7 @@ nla_put_failure:
return -ENOBUFS;
 }
 
-static u32 fib6_rule_default_pref(void)
+static u32 fib6_rule_default_pref(struct fib_rules_ops *ops)
 {
return 0x3FFF;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETNS]: Add netns parameter to fib_get_table/fib_new_table.

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8ad4942cd5bdad4143f7aa1d1bd4f7b2526c19c5
Commit: 8ad4942cd5bdad4143f7aa1d1bd4f7b2526c19c5
Parent: 93456b6d7753def8760b423ac6b986eb9d5a4a95
Author: Denis V. Lunev [EMAIL PROTECTED]
AuthorDate: Thu Jan 10 03:24:11 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:01:27 2008 -0800

[NETNS]: Add netns parameter to fib_get_table/fib_new_table.

This patch extends the fib_get_table and the fib_new_table functions
with the network namespace pointer. That will allow to access the
table relatively from the network namespace.

Acked-by: Benjamin Thery [EMAIL PROTECTED]
Acked-by: Daniel Lezcano [EMAIL PROTECTED]
Signed-off-by: Denis V. Lunev [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/ip_fib.h|   16 
 net/ipv4/fib_frontend.c |   24 
 net/ipv4/fib_hash.c |4 ++--
 net/ipv4/fib_rules.c|   12 ++--
 net/ipv4/fib_trie.c |8 
 5 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 249af66..dfb95d7 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -165,7 +165,7 @@ struct fib_table {
 #define TABLE_LOCAL_INDEX  0
 #define TABLE_MAIN_INDEX   1
 
-static inline struct fib_table *fib_get_table(u32 id)
+static inline struct fib_table *fib_get_table(struct net *net, u32 id)
 {
struct hlist_head *ptr;
 
@@ -175,20 +175,20 @@ static inline struct fib_table *fib_get_table(u32 id)
return hlist_entry(ptr-first, struct fib_table, tb_hlist);
 }
 
-static inline struct fib_table *fib_new_table(u32 id)
+static inline struct fib_table *fib_new_table(struct net *net, u32 id)
 {
-   return fib_get_table(id);
+   return fib_get_table(net, id);
 }
 
 static inline int fib_lookup(const struct flowi *flp, struct fib_result *res)
 {
struct fib_table *table;
 
-   table = fib_get_table(RT_TABLE_LOCAL);
+   table = fib_get_table(init_net, RT_TABLE_LOCAL);
if (!table-tb_lookup(table, flp, res))
return 0;
 
-   table = fib_get_table(RT_TABLE_MAIN);
+   table = fib_get_table(init_net, RT_TABLE_MAIN);
if (!table-tb_lookup(table, flp, res))
return 0;
return -ENETUNREACH;
@@ -197,7 +197,7 @@ static inline int fib_lookup(const struct flowi *flp, 
struct fib_result *res)
 static inline void fib_select_default(const struct flowi *flp,
  struct fib_result *res)
 {
-   struct fib_table *table = fib_get_table(RT_TABLE_MAIN);
+   struct fib_table *table = fib_get_table(init_net, RT_TABLE_MAIN);
if (FIB_RES_GW(*res)  FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK)
table-tb_select_default(table, flp, res);
 }
@@ -212,8 +212,8 @@ extern u32 fib_rules_tclass(struct fib_result *res);
 
 extern int fib_lookup(struct flowi *flp, struct fib_result *res);
 
-extern struct fib_table *fib_new_table(u32 id);
-extern struct fib_table *fib_get_table(u32 id);
+extern struct fib_table *fib_new_table(struct net *net, u32 id);
+extern struct fib_table *fib_get_table(struct net *net, u32 id);
 extern void fib_select_default(const struct flowi *flp, struct fib_result 
*res);
 
 #endif /* CONFIG_IP_MULTIPLE_TABLES */
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 9ff1e66..7718823 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -78,14 +78,14 @@ fail:
 }
 #else
 
-struct fib_table *fib_new_table(u32 id)
+struct fib_table *fib_new_table(struct net *net, u32 id)
 {
struct fib_table *tb;
unsigned int h;
 
if (id == 0)
id = RT_TABLE_MAIN;
-   tb = fib_get_table(id);
+   tb = fib_get_table(net, id);
if (tb)
return tb;
tb = fib_hash_init(id);
@@ -96,7 +96,7 @@ struct fib_table *fib_new_table(u32 id)
return tb;
 }
 
-struct fib_table *fib_get_table(u32 id)
+struct fib_table *fib_get_table(struct net *net, u32 id)
 {
struct fib_table *tb;
struct hlist_node *node;
@@ -148,7 +148,7 @@ struct net_device * ip_dev_find(__be32 addr)
res.r = NULL;
 #endif
 
-   local_table = fib_get_table(RT_TABLE_LOCAL);
+   local_table = fib_get_table(init_net, RT_TABLE_LOCAL);
if (!local_table || local_table-tb_lookup(local_table, fl, res))
return NULL;
if (res.type != RTN_LOCAL)
@@ -183,7 +183,7 @@ static inline unsigned __inet_dev_addr_type(const struct 
net_device *dev,
res.r = NULL;
 #endif
 
-   local_table = fib_get_table(RT_TABLE_LOCAL);
+   local_table = fib_get_table(init_net, RT_TABLE_LOCAL);
if (local_table) {
ret = RTN_UNICAST;
if (!local_table-tb_lookup(local_table, fl, res)) {
@@ -453,13 +453,13 @@ int 

[ATM]: Oops reading net/atm/arp

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e5d69b9f4a6ce17f0d09595da45e37b870fee5ae
Commit: e5d69b9f4a6ce17f0d09595da45e37b870fee5ae
Parent: 8cced9eff1d413c28efac9c5ac5a75793c9251cf
Author: Denis V. Lunev [EMAIL PROTECTED]
AuthorDate: Thu Jan 10 03:51:41 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:01:36 2008 -0800

[ATM]: Oops reading net/atm/arp

cat /proc/net/atm/arp causes the NULL pointer dereference in the
get_proc_net+0xc/0x3a. This happens as proc_get_net believes that the
parent proc dir entry contains struct net.

Fix this assumption for net/atm case.

The problem is introduced by the commit 
c0097b07abf5f92ab135d024dd41bd2aada1512f
from Eric W. Biederman/Daniel Lezcano.

Signed-off-by: Denis V. Lunev [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 fs/proc/proc_net.c  |   17 +
 include/linux/proc_fs.h |2 ++
 net/atm/proc.c  |4 ++--
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index cfc4f6c..4823c96 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -96,6 +96,17 @@ static struct proc_dir_entry *proc_net_shadow(struct 
task_struct *task,
return task-nsproxy-net_ns-proc_net;
 }
 
+struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
+   struct proc_dir_entry *parent)
+{
+   struct proc_dir_entry *pde;
+   pde = proc_mkdir_mode(name, S_IRUGO | S_IXUGO, parent);
+   if (pde != NULL)
+   pde-data = net;
+   return pde;
+}
+EXPORT_SYMBOL_GPL(proc_net_mkdir);
+
 static __net_init int proc_net_ns_init(struct net *net)
 {
struct proc_dir_entry *root, *netd, *net_statd;
@@ -107,18 +118,16 @@ static __net_init int proc_net_ns_init(struct net *net)
goto out;
 
err = -EEXIST;
-   netd = proc_mkdir(net, root);
+   netd = proc_net_mkdir(net, net, root);
if (!netd)
goto free_root;
 
err = -EEXIST;
-   net_statd = proc_mkdir(stat, netd);
+   net_statd = proc_net_mkdir(net, stat, netd);
if (!net_statd)
goto free_net;
 
root-data = net;
-   netd-data = net;
-   net_statd-data = net;
 
net-proc_net_root = root;
net-proc_net = netd;
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index a531682..8f92546 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -201,6 +201,8 @@ static inline struct proc_dir_entry 
*create_proc_info_entry(const char *name,
 extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
const char *name, mode_t mode, const struct file_operations *fops);
 extern void proc_net_remove(struct net *net, const char *name);
+extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
+   struct proc_dir_entry *parent);
 
 #else
 
diff --git a/net/atm/proc.c b/net/atm/proc.c
index 5d9d5ff..565e75e 100644
--- a/net/atm/proc.c
+++ b/net/atm/proc.c
@@ -476,7 +476,7 @@ static void atm_proc_dirs_remove(void)
if (e-dirent)
remove_proc_entry(e-name, atm_proc_root);
}
-   remove_proc_entry(atm, init_net.proc_net);
+   proc_net_remove(init_net, atm);
 }
 
 int __init atm_proc_init(void)
@@ -484,7 +484,7 @@ int __init atm_proc_init(void)
static struct atm_proc_entry *e;
int ret;
 
-   atm_proc_root = proc_mkdir(atm, init_net.proc_net);
+   atm_proc_root = proc_net_mkdir(init_net, atm, init_net.proc_net);
if (!atm_proc_root)
goto err_out;
for (e = atm_proc_ents; e-name; e++) {
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TCP]: Do not purge sk_forward_alloc entirely in tcp_delack_timer().

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9993e7d313e80bdc005d09c7def91903e0068f07
Commit: 9993e7d313e80bdc005d09c7def91903e0068f07
Parent: e186932b3d26bd975022a1e254407e95dddceae7
Author: David S. Miller [EMAIL PROTECTED]
AuthorDate: Thu Jan 10 21:56:38 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:01:42 2008 -0800

[TCP]: Do not purge sk_forward_alloc entirely in tcp_delack_timer().

Otherwise we beat heavily on the global tcp_memory atomics
when all of the sockets in the system are slowly sending
perioding packet clumps.

Noticed and suggested by Eric Dumazet.

Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/sock.h   |8 
 net/ipv4/tcp_timer.c |2 +-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 786fae8..9023244 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -759,6 +759,14 @@ static inline void sk_mem_reclaim(struct sock *sk)
__sk_mem_reclaim(sk);
 }
 
+static inline void sk_mem_reclaim_partial(struct sock *sk)
+{
+   if (!sk_has_account(sk))
+   return;
+   if (sk-sk_forward_alloc  SK_MEM_QUANTUM)
+   __sk_mem_reclaim(sk);
+}
+
 static inline void sk_mem_charge(struct sock *sk, int size)
 {
if (!sk_has_account(sk))
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 17931be..803d758 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -186,7 +186,7 @@ static void tcp_delack_timer(unsigned long data)
goto out_unlock;
}
 
-   sk_mem_reclaim(sk);
+   sk_mem_reclaim_partial(sk);
 
if (sk-sk_state == TCP_CLOSE || !(icsk-icsk_ack.pending  
ICSK_ACK_TIMER))
goto out;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


rc80211-pid: fix sta_info refcounting

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=13e05aa631b195ce30737b320da17e7542c82ead
Commit: 13e05aa631b195ce30737b320da17e7542c82ead
Parent: fa44327c06492c9bd625dbc8dbe35e5d5965fec6
Author: Stefano Brivio [EMAIL PROTECTED]
AuthorDate: Sun Dec 23 04:43:57 2007 +0100
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:00:53 2008 -0800

rc80211-pid: fix sta_info refcounting

Fix a bug which caused uncorrect refcounting of PHYs in mac80211. Thanks to
Johannes Berg for spotting this out.

Cc: Johannes Berg [EMAIL PROTECTED]
Signed-off-by: Stefano Brivio [EMAIL PROTECTED]
Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/mac80211/rc80211_pid_algo.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index 3e26280..da35290 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -254,7 +254,7 @@ static void rate_control_pid_tx_status(void *priv, struct 
net_device *dev,
/* Ignore all frames that were sent with a different rate than the rate
 * we currently advise mac80211 to use. */
if (status-control.rate != local-oper_hw_mode-rates[sta-txrate])
-   return;
+   goto ignore;
 
spinfo = sta-rate_ctrl_priv;
spinfo-tx_num_xmit++;
@@ -295,6 +295,7 @@ static void rate_control_pid_tx_status(void *priv, struct 
net_device *dev,
if (time_after(jiffies, spinfo-last_sample + period))
rate_control_pid_sample(pinfo, local, sta);
 
+ignore:
sta_info_put(sta);
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TCP]: Fix TSO deferring

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bd515c3e48ececd774eb3128e81b669dbbd32637
Commit: bd515c3e48ececd774eb3128e81b669dbbd32637
Parent: 255f97b3117cbe10b2493f7f12d66a81dfbcdf43
Author: Ilpo Järvinen [EMAIL PROTECTED]
AuthorDate: Thu Dec 20 20:36:03 2007 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 14:59:36 2008 -0800

[TCP]: Fix TSO deferring

I'd say that most of what tcp_tso_should_defer had in between
there was dead code because of this.

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/tcp_output.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 9a985b5..7c50271 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1230,7 +1230,8 @@ static int tcp_tso_should_defer(struct sock *sk, struct 
sk_buff *skb)
goto send_now;
 
/* Defer for less than two clock ticks. */
-   if (!tp-tso_deferred  ((jiffies1)1) - (tp-tso_deferred1)  1)
+   if (tp-tso_deferred 
+   ((jiffies  1)  1) - (tp-tso_deferred  1)  1)
goto send_now;
 
in_flight = tcp_packets_in_flight(tp);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PKT_SCHED] HTB: htb_classid is dead static inline

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d88c305a03c37a95c4b27e1a0c2e387bb7ce80df
Commit: d88c305a03c37a95c4b27e1a0c2e387bb7ce80df
Parent: 8519660b98349fb922157fa2f5fb6e49eb17ad38
Author: Ilpo Järvinen [EMAIL PROTECTED]
AuthorDate: Sat Jan 12 21:29:14 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:01:59 2008 -0800

[PKT_SCHED] HTB: htb_classid is dead static inline

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/sched/sch_htb.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 72beb66..6a2352c 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -214,10 +214,6 @@ static inline struct htb_class *htb_find(u32 handle, 
struct Qdisc *sch)
  * then finish and return direct queue.
  */
 #define HTB_DIRECT (struct htb_class*)-1
-static inline u32 htb_classid(struct htb_class *cl)
-{
-   return (cl  cl != HTB_DIRECT) ? cl-classid : TC_H_UNSPEC;
-}
 
 static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
  int *qerr)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: nf_conntrack_sctp: reduce line length

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=112f35c9c164e06e038d506dd3eb15e76829ef8a
Commit: 112f35c9c164e06e038d506dd3eb15e76829ef8a
Parent: 35c6d3cbe1b97b860087f6082e764ac8da2a12b2
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Jan 14 23:46:20 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:02:34 2008 -0800

[NETFILTER]: nf_conntrack_sctp: reduce line length

Reduce the length of some overly long lines by renaming all
conntrack variables to ct.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/netfilter/nf_conntrack_proto_sctp.c |   43 +++
 1 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/net/netfilter/nf_conntrack_proto_sctp.c 
b/net/netfilter/nf_conntrack_proto_sctp.c
index 5166bb3..84e37e9 100644
--- a/net/netfilter/nf_conntrack_proto_sctp.c
+++ b/net/netfilter/nf_conntrack_proto_sctp.c
@@ -173,13 +173,12 @@ static int sctp_print_tuple(struct seq_file *s,
 }
 
 /* Print out the private part of the conntrack. */
-static int sctp_print_conntrack(struct seq_file *s,
-   const struct nf_conn *conntrack)
+static int sctp_print_conntrack(struct seq_file *s, const struct nf_conn *ct)
 {
enum sctp_conntrack state;
 
read_lock_bh(sctp_lock);
-   state = conntrack-proto.sctp.state;
+   state = ct-proto.sctp.state;
read_unlock_bh(sctp_lock);
 
return seq_printf(s, %s , sctp_conntrack_names[state]);
@@ -192,7 +191,7 @@ for ((offset) = (dataoff) + sizeof(sctp_sctphdr_t), (count) 
= 0;\
(offset) += (ntohs((sch)-length) + 3)  ~3, (count)++)
 
 /* Some validity checks to make sure the chunks are fine */
-static int do_basic_checks(struct nf_conn *conntrack,
+static int do_basic_checks(struct nf_conn *ct,
   const struct sk_buff *skb,
   unsigned int dataoff,
   unsigned long *map)
@@ -293,7 +292,7 @@ static int new_state(enum ip_conntrack_dir dir,
 }
 
 /* Returns verdict for packet, or -1 for invalid. */
-static int sctp_packet(struct nf_conn *conntrack,
+static int sctp_packet(struct nf_conn *ct,
   const struct sk_buff *skb,
   unsigned int dataoff,
   enum ip_conntrack_info ctinfo,
@@ -310,7 +309,7 @@ static int sctp_packet(struct nf_conn *conntrack,
if (sh == NULL)
return -1;
 
-   if (do_basic_checks(conntrack, skb, dataoff, map) != 0)
+   if (do_basic_checks(ct, skb, dataoff, map) != 0)
return -1;
 
/* Check the verification tag (Sec 8.5) */
@@ -319,7 +318,7 @@ static int sctp_packet(struct nf_conn *conntrack,
!test_bit(SCTP_CID_COOKIE_ECHO, map) 
!test_bit(SCTP_CID_ABORT, map) 
!test_bit(SCTP_CID_SHUTDOWN_ACK, map) 
-   sh-vtag != conntrack-proto.sctp.vtag[CTINFO2DIR(ctinfo)]) {
+   sh-vtag != ct-proto.sctp.vtag[CTINFO2DIR(ctinfo)]) {
pr_debug(Verification tag check failed\n);
return -1;
}
@@ -337,28 +336,28 @@ static int sctp_packet(struct nf_conn *conntrack,
}
} else if (sch-type == SCTP_CID_ABORT) {
/* Sec 8.5.1 (B) */
-   if (sh-vtag != 
conntrack-proto.sctp.vtag[CTINFO2DIR(ctinfo)] 
-   sh-vtag != conntrack-proto.sctp.vtag[1 - 
CTINFO2DIR(ctinfo)]) {
+   if (sh-vtag != ct-proto.sctp.vtag[CTINFO2DIR(ctinfo)] 

+   sh-vtag != ct-proto.sctp.vtag[1 - 
CTINFO2DIR(ctinfo)]) {
write_unlock_bh(sctp_lock);
return -1;
}
} else if (sch-type == SCTP_CID_SHUTDOWN_COMPLETE) {
/* Sec 8.5.1 (C) */
-   if (sh-vtag != 
conntrack-proto.sctp.vtag[CTINFO2DIR(ctinfo)] 
-   sh-vtag != conntrack-proto.sctp.vtag[1 - 
CTINFO2DIR(ctinfo)] 
+   if (sh-vtag != ct-proto.sctp.vtag[CTINFO2DIR(ctinfo)] 

+   sh-vtag != ct-proto.sctp.vtag[1 - 
CTINFO2DIR(ctinfo)] 
(sch-flags  1)) {
write_unlock_bh(sctp_lock);
return -1;
}
} else if (sch-type == SCTP_CID_COOKIE_ECHO) {
/* Sec 8.5.1 (D) */
-   if (sh-vtag != 
conntrack-proto.sctp.vtag[CTINFO2DIR(ctinfo)]) {
+   if (sh-vtag != 
ct-proto.sctp.vtag[CTINFO2DIR(ctinfo)]) {
write_unlock_bh(sctp_lock);
return -1;
}
}
 
-   oldsctpstate = 

[X25]: Avoid divides and sparse warnings

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6bf1574ee33270e7c0b9d43103e8cedffd9f74db
Commit: 6bf1574ee33270e7c0b9d43103e8cedffd9f74db
Parent: 4dde4610c4ab54e9d36a4afaa98c23b017f7f9e3
Author: Eric Dumazet [EMAIL PROTECTED]
AuthorDate: Sun Jan 13 22:27:52 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:02:03 2008 -0800

[X25]: Avoid divides and sparse warnings

   CHECK   net/x25/af_x25.c
net/x25/af_x25.c:117:46: warning: expensive signed divide
   CHECK   net/x25/x25_facilities.c
net/x25/x25_facilities.c:209:30: warning: expensive signed divide
   CHECK   net/x25/x25_in.c
net/x25/x25_in.c:250:26: warning: expensive signed divide
   CHECK   net/x25/x25_proc.c
net/x25/x25_proc.c:48:11: warning: context imbalance in 
'x25_seq_route_start'
- wrong count at exit
net/x25/x25_proc.c:72:13: warning: context imbalance in 
'x25_seq_route_stop' -
unexpected unlock
net/x25/x25_proc.c:112:11: warning: context imbalance in
'x25_seq_socket_start' - wrong count at exit
net/x25/x25_proc.c:129:13: warning: context imbalance in 
'x25_seq_socket_stop'
- unexpected unlock
net/x25/x25_proc.c:190:11: warning: context imbalance in
'x25_seq_forward_start' - wrong count at exit
net/x25/x25_proc.c:215:13: warning: context imbalance in
'x25_seq_forward_stop' - unexpected unlock
   CHECK   net/x25/x25_subr.c
net/x25/x25_subr.c:362:57: warning: expensive signed divide

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/x25/af_x25.c |4 ++--
 net/x25/x25_facilities.c |4 +---
 net/x25/x25_in.c |2 +-
 net/x25/x25_proc.c   |6 ++
 net/x25/x25_subr.c   |2 +-
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 92cfe8e..07fad7c 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -83,9 +83,9 @@ struct compat_x25_subscrip_struct {
 int x25_addr_ntoa(unsigned char *p, struct x25_address *called_addr,
  struct x25_address *calling_addr)
 {
-   int called_len, calling_len;
+   unsigned int called_len, calling_len;
char *called, *calling;
-   int i;
+   unsigned int i;
 
called_len  = (*p  0)  0x0F;
calling_len = (*p  4)  0x0F;
diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c
index dec404a..a21f664 100644
--- a/net/x25/x25_facilities.c
+++ b/net/x25/x25_facilities.c
@@ -205,9 +205,7 @@ int x25_create_facilities(unsigned char *buffer,
}
 
if (dte_facs-calling_len  (facil_mask  X25_MASK_CALLING_AE)) {
-   unsigned bytecount = (dte_facs-calling_len % 2) ?
-   dte_facs-calling_len / 2 + 1 :
-   dte_facs-calling_len / 2;
+   unsigned bytecount = (dte_facs-calling_len + 1)  1;
*p++ = X25_FAC_CALLING_AE;
*p++ = 1 + bytecount;
*p++ = dte_facs-calling_len;
diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c
index 1c88762..7d7c3ab 100644
--- a/net/x25/x25_in.c
+++ b/net/x25/x25_in.c
@@ -247,7 +247,7 @@ static int x25_state3_machine(struct sock *sk, struct 
sk_buff *skb, int frametyp
break;
}
if (atomic_read(sk-sk_rmem_alloc) 
-   (sk-sk_rcvbuf / 2))
+   (sk-sk_rcvbuf  1))
x25-condition |= X25_COND_OWN_RX_BUSY;
}
/*
diff --git a/net/x25/x25_proc.c b/net/x25/x25_proc.c
index 7d55e50..78b0534 100644
--- a/net/x25/x25_proc.c
+++ b/net/x25/x25_proc.c
@@ -41,6 +41,7 @@ found:
 }
 
 static void *x25_seq_route_start(struct seq_file *seq, loff_t *pos)
+   __acquires(x25_route_list_lock)
 {
loff_t l = *pos;
 
@@ -70,6 +71,7 @@ out:
 }
 
 static void x25_seq_route_stop(struct seq_file *seq, void *v)
+   __releases(x25_route_list_lock)
 {
read_unlock_bh(x25_route_list_lock);
 }
@@ -105,6 +107,7 @@ found:
 }
 
 static void *x25_seq_socket_start(struct seq_file *seq, loff_t *pos)
+   __acquires(x25_list_lock)
 {
loff_t l = *pos;
 
@@ -127,6 +130,7 @@ out:
 }
 
 static void x25_seq_socket_stop(struct seq_file *seq, void *v)
+   __releases(x25_list_lock)
 {
read_unlock_bh(x25_list_lock);
 }
@@ -183,6 +187,7 @@ found:
 }
 
 static void *x25_seq_forward_start(struct seq_file *seq, loff_t *pos)
+   __acquires(x25_forward_list_lock)
 {
loff_t l = *pos;
 
@@ -213,6 +218,7 @@ out:
 }
 
 static void x25_seq_forward_stop(struct seq_file *seq, void *v)
+   __releases(x25_forward_list_lock)
 {
read_unlock_bh(x25_forward_list_lock);
 }
diff --git a/net/x25/x25_subr.c b/net/x25/x25_subr.c

[NETFILTER]: kill nf_sysctl.c

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4f536522dae9d5326ad1872cd254ee84681cf563
Commit: 4f536522dae9d5326ad1872cd254ee84681cf563
Parent: 86c0bf4095b35b978540aa43b12840d138a0b376
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Mon Jan 14 23:48:39 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:02:40 2008 -0800

[NETFILTER]: kill nf_sysctl.c

Since there now is generic support for shared sysctl paths, the only
remains are the net/netfilter and net/ipv4/netfilter paths. Move them
to net/netfilter/core.c and net/ipv4/netfilter.c and kill nf_sysctl.c.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/netfilter.c  |   10 ++
 net/netfilter/Makefile|1 -
 net/netfilter/core.c  |9 +
 net/netfilter/nf_sysctl.c |   25 -
 4 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index 0ed843e..6322155 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -211,3 +211,13 @@ static void ipv4_netfilter_fini(void)
 
 module_init(ipv4_netfilter_init);
 module_exit(ipv4_netfilter_fini);
+
+#ifdef CONFIG_SYSCTL
+struct ctl_path nf_net_ipv4_netfilter_sysctl_path[] = {
+   { .procname = net, .ctl_name = CTL_NET, },
+   { .procname = ipv4, .ctl_name = NET_IPV4, },
+   { .procname = netfilter, .ctl_name = NET_IPV4_NETFILTER, },
+   { }
+};
+EXPORT_SYMBOL_GPL(nf_net_ipv4_netfilter_sysctl_path);
+#endif /* CONFIG_SYSCTL */
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile
index c910cae..ea75083 100644
--- a/net/netfilter/Makefile
+++ b/net/netfilter/Makefile
@@ -4,7 +4,6 @@ nf_conntrack-y  := nf_conntrack_core.o 
nf_conntrack_standalone.o nf_conntrack_exp
 nf_conntrack-$(CONFIG_NF_CONNTRACK_EVENTS) += nf_conntrack_ecache.o
 
 obj-$(CONFIG_NETFILTER) = netfilter.o
-obj-$(CONFIG_SYSCTL) += nf_sysctl.o
 
 obj-$(CONFIG_NETFILTER_NETLINK) += nfnetlink.o
 obj-$(CONFIG_NETFILTER_NETLINK_QUEUE) += nfnetlink_queue.o
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index e026344..c4065b8 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -272,3 +272,12 @@ void __init netfilter_init(void)
if (netfilter_log_init()  0)
panic(cannot initialize nf_log);
 }
+
+#ifdef CONFIG_SYSCTL
+struct ctl_path nf_net_netfilter_sysctl_path[] = {
+   { .procname = net, .ctl_name = CTL_NET, },
+   { .procname = netfilter, .ctl_name = NET_NETFILTER, },
+   { }
+};
+EXPORT_SYMBOL_GPL(nf_net_netfilter_sysctl_path);
+#endif /* CONFIG_SYSCTL */
diff --git a/net/netfilter/nf_sysctl.c b/net/netfilter/nf_sysctl.c
deleted file mode 100644
index d9fcc89..000
--- a/net/netfilter/nf_sysctl.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* nf_sysctl.c netfilter sysctl registration/unregistation
- *
- * Copyright (c) 2006 Patrick McHardy [EMAIL PROTECTED]
- */
-#include linux/module.h
-#include linux/sysctl.h
-#include linux/string.h
-#include linux/slab.h
-
-/* net/netfilter */
-struct ctl_path nf_net_netfilter_sysctl_path[] = {
-   { .procname = net, .ctl_name = CTL_NET, },
-   { .procname = netfilter, .ctl_name = NET_NETFILTER, },
-   { }
-};
-EXPORT_SYMBOL_GPL(nf_net_netfilter_sysctl_path);
-
-/* net/ipv4/netfilter */
-struct ctl_path nf_net_ipv4_netfilter_sysctl_path[] = {
-   { .procname = net, .ctl_name = CTL_NET, },
-   { .procname = ipv4, .ctl_name = NET_IPV4, },
-   { .procname = netfilter, .ctl_name = NET_IPV4_NETFILTER, },
-   { }
-};
-EXPORT_SYMBOL_GPL(nf_net_ipv4_netfilter_sysctl_path);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[FIB]: Avoid using static variables without proper locking

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=28d36e3702fcbed73c38e877bcf2a8f8946b7f3d
Commit: 28d36e3702fcbed73c38e877bcf2a8f8946b7f3d
Parent: 39a6d06300128d32f361f4f790beba0ca83730eb
Author: Eric Dumazet [EMAIL PROTECTED]
AuthorDate: Mon Jan 14 23:09:56 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:02:13 2008 -0800

[FIB]: Avoid using static variables without proper locking

fib_trie_seq_show() uses two helper functions, rtn_scope() and
rtn_type() that can write to static storage without locking.

Just pass to them a temporary buffer to avoid potential corruption
(probably not triggerable but still...)

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/fib_trie.c |   22 --
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 18fb739..72c78c2 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2284,10 +2284,8 @@ static void seq_indent(struct seq_file *seq, int n)
while (n--  0) seq_puts(seq,);
 }
 
-static inline const char *rtn_scope(enum rt_scope_t s)
+static inline const char *rtn_scope(char *buf, size_t len, enum rt_scope_t s)
 {
-   static char buf[32];
-
switch (s) {
case RT_SCOPE_UNIVERSE: return universe;
case RT_SCOPE_SITE: return site;
@@ -2295,7 +2293,7 @@ static inline const char *rtn_scope(enum rt_scope_t s)
case RT_SCOPE_HOST: return host;
case RT_SCOPE_NOWHERE:  return nowhere;
default:
-   snprintf(buf, sizeof(buf), scope=%d, s);
+   snprintf(buf, len, scope=%d, s);
return buf;
}
 }
@@ -2315,13 +2313,11 @@ static const char *rtn_type_names[__RTN_MAX] = {
[RTN_XRESOLVE] = XRESOLVE,
 };
 
-static inline const char *rtn_type(unsigned t)
+static inline const char *rtn_type(char *buf, size_t len, unsigned t)
 {
-   static char buf[32];
-
if (t  __RTN_MAX  rtn_type_names[t])
return rtn_type_names[t];
-   snprintf(buf, sizeof(buf), type %u, t);
+   snprintf(buf, len, type %u, t);
return buf;
 }
 
@@ -2359,13 +2355,19 @@ static int fib_trie_seq_show(struct seq_file *seq, void 
*v)
seq_printf(seq,   |-- %d.%d.%d.%d\n, NIPQUAD(val));
for (i = 32; i = 0; i--) {
struct leaf_info *li = find_leaf_info(l, i);
+
if (li) {
struct fib_alias *fa;
+
list_for_each_entry_rcu(fa, li-falh, fa_list) 
{
+   char buf1[32], buf2[32];
+
seq_indent(seq, iter-depth+1);
seq_printf(seq,   /%d %s %s, i,
-  rtn_scope(fa-fa_scope),
-  rtn_type(fa-fa_type));
+  rtn_scope(buf1, sizeof(buf1),
+fa-fa_scope),
+  rtn_type(buf2, sizeof(buf2),
+fa-fa_type));
if (fa-fa_tos)
seq_printf(seq, tos =%d\n,
   fa-fa_tos);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: remove ipt_TOS.c

2008-01-29 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=11fa2aa362fa54b9eaa8adce9a89f9b467cc9214
Commit: 11fa2aa362fa54b9eaa8adce9a89f9b467cc9214
Parent: 8ce22fcab432313717d393c96ad35f0aee016e83
Author: Jan Engelhardt [EMAIL PROTECTED]
AuthorDate: Mon Jan 14 23:32:13 2008 -0800
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Mon Jan 28 15:02:17 2008 -0800

[NETFILTER]: remove ipt_TOS.c

Commit 88c85d81f74f92371745158aebc5cbf490412002 forgot to remove the
old ipt_TOS file (whose code has been merged into xt_DSCP). Remove
it now.

Signed-off-by: Jan Engelhardt [EMAIL PROTECTED]
Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/netfilter/ipt_TOS.c |   82 --
 1 files changed, 0 insertions(+), 82 deletions(-)

diff --git a/net/ipv4/netfilter/ipt_TOS.c b/net/ipv4/netfilter/ipt_TOS.c
deleted file mode 100644
index 1a92441..000
--- a/net/ipv4/netfilter/ipt_TOS.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* This is a module which is used for setting the TOS field of a packet. */
-
-/* (C) 1999-2001 Paul `Rusty' Russell
- * (C) 2002-2004 Netfilter Core Team [EMAIL PROTECTED]
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include linux/module.h
-#include linux/skbuff.h
-#include linux/ip.h
-#include net/checksum.h
-
-#include linux/netfilter/x_tables.h
-#include linux/netfilter_ipv4/ipt_TOS.h
-
-MODULE_LICENSE(GPL);
-MODULE_AUTHOR(Netfilter Core Team [EMAIL PROTECTED]);
-MODULE_DESCRIPTION(iptables TOS mangling module);
-
-static unsigned int
-tos_tg(struct sk_buff *skb, const struct net_device *in,
-   const struct net_device *out, unsigned int hooknum,
-   const struct xt_target *target, const void *targinfo)
-{
-   const struct ipt_tos_target_info *tosinfo = targinfo;
-   struct iphdr *iph = ip_hdr(skb);
-
-   if ((iph-tos  IPTOS_TOS_MASK) != tosinfo-tos) {
-   __u8 oldtos;
-   if (!skb_make_writable(skb, sizeof(struct iphdr)))
-   return NF_DROP;
-   iph = ip_hdr(skb);
-   oldtos = iph-tos;
-   iph-tos = (iph-tos  IPTOS_PREC_MASK) | tosinfo-tos;
-   csum_replace2(iph-check, htons(oldtos), htons(iph-tos));
-   }
-   return XT_CONTINUE;
-}
-
-static bool
-tos_tg_check(const char *tablename, const void *e_void,
- const struct xt_target *target, void *targinfo,
- unsigned int hook_mask)
-{
-   const u_int8_t tos = ((struct ipt_tos_target_info *)targinfo)-tos;
-
-   if (tos != IPTOS_LOWDELAY
-tos != IPTOS_THROUGHPUT
-tos != IPTOS_RELIABILITY
-tos != IPTOS_MINCOST
-tos != IPTOS_NORMALSVC) {
-   printk(KERN_WARNING TOS: bad tos value %#x\n, tos);
-   return false;
-   }
-   return true;
-}
-
-static struct xt_target tos_tg_reg __read_mostly = {
-   .name   = TOS,
-   .family = AF_INET,
-   .target = tos_tg,
-   .targetsize = sizeof(struct ipt_tos_target_info),
-   .table  = mangle,
-   .checkentry = tos_tg_check,
-   .me = THIS_MODULE,
-};
-
-static int __init tos_tg_init(void)
-{
-   return xt_register_target(tos_tg_reg);
-}
-
-static void __exit tos_tg_exit(void)
-{
-   xt_unregister_target(tos_tg_reg);
-}
-
-module_init(tos_tg_init);
-module_exit(tos_tg_exit);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


<    1   2   3   4   5   6   7   8   9   10   >