From 8b5c171bb3dc0686b2647a84e990199c5faa9ef8 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 9 Nov 2011 12:07:14 +0000 Subject: neigh: new unresolved queue limits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le mercredi 09 novembre 2011 à 16:21 -0500, David Miller a écrit : > From: David Miller > Date: Wed, 09 Nov 2011 16:16:44 -0500 (EST) > > > From: Eric Dumazet > > Date: Wed, 09 Nov 2011 12:14:09 +0100 > > > >> unres_qlen is the number of frames we are able to queue per unresolved > >> neighbour. Its default value (3) was never changed and is responsible > >> for strange drops, especially if IP fragments are used, or multiple > >> sessions start in parallel. Even a single tcp flow can hit this limit. > > ... > > > > Ok, I've applied this, let's see what happens :-) > > Early answer, build fails. > > Please test build this patch with DECNET enabled and resubmit. The > decnet neigh layer still refers to the removed ->queue_len member. > > Thanks. Ouch, this was fixed on one machine yesterday, but not the other one I used this morning, sorry. [PATCH V5 net-next] neigh: new unresolved queue limits unres_qlen is the number of frames we are able to queue per unresolved neighbour. Its default value (3) was never changed and is responsible for strange drops, especially if IP fragments are used, or multiple sessions start in parallel. Even a single tcp flow can hit this limit. $ arp -d 192.168.20.108 ; ping -c 2 -s 8000 192.168.20.108 PING 192.168.20.108 (192.168.20.108) 8000(8028) bytes of data. 8008 bytes from 192.168.20.108: icmp_seq=2 ttl=64 time=0.322 ms Signed-off-by: David S. Miller --- include/net/neighbour.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/net/neighbour.h') diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 2720884287c..7ae5acff96e 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -59,7 +59,7 @@ struct neigh_parms { int reachable_time; int delay_probe_time; - int queue_len; + int queue_len_bytes; int ucast_probes; int app_probes; int mcast_probes; @@ -99,6 +99,7 @@ struct neighbour { rwlock_t lock; atomic_t refcnt; struct sk_buff_head arp_queue; + unsigned int arp_queue_len_bytes; struct timer_list timer; unsigned long used; atomic_t probes; -- cgit v1.2.3-18-g5258 From 1026fec8739663621d64216ba939c23bc1d089b7 Mon Sep 17 00:00:00 2001 From: David Miller Date: Mon, 25 Jul 2011 00:01:17 +0000 Subject: neigh: Create mechanism for generic neigh private areas. The implementation private sits right after the primary_key memory. Signed-off-by: David S. Miller --- include/net/neighbour.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/net/neighbour.h') diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 7ae5acff96e..87c0e5ce649 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -179,6 +179,13 @@ struct neigh_table { struct pneigh_entry **phash_buckets; }; +#define NEIGH_PRIV_ALIGN sizeof(long long) + +static inline void *neighbour_priv(const struct neighbour *n) +{ + return (char *)n + ALIGN(sizeof(*n) + n->tbl->key_len, NEIGH_PRIV_ALIGN); +} + /* flags for neigh_update() */ #define NEIGH_UPDATE_F_OVERRIDE 0x00000001 #define NEIGH_UPDATE_F_WEAK_OVERRIDE 0x00000002 -- cgit v1.2.3-18-g5258 From 5b8b0060cbd6332ae5d1fa0bec0e8e211248d0e7 Mon Sep 17 00:00:00 2001 From: David Miller Date: Mon, 25 Jul 2011 00:01:22 +0000 Subject: neigh: Get rid of neigh_table->kmem_cachep We are going to alloc for device specific private areas for neighbour entries, and in order to do that we have to move away from the fixed allocation size enforced by using neigh_table->kmem_cachep As a nice side effect we can now use kfree_rcu(). Signed-off-by: David S. Miller --- include/net/neighbour.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/net/neighbour.h') diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 87c0e5ce649..e31f0a86f9b 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -173,7 +173,6 @@ struct neigh_table { atomic_t entries; rwlock_t lock; unsigned long last_rand; - struct kmem_cache *kmem_cachep; struct neigh_statistics __percpu *stats; struct neigh_hash_table __rcu *nht; struct pneigh_entry **phash_buckets; -- cgit v1.2.3-18-g5258 From 5c3ddec73d01a1fae9409c197078cb02c42238c3 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 13 Dec 2011 16:44:22 -0500 Subject: net: Remove unused neighbour layer ops. It's simpler to just keep these things out until there is a real user of them, so we can see what the needs actually are, rather than keep these things around as useless overhead. Signed-off-by: David S. Miller --- include/net/neighbour.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/net/neighbour.h') diff --git a/include/net/neighbour.h b/include/net/neighbour.h index e31f0a86f9b..6814c4d61c1 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -43,7 +43,6 @@ struct neigh_parms { #endif struct net_device *dev; struct neigh_parms *next; - int (*neigh_setup)(struct neighbour *); void (*neigh_cleanup)(struct neighbour *); struct neigh_table *tbl; -- cgit v1.2.3-18-g5258 From 447f219190bf0368b8b36cf60155744cb43510df Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 19 Dec 2011 15:04:41 -0500 Subject: Revert "net: Remove unused neighbour layer ops." This reverts commit 5c3ddec73d01a1fae9409c197078cb02c42238c3. S390 qeth driver actually still uses the setup ops. Reported-by: Frank Blaschka Signed-off-by: David S. Miller --- include/net/neighbour.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/net/neighbour.h') diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 6814c4d61c1..e31f0a86f9b 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -43,6 +43,7 @@ struct neigh_parms { #endif struct net_device *dev; struct neigh_parms *next; + int (*neigh_setup)(struct neighbour *); void (*neigh_cleanup)(struct neighbour *); struct neigh_table *tbl; -- cgit v1.2.3-18-g5258 From 2c2aba6c561ac425602f4a0be61422224cb87151 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 28 Dec 2011 15:06:58 -0500 Subject: ipv6: Use universal hash for NDISC. In order to perform a proper universal hash on a vector of integers, we have to use different universal hashes on each vector element. Which means we need 4 different hash randoms for ipv6. Signed-off-by: David S. Miller --- include/net/neighbour.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/net/neighbour.h') diff --git a/include/net/neighbour.h b/include/net/neighbour.h index e31f0a86f9b..34c996f4618 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -139,10 +139,12 @@ struct pneigh_entry { * neighbour table manipulation */ +#define NEIGH_NUM_HASH_RND 4 + struct neigh_hash_table { struct neighbour __rcu **hash_buckets; unsigned int hash_shift; - __u32 hash_rnd; + __u32 hash_rnd[NEIGH_NUM_HASH_RND]; struct rcu_head rcu; }; @@ -154,7 +156,7 @@ struct neigh_table { int key_len; __u32 (*hash)(const void *pkey, const struct net_device *dev, - __u32 hash_rnd); + __u32 *hash_rnd); int (*constructor)(struct neighbour *); int (*pconstructor)(struct pneigh_entry *); void (*pdestructor)(struct pneigh_entry *); -- cgit v1.2.3-18-g5258