Netdev List
 help / color / mirror / Atom feed
* [PATCH v2] ip6_tunnel: allow to change mode for the ip6tnl0
From: Alexey Andriyanov @ 2014-10-29  7:54 UTC (permalink / raw)
  To: netdev; +Cc: Alexey Andriyanov, David S. Miller, Eric Dumazet
In-Reply-To: <1414563898-10347-1-git-send-email-alan@al-an.info>

The fallback device is in ipv6 mode by default.
The mode can not be changed in runtime, so there
is no way to decapsulate ip4in6 packets coming from
various sources without creating the specific tunnel
ifaces for each peer.

This allows to update the fallback tunnel device, but only
the mode could be changed. Usual command should work for the
fallback device: `ip -6 tun change ip6tnl0 mode any`

The fallback device can not be hidden from the packet receiver
as a regular tunnel, but there is no need for synchronization
as long as we do single assignment.

Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Alexey Andriyanov <alan@al-an.info>
---
 net/ipv6/ip6_tunnel.c | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 9409887..8c97cd1 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -477,6 +477,7 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
 	int rel_msg = 0;
 	u8 rel_type = ICMPV6_DEST_UNREACH;
 	u8 rel_code = ICMPV6_ADDR_UNREACH;
+	u8 tproto;
 	__u32 rel_info = 0;
 	__u16 len;
 	int err = -ENOENT;
@@ -490,7 +491,8 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
 					&ipv6h->saddr)) == NULL)
 		goto out;
 
-	if (t->parms.proto != ipproto && t->parms.proto != 0)
+	tproto = ACCESS_ONCE(t->parms.proto);
+	if (tproto != ipproto && tproto != 0)
 		goto out;
 
 	err = 0;
@@ -791,6 +793,7 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
 {
 	struct ip6_tnl *t;
 	const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
+	u8 tproto;
 	int err;
 
 	rcu_read_lock();
@@ -799,7 +802,8 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
 					&ipv6h->daddr)) != NULL) {
 		struct pcpu_sw_netstats *tstats;
 
-		if (t->parms.proto != ipproto && t->parms.proto != 0) {
+		tproto = ACCESS_ONCE(t->parms.proto);
+		if (tproto != ipproto && tproto != 0) {
 			rcu_read_unlock();
 			goto discard;
 		}
@@ -1078,9 +1082,11 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct flowi6 fl6;
 	__u8 dsfield;
 	__u32 mtu;
+	u8 tproto;
 	int err;
 
-	if ((t->parms.proto != IPPROTO_IPIP && t->parms.proto != 0) ||
+	tproto = ACCESS_ONCE(t->parms.proto);
+	if ((tproto != IPPROTO_IPIP && tproto != 0) ||
 	    !ip6_tnl_xmit_ctl(t))
 		return -1;
 
@@ -1120,9 +1126,11 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct flowi6 fl6;
 	__u8 dsfield;
 	__u32 mtu;
+	u8 tproto;
 	int err;
 
-	if ((t->parms.proto != IPPROTO_IPV6 && t->parms.proto != 0) ||
+	tproto = ACCESS_ONCE(t->parms.proto);
+	if ((tproto != IPPROTO_IPV6 && tproto != 0) ||
 	    !ip6_tnl_xmit_ctl(t) || ip6_tnl_addr_conflict(t, ipv6h))
 		return -1;
 
@@ -1285,6 +1293,14 @@ static int ip6_tnl_update(struct ip6_tnl *t, struct __ip6_tnl_parm *p)
 	return err;
 }
 
+static int ip6_tnl0_update(struct ip6_tnl *t, struct __ip6_tnl_parm *p)
+{
+	/* for default tnl0 device allow to change only the proto */
+	t->parms.proto = p->proto;
+	netdev_state_change(t->dev);
+	return 0;
+}
+
 static void
 ip6_tnl_parm_from_user(struct __ip6_tnl_parm *p, const struct ip6_tnl_parm *u)
 {
@@ -1384,7 +1400,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			break;
 		ip6_tnl_parm_from_user(&p1, &p);
 		t = ip6_tnl_locate(net, &p1, cmd == SIOCADDTUNNEL);
-		if (dev != ip6n->fb_tnl_dev && cmd == SIOCCHGTUNNEL) {
+		if (cmd == SIOCCHGTUNNEL) {
 			if (t != NULL) {
 				if (t->dev != dev) {
 					err = -EEXIST;
@@ -1392,8 +1408,10 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 				}
 			} else
 				t = netdev_priv(dev);
-
-			err = ip6_tnl_update(t, &p1);
+			if (dev == ip6n->fb_tnl_dev)
+				err = ip6_tnl0_update(t, &p1);
+			else
+				err = ip6_tnl_update(t, &p1);
 		}
 		if (t) {
 			err = 0;
-- 
1.9.1

^ permalink raw reply related

* Re: ipv6 mld: packets are not looped back to/from kernel/querier
From: Pierre Pfister @ 2014-10-29  8:14 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: netdev, liuhangbin
In-Reply-To: <544FDDA7.8020007@redhat.com>

Thanks for the quick answer,

See inline,

Le 28 oct. 2014 à 19:17, Daniel Borkmann <dborkman@redhat.com> a écrit :

> On 10/28/2014 05:32 PM, Pierre Pfister wrote:
>> Hello,
>> 
>> I’m implementing a dual-stack multicast querier (IGMPv3 and MLDv2) along with the PIM protocol.
>> So I’ve got two multicast sockets, one for each protocol.
>> 
>> I open the two sockets like this:
>> 
>> ——————————————————
>> fd = socket(AF_INET, SOCK_RAW, IPPROTO_IGMP);
>> val = 1;
>> setsockopt(fd, IPPROTO_IP, MRT_INIT, &val, sizeof(val));
>> setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &val, sizeof(val));
>> setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, &val, sizeof(val));
>> val = 0xc0;
>> setsockopt(fd, IPPROTO_IP, IP_TOS, &val, sizeof(val));
>> setsockopt(fd, IPPROTO_IP, IP_OPTIONS, &ipv4_rtr_alert, sizeof(ipv4_rtr_alert))
>> 
>> fd = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
>> val = 1;
>> setsockopt(fd, IPPROTO_IPV6, MRT6_INIT, &val, sizeof(val));
>> setsockopt(fd, IPPROTO_IPV6, IPV6_RECVHOPOPTS, &val, sizeof(val));
>> setsockopt(fd, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &val, sizeof(val));
>> setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &val, sizeof(val));
>> val = 2;
>> setsockopt(fd, IPPROTO_RAW, IPV6_CHECKSUM, &val, sizeof(val));
>> setsockopt(fd, IPPROTO_IPV6, IPV6_HOPOPTS, &ipv6_rtr_alert, sizeof(ipv6_rtr_alert));
> 
> What kernel are you using? How do you setup ipv6_rtr_alert here?
> 
> For inbound queries in IPv6, the kernel might be more picky after
> [correct] commit e940f5d6ba6a ("ipv6: Fix MLD Query message check"),
> so you need to make sure you have hop limit of 1 and a proper set
> up RA option …

I can reproduce the problem with both 3.10.28 and 3.14-0. I will try to try a later version.
I don’t think the packet itself can be a problem as other routers correctly receive it.
The problem comes with loopbacking to kernel and userspace (Depending whether the kernel or querier sent it).

Here is the router alert struct.
static struct {
	struct ip6_hbh hdr;
	struct ip6_opt_router rt;
	uint8_t pad[2];
} ipv6_rtr_alert = {
	.hdr = {0, 0},
	.rt = {IP6OPT_ROUTER_ALERT, 2, {0, IP6_ALERT_MLD}},
	.pad = {0, 0}
}

I also checked what that commit checks (wiresharked), and everything seems correct.

Thanks,

- Pierre



> 
>> struct icmp6_filter flt;
>> ICMP6_FILTER_SETBLOCKALL(&flt);
>> ICMP6_FILTER_SETPASS(ICMPV6_MGM_QUERY, &flt);
>> ICMP6_FILTER_SETPASS(ICMPV6_MGM_REPORT, &flt);
>> ICMP6_FILTER_SETPASS(ICMPV6_MGM_REDUCTION, &flt);
>> ICMP6_FILTER_SETPASS(ICMPV6_MLD2_REPORT, &flt);
>> setsockopt(fd, IPPROTO_ICMPV6, ICMP6_FILTER, &flt, sizeof(flt));
>> ——————————————————————
>> 
>> I’ve got two issues with the IPv6 socket.
>> When I send an MLD query, it is sent on the wire, but the kernel doesn’t interpret it (It doesn’t send MLD Reports as reply).
>> Similarly, when the kernel sends a Report, my MLD Querier socket doesn’t receive the message.
>> 
>> The resulting problem is that everything works fine as long as the router doesn’t want to join a group. When it does, my Querier can’t know it, and the kernel doesn’t reply to Querier’s requests.
>> 
>> It works well in IPv4.
>> 
>> I tried removing the ICMPV6 filter as well as using IPV6_MULTICAST_LOOP.
>> 
>> Am I doing something wrong or is it an actual bug ?
>> If you need more information, please ask.
>> 
>> Thanks,
>> 
>> 
>> Pierre
>> 
>> 
>> --
>> 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
>> 
> --
> 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

* [PATCH 1/1 net-next] ipx: remove all unnecessary castings on ntohl
From: Fabian Frederick @ 2014-10-29  8:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Fabian Frederick, Arnaldo Carvalho de Melo, David S. Miller,
	netdev

Apply commit e0f36310f793
("ipx: remove unnecessary casting on ntohl")
to all seq_printf/08lX

Inspired-by: "David S. Miller" <davem@davemloft.net>
Inspired-by: Joe Perches <joe@perches.com>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 net/ipx/ipx_proc.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/ipx/ipx_proc.c b/net/ipx/ipx_proc.c
index 8391191..c1d247e 100644
--- a/net/ipx/ipx_proc.c
+++ b/net/ipx/ipx_proc.c
@@ -45,7 +45,7 @@ static int ipx_seq_interface_show(struct seq_file *seq, void *v)
 	}
 
 	i = list_entry(v, struct ipx_interface, node);
-	seq_printf(seq, "%08lX   ", (unsigned long int)ntohl(i->if_netnum));
+	seq_printf(seq, "%08X   ", ntohl(i->if_netnum));
 	seq_printf(seq, "%02X%02X%02X%02X%02X%02X   ",
 			i->if_node[0], i->if_node[1], i->if_node[2],
 			i->if_node[3], i->if_node[4], i->if_node[5]);
@@ -87,7 +87,7 @@ static int ipx_seq_route_show(struct seq_file *seq, void *v)
 
 	rt = list_entry(v, struct ipx_route, node);
 
-	seq_printf(seq, "%08lX   ", (unsigned long int)ntohl(rt->ir_net));
+	seq_printf(seq, "%08X   ", ntohl(rt->ir_net));
 	if (rt->ir_routed)
 		seq_printf(seq, "%08X     %02X%02X%02X%02X%02X%02X\n",
 			   ntohl(rt->ir_intrfc->if_netnum),
@@ -194,19 +194,19 @@ static int ipx_seq_socket_show(struct seq_file *seq, void *v)
 	s = v;
 	ipxs = ipx_sk(s);
 #ifdef CONFIG_IPX_INTERN
-	seq_printf(seq, "%08lX:%02X%02X%02X%02X%02X%02X:%04X  ",
-		   (unsigned long)ntohl(ipxs->intrfc->if_netnum),
+	seq_printf(seq, "%08X:%02X%02X%02X%02X%02X%02X:%04X  ",
+		   ntohl(ipxs->intrfc->if_netnum),
 		   ipxs->node[0], ipxs->node[1], ipxs->node[2], ipxs->node[3],
 		   ipxs->node[4], ipxs->node[5], ntohs(ipxs->port));
 #else
-	seq_printf(seq, "%08lX:%04X  ", (unsigned long) ntohl(ipxs->intrfc->if_netnum),
+	seq_printf(seq, "%08X:%04X  ", ntohl(ipxs->intrfc->if_netnum),
 		   ntohs(ipxs->port));
 #endif	/* CONFIG_IPX_INTERN */
 	if (s->sk_state != TCP_ESTABLISHED)
 		seq_printf(seq, "%-28s", "Not_Connected");
 	else {
-		seq_printf(seq, "%08lX:%02X%02X%02X%02X%02X%02X:%04X  ",
-			   (unsigned long)ntohl(ipxs->dest_addr.net),
+		seq_printf(seq, "%08X:%02X%02X%02X%02X%02X%02X:%04X  ",
+			   ntohl(ipxs->dest_addr.net),
 			   ipxs->dest_addr.node[0], ipxs->dest_addr.node[1],
 			   ipxs->dest_addr.node[2], ipxs->dest_addr.node[3],
 			   ipxs->dest_addr.node[4], ipxs->dest_addr.node[5],
-- 
1.9.3

^ permalink raw reply related

* [patch] SUNRPC: off by one in BUG_ON()
From: Dan Carpenter @ 2014-10-29  8:44 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: Trond Myklebust, David S. Miller,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

The m->pool_to[] array has "maxpools" number of elements.  It's
allocated in svc_pool_map_alloc_arrays() which we called earlier in the
function.  This test should be >= instead of >.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
This is very old code, but hopefully the off by one doesn't affect
runtime.

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index ca8a795..349c98f 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -189,7 +189,7 @@ svc_pool_map_init_percpu(struct svc_pool_map *m)
 		return err;
 
 	for_each_online_cpu(cpu) {
-		BUG_ON(pidx > maxpools);
+		BUG_ON(pidx >= maxpools);
 		m->to_pool[cpu] = pidx;
 		m->pool_to[pidx] = cpu;
 		pidx++;
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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

* Re: ipv6 mld: packets are not looped back to/from kernel/querier
From: Pierre Pfister @ 2014-10-29  8:49 UTC (permalink / raw)
  To: Pierre Pfister; +Cc: Daniel Borkmann, netdev, liuhangbin
In-Reply-To: <4F039FC5-0FE5-4944-8371-75F927B185C6@darou.fr>

It doesn’t work with 3.16 neither.

Cheers,

- Pierre

Le 29 oct. 2014 à 09:14, Pierre Pfister <pierre@darou.fr> a écrit :

> Thanks for the quick answer,
> 
> See inline,
> 
> Le 28 oct. 2014 à 19:17, Daniel Borkmann <dborkman@redhat.com> a écrit :
> 
>> On 10/28/2014 05:32 PM, Pierre Pfister wrote:
>>> Hello,
>>> 
>>> I’m implementing a dual-stack multicast querier (IGMPv3 and MLDv2) along with the PIM protocol.
>>> So I’ve got two multicast sockets, one for each protocol.
>>> 
>>> I open the two sockets like this:
>>> 
>>> ——————————————————
>>> fd = socket(AF_INET, SOCK_RAW, IPPROTO_IGMP);
>>> val = 1;
>>> setsockopt(fd, IPPROTO_IP, MRT_INIT, &val, sizeof(val));
>>> setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &val, sizeof(val));
>>> setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, &val, sizeof(val));
>>> val = 0xc0;
>>> setsockopt(fd, IPPROTO_IP, IP_TOS, &val, sizeof(val));
>>> setsockopt(fd, IPPROTO_IP, IP_OPTIONS, &ipv4_rtr_alert, sizeof(ipv4_rtr_alert))
>>> 
>>> fd = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
>>> val = 1;
>>> setsockopt(fd, IPPROTO_IPV6, MRT6_INIT, &val, sizeof(val));
>>> setsockopt(fd, IPPROTO_IPV6, IPV6_RECVHOPOPTS, &val, sizeof(val));
>>> setsockopt(fd, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &val, sizeof(val));
>>> setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &val, sizeof(val));
>>> val = 2;
>>> setsockopt(fd, IPPROTO_RAW, IPV6_CHECKSUM, &val, sizeof(val));
>>> setsockopt(fd, IPPROTO_IPV6, IPV6_HOPOPTS, &ipv6_rtr_alert, sizeof(ipv6_rtr_alert));
>> 
>> What kernel are you using? How do you setup ipv6_rtr_alert here?
>> 
>> For inbound queries in IPv6, the kernel might be more picky after
>> [correct] commit e940f5d6ba6a ("ipv6: Fix MLD Query message check"),
>> so you need to make sure you have hop limit of 1 and a proper set
>> up RA option …
> 
> I can reproduce the problem with both 3.10.28 and 3.14-0. I will try to try a later version.
> I don’t think the packet itself can be a problem as other routers correctly receive it.
> The problem comes with loopbacking to kernel and userspace (Depending whether the kernel or querier sent it).
> 
> Here is the router alert struct.
> static struct {
> 	struct ip6_hbh hdr;
> 	struct ip6_opt_router rt;
> 	uint8_t pad[2];
> } ipv6_rtr_alert = {
> 	.hdr = {0, 0},
> 	.rt = {IP6OPT_ROUTER_ALERT, 2, {0, IP6_ALERT_MLD}},
> 	.pad = {0, 0}
> }
> 
> I also checked what that commit checks (wiresharked), and everything seems correct.
> 
> Thanks,
> 
> - Pierre
> 
> 
> 
>> 
>>> struct icmp6_filter flt;
>>> ICMP6_FILTER_SETBLOCKALL(&flt);
>>> ICMP6_FILTER_SETPASS(ICMPV6_MGM_QUERY, &flt);
>>> ICMP6_FILTER_SETPASS(ICMPV6_MGM_REPORT, &flt);
>>> ICMP6_FILTER_SETPASS(ICMPV6_MGM_REDUCTION, &flt);
>>> ICMP6_FILTER_SETPASS(ICMPV6_MLD2_REPORT, &flt);
>>> setsockopt(fd, IPPROTO_ICMPV6, ICMP6_FILTER, &flt, sizeof(flt));
>>> ——————————————————————
>>> 
>>> I’ve got two issues with the IPv6 socket.
>>> When I send an MLD query, it is sent on the wire, but the kernel doesn’t interpret it (It doesn’t send MLD Reports as reply).
>>> Similarly, when the kernel sends a Report, my MLD Querier socket doesn’t receive the message.
>>> 
>>> The resulting problem is that everything works fine as long as the router doesn’t want to join a group. When it does, my Querier can’t know it, and the kernel doesn’t reply to Querier’s requests.
>>> 
>>> It works well in IPv4.
>>> 
>>> I tried removing the ICMPV6 filter as well as using IPV6_MULTICAST_LOOP.
>>> 
>>> Am I doing something wrong or is it an actual bug ?
>>> If you need more information, please ask.
>>> 
>>> Thanks,
>>> 
>>> 
>>> Pierre
>>> 
>>> 
>>> --
>>> 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
>>> 
>> --
>> 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
> 
> --
> 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

* [PATCH/TRIVIAL 1/1 net-next] ipv6: spelling s/incomming/incoming
From: Fabian Frederick @ 2014-10-29  9:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Fabian Frederick, David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, Jiri Kosina, netdev

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 net/ipv6/ip6mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 0171f08..467f310 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -2090,7 +2090,7 @@ static void ip6_mr_forward(struct net *net, struct mr6_table *mrt,
 	if (ipv6_addr_any(&cache->mf6c_origin) && true_vifi >= 0) {
 		struct mfc6_cache *cache_proxy;
 
-		/* For an (*,G) entry, we only check that the incomming
+		/* For an (*,G) entry, we only check that the incoming
 		 * interface is part of the static tree.
 		 */
 		cache_proxy = ip6mr_cache_find_any_parent(mrt, vif);
-- 
1.9.3

^ permalink raw reply related

* spin lock held between 2 process
From: Chetan C R @ 2014-10-29  9:02 UTC (permalink / raw)
  To: netdev

Hi,

In 3.4 kernel facing this issue.


[58762.332116] PID: 23472, Name: wlanconfig
[58762.337490] Backtrace:
[58762.339926] [<c001256c>] (dump_backtrace+0x0/0x10c) from
[<c0012894>] (show_stack+0x18/0x1c)
[58762.348330] r6:36b4a597 r5:c0744258 r4:d7dc1600 r3:c07003c4
[58762.353984] [<c001287c>] (show_stack+0x0/0x1c) from [<c0046828>]
(wdog_handler+0x16c/0x1b4)
[58762.362763] [<c00466bc>] (wdog_handler+0x0/0x1b4) from [<c00a0af0>]
(handle_percpu_devid_irq+0x88/0xa8)
[58762.372572] [<c00a0a68>] (handle_percpu_devid_irq+0x0/0xa8) from
[<c009d234>] (generic_handle_irq+0x34/0x48)
[58762.382382] r8:00000000 r7:c0741df0 r6:c0700f20 r5:00000014 r4:d2630000
[58762.388880] r3:c00a0a68
[58762.391473] [<c009d200>] (generic_handle_irq+0x0/0x48) from
[<c000f6d8>] (handle_IRQ+0x84/0xb0)
[58762.400157] [<c000f654>] (handle_IRQ+0x0/0xb0) from [<c000861c>]
(gic_handle_irq+0x70/0xc4)
[58762.408499] r8:d2631be8 r7:fa003000 r6:00000014 r5:c07410e4 r4:00000014
[58762.414997] r3:00000004
[58762.417621] [<c00085ac>] (gic_handle_irq+0x0/0xc4) from
[<c000ea00>] (__irq_svc+0x40/0x70)
[58762.425868] Exception stack(0xd2631be8 to 0xd2631c30)
[58762.430898] 1be0: c07f1430 0000c5db 00000001 00000000 c5dac5dc d860840c
[58762.439052] 1c00: d792c000 d7557800 d7557800 d2630000 d8608400
d2631c44 20000013 d2631c34
[58762.447205] 1c20: c0123228 c03614f4 60000013 ffffffff
[58762.452266] [<c0361498>] (_raw_spin_lock+0x0/0x9c) from
[<c0123228>] (unregister_sysctl_table+0x64/0x7c)
[58762.461701] r4:d460f400
[58762.464231] [<c01231c4>] (unregister_sysctl_table+0x0/0x7c) from
[<c0347e9c>] (unregister_net_sysctl_table+0x10/0x14)
[58762.474822] r7:d7557800 r6:d7557800 r5:d860840c r4:d460f400
[58762.480476] [<c0347e8c>] (unregister_net_sysctl_table+0x0/0x14)
from [<c0317710>] (__devinet_sysctl_unregister+0x28/0x3c)
[58762.491410] [<c03176e8>] (__devinet_sysctl_unregister+0x0/0x3c)
from [<c0317c9c>] (inetdev_event+0x2e8/0x454)
[58762.501282] r4:00000000 r3:d7dc1600
[58762.504875] [<c03179b4>] (inetdev_event+0x0/0x454) from
[<c007aebc>] (notifier_call_chain+0x34/0x74)
[58762.513966] [<c007ae88>] (notifier_call_chain+0x0/0x74) from
[<c007afd0>] (raw_notifier_call_chain+0x20/0x28)
[58762.523869] r8:00200200 r7:c0824e40 r6:d2631d68 r5:d7557800 r4:00000006
[58762.530367] r3:ffffffff
[58762.532991] [<c007afb0>] (raw_notifier_call_chain+0x0/0x28) from
[<c02c2390>] (call_netdevice_notifiers+0x44/0x54)
[58762.543300] [<c02c234c>] (call_netdevice_notifiers+0x0/0x54) from
[<c02c2770>] (rollback_registered_many+0x1d0/0x2e0)
[58762.553891] r5:0000029e r4:d7557800
[58762.557452] [<c02c25a0>] (rollback_registered_many+0x0/0x2e0) from
[<c02c2918>] (rollback_registered+0x30/0x48)
[58762.567543] [<c02c28e8>] (rollback_registered+0x0/0x48) from
[<c02c4024>] (unregister_netdevice_queue+0x70/0xa0)
[58762.577821] [<c02c3fb4>] (unregister_netdevice_queue+0x0/0xa0) from
[<bf36a768>] (mac-driver_ioctl_delete_vap+0x188/0x1a0 [mac-driver])
[58762.588786] r5:d25b4000 r4:00000000
[58762.592504] [<bf36a5e0>] (mac-driver_ioctl_delete_vap+0x0/0x1a0
[mac-driver]) from [<bf361e88>] (ieee80211_ioctl+0x180/0x1400
[mac-driver])
[58762.603375] [<bf361d08>] (ieee80211_ioctl+0x0/0x1400 [mac-driver])
from [<c02c5d34>] (dev_ifsioc+0x314/0x334)
[58762.612654] [<c02c5a20>] (dev_ifsioc+0x0/0x334) from [<c02c64f8>]
(dev_ioctl+0x7a4/0x86c)
[58762.620839] r7:00000000 r6:c0824e40 r5:000089f8 r4:00000000
[58762.626462] [<c02c5d54>] (dev_ioctl+0x0/0x86c) from [<c02b0b88>]
(sock_ioctl+0x3c/0x288)
[58762.634553] [<c02b0b4c>] (sock_ioctl+0x0/0x288) from [<c00e8eb8>]
(do_vfs_ioctl+0x5a8/0x608)
[58762.642957] r6:be8900a8 r5:db248000 r4:d4f08aa0 r3:c02b0b4c
[58762.648611] [<c00e8910>] (do_vfs_ioctl+0x0/0x608) from [<c00e8f58>]
(sys_ioctl+0x40/0x64)
[58762.656765] r8:c000ef84 r7:db248000 r6:be8900a8 r5:000089f8 r4:00000003
[58762.663450] [<c00e8f18>] (sys_ioctl+0x0/0x64) from [<c000ee00>]
(ret_fast_syscall+0x0/0x30)
[58762.671791] r7:00000036 r6:00000003 r5:000089f8 r4:be8900a8

…

[58763.810779] PID: 26771, Name: lua
[58763.815528] Backtrace: no frame pointer
[58763.819370] Kernel panic - not syncing:
[58763.825712] CPU1: stopping
[58763.828399] Backtrace:
[58763.830835] [<c001256c>] (dump_backtrace+0x0/0x10c) from
[<c0359d8c>] (dump_stack+0x18/0x1c)
[58763.839239] r6:d789a000 r5:c07410e4 r4:00000001 r3:c07003c4
[58763.844894] [<c0359d74>] (dump_stack+0x0/0x1c) from [<c00145b0>]
(handle_IPI+0x100/0x1c4)
[58763.853047] [<c00144b0>] (handle_IPI+0x0/0x1c4) from [<c0008664>]
(gic_handle_irq+0xb8/0xc4)
[58763.861451] [<c00085ac>] (gic_handle_irq+0x0/0xc4) from
[<c000ea00>] (__irq_svc+0x40/0x70)
[58763.869698] Exception stack(0xd789bcc0 to 0xd789bd08)
[58763.874728] bcc0: c07f1430 0000c5dc 00000001 00000000 c5dac5dd
ddb22890 00000081 ddb22890
[58763.882913] bce0: 00000000 d789a000 d789a000 d789bd1c 20000013
d789bd0c c0122a80 c03614f4
[58763.891067] bd00: 60000013 ffffffff
[58763.894534] [<c0361498>] (_raw_spin_lock+0x0/0x9c) from
[<c0122a80>] (sysctl_head_grab+0x20/0x4c)
[58763.903375] r4:c0767c54
[58763.905906] [<c0122a60>] (sysctl_head_grab+0x0/0x4c) from
[<c0122acc>] (grab_header+0x20/0x28)
[58763.914497] r4:ddb22890 r3:c0767c54
[58763.918058] [<c0122aac>] (grab_header+0x0/0x28) from [<c0123cb4>]
(proc_sys_permission+0x38/0x80)
[58763.926930] [<c0123c7c>] (proc_sys_permission+0x0/0x80) from
[<c00e399c>] (inode_permission+0x7c/0xc0)
[58763.936209] r6:00000081 r5:ddb22890 r4:d24fc00a r3:c0123c7c
[58763.941832] [<c00e3920>] (inode_permission+0x0/0xc0) from
[<c00e3f8c>] (link_path_walk+0x5c/0x7e0)
[58763.950767] r6:ddb22890 r5:d789be70 r4:d24fc00a r3:00000051
[58763.956421] [<c00e3f30>] (link_path_walk+0x0/0x7e0) from
[<c00e4cc0>] (path_lookupat+0x5c/0x6c4)
[58763.965200] [<c00e4c64>] (path_lookupat+0x0/0x6c4) from
[<c00e534c>] (do_path_lookup+0x24/0x60)
[58763.973884] [<c00e5328>] (do_path_lookup+0x0/0x60) from
[<c00e698c>] (user_path_at_empty+0x60/0x90)
[58763.982913] r7:ffffff9c r6:d789be70 r5:d24fc000 r4:00000001
[58763.988536] [<c00e692c>] (user_path_at_empty+0x0/0x90) from
[<c00e69d8>] (user_path_at+0x1c/0x24)
[58763.997408] r8:c000ef84 r7:000000c3 r6:00000000 r5:d789bf40 r4:beaf1cb8
[58764.004094] [<c00e69bc>] (user_path_at+0x0/0x24) from [<c00dd8b4>]
(vfs_fstatat+0x3c/0x6c)
[58764.012341] [<c00dd878>] (vfs_fstatat+0x0/0x6c) from [<c00dd930>]
(vfs_stat+0x24/0x28)
[58764.020214] r5:00e2f438 r4:beaf1cb8
[58764.023775] [<c00dd90c>] (vfs_stat+0x0/0x28) from [<c00ddb0c>]
(sys_stat64+0x1c/0x38)
[58764.031616] [<c00ddaf0>] (sys_stat64+0x0/0x38) from [<c000ee00>]
(ret_fast_syscall+0x0/0x30)

Facing this look up issue in 3.4.0 kernel. Any pointers to resolve this issue?

Thanks,

^ permalink raw reply

* Re: [PATCH] PPC: bpf_jit_comp: add SKF_AD_PKTTYPE instruction
From: Denis Kirjanov @ 2014-10-29  9:21 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Denis Kirjanov, Matt Evans, netdev
In-Reply-To: <1414351406-4122-1-git-send-email-kda@linux-powerpc.org>

Any feedback from PPC folks?

On 10/26/14, Denis Kirjanov <kda@linux-powerpc.org> wrote:
> Cc: Matt Evans <matt@ozlabs.org>
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
> ---
>  arch/powerpc/include/asm/ppc-opcode.h | 1 +
>  arch/powerpc/net/bpf_jit.h            | 7 +++++++
>  arch/powerpc/net/bpf_jit_comp.c       | 5 +++++
>  3 files changed, 13 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/ppc-opcode.h
> b/arch/powerpc/include/asm/ppc-opcode.h
> index 6f85362..1a52877 100644
> --- a/arch/powerpc/include/asm/ppc-opcode.h
> +++ b/arch/powerpc/include/asm/ppc-opcode.h
> @@ -204,6 +204,7 @@
>  #define PPC_INST_ERATSX_DOT		0x7c000127
>
>  /* Misc instructions for BPF compiler */
> +#define PPC_INST_LBZ			0x88000000
>  #define PPC_INST_LD			0xe8000000
>  #define PPC_INST_LHZ			0xa0000000
>  #define PPC_INST_LHBRX			0x7c00062c
> diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
> index 9aee27c..c406aa9 100644
> --- a/arch/powerpc/net/bpf_jit.h
> +++ b/arch/powerpc/net/bpf_jit.h
> @@ -87,6 +87,9 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
>  #define PPC_STD(r, base, i)	EMIT(PPC_INST_STD | ___PPC_RS(r) |	      \
>  				     ___PPC_RA(base) | ((i) & 0xfffc))
>
> +
> +#define PPC_LBZ(r, base, i)	EMIT(PPC_INST_LBZ | ___PPC_RT(r) |	      \
> +				     ___PPC_RA(base) | IMM_L(i))
>  #define PPC_LD(r, base, i)	EMIT(PPC_INST_LD | ___PPC_RT(r) |	      \
>  				     ___PPC_RA(base) | IMM_L(i))
>  #define PPC_LWZ(r, base, i)	EMIT(PPC_INST_LWZ | ___PPC_RT(r) |	      \
> @@ -96,6 +99,10 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
>  #define PPC_LHBRX(r, base, b)	EMIT(PPC_INST_LHBRX | ___PPC_RT(r) |	      \
>  				     ___PPC_RA(base) | ___PPC_RB(b))
>  /* Convenience helpers for the above with 'far' offsets: */
> +#define PPC_LBZ_OFFS(r, base, i) do { if ((i) < 32768) PPC_LBZ(r, base, i);
>   \
> +		else {	PPC_ADDIS(r, base, IMM_HA(i));			      \
> +			PPC_LBZ(r, r, IMM_L(i)); } } while(0)
> +
>  #define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i);
>   \
>  		else {	PPC_ADDIS(r, base, IMM_HA(i));			      \
>  			PPC_LD(r, r, IMM_L(i)); } } while(0)
> diff --git a/arch/powerpc/net/bpf_jit_comp.c
> b/arch/powerpc/net/bpf_jit_comp.c
> index cbae2df..d110e28 100644
> --- a/arch/powerpc/net/bpf_jit_comp.c
> +++ b/arch/powerpc/net/bpf_jit_comp.c
> @@ -407,6 +407,11 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32
> *image,
>  			PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
>  							  queue_mapping));
>  			break;
> +		case BPF_ANC | SKF_AD_PKTTYPE:
> +			PPC_LBZ_OFFS(r_A, r_skb, PKT_TYPE_OFFSET());
> +			PPC_ANDI(r_A, r_A, PKT_TYPE_MAX);
> +			PPC_SRWI(r_A, r_A, 5);
> +			break;
>  		case BPF_ANC | SKF_AD_CPU:
>  #ifdef CONFIG_SMP
>  			/*
> --
> 2.1.0
>
>

^ permalink raw reply

* Re: [PATCH v2 net-next] net: ipv6: Add a sysctl to make optimistic addresses useful candidates
From: Erik Kline @ 2014-10-29  9:36 UTC (permalink / raw)
  To: Hannes Frederic Sowa
  Cc: netdev@vger.kernel.org, David Miller, Ben Hutchings,
	Lorenzo Colitti
In-Reply-To: <CAAedzxptbKLrO_0uPVqXiqOACqNNj9BeeakgB3+t+XxemeN3Sw@mail.gmail.com>

(resending; sorry for the dup; my text mail setting was defeated)-:

On Wed, Oct 29, 2014 at 6:34 PM, Erik Kline <ek@google.com> wrote:
> Hannes,
>
> Given that we spoke about this reduction in the number of netlink messages
> earlier, do you still think it's an issue?
>
> The end result here is that for listeners on netlink sockets on systems that
> (a) have optimistic dad built-in, (b) have optimistic dad enabled, and (c)
> have use_optimistic set: they'll 2 notifications (with different flags) for
> automatically added addresses on these interfaces.
>
> (Personally, given that we appear to send an RTM_NEWADDR when the address
> gets deprecated (I think), I think sending one on every flag change of
> interest is in keeping with existing behaviour.)
>
> On Wed Oct 29 2014 at 12:15:59 AM Lorenzo Colitti <lorenzo@google.com>
> wrote:
>>
>> On Tue, Oct 28, 2014 at 6:11 PM, Erik Kline <ek@google.com> wrote:
>> > Add a sysctl that causes an interface's optimistic addresses
>> > to be considered equivalent to other non-deprecated addresses
>> > for source address selection purposes.  Preferred addresses
>> > will still take precedence over optimistic addresses, subject
>> > to other ranking in the source address selection algorithm.
>> > ...
>> > Signed-off-by: Erik Kline <ek@google.com>
>>
>> Acked-by: Lorenzo Colitti <lorenzo@google.com>

^ permalink raw reply

* Re: [PATCH] mac80211_hwsim: release driver when ieee80211_register_hw fails
From: Junjie Mao @ 2014-10-29 10:23 UTC (permalink / raw)
  To: Martin Pitt
  Cc: Junjie Mao, Fengguang Wu, linux-wireless, netdev, linux-kernel
In-Reply-To: <20141029064501.GB2985@piware.de>

I was not familiar with the acquiring/releasing API either, until I met
with this bug...

Perhaps we can use static checkers to avoid these issues as early as
possible. Any suggestions?

Best Regards
Junjie Mao

Martin Pitt <martin.pitt@ubuntu.com> writes:

> Acked-By: Martin Pitt <martin.pitt@ubuntu.com>
>
> Hello Junjie,
>
> Junjie Mao [2014-10-28  9:31 +0800]:
>> The driver is not released when ieee80211_register_hw fails in
>> mac80211_hwsim_create_radio, leading to the access to the unregistered (and
>> possibly freed) device in platform_driver_unregister:
>
> Many thanks for fixing this! Sorry about that, I don't know these bits
> very well.
>
> Martin

^ permalink raw reply

* [PATCH 1/1 net-next] ipv6: remove inline on static in c file
From: Fabian Frederick @ 2014-10-29 10:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: Fabian Frederick, David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev

remove __inline__ / inline and let compiler decide what to do
with static functions

Inspired-by: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 net/ipv6/reassembly.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 1a157ca..51ab096 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -69,7 +69,7 @@ struct ip6frag_skb_cb {
 
 #define FRAG6_CB(skb)	((struct ip6frag_skb_cb *)((skb)->cb))
 
-static inline u8 ip6_frag_ecn(const struct ipv6hdr *ipv6h)
+static u8 ip6_frag_ecn(const struct ipv6hdr *ipv6h)
 {
 	return 1 << (ipv6_get_dsfield(ipv6h) & INET_ECN_MASK);
 }
@@ -178,7 +178,7 @@ static void ip6_frag_expire(unsigned long data)
 	ip6_expire_frag_queue(net, fq, &ip6_frags);
 }
 
-static __inline__ struct frag_queue *
+static struct frag_queue *
 fq_find(struct net *net, __be32 id, const struct in6_addr *src,
 	const struct in6_addr *dst, u8 ecn)
 {
@@ -684,21 +684,21 @@ static void ip6_frags_sysctl_unregister(void)
 	unregister_net_sysctl_table(ip6_ctl_header);
 }
 #else
-static inline int ip6_frags_ns_sysctl_register(struct net *net)
+static int ip6_frags_ns_sysctl_register(struct net *net)
 {
 	return 0;
 }
 
-static inline void ip6_frags_ns_sysctl_unregister(struct net *net)
+static void ip6_frags_ns_sysctl_unregister(struct net *net)
 {
 }
 
-static inline int ip6_frags_sysctl_register(void)
+static int ip6_frags_sysctl_register(void)
 {
 	return 0;
 }
 
-static inline void ip6_frags_sysctl_unregister(void)
+static void ip6_frags_sysctl_unregister(void)
 {
 }
 #endif
-- 
1.9.3

^ permalink raw reply related

* YOUR URGENT ASSISTANCE NEEDED
From: LADY ROSE BANDA @ 2014-10-29 10:32 UTC (permalink / raw)

In-Reply-To: <925190213.82277.1414578567451.JavaMail.yahoo@jws100133.mail.ne1.yahoo.com>

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: MRS._LADY_ROSE BANDA.docx --]
[-- Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document, Size: 16473 bytes --]

^ permalink raw reply

* [PATCH 1/7] can: m_can: fix possible sleep in napi poll
From: Dong Aisheng @ 2014-10-29 10:45 UTC (permalink / raw)
  To: linux-can
  Cc: mkl, wg, varkabhadram, netdev, socketcan, b29396,
	linux-arm-kernel

The m_can_get_berr_counter function can sleep and it may be called in napi poll function.
Rework it to fix the following warning.
root@imx6qdlsolo:~# cangen can0 -f -L 12 -D 112233445566778899001122
[ 1846.017565] m_can 20e8000.can can0: entered error warning state
[ 1846.023551] ------------[ cut here ]------------
[ 1846.028216] WARNING: CPU: 0 PID: 560 at kernel/locking/mutex.c:867 mutex_trylock+0x218/0x23c()
[ 1846.036889] DEBUG_LOCKS_WARN_ON(in_interrupt())
[ 1846.041263] Modules linked in:
[ 1846.044594] CPU: 0 PID: 560 Comm: cangen Not tainted 3.17.0-rc4-next-20140915-00010-g032d018-dirty #477
[ 1846.054033] Backtrace:
[ 1846.056557] [<80012448>] (dump_backtrace) from [<80012728>] (show_stack+0x18/0x1c)
[ 1846.064180]  r6:809a07ec r5:809a07ec r4:00000000 r3:00000000
[ 1846.069966] [<80012710>] (show_stack) from [<806c9ee0>] (dump_stack+0x8c/0xa4)
[ 1846.077264] [<806c9e54>] (dump_stack) from [<8002aa78>] (warn_slowpath_common+0x70/0x94)
[ 1846.085403]  r6:806cd1b0 r5:00000009 r4:be1d5c20 r3:be07b0c0
[ 1846.091204] [<8002aa08>] (warn_slowpath_common) from [<8002aad4>] (warn_slowpath_fmt+0x38/0x40)
[ 1846.099951]  r8:8119106c r7:80515aa4 r6:be027000 r5:00000001 r4:809d1df4
[ 1846.106830] [<8002aaa0>] (warn_slowpath_fmt) from [<806cd1b0>] (mutex_trylock+0x218/0x23c)
[ 1846.115141]  r3:80851c88 r2:8084fb74
[ 1846.118804] [<806ccf98>] (mutex_trylock) from [<80515aa4>] (clk_prepare_lock+0x14/0xf4)
[ 1846.126859]  r8:00000040 r7:be1d5cec r6:be027000 r5:be255800 r4:be027000
[ 1846.133737] [<80515a90>] (clk_prepare_lock) from [<80517660>] (clk_prepare+0x14/0x2c)
[ 1846.141583]  r5:be255800 r4:be027000
[ 1846.145272] [<8051764c>] (clk_prepare) from [<8041ff14>] (m_can_get_berr_counter+0x20/0xd4)
[ 1846.153672]  r4:be255800 r3:be07b0c0
[ 1846.157325] [<8041fef4>] (m_can_get_berr_counter) from [<80420428>] (m_can_poll+0x310/0x8fc)
[ 1846.165809]  r7:bd4dc540 r6:00000744 r5:11300000 r4:be255800
[ 1846.171590] [<80420118>] (m_can_poll) from [<8056a468>] (net_rx_action+0xcc/0x1b4)
[ 1846.179204]  r10:00000101 r9:be255ebc r8:00000040 r7:be7c3208 r6:8097c100 r5:be7c3200
[ 1846.187192]  r4:0000012c
[ 1846.189779] [<8056a39c>] (net_rx_action) from [<8002deec>] (__do_softirq+0xfc/0x2c4)
[ 1846.197568]  r10:00000101 r9:8097c088 r8:00000003 r7:8097c080 r6:40000001 r5:8097c08c
[ 1846.205559]  r4:00000020
[ 1846.208144] [<8002ddf0>] (__do_softirq) from [<8002e194>] (do_softirq+0x7c/0x88)
[ 1846.215588]  r10:00000000 r9:bd516a60 r8:be18ce00 r7:00000000 r6:be255800 r5:8056c0ec
[ 1846.223578]  r4:60000093
[ 1846.226163] [<8002e118>] (do_softirq) from [<8002e288>] (__local_bh_enable_ip+0xe8/0x10c)
[ 1846.234386]  r4:00000200 r3:be1d4000
[ 1846.238036] [<8002e1a0>] (__local_bh_enable_ip) from [<8056c108>] (__dev_queue_xmit+0x314/0x6b0)
[ 1846.246868]  r6:be255800 r5:bd516a00 r4:00000000 r3:be07b0c0
[ 1846.252645] [<8056bdf4>] (__dev_queue_xmit) from [<8056c4b8>] (dev_queue_xmit+0x14/0x18)

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/net/can/m_can/m_can.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 10d571e..8692848 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -481,11 +481,23 @@ static int m_can_handle_lec_err(struct net_device *dev,
 	return 1;
 }
 
+static int __m_can_get_berr_counter(const struct net_device *dev,
+				    struct can_berr_counter *bec)
+{
+	struct m_can_priv *priv = netdev_priv(dev);
+	unsigned int ecr;
+
+	ecr = m_can_read(priv, M_CAN_ECR);
+	bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT;
+	bec->txerr = ecr & ECR_TEC_MASK;
+
+	return 0;
+}
+
 static int m_can_get_berr_counter(const struct net_device *dev,
 				  struct can_berr_counter *bec)
 {
 	struct m_can_priv *priv = netdev_priv(dev);
-	unsigned int ecr;
 	int err;
 
 	err = clk_prepare_enable(priv->hclk);
@@ -498,9 +510,7 @@ static int m_can_get_berr_counter(const struct net_device *dev,
 		return err;
 	}
 
-	ecr = m_can_read(priv, M_CAN_ECR);
-	bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT;
-	bec->txerr = ecr & ECR_TEC_MASK;
+	__m_can_get_berr_counter(dev, bec);
 
 	clk_disable_unprepare(priv->cclk);
 	clk_disable_unprepare(priv->hclk);
@@ -544,7 +554,7 @@ static int m_can_handle_state_change(struct net_device *dev,
 	if (unlikely(!skb))
 		return 0;
 
-	m_can_get_berr_counter(dev, &bec);
+	__m_can_get_berr_counter(dev, &bec);
 
 	switch (new_state) {
 	case CAN_STATE_ERROR_ACTIVE:
-- 
1.9.1


^ permalink raw reply related

* [PATCH 2/7] can: m_can: fix the incorrect error messages
From: Dong Aisheng @ 2014-10-29 10:45 UTC (permalink / raw)
  To: linux-can
  Cc: netdev, varkabhadram, mkl, linux-arm-kernel, socketcan, b29396,
	wg
In-Reply-To: <1414579527-31100-1-git-send-email-b29396@freescale.com>

Fix a few error messages.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/net/can/m_can/m_can.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 8692848..2784423 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -606,14 +606,14 @@ static int m_can_handle_state_errors(struct net_device *dev, u32 psr)
 
 	if ((psr & PSR_EP) &&
 	    (priv->can.state != CAN_STATE_ERROR_PASSIVE)) {
-		netdev_dbg(dev, "entered error warning state\n");
+		netdev_dbg(dev, "entered error passive state\n");
 		work_done += m_can_handle_state_change(dev,
 						       CAN_STATE_ERROR_PASSIVE);
 	}
 
 	if ((psr & PSR_BO) &&
 	    (priv->can.state != CAN_STATE_BUS_OFF)) {
-		netdev_dbg(dev, "entered error warning state\n");
+		netdev_dbg(dev, "entered error bus off state\n");
 		work_done += m_can_handle_state_change(dev,
 						       CAN_STATE_BUS_OFF);
 	}
@@ -625,7 +625,7 @@ static void m_can_handle_other_err(struct net_device *dev, u32 irqstatus)
 {
 	if (irqstatus & IR_WDI)
 		netdev_err(dev, "Message RAM Watchdog event due to missing READY\n");
-	if (irqstatus & IR_BEU)
+	if (irqstatus & IR_ELO)
 		netdev_err(dev, "Error Logging Overflow\n");
 	if (irqstatus & IR_BEU)
 		netdev_err(dev, "Bit Error Uncorrected\n");
-- 
1.9.1

^ permalink raw reply related

* [PATCH 3/7] can: m_can: add .ndo_change_mtu function
From: Dong Aisheng @ 2014-10-29 10:45 UTC (permalink / raw)
  To: linux-can
  Cc: netdev, varkabhadram, mkl, linux-arm-kernel, socketcan, b29396,
	wg
In-Reply-To: <1414579527-31100-1-git-send-email-b29396@freescale.com>

Use common can_change_mtu function.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/net/can/m_can/m_can.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 2784423..e4ef146 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1002,6 +1002,7 @@ static const struct net_device_ops m_can_netdev_ops = {
 	.ndo_open = m_can_open,
 	.ndo_stop = m_can_close,
 	.ndo_start_xmit = m_can_start_xmit,
+	.ndo_change_mtu = can_change_mtu,
 };
 
 static int register_m_can_dev(struct net_device *dev)
-- 
1.9.1

^ permalink raw reply related

* [PATCH 4/7] can: m_can: add a bit delay after setting CCCR_INIT bit
From: Dong Aisheng @ 2014-10-29 10:45 UTC (permalink / raw)
  To: linux-can
  Cc: netdev, varkabhadram, mkl, linux-arm-kernel, socketcan, b29396,
	wg
In-Reply-To: <1414579527-31100-1-git-send-email-b29396@freescale.com>

The spec mentions there may be a delay until the value written to
INIT can be read back due to the synchronization mechanism between the
two clock domains. But it does not indicate the exact clock cycles needed.
The 5us delay is a test value and seems ok.

Without the delay, CCCR.CCE bit may fail to be set and then the
initialization fail sometimes when do repeatly up and down.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/net/can/m_can/m_can.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index e4ef146..6160b9c 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -296,6 +296,7 @@ static inline void m_can_config_endisable(const struct m_can_priv *priv,
 	if (enable) {
 		/* enable m_can configuration */
 		m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT);
+		udelay(5);
 		/* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */
 		m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE);
 	} else {
-- 
1.9.1

^ permalink raw reply related

* [PATCH 5/7] can: clear ctrlmode when close candev
From: Dong Aisheng @ 2014-10-29 10:45 UTC (permalink / raw)
  To: linux-can
  Cc: netdev, varkabhadram, mkl, linux-arm-kernel, socketcan, b29396,
	wg
In-Reply-To: <1414579527-31100-1-git-send-email-b29396@freescale.com>

Currently priv->ctrlmode is not cleared when close_candev, so next time
the driver will still use this value to set controller even user
does not set any ctrl mode.
e.g.
Step 1. ip link set can0 up type can0 bitrate 1000000 loopback on
Controller will be in loopback mode
Step 2. ip link set can0 down
Step 3. ip link set can0 up type can0 bitrate 1000000
Controller will still be set to loopback mode in driver due to saved
priv->ctrlmode.

This patch clears priv->ctrlmode when the CAN interface is closed,
and set it to correct mode according to next user setting.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/net/can/dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 02492d2..1fce485 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -671,6 +671,7 @@ void close_candev(struct net_device *dev)
 
 	del_timer_sync(&priv->restart_timer);
 	can_flush_echo_skb(dev);
+	priv->ctrlmode = 0;
 }
 EXPORT_SYMBOL_GPL(close_candev);
 
