* [PATCH 14/20] net/ipv4/cipso_ipv4.c: use LIST_HEAD instead of LIST_HEAD_INIT
From: Denis Cheng @ 2007-12-06 16:04 UTC (permalink / raw)
To: netdev; +Cc: Andrew Morton, linux-kernel
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 <crquan@gmail.com>
---
net/ipv4/cipso_ipv4.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index f18e88b..d4dc4eb 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -63,7 +63,7 @@ struct cipso_v4_domhsh_entry {
* probably be turned into a hash table or something similar so we
* can do quick lookups. */
static DEFINE_SPINLOCK(cipso_v4_doi_list_lock);
-static struct list_head cipso_v4_doi_list = LIST_HEAD_INIT(cipso_v4_doi_list);
+static LIST_HEAD(cipso_v4_doi_list);
/* Label mapping cache */
int cipso_v4_cache_enabled = 1;
--
1.5.3.4
^ permalink raw reply related
* [PATCH 13/20] net/core/dev.c: use LIST_HEAD instead of LIST_HEAD_INIT
From: Denis Cheng @ 2007-12-06 16:01 UTC (permalink / raw)
To: netdev; +Cc: Andrew Morton, linux-kernel
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 <crquan@gmail.com>
---
net/core/dev.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 86d6261..7626db4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3501,7 +3501,7 @@ static int dev_new_index(struct net *net)
/* Delayed registration/unregisteration */
static DEFINE_SPINLOCK(net_todo_list_lock);
-static struct list_head net_todo_list = LIST_HEAD_INIT(net_todo_list);
+static LIST_HEAD(net_todo_list);
static void net_set_todo(struct net_device *dev)
{
--
1.5.3.4
^ permalink raw reply related
* [PATCH] virtio_net: Fix stalled inbound traffic on early packets
From: Christian Borntraeger @ 2007-12-06 15:59 UTC (permalink / raw)
To: Rusty Russell; +Cc: netdev, virtualization, Anthony Liguori
The current virtio_net driver has a startup race, which prevents any
incoming traffic:
If try_fill_recv submits buffers to the host system data might be
filled in and an interrupt is sent, before napi_enable finishes.
In that case the interrupt will kick skb_recv_done which will then
call netif_rx_schedule. netif_rx_schedule checks, if NAPI_STATE_SCHED
is set - which is not as we did not run napi_enable. No poll routine
is scheduled. Furthermore, skb_recv_done returns false, we disables
interrupts for this device.
One solution is the enable napi before inbound buffer are available.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
drivers/net/virtio_net.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: kvm/drivers/net/virtio_net.c
===================================================================
--- kvm.orig/drivers/net/virtio_net.c
+++ kvm/drivers/net/virtio_net.c
@@ -285,13 +285,15 @@ static int virtnet_open(struct net_devic
{
struct virtnet_info *vi = netdev_priv(dev);
+ napi_enable(&vi->napi);
try_fill_recv(vi);
/* If we didn't even get one input buffer, we're useless. */
- if (vi->num == 0)
+ if (vi->num == 0) {
+ napi_disable(&vi->napi);
return -ENOMEM;
+ }
- napi_enable(&vi->napi);
return 0;
}
^ permalink raw reply
* [PATCH 2.6.25] net: move trie_local and trie_main into the proc iterator
From: Denis V. Lunev @ 2007-12-06 15:00 UTC (permalink / raw)
To: davem; +Cc: containers, devel, netdev, ebiederm
From: Eric W. Biederman <ebiederm@xmission.com>
We only use these variables when displaying the trie in proc so
place them into the iterator to make this explicit. We should
probably do something smarter to handle the CONFIG_IP_MULTIPLE_TABLES
case but at least this makes it clear that the silliness is limited
to the display in /proc.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/ipv4/fib_trie.c | 47 ++++++++++++++++++++++++++++++++++-------------
1 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 8d8c291..6385cca 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -164,7 +164,6 @@ static struct tnode *halve(struct trie *t, struct tnode *tn);
static void tnode_free(struct tnode *tn);
static struct kmem_cache *fn_alias_kmem __read_mostly;
-static struct trie *trie_local = NULL, *trie_main = NULL;
static inline struct tnode *node_parent(struct node *node)
{
@@ -2000,11 +1999,6 @@ struct fib_table * __init fib_hash_init(u32 id)
trie_init(t);
if (id == RT_TABLE_LOCAL)
- trie_local = t;
- else if (id == RT_TABLE_MAIN)
- trie_main = t;
-
- if (id == RT_TABLE_LOCAL)
printk(KERN_INFO "IPv4 FIB: Using LC-trie version %s\n", VERSION);
return tb;
@@ -2013,6 +2007,7 @@ struct fib_table * __init fib_hash_init(u32 id)
#ifdef CONFIG_PROC_FS
/* Depth first Trie walk iterator */
struct fib_trie_iter {
+ struct trie *trie_local, *trie_main;
struct tnode *tnode;
struct trie *trie;
unsigned index;
@@ -2179,7 +2174,20 @@ static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat)
static int fib_triestat_seq_show(struct seq_file *seq, void *v)
{
+ struct trie *trie_local, *trie_main;
struct trie_stat *stat;
+ struct fib_table *tb;
+
+ trie_local = NULL;
+ tb = fib_get_table(RT_TABLE_LOCAL);
+ if (tb)
+ trie_local = (struct trie *) tb->tb_data;
+
+ trie_main = NULL;
+ tb = fib_get_table(RT_TABLE_MAIN);
+ if (tb)
+ trie_main = (struct trie *) tb->tb_data;
+
stat = kmalloc(sizeof(*stat), GFP_KERNEL);
if (!stat)
@@ -2223,13 +2231,13 @@ static struct node *fib_trie_get_idx(struct fib_trie_iter *iter,
loff_t idx = 0;
struct node *n;
- for (n = fib_trie_get_first(iter, trie_local);
+ for (n = fib_trie_get_first(iter, iter->trie_local);
n; ++idx, n = fib_trie_get_next(iter)) {
if (pos == idx)
return n;
}
- for (n = fib_trie_get_first(iter, trie_main);
+ for (n = fib_trie_get_first(iter, iter->trie_main);
n; ++idx, n = fib_trie_get_next(iter)) {
if (pos == idx)
return n;
@@ -2239,10 +2247,23 @@ static struct node *fib_trie_get_idx(struct fib_trie_iter *iter,
static void *fib_trie_seq_start(struct seq_file *seq, loff_t *pos)
{
+ struct fib_trie_iter *iter = seq->private;
+ struct fib_table *tb;
+
+ if (!iter->trie_local) {
+ tb = fib_get_table(RT_TABLE_LOCAL);
+ if (tb)
+ iter->trie_local = (struct trie *) tb->tb_data;
+ }
+ if (!iter->trie_main) {
+ tb = fib_get_table(RT_TABLE_MAIN);
+ if (tb)
+ iter->trie_main = (struct trie *) tb->tb_data;
+ }
rcu_read_lock();
if (*pos == 0)
return SEQ_START_TOKEN;
- return fib_trie_get_idx(seq->private, *pos - 1);
+ return fib_trie_get_idx(iter, *pos - 1);
}
static void *fib_trie_seq_next(struct seq_file *seq, void *v, loff_t *pos)
@@ -2260,8 +2281,8 @@ static void *fib_trie_seq_next(struct seq_file *seq, void *v, loff_t *pos)
return v;
/* continue scan in next trie */
- if (iter->trie == trie_local)
- return fib_trie_get_first(iter, trie_main);
+ if (iter->trie == iter->trie_local)
+ return fib_trie_get_first(iter, iter->trie_main);
return NULL;
}
@@ -2327,7 +2348,7 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v)
return 0;
if (!node_parent(n)) {
- if (iter->trie == trie_local)
+ if (iter->trie == iter->trie_local)
seq_puts(seq, "<local>:\n");
else
seq_puts(seq, "<main>:\n");
@@ -2426,7 +2447,7 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
return 0;
}
- if (iter->trie == trie_local)
+ if (iter->trie == iter->trie_local)
return 0;
if (IS_TNODE(l))
return 0;
--
1.5.3.rc5
^ permalink raw reply related
* [PATCH 2.6.25] Remove ip_fib_local_table and ip_fib_main_table defines
From: Denis V. Lunev @ 2007-12-06 14:58 UTC (permalink / raw)
To: davem; +Cc: containers, devel, netdev, ebiederm
From: Eric W. Biederman <ebiederm@xmission.com>
There are only 2 users and it doesn't hurt to call fib_get_table
instead, and it makes it easier to make the fib network namespace
aware.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
include/net/ip_fib.h | 3 ---
net/ipv4/fib_hash.c | 5 +++--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index ed514bf..690fb4d 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -191,9 +191,6 @@ extern void __init fib4_rules_init(void);
extern u32 fib_rules_tclass(struct fib_result *res);
#endif
-#define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL)
-#define ip_fib_main_table fib_get_table(RT_TABLE_MAIN)
-
extern int fib_lookup(struct flowi *flp, struct fib_result *res);
extern struct fib_table *fib_new_table(u32 id);
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index 9d0cee2..30ff657 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -810,7 +810,8 @@ struct fib_iter_state {
static struct fib_alias *fib_get_first(struct seq_file *seq)
{
struct fib_iter_state *iter = seq->private;
- struct fn_hash *table = (struct fn_hash *) ip_fib_main_table->tb_data;
+ struct fib_table *main_table = fib_get_table(RT_TABLE_MAIN);
+ struct fn_hash *table = (struct fn_hash *)main_table->tb_data;
iter->bucket = 0;
iter->hash_head = NULL;
@@ -949,7 +950,7 @@ static void *fib_seq_start(struct seq_file *seq, loff_t *pos)
void *v = NULL;
read_lock(&fib_hash_lock);
- if (ip_fib_main_table)
+ if (fib_get_table(RT_TABLE_MAIN))
v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
return v;
}
--
1.5.3.rc5
^ permalink raw reply related
* Re: [Patch] net/xfrm/xfrm_policy.c: Some small improvements
From: Richard Knutsson @ 2007-12-06 14:37 UTC (permalink / raw)
To: David Miller; +Cc: xiyou.wangcong, linux-kernel, herbert, akpm, netdev
In-Reply-To: <20071206.031434.179419183.davem@davemloft.net>
David Miller wrote:
> From: WANG Cong <xiyou.wangcong@gmail.com>
> Date: Thu, 6 Dec 2007 19:01:23 +0800
>
>
>> This patch contains the following changes.
>>
>> - Use 'bool' instead of 'int' for booleans.
>> - Use 'size_t' instead of 'int' for 'sizeof' return value.
>> - Some style fixes.
>>
>> Cc: Herbert Xu <herbert@gondor.apana.org.au>
>> Cc: David Miller <davem@davemloft.net>
>> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
>>
>
> Normally I would let a patch like this sit in my mailbox
> for a week and then delete it.
>
That is evil! ;)
> But this time I'll just let you know up front that I
> don't see much value in this patch. It is not a clear
> improvement to replace int's with bool's in my mind and
> the other changes are just whitespace changes.
>
Is it not an improvement to distinct booleans from actual values? Do you
use integers for ASCII characters too? It can also avoid some potential
bugs like the 'if (i == TRUE)'...
What is wrong with 'size_t' (since it is unsigned, compared to (some)
'int')?
/Richard Knutsson
^ permalink raw reply
* Re: sockets affected by IPsec always block (2.6.23)
From: Stefan Rompf @ 2007-12-06 14:31 UTC (permalink / raw)
To: David Miller; +Cc: herbert, simon, linux-kernel, netdev
In-Reply-To: <20071206.055515.180308628.davem@davemloft.net>
Am Donnerstag, 6. Dezember 2007 14:55 schrieb David Miller:
> You keep ignoring the fact that, as Herbert and I discussed, not
> blocking for IPSEC resolution will make some connect() cases fail that
> would otherwise not fail.
>
> There are two sides to this issue, and we need to consider them
> both.
as far as I've understood Herbert's patch, at least TCP connect can be fixed
so that non blocking connect() will neither fail nor block, but just use the
first or second retransmission of the SYN packet to complete the handshake
after IPSEC is up. As this will fix the common breakage case, just do so and
keep UDP sendmsg() etc for later.
You are looking at this issue too much from the kernel side. Admitted, this is
a corner case, but therefore nobody cares if connection completion takes two
SYNs and three seconds instead of one SYN and may be two seconds. But
application developers and users will validly complain if their applications
block unexpectedly for hours just because some random provider has a network
outage and IPSEC cannot come up.
Stefan
^ permalink raw reply
* Re: [PATCH][VLAN] Lost rtnl_unlock() in vlan_ioctl()
From: Patrick McHardy @ 2007-12-06 14:10 UTC (permalink / raw)
To: David Miller; +Cc: xemul, netdev, devel
In-Reply-To: <20071206.060151.154858451.davem@davemloft.net>
David Miller wrote:
> From: Patrick McHardy <kaber@trash.net>
> Date: Thu, 06 Dec 2007 14:59:24 +0100
>
>> Pavel Emelyanov wrote:
>>> The SET_VLAN_NAME_TYPE_CMD command w/o CAP_NET_ADMIN capability
>>> doesn't release the rtnl lock.
>>
>> Thanks Pavel. I somehow recall that we already fixed this
>> one, but can't find the patch :) Dave, please apply.
>
> I think we even added this bug to -stable, or something like
> that, didn't we? Yikes...
No, I mixed those two patches up as well. The bug was introduced
with the vlan_netlink stuff, the -stable patch fixed an invalid
return value, but still properly dropped the lock.
This patch should of course go in -stable anyway.
^ permalink raw reply
* Re: [RFC2][PATCH 7/7] [TFRC]: New rx history code
From: Arnaldo Carvalho de Melo @ 2007-12-06 14:07 UTC (permalink / raw)
To: Gerrit Renker, dccp, netdev, Arnaldo Carvalho de Melo
In-Reply-To: <20071206140225.GD7484@gerrit.erg.abdn.ac.uk>
Em Thu, Dec 06, 2007 at 02:02:25PM +0000, Gerrit Renker escreveu:
> | The first six patches in this series are unmodified, so if you
> | are OK with them please send me your Signed-off-by.
> Patches [1/7], [2/7], and [6/7] already have a signed-off and there are
> no changes. Just acknowledged [3..5/7], will look at [7/7] now.
OK, please let me know if there are still any problems.
The removal of timestamp insertion in ccid3_hc_rx_insert_options will be
put in another cset.
- Arnaldo
^ permalink raw reply
* [patch 2/6] ipv6 - make xfrm6_init to return an error code
From: Daniel Lezcano @ 2007-12-06 13:53 UTC (permalink / raw)
To: davem; +Cc: yoshfuji, pekkas, netdev, Benjamin Thery
In-Reply-To: <20071206135329.598202596@ICON-9-164-138-215.megacenter.de.ibm.com>
[-- Attachment #1: xfrm-handle-error-at-init.patch --]
[-- Type: text/plain, Size: 2709 bytes --]
The xfrm initialization function does not return any error code, so
if there is an error, the caller can not be advise of that.
This patch checks the return code of the different called functions
in order to return a successful or failed initialization.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Benjamin Thery <benjamin.thery@bull.net>
---
include/net/xfrm.h | 4 ++--
net/ipv6/xfrm6_policy.c | 22 +++++++++++++++++-----
net/ipv6/xfrm6_state.c | 4 ++--
3 files changed, 21 insertions(+), 9 deletions(-)
Index: net-2.6.25/include/net/xfrm.h
===================================================================
--- net-2.6.25.orig/include/net/xfrm.h
+++ net-2.6.25/include/net/xfrm.h
@@ -1066,11 +1066,11 @@ struct xfrm6_tunnel {
extern void xfrm_init(void);
extern void xfrm4_init(void);
-extern void xfrm6_init(void);
+extern int xfrm6_init(void);
extern void xfrm6_fini(void);
extern void xfrm_state_init(void);
extern void xfrm4_state_init(void);
-extern void xfrm6_state_init(void);
+extern int xfrm6_state_init(void);
extern void xfrm6_state_fini(void);
extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *);
Index: net-2.6.25/net/ipv6/xfrm6_policy.c
===================================================================
--- net-2.6.25.orig/net/ipv6/xfrm6_policy.c
+++ net-2.6.25/net/ipv6/xfrm6_policy.c
@@ -269,9 +269,9 @@ static struct xfrm_policy_afinfo xfrm6_p
.fill_dst = xfrm6_fill_dst,
};
-static void __init xfrm6_policy_init(void)
+static int __init xfrm6_policy_init(void)
{
- xfrm_policy_register_afinfo(&xfrm6_policy_afinfo);
+ return xfrm_policy_register_afinfo(&xfrm6_policy_afinfo);
}
static void xfrm6_policy_fini(void)
@@ -279,10 +279,22 @@ static void xfrm6_policy_fini(void)
xfrm_policy_unregister_afinfo(&xfrm6_policy_afinfo);
}
-void __init xfrm6_init(void)
+int __init xfrm6_init(void)
{
- xfrm6_policy_init();
- xfrm6_state_init();
+ int ret;
+
+ ret = xfrm6_policy_init();
+ if (ret)
+ goto out;
+
+ ret = xfrm6_state_init();
+ if (ret)
+ goto out_policy;
+out:
+ return ret;
+out_policy:
+ xfrm6_policy_fini();
+ goto out;
}
void xfrm6_fini(void)
Index: net-2.6.25/net/ipv6/xfrm6_state.c
===================================================================
--- net-2.6.25.orig/net/ipv6/xfrm6_state.c
+++ net-2.6.25/net/ipv6/xfrm6_state.c
@@ -198,9 +198,9 @@ static struct xfrm_state_afinfo xfrm6_st
.transport_finish = xfrm6_transport_finish,
};
-void __init xfrm6_state_init(void)
+int __init xfrm6_state_init(void)
{
- xfrm_state_register_afinfo(&xfrm6_state_afinfo);
+ return xfrm_state_register_afinfo(&xfrm6_state_afinfo);
}
void xfrm6_state_fini(void)
--
^ permalink raw reply
* [patch 1/6] ipv6 - make fib6_init to return an error code
From: Daniel Lezcano @ 2007-12-06 13:53 UTC (permalink / raw)
To: davem; +Cc: yoshfuji, pekkas, netdev, Benjamin Thery
In-Reply-To: <20071206135329.598202596@ICON-9-164-138-215.megacenter.de.ibm.com>
[-- Attachment #1: ip6_fib-handle-error-at-init.patch --]
[-- Type: text/plain, Size: 1652 bytes --]
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 <dlezcano@fr.ibm.com>
Acked-by: Benjamin Thery <benjamin.thery@bull.net>
---
include/net/ip6_fib.h | 2 +-
net/ipv6/ip6_fib.c | 14 +++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
Index: net-2.6.25/include/net/ip6_fib.h
===================================================================
--- net-2.6.25.orig/include/net/ip6_fib.h
+++ net-2.6.25/include/net/ip6_fib.h
@@ -224,7 +224,7 @@ extern void fib6_run_gc(unsigned long
extern void fib6_gc_cleanup(void);
-extern void fib6_init(void);
+extern int fib6_init(void);
extern void fib6_rules_init(void);
extern void fib6_rules_cleanup(void);
Index: net-2.6.25/net/ipv6/ip6_fib.c
===================================================================
--- net-2.6.25.orig/net/ipv6/ip6_fib.c
+++ net-2.6.25/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)
--
^ permalink raw reply
* [patch 6/6] ipv6 - route6/fib6 : dont panic a kmem_cache_create
From: Daniel Lezcano @ 2007-12-06 13:53 UTC (permalink / raw)
To: davem; +Cc: yoshfuji, pekkas, netdev, Benjamin Thery
In-Reply-To: <20071206135329.598202596@ICON-9-164-138-215.megacenter.de.ibm.com>
[-- Attachment #1: ip6_fib-dont-panic-on-kmem_cache-creation-error.patch --]
[-- Type: text/plain, Size: 1732 bytes --]
If the kmem_cache_creation fails, the kernel will panic. It is acceptable
if the system is booting, but if the ipv6 protocol is compiled as a module
and it is loaded after the system has booted, do we want to panic instead
of just failing to initialize the protocol ?
The init function is now returning an error and this one is checked for
protocol initialization. So the ipv6 protocol will safely fails.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Benjamin Thery <benjamin.thery@bull.net>
---
net/ipv6/ip6_fib.c | 5 ++++-
net/ipv6/route.c | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
Index: net-2.6.25/net/ipv6/ip6_fib.c
===================================================================
--- net-2.6.25.orig/net/ipv6/ip6_fib.c
+++ net-2.6.25/net/ipv6/ip6_fib.c
@@ -1478,8 +1478,11 @@ 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,
+ 0, SLAB_HWCACHE_ALIGN,
NULL);
+ if (!fib6_node_kmem)
+ return -ENOMEM;
+
fib6_tables_init();
ret = __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib);
Index: net-2.6.25/net/ipv6/route.c
===================================================================
--- net-2.6.25.orig/net/ipv6/route.c
+++ net-2.6.25/net/ipv6/route.c
@@ -2466,7 +2466,10 @@ int __init ip6_route_init(void)
ip6_dst_ops.kmem_cachep =
kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0,
- SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
+ SLAB_HWCACHE_ALIGN, NULL);
+ if (!ip6_dst_ops.kmem_cachep)
+ return -ENOMEM;
+
ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops.kmem_cachep;
ret = fib6_init();
--
^ permalink raw reply
* [patch 0/6] ipv6 - ipv6 routing initialization
From: Daniel Lezcano @ 2007-12-06 13:53 UTC (permalink / raw)
To: davem; +Cc: yoshfuji, pekkas, netdev
This patchset provides modifications around the routes initialization
for ipv6. Actually the init functions does not return an error code
so the protocol can not be notified that there were an error while
initializing the routing subsystems.
The patchset make the init functions to return an error code, so the ipv6
can safely handle the error and fail gracefully.
The error code can also let to catch the kmem_cache_creation failure without
doing a radical panic. That's allow just to fail to load the ipv6 module without
crashing down the machine.
--
^ permalink raw reply
* [patch 4/6] ipv6 - make ip6_route_init to return an error code
From: Daniel Lezcano @ 2007-12-06 13:53 UTC (permalink / raw)
To: davem; +Cc: yoshfuji, pekkas, netdev, Benjamin Thery
In-Reply-To: <20071206135329.598202596@ICON-9-164-138-215.megacenter.de.ibm.com>
[-- Attachment #1: route6-handle-error-at-init.patch --]
[-- Type: text/plain, Size: 3747 bytes --]
The route initialization function does not return any value to notify if
the initialization is successful or not. This patch checks all calls made
for the initilization in order to return a value for the caller.
Unfortunatly, proc_net_fops_create will return a NULL pointer if CONFIG_PROC_FS
is off, so we can not check the return code without an ifdef CONFIG_PROC_FS
block in the ip6_route_init function.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Benjamin Thery <benjamin.thery@bull.net>
---
include/net/ip6_route.h | 2 -
net/ipv6/route.c | 66 +++++++++++++++++++++++++++++++++++++++---------
2 files changed, 55 insertions(+), 13 deletions(-)
Index: net-2.6.25/include/net/ip6_route.h
===================================================================
--- net-2.6.25.orig/include/net/ip6_route.h
+++ net-2.6.25/include/net/ip6_route.h
@@ -50,7 +50,7 @@ extern void ip6_route_input(struct sk_
extern struct dst_entry * ip6_route_output(struct sock *sk,
struct flowi *fl);
-extern void ip6_route_init(void);
+extern int ip6_route_init(void);
extern void ip6_route_cleanup(void);
extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg);
Index: net-2.6.25/net/ipv6/route.c
===================================================================
--- net-2.6.25.orig/net/ipv6/route.c
+++ net-2.6.25/net/ipv6/route.c
@@ -2460,26 +2460,70 @@ ctl_table ipv6_route_table[] = {
#endif
-void __init ip6_route_init(void)
+int __init ip6_route_init(void)
{
+ int ret;
+
ip6_dst_ops.kmem_cachep =
kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0,
SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops.kmem_cachep;
- fib6_init();
- proc_net_fops_create(&init_net, "ipv6_route", 0, &ipv6_route_proc_fops);
- proc_net_fops_create(&init_net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops);
+ ret = fib6_init();
+ 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))
+ 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
- xfrm6_init();
+ ret = xfrm6_init();
+ if (ret)
+ goto out_proc_rt6_stats;
#endif
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
- fib6_rules_init();
-#endif
+ ret = fib6_rules_init();
+ if (ret)
+ goto xfrm6_init;
+#endif
+ ret = -ENOBUFS;
+ if (__rtnl_register(PF_INET6, RTM_NEWROUTE, inet6_rtm_newroute, NULL) ||
+ __rtnl_register(PF_INET6, RTM_DELROUTE, inet6_rtm_delroute, NULL) ||
+ __rtnl_register(PF_INET6, RTM_GETROUTE, inet6_rtm_getroute, NULL))
+ goto fib6_rules_init;
+
+ ret = 0;
+out:
+ return ret;
- __rtnl_register(PF_INET6, RTM_NEWROUTE, inet6_rtm_newroute, NULL);
- __rtnl_register(PF_INET6, RTM_DELROUTE, inet6_rtm_delroute, NULL);
- __rtnl_register(PF_INET6, RTM_GETROUTE, inet6_rtm_getroute, NULL);
+fib6_rules_init:
+#ifdef CONFIG_IPV6_MULTIPLE_TABLES
+ fib6_rules_cleanup();
+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_fib6_init:
+#endif
+ rt6_ifdown(NULL);
+ fib6_gc_cleanup();
+out_kmem_cache:
+ kmem_cache_destroy(ip6_dst_ops.kmem_cachep);
+ goto out;
}
void ip6_route_cleanup(void)
@@ -2487,10 +2531,8 @@ void ip6_route_cleanup(void)
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
fib6_rules_cleanup();
#endif
-#ifdef CONFIG_PROC_FS
proc_net_remove(&init_net, "ipv6_route");
proc_net_remove(&init_net, "rt6_stats");
-#endif
#ifdef CONFIG_XFRM
xfrm6_fini();
#endif
--
^ permalink raw reply
* [patch 5/6] ipv6 - make af_inet6 to check ip6_route_init return value
From: Daniel Lezcano @ 2007-12-06 13:53 UTC (permalink / raw)
To: davem; +Cc: yoshfuji, pekkas, netdev, Benjamin Thery
In-Reply-To: <20071206135329.598202596@ICON-9-164-138-215.megacenter.de.ibm.com>
[-- Attachment #1: af_inet6-handle-subsystem-errors-at-init.patch --]
[-- Type: text/plain, Size: 1377 bytes --]
The af_inet6 initialization function does not check the return code
of the route initilization, so if something goes wrong, the protocol
initialization will continue anyway.
This patch takes into account the modification made in the different
route's initialization subroutines to check the return value and to
make the protocol initialization to fail.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Benjamin Thery <benjamin.thery@bull.net>
---
net/ipv6/af_inet6.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Index: net-2.6.25/net/ipv6/af_inet6.c
===================================================================
--- net-2.6.25.orig/net/ipv6/af_inet6.c
+++ net-2.6.25/net/ipv6/af_inet6.c
@@ -849,7 +849,9 @@ static int __init inet6_init(void)
if (if6_proc_init())
goto proc_if6_fail;
#endif
- ip6_route_init();
+ err = ip6_route_init();
+ if (err)
+ goto ip6_route_fail;
ip6_flowlabel_init();
err = addrconf_init();
if (err)
@@ -874,6 +876,7 @@ out:
addrconf_fail:
ip6_flowlabel_cleanup();
ip6_route_cleanup();
+ip6_route_fail:
#ifdef CONFIG_PROC_FS
if6_proc_exit();
proc_if6_fail:
@@ -904,6 +907,7 @@ icmp_fail:
cleanup_ipv6_mibs();
out_unregister_sock:
sock_unregister(PF_INET6);
+ rtnl_unregister_all(PF_INET6);
out_unregister_raw_proto:
proto_unregister(&rawv6_prot);
out_unregister_udplite_proto:
--
^ permalink raw reply
* [patch 3/6] ipv6 - make fib6_rules_init to return an error code
From: Daniel Lezcano @ 2007-12-06 13:53 UTC (permalink / raw)
To: davem; +Cc: yoshfuji, pekkas, netdev, Benjamin Thery
In-Reply-To: <20071206135329.598202596@ICON-9-164-138-215.megacenter.de.ibm.com>
[-- Attachment #1: fib6_rules-handle-error-at-init.patch --]
[-- Type: text/plain, Size: 3003 bytes --]
When the fib_rules initialization finished, no return code is provided
so there is no way to know, for the caller, if the initialization has
been successful or has failed. This patch fix that.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Benjamin Thery <benjamin.thery@bull.net>
---
include/net/fib_rules.h | 1 +
include/net/ip6_fib.h | 2 +-
net/core/fib_rules.c | 5 +++--
net/ipv6/fib6_rules.c | 19 ++++++++++++++++---
4 files changed, 21 insertions(+), 6 deletions(-)
Index: net-2.6.25/include/net/ip6_fib.h
===================================================================
--- net-2.6.25.orig/include/net/ip6_fib.h
+++ net-2.6.25/include/net/ip6_fib.h
@@ -226,7 +226,7 @@ extern void fib6_gc_cleanup(void);
extern int fib6_init(void);
-extern void fib6_rules_init(void);
+extern int fib6_rules_init(void);
extern void fib6_rules_cleanup(void);
#endif
Index: net-2.6.25/net/ipv6/fib6_rules.c
===================================================================
--- net-2.6.25.orig/net/ipv6/fib6_rules.c
+++ net-2.6.25/net/ipv6/fib6_rules.c
@@ -265,10 +265,23 @@ static int __init fib6_default_rules_ini
return 0;
}
-void __init fib6_rules_init(void)
+int __init fib6_rules_init(void)
{
- BUG_ON(fib6_default_rules_init());
- fib_rules_register(&fib6_rules_ops);
+ int ret;
+
+ ret = fib6_default_rules_init();
+ if (ret)
+ goto out;
+
+ ret = fib_rules_register(&fib6_rules_ops);
+ if (ret)
+ goto out_default_rules_init;
+out:
+ return ret;
+
+out_default_rules_init:
+ fib_rules_cleanup_ops(&fib6_rules_ops);
+ goto out;
}
void fib6_rules_cleanup(void)
Index: net-2.6.25/include/net/fib_rules.h
===================================================================
--- net-2.6.25.orig/include/net/fib_rules.h
+++ net-2.6.25/include/net/fib_rules.h
@@ -103,6 +103,7 @@ static inline u32 frh_get_table(struct f
extern int fib_rules_register(struct fib_rules_ops *);
extern int fib_rules_unregister(struct fib_rules_ops *);
+extern void fib_rules_cleanup_ops(struct fib_rules_ops *);
extern int fib_rules_lookup(struct fib_rules_ops *,
struct flowi *, int flags,
Index: net-2.6.25/net/core/fib_rules.c
===================================================================
--- net-2.6.25.orig/net/core/fib_rules.c
+++ net-2.6.25/net/core/fib_rules.c
@@ -102,7 +102,7 @@ errout:
EXPORT_SYMBOL_GPL(fib_rules_register);
-static void cleanup_ops(struct fib_rules_ops *ops)
+void fib_rules_cleanup_ops(struct fib_rules_ops *ops)
{
struct fib_rule *rule, *tmp;
@@ -111,6 +111,7 @@ static void cleanup_ops(struct fib_rules
fib_rule_put(rule);
}
}
+EXPORT_SYMBOL_GPL(fib_rules_cleanup_ops);
int fib_rules_unregister(struct fib_rules_ops *ops)
{
@@ -121,7 +122,7 @@ int fib_rules_unregister(struct fib_rule
list_for_each_entry(o, &rules_ops, list) {
if (o == ops) {
list_del_rcu(&o->list);
- cleanup_ops(ops);
+ fib_rules_cleanup_ops(ops);
goto out;
}
}
--
^ permalink raw reply
* Re: [RFC2][PATCH 7/7] [TFRC]: New rx history code
From: Gerrit Renker @ 2007-12-06 14:02 UTC (permalink / raw)
To: dccp, netdev; +Cc: Arnaldo Carvalho de Melo
In-Reply-To: <20071206130309.GU4653@ghostprotocols.net>
| The first six patches in this series are unmodified, so if you
| are OK with them please send me your Signed-off-by.
Patches [1/7], [2/7], and [6/7] already have a signed-off and there are
no changes. Just acknowledged [3..5/7], will look at [7/7] now.
Cheers
Gerrit
^ permalink raw reply
* Re: [PATCH][VLAN] Lost rtnl_unlock() in vlan_ioctl()
From: David Miller @ 2007-12-06 14:01 UTC (permalink / raw)
To: kaber; +Cc: xemul, netdev, devel
In-Reply-To: <4758003C.9080105@trash.net>
From: Patrick McHardy <kaber@trash.net>
Date: Thu, 06 Dec 2007 14:59:24 +0100
> Pavel Emelyanov wrote:
> > The SET_VLAN_NAME_TYPE_CMD command w/o CAP_NET_ADMIN capability
> > doesn't release the rtnl lock.
>
>
> Thanks Pavel. I somehow recall that we already fixed this
> one, but can't find the patch :) Dave, please apply.
I think we even added this bug to -stable, or something like
that, didn't we? Yikes...
^ permalink raw reply
* Re: [PATCH 5/7] [TFRC]: Rename dccp_rx_ to tfrc_rx_
From: Gerrit Renker @ 2007-12-06 13:59 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: netdev, dccp
In-Reply-To: <1196631416-17778-6-git-send-email-acme@redhat.com>
| Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
^ permalink raw reply
* Re: [PATCH 4/7] [TFRC]: Make the rx history slab be global
From: Gerrit Renker @ 2007-12-06 13:59 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: netdev, dccp
In-Reply-To: <1196631416-17778-5-git-send-email-acme@redhat.com>
| Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
^ permalink raw reply
* Re: [PATCH][VLAN] Lost rtnl_unlock() in vlan_ioctl()
From: Patrick McHardy @ 2007-12-06 13:59 UTC (permalink / raw)
To: Pavel Emelyanov; +Cc: David Miller, Linux Netdev List, devel
In-Reply-To: <4757FE80.2080000@openvz.org>
Pavel Emelyanov wrote:
> The SET_VLAN_NAME_TYPE_CMD command w/o CAP_NET_ADMIN capability
> doesn't release the rtnl lock.
Thanks Pavel. I somehow recall that we already fixed this
one, but can't find the patch :) Dave, please apply.
^ permalink raw reply
* Re: [PATCH 3/7] [TFRC]: Rename tfrc_tx_hist to tfrc_tx_hist_slab, for consistency
From: Gerrit Renker @ 2007-12-06 13:57 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: netdev, dccp
In-Reply-To: <1196631416-17778-4-git-send-email-acme@redhat.com>
| Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
^ permalink raw reply
* Re: sockets affected by IPsec always block (2.6.23)
From: David Miller @ 2007-12-06 13:55 UTC (permalink / raw)
To: stefan; +Cc: herbert, simon, linux-kernel, netdev
In-Reply-To: <200712061330.20586.stefan@loplof.de>
From: Stefan Rompf <stefan@loplof.de>
Date: Thu, 6 Dec 2007 13:30:20 +0100
> IMHO this is what developers expect, and is also consistent with the
> fact that POSIX does not define O_NONBLOCK behaviour for local
> files.
You keep ignoring the fact that, as Herbert and I discussed, not
blocking for IPSEC resolution will make some connect() cases fail that
would otherwise not fail.
There are two sides to this issue, and we need to consider them
both.
Long term a resolution-packet-queue provides a solution that handles
both angles correctly, but we don't have that code yet.
^ permalink raw reply
* [PATCH][VLAN] Lost rtnl_unlock() in vlan_ioctl()
From: Pavel Emelyanov @ 2007-12-06 13:52 UTC (permalink / raw)
To: David Miller, Patrick McHardy; +Cc: Linux Netdev List, devel
The SET_VLAN_NAME_TYPE_CMD command w/o CAP_NET_ADMIN capability
doesn't release the rtnl lock.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 6567213..5b18315 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -776,7 +776,7 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
case SET_VLAN_NAME_TYPE_CMD:
err = -EPERM;
if (!capable(CAP_NET_ADMIN))
- return -EPERM;
+ break;
if ((args.u.name_type >= 0) &&
(args.u.name_type < VLAN_NAME_TYPE_HIGHEST)) {
vlan_name_type = args.u.name_type;
^ permalink raw reply related
* Re: TCP event tracking via netlink...
From: Arnaldo Carvalho de Melo @ 2007-12-06 13:28 UTC (permalink / raw)
To: David Miller; +Cc: shemminger, joe, ilpo.jarvinen, netdev
In-Reply-To: <20071206.022058.153600766.davem@davemloft.net>
Em Thu, Dec 06, 2007 at 02:20:58AM -0800, David Miller escreveu:
> From: Stephen Hemminger <shemminger@linux-foundation.org>
> Date: Wed, 5 Dec 2007 16:33:38 -0500
>
> > On Wed, 05 Dec 2007 08:53:07 -0800
> > Joe Perches <joe@perches.com> wrote:
> >
> > > > it occurred to me that we might want to do something
> > > > like a state change event generator.
> > >
> > > This could be a basis for an interesting TCP
> > > performance tester.
> >
> > That is what tcpprobe does but it isn't detailed enough to address SACK
> > issues.
>
> Indeed, this could be done via the jprobe there.
>
> Silly me I didn't do this in the implementation I whipped
> up, which I'll likely correct.
I have some experiments from the past on this area:
This is what is produced by ctracer + the ostra callgrapher when
tracking many sk_buff objects, tracing sk_buff routines and as well all
other structs that have a pointer to a sk_buff, i.e. where the sk_buff
can be get from the struct that has a pointer to it, tcp_sock is an
"alias" to struct inet_sock that is an "alias" to struct sock, etc, so
when tracing tcp_sock you also trace inet_connection_sock, inet_sock,
sock methods:
http://oops.ghostprotocols.net:81/acme/dwarves/callgraphs/sk_buff/many_objects/
With just one object (that is reused, so appears many times):
http://oops.ghostprotocols.net:81/acme/dwarves/callgraphs/sk_buff/0xffff8101013130e8/
Following struct sock methods:
http://oops.ghostprotocols.net:81/acme/dwarves/callgraphs/sock/many_objects/
http://oops.ghostprotocols.net:81/acme/dwarves/callgraphs/sock/0xf61bf500/
struct socket:
http://oops.ghostprotocols.net:81/acme/dwarves/callgraphs/socket/many_objects/
It works by using the DWARF information to generate a systemtap module
that in turn will create a relayfs channel where we store the traces and
a automatically reorganized struct with just the base types (int, char,
long, etc) and typedefs that end up being base types.
Example of the struct minisock recreated from the debugging information
and reorganized using the algorithms in pahole to save space, generated
by this tool, go to the bottom, where you'll find struct
ctracer__mini_sock and the collector, that from a full sized object
creates the mini struct.
http://oops.ghostprotocols.net:81/acme/dwarves/callgraphs/ctracer_collector.struct.sock.c
And the systemtap module (the tcpprobe on steroids) automatically
generated:
http://oops.ghostprotocols.net:81/acme/dwarves/callgraphs/ctracer_methods.struct.sock.stp
This requires more work to:
. reduce the overhead
. filter out undesired functions creating a "project" with the functions desired using
some gui editor
. specify lists of fields to put on the internal state to be collected, again using a
gui or plain ctracer-edit using vi, instead of getting just base types
. Be able to say: collect just the fields on the second and fourth cacheline
. collectors for complex objects such as spinlocks, socket lock, mutexes
But since people are wanting to work on tools to watch state
transitions, fields changing, etc, I thought I should dust off the ostra
experiments and the more recent dwarves ctracer work I'm doing on my
copious spare time 8)
In the callgrapher there are some more interesting stuff:
Interface to see where fields changed:
http://oops.ghostprotocols.net:81/acme/dwarves/callgraphs/sock/0xf61bf500/changes.html
In this page clicking on a field name, such as:
http://oops.ghostprotocols.net:81/acme/dwarves/callgraphs/sock/0xf61bf500/sk_forward_alloc.png
You'll get graphs over time.
Code is in the dwarves repo at:
http://master.kernel.org/git/?p=linux/kernel/git/acme/pahole.git;a=summary
Thanks,
- Arnaldo
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox