Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 00/16] Remove the ipv4 routing cache
From: David Miller @ 2012-07-26  8:18 UTC (permalink / raw)
  To: eric.dumazet; +Cc: alexander.duyck, netdev
In-Reply-To: <1343290414.2626.11181.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 26 Jul 2012 10:13:34 +0200

> On Wed, 2012-07-25 at 17:54 -0700, David Miller wrote:
>> @@ -1216,9 +1215,15 @@ static void rt_cache_route(struct fib_nh *nh, struct rtable *rt)
>>  
>>  	prev = cmpxchg(p, orig, rt);
>>  	if (prev == orig) {
>> -		dst_clone(&rt->dst);
>>  		if (orig)
>> -			call_rcu_bh(&orig->dst.rcu_head, rt_release_rcu);
>> +			rt_free(orig);
>> +	} else {
>> +		/* Routes we intend to cache in the FIB nexthop have
>> +		 * the DST_NOCACHE bit set.  However, if we are
>> +		 * unsuccessful at storing this route into the cache
>> +		 * we really need to clear that bit.
>> +		 */
>> +		rt->dst.flags &= ~DST_NOCACHE;
>>  	}
>>  }
>>  
> 
> Not sure why you removed the dst_clone(&rt->dst) ?

Because "cached" dst objects have no reference count.  When such a
cached dst is "released", it is dst_free()'d instead of
dst_release()'d.

> If it is not needed, we might need to release a reference in the else {}
> clause, no ?

Nope.  'rt' has a reference count of one, which is for the caller, not
for this cached location.

^ permalink raw reply

* Re: [net-next RFC V5 2/5] virtio_ring: move queue_index to vring_virtqueue
From: Paolo Bonzini @ 2012-07-26  8:20 UTC (permalink / raw)
  To: Sasha Levin
  Cc: krkumar2, habanero, kvm, mst, netdev, mashirle, linux-kernel,
	virtualization, edumazet, tahm, jwhan, davem, sri
In-Reply-To: <1341488454.18786.15.camel@lappy>

Il 05/07/2012 13:40, Sasha Levin ha scritto:
> @@ -275,7 +274,7 @@ static void vm_del_vq(struct virtqueue *vq)
>         vring_del_virtqueue(vq);
>  
>         /* Select and deactivate the queue */
> -       writel(info->queue_index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL);
> +       writel(virtqueue_get_queue_index(vq), vm_dev->base + VIRTIO_MMIO_QUEUE_SEL);
>         writel(0, vm_dev->base + VIRTIO_MMIO_QUEUE_PFN);
>  

This accesses vq after vring_del_virtqueue has freed it.

Paolo

^ permalink raw reply

* Re: [PATCH 00/16] Remove the ipv4 routing cache
From: Eric Dumazet @ 2012-07-26  8:27 UTC (permalink / raw)
  To: David Miller; +Cc: alexander.duyck, netdev
In-Reply-To: <20120726.011853.973075299731735416.davem@davemloft.net>

On Thu, 2012-07-26 at 01:18 -0700, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Thu, 26 Jul 2012 10:13:34 +0200
> 
> > On Wed, 2012-07-25 at 17:54 -0700, David Miller wrote:
> >> @@ -1216,9 +1215,15 @@ static void rt_cache_route(struct fib_nh *nh, struct rtable *rt)
> >>  
> >>  	prev = cmpxchg(p, orig, rt);
> >>  	if (prev == orig) {
> >> -		dst_clone(&rt->dst);
> >>  		if (orig)
> >> -			call_rcu_bh(&orig->dst.rcu_head, rt_release_rcu);
> >> +			rt_free(orig);
> >> +	} else {
> >> +		/* Routes we intend to cache in the FIB nexthop have
> >> +		 * the DST_NOCACHE bit set.  However, if we are
> >> +		 * unsuccessful at storing this route into the cache
> >> +		 * we really need to clear that bit.
> >> +		 */
> >> +		rt->dst.flags &= ~DST_NOCACHE;
> >>  	}
> >>  }
> >>  
> > 
> > Not sure why you removed the dst_clone(&rt->dst) ?
> 
> Because "cached" dst objects have no reference count.  When such a
> cached dst is "released", it is dst_free()'d instead of
> dst_release()'d.
> 
> > If it is not needed, we might need to release a reference in the else {}
> > clause, no ?
> 
> Nope.  'rt' has a reference count of one, which is for the caller, not
> for this cached location.

But isnt DST_NOCACHE intent reverted then ?

like you meant :

+       } else {
+               /* Routes we intend to cache in the FIB nexthop have
+                * the DST_NOCACHE bit unset.  However, if we are
+                * unsuccessful at storing this route into the cache
+                * we really need to set that bit.
+                */
+               rt->dst.flags |= DST_NOCACHE;
        }

^ permalink raw reply

* Re: [PATCH 00/16] Remove the ipv4 routing cache
From: David Miller @ 2012-07-26  8:47 UTC (permalink / raw)
  To: eric.dumazet; +Cc: alexander.duyck, netdev
In-Reply-To: <1343291278.2626.11188.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 26 Jul 2012 10:27:58 +0200

> But isnt DST_NOCACHE intent reverted then ?
> 
> like you meant :
> 
> +       } else {
> +               /* Routes we intend to cache in the FIB nexthop have
> +                * the DST_NOCACHE bit unset.  However, if we are
> +                * unsuccessful at storing this route into the cache
> +                * we really need to set that bit.
> +                */
> +               rt->dst.flags |= DST_NOCACHE;
>         }

Indeed, thanks for catching this bug.

Here's a new version of the patch, as I found another error.  In
fib_semantics.c, we have to change dst_release() to dst_free() for the
liberation the nexthop cached routes.

diff --git a/include/net/route.h b/include/net/route.h
index c29ef27..8c52bc6 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -30,6 +30,7 @@
 #include <net/inet_sock.h>
 #include <linux/in_route.h>
 #include <linux/rtnetlink.h>
+#include <linux/rcupdate.h>
 #include <linux/route.h>
 #include <linux/ip.h>
 #include <linux/cache.h>
@@ -157,8 +158,22 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4
 	return ip_route_output_key(net, fl4);
 }
 
-extern int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
-			  u8 tos, struct net_device *devin);
+extern int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
+				u8 tos, struct net_device *devin);
+
+static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
+				 u8 tos, struct net_device *devin)
+{
+	int err;
+
+	rcu_read_lock();
+	err = ip_route_input_noref(skb, dst, src, tos, devin);
+	if (!err)
+		skb_dst_force(skb);
+	rcu_read_unlock();
+
+	return err;
+}
 
 extern void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
 			     int oif, u32 mark, u8 protocol, int flow_flags);
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index a0124eb..77e87af 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -827,7 +827,7 @@ static int arp_process(struct sk_buff *skb)
 	}
 
 	if (arp->ar_op == htons(ARPOP_REQUEST) &&
-	    ip_route_input(skb, tip, sip, 0, dev) == 0) {
+	    ip_route_input_noref(skb, tip, sip, 0, dev) == 0) {
 
 		rt = skb_rtable(skb);
 		addr_type = rt->rt_type;
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index e55171f..da0cc2e 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -172,9 +172,9 @@ static void free_fib_info_rcu(struct rcu_head *head)
 		if (nexthop_nh->nh_exceptions)
 			free_nh_exceptions(nexthop_nh);
 		if (nexthop_nh->nh_rth_output)
-			dst_release(&nexthop_nh->nh_rth_output->dst);
+			dst_free(&nexthop_nh->nh_rth_output->dst);
 		if (nexthop_nh->nh_rth_input)
-			dst_release(&nexthop_nh->nh_rth_input->dst);
+			dst_free(&nexthop_nh->nh_rth_input->dst);
 	} endfor_nexthops(fi);
 
 	release_net(fi->fib_net);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 7ad88e5..8d07c97 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -258,8 +258,8 @@ static void ip_expire(unsigned long arg)
 		/* skb dst is stale, drop it, and perform route lookup again */
 		skb_dst_drop(head);
 		iph = ip_hdr(head);