-- 
1.9.1

^ permalink raw reply related

* [PATCH 6/7] can: m_can: update to support CAN FD features
From: Dong Aisheng @ 2014-10-29 10:45 UTC (permalink / raw)
  To: linux-can
  Cc: mkl, wg, varkabhadram, netdev, socketcan, b29396,
	linux-arm-kernel
In-Reply-To: <1414579527-31100-1-git-send-email-b29396@freescale.com>

Bosch M_CAN is CAN FD capable device.
This patch implements the CAN FD features include up to 64 bytes
payload and bitrate switch function.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/net/can/m_can/m_can.c | 138 +++++++++++++++++++++++++++++++++---------
 1 file changed, 110 insertions(+), 28 deletions(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 6160b9c..219e0e3 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -105,14 +105,36 @@ enum m_can_mram_cfg {
 	MRAM_CFG_NUM,
 };
 
+/* Fast Bit Timing & Prescaler Register (FBTP) */
+#define FBTR_FBRP_MASK		0x1f
+#define FBTR_FBRP_SHIFT		16
+#define FBTR_FTSEG1_SHIFT	8
+#define FBTR_FTSEG1_MASK	(0xf << FBTR_FTSEG1_SHIFT)
+#define FBTR_FTSEG2_SHIFT	4
+#define FBTR_FTSEG2_MASK	(0x7 << FBTR_FTSEG2_SHIFT)
+#define FBTR_FSJW_SHIFT		0
+#define FBTR_FSJW_MASK		0x3
+
 /* Test Register (TEST) */
 #define TEST_LBCK	BIT(4)
 
 /* CC Control Register(CCCR) */
-#define CCCR_TEST	BIT(7)
-#define CCCR_MON	BIT(5)
-#define CCCR_CCE	BIT(1)
-#define CCCR_INIT	BIT(0)
+#define CCCR_TEST		BIT(7)
+#define CCCR_CMR_MASK		0x3
+#define CCCR_CMR_SHIFT		10
+#define CCCR_CMR_CANFD		0x1
+#define CCCR_CMR_CANFD_BRS	0x2
+#define CCCR_CMR_CAN		0x3
+#define CCCR_CME_MASK		0x3
+#define CCCR_CME_SHIFT		8
+#define CCCR_CME_CAN		0
+#define CCCR_CME_CANFD		0x1
+#define CCCR_CME_CANFD_BRS	0x2
+#define CCCR_TEST		BIT(7)
+#define CCCR_MON		BIT(5)
+#define CCCR_CCE		BIT(1)
+#define CCCR_INIT		BIT(0)
+#define CCCR_CANFD		0x10
 
 /* Bit Timing & Prescaler Register (BTP) */
 #define BTR_BRP_MASK		0x3ff
@@ -204,6 +226,7 @@ enum m_can_mram_cfg {
 
 /* Rx Buffer / FIFO Element Size Configuration (RXESC) */
 #define M_CAN_RXESC_8BYTES	0x0
+#define M_CAN_RXESC_64BYTES	0x777
 
 /* Tx Buffer Configuration(TXBC) */
 #define TXBC_NDTB_OFF		16
@@ -211,6 +234,7 @@ enum m_can_mram_cfg {
 
 /* Tx Buffer Element Size Configuration(TXESC) */
 #define TXESC_TBDS_8BYTES	0x0
+#define TXESC_TBDS_64BYTES	0x7
 
 /* Tx Event FIFO Con.guration (TXEFC) */
 #define TXEFC_EFS_OFF		16
@@ -219,11 +243,11 @@ enum m_can_mram_cfg {
 /* Message RAM Configuration (in bytes) */
 #define SIDF_ELEMENT_SIZE	4
 #define XIDF_ELEMENT_SIZE	8
-#define RXF0_ELEMENT_SIZE	16
-#define RXF1_ELEMENT_SIZE	16
+#define RXF0_ELEMENT_SIZE	72
+#define RXF1_ELEMENT_SIZE	72
 #define RXB_ELEMENT_SIZE	16
 #define TXE_ELEMENT_SIZE	8
-#define TXB_ELEMENT_SIZE	16
+#define TXB_ELEMENT_SIZE	72
 
 /* Message RAM Elements */
 #define M_CAN_FIFO_ID		0x0
@@ -231,11 +255,17 @@ enum m_can_mram_cfg {
 #define M_CAN_FIFO_DATA(n)	(0x8 + ((n) << 2))
 
 /* Rx Buffer Element */
+/* R0 */
 #define RX_BUF_ESI		BIT(31)
 #define RX_BUF_XTD		BIT(30)
 #define RX_BUF_RTR		BIT(29)
+/* R1 */
+#define RX_BUF_ANMF		BIT(31)
+#define RX_BUF_EDL		BIT(21)
+#define RX_BUF_BRS		BIT(20)
 
 /* Tx Buffer Element */
+/* R0 */
 #define TX_BUF_XTD		BIT(30)
 #define TX_BUF_RTR		BIT(29)
 
@@ -327,11 +357,12 @@ static inline void m_can_disable_all_interrupts(const struct m_can_priv *priv)
 	m_can_write(priv, M_CAN_ILE, 0x0);
 }
 
-static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf,
+static void m_can_read_fifo(const struct net_device *dev, struct canfd_frame *cf,
 			    u32 rxfs)
 {
 	struct m_can_priv *priv = netdev_priv(dev);
 	u32 id, fgi;
+	int i;
 
 	/* calculate the fifo get index for where to read data */
 	fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF;
@@ -341,15 +372,23 @@ static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf,
 	else
 		cf->can_id = (id >> 18) & CAN_SFF_MASK;
 
+	if (id & RX_BUF_ESI) {
+		cf->flags |= CANFD_ESI;
+		netdev_dbg(dev, "ESI Error\n");
+	}
+
 	if (id & RX_BUF_RTR) {
 		cf->can_id |= CAN_RTR_FLAG;
 	} else {
 		id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC);
-		cf->can_dlc = get_can_dlc((id >> 16) & 0x0F);
-		*(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi,
-							 M_CAN_FIFO_DATA(0));
-		*(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi,
-							 M_CAN_FIFO_DATA(1));
+		cf->len = can_dlc2len(get_canfd_dlc((id >> 16) & 0x0F));
+
+		if (id & RX_BUF_BRS)
+			cf->flags |= CANFD_BRS;
+
+		for (i = 0; i < cf->len; i += 4)
+			*(u32 *)(cf->data + i) =
+				m_can_fifo_read(priv, fgi, M_CAN_FIFO_DATA(i / 4));
 	}
 
 	/* acknowledge rx fifo 0 */
@@ -361,7 +400,7 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota)
 	struct m_can_priv *priv = netdev_priv(dev);
 	struct net_device_stats *stats = &dev->stats;
 	struct sk_buff *skb;
-	struct can_frame *frame;
+	struct canfd_frame *frame;
 	u32 pkts = 0;
 	u32 rxfs;
 
@@ -375,7 +414,7 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota)
 		if (rxfs & RXFS_RFL)
 			netdev_warn(dev, "Rx FIFO 0 Message Lost\n");
 
-		skb = alloc_can_skb(dev, &frame);
+		skb = alloc_canfd_skb(dev, &frame);
 		if (!skb) {
 			stats->rx_dropped++;
 			return pkts;
@@ -384,7 +423,7 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota)
 		m_can_read_fifo(dev, frame, rxfs);
 
 		stats->rx_packets++;
-		stats->rx_bytes += frame->can_dlc;
+		stats->rx_bytes += frame->len;
 
 		netif_receive_skb(skb);
 
@@ -744,10 +783,23 @@ static const struct can_bittiming_const m_can_bittiming_const = {
 	.brp_inc = 1,
 };
 
+static const struct can_bittiming_const m_can_data_bittiming_const = {
+	.name = KBUILD_MODNAME,
+	.tseg1_min = 2,		/* Time segment 1 = prop_seg + phase_seg1 */
+	.tseg1_max = 16,
+	.tseg2_min = 1,		/* Time segment 2 = phase_seg2 */
+	.tseg2_max = 8,
+	.sjw_max = 4,
+	.brp_min = 1,
+	.brp_max = 32,
+	.brp_inc = 1,
+};
+
 static int m_can_set_bittiming(struct net_device *dev)
 {
 	struct m_can_priv *priv = netdev_priv(dev);
 	const struct can_bittiming *bt = &priv->can.bittiming;
+	const struct can_bittiming *dbt = &priv->can.data_bittiming;
 	u16 brp, sjw, tseg1, tseg2;
 	u32 reg_btp;
 
@@ -758,7 +810,17 @@ static int m_can_set_bittiming(struct net_device *dev)
 	reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) |
 			(tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT);
 	m_can_write(priv, M_CAN_BTP, reg_btp);
-	netdev_dbg(dev, "setting BTP 0x%x\n", reg_btp);
+
+	if (priv->can.ctrlmode & CAN_CTRLMODE_FD) {
+		brp = dbt->brp - 1;
+		sjw = dbt->sjw - 1;
+		tseg1 = dbt->prop_seg + dbt->phase_seg1 - 1;
+		tseg2 = dbt->phase_seg2 - 1;
+		reg_btp = (brp << FBTR_FBRP_SHIFT) | (sjw << FBTR_FSJW_SHIFT) |
+				(tseg1 << FBTR_FTSEG1_SHIFT) |
+				(tseg2 << FBTR_FTSEG2_SHIFT);
+		m_can_write(priv, M_CAN_FBTP, reg_btp);
+	}
 
 	return 0;
 }
@@ -778,8 +840,8 @@ static void m_can_chip_config(struct net_device *dev)
 
 	m_can_config_endisable(priv, true);
 
-	/* RX Buffer/FIFO Element Size 8 bytes data field */
-	m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_8BYTES);
+	/* RX Buffer/FIFO Element Size 64 bytes data field */
+	m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_64BYTES);
 
 	/* Accept Non-matching Frames Into FIFO 0 */
 	m_can_write(priv, M_CAN_GFC, 0x0);
