Netdev List
 help / color / mirror / Atom feed
* Re: [2.6 patch] remove Documentation/networking/routing.txt
From: David Miller @ 2007-11-07 10:30 UTC (permalink / raw)
  To: bunk; +Cc: kuznet, netdev, linux-kernel
In-Reply-To: <20071105170601.GU12045@stusta.de>

From: Adrian Bunk <bunk@kernel.org>
Date: Mon, 5 Nov 2007 18:06:01 +0100

> This file is so outdated that I can't see any value in keeping it.
> 
> Signed-off-by: Adrian Bunk <bunk@kernel.org>

Agreed, and applied.


^ permalink raw reply

* Re: [2.6 patch] remove Documentation/networking/pt.txt
From: David Miller @ 2007-11-07 10:30 UTC (permalink / raw)
  To: alan; +Cc: bunk, jgarzik, netdev, linux-kernel
In-Reply-To: <20071105171757.278bcec7@the-village.bc.nu>

From: Alan Cox <alan@lxorguk.ukuu.org.uk>
Date: Mon, 5 Nov 2007 17:17:57 +0000

> On Mon, 5 Nov 2007 18:05:57 +0100
> Adrian Bunk <bunk@kernel.org> wrote:
> 
> > There's no no point in keeping documentation for a driver that was 
> > removed many years ago.
> > 
> > Signed-off-by: Adrian Bunk <bunk@kernel.org>
> 
> Defintiely very dead
> 
> Acked-by: Alan Cox <alan@redhat.com>

Applied.

^ permalink raw reply

* Re: [BUG] in inet6_create
From: David Miller @ 2007-11-07 10:34 UTC (permalink / raw)
  To: yoshfuji; +Cc: 12o3l, netdev
In-Reply-To: <20071105.200046.69224507.yoshfuji@linux-ipv6.org>

From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Date: Mon, 05 Nov 2007 20:00:46 +0900 (JST)

> [IPV6]: Ensure to initialize inetsw6 array before we start accepting socket.
> 
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> 
> diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
> index ecbd388..9ecd41b 100644
> --- a/net/ipv6/af_inet6.c
> +++ b/net/ipv6/af_inet6.c
> @@ -789,6 +789,7 @@ static int __init inet6_init(void)
>  	/* Register the socket-side information for inet6_create.  */
>  	for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r)
>  		INIT_LIST_HEAD(r);
> +	synchronize_net();
>  
>  	/* We MUST register RAW sockets before we create the ICMP6,
>  	 * IGMP6, or NDISC control sockets.
> 

I don't see how this can make a difference.

sock_register() takes spinlocks, and therefore provides
a full memory barrier.  The list initializations MUST
appear before any code path can see inet6_create() and
friends.

I simply cannot see how this crash is even possible.

Also, the original bug reporter cannot provide an inet6.o image that
matches any of his OOPS traces, so we cannot analyze this bug properly.

^ permalink raw reply

* Re: [patch 1/2] ipvs: Bind connections on stanby if the destination exists
From: David Miller @ 2007-11-07 10:36 UTC (permalink / raw)
  To: horms; +Cc: lvs-devel, netdev, rumen, graeme, jmack, ja, wensong
In-Reply-To: <20071105030958.596331811@vergenet.net>

From: horms@vergenet.net
Date: Mon, 05 Nov 2007 12:08:52 +0900

> From: Rumen G. Bogdanovski <rumen@voicecho.com>
> 
> This patch fixes the problem with node overload on director fail-over.
> Given the scenario: 2 nodes each accepting 3 connections at a time and 2
> directors, director failover occurs when the nodes are fully loaded (6
> connections to the cluster) in this case the new director will assign
> another 6 connections to the cluster, If the same real servers exist
> there.
 ...
> Acked-by: Julian Anastasov <ja@ssi.bg>
> Signed-off-by: Rumen G. Bogdanovski <rumen@voicecho.com>
> Signed-off-by: Simon Horman <horms@verge.net.au>

Applied, thanks.

^ permalink raw reply

* Re: [patch 2/2] ipvs: Syncrhonise Closing of Connections
From: David Miller @ 2007-11-07 10:37 UTC (permalink / raw)
  To: horms; +Cc: lvs-devel, netdev, rumen, graeme, jmack, ja, wensong
In-Reply-To: <20071105030958.813581208@vergenet.net>

From: horms@vergenet.net
Date: Mon, 05 Nov 2007 12:08:53 +0900

> From: Rumen G. Bogdanovski <rumen@voicecho.com>
> 
> This patch makes the master daemon to sync the connection when it is about
> to close.  This makes the connections on the backup to close or timeout
> according their state.  Before the sync was performed only if the
> connection is in ESTABLISHED state which always made the connections to
> timeout in the hard coded 3 minutes. However the Andy Gospodarek's patch
> ([IPVS]: use proper timeout instead of fixed value) effectively did nothing
> more than increasing this to 15 minutes (Established state timeout).  So
> this patch makes use of proper timeout since it syncs the connections on
> status changes to FIN_WAIT (2min timeout) and CLOSE (10sec timeout).
> However if the backup misses CLOSE hopefully it did not miss FIN_WAIT.
> Otherwise we will just have to wait for the ESTABLISHED state timeout. As
> it is without this patch.  This way the number of the hanging connections
> on the backup is kept to minimum. And very few of them will be left to
> timeout with a long timeout.
> 
> This is important if we want to make use of the fix for the real server
> overcommit on master/backup fail-over.
> 
> Signed-off-by: Rumen G. Bogdanovski <rumen@voicecho.com>
> Signed-off-by: Simon Horman <horms@verge.net.au>

Also applied, thanks.

^ permalink raw reply

* Re: [PATCH] INET : removes per bucket rwlock in tcp/dccp ehash table
From: David Miller @ 2007-11-07 10:41 UTC (permalink / raw)
  To: dada1; +Cc: ak, netdev, acme, jarkao2
In-Reply-To: <472DAD90.4050709@cosmosbay.com>

From: Eric Dumazet <dada1@cosmosbay.com>
Date: Sun, 04 Nov 2007 12:31:28 +0100

> [PATCH] INET : removes per bucket rwlock in tcp/dccp ehash table
> 
> As done two years ago on IP route cache table (commit 
> 22c047ccbc68fa8f3fa57f0e8f906479a062c426) , we can avoid using one lock per 
> hash bucket for the huge TCP/DCCP hash tables.
> 
> On a typical x86_64 platform, this saves about 2MB or 4MB of ram, for litle 
> performance differences. (we hit a different cache line for the rwlock, but 
> then the bucket cache line have a better sharing factor among cpus, since we 
> dirty it less often). For netstat or ss commands that want a full scan of hash 
> table, we perform fewer memory accesses.
> 
> Using a 'small' table of hashed rwlocks should be more than enough to provide 
> correct SMP concurrency between different buckets, without using too much 
> memory. Sizing of this table depends on num_possible_cpus() and various CONFIG 
> settings.
> 
> This patch provides some locking abstraction that may ease a future work using 
>   a different model for TCP/DCCP table.
> 
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

I'm going to push this current version to Linus, the space saving
really justify it and if we want to refine things further we do it
with followon work rather than blocking this patch.

Thanks Eric!

^ permalink raw reply

* Re: [NETLINK]: Fix unicast timeouts
From: David Miller @ 2007-11-07 10:42 UTC (permalink / raw)
  To: kaber; +Cc: manfred, netdev
In-Reply-To: <472DF8E8.2030204@trash.net>

From: Patrick McHardy <kaber@trash.net>
Date: Sun, 04 Nov 2007 17:52:56 +0100

> [NETLINK]: Fix unicast timeouts
> 
> Commit ed6dcf4a in the history.git tree broke netlink_unicast timeouts by
> moving the schedule_timeout() call to a new function that doesn't propagate
> the remaining timeout back to the caller. This means on each retry we start
> with the full timeout again.
> 
> ipc/mqueue.c seems to actually want to wait indefinitely so this behaviour
> is retained.
> 
> Cc: Manfred Spraul <manfred@colorfullife.com>
> Signed-off-by: Patrick McHardy <kaber@trash.net>

Applied, and I'll queue this up for -stable, thanks Patrick!

^ permalink raw reply

* Re: Stack Trace. Bad?
From: Evgeniy Polyakov @ 2007-11-07 10:49 UTC (permalink / raw)
  To: Jon Nelson; +Cc: netdev
In-Reply-To: <cccedfc60711061223me598dc8sad8dd36577874915@mail.gmail.com>

Hi Jon.

On Tue, Nov 06, 2007 at 02:23:03PM -0600, Jon Nelson (jnelson@jamponi.net) wrote:
> [linux-raid was also emailed this same information]

It looks like it was not :)

> I was testing some network throughput today and ran into this.
> I should note that I've this motherboard has 2x MCP55 Ethernet and one
> of them works fine and the other one gives lots and lots of frame
> errors under load.
> 
> The following is only an harmless informational message.
> Unless you get a _continuous_flood_ of these messages it means
> everything is working fine. Allocations from irqs cannot be
> perfectly reliable and the kernel is designed to handle that.
> md0_raid5: page allocation failure. order:2, mode:0x20
> 
> Call Trace:
>  <IRQ>  [<ffffffff802684c2>] __alloc_pages+0x324/0x33d
>  [<ffffffff80283147>] kmem_getpages+0x66/0x116
>  [<ffffffff8028367a>] fallback_alloc+0x104/0x174
>  [<ffffffff80283330>] kmem_cache_alloc_node+0x9c/0xa8
>  [<ffffffff80396984>] __alloc_skb+0x65/0x138
>  [<ffffffff8821d82a>] :forcedeth:nv_alloc_rx_optimized+0x4d/0x18f

What MTU for this card is? Forcedeth supports jumbo frames, but does it
in very unoptimized way, particulary by relying on the possibility to
allocate 2-order pages, which is wrong.

So, set MTU to 1500 and things will be back into good shape.
I think adding fragments support is not a short-term solution because
of closed specs.

-- 
	Evgeniy Polyakov

^ permalink raw reply

* RE: [PATCH] [AF_PACKET]: Allow multicast traffic to be caught by ORIGDEV when bonded
From: Waskiewicz Jr, Peter P @ 2007-11-07 11:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20071107.022116.16986000.davem@davemloft.net>

> > The socket option for packet sockets to return the original ifindex 
> > instead of the bonded ifindex will not match multicast 
> traffic.  Since 
> > this socket option is the most useful for layer 2 traffic and 
> > multicast traffic, make the option multicast-aware.
> > 
> > Signed-off-by: Peter P Waskiewicz Jr 
> <peter.p.waskiewicz.jr@intel.com>
> 
> I agree with you in principle, but I'd like to hear some 
> feedback from other folks.  In particular I'd like a 
> discussion about what this might break, if anything.

That's reasonable.  In any event, the only thing this could affect is if
the option is set on the socket, which shouldn't be very often at all.

I'm more than open to feedback on this change.

Thanks Dave,

-PJ Waskiewicz

^ permalink raw reply

* Re: Why does a connect to IPv6 LLA address fail ?
From: Jiri Bohac @ 2007-11-07 11:28 UTC (permalink / raw)
  To: netdev; +Cc: yoshfuji, kkeil
In-Reply-To: <20071107094007.GA15575@pingi.kke.suse.de>

Hi,

> For this it create a socket for datagram and
> protocol IPPROTO_IP and then try to connect it with the destination
> address. This fails in the case of a LLA, because connect returns EINVAL,
> since here is no device bind to this socket at this time.

[snip]

> Why do we have this check in ip6_datagram_connect() ?

This problem has been nicely described in
http://www.linux-ipv6.org/ml/usagi-users/msg03062.html
without any response. 

RFC2461, Appendix A, really suggests performing neighbour
discovery on all the links. I like the idea, it would make LLAs
much more useful. 

Has anyone experimented with this? Is there any good reason why
we don't send NSs to all the links to find out which link the
destination LLA is on?

Regards,

-- 
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, SUSE CZ


^ permalink raw reply

* Re: [PATCH] [AF_PACKET]: Allow multicast traffic to be caught by ORIGDEV when bonded
From: David Miller @ 2007-11-07 11:52 UTC (permalink / raw)
  To: peter.p.waskiewicz.jr; +Cc: netdev
In-Reply-To: <D5C1322C3E673F459512FB59E0DDC32903ED74CE@orsmsx414.amr.corp.intel.com>

From: "Waskiewicz Jr, Peter P" <peter.p.waskiewicz.jr@intel.com>
Date: Wed, 7 Nov 2007 03:00:42 -0800

> In any event, the only thing this could affect is if the option is
> set on the socket, which shouldn't be very often at all.

Any idea how many programs set this option and which
ones?  You obviously noticed, so perhaps you know at
least one or was this discovered purely by code
inspection?

^ permalink raw reply

* [PATCH 0/2] fix for OOPS in pernet list operations if CONFIG_NET_NS undefined
From: Denis V. Lunev @ 2007-11-07 11:59 UTC (permalink / raw)
  To: davem; +Cc: devel, containers, netdev, clg, benjamin.thery

These patches are addressed to the oops reported by the Cedric Le Goater
a week ago. The pernet_operations were discarder during kernel boot and
this breaks further operations as this 

Though, the patch from Pavel Emelyanov was partially reverted
by the Eric W. Biederman [commit 2b008b0a8e96b726c603c5e1a5a7a509b5f61e35]

So, I revert the Eric patch (actually, Eric one can be simply dropped) and
fix original code. There is no need for such complex code if CONFIG_NET_NS
is not defined.

^ permalink raw reply

* [PATCH 1/2] cleanup pernet operation without CONFIG_NET_NS
From: Denis V. Lunev @ 2007-11-07 12:00 UTC (permalink / raw)
  To: davem; +Cc: devel, containers, netdev, clg, benjamin.thery

If CONFIG_NET_NS is not set, the only namespace is possible.

This patch removes list of pernet_operations and cleanups code a bit.
This list is not needed if there are no namespaces. We should just call
->init method.

Additionally, the ->exit will be called on module unloading only. This
case is safe - the code is not discarded. For the in/kernel code, ->exit
should never be called.

Signed-off-by: Denis V. Lunev <den@openvz.org>

--- ./net/core/net_namespace.c.netinitdata	2007-10-15 13:55:25.000000000 +0400
+++ ./net/core/net_namespace.c	2007-11-06 14:33:14.000000000 +0300
@@ -179,6 +180,7 @@ static int __init net_ns_init(void)
 
 pure_initcall(net_ns_init);
 
+#ifdef CONFIG_NET_NS
 static int register_pernet_operations(struct list_head *list,
 				      struct pernet_operations *ops)
 {
@@ -220,6 +222,23 @@ static void unregister_pernet_operations
 			ops->exit(net);
 }
 
+#else
+
+static int register_pernet_operations(struct list_head *list,
+				      struct pernet_operations *ops)
+{
+	if (ops->init == NULL)
+		return 0;
+	return ops->init(&init_net);
+}
+
+static void unregister_pernet_operations(struct pernet_operations *ops)
+{
+	if (ops->exit)
+		ops->exit(&init_net);
+}
+#endif
+
 /**
  *      register_pernet_subsys - register a network namespace subsystem
  *	@ops:  pernet operations structure for the subsystem

^ permalink raw reply

* [PATCH 2/2] move unneeded data to initdata section
From: Denis V. Lunev @ 2007-11-07 12:01 UTC (permalink / raw)
  To: davem; +Cc: devel, containers, netdev, clg, benjamin.thery

This patch reverts Eric's commit 2b008b0a8e96b726c603c5e1a5a7a509b5f61e35

It diets .text & .data section of the kernel if CONFIG_NET_NS is not set.
This is safe after list operations cleanup.

Signed-of-by: Denis V. Lunev <den@openvz.org>

--- ./drivers/net/loopback.c.reversed	2007-10-30 14:45:07.000000000 +0300
+++ ./drivers/net/loopback.c	2007-11-01 17:30:55.000000000 +0300
@@ -284,7 +284,7 @@ static __net_exit void loopback_net_exit
 	unregister_netdev(dev);
 }
 
-static struct pernet_operations loopback_net_ops = {
+static struct pernet_operations __net_initdata loopback_net_ops = {
        .init = loopback_net_init,
        .exit = loopback_net_exit,
 };
--- ./fs/proc/proc_net.c.reversed	2007-10-30 14:45:07.000000000 +0300
+++ ./fs/proc/proc_net.c	2007-11-01 17:30:57.000000000 +0300
@@ -185,7 +185,7 @@ static __net_exit void proc_net_ns_exit(
 	kfree(net->proc_net_root);
 }
 
-static struct pernet_operations proc_net_ns_ops = {
+static struct pernet_operations __net_initdata proc_net_ns_ops = {
 	.init = proc_net_ns_init,
 	.exit = proc_net_ns_exit,
 };
--- ./include/net/net_namespace.h.reversed	2007-10-30 14:45:07.000000000 +0300
+++ ./include/net/net_namespace.h	2007-11-01 17:30:58.000000000 +0300
@@ -102,9 +102,11 @@ static inline void release_net(struct ne
 #ifdef CONFIG_NET_NS
 #define __net_init
 #define __net_exit
+#define __net_initdata
 #else
 #define __net_init	__init
 #define __net_exit	__exit_refok
+#define __net_initdata	__initdata
 #endif
 
 struct pernet_operations {
--- ./net/core/dev.c.reversed	2007-10-30 14:45:08.000000000 +0300
+++ ./net/core/dev.c	2007-11-01 17:30:58.000000000 +0300
@@ -2676,7 +2676,7 @@ static void __net_exit dev_proc_net_exit
 	proc_net_remove(net, "dev");
 }
 
-static struct pernet_operations dev_proc_ops = {
+static struct pernet_operations __net_initdata dev_proc_ops = {
 	.init = dev_proc_net_init,
 	.exit = dev_proc_net_exit,
 };
@@ -4336,7 +4336,7 @@ static void __net_exit netdev_exit(struc
 	kfree(net->dev_index_head);
 }
 
-static struct pernet_operations  netdev_net_ops = {
+static struct pernet_operations __net_initdata netdev_net_ops = {
 	.init = netdev_init,
 	.exit = netdev_exit,
 };
@@ -4367,7 +4367,7 @@ static void __net_exit default_device_ex
 	rtnl_unlock();
 }
 
-static struct pernet_operations  default_device_ops = {
+static struct pernet_operations __net_initdata default_device_ops = {
 	.exit = default_device_exit,
 };
 
--- ./net/core/dev_mcast.c.reversed	2007-10-30 14:45:08.000000000 +0300
+++ ./net/core/dev_mcast.c	2007-11-01 17:31:00.000000000 +0300
@@ -285,7 +285,7 @@ static void __net_exit dev_mc_net_exit(s
 	proc_net_remove(net, "dev_mcast");
 }
 
-static struct pernet_operations dev_mc_net_ops = {
+static struct pernet_operations __net_initdata dev_mc_net_ops = {
 	.init = dev_mc_net_init,
 	.exit = dev_mc_net_exit,
 };
--- ./net/netlink/af_netlink.c.reversed	2007-10-30 14:45:08.000000000 +0300
+++ ./net/netlink/af_netlink.c	2007-11-01 17:31:01.000000000 +0300
@@ -1888,7 +1888,7 @@ static void __net_exit netlink_net_exit(
 #endif
 }
 
-static struct pernet_operations netlink_net_ops = {
+static struct pernet_operations __net_initdata netlink_net_ops = {
 	.init = netlink_net_init,
 	.exit = netlink_net_exit,
 };

^ permalink raw reply

* Re: [PATCH] INET : removes per bucket rwlock in tcp/dccp ehash table
From: Jarek Poplawski @ 2007-11-07 12:13 UTC (permalink / raw)
  To: David Miller; +Cc: dada1, ak, netdev, acme
In-Reply-To: <20071107.024114.265595154.davem@davemloft.net>

On Wed, Nov 07, 2007 at 02:41:14AM -0800, David Miller wrote:
> From: Eric Dumazet <dada1@cosmosbay.com>
> Date: Sun, 04 Nov 2007 12:31:28 +0100
> 
> > [PATCH] INET : removes per bucket rwlock in tcp/dccp ehash table
> > 
> > As done two years ago on IP route cache table (commit 
> > 22c047ccbc68fa8f3fa57f0e8f906479a062c426) , we can avoid using one lock per 
> > hash bucket for the huge TCP/DCCP hash tables.
> > 
> > On a typical x86_64 platform, this saves about 2MB or 4MB of ram, for litle 
> > performance differences. (we hit a different cache line for the rwlock, but 
> > then the bucket cache line have a better sharing factor among cpus, since we 
> > dirty it less often). For netstat or ss commands that want a full scan of hash 
> > table, we perform fewer memory accesses.
> > 
> > Using a 'small' table of hashed rwlocks should be more than enough to provide 
> > correct SMP concurrency between different buckets, without using too much 
> > memory. Sizing of this table depends on num_possible_cpus() and various CONFIG 
> > settings.
> > 
> > This patch provides some locking abstraction that may ease a future work using 
> >   a different model for TCP/DCCP table.
> > 
> > Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
> > Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> I'm going to push this current version to Linus, the space saving
> really justify it and if we want to refine things further we do it
> with followon work rather than blocking this patch.
> 
> Thanks Eric!

I hope my remarks didn't block anything?! I've written it's OK.
So, I'm not sure it's useful or expected, but anyway:

Acked-by: Jarek Poplawski <jarkao2@o2.pl>

Thanks,
Jarek P.

^ permalink raw reply

* [PATCH] mdiobus_register: check bus not being NULL before dereferencing it.
From: Uwe Kleine-König @ 2007-11-07 11:31 UTC (permalink / raw)
  To: netdev; +Cc: Uwe Kleine-König, Andy Fleming

Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Cc: Andy Fleming <afleming@freescale.com>
---
 drivers/net/phy/mdio_bus.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index fc2f0e6..7ff55bb 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -49,13 +49,13 @@ int mdiobus_register(struct mii_bus *bus)
 	int i;
 	int err = 0;
 
-	spin_lock_init(&bus->mdio_lock);
-
 	if (NULL == bus || NULL == bus->name ||
 			NULL == bus->read ||
 			NULL == bus->write)
 		return -EINVAL;
 
+	spin_lock_init(&bus->mdio_lock);
+
 	if (bus->reset)
 		bus->reset(bus);
 
-- 
1.5.3.4


^ permalink raw reply related

* [PATCH] netns: init dev_base_lock only once
From: Alexey Dobriyan @ 2007-11-07 12:51 UTC (permalink / raw)
  To: davem; +Cc: netdev, devel, ebiederm

* it already statically initialized
* reinitializing live global spinlock every time netns is
  setup is also wrong

Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
---

 net/core/dev.c |    1 -
 1 file changed, 1 deletion(-)

--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4330,7 +4330,6 @@ static struct hlist_head *netdev_create_hash(void)
 static int __net_init netdev_init(struct net *net)
 {
 	INIT_LIST_HEAD(&net->dev_base_head);
-	rwlock_init(&dev_base_lock);
 
 	net->dev_name_head = netdev_create_hash();
 	if (net->dev_name_head == NULL)


^ permalink raw reply

* Re: Endianness problem with u32 classifier hash masks
From: Jarek Poplawski @ 2007-11-07 12:56 UTC (permalink / raw)
  To: David Miller; +Cc: radu.rendec, hadi, netdev
In-Reply-To: <20071107.012220.17723288.davem@davemloft.net>

On Wed, Nov 07, 2007 at 01:22:20AM -0800, David Miller wrote:
> From: Radu Rendec <radu.rendec@ines.ro>
> Date: Tue, 06 Nov 2007 19:00:16 +0200
> 
> > On Tue, 2007-11-06 at 09:43 -0500, jamal wrote:
> > > On Tue, 2007-06-11 at 15:25 +0100, Jarek Poplawski wrote:
> > > 
> > > > Yes, it saves one htonl() on the slow path!
> > > 
> > > Would it feel better to say grew down exponentially from version 1 to
> > > 3? ;->
> > 
> > Not only it saves one htonl(), but also keeps the code readable :)
> > Computing offsets within the rtnetlink response skb and applying htonl()
> > there is quite tricky and might get broken if RTA_PUT() is changed.
> > Unfortunately I spent about an hour figuring out how to do that :))
> > 
> > The bad news is that today I haven't got the chance to work on the two
> > patches. But the good news is that I managed to finish the (urgent) task
> > that had been assigned to me at work, and tomorrow I will be able to
> > work on the kernel and test it leisurely.
> 
> I've grown impatient and done the work for you :-)  I've applied
> the patch below to my tree, thank you!
> 
> If someone wants to send me the ffs() thing relative to this,
> I'd appreciate it.  Thanks again!

...And Radu has spend so much time on this git vs. which tree to cut
for the beginning... I hope this ffs() patch will be enough to check
on some bush at least!

> 
> From 8e36263f10a054479636b57943cdeaf37470acc5 Mon Sep 17 00:00:00 2001
> From: Radu Rendec <radu.rendec@ines.ro>
> Date: Wed, 7 Nov 2007 01:20:12 -0800
> Subject: [PATCH] [PKT_SCHED] CLS_U32: Fix endianness problem with u32 classifier hash masks.
> 
> From: Radu Rendec <radu.rendec@ines.ro>
> 
> While trying to implement u32 hashes in my shaping machine I ran into
> a possible bug in the u32 hash/bucket computing algorithm
> (net/sched/cls_u32.c).
> 
> The problem occurs only with hash masks that extend over the octet
> boundary, on little endian machines (where htonl() actually does
> something).
> 
> Let's say that I would like to use 0x3fc0 as the hash mask. This means
> 8 contiguous "1" bits starting at b6. With such a mask, the expected
> (and logical) behavior is to hash any address in, for instance,
> 192.168.0.0/26 in bucket 0, then any address in 192.168.0.64/26 in
> bucket 1, then 192.168.0.128/26 in bucket 2 and so on.
> 
> This is exactly what would happen on a big endian machine, but on
> little endian machines, what would actually happen with current
> implementation is 0x3fc0 being reversed (into 0xc03f0000) by htonl()
> in the userspace tool and then applied to 192.168.x.x in the u32
> classifier. When shifting right by 16 bits (rank of first "1" bit in
> the reversed mask) and applying the divisor mask (0xff for divisor
> 256), what would actually remain is 0x3f applied on the "168" octet of
> the address.
> 
> One could say is this can be easily worked around by taking endianness
> into account in userspace and supplying an appropriate mask (0xfc03)
> that would be turned into contiguous "1" bits when reversed
> (0x03fc0000). But the actual problem is the network address (inside
> the packet) not being converted to host order, but used as a
> host-order value when computing the bucket.
> 
> Let's say the network address is written as n31 n30 ... n0, with n0
> being the least significant bit. When used directly (without any
> conversion) on a little endian machine, it becomes n7 ... n0 n8 ..n15
> etc in the machine's registers. Thus bits n7 and n8 would no longer be
> adjacent and 192.168.64.0/26 and 192.168.128.0/26 would no longer be
> consecutive.
> 
> The fix is to apply ntohl() on the hmask before computing fshift,
> and in u32_hash_fold() convert the packet data to host order before
> shifting down by fshift.
> 
> With helpful feedback from Jamal Hadi Salim and Jarek Poplawski.

Acked-by: Jarek Poplawski <jarkao2@o2.pl>

> 
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>  net/sched/cls_u32.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
> index 9e98c6e..5317102 100644
> --- a/net/sched/cls_u32.c
> +++ b/net/sched/cls_u32.c
> @@ -91,7 +91,7 @@ static struct tc_u_common *u32_list;
>  
>  static __inline__ unsigned u32_hash_fold(u32 key, struct tc_u32_sel *sel, u8 fshift)
>  {
> -	unsigned h = (key & sel->hmask)>>fshift;
> +	unsigned h = ntohl(key & sel->hmask)>>fshift;
>  
>  	return h;
>  }
> @@ -615,7 +615,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
>  	n->handle = handle;
>  {
>  	u8 i = 0;
> -	u32 mask = s->hmask;
> +	u32 mask = ntohl(s->hmask);
>  	if (mask) {
>  		while (!(mask & 1)) {
>  			i++;
> -- 
> 1.5.3.5
> 

^ permalink raw reply

* [PATCH] [RESEND] small possible memory leak in FIB rules
From: Denis V. Lunev @ 2007-11-07 13:36 UTC (permalink / raw)
  To: davem, den; +Cc: devel, containers, netdev

This patch fixes a small memory leak. Default fib rules can be deleted by
the user if the rule does not carry FIB_RULE_PERMANENT flag, f.e. by
	ip rule flush

Such a rule will not be freed as the ref-counter has 2 on start and becomes
clearly unreachable after removal.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>

---------

 include/net/fib_rules.h |    3 ++
 net/core/fib_rules.c    |   22 ++++++++++++++++++++
 net/decnet/dn_rules.c   |   13 +-----------
 net/ipv4/fib_rules.c    |   51 ++++++++++++++++++------------------------------
 net/ipv6/fib6_rules.c   |   37 ++++++++++++++--------------------
 5 files changed, 62 insertions(+), 64 deletions(-)

---------

diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -107,4 +107,7 @@ extern int			fib_rules_unregister(struct fib_rules_ops *);
 extern int			fib_rules_lookup(struct fib_rules_ops *,
 						 struct flowi *, int flags,
 						 struct fib_lookup_arg *);
+extern int			fib_default_rule_add(struct fib_rules_ops *,
+			   			     u32 pref, u32 table,
+						     u32 flags);
 #endif
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 13de6f5..848132b 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -18,6 +18,28 @@
 static LIST_HEAD(rules_ops);
 static DEFINE_SPINLOCK(rules_mod_lock);
 
+int fib_default_rule_add(struct fib_rules_ops *ops,
+			 u32 pref, u32 table, u32 flags)
+{
+	struct fib_rule *r;
+
+	r = kzalloc(ops->rule_size, GFP_KERNEL);
+	if (r == NULL)
+		return -ENOMEM;
+
+	atomic_set(&r->refcnt, 1);
+	r->action = FR_ACT_TO_TBL;
+	r->pref = pref;
+	r->table = table;
+	r->flags = flags;
+
+	/* The lock is not required here, the list in unreacheable
+	 * at the moment this function is called */
+	list_add_tail(&r->list, &ops->rules_list);
+	return 0;
+}
+EXPORT_SYMBOL(fib_default_rule_add);
+
 static void notify_rule_change(int event, struct fib_rule *rule,
 			       struct fib_rules_ops *ops, struct nlmsghdr *nlh,
 			       u32 pid);
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index ddd3f04..ffebea0 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -48,15 +48,6 @@ struct dn_fib_rule
 	u8			flags;
 };
 
-static struct dn_fib_rule default_rule = {
-	.common = {
-		.refcnt =		ATOMIC_INIT(2),
-		.pref =			0x7fff,
-		.table =		RT_TABLE_MAIN,
-		.action =		FR_ACT_TO_TBL,
-	},
-};
-
 
 int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res)
 {
@@ -262,8 +253,8 @@ static struct fib_rules_ops dn_fib_rules_ops = {
 
 void __init dn_fib_rules_init(void)
 {
-	list_add_tail(&default_rule.common.list,
-			&dn_fib_rules_ops.rules_list);
+	BUG_ON(fib_default_rule_add(&dn_fib_rules_ops, 0x7fff,
+			            RT_TABLE_MAIN, 0));
 	fib_rules_register(&dn_fib_rules_ops);
 }
 
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index f16839c..a0ada3a 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -49,33 +49,6 @@ struct fib4_rule
 #endif
 };
 
-static struct fib4_rule default_rule = {
-	.common = {
-		.refcnt =	ATOMIC_INIT(2),
-		.pref =		0x7FFF,
-		.table =	RT_TABLE_DEFAULT,
-		.action =	FR_ACT_TO_TBL,
-	},
-};
-
-static struct fib4_rule main_rule = {
-	.common = {
-		.refcnt =	ATOMIC_INIT(2),
-		.pref =		0x7FFE,
-		.table =	RT_TABLE_MAIN,
-		.action =	FR_ACT_TO_TBL,
-	},
-};
-
-static struct fib4_rule local_rule = {
-	.common = {
-		.refcnt =	ATOMIC_INIT(2),
-		.table =	RT_TABLE_LOCAL,
-		.action =	FR_ACT_TO_TBL,
-		.flags =	FIB_RULE_PERMANENT,
-	},
-};
-
 #ifdef CONFIG_NET_CLS_ROUTE
 u32 fib_rules_tclass(struct fib_result *res)
 {
@@ -319,11 +292,27 @@ static struct fib_rules_ops fib4_rules_ops = {
 	.owner		= THIS_MODULE,
 };
 
-void __init fib4_rules_init(void)
+static int __init fib_default_rules_init(void)
 {
-	list_add_tail(&local_rule.common.list, &fib4_rules_ops.rules_list);
-	list_add_tail(&main_rule.common.list, &fib4_rules_ops.rules_list);
-	list_add_tail(&default_rule.common.list, &fib4_rules_ops.rules_list);
+	int err;
+
+	err = fib_default_rule_add(&fib4_rules_ops, 0,
+				   RT_TABLE_LOCAL, FIB_RULE_PERMANENT);
+	if (err < 0)
+		return err;
+	err = fib_default_rule_add(&fib4_rules_ops, 0x7FFE,
+				   RT_TABLE_MAIN, 0);
+	if (err < 0)
+		return err;
+	err = fib_default_rule_add(&fib4_rules_ops, 0x7FFF,
+				   RT_TABLE_DEFAULT, 0);
+	if (err < 0)
+		return err;
+	return 0;
+}
 
+void __init fib4_rules_init(void)
+{
+	BUG_ON(fib_default_rules_init());
 	fib_rules_register(&fib4_rules_ops);
 }
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 706622a..428c6b0 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -31,25 +31,6 @@ struct fib6_rule
 
 static struct fib_rules_ops fib6_rules_ops;
 
-static struct fib6_rule main_rule = {
-	.common = {
-		.refcnt =	ATOMIC_INIT(2),
-		.pref =		0x7FFE,
-		.action =	FR_ACT_TO_TBL,
-		.table =	RT6_TABLE_MAIN,
-	},
-};
-
-static struct fib6_rule local_rule = {
-	.common = {
-		.refcnt =	ATOMIC_INIT(2),
-		.pref =		0,
-		.action =	FR_ACT_TO_TBL,
-		.table =	RT6_TABLE_LOCAL,
-		.flags =	FIB_RULE_PERMANENT,
-	},
-};
-
 struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags,
 				   pol_lookup_t lookup)
 {
@@ -270,11 +251,23 @@ static struct fib_rules_ops fib6_rules_ops = {
 	.owner			= THIS_MODULE,
 };
 
-void __init fib6_rules_init(void)
+static int __init fib6_default_rules_init(void)
 {
-	list_add_tail(&local_rule.common.list, &fib6_rules_ops.rules_list);
-	list_add_tail(&main_rule.common.list, &fib6_rules_ops.rules_list);
+	int err;
+
+	err = fib_default_rule_add(&fib6_rules_ops, 0,
+				   RT6_TABLE_LOCAL, FIB_RULE_PERMANENT);
+	if (err < 0)
+		return err;
+	err = fib_default_rule_add(&fib6_rules_ops, 0x7FFE, RT6_TABLE_MAIN, 0);
+	if (err < 0)
+		return err;
+	return 0;
+}
 
+void __init fib6_rules_init(void)
+{
+	BUG_ON(fib6_default_rules_init());
 	fib_rules_register(&fib6_rules_ops);
 }
 

^ permalink raw reply related

* Re: [PATCH] using mii-bitbang on different processor ports - update the booting-without-of.txt-file
From: Sergej Stepanov @ 2007-11-07 13:40 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, netdev, jgarzik
In-Reply-To: <20071106184649.GA5283@loki.buserror.net>

Am Dienstag, den 06.11.2007, 12:46 -0600 schrieb Scott Wood:
> >  
> > +   The "reg"-property may have also depending on board design
> > +   the following form:
> > +	reg = <10d40 14 10d60 14>;
> > +   In that case the pin for mdio data controlling is on the port C,
> > +   and the pin for mdio clock controlling is on the port D.
> 
> It'd be better to explicitly say that the first resource is mdio, and the
> second resource is mdc, rather than require the reader to know/look up which
> corresponds to 10d40 and which to 10d60.
> 
> -Scott

Ok. What would you say about something like that:
--
If both mdio and mdc controlling pins are on the same processor port,
one resource should be used.
Otherwise, two resources are used: the 1-st - mdio, the 2-nd - mdc.
--
Please, correct me, if it sounds bad.

Thanks and regards
Sergej. 

^ permalink raw reply

* Re: Endianness problem with u32 classifier hash masks
From: jamal @ 2007-11-07 13:42 UTC (permalink / raw)
  To: David Miller; +Cc: radu.rendec, jarkao2, netdev
In-Reply-To: <20071107.012220.17723288.davem@davemloft.net>

On Wed, 2007-07-11 at 01:22 -0800, David Miller wrote:

> @@ -615,7 +615,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
>  	n->handle = handle;
>  {
>  	u8 i = 0;
> -	u32 mask = s->hmask;
> +	u32 mask = ntohl(s->hmask);


Is this line needed? Radu?

cheers,
jamal




^ permalink raw reply

* [PATCH 1/3][UNIX] Make unix_tot_inflight counter non-atomic
From: Pavel Emelyanov @ 2007-11-07 13:52 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, devel

This counter is _always_ modified under the unix_gc_lock spinlock, 
so its atomicity can be provided w/o additional efforts.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 0864a77..a1c805d 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -12,7 +12,7 @@ extern void unix_gc(void);
 
 #define UNIX_HASH_SIZE	256
 
-extern atomic_t unix_tot_inflight;
+extern unsigned int unix_tot_inflight;
 
 struct unix_address {
 	atomic_t	refcnt;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 515e7a6..ab9048a 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -457,7 +457,7 @@ static int unix_release_sock (struct sock *sk, int embrion)
 	 *	  What the above comment does talk about? --ANK(980817)
 	 */
 
-	if (atomic_read(&unix_tot_inflight))
+	if (unix_tot_inflight)
 		unix_gc();		/* Garbage collect fds */
 
 	return 0;
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 406b643..399717e 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -92,7 +92,7 @@ static LIST_HEAD(gc_inflight_list);
 static LIST_HEAD(gc_candidates);
 static DEFINE_SPINLOCK(unix_gc_lock);
 
-atomic_t unix_tot_inflight = ATOMIC_INIT(0);
+unsigned int unix_tot_inflight;
 
 
 static struct sock *unix_get_socket(struct file *filp)
@@ -133,7 +133,7 @@ void unix_inflight(struct file *fp)
 		} else {
 			BUG_ON(list_empty(&u->link));
 		}
-		atomic_inc(&unix_tot_inflight);
+		unix_tot_inflight++;
 		spin_unlock(&unix_gc_lock);
 	}
 }
@@ -147,7 +147,7 @@ void unix_notinflight(struct file *fp)
 		BUG_ON(list_empty(&u->link));
 		if (atomic_dec_and_test(&u->inflight))
 			list_del_init(&u->link);
-		atomic_dec(&unix_tot_inflight);
+		unix_tot_inflight--;
 		spin_unlock(&unix_gc_lock);
 	}
 }
-- 
1.5.3.4


^ permalink raw reply related

* Re: Stack Trace. Bad?
From: Jon Nelson @ 2007-11-07 13:55 UTC (permalink / raw)
  Cc: netdev
In-Reply-To: <20071107104900.GB14732@2ka.mipt.ru>

On 11/7/07, Evgeniy Polyakov <johnpol@2ka.mipt.ru> wrote:
> Hi Jon.
>
> On Tue, Nov 06, 2007 at 02:23:03PM -0600, Jon Nelson (jnelson@jamponi.net) wrote:
> > I was testing some network throughput today and ran into this.
> > I should note that I've this motherboard has 2x MCP55 Ethernet and one
> > of them works fine and the other one gives lots and lots of frame
> > errors under load.
> >
> > The following is only an harmless informational message.
> > Unless you get a _continuous_flood_ of these messages it means
> > everything is working fine. Allocations from irqs cannot be
> > perfectly reliable and the kernel is designed to handle that.
> > md0_raid5: page allocation failure. order:2, mode:0x20
> >
> > Call Trace:
> >  <IRQ>  [<ffffffff802684c2>] __alloc_pages+0x324/0x33d
> >  [<ffffffff80283147>] kmem_getpages+0x66/0x116
> >  [<ffffffff8028367a>] fallback_alloc+0x104/0x174
> >  [<ffffffff80283330>] kmem_cache_alloc_node+0x9c/0xa8
> >  [<ffffffff80396984>] __alloc_skb+0x65/0x138
> >  [<ffffffff8821d82a>] :forcedeth:nv_alloc_rx_optimized+0x4d/0x18f
>
> What MTU for this card is? Forcedeth supports jumbo frames, but does it
> in very unoptimized way, particulary by relying on the possibility to
> allocate 2-order pages, which is wrong.
>
> So, set MTU to 1500 and things will be back into good shape.
> I think adding fragments support is not a short-term solution because
> of closed specs.

The NIC is configured to use a 1500 byte MTU.

-- 
Jon

^ permalink raw reply

* [PATCH 2/3][UNIX] Convert socks to unix_socks in scan_inflight, not in callbacks
From: Pavel Emelyanov @ 2007-11-07 13:56 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, devel

The scan_inflight() routine scans through the unix sockets and calls
some passed callback. The fact is that all these callbacks work with
the unix_sock objects, not the sock ones, so make this conversion in
the scan_inflight() before calling the callbacks.

This removes one unneeded variable from the inc_inflight_move_tail().

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 399717e..ebdff3d 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -161,7 +161,7 @@ static inline struct sk_buff *sock_queue_head(struct sock *sk)
 	for (skb = sock_queue_head(sk)->next, next = skb->next; \
 	     skb != sock_queue_head(sk); skb = next, next = skb->next)
 
-static void scan_inflight(struct sock *x, void (*func)(struct sock *),
+static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *),
 			  struct sk_buff_head *hitlist)
 {
 	struct sk_buff *skb;
@@ -185,9 +185,9 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *),
 				 *	if it indeed does so
 				 */
 				struct sock *sk = unix_get_socket(*fp++);
-				if(sk) {
+				if (sk) {
 					hit = true;
-					func(sk);
+					func(unix_sk(sk));
 				}
 			}
 			if (hit && hitlist != NULL) {
@@ -199,7 +199,7 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *),
 	spin_unlock(&x->sk_receive_queue.lock);
 }
 