-		err = ip_route_input(head, iph->daddr, iph->saddr,
-				     iph->tos, head->dev);
+		err = ip_route_input_noref(head, iph->daddr, iph->saddr,
+					   iph->tos, head->dev);
 		if (err)
 			goto out_rcu_unlock;
 
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 93134b0..bda8cac 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -339,8 +339,8 @@ static int ip_rcv_finish(struct sk_buff *skb)
 	 *	how the packet travels inside Linux networking.
 	 */
 	if (!skb_dst(skb)) {
-		int err = ip_route_input(skb, iph->daddr, iph->saddr,
-					 iph->tos, skb->dev);
+		int err = ip_route_input_noref(skb, iph->daddr, iph->saddr,
+					       iph->tos, skb->dev);
 		if (unlikely(err)) {
 			if (err == -EXDEV)
 				NET_INC_STATS_BH(dev_net(skb->dev),
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 3f7bb71..7a591aa 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1199,10 +1199,9 @@ restart:
 	fnhe->fnhe_stamp = jiffies;
 }
 
-static inline void rt_release_rcu(struct rcu_head *head)
+static inline void rt_free(struct rtable *rt)
 {
-	struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head);
-	dst_release(dst);
+	call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free);
 }
 
 static void rt_cache_route(struct fib_nh *nh, struct rtable *rt)
@@ -1216,9 +1215,15 @@ static void rt_cache_route(struct fib_nh *nh, struct rtable *rt)
 
 	prev = cmpxchg(p, orig, rt);
 	if (prev == orig) {
-		dst_clone(&rt->dst);
 		if (orig)
-			call_rcu_bh(&orig->dst.rcu_head, rt_release_rcu);
+			rt_free(orig);
+	} else {
+		/* Routes we intend to cache in the FIB nexthop have
+		 * the DST_NOCACHE bit clear.  However, if we are
+		 * unsuccessful at storing this route into the cache
+		 * we really need to set it.
+		 */
+		rt->dst.flags |= DST_NOCACHE;
 	}
 }
 
@@ -1245,7 +1250,7 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
 #ifdef CONFIG_IP_ROUTE_CLASSID
 		rt->dst.tclassid = nh->nh_tclassid;
 #endif
-		if (!(rt->dst.flags & DST_HOST))
+		if (!(rt->dst.flags & DST_NOCACHE))
 			rt_cache_route(nh, rt);
 	}
 
@@ -1261,7 +1266,7 @@ static struct rtable *rt_dst_alloc(struct net_device *dev,
 				   bool nopolicy, bool noxfrm, bool will_cache)
 {
 	return dst_alloc(&ipv4_dst_ops, dev, 1, DST_OBSOLETE_FORCE_CHK,
-			 (will_cache ? 0 : DST_HOST) | DST_NOCACHE |
+			 (will_cache ? 0 : (DST_HOST | DST_NOCACHE)) |
 			 (nopolicy ? DST_NOPOLICY : 0) |
 			 (noxfrm ? DST_NOXFRM : 0));
 }
@@ -1588,8 +1593,9 @@ local_input:
 		if (!itag) {
 			rth = FIB_RES_NH(res).nh_rth_input;
 			if (rt_cache_valid(rth)) {
-				dst_hold(&rth->dst);
-				goto set_and_out;
+				skb_dst_set_noref(skb, &rth->dst);
+				err = 0;
+				goto out;
 			}
 			do_cache = true;
 		}
@@ -1620,7 +1626,6 @@ local_input:
 	}
 	if (do_cache)
 		rt_cache_route(&FIB_RES_NH(res), rth);
-set_and_out:
 	skb_dst_set(skb, &rth->dst);
 	err = 0;
 	goto out;
@@ -1658,8 +1663,8 @@ martian_source_keep_err:
 	goto out;
 }
 
-int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
-		   u8 tos, struct net_device *dev)
+int ip_route_input_noref(struct sk_buff *skb, __be32 daddr, __be32 saddr,
+			 u8 tos, struct net_device *dev)
 {
 	int res;
 
@@ -1702,7 +1707,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 	rcu_read_unlock();
 	return res;
 }
-EXPORT_SYMBOL(ip_route_input);
+EXPORT_SYMBOL(ip_route_input_noref);
 
 /* called with rcu_read_lock() */
 static struct rtable *__mkroute_output(const struct fib_result *res,
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index 58d23a5..06814b6 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -27,8 +27,8 @@ static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb)
 	if (skb_dst(skb) == NULL) {
 		const struct iphdr *iph = ip_hdr(skb);
 
-		if (ip_route_input(skb, iph->daddr, iph->saddr,
-				   iph->tos, skb->dev))
+		if (ip_route_input_noref(skb, iph->daddr, iph->saddr,
+					 iph->tos, skb->dev))
 			goto drop;
 	}
 	return dst_input(skb);

^ permalink raw reply related

* [PATCH] iproute: Add route showdump command
From: Pavel Emelyanov @ 2012-07-26  8:53 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Dan Smith, Linux Netdev List

Some time ago the save+restore commands were added to ip route (git
id f4ff11e3, Add ip route save/restore). These two save the raw rtnl
stream into a file and restore one (reading it from stdin).

The problem is that there's no way to get the contents of the dump
file in a human readable form. How about adding a command that reads
the rtnl stream from stdin and prints the data in a way the usual
"ip route list" does?

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

---

diff --git a/ip/iproute.c b/ip/iproute.c
index 5cd313e..585a7d8 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -60,6 +60,7 @@ static void usage(void)
 	fprintf(stderr, "Usage: ip route { list | flush } SELECTOR\n");
 	fprintf(stderr, "       ip route save SELECTOR\n");
 	fprintf(stderr, "       ip route restore\n");
+	fprintf(stderr, "       ip route showdump\n");
 	fprintf(stderr, "       ip route get ADDRESS [ from ADDRESS iif STRING ]\n");
 	fprintf(stderr, "                            [ oif STRING ]  [ tos TOS ]\n");
 	fprintf(stderr, "                            [ mark NUMBER ]\n");
@@ -1526,6 +1527,17 @@ int iproute_restore(void)
 	exit(rtnl_from_file(stdin, &restore_handler, NULL));
 }
 
+static int show_handler(const struct sockaddr_nl *nl, struct nlmsghdr *n, void *arg)
+{
+	print_route(nl, n, stdout);
+	return 0;
+}
+
+static int iproute_showdump(void)
+{
+	exit(rtnl_from_file(stdin, &show_handler, NULL));
+}
+
 void iproute_reset_filter()
 {
 	memset(&filter, 0, sizeof(filter));
@@ -1570,6 +1582,8 @@ int do_iproute(int argc, char **argv)
 		return iproute_list_flush_or_save(argc-1, argv+1, IPROUTE_SAVE);
 	if (matches(*argv, "restore") == 0)
 		return iproute_restore();
+	if (matches(*argv, "showdump") == 0)
+		return iproute_showdump();
 	if (matches(*argv, "help") == 0)
 		usage();
 	fprintf(stderr, "Command \"%s\" is unknown, try \"ip route help\".\n", *argv);

^ permalink raw reply related

* Re: [PATCH 00/16] Remove the ipv4 routing cache
From: Eric Dumazet @ 2012-07-26  9:12 UTC (permalink / raw)
  To: David Miller; +Cc: alexander.duyck, netdev
In-Reply-To: <20120726.014736.1066206957795563053.davem@davemloft.net>

On Thu, 2012-07-26 at 01:47 -0700, David Miller wrote:

> Indeed, thanks for catching this bug.
> 
> Here's a new version of the patch, as I found another error.  In
> fib_semantics.c, we have to change dst_release() to dst_free() for the
> liberation the nexthop cached routes.

Excellent, I did tests here and this seems ok to me

Tested-by: Eric Dumazet <edumazet@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply

* [PATCH] bcma: fix regression in pmu workaround reg masks
From: Hauke Mehrtens @ 2012-07-26  9:15 UTC (permalink / raw)
  To: torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
  Cc: linville-2XuSBdqkA4R54TAoqtyWWQ, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	brcm80211-dev-list-dY08KVG/lbpWk0Htik3J/w,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	seth.forshee-Z7WLFzj8eWMS+FvcfC7Uqw,
	pieterpg-dY08KVG/lbpWk0Htik3J/w, brudley-dY08KVG/lbpWk0Htik3J/w,
	Hauke Mehrtens, Arend van Spriel, Rafał Miłecki

This fixes a regression introduced in:
commit b9562545ef0b13c0440ccd8d6dd4111fb77cb17a
Author: Hauke Mehrtens <hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
Date:   Sat Jun 30 01:44:41 2012 +0200

    bcma: complete workaround for BCMA43224 and BCM4313

The regression broke reading of the sprom from the chip and seamed to
cause a change of the pci id on a BCMA43224 device so that it is
rejected by brcmsmac. If this problem occurred, after applying this
patch, a cold boot is needed to make the device work again.

In the original patch the workaround set the intended bits in the chip
common core chip control registers, but the patch also unset all the
other bits in that register, because of a wrong mask. The original
patch was based on code from brcmsmac and there was an additional
inversing of the mask in the code setting these regs which was missing
here. Now the regs are set like brcmsmac did it before.

Signed-off-by: Hauke Mehrtens <hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
Reported-by: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Tested-by: Seth Forshee <seth.forshee-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Cc: Arend van Spriel <arend-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Cc: Rafał Miłecki <zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/bcma/driver_chipcommon_pmu.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c
index 4432617..c9a4f46 100644
--- a/drivers/bcma/driver_chipcommon_pmu.c
+++ b/drivers/bcma/driver_chipcommon_pmu.c
@@ -110,7 +110,7 @@ void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
 		/* enable 12 mA drive strenth for 4313 and set chipControl
 		   register bit 1 */
 		bcma_chipco_chipctl_maskset(cc, 0,
-					    BCMA_CCTRL_4313_12MA_LED_DRIVE,
+					    ~BCMA_CCTRL_4313_12MA_LED_DRIVE,
 					    BCMA_CCTRL_4313_12MA_LED_DRIVE);
 		break;
 	case BCMA_CHIP_ID_BCM4331:
@@ -124,14 +124,14 @@ void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
 		   register bit 15 */
 		if (bus->chipinfo.rev == 0) {
 			bcma_cc_maskset32(cc, BCMA_CC_CHIPCTL,
-					  BCMA_CCTRL_43224_GPIO_TOGGLE,
+					  ~BCMA_CCTRL_43224_GPIO_TOGGLE,
 					  BCMA_CCTRL_43224_GPIO_TOGGLE);
 			bcma_chipco_chipctl_maskset(cc, 0,
-						    BCMA_CCTRL_43224A0_12MA_LED_DRIVE,
+						    ~BCMA_CCTRL_43224A0_12MA_LED_DRIVE,
 						    BCMA_CCTRL_43224A0_12MA_LED_DRIVE);
 		} else {
 			bcma_chipco_chipctl_maskset(cc, 0,
-						    BCMA_CCTRL_43224B0_12MA_LED_DRIVE,
+						    ~BCMA_CCTRL_43224B0_12MA_LED_DRIVE,
 						    BCMA_CCTRL_43224B0_12MA_LED_DRIVE);
 		}
 		break;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH iproute2] ss: report SK_MEMINFO_BACKLOG
From: Eric Dumazet @ 2012-07-26  9:20 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Vijay Subramanian

From: Eric Dumazet <edumazet@google.com>

linux-3.6-rc1 supports SK_MEMINFO_BACKLOG with commit d594e987c6f54
(sock_diag: add SK_MEMINFO_BACKLOG)

ss command can display it if provided by the kernel.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Vijay Subramanian <subramanian.vijay@gmail.com>
---
 include/linux/sock_diag.h |    1 +
 misc/ss.c                 |   13 ++++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
index 39e4b1c..ac9db19 100644
--- a/include/linux/sock_diag.h
+++ b/include/linux/sock_diag.h
@@ -18,6 +18,7 @@ enum {
 	SK_MEMINFO_FWD_ALLOC,
 	SK_MEMINFO_WMEM_QUEUED,
 	SK_MEMINFO_OPTMEM,
+	SK_MEMINFO_BACKLOG,
 
 	SK_MEMINFO_VARS,
 };
diff --git a/misc/ss.c b/misc/ss.c
index cf529ef..d8429cc 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1337,8 +1337,9 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r)
 		     nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
 
 	if (tb[INET_DIAG_SKMEMINFO]) {
-		const __u32 *skmeminfo =  RTA_DATA(tb[INET_DIAG_SKMEMINFO]);
-		printf(" skmem:(r%u,rb%u,t%u,tb%u,f%u,w%u,o%u)",
+		const __u32 *skmeminfo = RTA_DATA(tb[INET_DIAG_SKMEMINFO]);
+
+		printf(" skmem:(r%u,rb%u,t%u,tb%u,f%u,w%u,o%u",
 			skmeminfo[SK_MEMINFO_RMEM_ALLOC],
 			skmeminfo[SK_MEMINFO_RCVBUF],
 			skmeminfo[SK_MEMINFO_WMEM_ALLOC],
@@ -1346,7 +1347,13 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r)
 			skmeminfo[SK_MEMINFO_FWD_ALLOC],
 			skmeminfo[SK_MEMINFO_WMEM_QUEUED],
 			skmeminfo[SK_MEMINFO_OPTMEM]);
-	}else if (tb[INET_DIAG_MEMINFO]) {
+
+		if (RTA_PAYLOAD(tb[INET_DIAG_SKMEMINFO]) >=
+			(SK_MEMINFO_BACKLOG + 1) * sizeof(__u32))
+			printf(",bl%u", skmeminfo[SK_MEMINFO_BACKLOG]);
+
+		printf(")");
+	} else if (tb[INET_DIAG_MEMINFO]) {
 		const struct inet_diag_meminfo *minfo
 			= RTA_DATA(tb[INET_DIAG_MEMINFO]);
 		printf(" mem:(r%u,w%u,f%u,t%u)",

^ permalink raw reply related

* Re: [PATCH] bcma: fix regression in pmu workaround reg masks
From: David Miller @ 2012-07-26 10:06 UTC (permalink / raw)
  To: hauke
  Cc: torvalds, linville, brcm80211-dev-list, linux-wireless, netdev,
	linux-kernel, seth.forshee, pieterpg, brudley, arend, zajec5
In-Reply-To: <1343294151-5691-1-git-send-email-hauke@hauke-m.de>

From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Thu, 26 Jul 2012 11:15:51 +0200

> This fixes a regression introduced in:
> commit b9562545ef0b13c0440ccd8d6dd4111fb77cb17a
> Author: Hauke Mehrtens <hauke@hauke-m.de>
> Date:   Sat Jun 30 01:44:41 2012 +0200
> 
>     bcma: complete workaround for BCMA43224 and BCM4313
> 
> The regression broke reading of the sprom from the chip and seamed to
> cause a change of the pci id on a BCMA43224 device so that it is
> rejected by brcmsmac. If this problem occurred, after applying this
> patch, a cold boot is needed to make the device work again.
> 
> In the original patch the workaround set the intended bits in the chip
> common core chip control registers, but the patch also unset all the
> other bits in that register, because of a wrong mask. The original
> patch was based on code from brcmsmac and there was an additional
> inversing of the mask in the code setting these regs which was missing
> here. Now the regs are set like brcmsmac did it before.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Tested-by: Seth Forshee <seth.forshee@canonical.com>

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

^ permalink raw reply

* [PATCH] ipv6: Early TCP socket demux
From: Eric Dumazet @ 2012-07-26 10:34 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

This is the IPv6 missing bits for infratructure added in commit
41063e9dd1195 (ipv4: Early TCP socket demux.)

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/protocol.h |    2 ++
 net/ipv6/ip6_input.c   |   13 +++++++++++--
 net/ipv6/tcp_ipv6.c    |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/include/net/protocol.h b/include/net/protocol.h
index 057f2d3..929528c 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -52,6 +52,8 @@ struct net_protocol {
 
 #if IS_ENABLED(CONFIG_IPV6)
 struct inet6_protocol {
+	void	(*early_demux)(struct sk_buff *skb);
+
 	int	(*handler)(struct sk_buff *skb);
 
 	void	(*err_handler)(struct sk_buff *skb,
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 5ab923e..47975e3 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -47,9 +47,18 @@
 
 
 
-inline int ip6_rcv_finish( struct sk_buff *skb)
+int ip6_rcv_finish(struct sk_buff *skb)
 {
-	if (skb_dst(skb) == NULL)
+	if (sysctl_ip_early_demux && !skb_dst(skb)) {
+		const struct inet6_protocol *ipprot;
+
+		rcu_read_lock();
+		ipprot = rcu_dereference(inet6_protos[ipv6_hdr(skb)->nexthdr]);
+		if (ipprot && ipprot->early_demux)
+			ipprot->early_demux(skb);
+		rcu_read_unlock();
+	}
+	if (!skb_dst(skb))
 		ip6_route_input(skb);
 
 	return dst_input(skb);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index f49476e..221224e 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1674,6 +1674,43 @@ do_time_wait:
 	goto discard_it;
 }
 
+static void tcp_v6_early_demux(struct sk_buff *skb)
+{
+	const struct ipv6hdr *hdr;
+	const struct tcphdr *th;
+	struct sock *sk;
+
+	if (skb->pkt_type != PACKET_HOST)
+		return;
+
+	if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct tcphdr)))
+		return;
+
+	hdr = ipv6_hdr(skb);
+	th = tcp_hdr(skb);
+
+	if (th->doff < sizeof(struct tcphdr) / 4)
+		return;
+
+	sk = __inet6_lookup_established(dev_net(skb->dev), &tcp_hashinfo,
+					&hdr->saddr, th->source,
+					&hdr->daddr, ntohs(th->dest),
+					inet6_iif(skb));
+	if (sk) {
+		skb->sk = sk;
+		skb->destructor = sock_edemux;
+		if (sk->sk_state != TCP_TIME_WAIT) {
+			struct dst_entry *dst = sk->sk_rx_dst;
+			struct inet_sock *icsk = inet_sk(sk);
+			if (dst)
+				dst = dst_check(dst, 0);
+			if (dst &&
+			    icsk->rx_dst_ifindex == inet6_iif(skb))
+				skb_dst_set_noref(skb, dst);
+		}
+	}
+}
+
 static struct timewait_sock_ops tcp6_timewait_sock_ops = {
 	.twsk_obj_size	= sizeof(struct tcp6_timewait_sock),
 	.twsk_unique	= tcp_twsk_unique,
@@ -1984,6 +2021,7 @@ struct proto tcpv6_prot = {
 };
 
 static const struct inet6_protocol tcpv6_protocol = {
+	.early_demux	=	tcp_v6_early_demux,
 	.handler	=	tcp_v6_rcv,
 	.err_handler	=	tcp_v6_err,
 	.gso_send_check	=	tcp_v6_gso_send_check,

^ permalink raw reply related

* [net] ixgbe: fix panic while dumping packets on Tx hang with IOMMU
From: Jeff Kirsher @ 2012-07-26 11:21 UTC (permalink / raw)
  To: davem; +Cc: Emil Tantilov, netdev, gospo, sassmann, Jeff Kirsher

From: Emil Tantilov <emil.s.tantilov@intel.com>

This patch resolves a "BUG: unable to handle kernel paging request at ..."
oops while dumping packet data. The issue occurs with IOMMU enabled due to
the address provided by phys_to_virt().

This patch makes use of skb->data on Tx and the virtual address of the pages
allocated for Rx.

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 3b6784c..c709eae 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -396,11 +396,10 @@ static void ixgbe_dump(struct ixgbe_adapter *adapter)
 				pr_cont("\n");
 
 			if (netif_msg_pktdata(adapter) &&
-			    dma_unmap_len(tx_buffer, len) != 0)
+			    tx_buffer->skb)
 				print_hex_dump(KERN_INFO, "",
 					DUMP_PREFIX_ADDRESS, 16, 1,
-					phys_to_virt(dma_unmap_addr(tx_buffer,
-								    dma)),
+					tx_buffer->skb->data,
 					dma_unmap_len(tx_buffer, len),
 					true);
 		}
@@ -474,10 +473,12 @@ rx_ring_summary:
 					(u64)rx_buffer_info->dma,
 					rx_buffer_info->skb);
 
-				if (netif_msg_pktdata(adapter)) {
+				if (netif_msg_pktdata(adapter) &&
+				    rx_buffer_info->dma) {
 					print_hex_dump(KERN_INFO, "",
 					   DUMP_PREFIX_ADDRESS, 16, 1,
-					   phys_to_virt(rx_buffer_info->dma),
+					   page_address(rx_buffer_info->page) +
+						    rx_buffer_info->page_offset,
 					   ixgbe_rx_bufsz(rx_ring), true);
 				}
 			}
-- 
1.7.11.2

^ permalink raw reply related

* r8169, 3.5.0, does't work at all
From: Denys Fedoryshchenko @ 2012-07-26 11:58 UTC (permalink / raw)
  To: netdev, romieu

Just pushed new kernel to test cluster and got this:

[    1.604470] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    1.604709] r8169 0000:02:00.0: irq 43 for MSI/MSI-X
[    1.605211] r8169 0000:02:00.0: eth0: RTL8168b/8111b at 0xf8604000, 
00:08:54:57:7a:54, XID 18000000 IRQ 43
[    1.605364] r8169 0000:02:00.0: eth0: jumbo features [frames: 4080 
bytes, tx checksumming: ko]
[    1.605549] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[    1.605780] r8169 0000:03:00.0: irq 44 for MSI/MSI-X
[    1.606212] r8169 0000:03:00.0: eth1: RTL8168b/8111b at 0xf8606000, 
00:08:54:57:7a:33, XID 18000000 IRQ 44
[    1.606366] r8169 0000:03:00.0: eth1: jumbo features [frames: 4080 
bytes, tx checksumming: ko]
....
[   20.406090]     input device check on
[   20.406177]     Actions configured
[   21.526836] r8169 0000:02:00.0: eth0: link up
[   28.038386] ------------[ cut here ]------------
[   28.038438] WARNING: at net/sched/sch_generic.c:255 
dev_watchdog+0xd6/0x12a()
[   28.038489] Hardware name:
[   28.038534] NETDEV WATCHDOG: eth0 (r8169): transmit queue 0 timed 
out
[   28.038584] Modules linked in: cls_flow cls_u32 em_meta cls_basic 
xt_dscp ts_bm xt_string xt_hl ifb cls_fw sch_tbf sch_htb act_ipt 
act_mirred ipt_REDIRECT ipt_REJECT xt_TCPMSS xt_DSCP xt_mark 
iptable_mangle iptable_nat nf_nat nf_conntrack_ipv4 nf_conntrack 
nf_defrag_ipv4 iptable_filter 8021q garp stp llc loop usb_storage mei 
lpc_ich mfd_core ahci libahci libata sr_mod cdrom tulip r8169 sky2 
via_velocity via_rhine sis900 ne2k_pci 8390 skge tg3 libphy 8139too 
e1000 e100 usbhid ohci_hcd uhci_hcd ehci_hcd usbcore usb_common [last 
unloaded: usb_storage]
[   28.038616] Pid: 4, comm: kworker/0:0 Not tainted 3.5.0-build-0063 
#4
[   28.038617] Call Trace:
[   28.038620]  [<c0127962>] warn_slowpath_common+0x77/0x8c
[   28.038623]  [<c02f507e>] ? dev_watchdog+0xd6/0x12a
[   28.038625]  [<c02f507e>] ? dev_watchdog+0xd6/0x12a
[   28.038628]  [<c01279f3>] warn_slowpath_fmt+0x2e/0x30
[   28.038630]  [<c02f507e>] dev_watchdog+0xd6/0x12a
[   28.038633]  [<c0131c45>] run_timer_softirq+0x1ab/0x254
[   28.038635]  [<c0131bc9>] ? run_timer_softirq+0x12f/0x254
[   28.038638]  [<c015d181>] ? trace_hardirqs_on_caller+0xf5/0x13f
[   28.038640]  [<c02f4fa8>] ? netif_tx_unlock+0x41/0x41
[   28.038643]  [<c012d38e>] __do_softirq+0x7b/0x118
[   28.038644]  [<c012d313>] ? local_bh_enable+0xd/0xd
[   28.038645]  <IRQ>  [<c012d5a9>] ? irq_exit+0x41/0x91
[   28.038650]  [<c0118ac0>] ? smp_apic_timer_interrupt+0x64/0x71
[   28.038652]  [<c023054c>] ? trace_hardirqs_off_thunk+0xc/0x10
[   28.038655]  [<c0353977>] ? apic_timer_interrupt+0x2f/0x34
[   28.038661]  [<f85f7e9f>] ? rtl_slow_event_work+0x14/0x1a2 [r8169]
[   28.038664]  [<c0351898>] ? mutex_lock_nested+0x20/0x22
[   28.038667]  [<f85f49d1>] ? rtl_task+0x49/0x5f [r8169]
[   28.038670]  [<c013992a>] ? process_one_work+0x1a1/0x2ab
[   28.038672]  [<c01398b9>] ? process_one_work+0x130/0x2ab
[   28.038675]  [<f85f4988>] ? rtl8169_set_features+0x39/0x39 [r8169]
[   28.038678]  [<c013a3be>] ? worker_thread+0xd1/0x14c
[   28.038680]  [<c013a2ed>] ? manage_workers.clone.20+0x14e/0x14e
[   28.038682]  [<c013d3ec>] ? kthread+0x67/0x6c
[   28.038685]  [<c0350000>] ? migration_call+0x10/0x189
[   28.038687]  [<c013d385>] ? __init_kthread_worker+0x47/0x47
[   28.038689]  [<c03542fa>] ? kernel_thread_helper+0x6/0xd
[   28.038690] ---[ end trace 9701f577e9a74181 ]---
[   28.043532] r8169 0000:02:00.0: eth0: link up
[   34.043357] r8169 0000:02:00.0: eth0: link up
[   40.043202] r8169 0000:02:00.0: eth0: link up
[   46.043052] r8169 0000:02:00.0: eth0: link up
[   52.042893] r8169 0000:02:00.0: eth0: link up
[   58.042739] r8169 0000:02:00.0: eth0: link up
[   64.042584] r8169 0000:02:00.0: eth0: link up
[   70.042430] r8169 0000:02:00.0: eth0: link up
[   76.042276] r8169 0000:02:00.0: eth0: link up
[   82.042123] r8169 0000:02:00.0: eth0: link up
[   88.041968] r8169 0000:02:00.0: eth0: link up
[   94.041813] r8169 0000:02:00.0: eth0: link up

