Netdev List
 help / color / mirror / Atom feed
* [PATCH net] bridge: flush br's address entry in fdb when remove the bridge dev
From: Ding Tianhong @ 2013-11-18  8:26 UTC (permalink / raw)
  To: Stephen Hemminger, David S. Miller, bridge, Netdev

When the following commands are executed:

brctl addbr br0
ifconfig br0 hw ether <addr>
rmmod bridge

The calltrace will occur:

[  563.312114] device eth1 left promiscuous mode
[  563.312188] br0: port 1(eth1) entered disabled state
[  563.468190] kmem_cache_destroy bridge_fdb_cache: Slab cache still has objects
[  563.468197] CPU: 6 PID: 6982 Comm: rmmod Tainted: G           O 3.12.0-0.7-default+ #9
[  563.468199] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
[  563.468200]  0000000000000880 ffff88010f111e98 ffffffff814d1c92 ffff88010f111eb8
[  563.468204]  ffffffff81148efd ffff88010f111eb8 0000000000000000 ffff88010f111ec8
[  563.468206]  ffffffffa062a270 ffff88010f111ed8 ffffffffa063ac76 ffff88010f111f78
[  563.468209] Call Trace:
[  563.468218]  [<ffffffff814d1c92>] dump_stack+0x6a/0x78
[  563.468234]  [<ffffffff81148efd>] kmem_cache_destroy+0xfd/0x100
[  563.468242]  [<ffffffffa062a270>] br_fdb_fini+0x10/0x20 [bridge]
[  563.468247]  [<ffffffffa063ac76>] br_deinit+0x4e/0x50 [bridge]
[  563.468254]  [<ffffffff810c7dc9>] SyS_delete_module+0x199/0x2b0
[  563.468259]  [<ffffffff814e0922>] system_call_fastpath+0x16/0x1b
[  570.377958] Bridge firewalling registered

------------------------- cut here ---------------------------

The reason is that if the bridge dev's address is changed, the
br_fdb_change_mac_address() will add new address in fdb, but when
the bridge was removed, the address entry in the fdb did not free,
the bridge_fdb_cache still has objects when destroy the cache, Fix
this by flushing the bridge address entry when removing the bridge.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 net/bridge/br_if.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index c41d5fb..baedc32 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -172,6 +172,10 @@ void br_dev_delete(struct net_device *dev, struct list_head *head)
 		del_nbp(p);
 	}
 
+	spin_lock_bh(&br->hash_lock);
+	fdb_delete_by_addr(br, br->dev->dev_addr, 0);
+	spin_unlock_bh(&br->hash_lock);
+
 	del_timer_sync(&br->gc_timer);
 
 	br_sysfs_delbr(br->dev);
-- 
1.7.12

^ permalink raw reply related

* Re: bridge: flush br's address entry in fdb when remove the bridge dev
From: Ding Tianhong @ 2013-11-18  8:34 UTC (permalink / raw)
  To: Stephen Hemminger, David S. Miller, bridge, Netdev
In-Reply-To: <5289CEFE.607@huawei.com>

On 2013/11/18 16:25, Ding Tianhong wrote:
> When the following commands are executed:
> 
> brctl addbr br0
> ifconfig br0 hw ether <addr>
> rmmod bridge
> 
> The calltrace will occur:

wrong title, miss it, please.

^ permalink raw reply

* [PATCH net v2 0/2] net: sched: fix some issues
From: Yang Yingliang @ 2013-11-18  8:39 UTC (permalink / raw)
  To: davem, netdev; +Cc: eric.dumazet, brouer, jpirko

fix a regression introduced by commit b757c9336d63f94c6b57532
(tbf: improved accuracy at high rates).
fix quantum calculation introduced by 64bit rates.

v2
  patch 1/2: redescribe the regression
  patch 2/2: add Eric's ack

Yang Yingliang (2):
  net: sched: tbf: fix calculation of max_size
  net: sched: htb: fix calculation of quantum

 include/net/sch_generic.h | 46 ++++++++++++++++++++++++++++++++
 net/sched/sch_htb.c       | 18 +++++++------
 net/sched/sch_tbf.c       | 67 ++++++++++++++++++++++++++---------------------
 3 files changed, 93 insertions(+), 38 deletions(-)

-- 
1.8.0

^ permalink raw reply

* [PATCH net v2 1/2] net: sched: tbf: fix calculation of max_size
From: Yang Yingliang @ 2013-11-18  8:39 UTC (permalink / raw)
  To: davem, netdev; +Cc: eric.dumazet, brouer, jpirko
In-Reply-To: <1384763964-5000-1-git-send-email-yangyingliang@huawei.com>

commit b757c9336d63f94c6b57532(tbf: improved accuracy at high rates)
introduce a regression.

With the follow command:
tc qdisc add dev eth1 root handle 1: tbf latency 50ms burst 10KB rate 30gbit mtu 64k

Without this patch, the max_size value is 10751(bytes).
But, in fact, the real max_size value should be smaller than 7440(bytes).
Or a packet whose length is bigger than 7440 will cause network congestion.
Because the packet is so big that can't get enough tokens. Even all the tokens
in the buffer is given to the packet.

With this patch, the max_size value is 7440(bytes).
The packets whose length is bigger than 7440(bytes) will be dropped or reshape
in tbf_enqueue().

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 include/net/sch_generic.h | 46 ++++++++++++++++++++++++++++++++
 net/sched/sch_tbf.c       | 67 ++++++++++++++++++++++++++---------------------
 2 files changed, 83 insertions(+), 30 deletions(-)

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index d0a6321..8da64f3 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -701,6 +701,52 @@ static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
 	return ((u64)len * r->mult) >> r->shift;
 }
 
+/* Time to Length, convert time in ns to length in bytes
+ * to determinate how many bytes can be sent in given time.
+ */
+static inline u64 psched_ns_t2l(const struct psched_ratecfg *r,
+				u64 time_in_ns)
+{
+	u64 len = time_in_ns;
+	u8 shift = r->shift;
+	bool is_div = false;
+
+	/* The formula is :
+	 * len = (time_in_ns << shift) / mult
+	 * when time_in_ns does shift, it would overflow.
+	 * If overflow happens first time, do division.
+	 * Then do shift. If it happens again,
+	 * set lenth to ~0ULL.
+	 */
+	while (shift) {
+		if (len & (1ULL << 63)) {
+			if (!is_div) {
+				len = div64_u64(len, r->mult);
+				is_div = true;
+			} else {
+				/* overflow happens */
+				len = ~0ULL;
+				is_div = true;
+				break;
+			}
+		}
+		len <<= 1;
+		shift--;
+	}
+	if (!is_div)
+		len = div64_u64(len, r->mult);
+
+	if (unlikely(r->linklayer == TC_LINKLAYER_ATM))
+		len = (len / 53) * 48;
+
+	if (len > r->overhead)
+		len -= r->overhead;
+	else
+		len = 0;
+
+	return len;
+}
+
 void psched_ratecfg_precompute(struct psched_ratecfg *r,
 			       const struct tc_ratespec *conf,
 			       u64 rate64);
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 68f9859..eb9ce7b 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -279,7 +279,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
 	struct qdisc_rate_table *rtab = NULL;
 	struct qdisc_rate_table *ptab = NULL;
 	struct Qdisc *child = NULL;
-	int max_size, n;
+	u32 max_size = 0;
 	u64 rate64 = 0, prate64 = 0;
 
 	err = nla_parse_nested(tb, TCA_TBF_MAX, opt, tbf_policy);
@@ -291,33 +291,20 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
 		goto done;
 
 	qopt = nla_data(tb[TCA_TBF_PARMS]);
-	rtab = qdisc_get_rtab(&qopt->rate, tb[TCA_TBF_RTAB]);
-	if (rtab == NULL)
-		goto done;
-
-	if (qopt->peakrate.rate) {
-		if (qopt->peakrate.rate > qopt->rate.rate)
-			ptab = qdisc_get_rtab(&qopt->peakrate, tb[TCA_TBF_PTAB]);
-		if (ptab == NULL)
-			goto done;
+	if (qopt->rate.linklayer == TC_LINKLAYER_UNAWARE) {
+		rtab = qdisc_get_rtab(&qopt->rate, tb[TCA_TBF_RTAB]);
+		if (rtab) {
+			qdisc_put_rtab(rtab);
+			rtab = NULL;
+		}
 	}
-
-	for (n = 0; n < 256; n++)
-		if (rtab->data[n] > qopt->buffer)
-			break;
-	max_size = (n << qopt->rate.cell_log) - 1;
-	if (ptab) {
-		int size;
-
-		for (n = 0; n < 256; n++)
-			if (ptab->data[n] > qopt->mtu)
-				break;
-		size = (n << qopt->peakrate.cell_log) - 1;
-		if (size < max_size)
-			max_size = size;
+	if (qopt->peakrate.linklayer == TC_LINKLAYER_UNAWARE) {
+		ptab = qdisc_get_rtab(&qopt->peakrate, tb[TCA_TBF_PTAB]);
+		if (ptab) {
+			qdisc_put_rtab(ptab);
+			ptab = NULL;
+		}
 	}
-	if (max_size < 0)
-		goto done;
 
 	if (q->qdisc != &noop_qdisc) {
 		err = fifo_set_limit(q->qdisc, qopt->limit);
@@ -339,25 +326,45 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
 	}
 	q->limit = qopt->limit;
 	q->mtu = PSCHED_TICKS2NS(qopt->mtu);
-	q->max_size = max_size;
 	q->buffer = PSCHED_TICKS2NS(qopt->buffer);
 	q->tokens = q->buffer;
 	q->ptokens = q->mtu;
 
 	if (tb[TCA_TBF_RATE64])
 		rate64 = nla_get_u64(tb[TCA_TBF_RATE64]);
-	psched_ratecfg_precompute(&q->rate, &rtab->rate, rate64);
-	if (ptab) {
+	psched_ratecfg_precompute(&q->rate, &qopt->rate, rate64);
+	if (!q->rate.rate_bytes_ps)
+		goto unlock_done;
+	max_size = min_t(u64, psched_ns_t2l(&q->rate, q->buffer), ~0);
+	max_size = min_t(u32, max_size, (256 << qopt->rate.cell_log) - 1);
+
+	if (qopt->peakrate.rate) {
+		u64 size = 0;
 		if (tb[TCA_TBF_PRATE64])
 			prate64 = nla_get_u64(tb[TCA_TBF_PRATE64]);
-		psched_ratecfg_precompute(&q->peak, &ptab->rate, prate64);
+		psched_ratecfg_precompute(&q->peak, &qopt->peakrate, prate64);
+		size = psched_ns_t2l(&q->peak, q->mtu);
+		max_size = min_t(u64, max_size, size);
+		max_size = min_t(u32,
+				 max_size,
+				 (256 << qopt->peakrate.cell_log) - 1);
 		q->peak_present = true;
 	} else {
 		q->peak_present = false;
 	}
 
+	if (!max_size)
+		goto unlock_done;
+	q->max_size = max_size;
+
 	sch_tree_unlock(sch);
 	err = 0;
+
+	if (0) {
+unlock_done:
+		sch_tree_unlock(sch);
+		err = -EINVAL;
+	}
 done:
 	if (rtab)
 		qdisc_put_rtab(rtab);
-- 
1.8.0

^ permalink raw reply related

* [PATCH net v2 2/2] net: sched: htb: fix calculation of quantum
From: Yang Yingliang @ 2013-11-18  8:39 UTC (permalink / raw)
  To: davem, netdev; +Cc: eric.dumazet, brouer, jpirko
In-Reply-To: <1384763964-5000-1-git-send-email-yangyingliang@huawei.com>

Now, 32bit rates may be not the true rate.
So use rate_bytes_ps which is from
max(rate32, rate64) to calcualte quantum.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Eric Dumazet <edumazet@google.com>
---
 net/sched/sch_htb.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 0e1e38b..57c6678 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1477,11 +1477,20 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
 		sch_tree_lock(sch);
 	}
 
+	rate64 = tb[TCA_HTB_RATE64] ? nla_get_u64(tb[TCA_HTB_RATE64]) : 0;
+
+	ceil64 = tb[TCA_HTB_CEIL64] ? nla_get_u64(tb[TCA_HTB_CEIL64]) : 0;
+
+	psched_ratecfg_precompute(&cl->rate, &hopt->rate, rate64);
+	psched_ratecfg_precompute(&cl->ceil, &hopt->ceil, ceil64);
+
 	/* it used to be a nasty bug here, we have to check that node
 	 * is really leaf before changing cl->un.leaf !
 	 */
 	if (!cl->level) {
-		cl->quantum = hopt->rate.rate / q->rate2quantum;
+		u64 quantum = div64_u64(cl->rate.rate_bytes_ps,
+					q->rate2quantum);
+		cl->quantum = min_t(u64, quantum, INT_MAX);
 		if (!hopt->quantum && cl->quantum < 1000) {
 			pr_warning(
 			       "HTB: quantum of class %X is small. Consider r2q change.\n",
@@ -1500,13 +1509,6 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
 			cl->prio = TC_HTB_NUMPRIO - 1;
 	}
 
-	rate64 = tb[TCA_HTB_RATE64] ? nla_get_u64(tb[TCA_HTB_RATE64]) : 0;
-
-	ceil64 = tb[TCA_HTB_CEIL64] ? nla_get_u64(tb[TCA_HTB_CEIL64]) : 0;
-
-	psched_ratecfg_precompute(&cl->rate, &hopt->rate, rate64);
-	psched_ratecfg_precompute(&cl->ceil, &hopt->ceil, ceil64);
-
 	cl->buffer = PSCHED_TICKS2NS(hopt->buffer);
 	cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer);
 
-- 
1.8.0

^ permalink raw reply related

* [PATCH 4/4] net, virtio_net: replace the magic value
From: Zhi Yong Wu @ 2013-11-18  8:46 UTC (permalink / raw)
  To: netdev; +Cc: mst, rusty, linux-kernel, qemu-devel, Zhi Yong Wu

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

It is more appropriate to use # of queue pairs currently used by
the driver instead of a magic value.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 drivers/net/virtio_net.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index cdc7c90..e0cb2d1 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1619,8 +1619,8 @@ static int virtnet_probe(struct virtio_device *vdev)
 	if (err)
 		goto free_stats;
 
-	netif_set_real_num_tx_queues(dev, 1);
-	netif_set_real_num_rx_queues(dev, 1);
+	netif_set_real_num_tx_queues(dev, vi->curr_queue_pairs);
+	netif_set_real_num_rx_queues(dev, vi->curr_queue_pairs);
 
 	err = register_netdev(dev);
 	if (err) {
-- 
1.7.6.5

^ permalink raw reply related

* Re: [PATCH 1/1] Revert "af-packet: Use existing netdev reference for bound sockets"
From: Daniel Borkmann @ 2013-11-18  9:00 UTC (permalink / raw)
  To: Salam Noureddine
  Cc: David S. Miller, Willem de Bruijn, Phil Sutter, Eric Dumazet,
	netdev, Ben Greear
In-Reply-To: <1384760425-37658-1-git-send-email-noureddine@aristanetworks.com>

On 11/18/2013 08:40 AM, Salam Noureddine wrote:
> This reverts commit 827d978037d7d0bf0860481948c6d26ead10042f
> ("af-packet: Use existing netdev reference for bound sockets")
>
> The patch introduced a race condition between packet_snd and
> packet_notifier when a net_device is being unregistered. In the case of
> a bound socket, packet_notifier can drop the last reference to the
> net_device and packet_snd might end up sending a packet over a freed
> net_device.

So there's no other workaround possible like e.g. setting a flag in
struct packet_sock so that in case our netdevice goes down, we just
set the flag and if set, we return with -ENXIO in send path?
Reverting this would decrease performance for everyone as we would
then do the lookup every time we send a packet again.

> Signed-off-by: Salam Noureddine <noureddine@aristanetworks.com>
> ---
>   net/packet/af_packet.c |   26 +++++++++++---------------
>   1 files changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 2e8286b..34fe9eb 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -2057,8 +2057,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
>   	struct sk_buff *skb;
>   	struct net_device *dev;
>   	__be16 proto;
> -	bool need_rls_dev = false;
> -	int err, reserve = 0;
> +	int ifindex, err, reserve = 0;
>   	void *ph;
>   	struct sockaddr_ll *saddr = (struct sockaddr_ll *)msg->msg_name;
>   	int tp_len, size_max;
> @@ -2070,7 +2069,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
>   	mutex_lock(&po->pg_vec_lock);
>
>   	if (saddr == NULL) {
> -		dev = po->prot_hook.dev;
> +		ifindex	= po->ifindex;
>   		proto	= po->num;
>   		addr	= NULL;
>   	} else {
> @@ -2081,12 +2080,12 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
>   					+ offsetof(struct sockaddr_ll,
>   						sll_addr)))
>   			goto out;
> +		ifindex	= saddr->sll_ifindex;
>   		proto	= saddr->sll_protocol;
>   		addr	= saddr->sll_addr;
> -		dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex);
> -		need_rls_dev = true;
>   	}
>
> +	dev = dev_get_by_index(sock_net(&po->sk), ifindex);
>   	err = -ENXIO;
>   	if (unlikely(dev == NULL))
>   		goto out;
> @@ -2173,8 +2172,7 @@ out_status:
>   	__packet_set_status(po, ph, status);
>   	kfree_skb(skb);
>   out_put:
> -	if (need_rls_dev)
> -		dev_put(dev);
> +	dev_put(dev);
>   out:
>   	mutex_unlock(&po->pg_vec_lock);
>   	return err;
> @@ -2212,9 +2210,8 @@ static int packet_snd(struct socket *sock,
>   	struct sk_buff *skb;
>   	struct net_device *dev;
>   	__be16 proto;
> -	bool need_rls_dev = false;
>   	unsigned char *addr;
> -	int err, reserve = 0;
> +	int ifindex, err, reserve = 0;
>   	struct virtio_net_hdr vnet_hdr = { 0 };
>   	int offset = 0;
>   	int vnet_hdr_len;
> @@ -2228,7 +2225,7 @@ static int packet_snd(struct socket *sock,
>   	 */
>
>   	if (saddr == NULL) {
> -		dev = po->prot_hook.dev;
> +		ifindex	= po->ifindex;
>   		proto	= po->num;
>   		addr	= NULL;
>   	} else {
> @@ -2237,12 +2234,12 @@ static int packet_snd(struct socket *sock,
>   			goto out;
>   		if (msg->msg_namelen < (saddr->sll_halen + offsetof(struct sockaddr_ll, sll_addr)))
>   			goto out;
> +		ifindex	= saddr->sll_ifindex;
>   		proto	= saddr->sll_protocol;
>   		addr	= saddr->sll_addr;
> -		dev = dev_get_by_index(sock_net(sk), saddr->sll_ifindex);
> -		need_rls_dev = true;
>   	}
>
> +	dev = dev_get_by_index(sock_net(sk), ifindex);
>   	err = -ENXIO;
>   	if (dev == NULL)
>   		goto out_unlock;
> @@ -2386,15 +2383,14 @@ static int packet_snd(struct socket *sock,
>   	if (err > 0 && (err = net_xmit_errno(err)) != 0)
>   		goto out_unlock;
>
> -	if (need_rls_dev)
> -		dev_put(dev);
> +	dev_put(dev);
>
>   	return len;
>
>   out_free:
>   	kfree_skb(skb);
>   out_unlock:
> -	if (dev && need_rls_dev)
> +	if (dev)
>   		dev_put(dev);
>   out:
>   	return err;
>

^ permalink raw reply

* Re: [RFC PATCH net-next 2/2] udp: add sk opt to allow sending pkt with src 0.0.0.0
From: Nicolas Dichtel @ 2013-11-18  9:15 UTC (permalink / raw)
  To: David Miller
  Cc: hannes, netdev, David.Laight, jiri, vyasevich, kuznet, jmorris,
	yoshfuji, kaber, thaller, stephen
In-Reply-To: <20131114.145708.640925730076403111.davem@davemloft.net>

Le 14/11/2013 20:57, David Miller a écrit :
> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Date: Thu, 14 Nov 2013 14:05:00 +0100
>
>> Le 11/11/2013 06:18, David Miller a écrit :
>>> Furthermore, the fact that you're implementing _addressing_ policy in
>>> the UDP code makes this change even more unreasonable.
>>>
>> I made this choice because using 0.0.0.0, for TCP for example, seems a
>> non-sense.
>
> It's at the very least something applicable to all datagram sockets.
Yes, right.

^ permalink raw reply

* Re: oops in pskb_expand_head - 3.11.6
From: Michele Baldessari @ 2013-11-18  9:19 UTC (permalink / raw)
  To: netdev, jiri; +Cc: Hannes Frederic Sowa
In-Reply-To: <20131117191810.GH16541@order.stressinduktion.org>

Hi Hannes,

On Sun, Nov 17, 2013 at 08:18:10PM +0100, Hannes Frederic Sowa wrote:
> On Sun, Nov 17, 2013 at 11:11:50AM +0000, Michele Baldessari wrote:
> > Hi Hannes,
> > 
> > On Sun, Nov 17, 2013 at 12:42:23AM +0100, Hannes Frederic Sowa wrote:
> > > On Sat, Nov 16, 2013 at 11:16:15PM +0000, Michele Baldessari wrote:
> > > > Two oops like the following were reported in Fedora 19 - kernel 3.11.6:
> > > > https://bugzilla.redhat.com/show_bug.cgi?id=1015905
> > > 
> > > I have not followed that issue that closely, but could you try linus tree
> > > or net-next?
> > > 
> > > Maybe those two patches improve the situation:
> > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=9037c3579a277f3a23ba476664629fda8c35f7c4
> > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6aafeef03b9d9ecf255f3a80ed85ee070260e1ae
> > > 
> > indeed a current kernel seems to fix the crash (according to the
> > reporters). I'll see if I manage to bisect exactly.
> 
> Great, if you confirm this we can ask David if he adds the commits to the
> -stable queue.

I can confirm that 6aafeef03b9d9ecf255f3a80ed85ee070260e1ae "netfilter:
push reasm skb through instead of original frag skbs" fixes the oops
mentioned in this thread. I've applied it to a 3.11.8 kernel and it
fixed the crash. I had to slightly tweak it as it does not apply 100%
cleanly due to 795aa6ef6a1aba99050735eadd0c2341b789b53b " netfilter:
pass hook ops to hookfn". 

So definitely -stable material.

Not sure if you also want to add 9037c3579a277f3a23ba476664629fda8c35f7c4 
"ip6_output: fragment outgoing reassembled skb properly". It did not
have any impact in this particular scenario.

Thanks again,
Michele
-- 
Michele Baldessari            <michele@acksyn.org>
C2A5 9DA3 9961 4FFB E01B  D0BC DDD4 DCCB 7515 5C6D

^ permalink raw reply

* Re: [OOPS][3.12] BUG: unable to handle kernel NULL pointer dereference at 0000000c
From: Steffen Klassert @ 2013-11-18  9:22 UTC (permalink / raw)
  To: David Miller
  Cc: pomac, bhelgaas, pomac, linux-kernel, edumazet, netdev,
	alex.aring
In-Reply-To: <20131115.185755.1752342950675745464.davem@davemloft.net>

On Fri, Nov 15, 2013 at 06:57:55PM -0500, David Miller wrote:
> From: Ian Kumlien <pomac@demius.net>
> Date: Sat, 16 Nov 2013 00:39:19 +0100
> 
> > On Fri, Nov 15, 2013 at 05:44:26PM -0500, David Miller wrote:
> >> From: Bjorn Helgaas <bhelgaas@google.com>
> >> Date: Fri, 15 Nov 2013 15:29:53 -0700
> >> 
> >> > [+cc David, Eric, Alex, netdev]
> >> > 
> >> > Alex reported a similar issue at
> >> > http://marc.info/?l=linux-netdev&m=138355719901790&w=4
> >> 
> >> Fixed by:
> >> 
> >> commit 84502b5ef9849a9694673b15c31bd3ac693010ae
> >> Author: Steffen Klassert <steffen.klassert@secunet.com>
> >> Date:   Wed Oct 30 11:16:28 2013 +0100
> > 
> > Cherry-picked, compiled and preparing for reboot - thanks!
> > 
> > Shouldn't this be queued up in stable sometime soonish?
> > 
> > (Sorry for the change of email address, i had forgot to switch the
> > configurations in mutt)
> 
> Steffen is in charge of IPSEC -stable submissions, please ask him
> :-)

It was intended for v3.12 but the release came before it was merged
into the manline. So yes, it should go to the v3.12 stable tree.

I've always did stable submissions just by marking them as a
candidate for stable, this did not happen here because I hoped
it will make it into v3.12. It should apply cleanly to v3.12
stable, you could just pick it into you stable queue, or
alternatively I can submit to stable.

^ permalink raw reply

* Re: oops in pskb_expand_head - 3.11.6
From: Jiri Pirko @ 2013-11-18  9:24 UTC (permalink / raw)
  To: Michele Baldessari; +Cc: netdev, Hannes Frederic Sowa
In-Reply-To: <20131118091922.GB11185@marquez.int.rhx>

Mon, Nov 18, 2013 at 10:19:22AM CET, michele@acksyn.org wrote:
>Hi Hannes,
>
>On Sun, Nov 17, 2013 at 08:18:10PM +0100, Hannes Frederic Sowa wrote:
>> On Sun, Nov 17, 2013 at 11:11:50AM +0000, Michele Baldessari wrote:
>> > Hi Hannes,
>> > 
>> > On Sun, Nov 17, 2013 at 12:42:23AM +0100, Hannes Frederic Sowa wrote:
>> > > On Sat, Nov 16, 2013 at 11:16:15PM +0000, Michele Baldessari wrote:
>> > > > Two oops like the following were reported in Fedora 19 - kernel 3.11.6:
>> > > > https://bugzilla.redhat.com/show_bug.cgi?id=1015905
>> > > 
>> > > I have not followed that issue that closely, but could you try linus tree
>> > > or net-next?
>> > > 
>> > > Maybe those two patches improve the situation:
>> > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=9037c3579a277f3a23ba476664629fda8c35f7c4
>> > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6aafeef03b9d9ecf255f3a80ed85ee070260e1ae
>> > > 
>> > indeed a current kernel seems to fix the crash (according to the
>> > reporters). I'll see if I manage to bisect exactly.
>> 
>> Great, if you confirm this we can ask David if he adds the commits to the
>> -stable queue.
>
>I can confirm that 6aafeef03b9d9ecf255f3a80ed85ee070260e1ae "netfilter:
>push reasm skb through instead of original frag skbs" fixes the oops
>mentioned in this thread. I've applied it to a 3.11.8 kernel and it
>fixed the crash. I had to slightly tweak it as it does not apply 100%
>cleanly due to 795aa6ef6a1aba99050735eadd0c2341b789b53b " netfilter:
>pass hook ops to hookfn". 
>
>So definitely -stable material.
>
>Not sure if you also want to add 9037c3579a277f3a23ba476664629fda8c35f7c4 
>"ip6_output: fragment outgoing reassembled skb properly". It did not
>have any impact in this particular scenario.

It goes hand in hand with 6aafeef03b9d9ecf255f3a80ed85ee070260e1ae.
Without 9037c3579a277f3a23ba476664629fda8c35f7c4 skbs that reasm len is
< MTU would not get fragmented which is not desired.


>
>Thanks again,
>Michele
>-- 
>Michele Baldessari            <michele@acksyn.org>
>C2A5 9DA3 9961 4FFB E01B  D0BC DDD4 DCCB 7515 5C6D

^ permalink raw reply

* RE: [PATCH] usb: xhci: Link TRB must not occur with a USB payload burst.
From: David Laight @ 2013-11-18  9:48 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Alan Stern, Sarah Sharp, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1384565904.29151.66.camel-/LGg1Z1CJKQ+9kgCwbf1HqK4ta4zdZpAajtMo4Cw6ucAvxtiuMwx3w@public.gmane.org>

> > But the minimum fragment size is (probably) 4k.
> > For the network stack an OUT transfer might have a lot (and I mean lots)
> > of fragments (there may be constraints, and linearising the skb is a option).
> [...]
> 
> The maximum number of fragments in the skb is going to be 17 (including
> the 'head' area).  (I'm ignoring NETIF_F_FRAGLIST which is not normally
> supported by physical device drivers.)
> 
> I don't know how many fragments that can end up as, at the USB level.

If you assume that every fragment crosses a 64k boundary that would be 34.
OTOH I've not seen a fragment of a 64k TSO send crossing a 32k
boundary, and I think the 'head' area is constrained to be part of
a single (4k or larger) page.

Isn't there something odd about skb merged by receive offload?
I've not entirely sorted out the full structure of skb.

	David


^ permalink raw reply

* Re: [PATCH 4/4] net, virtio_net: replace the magic value
From: Michael S. Tsirkin @ 2013-11-18  9:50 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: netdev, qemu-devel, rusty, Zhi Yong Wu, linux-kernel
In-Reply-To: <1384764380-16832-1-git-send-email-zwu.kernel@gmail.com>

On Mon, Nov 18, 2013 at 04:46:20PM +0800, Zhi Yong Wu wrote:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> It is more appropriate to use # of queue pairs currently used by
> the driver instead of a magic value.
> 
> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

I don't mind, but driver should be submitted separately
from qemu patches. As it is only patch 4/4 made it to netdev.

> ---
>  drivers/net/virtio_net.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index cdc7c90..e0cb2d1 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1619,8 +1619,8 @@ static int virtnet_probe(struct virtio_device *vdev)
>  	if (err)
>  		goto free_stats;
>  
> -	netif_set_real_num_tx_queues(dev, 1);
> -	netif_set_real_num_rx_queues(dev, 1);
> +	netif_set_real_num_tx_queues(dev, vi->curr_queue_pairs);
> +	netif_set_real_num_rx_queues(dev, vi->curr_queue_pairs);
>  
>  	err = register_netdev(dev);
>  	if (err) {
> -- 
> 1.7.6.5
> 

^ permalink raw reply

* RE: [PATCH] genetlink: unify registration functions
From: David Laight @ 2013-11-18  9:54 UTC (permalink / raw)
  To: David Miller, johannes; +Cc: netdev, johannes.berg
In-Reply-To: <20131115.205205.1547026485764326432.davem@davemloft.net>

> As a future simplification perhaps we can even elide the array length
> argument.  Most pass ARRAY_SIZE(foo) but there is at least one case
> (DLM) which passes a constant, which is error prone.
> 
> #define genl_register_family_with_ops(family, ops)
> 	__genl_register_family_with_ops(family, ops, ARRAY_SIZE(ops))
> 
> something like that.

Probably best to add a compile time check that ARRAY_SIZE(ops)
isn't zero - as might happen if a pointer is passed.
In some cases this can happen even when the source code appears
to contain the array size.

Or does ARRAY_SIZE(x) already contain a check that
sizeof(x) % sizeof(*(x)) is zero?

	David

^ permalink raw reply

* Re: [PATCH] genetlink: unify registration functions
From: Johannes Berg @ 2013-11-18  9:57 UTC (permalink / raw)
  To: David Laight; +Cc: David Miller, netdev
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B7429@saturn3.aculab.com>

On Mon, 2013-11-18 at 09:54 +0000, David Laight wrote:

> Or does ARRAY_SIZE(x) already contain a check that
> sizeof(x) % sizeof(*(x)) is zero?

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +
__must_be_array(arr))

__must_be_array() only works for gcc apparently, but that should be good
enough?

johannes

^ permalink raw reply

* Re: [PATCH 4/4] net, virtio_net: replace the magic value
From: Zhi Yong Wu @ 2013-11-18 10:07 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: netdev, Rusty Russell, Zhi Yong Wu, QEMU Developers,
	linux-kernel mlist
In-Reply-To: <20131118095043.GA3470@redhat.com>

On Mon, Nov 18, 2013 at 5:50 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Mon, Nov 18, 2013 at 04:46:20PM +0800, Zhi Yong Wu wrote:
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> It is more appropriate to use # of queue pairs currently used by
>> the driver instead of a magic value.
>>
>> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>
> I don't mind, but driver should be submitted separately
> from qemu patches. As it is only patch 4/4 made it to netdev.
ok, i will sent v2. By the way, can you help take a look at the
following patches? Maybe i can send their v2 together.
[PATCH 1/3] vhost: remove the dead branch
[PATCH 2/3] vhost: adjust vhost_dev_init() to be void
[PATCH 3/3] vhost: fix the wrong log descriptions


>
>> ---
>>  drivers/net/virtio_net.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> index cdc7c90..e0cb2d1 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>> @@ -1619,8 +1619,8 @@ static int virtnet_probe(struct virtio_device *vdev)
>>       if (err)
>>               goto free_stats;
>>
>> -     netif_set_real_num_tx_queues(dev, 1);
>> -     netif_set_real_num_rx_queues(dev, 1);
>> +     netif_set_real_num_tx_queues(dev, vi->curr_queue_pairs);
>> +     netif_set_real_num_rx_queues(dev, vi->curr_queue_pairs);
>>
>>       err = register_netdev(dev);
>>       if (err) {
>> --
>> 1.7.6.5
>>



-- 
Regards,

Zhi Yong Wu

^ permalink raw reply

* Re: [PATCH net] neigh: Force garbage collection if an entry is deleted administratively
From: Steffen Klassert @ 2013-11-18 10:08 UTC (permalink / raw)
  To: David Miller; +Cc: yoshfuji, netdev
In-Reply-To: <20131114.022356.1095983243221745109.davem@davemloft.net>

On Thu, Nov 14, 2013 at 02:23:56AM -0500, David Miller wrote:
> From: Steffen Klassert <steffen.klassert@secunet.com>
> Date: Tue, 12 Nov 2013 09:57:14 +0100
> 
> > Since git commit 2724680 ("neigh: Keep neighbour cache entries if number
> > of them is small enough."), we keep all neighbour cache entries if the
> > number is below a threshold. But if we now delete an entry administratively
> > and then try to replace this by a permanent one, we get -EEXIST because the
> > old entry ist still in the table (in NUD_FAILED state).
> > 
> > So lets force a garbage collect if we delete an entry administratively.
> > 
> > Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
> 
> I don't think this is a sufficient fix.

Yes, looks like that.

> 
> If some entity refers to this entry (refcnt != 1) then the forced
> GC won't do anything, and this is very much possible.
> 
> It is the difficult situation mentioned in a comment in
> neigh_flush_dev() below the "refcnt != 1" test there.

We ensured that an entry will go away if the refcount got to 1
by cyclic garbage collecting. Now we do this only if the cached
entries are above a threshold, so we have to handle this somehow
different if the cached entries are below this threshold.

Currently we do cyclic rescheduling of the gc worker but the worker
exits immediately if cached entries are below the threshold.
I'm testing an approach where we schedule the gc worker only if
the entries are above the threshold or if there is an administrative
change.

The patch I'm testing is below. It is pure RFC at the moment,
but I would be grateful for comments on the approach.


Subject: [PATCH RFC] neigh: Fix garbage collection if the cached entries are
 below the threshold

Since git commit 2724680 ("neigh: Keep neighbour cache entries if number
of them is small enough."), we keep all neighbour cache entries if the
number is below a threshold. But if we now delete an entry administratively
and then try to replace this by a permanent one, we get -EEXIST because the
old entry ist still in the table (in NUD_FAILED state).

So remove the threshold check in neigh_periodic_work() and schedule the
gc_work only when needed, i.e. if gc_thresh1 is reached or if there is
an administrative change. We reschedule gc_work either if the number of
cache entries is still above gc_thresh1 or if there are invalid entries
with "refcnt != 1" cached.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/core/neighbour.c |   29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index ca15f32..39c2a24 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -239,6 +239,9 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev)
 				else
 					n->nud_state = NUD_NONE;
 				neigh_dbg(2, "neigh %p is stray\n", n);
+				schedule_delayed_work(&tbl->gc_work,
+						      tbl->parms.base_reachable_time >> 1);
+
 			}
 			write_unlock(&n->lock);
 			neigh_cleanup_and_release(n);
@@ -282,6 +285,9 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl, struct net_device
 			goto out_entries;
 	}
 
+	if (entries >= tbl->gc_thresh1)
+		schedule_delayed_work(&tbl->gc_work, 0);
+
 	n = kzalloc(tbl->entry_size + dev->neigh_priv_len, GFP_ATOMIC);
 	if (!n)
 		goto out_entries;
@@ -757,6 +763,7 @@ static void neigh_periodic_work(struct work_struct *work)
 	struct neighbour __rcu **np;
 	unsigned int i;
 	struct neigh_hash_table *nht;
+	bool schedule = false;
 
 	NEIGH_CACHE_STAT_INC(tbl, periodic_gc_runs);
 
@@ -764,9 +771,6 @@ static void neigh_periodic_work(struct work_struct *work)
 	nht = rcu_dereference_protected(tbl->nht,
 					lockdep_is_held(&tbl->lock));
 
-	if (atomic_read(&tbl->entries) < tbl->gc_thresh1)
-		goto out;
-
 	/*
 	 *	periodically recompute ReachableTime from random function
 	 */
@@ -785,6 +789,7 @@ static void neigh_periodic_work(struct work_struct *work)
 		while ((n = rcu_dereference_protected(*np,
 				lockdep_is_held(&tbl->lock))) != NULL) {
 			unsigned int state;
+			int refcnt;
 
 			write_lock(&n->lock);
 
@@ -797,7 +802,8 @@ static void neigh_periodic_work(struct work_struct *work)
 			if (time_before(n->used, n->confirmed))
 				n->used = n->confirmed;
 
-			if (atomic_read(&n->refcnt) == 1 &&
+			refcnt = atomic_read(&n->refcnt);
+			if (refcnt == 1 &&
 			    (state == NUD_FAILED ||
 			     time_after(jiffies, n->used + n->parms->gc_staletime))) {
 				*np = n->next;
@@ -805,7 +811,8 @@ static void neigh_periodic_work(struct work_struct *work)
 				write_unlock(&n->lock);
 				neigh_cleanup_and_release(n);
 				continue;
-			}
+			} else if (refcnt != 1 && !(state & NUD_VALID))
+				schedule = true;
 			write_unlock(&n->lock);
 
 next_elt:
@@ -821,13 +828,15 @@ next_elt:
 		nht = rcu_dereference_protected(tbl->nht,
 						lockdep_is_held(&tbl->lock));
 	}
-out:
-	/* Cycle through all hash buckets every base_reachable_time/2 ticks.
+
+	/* Cycle through all hash buckets every base_reachable_time/2 ticks
+	 * as long as we have more than gc_thresh1 entries cached.
 	 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2
 	 * base_reachable_time.
 	 */
-	schedule_delayed_work(&tbl->gc_work,
-			      tbl->parms.base_reachable_time >> 1);
+	if (schedule == true || atomic_read(&tbl->entries) >= tbl->gc_thresh1)
+		schedule_delayed_work(&tbl->gc_work,
+				      tbl->parms.base_reachable_time >> 1);
 	write_unlock_bh(&tbl->lock);
 }
 
@@ -1659,6 +1668,8 @@ static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh)
 				   NEIGH_UPDATE_F_OVERRIDE |
 				   NEIGH_UPDATE_F_ADMIN);
 		neigh_release(neigh);
+
+		schedule_delayed_work(&tbl->gc_work, 0);
 		goto out;
 	}
 	read_unlock(&neigh_tbl_lock);
-- 
1.7.9.5

^ permalink raw reply related

* RE: [BUG,REGRESSION?] 3.11.6+,3.12: GbE iface rate drops to few KB/s
From: David Laight @ 2013-11-18 10:09 UTC (permalink / raw)
  To: Willy Tarreau, Arnaud Ebalard
  Cc: Cong Wang, edumazet, linux-arm-kernel, netdev, Thomas Petazzoni
In-Reply-To: <20131117141940.GA18569@1wt.eu>

> I wonder if we can call mvneta_txq_done() from the IRQ handler, which would
> cause some recycling of the Tx descriptors when receiving the corresponding
> ACKs.
> 
> Ideally we should enable the Tx IRQ, but I still have no access to this
> chip's datasheet despite having asked Marvell several times in one year
> (Thomas has it though).
> 
> So it is fairly possible that in your case you can't fill the link if you
> consume too many descriptors. For example, if your server uses TCP_NODELAY
> and sends incomplete segments (which is quite common), it's very easy to
> run out of descriptors before the link is full.

Or you have a significant number of active tcp connections.

Even if there were no requirement to free the skb quickly you still
need to take a 'tx done' interrupt when the link is transmit rate limited.
There are scenarios when there is no receive traffic - eg asymmetric
routing, but testable with netperf UDP transmits.

	David

