Netdev List
 help / color / mirror / Atom feed
* [net 1/2] sctp: add transport state in /proc/net/sctp/remaddr
From: Michele Baldessari @ 2014-10-23 19:48 UTC (permalink / raw)
  To: linux-sctp
  Cc: Vlad Yasevich, Neil Horman, netdev, dborkman, Michele Baldessari

It is often quite helpful to be able to know the state of a transport
outside of the application itself (for troubleshooting purposes or for
monitoring purposes). Add it under /proc/net/sctp/remaddr.

Signed-off-by: Michele Baldessari <michele@acksyn.org>
---
 net/sctp/proc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index 34229ee7f379..bfb242af06ab 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -417,7 +417,7 @@ static void *sctp_remaddr_seq_start(struct seq_file *seq, loff_t *pos)
 
 	if (*pos == 0)
 		seq_printf(seq, "ADDR ASSOC_ID HB_ACT RTO MAX_PATH_RTX "
-				"REM_ADDR_RTX  START\n");
+				"REM_ADDR_RTX START STATE\n");
 
 	return (void *)pos;
 }
@@ -497,7 +497,13 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
 			 * currently implemented, but we can record it with a
 			 * jiffies marker in a subsequent patch
 			 */
-			seq_printf(seq, "0");
+			seq_printf(seq, "0 ");
+
+			/*
+			 * The current state of this destination. I.e.
+			 * SCTP_ACTIVE, SCTP_INACTIVE, ...
+			 */
+			seq_printf(seq, "%d", tsp->state);
 
 			seq_printf(seq, "\n");
 		}
-- 
2.1.0

^ permalink raw reply related

* [PATCH v2 net] tcp: md5: do not use alloc_percpu()
From: Eric Dumazet @ 2014-10-23 19:58 UTC (permalink / raw)
  To: David Miller; +Cc: David Ahern, Crestez Dan Leonard, netdev, Jonathan Toppins
In-Reply-To: <1414081998.20845.18.camel@edumazet-glaptop2.roam.corp.google.com>

From: Eric Dumazet <edumazet@google.com>

percpu tcp_md5sig_pool contains memory blobs that ultimately
go through sg_set_buf().

-> sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));

This requires that whole area is in a physically contiguous portion
of memory. And that @buf is not backed by vmalloc().

Given that alloc_percpu() can use vmalloc() areas, this does not
fit the requirements.

Replace alloc_percpu() by a static DEFINE_PER_CPU() as tcp_md5sig_pool
is small anyway, there is no gain to dynamically allocate it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: 765cf9976e93 ("tcp: md5: remove one indirection level in tcp_md5sig_pool")
Reported-by: Crestez Dan Leonard <cdleonard@gmail.com>
---
 net/ipv4/tcp.c |   59 +++++++++++++++--------------------------------
 1 file changed, 20 insertions(+), 39 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 1bec4e76d88c..39ec0c379545 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2868,61 +2868,42 @@ EXPORT_SYMBOL(compat_tcp_getsockopt);
 #endif
 
 #ifdef CONFIG_TCP_MD5SIG
-static struct tcp_md5sig_pool __percpu *tcp_md5sig_pool __read_mostly;
+static DEFINE_PER_CPU(struct tcp_md5sig_pool, tcp_md5sig_pool);
 static DEFINE_MUTEX(tcp_md5sig_mutex);
-
-static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool __percpu *pool)
-{
-	int cpu;
-
-	for_each_possible_cpu(cpu) {
-		struct tcp_md5sig_pool *p = per_cpu_ptr(pool, cpu);
-
-		if (p->md5_desc.tfm)
-			crypto_free_hash(p->md5_desc.tfm);
-	}
-	free_percpu(pool);
-}
+static bool tcp_md5sig_pool_populated = false;
 
 static void __tcp_alloc_md5sig_pool(void)
 {
 	int cpu;
-	struct tcp_md5sig_pool __percpu *pool;
-
-	pool = alloc_percpu(struct tcp_md5sig_pool);
-	if (!pool)
-		return;
 
 	for_each_possible_cpu(cpu) {
-		struct crypto_hash *hash;
-
-		hash = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC);
-		if (IS_ERR_OR_NULL(hash))
-			goto out_free;
+		if (!per_cpu(tcp_md5sig_pool, cpu).md5_desc.tfm) {
+			struct crypto_hash *hash;
 
-		per_cpu_ptr(pool, cpu)->md5_desc.tfm = hash;
+			hash = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC);
+			if (IS_ERR_OR_NULL(hash))
+				return;
+			per_cpu(tcp_md5sig_pool, cpu).md5_desc.tfm = hash;
+		}
 	}
-	/* before setting tcp_md5sig_pool, we must commit all writes
-	 * to memory. See ACCESS_ONCE() in tcp_get_md5sig_pool()
+	/* before setting tcp_md5sig_pool_populated, we must commit all writes
+	 * to memory. See smp_rmb() in tcp_get_md5sig_pool()
 	 */
 	smp_wmb();
-	tcp_md5sig_pool = pool;
-	return;
-out_free:
-	__tcp_free_md5sig_pool(pool);
+	tcp_md5sig_pool_populated = true;
 }
 
 bool tcp_alloc_md5sig_pool(void)
 {
-	if (unlikely(!tcp_md5sig_pool)) {
+	if (unlikely(!tcp_md5sig_pool_populated)) {
 		mutex_lock(&tcp_md5sig_mutex);
 
-		if (!tcp_md5sig_pool)
+		if (!tcp_md5sig_pool_populated)
 			__tcp_alloc_md5sig_pool();
 
 		mutex_unlock(&tcp_md5sig_mutex);
 	}
-	return tcp_md5sig_pool != NULL;
+	return tcp_md5sig_pool_populated;
 }
 EXPORT_SYMBOL(tcp_alloc_md5sig_pool);
 
@@ -2936,13 +2917,13 @@ EXPORT_SYMBOL(tcp_alloc_md5sig_pool);
  */
 struct tcp_md5sig_pool *tcp_get_md5sig_pool(void)
 {
-	struct tcp_md5sig_pool __percpu *p;
-
 	local_bh_disable();
-	p = ACCESS_ONCE(tcp_md5sig_pool);
-	if (p)
-		return raw_cpu_ptr(p);
 
+	if (tcp_md5sig_pool_populated) {
+		/* coupled with smp_wmb() in __tcp_alloc_md5sig_pool() */
+		smp_rmb();
+		return this_cpu_ptr(&tcp_md5sig_pool);
+	}
 	local_bh_enable();
 	return NULL;
 }

^ permalink raw reply related

* [PATCH RFC] tun: fix sparse warnings for virtio headers
From: Michael S. Tsirkin @ 2014-10-23 20:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: netdev, Xi Wang, Masatake YAMATO, virtualization, Zhi Yong Wu,
	David S. Miller, Tom Herbert

Note: stub out endian-ness conversion for now.
We'll add a flag to control it for BE guests later.

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

This will be needed once __virtio16 typedefs come in.

 drivers/net/tun.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 186ce54..ee27ecb 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1043,10 +1043,10 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 			return -EFAULT;
 
 		if ((gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) &&
-		    gso.csum_start + gso.csum_offset + 2 > gso.hdr_len)
-			gso.hdr_len = gso.csum_start + gso.csum_offset + 2;
+		    __virtio16_to_cpu(false, gso.csum_start) + __virtio16_to_cpu(false, gso.csum_offset) + 2 > __virtio16_to_cpu(false, gso.hdr_len))
+			gso.hdr_len = __cpu_to_virtio16(false, __virtio16_to_cpu(false, gso.csum_start) + __virtio16_to_cpu(false, gso.csum_offset) + 2);
 
-		if (gso.hdr_len > len)
+		if (__virtio16_to_cpu(false, gso.hdr_len) > len)
 			return -EINVAL;
 		offset += tun->vnet_hdr_sz;
 	}
@@ -1054,7 +1054,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 	if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) {
 		align += NET_IP_ALIGN;
 		if (unlikely(len < ETH_HLEN ||
-			     (gso.hdr_len && gso.hdr_len < ETH_HLEN)))
+			     (gso.hdr_len && __virtio16_to_cpu(false, gso.hdr_len) < ETH_HLEN)))
 			return -EINVAL;
 	}
 
@@ -1065,7 +1065,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 		 * enough room for skb expand head in case it is used.
 		 * The rest of the buffer is mapped from userspace.
 		 */
-		copylen = gso.hdr_len ? gso.hdr_len : GOODCOPY_LEN;
+		copylen = gso.hdr_len ? __virtio16_to_cpu(false, gso.hdr_len) : GOODCOPY_LEN;
 		if (copylen > good_linear)
 			copylen = good_linear;
 		linear = copylen;
@@ -1075,10 +1075,10 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 
 	if (!zerocopy) {
 		copylen = len;
-		if (gso.hdr_len > good_linear)
+		if (__virtio16_to_cpu(false, gso.hdr_len) > good_linear)
 			linear = good_linear;
 		else
-			linear = gso.hdr_len;
+			linear = __virtio16_to_cpu(false, gso.hdr_len);
 	}
 
 	skb = tun_alloc_skb(tfile, align, copylen, linear, noblock);
@@ -1105,8 +1105,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 	}
 
 	if (gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) {
-		if (!skb_partial_csum_set(skb, gso.csum_start,
-					  gso.csum_offset)) {
+		if (!skb_partial_csum_set(skb, __virtio16_to_cpu(false, gso.csum_start),
+					  __virtio16_to_cpu(false, gso.csum_offset))) {
 			tun->dev->stats.rx_frame_errors++;
 			kfree_skb(skb);
 			return -EINVAL;
@@ -1160,7 +1160,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 		if (gso.gso_type & VIRTIO_NET_HDR_GSO_ECN)
 			skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
 
-		skb_shinfo(skb)->gso_size = gso.gso_size;
+		skb_shinfo(skb)->gso_size = __virtio16_to_cpu(false, gso.gso_size);
 		if (skb_shinfo(skb)->gso_size == 0) {
 			tun->dev->stats.rx_frame_errors++;
 			kfree_skb(skb);
@@ -1245,8 +1245,8 @@ static ssize_t tun_put_user(struct tun_struct *tun,
 			struct skb_shared_info *sinfo = skb_shinfo(skb);
 
 			/* This is a hint as to how much should be linear. */
-			gso.hdr_len = skb_headlen(skb);
-			gso.gso_size = sinfo->gso_size;
+			gso.hdr_len = __cpu_to_virtio16(false, skb_headlen(skb));
+			gso.gso_size = __cpu_to_virtio16(false, sinfo->gso_size);
 			if (sinfo->gso_type & SKB_GSO_TCPV4)
 				gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
 			else if (sinfo->gso_type & SKB_GSO_TCPV6)
@@ -1256,12 +1256,12 @@ static ssize_t tun_put_user(struct tun_struct *tun,
 			else {
 				pr_err("unexpected GSO type: "
 				       "0x%x, gso_size %d, hdr_len %d\n",
-				       sinfo->gso_type, gso.gso_size,
-				       gso.hdr_len);
+				       sinfo->gso_type, __virtio16_to_cpu(false, gso.gso_size),
+				       __virtio16_to_cpu(false, gso.hdr_len));
 				print_hex_dump(KERN_ERR, "tun: ",
 					       DUMP_PREFIX_NONE,
 					       16, 1, skb->head,
-					       min((int)gso.hdr_len, 64), true);
+					       min((int)__virtio16_to_cpu(false, gso.hdr_len), 64), true);
 				WARN_ON_ONCE(1);
 				return -EINVAL;
 			}
@@ -1272,8 +1272,8 @@ static ssize_t tun_put_user(struct tun_struct *tun,
 
 		if (skb->ip_summed == CHECKSUM_PARTIAL) {
 			gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
-			gso.csum_start = skb_checksum_start_offset(skb);
-			gso.csum_offset = skb->csum_offset;
+			gso.csum_start = __cpu_to_virtio16(false, skb_checksum_start_offset(skb));
+			gso.csum_offset = __cpu_to_virtio16(false, skb->csum_offset);
 		} else if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
 			gso.flags = VIRTIO_NET_HDR_F_DATA_VALID;
 		} /* else everything is zero */
-- 
MST

^ permalink raw reply related

* Re: localed stuck in recent 3.18 git in copy_net_ns?
From: Paul E. McKenney @ 2014-10-23 20:05 UTC (permalink / raw)
  To: Yanko Kaneti
  Cc: Josh Boyer, Eric W. Biederman, Cong Wang, Kevin Fenzi, netdev,
	Linux-Kernel@Vger. Kernel. Org
In-Reply-To: <20141023195159.GA2331@declera.com>

On Thu, Oct 23, 2014 at 10:51:59PM +0300, Yanko Kaneti wrote:
> On Thu-10/23/14-2014 08:33, Paul E. McKenney wrote:
> > On Thu, Oct 23, 2014 at 05:27:50AM -0700, Paul E. McKenney wrote:
> > > On Thu, Oct 23, 2014 at 09:09:26AM +0300, Yanko Kaneti wrote:
> > > > On Wed, 2014-10-22 at 16:24 -0700, Paul E. McKenney wrote:
> > > > > On Thu, Oct 23, 2014 at 01:40:32AM +0300, Yanko Kaneti wrote:
> > > > > > On Wed-10/22/14-2014 15:33, Josh Boyer wrote:
> > > > > > > On Wed, Oct 22, 2014 at 2:55 PM, Paul E. McKenney
> > > > > > > <paulmck@linux.vnet.ibm.com> wrote:
> > > > > 
> > > > > [ . . . ]
> > > > > 
> > > > > > > > Don't get me wrong -- the fact that this kthread appears to 
> > > > > > > > have
> > > > > > > > blocked within rcu_barrier() for 120 seconds means that 
> > > > > > > > something is
> > > > > > > > most definitely wrong here.  I am surprised that there are no 
> > > > > > > > RCU CPU
> > > > > > > > stall warnings, but perhaps the blockage is in the callback 
> > > > > > > > execution
> > > > > > > > rather than grace-period completion.  Or something is 
> > > > > > > > preventing this
> > > > > > > > kthread from starting up after the wake-up callback executes.  
> > > > > > > > Or...
> > > > > > > > 
> > > > > > > > Is this thing reproducible?
> > > > > > > 
> > > > > > > I've added Yanko on CC, who reported the backtrace above and can
> > > > > > > recreate it reliably.  Apparently reverting the RCU merge commit
> > > > > > > (d6dd50e) and rebuilding the latest after that does not show the
> > > > > > > issue.  I'll let Yanko explain more and answer any questions you 
> > > > > > > have.
> > > > > > 
> > > > > > - It is reproducible
> > > > > > - I've done another build here to double check and its definitely 
> > > > > > the rcu merge
> > > > > >   that's causing it.
> > > > > > 
> > > > > > Don't think I'll be able to dig deeper, but I can do testing if 
> > > > > > needed.
> > > > > 
> > > > > Please!  Does the following patch help?
> > > > 
> > > > Nope, doesn't seem to make a difference to the modprobe ppp_generic 
> > > > test
> > > 
> > > Well, I was hoping.  I will take a closer look at the RCU merge commit
> > > and see what suggests itself.  I am likely to ask you to revert specific
> > > commits, if that works for you.
> > 
> > Well, rather than reverting commits, could you please try testing the
> > following commits?
> > 
> > 11ed7f934cb8 (rcu: Make nocb leader kthreads process pending callbacks after spawning)
> > 
> > 73a860cd58a1 (rcu: Replace flush_signals() with WARN_ON(signal_pending()))
> > 
> > c847f14217d5 (rcu: Avoid misordering in nocb_leader_wait())
> > 
> > 	For whatever it is worth, I am guessing this one.
> 
> Indeed, c847f14217d5 it is.
> 
> Much to my embarrasment I just noticed that in addition to the
> rcu merge, triggering the bug "requires" my specific Fedora rawhide network
> setup. Booting in single mode and modprobe ppp_generic is fine. The bug
> appears when starting with my regular fedora network setup, which in my case 
> includes 3 ethernet adapters and a libvirt birdge+nat setup.
> 
> Hope that helps. 
> 
> I am attaching the config.

It does help a lot, thank you!!!

The following patch is a bit of a shot in the dark, and assumes that
commit 1772947bd012 (rcu: Handle NOCB callbacks from irq-disabled idle
code) introduced the problem.  Does this patch fix things up?

							Thanx, Paul

------------------------------------------------------------------------

rcu: Kick rcuo kthreads after their CPU goes offline

If a no-CBs CPU were to post an RCU callback with interrupts disabled
after it entered the idle loop for the last time, there might be no
deferred wakeup for the corresponding rcuo kthreads.  This commit
therefore adds a set of calls to do_nocb_deferred_wakeup() after the
CPU has gone completely offline.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 84b41b3c6ebd..4f3d25a58786 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3493,8 +3493,10 @@ static int rcu_cpu_notify(struct notifier_block *self,
 	case CPU_DEAD_FROZEN:
 	case CPU_UP_CANCELED:
 	case CPU_UP_CANCELED_FROZEN:
-		for_each_rcu_flavor(rsp)
+		for_each_rcu_flavor(rsp) {
 			rcu_cleanup_dead_cpu(cpu, rsp);
+			do_nocb_deferred_wakeup(this_cpu_ptr(rsp->rda));
+		}
 		break;
 	default:
 		break;

^ permalink raw reply related

* Re: [PATCH v2 net] tcp: md5: do not use alloc_percpu()
From: David Ahern @ 2014-10-23 20:44 UTC (permalink / raw)
  To: Eric Dumazet, David Miller; +Cc: Crestez Dan Leonard, netdev, Jonathan Toppins
In-Reply-To: <1414094338.20845.30.camel@edumazet-glaptop2.roam.corp.google.com>

On 10/23/14, 1:58 PM, Eric Dumazet wrote:
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 1bec4e76d88c..39ec0c379545 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -2868,61 +2868,42 @@ EXPORT_SYMBOL(compat_tcp_getsockopt);
>   #endif
>
>   #ifdef CONFIG_TCP_MD5SIG
> -static struct tcp_md5sig_pool __percpu *tcp_md5sig_pool __read_mostly;
> +static DEFINE_PER_CPU(struct tcp_md5sig_pool, tcp_md5sig_pool);
>   static DEFINE_MUTEX(tcp_md5sig_mutex);
> -
> -static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool __percpu *pool)
> -{
> -	int cpu;
> -
> -	for_each_possible_cpu(cpu) {
> -		struct tcp_md5sig_pool *p = per_cpu_ptr(pool, cpu);
> -
> -		if (p->md5_desc.tfm)
> -			crypto_free_hash(p->md5_desc.tfm);
> -	}
> -	free_percpu(pool);
> -}
> +static bool tcp_md5sig_pool_populated = false;

global variables do not need to be initialized to 0.

I'll see how this applies to v3.4 and build an image.

Thanks,
David

^ permalink raw reply

* Re: [net 1/2] sctp: add transport state in /proc/net/sctp/remaddr
From: Neil Horman @ 2014-10-23 20:51 UTC (permalink / raw)
  To: Michele Baldessari; +Cc: linux-sctp, Vlad Yasevich, netdev, dborkman
In-Reply-To: <1414093721-14921-1-git-send-email-michele@acksyn.org>

On Thu, Oct 23, 2014 at 09:48:40PM +0200, Michele Baldessari wrote:
> It is often quite helpful to be able to know the state of a transport
> outside of the application itself (for troubleshooting purposes or for
> monitoring purposes). Add it under /proc/net/sctp/remaddr.
> 
> Signed-off-by: Michele Baldessari <michele@acksyn.org>
> ---
>  net/sctp/proc.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/proc.c b/net/sctp/proc.c
> index 34229ee7f379..bfb242af06ab 100644
> --- a/net/sctp/proc.c
> +++ b/net/sctp/proc.c
> @@ -417,7 +417,7 @@ static void *sctp_remaddr_seq_start(struct seq_file *seq, loff_t *pos)
>  
>  	if (*pos == 0)
>  		seq_printf(seq, "ADDR ASSOC_ID HB_ACT RTO MAX_PATH_RTX "
> -				"REM_ADDR_RTX  START\n");
> +				"REM_ADDR_RTX START STATE\n");
>  
>  	return (void *)pos;
>  }
> @@ -497,7 +497,13 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
>  			 * currently implemented, but we can record it with a
>  			 * jiffies marker in a subsequent patch
>  			 */
> -			seq_printf(seq, "0");
> +			seq_printf(seq, "0 ");
> +
> +			/*
> +			 * The current state of this destination. I.e.
> +			 * SCTP_ACTIVE, SCTP_INACTIVE, ...
> +			 */
> +			seq_printf(seq, "%d", tsp->state);
>  
>  			seq_printf(seq, "\n");
>  		}
> -- 
> 2.1.0
> 
> 

Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply

* Re: [net 2/2] sctp: replace seq_printf with seq_puts
From: Neil Horman @ 2014-10-23 20:52 UTC (permalink / raw)
  To: Michele Baldessari; +Cc: linux-sctp, Vlad Yasevich, netdev, dborkman
In-Reply-To: <1414093721-14921-2-git-send-email-michele@acksyn.org>

On Thu, Oct 23, 2014 at 09:48:41PM +0200, Michele Baldessari wrote:
> Fixes checkpatch warning:
> "WARNING: Prefer seq_puts to seq_printf"
> 
> Signed-off-by: Michele Baldessari <michele@acksyn.org>
> ---
>  net/sctp/proc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/proc.c b/net/sctp/proc.c
> index bfb242af06ab..0697eda5aed8 100644
> --- a/net/sctp/proc.c
> +++ b/net/sctp/proc.c
> @@ -490,14 +490,14 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
>  			 * Note: We don't have a way to tally this at the moment
>  			 * so lets just leave it as zero for the moment
>  			 */
> -			seq_printf(seq, "0 ");
> +			seq_puts(seq, "0 ");
>  
>  			/*
>  			 * remote address start time (START).  This is also not
>  			 * currently implemented, but we can record it with a
>  			 * jiffies marker in a subsequent patch
>  			 */
> -			seq_printf(seq, "0 ");
> +			seq_puts(seq, "0 ");
>  
>  			/*
>  			 * The current state of this destination. I.e.
> -- 
> 2.1.0
> 
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply

* [PATCH RFC 1/4] virtio_net: pass vi around
From: Michael S. Tsirkin @ 2014-10-23 21:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, virtualization

Too many places poke at [rs]q->vq->vdev->priv just to get
the the vi structure.  Let's just pass the pointer around: seems
cleaner, and might even be faster.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/net/virtio_net.c | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 57cbc7d..36f3dfc 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -241,11 +241,11 @@ static unsigned long mergeable_buf_to_ctx(void *buf, unsigned int truesize)
 }
 
 /* Called from bottom half context */
-static struct sk_buff *page_to_skb(struct receive_queue *rq,
+static struct sk_buff *page_to_skb(struct virtnet_info *vi,
+				   struct receive_queue *rq,
 				   struct page *page, unsigned int offset,
 				   unsigned int len, unsigned int truesize)
 {
-	struct virtnet_info *vi = rq->vq->vdev->priv;
 	struct sk_buff *skb;
 	struct skb_vnet_hdr *hdr;
 	unsigned int copy, hdr_len, hdr_padded_len;
@@ -328,12 +328,13 @@ static struct sk_buff *receive_small(void *buf, unsigned int len)
 }
 
 static struct sk_buff *receive_big(struct net_device *dev,
+				   struct virtnet_info *vi,
 				   struct receive_queue *rq,
 				   void *buf,
 				   unsigned int len)
 {
 	struct page *page = buf;
-	struct sk_buff *skb = page_to_skb(rq, page, 0, len, PAGE_SIZE);
+	struct sk_buff *skb = page_to_skb(vi, rq, page, 0, len, PAGE_SIZE);
 
 	if (unlikely(!skb))
 		goto err;
@@ -359,7 +360,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
 	int offset = buf - page_address(page);
 	unsigned int truesize = max(len, mergeable_ctx_to_buf_truesize(ctx));
 
-	struct sk_buff *head_skb = page_to_skb(rq, page, offset, len, truesize);
+	struct sk_buff *head_skb = page_to_skb(vi, rq, page, offset, len,
+					       truesize);
 	struct sk_buff *curr_skb = head_skb;
 
 	if (unlikely(!curr_skb))
@@ -433,9 +435,9 @@ err_buf:
 	return NULL;
 }
 
-static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len)
+static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
+			void *buf, unsigned int len)
 {
-	struct virtnet_info *vi = rq->vq->vdev->priv;
 	struct net_device *dev = vi->dev;
 	struct virtnet_stats *stats = this_cpu_ptr(vi->stats);
 	struct sk_buff *skb;
@@ -459,9 +461,9 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len)
 	if (vi->mergeable_rx_bufs)
 		skb = receive_mergeable(dev, vi, rq, (unsigned long)buf, len);
 	else if (vi->big_packets)
-		skb = receive_big(dev, rq, buf, len);
+		skb = receive_big(dev, vi, rq, buf, len);
 	else
-		skb = receive_small(buf, len);
+		skb = receive_small(vi, buf, len);
 
 	if (unlikely(!skb))
 		return;
@@ -530,9 +532,9 @@ frame_err:
 	dev_kfree_skb(skb);
 }
 
-static int add_recvbuf_small(struct receive_queue *rq, gfp_t gfp)
+static int add_recvbuf_small(struct virtnet_info *vi, struct receive_queue *rq,
+			     gfp_t gfp)
 {
-	struct virtnet_info *vi = rq->vq->vdev->priv;
 	struct sk_buff *skb;
 	struct skb_vnet_hdr *hdr;
 	int err;
@@ -655,9 +657,9 @@ static int add_recvbuf_mergeable(struct receive_queue *rq, gfp_t gfp)
  * before we're receiving packets, or from refill_work which is
  * careful to disable receiving (using napi_disable).
  */
-static bool try_fill_recv(struct receive_queue *rq, gfp_t gfp)
+static bool try_fill_recv(struct virtnet_info *vi, struct receive_queue *rq,
+			  gfp_t gfp)
 {
-	struct virtnet_info *vi = rq->vq->vdev->priv;
 	int err;
 	bool oom;
 
@@ -668,7 +670,7 @@ static bool try_fill_recv(struct receive_queue *rq, gfp_t gfp)
 		else if (vi->big_packets)
 			err = add_recvbuf_big(rq, gfp);
 		else
-			err = add_recvbuf_small(rq, gfp);
+			err = add_recvbuf_small(vi, rq, gfp);
 
 		oom = err == -ENOMEM;
 		if (err)
@@ -717,7 +719,7 @@ static void refill_work(struct work_struct *work)
 		struct receive_queue *rq = &vi->rq[i];
 
 		napi_disable(&rq->napi);
-		still_empty = !try_fill_recv(rq, GFP_KERNEL);
+		still_empty = !try_fill_recv(vi, rq, GFP_KERNEL);
 		virtnet_napi_enable(rq);
 
 		/* In theory, this can happen: if we don't get any buffers in
@@ -736,12 +738,12 @@ static int virtnet_receive(struct receive_queue *rq, int budget)
 
 	while (received < budget &&
 	       (buf = virtqueue_get_buf(rq->vq, &len)) != NULL) {
-		receive_buf(rq, buf, len);
+		receive_buf(vi, rq, buf, len);
 		received++;
 	}
 
 	if (rq->vq->num_free > virtqueue_get_vring_size(rq->vq) / 2) {
-		if (!try_fill_recv(rq, GFP_ATOMIC))
+		if (!try_fill_recv(vi, rq, GFP_ATOMIC))
 			schedule_delayed_work(&vi->refill, 0);
 	}
 
@@ -817,7 +819,7 @@ static int virtnet_open(struct net_device *dev)
 	for (i = 0; i < vi->max_queue_pairs; i++) {
 		if (i < vi->curr_queue_pairs)
 			/* Make sure we have some buffers: if oom use wq. */
-			if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
+			if (!try_fill_recv(vi, &vi->rq[i], GFP_KERNEL))
 				schedule_delayed_work(&vi->refill, 0);
 		virtnet_napi_enable(&vi->rq[i]);
 	}
-- 
MST

^ permalink raw reply related

* [PATCH RFC 2/4] virtio_net: get rid of virtio_net_hdr/skb_vnet_hdr
From: Michael S. Tsirkin @ 2014-10-23 21:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, virtualization
In-Reply-To: <1414099656-28090-1-git-send-email-mst@redhat.com>

virtio 1.0 doesn't use virtio_net_hdr anymore, and in fact, it's not
really useful since virtio_net_hdr_mrg_rxbuf includes that as the first
field anyway.

Let's drop it, precalculate header len and store within vi instead.

This way we can also remove struct skb_vnet_hdr.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/net/virtio_net.c | 88 ++++++++++++++++++++++--------------------------
 1 file changed, 40 insertions(+), 48 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 36f3dfc..a795a23 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -123,6 +123,9 @@ struct virtnet_info {
 	/* Host can handle any s/g split between our header and packet data */
 	bool any_header_sg;
 
+	/* Packet virtio header size */
+	u8 hdr_len;
+
 	/* Active statistics */
 	struct virtnet_stats __percpu *stats;
 
@@ -139,21 +142,14 @@ struct virtnet_info {
 	struct notifier_block nb;
 };
 
-struct skb_vnet_hdr {
-	union {
-		struct virtio_net_hdr hdr;
-		struct virtio_net_hdr_mrg_rxbuf mhdr;
-	};
-};
-
 struct padded_vnet_hdr {
-	struct virtio_net_hdr hdr;
+	struct virtio_net_hdr_mrg_rxbuf hdr;
 	/*
-	 * virtio_net_hdr should be in a separated sg buffer because of a
-	 * QEMU bug, and data sg buffer shares same page with this header sg.
-	 * This padding makes next sg 16 byte aligned after virtio_net_hdr.
+	 * hdr is in a separate sg buffer, and data sg buffer shares same page
+	 * with this header sg. This padding makes next sg 16 byte aligned
+	 * after the header.
 	 */
-	char padding[6];
+	char padding[4];
 };
 
 /* Converting between virtqueue no. and kernel tx/rx queue no.
@@ -179,9 +175,9 @@ static int rxq2vq(int rxq)
 	return rxq * 2;
 }
 
-static inline struct skb_vnet_hdr *skb_vnet_hdr(struct sk_buff *skb)
+static inline struct virtio_net_hdr_mrg_rxbuf *skb_vnet_hdr(struct sk_buff *skb)
 {
-	return (struct skb_vnet_hdr *)skb->cb;
+	return (struct virtio_net_hdr_mrg_rxbuf *)skb->cb;
 }
 
 /*
@@ -247,7 +243,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
 				   unsigned int len, unsigned int truesize)
 {
 	struct sk_buff *skb;
-	struct skb_vnet_hdr *hdr;
+	struct virtio_net_hdr_mrg_rxbuf *hdr;
 	unsigned int copy, hdr_len, hdr_padded_len;
 	char *p;
 
@@ -260,13 +256,11 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
 
 	hdr = skb_vnet_hdr(skb);
 
-	if (vi->mergeable_rx_bufs) {
-		hdr_len = sizeof hdr->mhdr;
-		hdr_padded_len = sizeof hdr->mhdr;
-	} else {
-		hdr_len = sizeof hdr->hdr;
+	hdr_len = vi->hdr_len;
+	if (vi->mergeable_rx_bufs)
+		hdr_padded_len = sizeof *hdr;
+	else
 		hdr_padded_len = sizeof(struct padded_vnet_hdr);
-	}
 
 	memcpy(hdr, p, hdr_len);
 
@@ -317,11 +311,11 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
 	return skb;
 }
 
-static struct sk_buff *receive_small(void *buf, unsigned int len)
+static struct sk_buff *receive_small(struct virtnet_info *vi, void *buf, unsigned int len)
 {
 	struct sk_buff * skb = buf;
 
-	len -= sizeof(struct virtio_net_hdr);
+	len -= vi->hdr_len;
 	skb_trim(skb, len);
 
 	return skb;
@@ -354,8 +348,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
 					 unsigned int len)
 {
 	void *buf = mergeable_ctx_to_buf_address(ctx);
-	struct skb_vnet_hdr *hdr = buf;
-	u16 num_buf = virtio16_to_cpu(rq->vq->vdev, hdr->mhdr.num_buffers);
+	struct virtio_net_hdr_mrg_rxbuf *hdr = buf;
+	u16 num_buf = virtio16_to_cpu(vi->vdev, hdr->num_buffers);
 	struct page *page = virt_to_head_page(buf);
 	int offset = buf - page_address(page);
 	unsigned int truesize = max(len, mergeable_ctx_to_buf_truesize(ctx));
@@ -373,8 +367,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
 		if (unlikely(!ctx)) {
 			pr_debug("%s: rx error: %d buffers out of %d missing\n",
 				 dev->name, num_buf,
-				 virtio16_to_cpu(rq->vq->vdev,
-						 hdr->mhdr.num_buffers));
+				 virtio16_to_cpu(vi->vdev,
+						 hdr->num_buffers));
 			dev->stats.rx_length_errors++;
 			goto err_buf;
 		}
@@ -441,7 +435,7 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
 	struct net_device *dev = vi->dev;
 	struct virtnet_stats *stats = this_cpu_ptr(vi->stats);
 	struct sk_buff *skb;
-	struct skb_vnet_hdr *hdr;
+	struct virtio_net_hdr_mrg_rxbuf *hdr;
 
 	if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) {
 		pr_debug("%s: short packet %i\n", dev->name, len);
@@ -536,7 +530,7 @@ static int add_recvbuf_small(struct virtnet_info *vi, struct receive_queue *rq,
 			     gfp_t gfp)
 {
 	struct sk_buff *skb;
-	struct skb_vnet_hdr *hdr;
+	struct virtio_net_hdr_mrg_rxbuf *hdr;
 	int err;
 
 	skb = __netdev_alloc_skb_ip_align(vi->dev, GOOD_PACKET_LEN, gfp);
@@ -547,7 +541,7 @@ static int add_recvbuf_small(struct virtnet_info *vi, struct receive_queue *rq,
 
 	hdr = skb_vnet_hdr(skb);
 	sg_init_table(rq->sg, MAX_SKB_FRAGS + 2);
-	sg_set_buf(rq->sg, &hdr->hdr, sizeof hdr->hdr);
+	sg_set_buf(rq->sg, hdr, vi->hdr_len);
 	skb_to_sgvec(skb, rq->sg + 1, 0, skb->len);
 
 	err = virtqueue_add_inbuf(rq->vq, rq->sg, 2, skb, gfp);
@@ -557,7 +551,8 @@ static int add_recvbuf_small(struct virtnet_info *vi, struct receive_queue *rq,
 	return err;
 }
 
-static int add_recvbuf_big(struct receive_queue *rq, gfp_t gfp)
+static int add_recvbuf_big(struct virtnet_info *vi, struct receive_queue *rq,
+			   gfp_t gfp)
 {
 	struct page *first, *list = NULL;
 	char *p;
@@ -588,8 +583,8 @@ static int add_recvbuf_big(struct receive_queue *rq, gfp_t gfp)
 	p = page_address(first);
 
 	/* rq->sg[0], rq->sg[1] share the same page */
-	/* a separated rq->sg[0] for virtio_net_hdr only due to QEMU bug */
-	sg_set_buf(&rq->sg[0], p, sizeof(struct virtio_net_hdr));
+	/* a separated rq->sg[0] for header - required in case !any_header_sg */
+	sg_set_buf(&rq->sg[0], p, vi->hdr_len);
 
 	/* rq->sg[1] for data packet, from offset */
 	offset = sizeof(struct padded_vnet_hdr);
@@ -668,7 +663,7 @@ static bool try_fill_recv(struct virtnet_info *vi, struct receive_queue *rq,
 		if (vi->mergeable_rx_bufs)
 			err = add_recvbuf_mergeable(rq, gfp);
 		else if (vi->big_packets)
-			err = add_recvbuf_big(rq, gfp);
+			err = add_recvbuf_big(vi, rq, gfp);
 		else
 			err = add_recvbuf_small(vi, rq, gfp);
 
@@ -848,18 +843,14 @@ static void free_old_xmit_skbs(struct send_queue *sq)
 
 static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
 {
-	struct skb_vnet_hdr *hdr;
+	struct virtio_net_hdr_mrg_rxbuf *hdr;
 	const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
 	struct virtnet_info *vi = sq->vq->vdev->priv;
 	unsigned num_sg;
-	unsigned hdr_len;
+	unsigned hdr_len = vi->hdr_len;
 	bool can_push;
 
 	pr_debug("%s: xmit %p %pM\n", vi->dev->name, skb, dest);
-	if (vi->mergeable_rx_bufs)
-		hdr_len = sizeof hdr->mhdr;
-	else
-		hdr_len = sizeof hdr->hdr;
 
 	can_push = vi->any_header_sg &&
 		!((unsigned long)skb->data & (__alignof__(*hdr) - 1)) &&
@@ -867,7 +858,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
 	/* Even if we can, don't push here yet as this would skew
 	 * csum_start offset below. */
 	if (can_push)
-		hdr = (struct skb_vnet_hdr *)(skb->data - hdr_len);
+		hdr = (struct virtio_net_hdr_mrg_rxbuf *)(skb->data - hdr_len);
 	else
 		hdr = skb_vnet_hdr(skb);
 
@@ -902,7 +893,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
 	}
 
 	if (vi->mergeable_rx_bufs)
-		hdr->mhdr.num_buffers = 0;
+		hdr->num_buffers = 0;
 
 	sg_init_table(sq->sg, MAX_SKB_FRAGS + 2);
 	if (can_push) {
@@ -1773,18 +1764,19 @@ static int virtnet_probe(struct virtio_device *vdev)
 	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
 		vi->mergeable_rx_bufs = true;
 
+	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
+		vi->hdr_len = sizeof(struct virtio_net_hdr_mrg_rxbuf);
+	else
+		vi->hdr_len = sizeof(struct virtio_net_hdr);
+
 	if (virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT))
 		vi->any_header_sg = true;
 
 	if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ))
 		vi->has_cvq = true;
 
-	if (vi->any_header_sg) {
-		if (vi->mergeable_rx_bufs)
-			dev->needed_headroom = sizeof(struct virtio_net_hdr_mrg_rxbuf);
-		else
-			dev->needed_headroom = sizeof(struct virtio_net_hdr);
-	}
+	if (vi->any_header_sg)
+		dev->needed_headroom = vi->hdr_len;
 
 	/* Use single tx/rx queue pair as default */
 	vi->curr_queue_pairs = 1;
-- 
MST

^ permalink raw reply related

* [PATCH RFC 3/4] virtio_net: stricter short buffer length checks
From: Michael S. Tsirkin @ 2014-10-23 21:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, virtualization
In-Reply-To: <1414099656-28090-2-git-send-email-mst@redhat.com>

Our buffer length check is not strict enough for mergeable
buffers: buffer can still be shorter that header + address
by 2 bytes.

Fix that up.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/net/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index a795a23..9c6d50f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -437,7 +437,7 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
 	struct sk_buff *skb;
 	struct virtio_net_hdr_mrg_rxbuf *hdr;
 
-	if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) {
+	if (unlikely(len < vi->hdr_len + ETH_HLEN)) {
 		pr_debug("%s: short packet %i\n", dev->name, len);
 		dev->stats.rx_length_errors++;
 		if (vi->mergeable_rx_bufs) {
-- 
MST

^ permalink raw reply related

* [PATCH RFC 4/4] virtio_net: bigger header when VERSION_1 is set
From: Michael S. Tsirkin @ 2014-10-23 21:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, virtualization
In-Reply-To: <1414099656-28090-3-git-send-email-mst@redhat.com>

With VERSION_1 virtio_net uses same header size
whether mergeable buffers are enabled or not.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/net/virtio_net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9c6d50f..a2fe340 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1764,7 +1764,8 @@ static int virtnet_probe(struct virtio_device *vdev)
 	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
 		vi->mergeable_rx_bufs = true;
 
-	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
+	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF) ||
+	    virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
 		vi->hdr_len = sizeof(struct virtio_net_hdr_mrg_rxbuf);
 	else
 		vi->hdr_len = sizeof(struct virtio_net_hdr);
-- 
MST

^ permalink raw reply related

* [PATCH net 2/2] cxgb4 : Handle dcb enable correctly
From: Anish Bhatt @ 2014-10-23 21:37 UTC (permalink / raw)
  To: netdev; +Cc: davem, hariprasad, leedom, Anish Bhatt
In-Reply-To: <1414100251-15702-1-git-send-email-anish@chelsio.com>

Disabling DCBx in firmware automatically enables DCBx for control via host
lldp agents. Wait for an explicit setstate call from an lldp agents to enable
 DCBx instead.

Fixes: 76bcb31efc06 ("cxgb4 : Add DCBx support codebase and dcbnl_ops")

Signed-off-by: Anish Bhatt <anish@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c  | 7 ++++++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 6 +++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
index ee819fd..6fe300e 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
@@ -116,7 +116,6 @@ void cxgb4_dcb_state_fsm(struct net_device *dev,
 			/* we're going to use Host DCB */
 			dcb->state = CXGB4_DCB_STATE_HOST;
 			dcb->supported = CXGB4_DCBX_HOST_SUPPORT;
-			dcb->enabled = 1;
 			break;
 		}
 
@@ -386,6 +385,12 @@ static u8 cxgb4_setstate(struct net_device *dev, u8 enabled)
 {
 	struct port_info *pi = netdev2pinfo(dev);
 
+	/* If DCBx is host-managed, dcb is enabled by outside lldp agents */
+	if (pi->dcb.state == CXGB4_DCB_STATE_HOST) {
+		pi->dcb.enabled = enabled;
+		return 0;
+	}
+
 	/* Firmware doesn't provide any mechanism to control the DCB state.
 	 */
 	if (enabled != (pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED))
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 3f60070..97683c1 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -694,7 +694,11 @@ int cxgb4_dcb_enabled(const struct net_device *dev)
 #ifdef CONFIG_CHELSIO_T4_DCB
 	struct port_info *pi = netdev_priv(dev);
 
-	return pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED;
+	if (!pi->dcb.enabled)
+		return 0;
+
+	return ((pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED) ||
+		(pi->dcb.state == CXGB4_DCB_STATE_HOST));
 #else
 	return 0;
 #endif
-- 
2.1.2

^ permalink raw reply related

* [PATCH net 0/2] cxgb4 : DCBx fixes for apps/host lldp agents
From: Anish Bhatt @ 2014-10-23 21:37 UTC (permalink / raw)
  To: netdev; +Cc: davem, hariprasad, leedom, Anish Bhatt

This patchset  contains some minor fixes for cxgb4 DCBx code. Chiefly, cxgb4 
was not cleaning up any apps added to kernel app table when link was lost.
Disabling DCBx in firmware would automatically set DCBx state to host-managed
and enabled, we now wait for an explicit enable call from an lldp agent instead

First patch was originally sent to net-next, but considering it applies to
correcting behaviour of code already in net, I think it qualifies as a bug fix.
-Anish

Anish Bhatt (2):
  cxgb4 : Improve handling of DCB negotiation or loss thereof
  cxgb4 : Handle dcb enable correctly

 drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c  | 55 +++++++++++++++++++++++--
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |  6 ++-
 2 files changed, 56 insertions(+), 5 deletions(-)

-- 
2.1.2

^ permalink raw reply

* [PATCH net 1/2] cxgb4 : Improve handling of DCB negotiation or loss thereof
From: Anish Bhatt @ 2014-10-23 21:37 UTC (permalink / raw)
  To: netdev; +Cc: davem, hariprasad, leedom, Anish Bhatt
In-Reply-To: <1414100251-15702-1-git-send-email-anish@chelsio.com>

Clear out any DCB apps we might have added to kernel table when we lose DCB
sync (or IEEE equivalent event). These were previously left behind and not 
cleaned up correctly. IEEE allows individual components to work independently, 
 so improve check for IEEE completion by specifying individual components.

Fixes: 10b0046685ab ("cxgb4: IEEE fixes for DCBx state machine")

Signed-off-by: Anish Bhatt <anish@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | 48 ++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
index 8edf0f5..ee819fd 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
@@ -60,6 +60,42 @@ void cxgb4_dcb_version_init(struct net_device *dev)
 	dcb->dcb_version = FW_PORT_DCB_VER_AUTO;
 }
 
+static void cxgb4_dcb_cleanup_apps(struct net_device *dev)
+{
+	struct port_info *pi = netdev2pinfo(dev);
+	struct adapter *adap = pi->adapter;
+	struct port_dcb_info *dcb = &pi->dcb;
+	struct dcb_app app;
+	int i, err;
+
+	/* zero priority implies remove */
+	app.priority = 0;
+
+	for (i = 0; i < CXGB4_MAX_DCBX_APP_SUPPORTED; i++) {
+		/* Check if app list is exhausted */
+		if (!dcb->app_priority[i].protocolid)
+			break;
+
+		app.protocol = dcb->app_priority[i].protocolid;
+
+		if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) {
+			app.selector = dcb->app_priority[i].sel_field + 1;
+			err = dcb_ieee_setapp(dev, &app);
+		} else {
+			app.selector = !!(dcb->app_priority[i].sel_field);
+			err = dcb_setapp(dev, &app);
+		}
+
+		if (err) {
+			dev_err(adap->pdev_dev,
+				"Failed DCB Clear %s Application Priority: sel=%d, prot=%d, , err=%d\n",
+				dcb_ver_array[dcb->dcb_version], app.selector,
+				app.protocol, -err);
+			break;
+		}
+	}
+}
+
 /* Finite State machine for Data Center Bridging.
  */
 void cxgb4_dcb_state_fsm(struct net_device *dev,
@@ -145,6 +181,7 @@ void cxgb4_dcb_state_fsm(struct net_device *dev,
 			 * state.  We need to reset back to a ground state
 			 * of incomplete.
 			 */
+			cxgb4_dcb_cleanup_apps(dev);
 			cxgb4_dcb_state_init(dev);
 			dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE;
 			dcb->supported = CXGB4_DCBX_FW_SUPPORT;
@@ -833,11 +870,16 @@ static int cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id,
 
 /* Return whether IEEE Data Center Bridging has been negotiated.
  */
-static inline int cxgb4_ieee_negotiation_complete(struct net_device *dev)
+static inline int
+cxgb4_ieee_negotiation_complete(struct net_device *dev,
+				enum cxgb4_dcb_fw_msgs dcb_subtype)
 {
 	struct port_info *pi = netdev2pinfo(dev);
 	struct port_dcb_info *dcb = &pi->dcb;
 
+	if (dcb_subtype && !(dcb->msgs & dcb_subtype))
+		return 0;
+
 	return (dcb->state == CXGB4_DCB_STATE_FW_ALLSYNCED &&
 		(dcb->supported & DCB_CAP_DCBX_VER_IEEE));
 }
@@ -850,7 +892,7 @@ static int cxgb4_ieee_getapp(struct net_device *dev, struct dcb_app *app)
 {
 	int prio;
 
-	if (!cxgb4_ieee_negotiation_complete(dev))
+	if (!cxgb4_ieee_negotiation_complete(dev, CXGB4_DCB_FW_APP_ID))
 		return -EINVAL;
 	if (!(app->selector && app->protocol))
 		return -EINVAL;
@@ -872,7 +914,7 @@ static int cxgb4_ieee_setapp(struct net_device *dev, struct dcb_app *app)
 {
 	int ret;
 
-	if (!cxgb4_ieee_negotiation_complete(dev))
+	if (!cxgb4_ieee_negotiation_complete(dev, CXGB4_DCB_FW_APP_ID))
 		return -EINVAL;
 	if (!(app->selector && app->protocol))
 		return -EINVAL;
-- 
2.1.2

^ permalink raw reply related

* Re: localed stuck in recent 3.18 git in copy_net_ns?
From: Yanko Kaneti @ 2014-10-23 21:45 UTC (permalink / raw)
  To: paulmck
  Cc: Josh Boyer, Eric W. Biederman, Cong Wang, Kevin Fenzi, netdev,
	Linux-Kernel@Vger. Kernel. Org
In-Reply-To: <20141023200507.GC4977@linux.vnet.ibm.com>


On Thu, 2014-10-23 at 13:05 -0700, Paul E. McKenney wrote:
> On Thu, Oct 23, 2014 at 10:51:59PM +0300, Yanko Kaneti wrote:
> > On Thu-10/23/14-2014 08:33, Paul E. McKenney wrote:
> > > On Thu, Oct 23, 2014 at 05:27:50AM -0700, Paul E. McKenney wrote:
> > > > On Thu, Oct 23, 2014 at 09:09:26AM +0300, Yanko Kaneti wrote:
> > > > > On Wed, 2014-10-22 at 16:24 -0700, Paul E. McKenney wrote:
> > > > > > On Thu, Oct 23, 2014 at 01:40:32AM +0300, Yanko Kaneti 
> > > > > > wrote:
> > > > > > > On Wed-10/22/14-2014 15:33, Josh Boyer wrote:
> > > > > > > > On Wed, Oct 22, 2014 at 2:55 PM, Paul E. McKenney
> > > > > > > > <paulmck@linux.vnet.ibm.com> wrote:
> > > > > > 
> > > > > > [ . . . ]
> > > > > > 
> > > > > > > > > Don't get me wrong -- the fact that this kthread 
> > > > > > > > > appears to
> > > > > > > > > have
> > > > > > > > > blocked within rcu_barrier() for 120 seconds means 
> > > > > > > > > that
> > > > > > > > > something is
> > > > > > > > > most definitely wrong here.  I am surprised that 
> > > > > > > > > there are no
> > > > > > > > > RCU CPU
> > > > > > > > > stall warnings, but perhaps the blockage is in the 
> > > > > > > > > callback
> > > > > > > > > execution
> > > > > > > > > rather than grace-period completion.  Or something is
> > > > > > > > > preventing this
> > > > > > > > > kthread from starting up after the wake-up callback 
> > > > > > > > > executes.
> > > > > > > > > Or...
> > > > > > > > > 
> > > > > > > > > Is this thing reproducible?
> > > > > > > > 
> > > > > > > > I've added Yanko on CC, who reported the backtrace 
> > > > > > > > above and can
> > > > > > > > recreate it reliably.  Apparently reverting the RCU 
> > > > > > > > merge commit
> > > > > > > > (d6dd50e) and rebuilding the latest after that does 
> > > > > > > > not show the
> > > > > > > > issue.  I'll let Yanko explain more and answer any 
> > > > > > > > questions you
> > > > > > > > have.
> > > > > > > 
> > > > > > > - It is reproducible
> > > > > > > - I've done another build here to double check and its 
> > > > > > > definitely
> > > > > > > the rcu merge
> > > > > > >   that's causing it.
> > > > > > > 
> > > > > > > Don't think I'll be able to dig deeper, but I can do 
> > > > > > > testing if
> > > > > > > needed.
> > > > > > 
> > > > > > Please!  Does the following patch help?
> > > > > 
> > > > > Nope, doesn't seem to make a difference to the modprobe 
> > > > > ppp_generic
> > > > > test
> > > > 
> > > > Well, I was hoping.  I will take a closer look at the RCU 
> > > > merge commit
> > > > and see what suggests itself.  I am likely to ask you to 
> > > > revert specific
> > > > commits, if that works for you.
> > > 
> > > Well, rather than reverting commits, could you please try 
> > > testing the
> > > following commits?
> > > 
> > > 11ed7f934cb8 (rcu: Make nocb leader kthreads process pending 
> > > callbacks after spawning)
> > > 
> > > 73a860cd58a1 (rcu: Replace flush_signals() with 
> > > WARN_ON(signal_pending()))
> > > 
> > > c847f14217d5 (rcu: Avoid misordering in nocb_leader_wait())
> > > 
> > >         For whatever it is worth, I am guessing this one.
> > 
> > Indeed, c847f14217d5 it is.
> > 
> > Much to my embarrasment I just noticed that in addition to the
> > rcu merge, triggering the bug "requires" my specific Fedora 
> > rawhide network
> > setup. Booting in single mode and modprobe ppp_generic is fine. 
> > The bug
> > appears when starting with my regular fedora network setup, which 
> > in my case
> > includes 3 ethernet adapters and a libvirt birdge+nat setup.
> > 
> > Hope that helps.
> > 
> > I am attaching the config.
> 
> It does help a lot, thank you!!!
> 
> The following patch is a bit of a shot in the dark, and assumes that
> commit 1772947bd012 (rcu: Handle NOCB callbacks from irq-disabled 
> idle
> code) introduced the problem.  Does this patch fix things up?

Unfortunately not, This is linus-tip + patch


INFO: task kworker/u16:6:96 blocked for more than 120 seconds.
      Not tainted 3.18.0-rc1+ #4
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
kworker/u16:6   D ffff8800ca84cec0 11168    96      2 0x00000000
Workqueue: netns cleanup_net
 ffff8802218339e8 0000000000000096 ffff8800ca84cec0 00000000001d5f00
 ffff880221833fd8 00000000001d5f00 ffff880223264ec0 ffff8800ca84cec0
 ffffffff82c52040 7fffffffffffffff ffffffff81ee2658 ffffffff81ee2650
Call Trace:
 [<ffffffff8185b8e9>] schedule+0x29/0x70
 [<ffffffff81860b0c>] schedule_timeout+0x26c/0x410
 [<ffffffff81028bea>] ? native_sched_clock+0x2a/0xa0
 [<ffffffff8110759c>] ? mark_held_locks+0x7c/0xb0
 [<ffffffff81861b90>] ? _raw_spin_unlock_irq+0x30/0x50
 [<ffffffff8110772d>] ? trace_hardirqs_on_caller+0x15d/0x200
 [<ffffffff8185d31c>] wait_for_completion+0x10c/0x150
 [<ffffffff810e4ed0>] ? wake_up_state+0x20/0x20
 [<ffffffff8112a219>] _rcu_barrier+0x159/0x200
 [<ffffffff8112a315>] rcu_barrier+0x15/0x20
 [<ffffffff8171657f>] netdev_run_todo+0x6f/0x310
 [<ffffffff8170b145>] ? rollback_registered_many+0x265/0x2e0
 [<ffffffff817235ee>] rtnl_unlock+0xe/0x10
 [<ffffffff8170cfa6>] default_device_exit_batch+0x156/0x180
 [<ffffffff810fd390>] ? abort_exclusive_wait+0xb0/0xb0
 [<ffffffff81705053>] ops_exit_list.isra.1+0x53/0x60
 [<ffffffff81705c00>] cleanup_net+0x100/0x1f0
 [<ffffffff810cca98>] process_one_work+0x218/0x850
 [<ffffffff810cc9ff>] ? process_one_work+0x17f/0x850
 [<ffffffff810cd1b7>] ? worker_thread+0xe7/0x4a0
 [<ffffffff810cd13b>] worker_thread+0x6b/0x4a0
 [<ffffffff810cd0d0>] ? process_one_work+0x850/0x850
 [<ffffffff810d348b>] kthread+0x10b/0x130
 [<ffffffff81028c69>] ? sched_clock+0x9/0x10
 [<ffffffff810d3380>] ? kthread_create_on_node+0x250/0x250
 [<ffffffff818628bc>] ret_from_fork+0x7c/0xb0
 [<ffffffff810d3380>] ? kthread_create_on_node+0x250/0x250
4 locks held by kworker/u16:6/96:
 #0:  ("%s""netns"){.+.+.+}, at: [<ffffffff810cc9ff>] process_one_work+0x17f/0x850
 #1:  (net_cleanup_work){+.+.+.}, at: [<ffffffff810cc9ff>] process_one_work+0x17f/0x850
 #2:  (net_mutex){+.+.+.}, at: [<ffffffff81705b8c>] cleanup_net+0x8c/0x1f0
 #3:  (rcu_sched_state.barrier_mutex){+.+...}, at: [<ffffffff8112a0f5>] _rcu_barrier+0x35/0x200
INFO: task modprobe:1045 blocked for more than 120 seconds.
      Not tainted 3.18.0-rc1+ #4
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
modprobe        D ffff880218343480 12920  1045   1044 0x00000080
 ffff880218353bf8 0000000000000096 ffff880218343480 00000000001d5f00
 ffff880218353fd8 00000000001d5f00 ffffffff81e1b580 ffff880218343480
 ffff880218343480 ffffffff81f8f748 0000000000000246 ffff880218343480
Call Trace:
 [<ffffffff8185be91>] schedule_preempt_disabled+0x31/0x80
 [<ffffffff8185d6e3>] mutex_lock_nested+0x183/0x440
 [<ffffffff81705a1f>] ? register_pernet_subsys+0x1f/0x50
 [<ffffffff81705a1f>] ? register_pernet_subsys+0x1f/0x50
 [<ffffffffa0673000>] ? 0xffffffffa0673000
 [<ffffffff81705a1f>] register_pernet_subsys+0x1f/0x50
 [<ffffffffa0673048>] br_init+0x48/0xd3 [bridge]
 [<ffffffff81002148>] do_one_initcall+0xd8/0x210
 [<ffffffff81153052>] load_module+0x20c2/0x2870
 [<ffffffff8114e030>] ? store_uevent+0x70/0x70
 [<ffffffff81278717>] ? kernel_read+0x57/0x90
 [<ffffffff811539e6>] SyS_finit_module+0xa6/0xe0
 [<ffffffff81862969>] system_call_fastpath+0x12/0x17
1 lock held by modprobe/1045:
 #0:  (net_mutex){+.+.+.}, at: [<ffffffff81705a1f>] register_pernet_subsys+0x1f/0x50


>                 Thanx, Paul
> 
> ---------------------------------------------------------------------
> ---
> 
> rcu: Kick rcuo kthreads after their CPU goes offline
> 
> If a no-CBs CPU were to post an RCU callback with interrupts disabled
> after it entered the idle loop for the last time, there might be no
> deferred wakeup for the corresponding rcuo kthreads.  This commit
> therefore adds a set of calls to do_nocb_deferred_wakeup() after the
> CPU has gone completely offline.
> 
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 84b41b3c6ebd..4f3d25a58786 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3493,8 +3493,10 @@ static int rcu_cpu_notify(struct 
> notifier_block *self,
>         case CPU_DEAD_FROZEN:
>         case CPU_UP_CANCELED:
>         case CPU_UP_CANCELED_FROZEN:
> -       for_each_rcu_flavor(rsp)
> +       for_each_rcu_flavor(rsp) {
>         rcu_cleanup_dead_cpu(cpu, rsp);
> +       do_nocb_deferred_wakeup(this_cpu_ptr(rsp->rda));
> +       }
>         break;
>         default:
>         break;
> 
> 

^ permalink raw reply

* [PATCH] bridge: Add support for IEEE 802.11 Proxy ARP
From: Kyeyoon Park @ 2014-10-23 21:49 UTC (permalink / raw)
  To: davem; +Cc: kyeyoonp, jouni, netdev

From: Kyeyoon Park <kyeyoonp@codeaurora.org>

This feature is defined in IEEE Std 802.11-2012, 10.23.13. It allows
the AP devices to keep track of the hardware-address-to-IP-address
mapping of the mobile devices within the WLAN network.

The AP will learn this mapping via observing DHCP, ARP, and NS/NA
frames. When a request for such information is made (i.e. ARP request,
Neighbor Solicitation), the AP will respond on behalf of the
associated mobile device. In the process of doing so, the AP will drop
the multicast request frame that was intended to go out to the wireless
medium.

It was recommended at the LKS workshop to do this implementation in
the bridge layer. vxlan.c is already doing something very similar.
The DHCP snooping code will be added to the userspace application
(hostapd) per the recommendation.

This RFC commit is only for IPv4. A similar approach in the bridge
layer will be taken for IPv6 as well.

Signed-off-by: Kyeyoon Park <kyeyoonp@codeaurora.org>
---
 include/uapi/linux/if_link.h |  1 +
 net/bridge/br_forward.c      |  5 ++++
 net/bridge/br_input.c        | 60 ++++++++++++++++++++++++++++++++++++++++++++
 net/bridge/br_netlink.c      |  4 ++-
 net/bridge/br_private.h      |  1 +
 net/bridge/br_sysfs_if.c     |  2 ++
 6 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index ff95760..62a17e0 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -231,6 +231,7 @@ enum {
 	IFLA_BRPORT_FAST_LEAVE,	/* multicast fast leave    */
 	IFLA_BRPORT_LEARNING,	/* mac learning */
 	IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */
+	IFLA_BRPORT_PROXYARP,	/* proxy ARP */
 	__IFLA_BRPORT_MAX
 };
 #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index 056b67b..61d9edf 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -181,6 +181,11 @@ static void br_flood(struct net_bridge *br, struct sk_buff *skb,
 		/* Do not flood unicast traffic to ports that turn it off */
 		if (unicast && !(p->flags & BR_FLOOD))
 			continue;
+
+		/* Do not flood to ports that enable proxy ARP */
+		if (p->flags & BR_PROXYARP)
+			continue;
+
 		prev = maybe_deliver(prev, p, skb, __packet_hook);
 		if (IS_ERR(prev))
 			goto out;
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 366c436..a548fbf 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -16,6 +16,8 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/netfilter_bridge.h>
+#include <linux/neighbour.h>
+#include <net/arp.h>
 #include <linux/export.h>
 #include <linux/rculist.h>
 #include "br_private.h"
@@ -57,6 +59,60 @@ static int br_pass_frame_up(struct sk_buff *skb)
 		       netif_receive_skb);
 }
 
+static void br_do_proxy_arp(struct sk_buff *skb, struct net_bridge *br,
+			    u16 vid)
+{
+	struct net_device *dev = br->dev;
+	struct neighbour *n;
+	struct arphdr *parp;
+	u8 *arpptr, *sha;
+	__be32 sip, tip;
+
+	if (dev->flags & IFF_NOARP)
+		return;
+
+	if (!pskb_may_pull(skb, arp_hdr_len(dev))) {
+		dev->stats.tx_dropped++;
+		return;
+	}
+	parp = arp_hdr(skb);
+
+	if (parp->ar_pro != htons(ETH_P_IP) ||
+	    parp->ar_op != htons(ARPOP_REQUEST) ||
+	    parp->ar_hln != dev->addr_len ||
+	    parp->ar_pln != 4)
+		return;
+
+	arpptr = (u8 *)parp + sizeof(struct arphdr);
+	sha = arpptr;
+	arpptr += dev->addr_len;	/* sha */
+	memcpy(&sip, arpptr, sizeof(sip));
+	arpptr += sizeof(sip);
+	arpptr += dev->addr_len;	/* tha */
+	memcpy(&tip, arpptr, sizeof(tip));
+
+	if (ipv4_is_loopback(tip) ||
+	    ipv4_is_multicast(tip))
+		return;
+
+	n = neigh_lookup(&arp_tbl, &tip, dev);
+	if (n) {
+		struct net_bridge_fdb_entry *f;
+
+		if (!(n->nud_state & NUD_VALID)) {
+			neigh_release(n);
+			return;
+		}
+
+		f = __br_fdb_get(br, n->ha, vid);
+		if (f)
+			arp_send(ARPOP_REPLY, ETH_P_ARP, sip, skb->dev, tip,
+				 sha, n->ha, sha);
+
+		neigh_release(n);
+	}
+}
+
 /* note: already called with rcu_read_lock */
 int br_handle_frame_finish(struct sk_buff *skb)
 {
@@ -98,6 +154,10 @@ int br_handle_frame_finish(struct sk_buff *skb)
 	dst = NULL;
 
 	if (is_broadcast_ether_addr(dest)) {
+		if (p->flags & BR_PROXYARP &&
+		    skb->protocol == htons(ETH_P_ARP))
+			br_do_proxy_arp(skb, br, vid);
+
 		skb2 = skb;
 		unicast = false;
 	} else if (is_multicast_ether_addr(dest)) {
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index cb5fcf6..caa6857 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -60,7 +60,8 @@ static int br_port_fill_attrs(struct sk_buff *skb,
 	    nla_put_u8(skb, IFLA_BRPORT_PROTECT, !!(p->flags & BR_ROOT_BLOCK)) ||
 	    nla_put_u8(skb, IFLA_BRPORT_FAST_LEAVE, !!(p->flags & BR_MULTICAST_FAST_LEAVE)) ||
 	    nla_put_u8(skb, IFLA_BRPORT_LEARNING, !!(p->flags & BR_LEARNING)) ||
-	    nla_put_u8(skb, IFLA_BRPORT_UNICAST_FLOOD, !!(p->flags & BR_FLOOD)))
+	    nla_put_u8(skb, IFLA_BRPORT_UNICAST_FLOOD, !!(p->flags & BR_FLOOD)) ||
+	    nla_put_u8(skb, IFLA_BRPORT_PROXYARP, !!(p->flags & BR_PROXYARP)))
 		return -EMSGSIZE;
 
 	return 0;
@@ -335,6 +336,7 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[])
 	br_set_port_flag(p, tb, IFLA_BRPORT_PROTECT, BR_ROOT_BLOCK);
 	br_set_port_flag(p, tb, IFLA_BRPORT_LEARNING, BR_LEARNING);
 	br_set_port_flag(p, tb, IFLA_BRPORT_UNICAST_FLOOD, BR_FLOOD);
+	br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP, BR_PROXYARP);
 
 	if (tb[IFLA_BRPORT_COST]) {
 		err = br_stp_set_path_cost(p, nla_get_u32(tb[IFLA_BRPORT_COST]));
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index b6c04cb..666c6bc 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -172,6 +172,7 @@ struct net_bridge_port
 #define BR_FLOOD		0x00000040
 #define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING)
 #define BR_PROMISC		0x00000080
+#define BR_PROXYARP		0x00000100
 
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
 	struct bridge_mcast_own_query	ip4_own_query;
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
index e561cd5..2de5d91 100644
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -170,6 +170,7 @@ BRPORT_ATTR_FLAG(bpdu_guard, BR_BPDU_GUARD);
 BRPORT_ATTR_FLAG(root_block, BR_ROOT_BLOCK);
 BRPORT_ATTR_FLAG(learning, BR_LEARNING);
 BRPORT_ATTR_FLAG(unicast_flood, BR_FLOOD);
+BRPORT_ATTR_FLAG(proxyarp, BR_PROXYARP);
 
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
 static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf)
@@ -213,6 +214,7 @@ static const struct brport_attribute *brport_attrs[] = {
 	&brport_attr_multicast_router,
 	&brport_attr_multicast_fast_leave,
 #endif
+	&brport_attr_proxyarp,
 	NULL
 };
 
-- 
1.9.1

^ permalink raw reply related

* Re: [net-next] iptunnel: Fix iptunnel_xmit return code for stats maintenance
From: Pravin Shelar @ 2014-10-23 21:49 UTC (permalink / raw)
  To: Andy Zhou; +Cc: David Miller, netdev
In-Reply-To: <1413858156-31763-1-git-send-email-azhou@nicira.com>

On Mon, Oct 20, 2014 at 7:22 PM, Andy Zhou <azhou@nicira.com> wrote:
> iptunnel_xmit() currently always return >= 0 instead of proper error
> code, that is used to maintain stats. For example, current return code
> conflicts with how iptunnel_xmit_stats() maintains stats.
>
> Unfortunately, the return code can not be changed without readjusting
> how SKB memory is managed through the call chain.  The following two
> rules are adopted for this patch:
>
> 1) Proper error code are always propagate back through the call chain
>    so that the caller can maintain stats.
>
> 2) Tunnel xmit functions always free resources, e.g. skb and route
>    entry.
>
> Signed-off-by: Andy Zhou <azhou@nicira.com>
> ---
>  drivers/net/vxlan.c            |   21 +++++++++++++--------
>  include/net/ip_tunnels.h       |    7 +++++++
>  net/ipv4/geneve.c              |    8 ++++++--
>  net/ipv4/ip_tunnel_core.c      |   14 +++++++++++---
>  net/openvswitch/vport-geneve.c |    5 ++---
>  net/openvswitch/vport-gre.c    |    1 +
>  net/openvswitch/vport-vxlan.c  |    6 +++---
>  net/openvswitch/vport.c        |    8 ++++----
>  8 files changed, 47 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index ca30982..93348cb 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -1626,8 +1626,10 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
>         bool udp_sum = !vs->sock->sk->sk_no_check_tx;
>
>         skb = udp_tunnel_handle_offloads(skb, udp_sum);
> -       if (IS_ERR(skb))
> -               return -EINVAL;
> +       if (IS_ERR(skb)) {
> +               err = -EINVAL;
> +               goto error;
> +       }
>
>         min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len
>                         + VXLAN_HLEN + sizeof(struct iphdr)
> @@ -1636,13 +1638,15 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
>         /* Need space for new headers (invalidates iph ptr) */
>         err = skb_cow_head(skb, min_headroom);
>         if (unlikely(err))
> -               return err;
> +               goto error;
>
>         if (vlan_tx_tag_present(skb)) {
>                 if (WARN_ON(!__vlan_put_tag(skb,
>                                             skb->vlan_proto,
> -                                           vlan_tx_tag_get(skb))))
> -                       return -ENOMEM;
> +                                           vlan_tx_tag_get(skb)))) {
> +                       err = -ENOMEM;
> +                       goto error;
> +               }
>
>                 skb->vlan_tci = 0;
>         }
> @@ -1655,6 +1659,10 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
>
>         return udp_tunnel_xmit_skb(vs->sock, rt, skb, src, dst, tos,
>                                    ttl, df, src_port, dst_port, xnet);
> +error:
> +       kfree_skb(skb);
> +       ip_rt_put(rt);
> +       return err;
>  }
>  EXPORT_SYMBOL_GPL(vxlan_xmit_skb);
>
> @@ -1786,9 +1794,6 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
>                                      tos, ttl, df, src_port, dst_port,
>                                      htonl(vni << 8),
>                                      !net_eq(vxlan->net, dev_net(vxlan->dev)));
> -
> -               if (err < 0)
> -                       goto rt_tx_error;
>                 iptunnel_xmit_stats(err, &dev->stats, dev->tstats);
>  #if IS_ENABLED(CONFIG_IPV6)
>         } else {
> diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
> index 5bc6ede..80bcf2e 100644
> --- a/include/net/ip_tunnels.h
> +++ b/include/net/ip_tunnels.h
> @@ -174,6 +174,13 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
>  }
>
>  int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
> +
> +/* Transmit a packet over IP tunnel
> + * Returns:
> + *     0 Congestion notification received
> + *     >0  Number of bytes in the packet successfully sent
> + *     <0 packet dropped due to error
> + */
>  int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
>                   __be32 src, __be32 dst, __u8 proto,
>                   __u8 tos, __u8 ttl, __be16 df, bool xnet);
> diff --git a/net/ipv4/geneve.c b/net/ipv4/geneve.c
> index 065cd94..90fea48 100644
> --- a/net/ipv4/geneve.c
> +++ b/net/ipv4/geneve.c
> @@ -129,14 +129,14 @@ int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt,
>
>         err = skb_cow_head(skb, min_headroom);
>         if (unlikely(err))
> -               return err;
> +               goto error;
>
>         if (vlan_tx_tag_present(skb)) {
>                 if (unlikely(!__vlan_put_tag(skb,
>                                              skb->vlan_proto,
>                                              vlan_tx_tag_get(skb)))) {
>                         err = -ENOMEM;
> -                       return err;
> +                       goto error;
>                 }
>                 skb->vlan_tci = 0;
>         }
> @@ -146,6 +146,10 @@ int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt,
>
>         return udp_tunnel_xmit_skb(gs->sock, rt, skb, src, dst,
>                                    tos, ttl, df, src_port, dst_port, xnet);
> +error:
> +       kfree_skb(skb);
> +       ip_rt_put(rt);
> +       return err;
>  }
>  EXPORT_SYMBOL_GPL(geneve_xmit_skb);
>
> diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
> index 88c386c..b3ba4a3 100644
> --- a/net/ipv4/ip_tunnel_core.c
> +++ b/net/ipv4/ip_tunnel_core.c
> @@ -77,9 +77,17 @@ int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
>         __ip_select_ident(iph, skb_shinfo(skb)->gso_segs ?: 1);
>
>         err = ip_local_out_sk(sk, skb);
> -       if (unlikely(net_xmit_eval(err)))
> -               pkt_len = 0;
> -       return pkt_len;
> +
> +       /* Deal with positive error numbers. Filter out NET_XMIT_CN */
> +       if (err > 0)
> +               return net_xmit_errno(err);
> +
> +       /* Success, return number of bytes transmitted */
> +       if (err == 0)
> +               err = pkt_len;
> +
> +       /* Return pkt_len or an error code */
> +       return err;
>  }
>  EXPORT_SYMBOL_GPL(iptunnel_xmit);
>
> diff --git a/net/openvswitch/vport-geneve.c b/net/openvswitch/vport-geneve.c
> index 106a9d8..34276fb 100644
> --- a/net/openvswitch/vport-geneve.c
> +++ b/net/openvswitch/vport-geneve.c
> @@ -206,15 +206,14 @@ static int geneve_tnl_send(struct vport *vport, struct sk_buff *skb)
>         tunnel_id_to_vni(tun_key->tun_id, vni);
>         skb->ignore_df = 1;
>
> -       err = geneve_xmit_skb(geneve_port->gs, rt, skb, fl.saddr,
> +       return  geneve_xmit_skb(geneve_port->gs, rt, skb, fl.saddr,
>                               tun_key->ipv4_dst, tun_key->ipv4_tos,
>                               tun_key->ipv4_ttl, df, sport, dport,
>                               tun_key->tun_flags, vni,
>                               tun_info->options_len, (u8 *)tun_info->options,
>                               false);
> -       if (err < 0)
> -               ip_rt_put(rt);
>  error:
> +       kfree_skb(skb);
>         return err;
>  }
>
> diff --git a/net/openvswitch/vport-gre.c b/net/openvswitch/vport-gre.c
> index 108b82d..8721b30 100644
> --- a/net/openvswitch/vport-gre.c
> +++ b/net/openvswitch/vport-gre.c
> @@ -200,6 +200,7 @@ static int gre_tnl_send(struct vport *vport, struct sk_buff *skb)
>  err_free_rt:
>         ip_rt_put(rt);
>  error:
> +       kfree_skb(skb);
>         return err;
>  }
>
There is one error case where gre_tnl_send() leaks skb.

> diff --git a/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c
> index 2735e01..ace849a 100644
> --- a/net/openvswitch/vport-vxlan.c
> +++ b/net/openvswitch/vport-vxlan.c
> @@ -174,15 +174,15 @@ static int vxlan_tnl_send(struct vport *vport, struct sk_buff *skb)
>
>         src_port = udp_flow_src_port(net, skb, 0, 0, true);
>
> -       err = vxlan_xmit_skb(vxlan_port->vs, rt, skb,
> +       return vxlan_xmit_skb(vxlan_port->vs, rt, skb,
>                              fl.saddr, tun_key->ipv4_dst,
>                              tun_key->ipv4_tos, tun_key->ipv4_ttl, df,
>                              src_port, dst_port,
>                              htonl(be64_to_cpu(tun_key->tun_id) << 8),
>                              false);
> -       if (err < 0)
> -               ip_rt_put(rt);
> +
>  error:
> +       kfree_skb(skb);
>         return err;
>  }
>
> diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
> index 6015802..eb0a72f 100644
> --- a/net/openvswitch/vport.c
> +++ b/net/openvswitch/vport.c
> @@ -480,11 +480,11 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
>                 stats->tx_packets++;
>                 stats->tx_bytes += sent;
>                 u64_stats_update_end(&stats->syncp);
> -       } else if (sent < 0) {
> -               ovs_vport_record_error(vport, VPORT_E_TX_ERROR);
> -               kfree_skb(skb);
> -       } else
> +       } else if (sent == -ENOBUFS || sent == -ENOMEM || sent == 0) {
>                 ovs_vport_record_error(vport, VPORT_E_TX_DROPPED);
> +       } else {
> +               ovs_vport_record_error(vport, VPORT_E_TX_ERROR);
> +       }
>
vport-send() and iptunnel_xmit_stats() doe not interpret xmit return
value in same way. iptunnel_xmit_stats() treats all negative values as
error and zero as dropped. But ovs-vport send records selective
negative values as dropped.


>         return sent;
>  }
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: localed stuck in recent 3.18 git in copy_net_ns?
From: Paul E. McKenney @ 2014-10-23 22:04 UTC (permalink / raw)
  To: Yanko Kaneti
  Cc: Josh Boyer, Eric W. Biederman, Cong Wang, Kevin Fenzi, netdev,
	Linux-Kernel@Vger. Kernel. Org
In-Reply-To: <1414100740.2065.2.camel@declera.com>

On Fri, Oct 24, 2014 at 12:45:40AM +0300, Yanko Kaneti wrote:
> 
> On Thu, 2014-10-23 at 13:05 -0700, Paul E. McKenney wrote:
> > On Thu, Oct 23, 2014 at 10:51:59PM +0300, Yanko Kaneti wrote:
> > > On Thu-10/23/14-2014 08:33, Paul E. McKenney wrote:
> > > > On Thu, Oct 23, 2014 at 05:27:50AM -0700, Paul E. McKenney wrote:
> > > > > On Thu, Oct 23, 2014 at 09:09:26AM +0300, Yanko Kaneti wrote:
> > > > > > On Wed, 2014-10-22 at 16:24 -0700, Paul E. McKenney wrote:
> > > > > > > On Thu, Oct 23, 2014 at 01:40:32AM +0300, Yanko Kaneti 
> > > > > > > wrote:
> > > > > > > > On Wed-10/22/14-2014 15:33, Josh Boyer wrote:
> > > > > > > > > On Wed, Oct 22, 2014 at 2:55 PM, Paul E. McKenney
> > > > > > > > > <paulmck@linux.vnet.ibm.com> wrote:
> > > > > > > 
> > > > > > > [ . . . ]
> > > > > > > 
> > > > > > > > > > Don't get me wrong -- the fact that this kthread 
> > > > > > > > > > appears to
> > > > > > > > > > have
> > > > > > > > > > blocked within rcu_barrier() for 120 seconds means 
> > > > > > > > > > that
> > > > > > > > > > something is
> > > > > > > > > > most definitely wrong here.  I am surprised that 
> > > > > > > > > > there are no
> > > > > > > > > > RCU CPU
> > > > > > > > > > stall warnings, but perhaps the blockage is in the 
> > > > > > > > > > callback
> > > > > > > > > > execution
> > > > > > > > > > rather than grace-period completion.  Or something is
> > > > > > > > > > preventing this
> > > > > > > > > > kthread from starting up after the wake-up callback 
> > > > > > > > > > executes.
> > > > > > > > > > Or...
> > > > > > > > > > 
> > > > > > > > > > Is this thing reproducible?
> > > > > > > > > 
> > > > > > > > > I've added Yanko on CC, who reported the backtrace 
> > > > > > > > > above and can
> > > > > > > > > recreate it reliably.  Apparently reverting the RCU 
> > > > > > > > > merge commit
> > > > > > > > > (d6dd50e) and rebuilding the latest after that does 
> > > > > > > > > not show the
> > > > > > > > > issue.  I'll let Yanko explain more and answer any 
> > > > > > > > > questions you
> > > > > > > > > have.
> > > > > > > > 
> > > > > > > > - It is reproducible
> > > > > > > > - I've done another build here to double check and its 
> > > > > > > > definitely
> > > > > > > > the rcu merge
> > > > > > > >   that's causing it.
> > > > > > > > 
> > > > > > > > Don't think I'll be able to dig deeper, but I can do 
> > > > > > > > testing if
> > > > > > > > needed.
> > > > > > > 
> > > > > > > Please!  Does the following patch help?
> > > > > > 
> > > > > > Nope, doesn't seem to make a difference to the modprobe 
> > > > > > ppp_generic
> > > > > > test
> > > > > 
> > > > > Well, I was hoping.  I will take a closer look at the RCU 
> > > > > merge commit
> > > > > and see what suggests itself.  I am likely to ask you to 
> > > > > revert specific
> > > > > commits, if that works for you.
> > > > 
> > > > Well, rather than reverting commits, could you please try 
> > > > testing the
> > > > following commits?
> > > > 
> > > > 11ed7f934cb8 (rcu: Make nocb leader kthreads process pending 
> > > > callbacks after spawning)
> > > > 
> > > > 73a860cd58a1 (rcu: Replace flush_signals() with 
> > > > WARN_ON(signal_pending()))
> > > > 
> > > > c847f14217d5 (rcu: Avoid misordering in nocb_leader_wait())
> > > > 
> > > >         For whatever it is worth, I am guessing this one.
> > > 
> > > Indeed, c847f14217d5 it is.
> > > 
> > > Much to my embarrasment I just noticed that in addition to the
> > > rcu merge, triggering the bug "requires" my specific Fedora 
> > > rawhide network
> > > setup. Booting in single mode and modprobe ppp_generic is fine. 
> > > The bug
> > > appears when starting with my regular fedora network setup, which 
> > > in my case
> > > includes 3 ethernet adapters and a libvirt birdge+nat setup.
> > > 
> > > Hope that helps.
> > > 
> > > I am attaching the config.
> > 
> > It does help a lot, thank you!!!
> > 
> > The following patch is a bit of a shot in the dark, and assumes that
> > commit 1772947bd012 (rcu: Handle NOCB callbacks from irq-disabled 
> > idle
> > code) introduced the problem.  Does this patch fix things up?
> 
> Unfortunately not, This is linus-tip + patch

OK.  Can't have everything, I guess.

> INFO: task kworker/u16:6:96 blocked for more than 120 seconds.
>       Not tainted 3.18.0-rc1+ #4
> "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> kworker/u16:6   D ffff8800ca84cec0 11168    96      2 0x00000000
> Workqueue: netns cleanup_net
>  ffff8802218339e8 0000000000000096 ffff8800ca84cec0 00000000001d5f00
>  ffff880221833fd8 00000000001d5f00 ffff880223264ec0 ffff8800ca84cec0
>  ffffffff82c52040 7fffffffffffffff ffffffff81ee2658 ffffffff81ee2650
> Call Trace:
>  [<ffffffff8185b8e9>] schedule+0x29/0x70
>  [<ffffffff81860b0c>] schedule_timeout+0x26c/0x410
>  [<ffffffff81028bea>] ? native_sched_clock+0x2a/0xa0
>  [<ffffffff8110759c>] ? mark_held_locks+0x7c/0xb0
>  [<ffffffff81861b90>] ? _raw_spin_unlock_irq+0x30/0x50
>  [<ffffffff8110772d>] ? trace_hardirqs_on_caller+0x15d/0x200
>  [<ffffffff8185d31c>] wait_for_completion+0x10c/0x150
>  [<ffffffff810e4ed0>] ? wake_up_state+0x20/0x20
>  [<ffffffff8112a219>] _rcu_barrier+0x159/0x200
>  [<ffffffff8112a315>] rcu_barrier+0x15/0x20
>  [<ffffffff8171657f>] netdev_run_todo+0x6f/0x310
>  [<ffffffff8170b145>] ? rollback_registered_many+0x265/0x2e0
>  [<ffffffff817235ee>] rtnl_unlock+0xe/0x10
>  [<ffffffff8170cfa6>] default_device_exit_batch+0x156/0x180
>  [<ffffffff810fd390>] ? abort_exclusive_wait+0xb0/0xb0
>  [<ffffffff81705053>] ops_exit_list.isra.1+0x53/0x60
>  [<ffffffff81705c00>] cleanup_net+0x100/0x1f0
>  [<ffffffff810cca98>] process_one_work+0x218/0x850
>  [<ffffffff810cc9ff>] ? process_one_work+0x17f/0x850
>  [<ffffffff810cd1b7>] ? worker_thread+0xe7/0x4a0
>  [<ffffffff810cd13b>] worker_thread+0x6b/0x4a0
>  [<ffffffff810cd0d0>] ? process_one_work+0x850/0x850
>  [<ffffffff810d348b>] kthread+0x10b/0x130
>  [<ffffffff81028c69>] ? sched_clock+0x9/0x10
>  [<ffffffff810d3380>] ? kthread_create_on_node+0x250/0x250
>  [<ffffffff818628bc>] ret_from_fork+0x7c/0xb0
>  [<ffffffff810d3380>] ? kthread_create_on_node+0x250/0x250
> 4 locks held by kworker/u16:6/96:
>  #0:  ("%s""netns"){.+.+.+}, at: [<ffffffff810cc9ff>] process_one_work+0x17f/0x850
>  #1:  (net_cleanup_work){+.+.+.}, at: [<ffffffff810cc9ff>] process_one_work+0x17f/0x850
>  #2:  (net_mutex){+.+.+.}, at: [<ffffffff81705b8c>] cleanup_net+0x8c/0x1f0
>  #3:  (rcu_sched_state.barrier_mutex){+.+...}, at: [<ffffffff8112a0f5>] _rcu_barrier+0x35/0x200
> INFO: task modprobe:1045 blocked for more than 120 seconds.
>       Not tainted 3.18.0-rc1+ #4
> "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> modprobe        D ffff880218343480 12920  1045   1044 0x00000080
>  ffff880218353bf8 0000000000000096 ffff880218343480 00000000001d5f00
>  ffff880218353fd8 00000000001d5f00 ffffffff81e1b580 ffff880218343480
>  ffff880218343480 ffffffff81f8f748 0000000000000246 ffff880218343480
> Call Trace:
>  [<ffffffff8185be91>] schedule_preempt_disabled+0x31/0x80
>  [<ffffffff8185d6e3>] mutex_lock_nested+0x183/0x440
>  [<ffffffff81705a1f>] ? register_pernet_subsys+0x1f/0x50
>  [<ffffffff81705a1f>] ? register_pernet_subsys+0x1f/0x50
>  [<ffffffffa0673000>] ? 0xffffffffa0673000
>  [<ffffffff81705a1f>] register_pernet_subsys+0x1f/0x50
>  [<ffffffffa0673048>] br_init+0x48/0xd3 [bridge]
>  [<ffffffff81002148>] do_one_initcall+0xd8/0x210
>  [<ffffffff81153052>] load_module+0x20c2/0x2870
>  [<ffffffff8114e030>] ? store_uevent+0x70/0x70
>  [<ffffffff81278717>] ? kernel_read+0x57/0x90
>  [<ffffffff811539e6>] SyS_finit_module+0xa6/0xe0
>  [<ffffffff81862969>] system_call_fastpath+0x12/0x17
> 1 lock held by modprobe/1045:
>  #0:  (net_mutex){+.+.+.}, at: [<ffffffff81705a1f>] register_pernet_subsys+0x1f/0x50

Presumably the kworker/u16:6 completed, then modprobe hung?

If not, I have some very hard questions about why net_mutex can be
held by two tasks concurrently, given that it does not appear to be a
reader-writer lock...

Either way, my patch assumed that 39953dfd4007 (rcu: Avoid misordering in
__call_rcu_nocb_enqueue()) would work and that 1772947bd012 (rcu: Handle
NOCB callbacks from irq-disabled idle code) would fail.  Is that the case?
If not, could you please bisect the commits between 11ed7f934cb8 (rcu:
Make nocb leader kthreads process pending callbacks after spawning)
and c847f14217d5 (rcu: Avoid misordering in nocb_leader_wait())?

						Thanx, Paul

^ permalink raw reply

* Re: [PATCH 1/1 net-next] Bluetooth: fix shadow warning in hci_disconnect()
From: Marcel Holtmann @ 2014-10-23 22:09 UTC (permalink / raw)
  To: Fabian Frederick
  Cc: Gustavo F. Padovan, Network Development, linux-kernel,
	David S. Miller, BlueZ development, Johan Hedberg
In-Reply-To: <20326343.74480.1414085453988.open-xchange@webmail.nmp.skynet.be>

Hi Fabian,

>>> use cpr for hci_cp_read_clock_offset instead of cp
>>> (already defined above).
>>> 
>>> Signed-off-by: Fabian Frederick <fabf@skynet.be>
>>> ---
>>> net/bluetooth/hci_conn.c | 6 +++---
>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>> 
>>> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
>>> index b9517bd..6151e09 100644
>>> --- a/net/bluetooth/hci_conn.c
>>> +++ b/net/bluetooth/hci_conn.c
>>> @@ -141,10 +141,10 @@ int hci_disconnect(struct hci_conn *conn, __u8 reason)
>>>       */
>>>      if (conn->type == ACL_LINK && conn->role == HCI_ROLE_MASTER) {
>>>              struct hci_dev *hdev = conn->hdev;
>>> -           struct hci_cp_read_clock_offset cp;
>>> +           struct hci_cp_read_clock_offset cpr;
>>> 
>>> -           cp.handle = cpu_to_le16(conn->handle);
>>> -           hci_send_cmd(hdev, HCI_OP_READ_CLOCK_OFFSET, sizeof(cp), &cp);
>>> +           cpr.handle = cpu_to_le16(conn->handle);
>>> +           hci_send_cmd(hdev, HCI_OP_READ_CLOCK_OFFSET, sizeof(cpr), &cpr);
>> 
>> valid change, but I do not like cpr as variable name. We need to come up with
>> a better one. There are other places in the code where we had the same thing.
>> Please have a look there.
> 
>   Maybe read_cp (like commit c1f23a2bfc89 with struct hci_cp_auth_requested
> auth_cp) ?

lets use clkoff_cp unless someone comes up with a better name.

Regards

Marcel

^ permalink raw reply

* [bug] sunhme unable to receive IPv4 unicasts
From: Birger Harzenetter @ 2014-10-23 22:04 UTC (permalink / raw)
  To: netdev

 from https://bugzilla.kernel.org/show_bug.cgi?id=86731

Any kind of transmission is fine.
Reception of IPv4 broadcast works
Reception of non-IP works (pppoe tested)
But IPv4 unicasts don't show up at all.
IPv6 not tested

Additional tests:
I tried to set promiscous mode, but still no trace of unicasts seen with  
tcpdump.

Last known working version: 3.15.10

   Greetings,
     WIMPy

^ permalink raw reply

* Re: [PATCH v2 net] tcp: md5: do not use alloc_percpu()
From: Eric Dumazet @ 2014-10-23 22:57 UTC (permalink / raw)
  To: David Ahern; +Cc: David Miller, Crestez Dan Leonard, netdev, Jonathan Toppins
In-Reply-To: <5449689B.9040806@gmail.com>

On Thu, 2014-10-23 at 14:44 -0600, David Ahern wrote:

> global variables do not need to be initialized to 0.
> 

Compilers are generating the same code nowadays.
They place such zero variables in bss anyway.
They finally got this right, maybe years ago.


$ nm -v net/ipv4/tcp.o | grep populated
0000000000000078 b tcp_md5sig_pool_populated

^ permalink raw reply

* Re: [PATCH v2 net] tcp: md5: do not use alloc_percpu()
From: David Ahern @ 2014-10-23 23:36 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Crestez Dan Leonard, netdev, Jonathan Toppins
In-Reply-To: <1414105068.20845.38.camel@edumazet-glaptop2.roam.corp.google.com>

On 10/23/14, 4:57 PM, Eric Dumazet wrote:
> On Thu, 2014-10-23 at 14:44 -0600, David Ahern wrote:
>
>> global variables do not need to be initialized to 0.
>>
>
> Compilers are generating the same code nowadays.
> They place such zero variables in bss anyway.
> They finally got this right, maybe years ago.
>
>
> $ nm -v net/ipv4/tcp.o | grep populated
> 0000000000000078 b tcp_md5sig_pool_populated

Right. I was referring to coding standards. As I recall checkpatch 
throws a warning about it.

David

^ permalink raw reply

* [PATCH net] bpf: split eBPF out of NET
From: Alexei Starovoitov @ 2014-10-24  1:41 UTC (permalink / raw)
  To: David S. Miller
  Cc: Geert Uytterhoeven, Josh Triplett, Ingo Molnar, Steven Rostedt,
	Hannes Frederic Sowa, Eric Dumazet, Daniel Borkmann, netdev,
	linux-kernel

introduce two configs:
- hidden CONFIG_BPF to select eBPF interpreter that classic socket filters
  depend on
- visible CONFIG_BPF_SYSCALL (default off) that tracing and sockets can use

that solves several problems:
- tracing and others that wish to use eBPF don't need to depend on NET.
  They can use BPF_SYSCALL to allow loading from userspace or select BPF
  to use it directly from kernel in NET-less configs.
- in 3.18 programs cannot be attached to events yet, so don't force it on
- when the rest of eBPF infra is there in 3.19+, it's still useful to
  switch it off to minimize kernel size

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
---

bloat-o-meter on x64 shows:
add/remove: 0/60 grow/shrink: 0/2 up/down: 0/-15601 (-15601)

tested with many different config combinations. Hopefully didn't miss anything.

 init/Kconfig        |   14 ++++++++++++++
 kernel/Makefile     |    2 +-
 kernel/bpf/Makefile |    6 +++---
 kernel/bpf/core.c   |    9 +++++++++
 net/Kconfig         |    2 +-
 5 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index 3ee28ae..340fd92 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1341,6 +1341,10 @@ config SYSCTL_ARCH_UNALIGN_ALLOW
 config HAVE_PCSPKR_PLATFORM
 	bool
 
+# interpreter that classic socket filters depend on
+config BPF
+	boolean
+
 menuconfig EXPERT
 	bool "Configure standard kernel features (expert users)"
 	# Unhide debug options, to make the on-by-default options visible
@@ -1521,6 +1525,16 @@ config EVENTFD
 
 	  If unsure, say Y.
 
+# syscall, maps, verifier
+config BPF_SYSCALL
+	bool "Enable bpf() system call" if EXPERT
+	select ANON_INODES
+	select BPF
+	default n
+	help
+	  Enable the bpf() system call that allows to manipulate eBPF
+	  programs and maps via file descriptors.
+
 config SHMEM
 	bool "Use full shmem filesystem" if EXPERT
 	default y
diff --git a/kernel/Makefile b/kernel/Makefile
index dc5c775..17ea6d4 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -86,7 +86,7 @@ obj-$(CONFIG_RING_BUFFER) += trace/
 obj-$(CONFIG_TRACEPOINTS) += trace/
 obj-$(CONFIG_IRQ_WORK) += irq_work.o
 obj-$(CONFIG_CPU_PM) += cpu_pm.o
-obj-$(CONFIG_NET) += bpf/
+obj-$(CONFIG_BPF) += bpf/
 
 obj-$(CONFIG_PERF_EVENTS) += events/
 
diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
index 4542723..0daf7f6 100644
--- a/kernel/bpf/Makefile
+++ b/kernel/bpf/Makefile
@@ -1,5 +1,5 @@
-obj-y := core.o syscall.o verifier.o
-
+obj-y := core.o
+obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o
 ifdef CONFIG_TEST_BPF
-obj-y += test_stub.o
+obj-$(CONFIG_BPF_SYSCALL) += test_stub.o
 endif
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index f0c30c5..d6594e4 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -655,3 +655,12 @@ void bpf_prog_free(struct bpf_prog *fp)
 	schedule_work(&aux->work);
 }
 EXPORT_SYMBOL_GPL(bpf_prog_free);
+
+/* To execute LD_ABS/LD_IND instructions __bpf_prog_run() may call
+ * skb_copy_bits(), so provide a weak definition of it for NET-less config.
+ */
+int __weak skb_copy_bits(const struct sk_buff *skb, int offset, void *to,
+			 int len)
+{
+	return -EFAULT;
+}
diff --git a/net/Kconfig b/net/Kconfig
index 6272420..99815b5 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -6,7 +6,7 @@ menuconfig NET
 	bool "Networking support"
 	select NLATTR
 	select GENERIC_NET_UTILS
-	select ANON_INODES
+	select BPF
 	---help---
 	  Unless you really know what you are doing, you should say Y here.
 	  The reason is that some programs need kernel networking support even
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH V3.18] rtlwifi: Add check for get_btc_status callback
From: Mike Galbraith @ 2014-10-24  2:09 UTC (permalink / raw)
  To: Larry Finger
  Cc: linville, linux-wireless, troy_tan, netdev,
	Murilo Opsfelder Araujo, Thadeu Cascardo
In-Reply-To: <5449478B.4070908@lwfinger.net>

On Thu, 2014-10-23 at 13:23 -0500, Larry Finger wrote:

> I know "rtl8192se:rtl92se_get_desc(): ERR rxdesc :4 not process" messages will 
> be fixed by the attached patch. Please send the logs after this is applied.

Both applied.