---
Denys Fedoryshchenko, Network Engineer, Virtual ISP S.A.L.

^ permalink raw reply

* Re: orphan process is causing deadlock in __kernel_vsyscall ()
From: Sri Ram Vemulpali @ 2012-07-26 12:54 UTC (permalink / raw)
  To: linux-kernel-mail, linux-newbie, linux-netdev, kernelnewbies,
	Kernel-newbies
In-Reply-To: <CALyraeOQZ+FPTqaOk6XjHsZwwCfNuo2XLo6bhw44maSEkDf7tA@mail.gmail.com>

> Hello All,
>
> I am debugging a problem which I do not know how to solve. I know what
> is happening, but cannot find solution to it. If anyone has any
> suggestions or solution that would be really grateful and I appreciate
> it.
>
> Here is the description.
>
> I have a thread which spawns a child process using fork() and in child
> context it execv to shell and parent thread waits on waitpid(). This
> child process is nothing but a shell /bin/sh, so that from program I
> can create shell and run some commands.
> In this shell instance, I run tshark for capturing network traffic. I
> have really high traffic going, so system is really busy. All is good
> so far, but when I send SIGKILL to child process (shell) from another
> thread from same application,
> child process (shell) gets terminated and tshark is assigned to
> init(1) process as orphan. The parent thread which spawned the child
> process unblocks from waitpid() after cleaning child instance and
> continues it execution.
>
> Here is the problem:
> Once the parent thread resumes from waitpid(), it hits fprintf to
> print message "exiting from shell" to console. In here the main thread
> gets blocked in __kernel_vsyscall () entered from fprintf. Following
> is my stack trace from gdb.
> But after some more debugging and found that, if I kill from another
> shell "tshark" process which is assigned to init(1) as child, the
> parent thread unblocks from __kernel_vsyscall ().
>
> Can anyone tell what is going on, is this related to futex spinning
> problem where lock is been held by tshark. How would I approach this
> problem?
> Or is there a way to kill all child process of a process without
> making them orphan. Because when a child process is running at the
> time parent is exiting, that child process is assigned to init(1) as
> orphan process.
> Can this behavior be modified. Please let me know any suggestions and
> thoughts. Thanks in advance.
>
> --
> Regards,
> Sri.
>
> (gdb) backtrace
> #0  0xffffe424 in __kernel_vsyscall ()
> #1  0xb7e6396b in write () from /lib/libc.so.6
> #2  0xb7e0c2ef in _IO_new_file_write () from /lib/libc.so.6
> #3  0xb7e0bf93 in new_do_write () from /lib/libc.so.6
> #4  0xb7e0c296 in _IO_new_do_write () from /lib/libc.so.6
> #5  0xb7e0ce20 in _IO_new_file_overflow () from /lib/libc.so.6
> #6  0xb7e0c0cd in _IO_new_file_xsputn () from /lib/libc.so.6
> #7  0xb7de3634 in vfprintf () from /lib/libc.so.6
> #8  0x09ad62a2 in acme_fprintf (stream=0xb7ee2560,
>     format=0x9f17694 "shell exited. returning to acli\n")
>     at /home/svemulpali/cc/svemulpali_SCOTTY_main/linux/private/common/src/coutOverride.cpp:42
> #9  0x094a9345 in vxShellCmdStartWait (syscmd=0x0)
>     at /home/svemulpali/cc/svemulpali_SCOTTY_main/linux/private/lib/stub/vxShellLib.cpp:210