^ permalink raw reply

* Re: [PATCH 4/4] net, virtio_net: replace the magic value
From: Michael S. Tsirkin @ 2013-11-18 10:15 UTC (permalink / raw)
  To: Zhi Yong Wu
  Cc: netdev, QEMU Developers, Rusty Russell, Zhi Yong Wu,
	linux-kernel mlist
In-Reply-To: <CAEH94Ljbu-gJ3SCHYErNEPucV=rR9PHz5COrOp3B-iw+db=LDQ@mail.gmail.com>

On Mon, Nov 18, 2013 at 06:07:45PM +0800, Zhi Yong Wu wrote:
> On Mon, Nov 18, 2013 at 5:50 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > On Mon, Nov 18, 2013 at 04:46:20PM +0800, Zhi Yong Wu wrote:
> >> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> >>
> >> It is more appropriate to use # of queue pairs currently used by
> >> the driver instead of a magic value.
> >>
> >> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> >
> > I don't mind, but driver should be submitted separately
> > from qemu patches. As it is only patch 4/4 made it to netdev.
> ok, i will sent v2. By the way, can you help take a look at the
> following patches?

Will do.

> Maybe i can send their v2 together.

Please don't, these seem to be completely unrelated.

> [PATCH 1/3] vhost: remove the dead branch
> [PATCH 2/3] vhost: adjust vhost_dev_init() to be void
> [PATCH 3/3] vhost: fix the wrong log descriptions
> 
> 
> >
> >> ---
> >>  drivers/net/virtio_net.c |    4 ++--
> >>  1 files changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> >> index cdc7c90..e0cb2d1 100644
> >> --- a/drivers/net/virtio_net.c
> >> +++ b/drivers/net/virtio_net.c
> >> @@ -1619,8 +1619,8 @@ static int virtnet_probe(struct virtio_device *vdev)
> >>       if (err)
> >>               goto free_stats;
> >>
> >> -     netif_set_real_num_tx_queues(dev, 1);
> >> -     netif_set_real_num_rx_queues(dev, 1);
> >> +     netif_set_real_num_tx_queues(dev, vi->curr_queue_pairs);
> >> +     netif_set_real_num_rx_queues(dev, vi->curr_queue_pairs);
> >>
> >>       err = register_netdev(dev);
> >>       if (err) {
> >> --
> >> 1.7.6.5
> >>
> 
> 
> 
> -- 
> Regards,
> 
> Zhi Yong Wu

^ permalink raw reply

* Re: [PATCH 1/3] vhost: remove the dead branch
From: Michael S. Tsirkin @ 2013-11-18 10:16 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: netdev, rusty, Zhi Yong Wu
In-Reply-To: <1384744763-7476-1-git-send-email-zwu.kernel@gmail.com>

On Mon, Nov 18, 2013 at 11:19:21AM +0800, Zhi Yong Wu wrote:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> Since vhost_dev_init() forever return 0, some branches are never run,
> therefore need to be removed.
> 
> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/vhost/net.c  |    5 -----
>  drivers/vhost/scsi.c |    5 -----
>  drivers/vhost/test.c |    5 -----
>  3 files changed, 0 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 831eb4f..0554785 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -707,11 +707,6 @@ static int vhost_net_open(struct inode *inode, struct file *f)
>  		n->vqs[i].sock_hlen = 0;
>  	}
>  	r = vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
> -	if (r < 0) {
> -		kfree(n);
> -		kfree(vqs);
> -		return r;
> -	}
>  
>  	vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
>  	vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index e663921..9d5e18d 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -1421,14 +1421,9 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
>  
>  	tcm_vhost_init_inflight(vs, NULL);
>  
> -	if (r < 0)
> -		goto err_init;
> -
>  	f->private_data = vs;
>  	return 0;
>  
> -err_init:
> -	kfree(vqs);
>  err_vqs:
>  	vhost_scsi_free(vs);
>  err_vs:
> diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
> index 339eae8..99cb960 100644
> --- a/drivers/vhost/test.c
> +++ b/drivers/vhost/test.c
> @@ -118,11 +118,6 @@ static int vhost_test_open(struct inode *inode, struct file *f)
>  	vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
>  	n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
>  	r = vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
> -	if (r < 0) {
> -		kfree(vqs);
> -		kfree(n);
> -		return r;
> -	}
>  
>  	f->private_data = n;
>  
> -- 
> 1.7.6.5

