Netdev List
 help / color / mirror / Atom feed
* [PATCH 4/7] neigh: Do not set tbl->entry_size in ipv4/ipv6 neigh tables.
From: David Miller @ 2011-12-01  3:41 UTC (permalink / raw)
  To: netdev


Let the core self-size the neigh entry based upon the key length.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/atm/clip.c   |    1 -
 net/ipv4/arp.c   |    1 -
 net/ipv6/ndisc.c |    1 -
 3 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/net/atm/clip.c b/net/atm/clip.c
index aea7cad..b1c7ada 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -322,7 +322,6 @@ static u32 clip_hash(const void *pkey, const struct net_device *dev, __u32 rnd)
 
 static struct neigh_table clip_tbl = {
 	.family 	= AF_INET,
-	.entry_size 	= sizeof(struct neighbour)+sizeof(struct atmarp_entry),
 	.key_len 	= 4,
 	.hash 		= clip_hash,
 	.constructor 	= clip_constructor,
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 5c29ac5..fd4b3e8 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -164,7 +164,6 @@ static const struct neigh_ops arp_broken_ops = {
 
 struct neigh_table arp_tbl = {
 	.family		= AF_INET,
-	.entry_size	= sizeof(struct neighbour) + 4,
 	.key_len	= 4,
 	.hash		= arp_hash,
 	.constructor	= arp_constructor,
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 2854705..cfb9709 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -126,7 +126,6 @@ static const struct neigh_ops ndisc_direct_ops = {
 
 struct neigh_table nd_tbl = {
 	.family =	AF_INET6,
-	.entry_size =	sizeof(struct neighbour) + sizeof(struct in6_addr),
 	.key_len =	sizeof(struct in6_addr),
 	.hash =		ndisc_hash,
 	.constructor =	ndisc_constructor,
-- 
1.7.6.4

^ permalink raw reply related

* [PATCH 5/7] atm: clip: Convert over to neighbour_priv()
From: David Miller @ 2011-12-01  3:41 UTC (permalink / raw)
  To: netdev


Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/atmclip.h |    2 --
 net/atm/clip.c        |   28 +++++++++++++++-------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index 497ef64..852a3b2 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -15,7 +15,6 @@
 
 
 #define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back))
-#define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key)
 
 struct sk_buff;
 
@@ -36,7 +35,6 @@ struct clip_vcc {
 
 
 struct atmarp_entry {
-	__be32		ip;		/* IP address */
 	struct clip_vcc	*vccs;		/* active VCCs; NULL if resolution is
 					   pending */
 	unsigned long	expires;	/* entry expiration time */
diff --git a/net/atm/clip.c b/net/atm/clip.c
index b1c7ada..a9d3484 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -119,7 +119,7 @@ out:
 /* The neighbour entry n->lock is held. */
 static int neigh_check_cb(struct neighbour *n)
 {
-	struct atmarp_entry *entry = NEIGH2ENTRY(n);
+	struct atmarp_entry *entry = neighbour_priv(n);
 	struct clip_vcc *cv;
 
 	for (cv = entry->vccs; cv; cv = cv->next) {
@@ -262,8 +262,10 @@ static void clip_pop(struct atm_vcc *vcc, struct sk_buff *skb)
 
 static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb)
 {
+	__be32 *ip = (__be32 *) neigh->primary_key;
+
 	pr_debug("(neigh %p, skb %p)\n", neigh, skb);
-	to_atmarpd(act_need, PRIV(neigh->dev)->number, NEIGH2ENTRY(neigh)->ip);
+	to_atmarpd(act_need, PRIV(neigh->dev)->number, *ip);
 }
 
 static void clip_neigh_error(struct neighbour *neigh, struct sk_buff *skb)
@@ -284,13 +286,13 @@ static const struct neigh_ops clip_neigh_ops = {
 
 static int clip_constructor(struct neighbour *neigh)
 {
-	struct atmarp_entry *entry = NEIGH2ENTRY(neigh);
+	struct atmarp_entry *entry = neighbour_priv(neigh);
 	struct net_device *dev = neigh->dev;
 	struct in_device *in_dev;
 	struct neigh_parms *parms;
 
 	pr_debug("(neigh %p, entry %p)\n", neigh, entry);
-	neigh->type = inet_addr_type(&init_net, entry->ip);
+	neigh->type = inet_addr_type(&init_net, *((__be32 *) neigh->primary_key));
 	if (neigh->type != RTN_UNICAST)
 		return -EINVAL;
 
@@ -398,12 +400,12 @@ static netdev_tx_t clip_start_xmit(struct sk_buff *skb,
 		dev->stats.tx_dropped++;
 		return NETDEV_TX_OK;
 	}
-	entry = NEIGH2ENTRY(n);
+	entry = neighbour_priv(n);
 	if (!entry->vccs) {
 		if (time_after(jiffies, entry->expires)) {
 			/* should be resolved */
 			entry->expires = jiffies + ATMARP_RETRY_DELAY * HZ;
-			to_atmarpd(act_need, PRIV(dev)->number, entry->ip);
+			to_atmarpd(act_need, PRIV(dev)->number, *((__be32 *)n->primary_key));
 		}
 		if (entry->neigh->arp_queue.qlen < ATMARP_MAX_UNRES_PACKETS)
 			skb_queue_tail(&entry->neigh->arp_queue, skb);
@@ -510,7 +512,7 @@ static int clip_setentry(struct atm_vcc *vcc, __be32 ip)
 	ip_rt_put(rt);
 	if (!neigh)
 		return -ENOMEM;
-	entry = NEIGH2ENTRY(neigh);
+	entry = neighbour_priv(neigh);
 	if (entry != clip_vcc->entry) {
 		if (!clip_vcc->entry)
 			pr_debug("add\n");
@@ -771,9 +773,10 @@ static void svc_addr(struct seq_file *seq, struct sockaddr_atmsvc *addr)
 /* This means the neighbour entry has no attached VCC objects. */
 #define SEQ_NO_VCC_TOKEN	((void *) 2)
 
-static void atmarp_info(struct seq_file *seq, struct net_device *dev,
+static void atmarp_info(struct seq_file *seq, struct neighbour *n,
 			struct atmarp_entry *entry, struct clip_vcc *clip_vcc)
 {
+	struct net_device *dev = n->dev;
 	unsigned long exp;
 	char buf[17];
 	int svc, llc, off;
@@ -793,8 +796,7 @@ static void atmarp_info(struct seq_file *seq, struct net_device *dev,
 	seq_printf(seq, "%-6s%-4s%-4s%5ld ",
 		   dev->name, svc ? "SVC" : "PVC", llc ? "LLC" : "NULL", exp);
 
-	off = scnprintf(buf, sizeof(buf) - 1, "%pI4",
-			&entry->ip);
+	off = scnprintf(buf, sizeof(buf) - 1, "%pI4", n->primary_key);
 	while (off < 16)
 		buf[off++] = ' ';
 	buf[off] = '\0';
@@ -865,7 +867,7 @@ static void *clip_seq_sub_iter(struct neigh_seq_state *_state,
 {
 	struct clip_seq_state *state = (struct clip_seq_state *)_state;
 
-	return clip_seq_vcc_walk(state, NEIGH2ENTRY(n), pos);
+	return clip_seq_vcc_walk(state, neighbour_priv(n), pos);
 }
 
 static void *clip_seq_start(struct seq_file *seq, loff_t * pos)
@@ -884,10 +886,10 @@ static int clip_seq_show(struct seq_file *seq, void *v)
 		seq_puts(seq, atm_arp_banner);
 	} else {
 		struct clip_seq_state *state = seq->private;
-		struct neighbour *n = v;
 		struct clip_vcc *vcc = state->vcc;
+		struct neighbour *n = v;
 
-		atmarp_info(seq, n->dev, NEIGH2ENTRY(n), vcc);
+		atmarp_info(seq, n, neighbour_priv(n), vcc);
 	}
 	return 0;
 }
-- 
1.7.6.4

^ permalink raw reply related

* [PATCH 6/7] neigh: Add device constructor/destructor capability.
From: David Miller @ 2011-12-01  3:41 UTC (permalink / raw)
  To: netdev


If the neigh entry has device private state, it will need
constructor/destructor ops.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/linux/netdevice.h |    2 ++
 net/core/neighbour.c      |   15 ++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5462c2c..1c4ddb3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -974,6 +974,8 @@ struct net_device_ops {
 						    netdev_features_t features);
 	int			(*ndo_set_features)(struct net_device *dev,
 						    netdev_features_t features);
+	int			(*ndo_neigh_construct)(struct neighbour *n);
+	int			(*ndo_neigh_destroy)(struct neighbour *n);
 };
 
 /*
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index ef750ff..cdf8dc3 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -489,6 +489,14 @@ struct neighbour *neigh_create(struct neigh_table *tbl, const void *pkey,
 		goto out_neigh_release;
 	}
 
+	if (dev->netdev_ops->ndo_neigh_construct) {
+		error = dev->netdev_ops->ndo_neigh_construct(n);
+		if (error < 0) {
+			rc = ERR_PTR(error);
+			goto out_neigh_release;
+		}
+	}
+
 	/* Device specific setup. */
 	if (n->parms->neigh_setup &&
 	    (error = n->parms->neigh_setup(n)) < 0) {
@@ -692,6 +700,8 @@ static inline void neigh_parms_put(struct neigh_parms *parms)
  */
 void neigh_destroy(struct neighbour *neigh)
 {
+	struct net_device *dev = neigh->dev;
+
 	NEIGH_CACHE_STAT_INC(neigh->tbl, destroys);
 
 	if (!neigh->dead) {
@@ -707,7 +717,10 @@ void neigh_destroy(struct neighbour *neigh)
 	skb_queue_purge(&neigh->arp_queue);
 	neigh->arp_queue_len_bytes = 0;
 
-	dev_put(neigh->dev);
+	if (dev->netdev_ops->ndo_neigh_destroy)
+		dev->netdev_ops->ndo_neigh_destroy(neigh);
+
+	dev_put(dev);
 	neigh_parms_put(neigh->parms);
 
 	NEIGH_PRINTK2("neigh %p is destroyed.\n", neigh);
-- 
1.7.6.4

^ permalink raw reply related

* [PATCH 7/7] atm: clip: Use device neigh support on top of "arp_tbl".
From: David Miller @ 2011-12-01  3:41 UTC (permalink / raw)
  To: netdev


Instead of instantiating an entire new neigh_table instance
just for ATM handling, use the neigh device private facility.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/atmclip.h |    5 ---
 net/atm/clip.c        |   86 ++++++++-----------------------------------------
 net/ipv4/arp.c        |    5 ---
 net/ipv4/route.c      |   10 +----
 4 files changed, 16 insertions(+), 90 deletions(-)

diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index 852a3b2..5865924 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -41,17 +41,12 @@ struct atmarp_entry {
 	struct neighbour *neigh;	/* neighbour back-pointer */
 };
 
-
 #define PRIV(dev) ((struct clip_priv *) netdev_priv(dev))
 
-
 struct clip_priv {
 	int number;			/* for convenience ... */
 	spinlock_t xoff_lock;		/* ensures that pop is atomic (SMP) */
 	struct net_device *next;	/* next CLIP interface */
 };
 
-
-extern struct neigh_table *clip_tbl_hook;
-
 #endif
diff --git a/net/atm/clip.c b/net/atm/clip.c
index a9d3484..f3b3615 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <net/route.h> /* for struct rtable and routing */
 #include <net/icmp.h> /* icmp_send */
+#include <net/arp.h>
 #include <linux/param.h> /* for HZ */
 #include <linux/uaccess.h>
 #include <asm/byteorder.h> /* for htons etc. */
@@ -287,70 +288,23 @@ static const struct neigh_ops clip_neigh_ops = {
 static int clip_constructor(struct neighbour *neigh)
 {
 	struct atmarp_entry *entry = neighbour_priv(neigh);
-	struct net_device *dev = neigh->dev;
-	struct in_device *in_dev;
-	struct neigh_parms *parms;
 
-	pr_debug("(neigh %p, entry %p)\n", neigh, entry);
-	neigh->type = inet_addr_type(&init_net, *((__be32 *) neigh->primary_key));
-	if (neigh->type != RTN_UNICAST)
+	if (neigh->tbl->family != AF_INET)
 		return -EINVAL;
 
-	rcu_read_lock();
-	in_dev = __in_dev_get_rcu(dev);
-	if (!in_dev) {
-		rcu_read_unlock();
+	if (neigh->type != RTN_UNICAST)
 		return -EINVAL;
-	}
-
-	parms = in_dev->arp_parms;
-	__neigh_parms_put(neigh->parms);
-	neigh->parms = neigh_parms_clone(parms);
-	rcu_read_unlock();
 
+	neigh->nud_state = NUD_NONE;
 	neigh->ops = &clip_neigh_ops;
-	neigh->output = neigh->nud_state & NUD_VALID ?
-	    neigh->ops->connected_output : neigh->ops->output;
+	neigh->output = neigh->ops->output;
 	entry->neigh = neigh;
 	entry->vccs = NULL;
 	entry->expires = jiffies - 1;
+
 	return 0;
 }
 
-static u32 clip_hash(const void *pkey, const struct net_device *dev, __u32 rnd)
-{
-	return jhash_2words(*(u32 *) pkey, dev->ifindex, rnd);
-}
-
-static struct neigh_table clip_tbl = {
-	.family 	= AF_INET,
-	.key_len 	= 4,
-	.hash 		= clip_hash,
-	.constructor 	= clip_constructor,
-	.id 		= "clip_arp_cache",
-
-	/* parameters are copied from ARP ... */
-	.parms = {
-		.tbl 			= &clip_tbl,
-		.base_reachable_time 	= 30 * HZ,
-		.retrans_time 		= 1 * HZ,
-		.gc_staletime 		= 60 * HZ,
-		.reachable_time 	= 30 * HZ,
-		.delay_probe_time 	= 5 * HZ,
-		.queue_len_bytes 	= 64 * 1024,
-		.ucast_probes 		= 3,
-		.mcast_probes 		= 3,
-		.anycast_delay 		= 1 * HZ,
-		.proxy_delay 		= (8 * HZ) / 10,
-		.proxy_qlen 		= 64,
-		.locktime 		= 1 * HZ,
-	},
-	.gc_interval 	= 30 * HZ,
-	.gc_thresh1 	= 128,
-	.gc_thresh2 	= 512,
-	.gc_thresh3 	= 1024,
-};
-
 /* @@@ copy bh locking from arp.c -- need to bh-enable atm code before */
 
 /*
@@ -508,7 +462,7 @@ static int clip_setentry(struct atm_vcc *vcc, __be32 ip)
 	rt = ip_route_output(&init_net, ip, 0, 1, 0);
 	if (IS_ERR(rt))
 		return PTR_ERR(rt);
-	neigh = __neigh_lookup(&clip_tbl, &ip, rt->dst.dev, 1);
+	neigh = __neigh_lookup(&arp_tbl, &ip, rt->dst.dev, 1);
 	ip_rt_put(rt);
 	if (!neigh)
 		return -ENOMEM;
@@ -529,7 +483,8 @@ static int clip_setentry(struct atm_vcc *vcc, __be32 ip)
 }
 
 static const struct net_device_ops clip_netdev_ops = {
-	.ndo_start_xmit = clip_start_xmit,
+	.ndo_start_xmit		= clip_start_xmit,
+	.ndo_neigh_construct	= clip_constructor,
 };
 
 static void clip_setup(struct net_device *dev)
@@ -590,10 +545,8 @@ static int clip_device_event(struct notifier_block *this, unsigned long event,
 	if (!net_eq(dev_net(dev), &init_net))
 		return NOTIFY_DONE;
 
-	if (event == NETDEV_UNREGISTER) {
-		neigh_ifdown(&clip_tbl, dev);
+	if (event == NETDEV_UNREGISTER)
 		return NOTIFY_DONE;
-	}
 
 	/* ignore non-CLIP devices */
 	if (dev->type != ARPHRD_ATM || dev->netdev_ops != &clip_netdev_ops)
@@ -867,6 +820,9 @@ static void *clip_seq_sub_iter(struct neigh_seq_state *_state,
 {
 	struct clip_seq_state *state = (struct clip_seq_state *)_state;
 
+	if (n->dev->type != ARPHRD_ATM)
+		return NULL;
+
 	return clip_seq_vcc_walk(state, neighbour_priv(n), pos);
 }
 
@@ -874,7 +830,7 @@ static void *clip_seq_start(struct seq_file *seq, loff_t * pos)
 {
 	struct clip_seq_state *state = seq->private;
 	state->ns.neigh_sub_iter = clip_seq_sub_iter;
-	return neigh_seq_start(seq, pos, &clip_tbl, NEIGH_SEQ_NEIGH_ONLY);
+	return neigh_seq_start(seq, pos, &arp_tbl, NEIGH_SEQ_NEIGH_ONLY);
 }
 
 static int clip_seq_show(struct seq_file *seq, void *v)
@@ -920,9 +876,6 @@ static void atm_clip_exit_noproc(void);
 
 static int __init atm_clip_init(void)
 {
-	neigh_table_init_no_netlink(&clip_tbl);
-
-	clip_tbl_hook = &clip_tbl;
 	register_atm_ioctl(&clip_ioctl_ops);
 	register_netdevice_notifier(&clip_dev_notifier);
 	register_inetaddr_notifier(&clip_inet_notifier);
@@ -959,12 +912,6 @@ static void atm_clip_exit_noproc(void)
 	 */
 	del_timer_sync(&idle_timer);
 
-	/* Next, purge the table, so that the device
-	 * unregister loop below does not hang due to
-	 * device references remaining in the table.
-	 */
-	neigh_ifdown(&clip_tbl, NULL);
-
 	dev = clip_devs;
 	while (dev) {
 		next = PRIV(dev)->next;
@@ -972,11 +919,6 @@ static void atm_clip_exit_noproc(void)
 		free_netdev(dev);
 		dev = next;
 	}
-
-	/* Now it is safe to fully shutdown whole table. */
-	neigh_table_clear(&clip_tbl);
-
-	clip_tbl_hook = NULL;
 }
 
 static void __exit atm_clip_exit(void)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index fd4b3e8..ff324eb 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -112,11 +112,6 @@
 #include <net/arp.h>
 #include <net/ax25.h>
 #include <net/netrom.h>
-#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
-#include <net/atmclip.h>
-struct neigh_table *clip_tbl_hook;
-EXPORT_SYMBOL(clip_tbl_hook);
-#endif
 
 #include <asm/system.h>
 #include <linux/uaccess.h>
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index fb47c8f..9a20663 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -108,7 +108,6 @@
 #ifdef CONFIG_SYSCTL
 #include <linux/sysctl.h>
 #endif
-#include <net/atmclip.h>
 #include <net/secure_seq.h>
 
 #define RT_FL_TOS(oldflp4) \
@@ -1013,23 +1012,18 @@ static int slow_chain_length(const struct rtable *head)
 
 static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, const void *daddr)
 {
-	struct neigh_table *tbl = &arp_tbl;
 	static const __be32 inaddr_any = 0;
 	struct net_device *dev = dst->dev;
 	const __be32 *pkey = daddr;
 	struct neighbour *n;
 
-#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
-	if (dev->type == ARPHRD_ATM)
-		tbl = clip_tbl_hook;
-#endif
 	if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT))
 		pkey = &inaddr_any;
 
-	n = __ipv4_neigh_lookup(tbl, dev, *(__force u32 *)pkey);
+	n = __ipv4_neigh_lookup(&arp_tbl, dev, *(__force u32 *)pkey);
 	if (n)
 		return n;
-	return neigh_create(tbl, pkey, dev);
+	return neigh_create(&arp_tbl, pkey, dev);
 }
 
 static int rt_bind_neighbour(struct rtable *rt)
-- 
1.7.6.4

^ permalink raw reply related

* Re: Bug in computing data_len in tcp_sendmsg?
From: Eric Dumazet @ 2011-12-01  3:42 UTC (permalink / raw)
  To: Tom Herbert; +Cc: Linux Netdev List, David Miller
In-Reply-To: <CA+mtBx8+sajFaCWqHRr+pY5EAHwN8G61v6cr-HydYhbbdxAgHQ@mail.gmail.com>

Le mercredi 30 novembre 2011 à 17:48 -0800, Tom Herbert a écrit :
> I believe that skb->data_len might no be computed correctly in
> tcp_sendmsg.  Specifically, when skb_add_data_nocache (or
> skb_add_data) is called skb->data_len is not updated (skb_put only
> updates skb->len).  This results in the datalen in the head skbuf
> being zero so any subsequent uses of the value lead to incorrect
> results.  For instance, skb_headlen returns the length of the head
> skbu data and not just that of the headers.  If I'm reading this
> correctly, it's a pretty fundamental bug.
> 
> I don't have a fix for this yet.
> 
> Tom

On which tree do you see a problem ?

For example net-next seems fine to me :


static inline int skb_copy_to_page_nocache(struct sock *sk, char __user *from,
                                           struct sk_buff *skb,
                                           struct page *page,
                                           int off, int copy)
{
        int err;

        err = skb_do_copy_data_nocache(sk, skb, from, page_address(page) + off,
                                       copy, skb->len);
        if (err)
                return err;

        skb->len             += copy;
        skb->data_len        += copy;
        skb->truesize        += copy;
        sk->sk_wmem_queued   += copy;
        sk_mem_charge(sk, copy);
        return 0;
}

^ permalink raw reply

* Re: [PATCH] netconsole: implement ipv4 tos support
From: Eric Dumazet @ 2011-12-01  3:50 UTC (permalink / raw)
  To: Maciej Żenczykowski; +Cc: Stephen Hemminger, netdev
In-Reply-To: <CANP3RGfwUr3ho3Tz_cfVz4CBJWMktOb7MDbUYYXz7XfjErw7Zg@mail.gmail.com>

Le mercredi 30 novembre 2011 à 18:11 -0800, Maciej Żenczykowski a
écrit :

> TOS values are relevant within a LAN/WAN/Organization/AS, but are not
> relevant internet-wide.
> Almost all AS-boundary gateways/routers will do TOS remarking to their
> own internal specifications.

Thats a shame, especially if ECN is screwed up.

^ permalink raw reply

* Re: [PATCH] bonding: only use primary address for ARP
From: David Miller @ 2011-12-01  4:00 UTC (permalink / raw)
  To: andy; +Cc: henrik.e.persson, netdev, fubar
In-Reply-To: <20111130220709.GI25132@gospo.rdu.redhat.com>

From: Andy Gospodarek <andy@greyhouse.net>
Date: Wed, 30 Nov 2011 17:07:10 -0500

> On Thu, Nov 24, 2011 at 10:37:15AM +0100, Henrik Saavedra Persson wrote:
>> Only use the primary address of the bond device
>> for master_ip. This will prevent changing the ARP source
>> address in Active-Backup mode whenever a secondry address
>> is added to the bond device.
>> 
>> Signed-off-by: Henrik Saavedra Persson <henrik.e.persson@ericsson.com>
 ...
> Signed-off-by: Andy Gospodarek <andy@greyhouse.net>

Applied, thanks for reviewing Andy.

^ permalink raw reply

* Re: [PATCH] bridge: Cannot communicate with brX when its MAC address is changed
From: David Miller @ 2011-12-01  4:02 UTC (permalink / raw)
  To: sanagi.koki; +Cc: shemminger, bridge, netdev
In-Reply-To: <4ED5E9D6.3070404@jp.fujitsu.com>

From: Koki Sanagi <sanagi.koki@jp.fujitsu.com>
Date: Wed, 30 Nov 2011 17:31:18 +0900

> When the MAC address of a bridge interface is changed, it cannot communicate
> with others. Because Whether or not a packet should be transferred to bridge
> interface depends on whether or not dst of a packet is in fdb and is_local=y.
> If we change MAC address of a bridge interface, it isn't in fdb.
> 
> This patch adds an condition that dst of a packet matches MAC address of
> a bridge interface to the conventional condition.
> 
> Signed-off-by: Koki Sanagi <sanagi.koki@jp.fujitsu.com>

This looks like a patch I've seen before, and in any event it makes
more sense to update the FDB when the MAC changes instead of adding a
special bypass rule.

Stephen?

> ---
>  net/bridge/br_input.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
> index 5a31731..4e5c862 100644
> --- a/net/bridge/br_input.c
> +++ b/net/bridge/br_input.c
> @@ -94,7 +94,8 @@ int br_handle_frame_finish(struct sk_buff *skb)
>  			skb2 = skb;
>  
>  		br->dev->stats.multicast++;
> -	} else if ((dst = __br_fdb_get(br, dest)) && dst->is_local) {
> +	} else if ((dst = __br_fdb_get(br, dest) && dst->is_local) ||
> +		   !compare_ether_addr(p->br->dev->dev_addr, dest)) {
>  		skb2 = skb;
>  		/* Do not forward the packet since it's local. */
>  		skb = NULL;

^ permalink raw reply

* Re: Bug in computing data_len in tcp_sendmsg?
From: Tom Herbert @ 2011-12-01  4:06 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Linux Netdev List, David Miller
In-Reply-To: <1322710962.2577.3.camel@edumazet-laptop>

On Wed, Nov 30, 2011 at 7:42 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le mercredi 30 novembre 2011 à 17:48 -0800, Tom Herbert a écrit :
>> I believe that skb->data_len might no be computed correctly in
>> tcp_sendmsg.  Specifically, when skb_add_data_nocache (or
>> skb_add_data) is called skb->data_len is not updated (skb_put only
>> updates skb->len).  This results in the datalen in the head skbuf
>> being zero so any subsequent uses of the value lead to incorrect
>> results.  For instance, skb_headlen returns the length of the head
>> skbu data and not just that of the headers.  If I'm reading this
>> correctly, it's a pretty fundamental bug.
>>
>> I don't have a fix for this yet.
>>
>> Tom
>
> On which tree do you see a problem ?
>
> For example net-next seems fine to me :
>
>

On net-next.  Look at skb_add_data_nocache.  This doesn't touch
data_len, and really can't since skb_put wants skb linearized.

Actually, I think I am misinterpreting the meaning of data_len, looks
like it is intended to return the number of bytes in the page buffer
area (comment on the function would be have been nice ;-) ).  It would
seem that e1000e driver might be misinterpreting it also:

        segs = skb_shinfo(skb)->gso_segs ? : 1;
        /* multiply data chunks by size of headers */
        bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len;

So maybe the bug is  that e1000e is misusing the function (and it
looks like some other drivers would be too)?.

^ permalink raw reply

* Re: Bug in computing data_len in tcp_sendmsg?
From: David Miller @ 2011-12-01  4:16 UTC (permalink / raw)
  To: therbert; +Cc: eric.dumazet, netdev
In-Reply-To: <CA+mtBx_CUsuGunKONwBNA8qyVni16+RtrRL8w=THYY0mEDcvaA@mail.gmail.com>

From: Tom Herbert <therbert@google.com>
Date: Wed, 30 Nov 2011 20:06:09 -0800

> Actually, I think I am misinterpreting the meaning of data_len, looks
> like it is intended to return the number of bytes in the page buffer
> area

skb->len is all bytes, skb->data_len covers only segmented portion.

> (comment on the function would be have been nice ;-) ).

Patches welcome, otherwise:

http://vger.kernel.org/~davem/skb.html

^ permalink raw reply

* Re: Bug in computing data_len in tcp_sendmsg?
From: Eric Dumazet @ 2011-12-01  4:17 UTC (permalink / raw)
  To: Tom Herbert; +Cc: Linux Netdev List, David Miller
In-Reply-To: <CA+mtBx_CUsuGunKONwBNA8qyVni16+RtrRL8w=THYY0mEDcvaA@mail.gmail.com>

Le mercredi 30 novembre 2011 à 20:06 -0800, Tom Herbert a écrit :
> On Wed, Nov 30, 2011 at 7:42 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Le mercredi 30 novembre 2011 à 17:48 -0800, Tom Herbert a écrit :
> >> I believe that skb->data_len might no be computed correctly in
> >> tcp_sendmsg.  Specifically, when skb_add_data_nocache (or
> >> skb_add_data) is called skb->data_len is not updated (skb_put only
> >> updates skb->len).  This results in the datalen in the head skbuf
> >> being zero so any subsequent uses of the value lead to incorrect
> >> results.  For instance, skb_headlen returns the length of the head
> >> skbu data and not just that of the headers.  If I'm reading this
> >> correctly, it's a pretty fundamental bug.
> >>
> >> I don't have a fix for this yet.
> >>
> >> Tom
> >
> > On which tree do you see a problem ?
> >
> > For example net-next seems fine to me :
> >
> >
> 
> On net-next.  Look at skb_add_data_nocache.  This doesn't touch
> data_len, and really can't since skb_put wants skb linearized.
> 
> Actually, I think I am misinterpreting the meaning of data_len, looks
> like it is intended to return the number of bytes in the page buffer
> area (comment on the function would be have been nice ;-) ).  It would
> seem that e1000e driver might be misinterpreting it also:
> 
>         segs = skb_shinfo(skb)->gso_segs ? : 1;
>         /* multiply data chunks by size of headers */
>         bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len;
> 
> So maybe the bug is  that e1000e is misusing the function (and it
> looks like some other drivers would be too)?.

Or the "bug" was to assume that skb was headless.
It was true until recently.

We recently added commit f07d960df33c5aef
(tcp: avoid frag allocation for small frames)

to avoid page allocation for small frames.

So now, skb can contain in head part of tcp data.

^ permalink raw reply

* Re: [PATCH 1/2] ipv4 : igmp : Delete useless parameter in ip_mc_add1_src()
From: David Miller @ 2011-12-01  4:17 UTC (permalink / raw)
  To: mypopydev; +Cc: netdev
In-Reply-To: <1322670065-13237-1-git-send-email-mypopydev@gmail.com>

From: Jun Zhao <mypopydev@gmail.com>
Date: Thu,  1 Dec 2011 00:21:04 +0800

> Need not to used 'delta' flag when add single-source to interface
> filter source list.
> 
> Signed-off-by: Jun Zhao <mypopydev@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH 2/2] ipv6 : mcast : Delete useless parameter in ip6_mc_add1_src()
From: David Miller @ 2011-12-01  4:17 UTC (permalink / raw)
  To: mypopydev; +Cc: netdev
In-Reply-To: <1322670065-13237-2-git-send-email-mypopydev@gmail.com>

From: Jun Zhao <mypopydev@gmail.com>
Date: Thu,  1 Dec 2011 00:21:05 +0800

> Need not to used 'delta' flag when add single-source to interface
> filter source list.
> 
> Signed-off-by: Jun Zhao <mypopydev@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH v3 net-next 1/2] netem: rate extension
From: David Miller @ 2011-12-01  4:19 UTC (permalink / raw)
  To: hagen; +Cc: netdev, eric.dumazet, shemminger
In-Reply-To: <1322691627-20551-1-git-send-email-hagen@jauu.net>

From: Hagen Paul Pfeifer <hagen@jauu.net>
Date: Wed, 30 Nov 2011 23:20:26 +0100

> Currently netem is not in the ability to emulate channel bandwidth. Only static
> delay (and optional random jitter) can be configured.
> 
> To emulate the channel rate the token bucket filter (sch_tbf) can be used.  But
> TBF has some major emulation flaws. The buffer (token bucket depth/rate) cannot
> be 0. Also the idea behind TBF is that the credit (token in buckets) fills if
> no packet is transmitted. So that there is always a "positive" credit for new
> packets. In real life this behavior contradicts the law of nature where
> nothing can travel faster as speed of light. E.g.: on an emulated 1000 byte/s
> link a small IPv4/TCP SYN packet with ~50 byte require ~0.05 seconds - not 0
> seconds.
> 
> Netem is an excellent place to implement a rate limiting feature: static
> delay is already implemented, tfifo already has time information and the
> user can skip TBF configuration completely.
> 
> This patch implement rate feature which can be configured via tc. e.g:
> 
> 	tc qdisc add dev eth0 root netem rate 10kbit
> 
> To emulate a link of 5000byte/s and add an additional static delay of 10ms:
> 
> 	tc qdisc add dev eth0 root netem delay 10ms rate 5KBps
> 
> Note: similar to TBF the rate extension is bounded to the kernel timing
> system. Depending on the architecture timer granularity, higher rates (e.g.
> 10mbit/s and higher) tend to transmission bursts. Also note: further queues
> living in network adaptors; see ethtool(8).
> 
> Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH V2] sch_red: fix red_calc_qavg_from_idle_time
From: David Miller @ 2011-12-01  4:29 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, shemminger, dave.taht
In-Reply-To: <1322691053.2602.24.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 30 Nov 2011 23:10:53 +0100

> Since commit a4a710c4a7490587 (pkt_sched: Change PSCHED_SHIFT from 10 to
> 6) it seems RED/GRED are broken.
> 
> red_calc_qavg_from_idle_time() computes a delay in us units, but this
> delay is now 16 times bigger than real delay, so the final qavg result
> smaller than expected.
> 
> Use standard kernel time services since there is no need to obfuscate
> them.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied and queued up for -stable, thanks Eric.

If someone is looking for a fun project, I would like to see
psched_t obliterated completely and replaced with ktime_t across
the board.

To be honest, psched_t was created exactly because at the time we
lacked something like ktime_t.

^ permalink raw reply

* Re: Is there any necessary to add multicast route for a loopback device?
From: Li Wei @ 2011-12-01  4:31 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20111130.223539.675481575068605501.davem@davemloft.net>

> From: Li Wei <lw@cn.fujitsu.com>
> Date: Thu, 01 Dec 2011 10:30:00 +0800
> 
>> what's your opinion?
> 
> I have many higher priority tasks than this issue, so it is a poor
> idea to try and force me to look into this.
> 
> If no other developer cares to answer, maybe it isn't all that
> important.
> 
> 

My apologize :(

^ permalink raw reply

* Re: [PATCH RESEND net/stable] gro: reset vlan_tci on reuse
From: David Miller @ 2011-12-01  4:32 UTC (permalink / raw)
  To: bpoirier; +Cc: netdev, stable, jesse
In-Reply-To: <1322657238-17159-1-git-send-email-bpoirier@suse.de>

From: Benjamin Poirier <bpoirier@suse.de>
Date: Wed, 30 Nov 2011 07:47:18 -0500

> For drivers using the vlan_gro_frags() interface, a packet with an invalid tci
> leads to GRO_DROP and napi_reuse_skb(). The skb has to be sanitized before
> being reused or we may send an skb with an invalid vlan_tci field up the stack
> where it is not expected.
> 
> Signed-off-by: Benjamin Poirier <bpoirier@suse.de>
> Cc: Jesse Gross <jesse@nicira.com>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply

* [PATCH] net: net_device flags is an unsigned int
From: Eric Dumazet @ 2011-12-01  4:34 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

commit b00055aacdb ([NET] core: add RFC2863 operstate) changed
net_device flags from unsigned short to unsigned int.

Some core functions still assume its an unsigned short.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/core/dev.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 1482eea..1c345cf 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4538,7 +4538,7 @@ static void dev_change_rx_flags(struct net_device *dev, int flags)
 
 static int __dev_set_promiscuity(struct net_device *dev, int inc)
 {
-	unsigned short old_flags = dev->flags;
+	typeof(dev->flags) old_flags = dev->flags;
 	uid_t uid;
 	gid_t gid;
 
@@ -4595,7 +4595,7 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc)
  */
 int dev_set_promiscuity(struct net_device *dev, int inc)
 {
-	unsigned short old_flags = dev->flags;
+	typeof(dev->flags) old_flags = dev->flags;
 	int err;
 
 	err = __dev_set_promiscuity(dev, inc);
@@ -4622,7 +4622,7 @@ EXPORT_SYMBOL(dev_set_promiscuity);
 
 int dev_set_allmulti(struct net_device *dev, int inc)
 {
-	unsigned short old_flags = dev->flags;
+	typeof(dev->flags) old_flags = dev->flags;
 
 	ASSERT_RTNL();
 

^ permalink raw reply related

* Re: Is there any necessary to add multicast route for a loopback device?
From: Eric Dumazet @ 2011-12-01  4:36 UTC (permalink / raw)
  To: Li Wei; +Cc: David Miller, netdev
In-Reply-To: <4ED70332.4000405@cn.fujitsu.com>

Le jeudi 01 décembre 2011 à 12:31 +0800, Li Wei a écrit :
> > From: Li Wei <lw@cn.fujitsu.com>
> > Date: Thu, 01 Dec 2011 10:30:00 +0800
> > 
> >> what's your opinion?
> > 
> > I have many higher priority tasks than this issue, so it is a poor
> > idea to try and force me to look into this.
> > 
> > If no other developer cares to answer, maybe it isn't all that
> > important.
> > 
> > 
> 
> My apologize :(

It would help us if you provide a test program an setup script, because
we have litle time to figure out what exact problem you hit.

^ permalink raw reply

* Re: [PATCH net-next 1/3] caif: Allow cfpkt_extr_head to process empty message
From: David Miller @ 2011-12-01  4:37 UTC (permalink / raw)
  To: sjur.brandeland; +Cc: netdev
In-Reply-To: <1322680968-6470-1-git-send-email-sjur.brandeland@stericsson.com>

From: Sjur Brændeland <sjur.brandeland@stericsson.com>
Date: Wed, 30 Nov 2011 20:22:46 +0100

> Allow NULL pointer in cfpkt_extr_head in order to
> skip past header data.
> 
> Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next 2/3] caif: Restructure how link caif link layer enroll
From: David Miller @ 2011-12-01  4:38 UTC (permalink / raw)
  To: sjur.brandeland; +Cc: netdev
In-Reply-To: <1322680968-6470-2-git-send-email-sjur.brandeland@stericsson.com>

From: Sjur Brændeland <sjur.brandeland@stericsson.com>
Date: Wed, 30 Nov 2011 20:22:47 +0100

> Enrolling CAIF link layers are refactored.
> 
> Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next 3/3] caif: Remove unused enum and parameter in cfserl
From: David Miller @ 2011-12-01  4:38 UTC (permalink / raw)
  To: sjur.brandeland; +Cc: netdev
In-Reply-To: <1322680968-6470-3-git-send-email-sjur.brandeland@stericsson.com>

From: Sjur Brændeland <sjur.brandeland@stericsson.com>
Date: Wed, 30 Nov 2011 20:22:48 +0100

> Remove unused enum cfcnfg_phy_type and the parameter to cfserl_create.
> 
> Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>

Applied.

^ permalink raw reply

* Re: [PATCH] caif: Remove unused attributes from struct cflayer
From: David Miller @ 2011-12-01  4:38 UTC (permalink / raw)
  To: sjur.brandeland; +Cc: netdev
In-Reply-To: <1322694152-5422-1-git-send-email-sjur.brandeland@stericsson.com>

From: Sjur Brændeland <sjur.brandeland@stericsson.com>
Date: Thu,  1 Dec 2011 00:02:32 +0100

> Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>

Applied.

^ permalink raw reply

* Re: [PATCH] net: net_device flags is an unsigned int
From: David Miller @ 2011-12-01  4:39 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1322714077.2577.12.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 01 Dec 2011 05:34:37 +0100

> -	unsigned short old_flags = dev->flags;
> +	typeof(dev->flags) old_flags = dev->flags;

Please, create netdev_flags_t or similar, anything but this :-)

^ permalink raw reply

* Re: [PATCH] net/core: fix rollback handler in register_netdevice_notifier
From: David Miller @ 2011-12-01  4:43 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev
In-Reply-To: <1322707070-9514-1-git-send-email-roy.qing.li@gmail.com>

From: roy.qing.li@gmail.com
Date: Thu,  1 Dec 2011 10:37:50 +0800

> From: RongQing.Li <roy.qing.li@gmail.com>
> 
> Within nested statements, the break statement terminates only the
> do, for, switch, or while statement that immediately encloses it,
> So replace the break with goto.
> 
> Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>

Good catch, applied, thanks.

^ 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