-- 
Regards,
Sri.
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply

* Re: [PATCH RESEND 0/9] OLPC: create a generic OLPC EC driver
From: Thomas Gleixner @ 2012-07-26 13:51 UTC (permalink / raw)
  To: Andres Salomon
  Cc: Andrew Morton, Paul Fox, Daniel Drake, Richard A. Smith,
	linux-kernel, libertas-dev, linux-wireless, netdev,
	platform-driver-x86, devel, Ingo Molnar, H. Peter Anvin, x86,
	Dan Williams, John W. Linville, Matthew Garrett, Anton Vorontsov,
	David Woodhouse, Chris Ball, Jon Nettleton, Greg Kroah-Hartman
In-Reply-To: <20120718213713.232e4161@dev.queued.net>

On Wed, 18 Jul 2012, Andres Salomon wrote:
> The OLPC EC (Embedded Controller) code that is currently upstream is
> x86-only, originally written for the XO-1.  Since then, we've had the
> XO-1.5 (also x86), and XO-1.75 (arm-based) enter mass production.  The
> 1.75 uses a vastly different EC protocol, and future hardware revisions
> are likely to change it even further.
> 
> However, the drivers do share quite a bit of code, so it makes sense to
> have a platform-agnostic driver that calls into platform-specific hooks
> for each XO's EC driver.  This is the first stab and creating such a
> beast (with further patches pending).  Aside from the lack of code
> duplication, this is helpful for fixing bugs in one place (for example,
> we fixed an EC suspend/resume bug in 1.75 that I've just seen happen on
> 1.5 without these patches.  With these patches, the problem goes away).
> 
> These patches are against Linus's current HEAD; let me know if they
> don't apply somewhere, and I'll happily redo them against the -next
> tree.  I'm assuming that these changes (which touch places like x86,
> wireless, and staging) should go through either the x86 tree, or
> through akpm's tree.
> 
> Alternatively, if the reviews are positive and I can get SOBs from the
> relevant maintainers, I can set up a platform-olpc tree somewhere and
> request a pull from Linus.

Either via akpm or a separate tree are fine with me.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
 

^ permalink raw reply

* [PATCH]net:appletalk:ddp:fixed coding style issue in net/appletalk/ddp.c
From: Jeffrin Jose @ 2012-07-26 13:59 UTC (permalink / raw)
  To: acme, davem; +Cc: netdev, linux-kernel, ahiliation

Fixed coding style issue relating to switch  and case
statement in file net/appletalk/ddp.c