@@ -788,8 +850,8 @@ static void m_can_chip_config(struct net_device *dev)
 	m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) |
 		    priv->mcfg[MRAM_TXB].off);
 
-	/* only support 8 bytes firstly */
-	m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_8BYTES);
+	/* support 64 bytes payload */
+	m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_64BYTES);
 
 	m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) |
 		    priv->mcfg[MRAM_TXE].off);
@@ -804,7 +866,8 @@ static void m_can_chip_config(struct net_device *dev)
 		    RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off);
 
 	cccr = m_can_read(priv, M_CAN_CCCR);
-	cccr &= ~(CCCR_TEST | CCCR_MON);
+	cccr &= ~(CCCR_TEST | CCCR_MON | (CCCR_CMR_MASK << CCCR_CMR_SHIFT) |
+		(CCCR_CME_MASK << CCCR_CME_SHIFT));
 	test = m_can_read(priv, M_CAN_TEST);
 	test &= ~TEST_LBCK;
 
@@ -816,6 +879,9 @@ static void m_can_chip_config(struct net_device *dev)
 		test |= TEST_LBCK;
 	}
 
+	if (priv->can.ctrlmode & CAN_CTRLMODE_FD)
+		cccr |= CCCR_CME_CANFD_BRS << CCCR_CME_SHIFT;
+
 	m_can_write(priv, M_CAN_CCCR, cccr);
 	m_can_write(priv, M_CAN_TEST, test);
 