-static void scan_children(struct sock *x, void (*func)(struct sock *),
+static void scan_children(struct sock *x, void (*func)(struct unix_sock *),
 			  struct sk_buff_head *hitlist)
 {
 	if (x->sk_state != TCP_LISTEN)
@@ -235,20 +235,18 @@ static void scan_children(struct sock *x, void (*func)(struct sock *),
 	}
 }
 
-static void dec_inflight(struct sock *sk)
+static void dec_inflight(struct unix_sock *usk)
 {
-	atomic_dec(&unix_sk(sk)->inflight);
+	atomic_dec(&usk->inflight);
 }
 
-static void inc_inflight(struct sock *sk)
+static void inc_inflight(struct unix_sock *usk)
 {
-	atomic_inc(&unix_sk(sk)->inflight);
+	atomic_inc(&usk->inflight);
 }
 
-static void inc_inflight_move_tail(struct sock *sk)
+static void inc_inflight_move_tail(struct unix_sock *u)
 {
-	struct unix_sock *u = unix_sk(sk);
-
 	atomic_inc(&u->inflight);
 	/*
 	 * If this is still a candidate, move it to the end of the
-- 
1.5.3.4


^ permalink raw reply related

* Re: Endianness problem with u32 classifier hash masks
From: Radu Rendec @ 2007-11-07 13:55 UTC (permalink / raw)
  To: hadi; +Cc: David Miller, jarkao2, netdev
In-Reply-To: <1194442968.4446.8.camel@localhost>

On Wed, 2007-11-07 at 08:42 -0500, jamal wrote:
> On Wed, 2007-07-11 at 01:22 -0800, David Miller wrote:
> 
> > @@ -615,7 +615,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
> >  	n->handle = handle;
> >  {
> >  	u8 i = 0;
> > -	u32 mask = s->hmask;
> > +	u32 mask = ntohl(s->hmask);
> 
> 
> Is this line needed? Radu?

Yup. Without it, the number of bits to shift would be computed on the
network ordered mask. The shift in u32_hash_fold() is done on a host
ordered u32 (obtained from applying the mask on the packet data).

Shifting the host ordered u32 with number of bits obtained from network
ordered mask would most probably break things.

I've just compiled the kernel from a fresh clone of Dave's tree (u32
patch included) and I'm about to test it.

Dave, thanks a lot for adding the patch to your tree. But I guess you
didn't test it. I'll get back to you in max 1 hour and tell you the
results.

If everything goes well, then I'll move on to testing the ffs() patch.

Cheers,

Radu



^ permalink raw reply


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