^ permalink raw reply

* Re: [PATCH 2/3] vhost: adjust vhost_dev_init() to be void
From: Michael S. Tsirkin @ 2013-11-18 10:16 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: netdev, rusty, Zhi Yong Wu
In-Reply-To: <1384744763-7476-2-git-send-email-zwu.kernel@gmail.com>

On Mon, Nov 18, 2013 at 11:19:22AM +0800, Zhi Yong Wu wrote:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/vhost/net.c   |    4 ++--
>  drivers/vhost/scsi.c  |    2 +-
>  drivers/vhost/test.c  |    3 +--
>  drivers/vhost/vhost.c |    4 +---
>  drivers/vhost/vhost.h |    2 +-
>  5 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 0554785..9a68409 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -683,7 +683,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
>  	struct vhost_net *n = kmalloc(sizeof *n, GFP_KERNEL);
>  	struct vhost_dev *dev;
>  	struct vhost_virtqueue **vqs;
> -	int r, i;
> +	int i;
>  
>  	if (!n)
>  		return -ENOMEM;
> @@ -706,7 +706,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
>  		n->vqs[i].vhost_hlen = 0;
>  		n->vqs[i].sock_hlen = 0;
>  	}
> -	r = vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
> +	vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
>  
>  	vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
>  	vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index 9d5e18d..e02b7df 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -1417,7 +1417,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
>  		vqs[i] = &vs->vqs[i].vq;
>  		vs->vqs[i].vq.handle_kick = vhost_scsi_handle_kick;
>  	}
> -	r = vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ);
> +	vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ);
>  
>  	tcm_vhost_init_inflight(vs, NULL);
>  
> diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
> index 99cb960..c2a54fb 100644
> --- a/drivers/vhost/test.c
> +++ b/drivers/vhost/test.c
> @@ -104,7 +104,6 @@ static int vhost_test_open(struct inode *inode, struct file *f)
>  	struct vhost_test *n = kmalloc(sizeof *n, GFP_KERNEL);
>  	struct vhost_dev *dev;
>  	struct vhost_virtqueue **vqs;
> -	int r;
>  
>  	if (!n)
>  		return -ENOMEM;
> @@ -117,7 +116,7 @@ static int vhost_test_open(struct inode *inode, struct file *f)
>  	dev = &n->dev;
>  	vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
>  	n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
> -	r = vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
> +	vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
>  
>  	f->private_data = n;
>  
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 69068e0..78987e4 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -290,7 +290,7 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev)
>  		vhost_vq_free_iovecs(dev->vqs[i]);
>  }
>  
> -long vhost_dev_init(struct vhost_dev *dev,
> +void vhost_dev_init(struct vhost_dev *dev,
>  		    struct vhost_virtqueue **vqs, int nvqs)
>  {
>  	struct vhost_virtqueue *vq;
> @@ -319,8 +319,6 @@ long vhost_dev_init(struct vhost_dev *dev,
>  			vhost_poll_init(&vq->poll, vq->handle_kick,
>  					POLLIN, dev);
>  	}
> -
> -	return 0;
>  }
>  EXPORT_SYMBOL_GPL(vhost_dev_init);
>  
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index 4465ed5..35eeb2a 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -127,7 +127,7 @@ struct vhost_dev {
>  	struct task_struct *worker;
>  };
>  
> -long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
> +void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
>  long vhost_dev_set_owner(struct vhost_dev *dev);
>  bool vhost_dev_has_owner(struct vhost_dev *dev);
>  long vhost_dev_check_owner(struct vhost_dev *);
> -- 
> 1.7.6.5

^ permalink raw reply

* RE: net/usb/ax88179_178a driver broken in linux-3.12
From: David Laight @ 2013-11-18 10:12 UTC (permalink / raw)
  To: Mark Lord, Eric Dumazet, Ming Lei, davem, netdev
In-Reply-To: <52891341.4020403@pobox.com>

> On 13-11-17 01:56 PM, Mark Lord wrote:
> > On 13-11-17 01:35 PM, Mark Lord wrote:
> >> The USB3 network adapter locks up consistently for me here in 3.12,
> >> but was working without issues in 3.11.x

The xhci driver is well broken in 3.12.

Try disabling GSO and TSO so that the xhci driver is never given
fragments.

	David


^ permalink raw reply

* Re: [PATCH 3/3] vhost: fix the wrong log descriptions
From: Michael S. Tsirkin @ 2013-11-18 10:18 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: netdev, rusty, Zhi Yong Wu
In-Reply-To: <1384744763-7476-3-git-send-email-zwu.kernel@gmail.com>

On Mon, Nov 18, 2013 at 11:19:23AM +0800, Zhi Yong Wu wrote:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

This one does not make sense to me.
Heads in avail ring are heads which according to Guest are available by
definition.


> ---
>  drivers/vhost/vhost.c  |    2 +-
>  drivers/vhost/vringh.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 78987e4..568d20f 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -1241,7 +1241,7 @@ int vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
>  
>  	/* If their number is silly, that's an error. */
>  	if (unlikely(head >= vq->num)) {
> -		vq_err(vq, "Guest says index %u > %u is available",
> +		vq_err(vq, "Guest says index %u > %u is unavailable",
>  		       head, vq->num);
>  		return -EINVAL;
>  	}
> diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
> index 5174eba..86ef6c4 100644
> --- a/drivers/vhost/vringh.c
> +++ b/drivers/vhost/vringh.c
> @@ -57,7 +57,7 @@ static inline int __vringh_get_head(const struct vringh *vrh,
>  	}
>  
>  	if (head >= vrh->vring.num) {
> -		vringh_bad("Guest says index %u > %u is available",
> +		vringh_bad("Guest says index %u > %u is unavailable",
>  			   head, vrh->vring.num);
>  		return -EINVAL;
>  	}
> -- 
> 1.7.6.5

^ permalink raw reply

* Re: [PATCH 1/1] fixup! ipv6 addrconf: introduce IFA_F_MANAGETEMPADDR to tell kernel to manage temporary addresses
From: Jiri Pirko @ 2013-11-18 10:23 UTC (permalink / raw)
  To: Thomas Haller
  Cc: netdev, davem, kuznet, jmorris, yoshfuji, kaber, stephen, hannes,
	vyasevich, dcbw
In-Reply-To: <1384537726-14079-1-git-send-email-thaller@redhat.com>

Okay. I will try incorporate modify into my patch. Thanks.

Fri, Nov 15, 2013 at 06:48:46PM CET, thaller@redhat.com wrote:
>Handle IFA_F_MANAGETEMPADDR flag when modifying existing addresses too.
>
>Signed-off-by: Thomas Haller <thaller@redhat.com>
>---
>Hi,
>
>I'd like to suggest this change, I think it makes it easier for the user space
>application to set this flag of (potentially) existing addresses.
>
>Note, that if the flag gets cleared if the ifa had it set before
>and the temporary addresses will exprire immediatly. This makes sense
>for me.
>
>Or if we don't want this, then the command should fail (EEXIST?) when trying
>to set MANAGETEMPADDR for an existing address that doesn't have the flag already.
>
>Thomas
>
> net/ipv6/addrconf.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
>diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
>index 9e217b8..9e726c8 100644
>--- a/net/ipv6/addrconf.c
>+++ b/net/ipv6/addrconf.c
>@@ -3613,20 +3613,21 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh)
> 
> 	return inet6_addr_del(net, ifm->ifa_index, pfx, ifm->ifa_prefixlen);
> }
> 
> static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
> 			     u32 prefered_lft, u32 valid_lft)
> {
> 	u32 flags;
> 	clock_t expires;
> 	unsigned long timeout;
>+	int mngtmp;
> 
> 	if (!valid_lft || (prefered_lft > valid_lft))
> 		return -EINVAL;
> 
> 	timeout = addrconf_timeout_fixup(valid_lft, HZ);
> 	if (addrconf_finite_timeout(timeout)) {
> 		expires = jiffies_to_clock_t(timeout * HZ);
> 		valid_lft = timeout;
> 		flags = RTF_EXPIRES;
> 	} else {
>@@ -3636,35 +3637,48 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
> 	}
> 
> 	timeout = addrconf_timeout_fixup(prefered_lft, HZ);
> 	if (addrconf_finite_timeout(timeout)) {
> 		if (timeout == 0)
> 			ifa_flags |= IFA_F_DEPRECATED;
> 		prefered_lft = timeout;
> 	}
> 
> 	spin_lock_bh(&ifp->lock);
>-	ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD | IFA_F_HOMEADDRESS)) | ifa_flags;
>+	if (ifa_flags & IFA_F_MANAGETEMPADDR &&
>+	    (ifp->prefix_len != 64 || ifp->flags & IFA_F_TEMPORARY)) {
>+		spin_unlock_bh(&ifp->lock);
>+		return -EEXIST;
>+	}
>+	mngtmp = ifp->flags & IFA_F_MANAGETEMPADDR;
>+	ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD | IFA_F_HOMEADDRESS |
>+				     IFA_F_MANAGETEMPADDR)) | ifa_flags;
> 	ifp->tstamp = jiffies;
> 	ifp->valid_lft = valid_lft;
> 	ifp->prefered_lft = prefered_lft;
> 
> 	spin_unlock_bh(&ifp->lock);
> 	if (!(ifp->flags&IFA_F_TENTATIVE))
> 		ipv6_ifa_notify(0, ifp);
> 
> 	addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev,
> 			      expires, flags);
> 
>-	if (ifp->flags & IFA_F_MANAGETEMPADDR)
>-		manage_tempaddrs(ifp->idev, ifp, valid_lft, prefered_lft,
>+	if (mngtmp && !(ifa_flags & IFA_F_MANAGETEMPADDR)) {
>+		/* expire the life time of the temporary addresses */
>+		manage_tempaddrs(ifp->idev, ifp, 0, 0,
> 				 false, jiffies);
>+	} else if (ifa_flags & IFA_F_MANAGETEMPADDR) {
>+		/* if we did not yet mngtmp, create temporary addresses */
>+		manage_tempaddrs(ifp->idev, ifp, valid_lft, prefered_lft,
>+				 !mngtmp, jiffies);
>+	}
> 
> 	addrconf_verify(0);
> 
> 	return 0;
> }
> 
> static int
> inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
> {
> 	struct net *net = sock_net(skb->sk);
>@@ -3710,23 +3724,20 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
> 	if (ifa == NULL) {
> 		/*
> 		 * It would be best to check for !NLM_F_CREATE here but
> 		 * userspace alreay relies on not having to provide this.
> 		 */
> 		return inet6_addr_add(net, ifm->ifa_index, pfx, peer_pfx,
> 				      ifm->ifa_prefixlen, ifa_flags,
> 				      preferred_lft, valid_lft);
> 	}
> 
>-	/* We ignore IFA_F_MANAGETEMPADDR for modify. */
>-	ifa_flags &= ~IFA_F_MANAGETEMPADDR;
>-
> 	if (nlh->nlmsg_flags & NLM_F_EXCL ||
> 	    !(nlh->nlmsg_flags & NLM_F_REPLACE))
> 		err = -EEXIST;
> 	else
> 		err = inet6_addr_modify(ifa, ifa_flags, preferred_lft, valid_lft);
> 
> 	in6_ifa_put(ifa);
> 
> 	return err;
> }
>-- 
>1.8.4.1.559.gdb9bdfb
>

^ permalink raw reply

* RE: testing and validating 64-bit addressing.
From: David Laight @ 2013-11-18 10:24 UTC (permalink / raw)
  To: Rayagond K, netdev
In-Reply-To: <CAJ3bTp6pjy7PFbgAfoXoisue8xAeWA0bxxDPYY01QZN1iCX=rw@mail.gmail.com>

> I have one Ethernet card which supports 64-bit DMA addressing and I
> need to implement this feature and test it.
...
> 3. Installed the 64-bit operating system on 64-bit architecture -
> Fedora 15, 64 bit os , LINUX 3.8.0 kernel, Intel dual core processor,
> 4GB RAM.
...
> 1. Why are we always getting 33-bit address only ?

Because the physical memory is aligned to the bottom of the
physical memory map.
The only reason you see addresses above 4B is that there
is a great big address block (typically from 3G or 3.5G) reserved
for PCI devices.

	David

^ 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