@@ -880,11 +946,13 @@ static struct net_device *alloc_m_can_dev(void)
 
 	priv->dev = dev;
 	priv->can.bittiming_const = &m_can_bittiming_const;
+	priv->can.data_bittiming_const = &m_can_data_bittiming_const;
 	priv->can.do_set_mode = m_can_set_mode;
 	priv->can.do_get_berr_counter = m_can_get_berr_counter;
 	priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |
 					CAN_CTRLMODE_LISTENONLY |
-					CAN_CTRLMODE_BERR_REPORTING;
+					CAN_CTRLMODE_BERR_REPORTING |
+					CAN_CTRLMODE_FD;
 
 	return dev;
 }
@@ -967,8 +1035,9 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb,
 				    struct net_device *dev)
 {
 	struct m_can_priv *priv = netdev_priv(dev);
-	struct can_frame *cf = (struct can_frame *)skb->data;
-	u32 id;
+	struct canfd_frame *cf = (struct canfd_frame *)skb->data;
+	u32 id, cccr;
+	int i;
 
 	if (can_dropped_invalid_skb(dev, skb))
 		return NETDEV_TX_OK;
@@ -987,11 +1056,24 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb,
 
 	/* message ram configuration */
 	m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id);
-	m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, cf->can_dlc << 16);
-	m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(0), *(u32 *)(cf->data + 0));
-	m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(1), *(u32 *)(cf->data + 4));
+	m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, can_len2dlc(cf->len) << 16);
+
+	for (i = 0; i < cf->len; i += 4)
+		m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(i / 4),
+				 *(u32 *)(cf->data + i));
+
 	can_put_echo_skb(skb, dev, 0);
 