[   17.717226] cfg80211: World regulatory domain updated:
[   17.719760] cfg80211:  DFS Master region: unset
[   17.719801] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   17.724656] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   17.727087] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   17.729422] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm), (N/A)
[   17.731592] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   17.733702] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   17.858132] input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/sound/card0/hdaudioC0D0/input13
[   17.861052] input: HDA Intel Mic as /devices/pci0000:00/0000:00:1b.0/sound/card0/input14
[   17.863153] input: HDA Intel Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card0/input15
[   17.865356] input: HDA Intel HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1b.0/sound/card0/input16
[   18.259078] toshiba_acpi: Unknown key 401
[   18.661507] Adding 2096476k swap on /dev/sda2.  Priority:-1 extents:1 across:2096476k FS
[   18.984217] rtl8192se 0000:08:00.0: enabling device (0000 -> 0003)
[   19.025036] rtl8192se: FW Power Save off (module option)
[   19.027195] rtl8192se: Driver for Realtek RTL8192SE/RTL8191SE
[   19.027195] Loading firmware rtlwifi/rtl8192sefw.bin
[   19.095134] ieee80211 phy0: Selected rate control algorithm 'rtl_rc'
[   19.152305] ------------[ cut here ]------------
[   19.154367] WARNING: CPU: 0 PID: 59 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x68/0x80()
[   19.156445] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:1c.5/0000:08:00.0/ieee80211/phy0'
[   19.158562] Modules linked in: arc4 rtl8192se rtl_pci rtlwifi mac80211 snd_hda_codec_hdmi snd_hda_codec_conexant snd_hda_codec_generic uvcvideo btusb videobuf2_core coretemp snd_hda_intel snd_hda_controller snd_hda_codec iTCO_wdt iTCO_vendor_support bluetooth cfg80211 v4l2_common snd_hwdep microcode snd_pcm videodev lpc_ich snd_seq serio_raw snd_timer joydev i2c_i801 videobuf2_vmalloc videobuf2_memops mfd_core snd_seq_device toshiba_acpi sparse_keymap rfkill battery ac snd wmi toshiba_bluetooth toshiba_haps soundcore acpi_cpufreq sg autofs4 i915 drm_kms_helper drm i2c_algo_bit thermal video processor thermal_sys button scsi_dh_rdac scsi_dh_alua scsi_dh_emc scsi_dh_hp_sw scsi_dh netconsole atl1c
[   19.170633] CPU: 0 PID: 59 Comm: kworker/0:3 Not tainted 3.18.0-master #52
[   19.173036] Hardware name: TOSHIBA ��������������������������������/��������������������������������, BIOS V1.70    09/29/2009
[   19.175634] Workqueue: events request_firmware_work_func
[   19.178247]  0000000000000009 ffff8800379d7a98 ffffffff815878e0 0000000000000001
[   19.180947]  ffff8800379d7ae8 ffff8800379d7ad8 ffffffff8104c801 00000000000035e0
[   19.183573]  ffff88003706e000 ffff8800aff86d80 ffff8800b0093d48 ffff88013b027098
[   19.186231] Call Trace:
[   19.188885]  [<ffffffff815878e0>] dump_stack+0x46/0x58
[   19.191545]  [<ffffffff8104c801>] warn_slowpath_common+0x81/0xa0
[   19.194173]  [<ffffffff8104c866>] warn_slowpath_fmt+0x46/0x50
[   19.196707]  [<ffffffff811d06c8>] ? kernfs_path+0x48/0x60
[   19.199138]  [<ffffffff811d3b48>] sysfs_warn_dup+0x68/0x80
[   19.201587]  [<ffffffff811d3bee>] sysfs_create_dir_ns+0x8e/0xa0
[   19.204057]  [<ffffffff81286879>] kobject_add_internal+0xc9/0x400
[   19.206495]  [<ffffffff81286fe0>] kobject_add+0x60/0xb0
[   19.208938]  [<ffffffff8158c226>] ? mutex_lock+0x16/0x37
[   19.211321]  [<ffffffff81380d54>] device_add+0x104/0x600
[   19.213692]  [<ffffffff8114b98e>] ? lazy_max_pages+0x1e/0x30
[   19.216100]  [<ffffffffa02e9d0d>] wiphy_register+0x3fd/0x710 [cfg80211]
[   19.218504]  [<ffffffff8114d352>] ? __vunmap+0xc2/0x110
[   19.220957]  [<ffffffffa0457cfc>] ? ieee80211_register_hw+0x1ec/0x9a0 [mac80211]
[   19.223447]  [<ffffffffa0457e78>] ieee80211_register_hw+0x368/0x9a0 [mac80211]
[   19.225916]  [<ffffffffa050a26b>] rtl92se_fw_cb+0xab/0x1d0 [rtl8192se]
[   19.228362]  [<ffffffff81393d80>] request_firmware_work_func+0x30/0x60
[   19.230779]  [<ffffffff8106270d>] process_one_work+0x14d/0x3d0
[   19.233167]  [<ffffffff81062ab1>] worker_thread+0x121/0x480
[   19.235498]  [<ffffffff81062990>] ? process_one_work+0x3d0/0x3d0
[   19.237861]  [<ffffffff81067319>] kthread+0xc9/0xe0
[   19.240213]  [<ffffffff81067250>] ? kthread_create_on_node+0x180/0x180
[   19.242534]  [<ffffffff8158e26c>] ret_from_fork+0x7c/0xb0
[   19.244830]  [<ffffffff81067250>] ? kthread_create_on_node+0x180/0x180
[   19.247125] ---[ end trace 0734244a9269eff8 ]---
[   19.249416] ------------[ cut here ]------------
[   19.251626] WARNING: CPU: 0 PID: 59 at lib/kobject.c:240 kobject_add_internal+0x294/0x400()
[   19.253876] kobject_add_internal failed for phy0 with -EEXIST, don't try to register things with the same name in the same directory.
[   19.256197] Modules linked in: arc4 rtl8192se rtl_pci rtlwifi mac80211 snd_hda_codec_hdmi snd_hda_codec_conexant snd_hda_codec_generic uvcvideo btusb videobuf2_core coretemp snd_hda_intel snd_hda_controller snd_hda_codec iTCO_wdt iTCO_vendor_support bluetooth cfg80211 v4l2_common snd_hwdep microcode snd_pcm videodev lpc_ich snd_seq serio_raw snd_timer joydev i2c_i801 videobuf2_vmalloc videobuf2_memops mfd_core snd_seq_device toshiba_acpi sparse_keymap rfkill battery ac snd wmi toshiba_bluetooth toshiba_haps soundcore acpi_cpufreq sg autofs4 i915 drm_kms_helper drm i2c_algo_bit thermal video processor thermal_sys button scsi_dh_rdac scsi_dh_alua scsi_dh_emc scsi_dh_hp_sw scsi_dh netconsole atl1c
[   19.269327] CPU: 0 PID: 59 Comm: kworker/0:3 Tainted: G        W      3.18.0-master #52
[   19.271976] Hardware name: TOSHIBA ��������������������������������/��������������������������������, BIOS V1.70    09/29/2009
[   19.274674] Workqueue: events request_firmware_work_func
[   19.277301]  0000000000000009 ffff8800379d7af8 ffffffff815878e0 0000000000000001
[   19.279875]  ffff8800379d7b48 ffff8800379d7b38 ffffffff8104c801 ffff8800379d7b38
[   19.282376]  ffff880137730350 00000000ffffffef ffff880036a9c940 ffff88013b027098
[   19.284844] Call Trace:
[   19.287151]  [<ffffffff815878e0>] dump_stack+0x46/0x58
[   19.289474]  [<ffffffff8104c801>] warn_slowpath_common+0x81/0xa0
[   19.291751]  [<ffffffff8104c866>] warn_slowpath_fmt+0x46/0x50
[   19.293979]  [<ffffffff81286a44>] kobject_add_internal+0x294/0x400
[   19.296192]  [<ffffffff81286fe0>] kobject_add+0x60/0xb0
[   19.298381]  [<ffffffff8158c226>] ? mutex_lock+0x16/0x37
[   19.300578]  [<ffffffff81380d54>] device_add+0x104/0x600
[   19.302734]  [<ffffffff8114b98e>] ? lazy_max_pages+0x1e/0x30
[   19.304909]  [<ffffffffa02e9d0d>] wiphy_register+0x3fd/0x710 [cfg80211]
[   19.307110]  [<ffffffff8114d352>] ? __vunmap+0xc2/0x110
[   19.309305]  [<ffffffffa0457cfc>] ? ieee80211_register_hw+0x1ec/0x9a0 [mac80211]
[   19.311512]  [<ffffffffa0457e78>] ieee80211_register_hw+0x368/0x9a0 [mac80211]
[   19.313767]  [<ffffffffa050a26b>] rtl92se_fw_cb+0xab/0x1d0 [rtl8192se]
[   19.315998]  [<ffffffff81393d80>] request_firmware_work_func+0x30/0x60
[   19.318260]  [<ffffffff8106270d>] process_one_work+0x14d/0x3d0
[   19.320501]  [<ffffffff81062ab1>] worker_thread+0x121/0x480
[   19.322732]  [<ffffffff81062990>] ? process_one_work+0x3d0/0x3d0
[   19.324987]  [<ffffffff81067319>] kthread+0xc9/0xe0
[   19.327246]  [<ffffffff81067250>] ? kthread_create_on_node+0x180/0x180
[   19.329517]  [<ffffffff8158e26c>] ret_from_fork+0x7c/0xb0
[   19.331757]  [<ffffffff81067250>] ? kthread_create_on_node+0x180/0x180
[   19.334039] ---[ end trace 0734244a9269eff9 ]---
[   19.336275] rtl8192se:rtl92se_fw_cb():<0-0> Can't register mac80211 hw
[   20.108822] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: acl
[   24.761182] BUG: unable to handle kernel NULL pointer dereference at           (null)
[   24.762764] IP: [<          (null)>]           (null)
[   24.764106] PGD 0 
[   24.764106] Oops: 0010 [#1] SMP 
[   24.764106] Modules linked in: arc4 rtl8192se rtl_pci rtlwifi mac80211 snd_hda_codec_hdmi snd_hda_codec_conexant snd_hda_codec_generic uvcvideo btusb videobuf2_core coretemp snd_hda_intel snd_hda_controller snd_hda_codec iTCO_wdt iTCO_vendor_support bluetooth cfg80211 v4l2_common snd_hwdep microcode snd_pcm videodev lpc_ich snd_seq serio_raw snd_timer joydev i2c_i801 videobuf2_vmalloc videobuf2_memops mfd_core snd_seq_device toshiba_acpi sparse_keymap rfkill battery ac snd wmi toshiba_bluetooth toshiba_haps soundcore acpi_cpufreq sg autofs4 i915 drm_kms_helper drm i2c_algo_bit thermal video processor thermal_sys button scsi_dh_rdac scsi_dh_alua scsi_dh_emc scsi_dh_hp_sw scsi_dh netconsole atl1c
[   24.764106] CPU: 1 PID: 54 Comm: kworker/1:2 Tainted: G        W      3.18.0-master #52
[   24.764106] Hardware name: TOSHIBA ��������������������������������/��������������������������������, BIOS V1.70    09/29/2009
[   24.764106] Workqueue: rtl92s_pci rtl_watchdog_wq_callback [rtlwifi]
[   24.764106] task: ffff88013614c350 ti: ffff880136150000 task.ti: ffff880136150000
[   24.764106] RIP: 0010:[<0000000000000000>]  [<          (null)>]           (null)
[   24.764106] RSP: 0018:ffff880136153d80  EFLAGS: 00010293
[   24.764106] RAX: ffffffffa05103c0 RBX: ffff8801377319c0 RCX: 0000000000000000
[   24.764106] RDX: 0000000000000001 RSI: 000000000000005d RDI: ffff880137730620
[   24.764106] RBP: ffff880136153df8 R08: ffff88013fd12380 R09: 0000000000000001
[   24.764106] R10: 0000000000000002 R11: 0000000000000293 R12: ffff880137730620
[   24.764106] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[   24.764106] FS:  0000000000000000(0000) GS:ffff88013fd00000(0000) knlGS:0000000000000000
[   24.764106] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[   24.764106] CR2: 0000000000000000 CR3: 000000013b249000 CR4: 00000000000407e0
[   24.764106] Stack:
[   24.764106]  ffffffffa051e51e ffff88013fd12b00 0000000000000000 ffff88013fd12b00
[   24.764106]  0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   24.764106]  0000000000000000 ffff880136153e38 ffff880137731be0 ffff880136126b80
[   24.764106] Call Trace:
[   24.764106]  [<ffffffffa051e51e>] ? rtl_watchdog_wq_callback+0xfe/0x420 [rtlwifi]
[   24.764106]  [<ffffffff8106270d>] process_one_work+0x14d/0x3d0
[   24.764106]  [<ffffffff81062ab1>] worker_thread+0x121/0x480
[   24.764106]  [<ffffffff81062990>] ? process_one_work+0x3d0/0x3d0
[   24.764106]  [<ffffffff81067319>] kthread+0xc9/0xe0
[   24.764106]  [<ffffffff81067250>] ? kthread_create_on_node+0x180/0x180
[   24.764106]  [<ffffffff8158e26c>] ret_from_fork+0x7c/0xb0
[   24.764106]  [<ffffffff81067250>] ? kthread_create_on_node+0x180/0x180
[   24.764106] Code:  Bad RIP value.
[   24.764106] RIP  [<          (null)>]           (null)
[   24.764106]  RSP <ffff880136153d80>
[   24.764106] CR2: 0000000000000000
[   24.764106] ---[ end trace 0734244a9269effa ]---
[   24.855146] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   24.857620] BUG: unable to handle kernel paging request at ffffffffffffffd8
[   24.859873] IP: [<ffffffff810678f1>] kthread_data+0x11/0x20
[   24.861381] PGD 1a16067 PUD 1a18067 PMD 0 
[   24.861381] Oops: 0000 [#2] SMP 
[   24.861381] Modules linked in: arc4 rtl8192se rtl_pci rtlwifi mac80211 snd_hda_codec_hdmi snd_hda_codec_conexant snd_hda_codec_generic uvcvideo btusb videobuf2_core coretemp snd_hda_intel snd_hda_controller snd_hda_codec iTCO_wdt iTCO_vendor_support bluetooth cfg80211 v4l2_common snd_hwdep microcode snd_pcm videodev lpc_ich snd_seq serio_raw snd_timer joydev i2c_i801 videobuf2_vmalloc videobuf2_memops mfd_core snd_seq_device toshiba_acpi sparse_keymap rfkill battery ac snd wmi toshiba_bluetooth toshiba_haps soundcore acpi_cpufreq sg autofs4 i915 drm_kms_helper drm i2c_algo_bit thermal video processor thermal_sys button scsi_dh_rdac scsi_dh_alua scsi_dh_emc scsi_dh_hp_sw scsi_dh netconsole atl1c
[   24.861381] CPU: 1 PID: 54 Comm: kworker/1:2 Tainted: G      D W      3.18.0-master #52
[   24.861381] Hardware name: TOSHIBA ��������������������������������/��������������������������������, BIOS V1.70    09/29/2009
[   24.861381] task: ffff88013614c350 ti: ffff880136150000 task.ti: ffff880136150000
[   24.861381] RIP: 0010:[<ffffffff810678f1>]  [<ffffffff810678f1>] kthread_data+0x11/0x20
[   24.861381] RSP: 0018:ffff880136153990  EFLAGS: 00010092
[   24.861381] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000171a414dc
[   24.861381] RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff88013614c350
[   24.861381] RBP: ffff8801361539a8 R08: ffff88013614fcd0 R09: 00000000000003d9
[   24.861381] R10: 000000000000bc00 R11: 0000000000008ddc R12: ffff88013fd12b00
[   24.861381] R13: 0000000000000001 R14: 0000000000000000 R15: ffff88013614c350
[   24.861381] FS:  0000000000000000(0000) GS:ffff88013fd00000(0000) knlGS:0000000000000000
[   24.861381] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[   24.861381] CR2: 0000000000000028 CR3: 0000000035eba000 CR4: 00000000000407e0
[   24.861381] Stack:
[   24.861381]  ffffffff81063145 ffff8801361539a8 ffff88013614c350 ffff880136153a18
[   24.861381]  ffffffff8158a1ae ffff88013614c350 0000000000012b00 ffff880136153fd8
[   24.861381]  0000000000012b00 ffff880136153a08 ffff88013614c350 ffff88013614c350
[   24.861381] Call Trace:
[   24.861381]  [<ffffffff81063145>] ? wq_worker_sleeping+0x15/0xa0
[   24.861381]  [<ffffffff8158a1ae>] __schedule+0x53e/0x810
[   24.861381]  [<ffffffff8158a4a9>] schedule+0x29/0x70
[   24.861381]  [<ffffffff8104dfa2>] do_exit+0x6a2/0x9e0
[   24.861381]  [<ffffffff8100645e>] oops_end+0x8e/0xd0
[   24.861381]  [<ffffffff815829aa>] no_context+0x248/0x298
[   24.861381]  [<ffffffff81582a67>] __bad_area_nosemaphore+0x6d/0x1c6
[   24.861381]  [<ffffffff81582bd3>] bad_area_nosemaphore+0x13/0x15
[   24.861381]  [<ffffffff8103d67c>] __do_page_fault+0x9c/0x530
[   24.861381]  [<ffffffff812843c0>] ? cpumask_next_and+0x30/0x50
[   24.861381]  [<ffffffff8107a24e>] ? load_balance+0x23e/0x830
[   24.861381]  [<ffffffff8103db1c>] do_page_fault+0xc/0x10
[   24.861381]  [<ffffffff8158fe22>] page_fault+0x22/0x30
[   24.861381]  [<ffffffffa051e51e>] ? rtl_watchdog_wq_callback+0xfe/0x420 [rtlwifi]
[   24.861381]  [<ffffffff8106270d>] process_one_work+0x14d/0x3d0
[   24.861381]  [<ffffffff81062ab1>] worker_thread+0x121/0x480
[   24.861381]  [<ffffffff81062990>] ? process_one_work+0x3d0/0x3d0
[   24.861381]  [<ffffffff81067319>] kthread+0xc9/0xe0
[   24.861381]  [<ffffffff81067250>] ? kthread_create_on_node+0x180/0x180
[   24.861381]  [<ffffffff8158e26c>] ret_from_fork+0x7c/0xb0
[   24.861381]  [<ffffffff81067250>] ? kthread_create_on_node+0x180/0x180
[   24.861381] Code: 48 89 e5 5d 48 8b 40 c8 48 c1 e8 02 83 e0 01 c3 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 48 8b 87 60 04 00 00 55 48 89 e5 5d <48> 8b 40 d8 c3 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 55 
[   24.861381] RIP  [<ffffffff810678f1>] kthread_data+0x11/0x20
[   24.861381]  RSP <ffff880136153990>
[   24.861381] CR2: ffffffffffffffd8
[   24.861381] ---[ end trace 0734244a9269effb ]---
[   24.861381] Fixing recursive fault but reboot is needed!
[   24.861381] Kernel panic - not syncing: Watchdog detected hard LOCKUP on cpu 1
[   24.861381] Shutting down cpus with NMI
[   24.861381] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff)
[   24.861381] drm_kms_helper: panic occurred, switching back to text console
[   24.861381] Rebooting in 60 seconds..

^ permalink raw reply

* [PATCH net-next v3 0/5] cleanup on resource check
From: Varka Bhadram @ 2014-10-24  2:12 UTC (permalink / raw)
  To: netdev; +Cc: davem, sergei.shtylyov, Varka Bhadram

This series removes the duplication of sanity check for
platform_get_resource() return resource. It will be checked 
with devm_ioremap_resource()

changes since v2:
	- Merge #1 and #2 patches into single patch
	- remove the comment

changes since v1:
	- remove NULL dereference on resource_size()

Varka Bhadram (5):
  ethernet: wiznet: remove unnecessary check
  ethernet: apm: xgene: remove unnecessary check
  ethernet: marvell: remove unnecessary check
  ethernet: renesas: remove unnecessary check
  ethernet: samsung: sxgbe: remove unnecessary check

 drivers/net/ethernet/apm/xgene/xgene_enet_main.c   |   12 ------------
 drivers/net/ethernet/marvell/pxa168_eth.c          |    6 ++----
 drivers/net/ethernet/renesas/sh_eth.c              |    8 ++------
 .../net/ethernet/samsung/sxgbe/sxgbe_platform.c    |    3 ---
 drivers/net/ethernet/wiznet/w5100.c                |    6 ++----
 drivers/net/ethernet/wiznet/w5300.c                |    6 ++----
 6 files changed, 8 insertions(+), 33 deletions(-)

-- 
1.7.9.5

^ 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