Signed-off-by: Jeffrin Jose <ahiliation@yahoo.co.in>
---
 net/appletalk/ddp.c |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 0301b32..c8bbcd2 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1798,7 +1798,7 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 
 	switch (cmd) {
 		/* Protocol layer */
-		case TIOCOUTQ: {
+	case TIOCOUTQ: {
 			long amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk);
 
 			if (amount < 0)
@@ -1806,7 +1806,7 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 			rc = put_user(amount, (int __user *)argp);
 			break;
 		}
-		case TIOCINQ: {
+	case TIOCINQ: {
 			/*
 			 * These two are safe on a single CPU system as only
 			 * user tasks fiddle here
@@ -1819,27 +1819,27 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 			rc = put_user(amount, (int __user *)argp);
 			break;
 		}
-		case SIOCGSTAMP:
+	case SIOCGSTAMP:
 			rc = sock_get_timestamp(sk, argp);
 			break;
-		case SIOCGSTAMPNS:
+	case SIOCGSTAMPNS:
 			rc = sock_get_timestampns(sk, argp);
 			break;
 		/* Routing */
-		case SIOCADDRT:
-		case SIOCDELRT:
+	case SIOCADDRT:
+	case SIOCDELRT:
 			rc = -EPERM;
 			if (capable(CAP_NET_ADMIN))
 				rc = atrtr_ioctl(cmd, argp);
 			break;
 		/* Interface */
-		case SIOCGIFADDR:
-		case SIOCSIFADDR:
-		case SIOCGIFBRDADDR:
-		case SIOCATALKDIFADDR:
-		case SIOCDIFADDR:
-		case SIOCSARP:		/* proxy AARP */
-		case SIOCDARP:		/* proxy AARP */
+	case SIOCGIFADDR:
+	case SIOCSIFADDR:
+	case SIOCGIFBRDADDR:
+	case SIOCATALKDIFADDR:
+	case SIOCDIFADDR:
+	case SIOCSARP:		/* proxy AARP */
+	case SIOCDARP:		/* proxy AARP */
 			rtnl_lock();
 			rc = atif_ioctl(cmd, argp);
 			rtnl_unlock();
-- 
1.7.10

^ permalink raw reply related

* Re: [PATCH]net:appletalk:ddp:fixed coding style issue in net/appletalk/ddp.c
From: Joe Perches @ 2012-07-26 14:11 UTC (permalink / raw)
  To: Jeffrin Jose; +Cc: acme, davem, netdev, linux-kernel
In-Reply-To: <1343311142-4539-1-git-send-email-ahiliation@yahoo.co.in>

On Thu, 2012-07-26 at 19:29 +0530, Jeffrin Jose wrote:
> Fixed coding style issue relating to switch  and case
> statement in file net/appletalk/ddp.c

Don't just move the case labels, move the code blocks
including comments.

> diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
[]
> @@ -1798,7 +1798,7 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
>  
>  	switch (cmd) {
>  		/* Protocol layer */
> -		case TIOCOUTQ: {
> +	case TIOCOUTQ: {
>  			long amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk);

		long amount = etc...

Post the patch with a commit message that says that
that a git diff -w is empty and the compiled objects
are the same too.

^ permalink raw reply

* Premature timeout for MLDv1 Host compatibility mode?
From: Dragos Ilie @ 2012-07-26 14:57 UTC (permalink / raw)
  To: netdev

Hi!

I suspect that the MLDv1 Host compatibility mode is ended prematurely.
In net/ipv6/mcast.c the "Older Version Querier Present" timeout is
computed as

max_delay = (ntohs(mld->mld_maxdelay)*HZ)/1000;
switchback = (idev->mc_qrv + 1) * max_delay;
idev->mc_v1_seen = jiffies + switchback;


RFC 3810 says that the timeout should be computed as
Robustness_Variable * Query_Interval + Query_Response_Interval. This
suggests that the line where switchback is computed should be changed
to something like

switchback = (idev->mc_qrv * 125 * HZ)  + max_delay;

where 125 is the default Query_Interval in seconds

I would appreciate it if somebody can confirm if my suspicion is correct.

Regards,
Dragos

^ permalink raw reply

* [PATCH 0/4] pch_gbe: avoiding transmit timeouts (rev3)
From: Andy Cress @ 2012-07-26 15:57 UTC (permalink / raw)
  To: netdev


When the interface is stressed with 6 VLANs, some transmit timeout stats were 
observed, which is a potential precursor to the more severe netdev watchdog 
timeout oops.  Also we saw more than the expected number of transmit restarts, which impacted performance.   The following patches were applied and resolved 
the symptom of the transmit timeout stats, and reduced the number of 
transmit restarts.  

This patch set includes the following patches:
0001-pch_gbe-fix-transmit-watchdog-timeout.patch
0002-pch_gbe-add-extra-clean-tx.patch  (includes bumping the version to 1.01) 
0003-pch_gbe-vlan-skb-len-fix.patch

This rev3 has the following changes:
* Removed Fix-the-checksum-fill-to-the-error-location.patch for now so Hongbo can evaluate/revise/test based on feedback.

The resulting pch_gbe 1.01 driver has been tested on Kontron Tunnel Creek 
EG20T modules and Intel Crown Bay EG20T modules, so I believe that these are 
appropriate for consideration in the upstream pch_gbe driver.

Please review and comment.

Thanks,
Andy

^ permalink raw reply

* [PATCH 1/3] pch_gbe: fix transmit watchdog timeout
From: Andy Cress @ 2012-07-26 15:59 UTC (permalink / raw)
  To: netdev


An extended ping test with 6 vlans resulted in a driver oops with a
netdev transmit timeout.
Fix WATCHDOG_TIMEOUT to be more like e1000e at 5 * HZ, to avoid 
unnecessary transmit timeouts.

Signed-off-by: Andy Cress <andy.cress@us.kontron.com>

diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 4c04843..a746064 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -35,7 +35,7 @@ const char pch_driver_version[] = DRV_VERSION;
 #define DSC_INIT16			0xC000
 #define PCH_GBE_DMA_ALIGN		0
 #define PCH_GBE_DMA_PADDING		2
-#define PCH_GBE_WATCHDOG_PERIOD		(1 * HZ)	/* watchdog time */
+#define PCH_GBE_WATCHDOG_PERIOD		(5 * HZ)	/* watchdog time */
 #define PCH_GBE_COPYBREAK_DEFAULT	256
 #define PCH_GBE_PCI_BAR			1
 #define PCH_GBE_RESERVE_MEMORY		0x200000	/* 2MB */

^ permalink raw reply related

* [PATCH 2/3] pch_gbe: add extra clean tx
From: Andy Cress @ 2012-07-26 16:00 UTC (permalink / raw)
  To: netdev


This adds extra cleaning to the pch_gbe_clean_tx routine to avoid 
transmit timeouts on some BCM PHYs that have different timing.
Also update the DRV_VERSION to 1.01, and show it.

Signed-off-by: Andy Cress <andy.cress@us.kontron.com>

diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 8694704..000ef68 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -26,7 +26,7 @@
 #include <linux/ptp_classify.h>
 #endif
 
-#define DRV_VERSION     "1.00"
+#define DRV_VERSION     "1.01"
 const char pch_driver_version[] = DRV_VERSION;
 
 #define PCI_DEVICE_ID_INTEL_IOH1_GBE	0x8802		/* Pci device ID */
@@ -1579,7 +1579,8 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
 	struct sk_buff *skb;
 	unsigned int i;
 	unsigned int cleaned_count = 0;
-	bool cleaned = true;
+	bool cleaned = false;
+	int unused, thresh;
 
 	pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean);
 
@@ -1588,10 +1589,36 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
 	pr_debug("gbec_status:0x%04x  dma_status:0x%04x\n",
 		 tx_desc->gbec_status, tx_desc->dma_status);
 
+	unused = PCH_GBE_DESC_UNUSED(tx_ring);
+	thresh = tx_ring->count - PCH_GBE_TX_WEIGHT;
+	if ((tx_desc->gbec_status == DSC_INIT16) && (unused < thresh))
+	{  /* current marked clean, tx queue filling up, do extra clean */
+		int j, k;
+		if (unused < 8) {  /* tx queue nearly full */
+			pr_debug("clean_tx: transmit queue warning (%x,%x) unused=%d\n",
+				tx_ring->next_to_clean,tx_ring->next_to_use,unused);
+		}
+	   
+		/* current marked clean, scan for more that need cleaning. */
+		k = i;
+		for (j = 0; j < PCH_GBE_TX_WEIGHT; j++) 
+		{
+			tx_desc = PCH_GBE_TX_DESC(*tx_ring, k);
+			if (tx_desc->gbec_status != DSC_INIT16) break; /*found*/
+			if (++k >= tx_ring->count) k = 0;  /*increment, wrap*/
+		}
+		if (j < PCH_GBE_TX_WEIGHT) {
+			pr_debug("clean_tx: unused=%d loops=%d found tx_desc[%x,%x:%x].gbec_status=%04x\n",
+				unused,j, i,k, tx_ring->next_to_use, tx_desc->gbec_status);
+			i = k;  /*found one to clean, usu gbec_status==2000.*/
+		}
+	}
+
 	while ((tx_desc->gbec_status & DSC_INIT16) == 0x0000) {
 		pr_debug("gbec_status:0x%04x\n", tx_desc->gbec_status);
 		buffer_info = &tx_ring->buffer_info[i];
 		skb = buffer_info->skb;
+		cleaned = true;
 
 		if ((tx_desc->gbec_status & PCH_GBE_TXD_GMAC_STAT_ABT)) {
 			adapter->stats.tx_aborted_errors++;
@@ -1639,18 +1666,21 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
 	}
 	pr_debug("called pch_gbe_unmap_and_free_tx_resource() %d count\n",
 		 cleaned_count);
-	/* Recover from running out of Tx resources in xmit_frame */
-	spin_lock(&tx_ring->tx_lock);
-	if (unlikely(cleaned && (netif_queue_stopped(adapter->netdev)))) {
-		netif_wake_queue(adapter->netdev);
-		adapter->stats.tx_restart_count++;
-		pr_debug("Tx wake queue\n");
-	}
+	if (cleaned_count > 0)  { /*skip this if nothing cleaned*/
+		/* Recover from running out of Tx resources in xmit_frame */
+		spin_lock(&tx_ring->tx_lock);
+		if (unlikely(cleaned && (netif_queue_stopped(adapter->netdev))))
+		{
+			netif_wake_queue(adapter->netdev);
+			adapter->stats.tx_restart_count++;
+			pr_debug("Tx wake queue\n");
+		}
 
-	tx_ring->next_to_clean = i;
+		tx_ring->next_to_clean = i;
 
-	pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean);
-	spin_unlock(&tx_ring->tx_lock);
+		pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean);
+		spin_unlock(&tx_ring->tx_lock);
+	}
 	return cleaned;
 }
 
@@ -2387,7 +2417,7 @@ static int pch_gbe_napi_poll(struct napi_struct *napi, int budget)
 	pch_gbe_clean_rx(adapter, adapter->rx_ring, &work_done, budget);
 	cleaned = pch_gbe_clean_tx(adapter, adapter->tx_ring);
 
-	if (!cleaned)
+	if (cleaned)
 		work_done = budget;
 	/* If no Tx and not enough Rx work done,
 	 * exit the polling mode
@@ -2793,6 +2823,7 @@ static int __init pch_gbe_init_module(void)
 {
 	int ret;
 
+	pr_info("EG20T PCH Gigabit Ethernet Driver - version %s\n",DRV_VERSION);
 	ret = pci_register_driver(&pch_gbe_driver);
 	if (copybreak != PCH_GBE_COPYBREAK_DEFAULT) {
 		if (copybreak == 0) {

^ permalink raw reply related

* [PATCH 3/3] pch_gbe: vlan skb len fix
From: Andy Cress @ 2012-07-26 16:01 UTC (permalink / raw)
  To: netdev


pch_gbe_xmit_frame skb->len verification was incorrect in vlan case 
causing bogus transfer length errors.  One correction could be:
    offset = skb->protocol == htons(ETH_P_8021Q) ? 0 : 4;
    if (unlikely(skb->len > (adapter->hw.mac.max_frame_size - offset))) 
However, this verification is not necessary, so remove it.

Signed-off-by: Andy Cress <andy.cress@us.kontron.com>

diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 000ef68..817614c 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -2157,13 +2157,6 @@ static int pch_gbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 	struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring;
 	unsigned long flags;
 
-	if (unlikely(skb->len > (adapter->hw.mac.max_frame_size - 4))) {
-		pr_err("Transfer length Error: skb len: %d > max: %d\n",
-		       skb->len, adapter->hw.mac.max_frame_size);
-		dev_kfree_skb_any(skb);
-		adapter->stats.tx_length_errors++;
-		return NETDEV_TX_OK;
-	}
 	if (!spin_trylock_irqsave(&tx_ring->tx_lock, flags)) {
 		/* Collision - tell upper layer to requeue */
 		return NETDEV_TX_LOCKED;

^ permalink raw reply related

* Re: [PATCH] iproute: Add route showdump command
From: Stephen Hemminger @ 2012-07-26 16:03 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: Dan Smith, Linux Netdev List
In-Reply-To: <50110593.1070502@parallels.com>

On Thu, 26 Jul 2012 12:53:39 +0400
Pavel Emelyanov <xemul@parallels.com> wrote:

> Some time ago the save+restore commands were added to ip route (git
> id f4ff11e3, Add ip route save/restore). These two save the raw rtnl
> stream into a file and restore one (reading it from stdin).
> 
> The problem is that there's no way to get the contents of the dump
> file in a human readable form. How about adding a command that reads
> the rtnl stream from stdin and prints the data in a way the usual
> "ip route list" does?
> 
> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

Being able to decode a dump is great idea.
Are the user's smart enough not to try it out at the command prompt
and get totally lost? Maybe another isatty() check is needed.

Another solution would be to put a small header on the save file with
a magic number that could be checked. This would mean changing save/restore/showdump
and ideally updating the magic file in distributions.

^ permalink raw reply

* Re: [RFC ETHTOOL PATCH 2/2] ethtool: allow setting MDI-X state
From: Ben Hutchings @ 2012-07-26 16:35 UTC (permalink / raw)
  To: Jesse Brandeburg; +Cc: netdev
In-Reply-To: <20120726163033.GA20122@jbrandeb-snb.jf.intel.com>

On Thu, 2012-07-26 at 09:30 -0700, Jesse Brandeburg wrote:
> On Wed, Jul 25, 2012 at 11:59:02PM +0100, Ben Hutchings wrote:
> > On Wed, 2012-07-25 at 10:53 -0700, Jesse Brandeburg wrote:
> > How about when you have a forced mode but the driver reports eth_tp_mdix
> > = ETH_TP_MDI_INVALID because the link is down?  This is going to result
> > in:
> > 
> >         MDI-X: Unknown (forced)
> > 
> > which makes no sense at all.  So I think that we have to do something
> > like:
> > 
> > 	if (ep->eth_tp_mdix_ctrl == ETH_TP_MDI) {
> > 		fprintf(stdout, "off (forced)\n");
> > 	} else if (ep->eth_tp_mdix_ctrl == ETH_TP_MDI_X) {
> > 		fprintf(stdout, "on (forced)\n");
> > 	} else {
> > 		switch (ep->eth_tp_mdix) {
> > 			...
> > 		}
> > 		if (ep->eth_tp_mdix_ctrl == ETH_TP_MDI_AUTO)
> > 			fprintf(stdout, " (auto)");
> > 		fprintf(stdout, "\n");
> > 	}
> > 
> > Or else we require that when the mode is forced then drivers report that
> > as the current status even if the link is down.
> 
> I tried that and it works swimmingly.  How does this look?
[...]

That looks good, thanks.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* Re: [PATCH 00/16] Remove the ipv4 routing cache
From: Eric Dumazet @ 2012-07-26 17:02 UTC (permalink / raw)
  To: Paweł Staszewski; +Cc: David Miller, netdev
In-Reply-To: <500D8FEE.7050802@itcare.pl>

On Mon, 2012-07-23 at 19:54 +0200, Paweł Staszewski wrote:

> I make some real life tests with 10Gbit traffic and make some rdos.
> With kernel 3.4.5 when I reach 6M routing cache entries - traffic is not 
> forwarded - on my hardware with 64G RAM
> 
> With kernel - 3.5.0-rc7-next-20120720 + David M. patches - route cache 
> removal + fix
> Traffic is forwarder all the time at speed 8.2Mpps RX from traffic 
> generator and 8.2Mpps TX to the sink
> 
> Also I see performance improvement.
> 
> With kernel 3.4.5 I can reach maximum od 7.5Mpps with my hardware
> And with kernel 3.5.0-rc7-next-20120720 i can reach 8.2Mpps - forwarding 
> UDP performance - can be more - but my TX pktgen that use 6 cores can't 
> do more.
> 
> Really thanks for this :)

In real life, with TCP traffic, make sure you
set /proc/sys/net/ipv4/ip_early_demux to 0 

^ permalink raw reply

* Re: open sockets preventing unregister_netdevice from completing in linux-next (next-20120724)
From: Eric Dumazet @ 2012-07-26 17:15 UTC (permalink / raw)
  To: David Miller; +Cc: bjorn, netdev
In-Reply-To: <20120725.151737.1807149851147342859.davem@davemloft.net>

On Wed, 2012-07-25 at 15:17 -0700, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Wed, 25 Jul 2012 16:38:48 +0200
> 
> > Yes, we miss what was done with rt_cache_flush() : find all cached
> > routes and release all dev references...
> 
> We can fix this with a two-pronged approach:
> 
> 1) Walk the FIB info nexthops and invalidate.
> 
> 2) Entries not cached in the FIB info nexthops go into a
>    per-netns list which is scanned as well.
> 
> I'll try to work on this if nobody beats me to it.

With your latest patch, I can "rmmod tg3" while sockets are active.

Not sure we need all this now ?

(the trick is probably in fib_semantics.c, when you changed
dst_release() to dst_free())

^ 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