+	if (priv->can.ctrlmode & CAN_CTRLMODE_FD) {
+		cccr = m_can_read(priv, M_CAN_CCCR);
+		cccr &= ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT);
+		if (cf->flags & CANFD_BRS
+			cccr |= CCCR_CMR_CANFD_BRS << CCCR_CMR_SHIFT;
+		else
+			cccr |= CCCR_CMR_CANFD << CCCR_CMR_SHIFT;
+		m_can_write(priv, M_CAN_CCCR, cccr);
+	}
+
 	/* enable first TX buffer to start transfer  */
 	m_can_write(priv, M_CAN_TXBTIE, 0x1);
 	m_can_write(priv, M_CAN_TXBAR, 0x1);
-- 
1.9.1


^ permalink raw reply related

* [PATCH 7/7] can: m_can: workaround for transmit data less than 4 bytes
From: Dong Aisheng @ 2014-10-29 10:45 UTC (permalink / raw)
  To: linux-can
  Cc: netdev, varkabhadram, mkl, linux-arm-kernel, socketcan, b29396,
	wg
In-Reply-To: <1414579527-31100-1-git-send-email-b29396@freescale.com>

We meet an IC issue that we have to write the full 8 bytes (whatever
value for the second word) in Message RAM to avoid bit error for transmit
data less than 4 bytes.

Without the workaround, we can easily see the following errors:
root@imx6qdlsolo:~# ip link set can0 up type can bitrate 1000000
[   66.882520] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
root@imx6qdlsolo:~# cansend can0 123#112233
[   66.935640] m_can 20e8000.can can0: Bit Error Uncorrected

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/net/can/m_can/m_can.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 219e0e3..f2d9ebe 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1058,10 +1058,19 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb,
 	m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id);
 	m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, can_len2dlc(cf->len) << 16);
 
-	for (i = 0; i < cf->len; i += 4)
+	for (i = 0; i < cf->len; i += 4) {
 		m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(i / 4),
 				 *(u32 *)(cf->data + i));
 
+		/* FIXME: we meet an IC issue that we have to write the full 8
+		 * bytes (whatever value for the second word) in Message RAM to
+		 * avoid bit error for transmit data less than 4 bytes
+		 */
+		if (cf->len <= 4)
+			m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(i / 4 + 1),
+					 0x0);
+	}
+
 	can_put_echo_skb(skb, dev, 0);
 
 	if (priv->can.ctrlmode & CAN_CTRLMODE_FD) {
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH] wireless: rt2x00: add new rt2800usb device
From: Stanislaw Gruszka @ 2014-10-29 11:02 UTC (permalink / raw)
  To: Cyril Brulebois
  Cc: Helmut Schaa, John W. Linville, linux-wireless, users, netdev,
	linux-kernel
In-Reply-To: <1414510961-28920-1-git-send-email-kibi@debian.org>

On Tue, Oct 28, 2014 at 04:42:41PM +0100, Cyril Brulebois wrote:
> 0x1b75 0xa200 AirLive WN-200USB wireless 11b/g/n dongle
> 
> References: https://bugs.debian.org/766802
> Reported-by: Martin Mokrejs <mmokrejs@fold.natur.cuni.cz>

Was this patch tested by reporter? I would rather see Reported-and-tested-by tag :-)

Stanislaw

^ permalink raw reply

* Re: [PATCH 1/2] xen-netback: Disable NAPI after disabling interrupts
From: Wei Liu @ 2014-10-29 11:05 UTC (permalink / raw)
  To: David Vrabel; +Cc: netdev, xen-devel, Ian Campbell, Wei Liu, Zoltan Kiss
In-Reply-To: <1414510171-12853-2-git-send-email-david.vrabel@citrix.com>

On Tue, Oct 28, 2014 at 03:29:30PM +0000, David Vrabel wrote:
> From: Zoltan Kiss <zoltan.kiss@linaro.org>
> 
> Otherwise the interrupt handler still calls napi_complete. Although it
> won't schedule NAPI again as either NAPI_STATE_DISABLE or
> NAPI_STATE_SCHED is set, it is just unnecessary, and it makes more
> sense to do this way.
> 
> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  drivers/net/xen-netback/interface.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
> index 895fe84..a6a32d3 100644
> --- a/drivers/net/xen-netback/interface.c
> +++ b/drivers/net/xen-netback/interface.c
> @@ -235,10 +235,10 @@ static void xenvif_down(struct xenvif *vif)
>  
>  	for (queue_index = 0; queue_index < num_queues; ++queue_index) {
>  		queue = &vif->queues[queue_index];
> -		napi_disable(&queue->napi);
>  		disable_irq(queue->tx_irq);
>  		if (queue->tx_irq != queue->rx_irq)
>  			disable_irq(queue->rx_irq);
> +		napi_disable(&queue->napi);
>  		del_timer_sync(&queue->credit_timeout);
>  	}
>  }
> -- 
> 1.7.10.4

^ permalink raw reply

* Re: [PATCH 2/2] xen-netback: Remove __GFP_COLD
From: Wei Liu @ 2014-10-29 11:05 UTC (permalink / raw)
  To: David Vrabel; +Cc: netdev, xen-devel, Ian Campbell, Wei Liu, Zoltan Kiss
In-Reply-To: <1414510171-12853-3-git-send-email-david.vrabel@citrix.com>

On Tue, Oct 28, 2014 at 03:29:31PM +0000, David Vrabel wrote:
> From: Zoltan Kiss <zoltan.kiss@linaro.org>
> 
> This flag is unnecessary, it came from some old code.
> 
> Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  drivers/net/xen-netback/netback.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
> index 25f4c06..730252c 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -1550,7 +1550,7 @@ static int xenvif_handle_frag_list(struct xenvif_queue *queue, struct sk_buff *s
>  		unsigned int len;
>  
>  		BUG_ON(i >= MAX_SKB_FRAGS);
> -		page = alloc_page(GFP_ATOMIC|__GFP_COLD);
> +		page = alloc_page(GFP_ATOMIC);
>  		if (!page) {
>  			int j;
>  			skb->truesize += skb->data_len;
> -- 
> 1.7.10.4

^ permalink raw reply

* Re: [PATCH] wireless: rt2x00: add new rt2800usb device
From: Cyril Brulebois @ 2014-10-29 11:12 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Helmut Schaa, John W. Linville, linux-wireless, users, netdev,
	linux-kernel
In-Reply-To: <20141029110214.GB2021@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

Stanislaw Gruszka <sgruszka@redhat.com> (2014-10-29):
> On Tue, Oct 28, 2014 at 04:42:41PM +0100, Cyril Brulebois wrote:
> > 0x1b75 0xa200 AirLive WN-200USB wireless 11b/g/n dongle
> > 
> > References: https://bugs.debian.org/766802
> > Reported-by: Martin Mokrejs <mmokrejs@fold.natur.cuni.cz>
> 
> Was this patch tested by reporter? I would rather see Reported-and-tested-by tag :-)

The reporter confirmed the following trick worked:

  # echo rt2800usb >> /etc/modules
  # echo 'install rt2800usb /sbin/modprobe --ignore-install rt2800usb $CMDLINE_OPTS && echo 1b75 a200 > /sys/bus/usb/drivers/rt2800usb/new_id' > /etc/modprobe.d/ralink.conf
  # modprobe -r rt2800usb ; modprobe rt2800usb

but I'll try and get this patch tested on top of 3.16.x (which is what
we have in Debian at the moment) if that's good enough for you.

Mraw,
KiBi.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: suspend/resume broken on 3.18-rc2
From: Fabio Estevam @ 2014-10-29 11:47 UTC (permalink / raw)
  To: fugang.duan@freescale.com, Anson Huang
  Cc: Frank.Li@freescale.com, Russell King, Shawn Guo,
	netdev@vger.kernel.org
In-Reply-To: <6278a77cdc594b3488b0ebc043f7d17b@BLUPR03MB373.namprd03.prod.outlook.com>

On Wed, Oct 29, 2014 at 3:46 AM, fugang.duan@freescale.com
<fugang.duan@freescale.com> wrote:

> Hi, Fabio,
>
> I test 3.18.0-rc2, and has some problems:
> - most of time, imx6sx-sdb cannot resume back regardless of nfs or SD rootfs, and power key also cannnot resume back.
> - when do "echo core > /sys/power/pm_test", and then do suspend/resume test, console key can wake up system, but no broken issue found in nfs.

Adding Anson in case he could look into this problem from a power
management perspective.

^ permalink raw reply

* Re: [PATCH] wireless: rt2x00: add new rt2800usb device
From: Stanislaw Gruszka @ 2014-10-29 11:48 UTC (permalink / raw)
  To: Cyril Brulebois
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	users-poMEt7QlJxcwIE2E9O76wjtx2kNaKg5H,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20141029111224.GC29720-xazfMhTT2R0@public.gmane.org>

On Wed, Oct 29, 2014 at 12:12:24PM +0100, Cyril Brulebois wrote:
> Stanislaw Gruszka <sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> (2014-10-29):
> > On Tue, Oct 28, 2014 at 04:42:41PM +0100, Cyril Brulebois wrote:
> > > 0x1b75 0xa200 AirLive WN-200USB wireless 11b/g/n dongle
> > > 
> > > References: https://bugs.debian.org/766802
> > > Reported-by: Martin Mokrejs <mmokrejs-08dBlVkRsZWoiTQjSSYKZesEoJ4y9sgM@public.gmane.org>
> > 
> > Was this patch tested by reporter? I would rather see Reported-and-tested-by tag :-)
> 
> The reporter confirmed the following trick worked:
> 
>   # echo rt2800usb >> /etc/modules
>   # echo 'install rt2800usb /sbin/modprobe --ignore-install rt2800usb $CMDLINE_OPTS && echo 1b75 a200 > /sys/bus/usb/drivers/rt2800usb/new_id' > /etc/modprobe.d/ralink.conf
>   # modprobe -r rt2800usb ; modprobe rt2800usb

Ok, that's fine .

Acked-by: Stanislaw Gruszka <sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

^ 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