Netdev List
 help / color / mirror / Atom feed
* [PATCH] ipv6: replace write lock with read lock when get route info
From: roy.qing.li @ 2012-09-12  5:25 UTC (permalink / raw)
  To: netdev

From: Li RongQing <roy.qing.li@gmail.com>

geting route info does not write rt->rt6i_table, so replace
write lock with read lock

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 net/ipv6/route.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 399613b..8be1d86 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1837,7 +1837,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
 	if (!table)
 		return NULL;
 
-	write_lock_bh(&table->tb6_lock);
+	read_lock_bh(&table->tb6_lock);
 	fn = fib6_locate(&table->tb6_root, prefix ,prefixlen, NULL, 0);
 	if (!fn)
 		goto out;
@@ -1853,7 +1853,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
 		break;
 	}
 out:
-	write_unlock_bh(&table->tb6_lock);
+	read_unlock_bh(&table->tb6_lock);
 	return rt;
 }
 
@@ -1896,7 +1896,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev
 	if (!table)
 		return NULL;
 
-	write_lock_bh(&table->tb6_lock);
+	read_lock_bh(&table->tb6_lock);
 	for (rt = table->tb6_root.leaf; rt; rt=rt->dst.rt6_next) {
 		if (dev == rt->dst.dev &&
 		    ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) &&
@@ -1905,7 +1905,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev
 	}
 	if (rt)
 		dst_hold(&rt->dst);
-	write_unlock_bh(&table->tb6_lock);
+	read_unlock_bh(&table->tb6_lock);
 	return rt;
 }
 
-- 
1.7.4.1

^ permalink raw reply related

* Re: [V3 PATCH 9/9] cxgb4vf: Chelsio FCoE offload driver submission (header compatibility fixes).
From: Naresh Kumar Inna @ 2012-09-12  5:35 UTC (permalink / raw)
  To: David Miller
  Cc: JBottomley@parallels.com, linux-scsi@vger.kernel.org,
	Dimitrios Michailidis, Casey Leedom, netdev@vger.kernel.org,
	Chethan Seshadri
In-Reply-To: <20120911.133321.282568248903907762.davem@davemloft.net>

On 9/11/2012 11:03 PM, David Miller wrote:
> From: Naresh Kumar Inna <naresh@chelsio.com>
> Date: Tue, 11 Sep 2012 20:09:07 +0530
> 
>> This patch contains minor fixes to make cxgb4vf driver work with the updates to
>> shared firmware/hardware header files.
>>
>> Signed-off-by: Naresh Kumar Inna <naresh@chelsio.com>
> 
> You cannot submit a patch set that isn't bisectable, and in particular
> create a situation that mid-way through your patch set things do not
> build or operate correctly.
> 

Sorry, I am new to this process. The reason I did that was because I was
not sure if I could create a single patch with both cxgb4 and cxgb4vf
files in it, since they are two different subsystems. If I could do
that, the single patch then would build on its own, and not be dependent
on the other patches in the series. Is that something I can do?

Thanks,
Naresh.

^ permalink raw reply

* Re: [V3 PATCH 5/9] csiostor: Chelsio FCoE offload driver submission (sources part 5).
From: Naresh Kumar Inna @ 2012-09-12  5:40 UTC (permalink / raw)
  To: David Miller
  Cc: JBottomley@parallels.com, linux-scsi@vger.kernel.org,
	Dimitrios Michailidis, Casey Leedom, netdev@vger.kernel.org,
	Chethan Seshadri
In-Reply-To: <20120911.133510.1351483747174862495.davem@davemloft.net>

On 9/11/2012 11:05 PM, David Miller wrote:
> From: Naresh Kumar Inna <naresh@chelsio.com>
> Date: Tue, 11 Sep 2012 20:09:03 +0530
> 
>> +#include <linux/moduleparam.h>
> 
> This header include is not necessary.
> 

I will remove it, thanks.

^ permalink raw reply

* Re: [V3 PATCH 9/9] cxgb4vf: Chelsio FCoE offload driver submission (header compatibility fixes).
From: David Miller @ 2012-09-12  5:47 UTC (permalink / raw)
  To: naresh; +Cc: JBottomley, linux-scsi, dm, leedom, netdev, chethan
In-Reply-To: <50501F1A.6040905@chelsio.com>

From: Naresh Kumar Inna <naresh@chelsio.com>
Date: Wed, 12 Sep 2012 11:05:22 +0530

> On 9/11/2012 11:03 PM, David Miller wrote:
>> From: Naresh Kumar Inna <naresh@chelsio.com>
>> Date: Tue, 11 Sep 2012 20:09:07 +0530
>> 
>>> This patch contains minor fixes to make cxgb4vf driver work with the updates to
>>> shared firmware/hardware header files.
>>>
>>> Signed-off-by: Naresh Kumar Inna <naresh@chelsio.com>
>> 
>> You cannot submit a patch set that isn't bisectable, and in particular
>> create a situation that mid-way through your patch set things do not
>> build or operate correctly.
>> 
> 
> Sorry, I am new to this process. The reason I did that was because I was
> not sure if I could create a single patch with both cxgb4 and cxgb4vf
> files in it, since they are two different subsystems. If I could do
> that, the single patch then would build on its own, and not be dependent
> on the other patches in the series. Is that something I can do?

I don't know how else to say this, every step along the way the tree
has to build.  You arrange the patches however necessary to achieve
that goal.

^ permalink raw reply

* Re: [PATCHv4] virtio-spec: virtio network device multiqueue support
From: Rusty Russell @ 2012-09-12  5:49 UTC (permalink / raw)
  To: Jason Wang, Michael S. Tsirkin
  Cc: kvm, netdev, rick.jones2, virtualization, levinsasha928, pbonzini,
	Tom Herbert
In-Reply-To: <504DC831.1000709@redhat.com>

Jason Wang <jasowang@redhat.com> writes:
> On 09/10/2012 02:33 PM, Michael S. Tsirkin wrote:
>> A final addition: what you suggest above would be
>> "TX follows RX", right?

BTW, yes.  But it's a weird way to express what the nic is doing.

>> It is in anticipation of something like that, that I made
>> steering programming so generic.

>> I think TX follows RX is more immediately useful for reasons above
>> but we can add both to spec and let drivers and devices
>> decide what they want to support.

You mean "RX follows TX"?  ie. accelerated RFS.  I agree.

Perhaps Tom can explain how we avoid out-of-order receive for the
accelerated RFS case?  It's not clear to me, but we need to be able to
do that for virtio-net if it implements accelerated RFS.

> AFAIK, ixgbe does "rx follows tx". The only differences between ixgbe 
> and virtio-net is that ixgbe driver programs the flow director during 
> packet transmission but we suggest to do it silently in the device for 
> simplicity.

Implying the receive queue by xmit will be slightly laggy.  Don't know
if that's a problem.

Cheers,
Rusty.

^ permalink raw reply

* Re: [PATCH 2/2] netprio_cgroup: Optimize the priomap copy loop slightly
From: Srivatsa S. Bhat @ 2012-09-12  6:05 UTC (permalink / raw)
  To: David Laight
  Cc: davem, nhorman, john.r.fastabend, gaofeng, eric.dumazet,
	mark.d.rustad, lizefan, netdev, linux-kernel
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B6FE9@saturn3.aculab.com>

On 09/11/2012 05:12 PM, David Laight wrote:
>> -	for (i = 0;
>> -	     old_priomap && (i < old_priomap->priomap_len);
>> -	     i++)
>> -		new_priomap->priomap[i] = old_priomap->priomap[i];
>> +	if (old_priomap) {
>> +		old_len = old_priomap->priomap_len;
>> +
>> +		for (i = 0; i < old_len; i++)
>> +			new_priomap->priomap[i] = old_priomap->priomap[i];
>> +	}
> 
> Or:
> 	memcpy(new_priomap->priomap, old_priomap->priomap,
> 		old_priomap->priomap_len * sizeof old_priomap->priomap[0]);
> 

Ah, indeed that would be better. I'll send out an updated version of the
patches. Thanks!

Regards,
Srivatsa S. Bhat

^ permalink raw reply

* [v2 PATCH 1/2] netprio_cgroup: Remove update_netdev_tables() since it is unnecessary
From: Srivatsa S. Bhat @ 2012-09-12  6:07 UTC (permalink / raw)
  To: davem, nhorman
  Cc: David.Laight, john.r.fastabend, gaofeng, eric.dumazet,
	mark.d.rustad, lizefan, netdev, linux-kernel, srivatsa.bhat

The update_netdev_tables() function appears to be unnecessary, since the
write_update_netdev_table() function will adjust the priomaps as and when
required anyway. So drop the usage of update_netdev_tables() entirely.

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 net/core/netprio_cgroup.c |   32 --------------------------------
 1 files changed, 0 insertions(+), 32 deletions(-)

diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index c75e3f9..fd339bb0 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -109,32 +109,6 @@ static int write_update_netdev_table(struct net_device *dev)
 	return ret;
 }
 
-static int update_netdev_tables(void)
-{
-	int ret = 0;
-	struct net_device *dev;
-	u32 max_len;
-	struct netprio_map *map;
-
-	rtnl_lock();
-	max_len = atomic_read(&max_prioidx) + 1;
-	for_each_netdev(&init_net, dev) {
-		map = rtnl_dereference(dev->priomap);
-		/*
-		 * don't allocate priomap if we didn't
-		 * change net_prio.ifpriomap (map == NULL),
-		 * this will speed up skb_update_prio.
-		 */
-		if (map && map->priomap_len < max_len) {
-			ret = extend_netdev_table(dev, max_len);
-			if (ret < 0)
-				break;
-		}
-	}
-	rtnl_unlock();
-	return ret;
-}
-
 static struct cgroup_subsys_state *cgrp_create(struct cgroup *cgrp)
 {
 	struct cgroup_netprio_state *cs;
@@ -153,12 +127,6 @@ static struct cgroup_subsys_state *cgrp_create(struct cgroup *cgrp)
 		goto out;
 	}
 
-	ret = update_netdev_tables();
-	if (ret < 0) {
-		put_prioidx(cs->prioidx);
-		goto out;
-	}
-
 	return &cs->css;
 out:
 	kfree(cs);

^ permalink raw reply related

* [v2 PATCH 2/2] netprio_cgroup: Use memcpy instead of the for-loop to copy priomap
From: Srivatsa S. Bhat @ 2012-09-12  6:07 UTC (permalink / raw)
  To: davem, nhorman
  Cc: David.Laight, john.r.fastabend, gaofeng, eric.dumazet,
	mark.d.rustad, lizefan, netdev, linux-kernel, srivatsa.bhat
In-Reply-To: <20120912060741.11037.37347.stgit@srivatsabhat.in.ibm.com>

Replace the current (inefficient) for-loop with memcpy, to copy priomap.

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 net/core/netprio_cgroup.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index fd339bb0..83bbd0e 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -73,7 +73,6 @@ static int extend_netdev_table(struct net_device *dev, u32 new_len)
 			   ((sizeof(u32) * new_len));
 	struct netprio_map *new_priomap = kzalloc(new_size, GFP_KERNEL);
 	struct netprio_map *old_priomap;
-	int i;
 
 	old_priomap  = rtnl_dereference(dev->priomap);
 
@@ -82,10 +81,10 @@ static int extend_netdev_table(struct net_device *dev, u32 new_len)
 		return -ENOMEM;
 	}
 
-	for (i = 0;
-	     old_priomap && (i < old_priomap->priomap_len);
-	     i++)
-		new_priomap->priomap[i] = old_priomap->priomap[i];
+	if (old_priomap)
+		memcpy(new_priomap->priomap, old_priomap->priomap,
+			old_priomap->priomap_len *
+					sizeof(old_priomap->priomap[0]));
 
 	new_priomap->priomap_len = new_len;
 

^ permalink raw reply related

* [PATCH] iproute2: GENL: merge GENL_REQUEST and GENL_INITIALIZER
From: Julian Anastasov @ 2012-09-12  6:15 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

	Both macros are used together, so better to have
single define. Update all requests in ipl2tp.c to use the
new macro.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
---
 include/libgenl.h |   27 +++++++++-----------
 ip/ipl2tp.c       |   72 +++++++++++-----------------------------------------
 lib/libgenl.c     |    7 ++---
 3 files changed, 31 insertions(+), 75 deletions(-)

diff --git a/include/libgenl.h b/include/libgenl.h
index 0b11a89..9db4baf 100644
--- a/include/libgenl.h
+++ b/include/libgenl.h
@@ -3,25 +3,22 @@
 
 #include "libnetlink.h"
 
-#define GENL_REQUEST(_req, _hdrsiz, _bufsiz)				\
+#define GENL_REQUEST(_req, _bufsiz, _family, _hdrsiz, _ver, _cmd, _flags) \
 struct {								\
 	struct nlmsghdr		n;					\
 	struct genlmsghdr	g;					\
 	char			buf[NLMSG_ALIGN(_hdrsiz) + (_bufsiz)];	\
-} _req
-
-#define GENL_INITIALIZER(_family, _hdrsiz, _ver, _cmd, _flags)		\
-	{								\
-		.n = {							\
-			.nlmsg_type = (_family),			\
-			.nlmsg_flags = (_flags),			\
-			.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN + (_hdrsiz)), \
-		},							\
-		.g = {							\
-			.cmd = (_cmd),					\
-			.version = (_ver),				\
-		},							\
-	}
+} _req = {								\
+	.n = {								\
+		.nlmsg_type = (_family),				\
+		.nlmsg_flags = (_flags),				\
+		.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN + (_hdrsiz)),	\
+	},								\
+	.g = {								\
+		.cmd = (_cmd),						\
+		.version = (_ver),					\
+	},								\
+}
 
 extern int genl_resolve_family(struct rtnl_handle *grth, const char *family);
 
diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
index aaa3d31..f6e264a 100644
--- a/ip/ipl2tp.c
+++ b/ip/ipl2tp.c
@@ -96,9 +96,8 @@ static int create_tunnel(struct l2tp_parm *p)
 	uint32_t local_attr = L2TP_ATTR_IP_SADDR;
 	uint32_t peer_attr = L2TP_ATTR_IP_DADDR;
 
-	GENL_REQUEST(req, 0, 1024)
-		= GENL_INITIALIZER(genl_family, NLM_F_REQUEST | NLM_F_ACK, 0,
-				   L2TP_CMD_TUNNEL_CREATE, L2TP_GENL_VERSION);
+	GENL_REQUEST(req, 1024, genl_family, 0, L2TP_GENL_VERSION,
+		     L2TP_CMD_TUNNEL_CREATE, NLM_F_REQUEST | NLM_F_ACK);
 
 	addattr32(&req.n, 1024, L2TP_ATTR_CONN_ID, p->tunnel_id);
 	addattr32(&req.n, 1024, L2TP_ATTR_PEER_CONN_ID, p->peer_tunnel_id);
@@ -126,9 +125,8 @@ static int create_tunnel(struct l2tp_parm *p)
 
 static int delete_tunnel(struct l2tp_parm *p)
 {
-	GENL_REQUEST(req, 0, 1024)
-		= GENL_INITIALIZER(genl_family, NLM_F_REQUEST | NLM_F_ACK, 0,
-				   L2TP_CMD_TUNNEL_DELETE, L2TP_GENL_VERSION);
+	GENL_REQUEST(req, 128, genl_family, 0, L2TP_GENL_VERSION,
+		     L2TP_CMD_TUNNEL_DELETE, NLM_F_REQUEST | NLM_F_ACK);
 
 	addattr32(&req.n, 128, L2TP_ATTR_CONN_ID, p->tunnel_id);
 
@@ -140,18 +138,8 @@ static int delete_tunnel(struct l2tp_parm *p)
 
 static int create_session(struct l2tp_parm *p)
 {
-	struct {
-		struct nlmsghdr 	n;
-		struct genlmsghdr	g;
-		char   			buf[1024];
-	} req;
-
-	memset(&req, 0, sizeof(req));
-	req.n.nlmsg_type = genl_family;
-	req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
-	req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
-	req.g.cmd = L2TP_CMD_SESSION_CREATE;
-	req.g.version = L2TP_GENL_VERSION;
+	GENL_REQUEST(req, 1024, genl_family, 0, L2TP_GENL_VERSION,
+		     L2TP_CMD_SESSION_CREATE, NLM_F_REQUEST | NLM_F_ACK);
 
 	addattr32(&req.n, 1024, L2TP_ATTR_CONN_ID, p->tunnel_id);
 	addattr32(&req.n, 1024, L2TP_ATTR_PEER_CONN_ID, p->peer_tunnel_id);
@@ -182,18 +170,8 @@ static int create_session(struct l2tp_parm *p)
 
 static int delete_session(struct l2tp_parm *p)
 {
-	struct {
-		struct nlmsghdr 	n;
-		struct genlmsghdr	g;
-		char   			buf[128];
-	} req;
-
-	memset(&req, 0, sizeof(req));
-	req.n.nlmsg_type = genl_family;
-	req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
-	req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
-	req.g.cmd = L2TP_CMD_SESSION_DELETE;
-	req.g.version = L2TP_GENL_VERSION;
+	GENL_REQUEST(req, 1024, genl_family, 0, L2TP_GENL_VERSION,
+		     L2TP_CMD_SESSION_DELETE, NLM_F_REQUEST | NLM_F_ACK);
 
 	addattr32(&req.n, 1024, L2TP_ATTR_CONN_ID, p->tunnel_id);
 	addattr32(&req.n, 1024, L2TP_ATTR_SESSION_ID, p->session_id);
@@ -380,20 +358,11 @@ static int session_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n, void
 
 static int get_session(struct l2tp_data *p)
 {
-	struct {
-		struct nlmsghdr 	n;
-		struct genlmsghdr	g;
-		char buf[128];
-	} req;
-
-	memset(&req, 0, sizeof(req));
-	req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
-	req.n.nlmsg_type = genl_family;
-	req.n.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST;
-	req.n.nlmsg_seq = genl_rth.dump = ++genl_rth.seq;
+	GENL_REQUEST(req, 128, genl_family, 0, L2TP_GENL_VERSION,
+		     L2TP_CMD_SESSION_GET,
+		     NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST);
 
-	req.g.cmd = L2TP_CMD_SESSION_GET;
-	req.g.version = L2TP_GENL_VERSION;
+	req.n.nlmsg_seq = genl_rth.dump = ++genl_rth.seq;
 
 	if (p->config.tunnel_id && p->config.session_id) {
 		addattr32(&req.n, 128, L2TP_ATTR_CONN_ID, p->config.tunnel_id);
@@ -423,20 +392,11 @@ static int tunnel_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n, void
 
 static int get_tunnel(struct l2tp_data *p)
 {
-	struct {
-		struct nlmsghdr 	n;
-		struct genlmsghdr	g;
-		char buf[1024];
-	} req;
-
-	memset(&req, 0, sizeof(req));
-	req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
-	req.n.nlmsg_type = genl_family;
-	req.n.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST;
-	req.n.nlmsg_seq = genl_rth.dump = ++genl_rth.seq;
+	GENL_REQUEST(req, 1024, genl_family, 0, L2TP_GENL_VERSION,
+		     L2TP_CMD_TUNNEL_GET,
+		     NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST);
 
-	req.g.cmd = L2TP_CMD_TUNNEL_GET;
-	req.g.version = L2TP_GENL_VERSION;
+	req.n.nlmsg_seq = genl_rth.dump = ++genl_rth.seq;
 
 	if (p->config.tunnel_id)
 		addattr32(&req.n, 1024, L2TP_ATTR_CONN_ID, p->config.tunnel_id);
diff --git a/lib/libgenl.c b/lib/libgenl.c
index d68e58e..ef3e5db 100644
--- a/lib/libgenl.c
+++ b/lib/libgenl.c
@@ -47,11 +47,10 @@ static int genl_parse_getfamily(struct nlmsghdr *nlh)
 
 int genl_resolve_family(struct rtnl_handle *grth, const char *family)
 {
-	GENL_REQUEST(req, 0, 1024)
-		= GENL_INITIALIZER(GENL_ID_CTRL, 0,
-				   0, CTRL_CMD_GETFAMILY, NLM_F_REQUEST);
+	GENL_REQUEST(req, 1024, GENL_ID_CTRL, 0, 0, CTRL_CMD_GETFAMILY,
+		     NLM_F_REQUEST);
 
-	addattr_l(&req.n, 1024, CTRL_ATTR_FAMILY_NAME,
+	addattr_l(&req.n, sizeof(req), CTRL_ATTR_FAMILY_NAME,
 		  family, strlen(family) + 1);
 
 	if (rtnl_talk(grth, &req.n, 0, 0, &req.n) < 0) {
-- 
1.7.3.4

^ permalink raw reply related

* Re: [V3 PATCH 9/9] cxgb4vf: Chelsio FCoE offload driver submission (header compatibility fixes).
From: Naresh Kumar Inna @ 2012-09-12  6:27 UTC (permalink / raw)
  To: David Miller
  Cc: JBottomley@parallels.com, linux-scsi@vger.kernel.org,
	Dimitrios Michailidis, Casey Leedom, netdev@vger.kernel.org,
	Chethan Seshadri
In-Reply-To: <20120912.014746.636228439025755624.davem@davemloft.net>

On 9/12/2012 11:17 AM, David Miller wrote:
> From: Naresh Kumar Inna <naresh@chelsio.com>
> Date: Wed, 12 Sep 2012 11:05:22 +0530
> 
>> On 9/11/2012 11:03 PM, David Miller wrote:
>>> From: Naresh Kumar Inna <naresh@chelsio.com>
>>> Date: Tue, 11 Sep 2012 20:09:07 +0530
>>>
>>>> This patch contains minor fixes to make cxgb4vf driver work with the updates to
>>>> shared firmware/hardware header files.
>>>>
>>>> Signed-off-by: Naresh Kumar Inna <naresh@chelsio.com>
>>>
>>> You cannot submit a patch set that isn't bisectable, and in particular
>>> create a situation that mid-way through your patch set things do not
>>> build or operate correctly.
>>>
>>
>> Sorry, I am new to this process. The reason I did that was because I was
>> not sure if I could create a single patch with both cxgb4 and cxgb4vf
>> files in it, since they are two different subsystems. If I could do
>> that, the single patch then would build on its own, and not be dependent
>> on the other patches in the series. Is that something I can do?
> 
> I don't know how else to say this, every step along the way the tree
> has to build.  You arrange the patches however necessary to achieve
> that goal.
> 

OK, I think I should be able to arrange the patch set to fulfill that
requirement. I was under the impression it was fine for new drivers to
split patches in this fashion, since they go as a single commit, sorry
about that.

As for a single patch with both cxgb4 and cxgb4vf changes, I assume it
is OK for the commit log to start with "cxgb4/cxgb4vf:..."?

Thanks,
Naresh.

^ permalink raw reply

* Re: [PATCH] net_tx_action: Call trace_consume_skb() instead of trace_kfree_skb()
From: Eric Dumazet @ 2012-09-12  7:33 UTC (permalink / raw)
  To: Shawn Bohrer; +Cc: netdev, sanagi.koki, davem
In-Reply-To: <1347406098-22071-1-git-send-email-sbohrer@rgmadvisors.com>

On Tue, 2012-09-11 at 18:28 -0500, Shawn Bohrer wrote:
> Call trace_consume_skb() instead of trace_kfree_skb() as skbs are
> removed from the completion_queue during transmit.  This avoids false
> positives from dropwatch/drop_monitor making them more useful.
> 
> Signed-off-by: Shawn Bohrer <sbohrer@rgmadvisors.com>
> ---
> 
> In my case I seem to hit this tracepoint for every packet I transmit so
> these appear to be false positives to me.  Perhaps there are cases where
> you could hit this and it is a real packet drop?
> 
>  net/core/dev.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 8398836..00774ce 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3015,7 +3015,7 @@ static void net_tx_action(struct softirq_action *h)
>  			clist = clist->next;
>  
>  			WARN_ON(atomic_read(&skb->users));
> -			trace_kfree_skb(skb, net_tx_action);
> +			trace_consume_skb(skb);
>  			__kfree_skb(skb);
>  		}
>  	}
> -- 
> 1.7.7.6
> 
> 


Problem here is : we dont know if caller of dev_kfree_skb_irq(skb)
wanted to drop or consume skb.

(We dont have a dev_consume_skb_irq(skb) function)

For example, drivers/infiniband/ulp/ipoib/ipoib_main.c function
path_free() does :

while ((skb = __skb_dequeue(&path->queue)))
	dev_kfree_skb_irq(skb);

Are these packets dropped or consumed, I dont really know...

Note : NAPI drivers dont use dev_kfree_skb_irq(skb).

What is the NIC driver you are using, I thought it was mellanox (wich is
NAPI) ?

^ permalink raw reply

* Re: [PATCH net-next v3 4/4] ipv6: use DST_* macro to set obselete field
From: Eric Dumazet @ 2012-09-12  7:40 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: vyasevich, davem, sds, james.l.morris, eparis, sri, linux-sctp,
	netdev
In-Reply-To: <1347350987-8054-5-git-send-email-nicolas.dichtel@6wind.com>

On Tue, 2012-09-11 at 10:09 +0200, Nicolas Dichtel wrote:
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
>  net/ipv6/route.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 561f249..0c6f132 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -226,7 +226,7 @@ static struct rt6_info ip6_null_entry_template = {
>  	.dst = {
>  		.__refcnt	= ATOMIC_INIT(1),
>  		.__use		= 1,
> -		.obsolete	= -1,
> +		.obsolete	= DST_OBSOLETE_FORCE_CHK,
>  		.error		= -ENETUNREACH,
>  		.input		= ip6_pkt_discard,
>  		.output		= ip6_pkt_discard_out,
> @@ -246,7 +246,7 @@ static struct rt6_info ip6_prohibit_entry_template = {
>  	.dst = {
>  		.__refcnt	= ATOMIC_INIT(1),
>  		.__use		= 1,
> -		.obsolete	= -1,
> +		.obsolete	= DST_OBSOLETE_FORCE_CHK,
>  		.error		= -EACCES,
>  		.input		= ip6_pkt_prohibit,
>  		.output		= ip6_pkt_prohibit_out,
> @@ -261,7 +261,7 @@ static struct rt6_info ip6_blk_hole_entry_template = {
>  	.dst = {
>  		.__refcnt	= ATOMIC_INIT(1),
>  		.__use		= 1,
> -		.obsolete	= -1,
> +		.obsolete	= DST_OBSOLETE_FORCE_CHK,
>  		.error		= -EINVAL,
>  		.input		= dst_discard,
>  		.output		= dst_discard,

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

^ permalink raw reply

* Re: [PATCH] ipv6: replace write lock with read lock when get route info
From: Eric Dumazet @ 2012-09-12  7:45 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev
In-Reply-To: <1347427553-17781-1-git-send-email-roy.qing.li@gmail.com>

On Wed, 2012-09-12 at 13:25 +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> geting route info does not write rt->rt6i_table, so replace
> write lock with read lock
> 
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> ---
>  net/ipv6/route.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 399613b..8be1d86 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1837,7 +1837,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
>  	if (!table)
>  		return NULL;
>  
> -	write_lock_bh(&table->tb6_lock);
> +	read_lock_bh(&table->tb6_lock);
>  	fn = fib6_locate(&table->tb6_root, prefix ,prefixlen, NULL, 0);
>  	if (!fn)
>  		goto out;
> @@ -1853,7 +1853,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
>  		break;
>  	}
>  out:
> -	write_unlock_bh(&table->tb6_lock);
> +	read_unlock_bh(&table->tb6_lock);
>  	return rt;
>  }
>  
> @@ -1896,7 +1896,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev
>  	if (!table)
>  		return NULL;
>  
> -	write_lock_bh(&table->tb6_lock);
> +	read_lock_bh(&table->tb6_lock);
>  	for (rt = table->tb6_root.leaf; rt; rt=rt->dst.rt6_next) {
>  		if (dev == rt->dst.dev &&
>  		    ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) &&
> @@ -1905,7 +1905,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev
>  	}
>  	if (rt)
>  		dst_hold(&rt->dst);
> -	write_unlock_bh(&table->tb6_lock);
> +	read_unlock_bh(&table->tb6_lock);
>  	return rt;
>  }
>  

Why dont you also change addrconf_get_prefix_route() ?

^ permalink raw reply

* [PATCH] netfilter/iptables: Fix log-level processing
From: Joe Perches @ 2012-09-12  7:46 UTC (permalink / raw)
  To: auto75914331, Bart De Schuymer, Pablo Neira Ayuso,
	Patrick McHardy, Stephen Hemminger
  Cc: netfilter-devel, netfilter, coreteam, bridge, netdev,
	linux-kernel
In-Reply-To: <20120912045120.9E1A76F446@smtp.hushmail.com>

auto75914331@hushmail.com reports that iptables does not correctly
output the KERN_<level>.

$IPTABLES -A RULE_0_in  -j LOG  --log-level notice --log-prefix "DENY  in: "

result with linux 3.6-rc5
Sep 12 06:37:29 xxxxx kernel: <5>DENY  in: IN=eth0 OUT= MAC=.......

result with linux 3.5.3 and older:
Sep  9 10:43:01 xxxxx kernel: DENY  in: IN=eth0 OUT= MAC......

commit 04d2c8c83d0
("printk: convert the format for KERN_<LEVEL> to a 2 byte pattern")
updated the syslog header style but did not update netfilter uses.

Do so.

Signed-off-by: Joe Perches <joe@perches.com>
cc: auto75914331@hushmail.com
---
 net/bridge/netfilter/ebt_log.c |    4 ++--
 net/netfilter/xt_LOG.c         |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c
index f88ee53..cb46d2f 100644
--- a/net/bridge/netfilter/ebt_log.c
+++ b/net/bridge/netfilter/ebt_log.c
@@ -80,8 +80,8 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
 	unsigned int bitmask;
 
 	spin_lock_bh(&ebt_log_lock);
-	printk("<%c>%s IN=%s OUT=%s MAC source = %pM MAC dest = %pM proto = 0x%04x",
-	       '0' + loginfo->u.log.level, prefix,
+	printk("%c%c%s IN=%s OUT=%s MAC source = %pM MAC dest = %pM proto = 0x%04x",
+	       KERN_SOH_ASCII, '0' + loginfo->u.log.level, prefix,
 	       in ? in->name : "", out ? out->name : "",
 	       eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest,
 	       ntohs(eth_hdr(skb)->h_proto));
diff --git a/net/netfilter/xt_LOG.c b/net/netfilter/xt_LOG.c
index ff5f75f..bdc5352 100644
--- a/net/netfilter/xt_LOG.c
+++ b/net/netfilter/xt_LOG.c
@@ -436,8 +436,8 @@ log_packet_common(struct sbuff *m,
 		  const struct nf_loginfo *loginfo,
 		  const char *prefix)
 {
-	sb_add(m, "<%d>%sIN=%s OUT=%s ", loginfo->u.log.level,
-	       prefix,
+	sb_add(m, "%c%c%sIN=%s OUT=%s ",
+	       KERN_SOH_ASCII, '0' + loginfo->u.log.level, prefix,
 	       in ? in->name : "",
 	       out ? out->name : "");
 #ifdef CONFIG_BRIDGE_NETFILTER



^ permalink raw reply related

* [PATCH net-next] ipv6: route templates can be const
From: Eric Dumazet @ 2012-09-12  7:47 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

We kmemdup() templates, so they can be const.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv6/route.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 399613b..f568ac6 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -222,7 +222,7 @@ static const u32 ip6_template_metrics[RTAX_MAX] = {
 	[RTAX_HOPLIMIT - 1] = 255,
 };
 
-static struct rt6_info ip6_null_entry_template = {
+static const struct rt6_info ip6_null_entry_template = {
 	.dst = {
 		.__refcnt	= ATOMIC_INIT(1),
 		.__use		= 1,
@@ -242,7 +242,7 @@ static struct rt6_info ip6_null_entry_template = {
 static int ip6_pkt_prohibit(struct sk_buff *skb);
 static int ip6_pkt_prohibit_out(struct sk_buff *skb);
 
-static struct rt6_info ip6_prohibit_entry_template = {
+static const struct rt6_info ip6_prohibit_entry_template = {
 	.dst = {
 		.__refcnt	= ATOMIC_INIT(1),
 		.__use		= 1,
@@ -257,7 +257,7 @@ static struct rt6_info ip6_prohibit_entry_template = {
 	.rt6i_ref	= ATOMIC_INIT(1),
 };
 
-static struct rt6_info ip6_blk_hole_entry_template = {
+static const struct rt6_info ip6_blk_hole_entry_template = {
 	.dst = {
 		.__refcnt	= ATOMIC_INIT(1),
 		.__use		= 1,

^ permalink raw reply related

* Re: [v2 PATCH 2/2] netprio_cgroup: Use memcpy instead of the for-loop to copy priomap
From: David Miller @ 2012-09-12  7:49 UTC (permalink / raw)
  To: srivatsa.bhat
  Cc: nhorman, David.Laight, john.r.fastabend, gaofeng, eric.dumazet,
	mark.d.rustad, lizefan, netdev, linux-kernel
In-Reply-To: <20120912060747.11037.42623.stgit@srivatsabhat.in.ibm.com>

From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Date: Wed, 12 Sep 2012 11:37:47 +0530

> +		memcpy(new_priomap->priomap, old_priomap->priomap,
> +			old_priomap->priomap_len *
> +					sizeof(old_priomap->priomap[0]));

This argument indentation is ridiculous.  Try:

		memcpy(new_priomap->priomap, old_priomap->priomap,
		       old_priomap->priomap_len *
		       sizeof(old_priomap->priomap[0]));

Using TABs exclusively for argumentat indentation is not the goal.

Rather, lining the arguments up properly so that they sit at the first
column after the first line's openning parenthesis is what you should
be trying to achieve.

And ignoring whatever stylistic convention we may or may not have, I
find it impossibly hard to believe that the code quoted above looks
good even to you.

^ permalink raw reply

* Re: [PATCH] ipv6: replace write lock with read lock when get route info
From: RongQing Li @ 2012-09-12  7:49 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1347435907.13103.693.camel@edumazet-glaptop>

>>
>
> Why dont you also change addrconf_get_prefix_route() ?
>
>

I did not find it, I will send v2
Thanks

-Roy

^ permalink raw reply

* Re: [PATCHv4] virtio-spec: virtio network device multiqueue support
From: Michael S. Tsirkin @ 2012-09-12  7:57 UTC (permalink / raw)
  To: Rusty Russell
  Cc: kvm, netdev, rick.jones2, virtualization, levinsasha928, pbonzini,
	Tom Herbert
In-Reply-To: <87har3dc4o.fsf@rustcorp.com.au>

On Wed, Sep 12, 2012 at 03:19:11PM +0930, Rusty Russell wrote:
> Jason Wang <jasowang@redhat.com> writes:
> > On 09/10/2012 02:33 PM, Michael S. Tsirkin wrote:
> >> A final addition: what you suggest above would be
> >> "TX follows RX", right?
> 
> BTW, yes.  But it's a weird way to express what the nic is doing.

It explains what the system is doing.
TX is done by driver, RX by nic.
We document both driver and device in the spec
so I thought it's fine. any suggestions wellcome.

> >> It is in anticipation of something like that, that I made
> >> steering programming so generic.
> 
> >> I think TX follows RX is more immediately useful for reasons above
> >> but we can add both to spec and let drivers and devices
> >> decide what they want to support.
> 
> You mean "RX follows TX"?  ie. accelerated RFS.  I agree.


Yes that's what I meant. Thanks for the correction.

> Perhaps Tom can explain how we avoid out-of-order receive for the
> accelerated RFS case?  It's not clear to me, but we need to be able to
> do that for virtio-net if it implements accelerated RFS.

Basically this has tx vq per cpu and relies on scheduler not bouncing threads
between cpus too aggressively. Appears to be what ixgbe does.

> > AFAIK, ixgbe does "rx follows tx". The only differences between ixgbe 
> > and virtio-net is that ixgbe driver programs the flow director during 
> > packet transmission but we suggest to do it silently in the device for 
> > simplicity.
> 
> Implying the receive queue by xmit will be slightly laggy.  Don't know
> if that's a problem.
> 
> Cheers,
> Rusty.

Doesn't seem to be a problem in Jason's testing so far.

^ permalink raw reply

* [PATCH v2] ipv6: replace write lock with read lock when get route info
From: roy.qing.li @ 2012-09-12  7:59 UTC (permalink / raw)
  To: netdev

From: Li RongQing <roy.qing.li@gmail.com>

geting route info does not write rt->rt6i_table, so replace
write lock with read lock

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 net/ipv6/addrconf.c |    4 ++--
 net/ipv6/route.c    |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 1237d5d..061c100 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1706,7 +1706,7 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx,
 	if (table == NULL)
 		return NULL;
 
-	write_lock_bh(&table->tb6_lock);
+	read_lock_bh(&table->tb6_lock);
 	fn = fib6_locate(&table->tb6_root, pfx, plen, NULL, 0);
 	if (!fn)
 		goto out;
@@ -1721,7 +1721,7 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx,
 		break;
 	}
 out:
-	write_unlock_bh(&table->tb6_lock);
+	read_unlock_bh(&table->tb6_lock);
 	return rt;
 }
 
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 399613b..8be1d86 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1837,7 +1837,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
 	if (!table)
 		return NULL;
 
-	write_lock_bh(&table->tb6_lock);
+	read_lock_bh(&table->tb6_lock);
 	fn = fib6_locate(&table->tb6_root, prefix ,prefixlen, NULL, 0);
 	if (!fn)
 		goto out;
@@ -1853,7 +1853,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
 		break;
 	}
 out:
-	write_unlock_bh(&table->tb6_lock);
+	read_unlock_bh(&table->tb6_lock);
 	return rt;
 }
 
@@ -1896,7 +1896,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev
 	if (!table)
 		return NULL;
 
-	write_lock_bh(&table->tb6_lock);
+	read_lock_bh(&table->tb6_lock);
 	for (rt = table->tb6_root.leaf; rt; rt=rt->dst.rt6_next) {
 		if (dev == rt->dst.dev &&
 		    ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) &&
@@ -1905,7 +1905,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev
 	}
 	if (rt)
 		dst_hold(&rt->dst);
-	write_unlock_bh(&table->tb6_lock);
+	read_unlock_bh(&table->tb6_lock);
 	return rt;
 }
 
-- 
1.7.4.1

^ permalink raw reply related

* Re: [PATCH] netfilter/iptables: Fix log-level processing
From: Eric Dumazet @ 2012-09-12  8:07 UTC (permalink / raw)
  To: Joe Perches
  Cc: auto75914331, netfilter, coreteam, netdev, bridge, linux-kernel,
	Bart De Schuymer, netfilter-devel, Stephen Hemminger,
	Patrick McHardy, Pablo Neira Ayuso
In-Reply-To: <1347435973.2456.23.camel@joe2Laptop>

On Wed, 2012-09-12 at 00:46 -0700, Joe Perches wrote:
> auto75914331@hushmail.com reports that iptables does not correctly
> output the KERN_<level>.
> 
> $IPTABLES -A RULE_0_in  -j LOG  --log-level notice --log-prefix "DENY  in: "
> 
> result with linux 3.6-rc5
> Sep 12 06:37:29 xxxxx kernel: <5>DENY  in: IN=eth0 OUT= MAC=.......
> 
> result with linux 3.5.3 and older:
> Sep  9 10:43:01 xxxxx kernel: DENY  in: IN=eth0 OUT= MAC......
> 
> commit 04d2c8c83d0
> ("printk: convert the format for KERN_<LEVEL> to a 2 byte pattern")
> updated the syslog header style but did not update netfilter uses.
> 
> Do so.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> cc: auto75914331@hushmail.com
> ---
>  net/bridge/netfilter/ebt_log.c |    4 ++--
>  net/netfilter/xt_LOG.c         |    4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c
> index f88ee53..cb46d2f 100644
> --- a/net/bridge/netfilter/ebt_log.c
> +++ b/net/bridge/netfilter/ebt_log.c
> @@ -80,8 +80,8 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
>  	unsigned int bitmask;
>  
>  	spin_lock_bh(&ebt_log_lock);
> -	printk("<%c>%s IN=%s OUT=%s MAC source = %pM MAC dest = %pM proto = 0x%04x",
> -	       '0' + loginfo->u.log.level, prefix,
> +	printk("%c%c%s IN=%s OUT=%s MAC source = %pM MAC dest = %pM proto = 0x%04x",
> +	       KERN_SOH_ASCII, '0' + loginfo->u.log.level, prefix,
>  	       in ? in->name : "", out ? out->name : "",
>  	       eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest,
>  	       ntohs(eth_hdr(skb)->h_proto));
> diff --git a/net/netfilter/xt_LOG.c b/net/netfilter/xt_LOG.c
> index ff5f75f..bdc5352 100644
> --- a/net/netfilter/xt_LOG.c
> +++ b/net/netfilter/xt_LOG.c
> @@ -436,8 +436,8 @@ log_packet_common(struct sbuff *m,
>  		  const struct nf_loginfo *loginfo,
>  		  const char *prefix)
>  {
> -	sb_add(m, "<%d>%sIN=%s OUT=%s ", loginfo->u.log.level,
> -	       prefix,
> +	sb_add(m, "%c%c%sIN=%s OUT=%s ",
> +	       KERN_SOH_ASCII, '0' + loginfo->u.log.level, prefix,
>  	       in ? in->name : "",
>  	       out ? out->name : "");
>  #ifdef CONFIG_BRIDGE_NETFILTER
> 

would be better to avoid the %c

->

 sb_add(m, KERN_SOH "%c%sIN=%s OUT=%s ",
	'0' + loginfo->u.log.level, prefix,

^ permalink raw reply

* Re: [PATCH v2] ipv6: replace write lock with read lock when get route info
From: Eric Dumazet @ 2012-09-12  8:12 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev
In-Reply-To: <1347436741-344-1-git-send-email-roy.qing.li@gmail.com>

On Wed, 2012-09-12 at 15:59 +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> geting route info does not write rt->rt6i_table, so replace
> write lock with read lock
> 
> Suggested-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> ---
>  net/ipv6/addrconf.c |    4 ++--
>  net/ipv6/route.c    |    8 ++++----
>  2 files changed, 6 insertions(+), 6 deletions(-)

I guess you missed the net-next tag in your [PATCH ...] ?
 
Signed-off-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply

* Re: [v2 PATCH 2/2] netprio_cgroup: Use memcpy instead of the for-loop to copy priomap
From: Srivatsa S. Bhat @ 2012-09-12  8:24 UTC (permalink / raw)
  To: David Miller
  Cc: nhorman, David.Laight, john.r.fastabend, gaofeng, eric.dumazet,
	mark.d.rustad, lizefan, netdev, linux-kernel
In-Reply-To: <20120912.034901.184817520125489015.davem@davemloft.net>

On 09/12/2012 01:19 PM, David Miller wrote:
> From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
> Date: Wed, 12 Sep 2012 11:37:47 +0530
> 
>> +		memcpy(new_priomap->priomap, old_priomap->priomap,
>> +			old_priomap->priomap_len *
>> +					sizeof(old_priomap->priomap[0]));
> 
> This argument indentation is ridiculous.  Try:
> 
> 		memcpy(new_priomap->priomap, old_priomap->priomap,
> 		       old_priomap->priomap_len *
> 		       sizeof(old_priomap->priomap[0]));
> 
> Using TABs exclusively for argumentat indentation is not the goal.
> 
> Rather, lining the arguments up properly so that they sit at the first
> column after the first line's openning parenthesis is what you should
> be trying to achieve.

OK, will fix it, thanks!

> 
> And ignoring whatever stylistic convention we may or may not have, I
> find it impossibly hard to believe that the code quoted above looks
> good even to you.
>

On second thoughts, I think the memcpy in this case will actually be worse
since it will copy the contents in chunks of smaller size than the for-loop.

Or, did you mean to say that this code is plain wrong for some reason?

Regards,
Srivatsa S. Bhat

^ permalink raw reply

* [RFC PATCH net-next 0/1] Add support of ECMPv6
From: Nicolas Dichtel @ 2012-09-12  8:29 UTC (permalink / raw)
  To: bernat, netdev, yoshfuji, davem
In-Reply-To: <87a9x3vxzp.fsf@guybrush.luffy.cx>

Here is a proposal to add the support of ECMPv6. The previous patch
from Vincent against iproute2 can be used, but a little other patch is needed
too:

diff --git a/ip/iproute.c b/ip/iproute.c
index 2fe44b3..b71f150 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -693,8 +693,10 @@ int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r, int argc, char **argv)
 		rtnh = RTNH_NEXT(rtnh);
 	}
 
-	if (rta->rta_len > RTA_LENGTH(0))
+	if (rta->rta_len > RTA_LENGTH(0)) {
 		addattr_l(n, 1024, RTA_MULTIPATH, RTA_DATA(rta), RTA_PAYLOAD(rta));
+		n->nlmsg_flags &= ~NLM_F_EXCL;
+	}
 	return 0;
 }
 

If the kernel patch is approved, I will submit formally the patch for
iproute2.

Here is an example of a command to add an ECMP route:
$ ip -6 route add 3ffe:304:124:2306::/64 \
	nexthop via fe80::230:1bff:feb4:e05c dev eth0 weight 1 \
	nexthop via fe80::230:1bff:feb4:dd4f dev eth0 weight 1

Comments are welcome.

Regards,
Nicolas

^ permalink raw reply related

* [RFC PATCH net-next 1/1] ipv6: add support of ECMP
From: Nicolas Dichtel @ 2012-09-12  8:29 UTC (permalink / raw)
  To: bernat, netdev, yoshfuji, davem; +Cc: Nicolas Dichtel
In-Reply-To: <1347438597-4233-1-git-send-email-nicolas.dichtel@6wind.com>

This patch adds the support of equal cost multipath for IPv6.

The patch is based on a previous work from
Luc Saillard <luc.saillard@6wind.com>.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 include/net/ip6_fib.h |  13 ++++
 net/ipv6/Kconfig      |  32 ++++++++
 net/ipv6/ip6_fib.c    |  73 ++++++++++++++++++
 net/ipv6/route.c      | 207 +++++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 322 insertions(+), 3 deletions(-)

diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index cd64cf3..8071c66 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -47,6 +47,10 @@ struct fib6_config {
 	unsigned long	fc_expires;
 	struct nlattr	*fc_mx;
 	int		fc_mx_len;
+#ifdef CONFIG_IPV6_MULTIPATH
+	struct nlattr	*fc_mp;
+	int		fc_mp_len;
+#endif
 
 	struct nl_info	fc_nlinfo;
 };
@@ -98,6 +102,15 @@ struct rt6_info {
 	struct fib6_node		*rt6i_node;
 
 	struct in6_addr			rt6i_gateway;
+#ifdef CONFIG_IPV6_MULTIPATH
+	/*
+	 * siblings is a list of rt6_info that have the the same metric/weight,
+	 * destination, but not the same gateway. nsiblings is just a cache
+	 * to speed up lookup.
+	 */
+	unsigned int                    rt6i_nsiblings;
+	struct list_head                rt6i_siblings;
+#endif
 
 	atomic_t			rt6i_ref;
 
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index 4f7fe72..5980aec 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -266,4 +266,36 @@ config IPV6_PIMSM_V2
 	  Support for IPv6 PIM multicast routing protocol PIM-SMv2.
 	  If unsure, say N.
 
+config IPV6_MULTIPATH
+	bool "IPv6: equal cost multipath for IPv6 routing"
+	depends on IPV6
+	default y
+	---help---
+	  Enable this option to support ECMP for IPv6.
+	  If unsure, say N.
+
+choice
+	prompt "IPv6: choose Multipath algorithm"
+	depends on IPV6_MULTIPATH
+	default IPV6_MULTIPATH_ROUTE
+	---help---
+	  Define the method to select route between each possible path.
+
+	config IPV6_MULTIPATH_ROUTE
+	bool "IPv6: MULTIPATH flow algorithm"
+	---help---
+	  Multipath routes are chosen according to hash of packet header to
+	  ensure a flow keeps the same route.
+
+	config IPV6_MULTIPATH_RR
+	bool "IPv6: MULTIPATH round robin algorithm"
+	---help---
+	  Multipath routes are chosen according to Round Robin.
+
+	config IPV6_MULTIPATH_RANDOM
+	bool "IPv6: MULTIPATH random algorithm"
+	---help---
+	  Multipath routes are chosen in a random fashion.
+endchoice
+
 endif # IPV6
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 13690d6..3541e44 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -672,6 +672,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
 			    iter->rt6i_idev == rt->rt6i_idev &&
 			    ipv6_addr_equal(&iter->rt6i_gateway,
 					    &rt->rt6i_gateway)) {
+#ifdef CONFIG_IPV6_MULTIPATH
+				if (rt->rt6i_nsiblings)
+					rt->rt6i_nsiblings = 0;
+#endif
 				if (!(iter->rt6i_flags & RTF_EXPIRES))
 					return -EEXIST;
 				if (!(rt->rt6i_flags & RTF_EXPIRES))
@@ -680,6 +684,23 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
 					rt6_set_expires(iter, rt->dst.expires);
 				return -EEXIST;
 			}
+#ifdef CONFIG_IPV6_MULTIPATH
+			/* If we have the same destination and the same metric,
+			 * but not the same gateway, then the route we try to
+			 * add is sibling to this route, increment our counter
+			 * of siblings, and later we will add our route to the
+			 * list.
+			 * Only static routes (which don't have flag
+			 * RTF_EXPIRES) are used for ECMPv6.
+			 *
+			 * To avoid long list, we only had siblings if the
+			 * route have a gateway.
+			 */
+			if (rt->rt6i_flags & RTF_GATEWAY &&
+			    !(rt->rt6i_flags & RTF_EXPIRES) &&
+			    !(iter->rt6i_flags & RTF_EXPIRES))
+				rt->rt6i_nsiblings++;
+#endif
 		}
 
 		if (iter->rt6i_metric > rt->rt6i_metric)
@@ -692,6 +713,43 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
 	if (ins == &fn->leaf)
 		fn->rr_ptr = NULL;
 
+#ifdef CONFIG_IPV6_MULTIPATH
+	/* Link this route to others same route. */
+	if (rt->rt6i_nsiblings) {
+		unsigned int rt6i_nsiblings;
+		struct rt6_info *sibling, *temp_sibling;
+
+		/* Find the first route that have the same metric */
+		sibling = fn->leaf;
+		while (sibling) {
+			if (sibling->rt6i_metric == rt->rt6i_metric) {
+				list_add_tail(&rt->rt6i_siblings,
+					      &sibling->rt6i_siblings);
+				break;
+			}
+			sibling = sibling->dst.rt6_next;
+		}
+		/* For each sibling in the list, increment the counter of
+		 * siblings. We can check if all the counter are equal.
+		 */
+		rt6i_nsiblings = 0;
+		list_for_each_entry_safe(sibling, temp_sibling,
+					 &rt->rt6i_siblings,
+					 rt6i_siblings) {
+			sibling->rt6i_nsiblings++;
+			if (unlikely(sibling->rt6i_nsiblings !=
+				     rt->rt6i_nsiblings)) {
+				pr_err("Wrong number of siblings for route %p (%d)\n",
+				       sibling, sibling->rt6i_nsiblings);
+			}
+			rt6i_nsiblings++;
+		}
+		if (unlikely(rt6i_nsiblings != rt->rt6i_nsiblings)) {
+			pr_err("Wrong number of siblings for route %p. I have %d routes, but count %d siblings\n",
+			       rt, rt6i_nsiblings, rt->rt6i_nsiblings);
+		}
+	}
+#endif
 	/*
 	 *	insert node
 	 */
@@ -1197,6 +1255,21 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
 	if (fn->rr_ptr == rt)
 		fn->rr_ptr = NULL;
 
+#ifdef CONFIG_IPV6_MULTIPATH
+	/* Remove this entry from other siblings */
+	if (rt->rt6i_nsiblings) {
+		struct rt6_info *sibling, *next_sibling;
+
+		/* For each siblings, decrement the counter of siblings */
+		list_for_each_entry_safe(sibling, next_sibling,
+					 &rt->rt6i_siblings, rt6i_siblings) {
+			sibling->rt6i_nsiblings--;
+		}
+		rt->rt6i_nsiblings = 0;
+		list_del_init(&rt->rt6i_siblings);
+	}
+#endif
+
 	/* Adjust walkers */
 	read_lock(&fib6_walker_lock);
 	FOR_WALKERS(w) {
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 399613b..563d671 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -57,6 +57,9 @@
 #include <net/xfrm.h>
 #include <net/netevent.h>
 #include <net/netlink.h>
+#ifdef CONFIG_IPV6_MULTIPATH
+#include <net/nexthop.h>
+#endif
 
 #include <asm/uaccess.h>
 
@@ -288,6 +291,10 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net,
 
 		memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
 		rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers);
+#ifdef CONFIG_IPV6_MULTIPATH
+		INIT_LIST_HEAD(&rt->rt6i_siblings);
+		rt->rt6i_nsiblings = 0;
+#endif
 	}
 	return rt;
 }
@@ -388,6 +395,122 @@ static bool rt6_need_strict(const struct in6_addr *daddr)
 		(IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
 }
 
+#ifdef CONFIG_IPV6_MULTIPATH
+/*
+ *	Multipath route selection.
+ */
+
+#ifdef CONFIG_IPV6_MULTIPATH_RANDOM
+/*
+ * Pseudo random candidate function
+ */
+static int rt6_info_hash_randomfn(unsigned int candidate_count)
+{
+	return random32() % candidate_count;
+}
+#endif
+
+#ifdef CONFIG_IPV6_MULTIPATH_RR
+/*
+ * Fake Round Robin candidate function
+ * If we want real RR, we need to add a counter in each route
+ */
+static int rt6_info_hash_falserr(unsigned int candidate_count)
+{
+	static unsigned int seed;
+	seed++;
+	return seed % candidate_count;
+}
+#endif
+
+#ifdef CONFIG_IPV6_MULTIPATH_ROUTE
+/*
+ * Pseudo random candidate using the src port, and other information
+ * Adapted from fib_info_hashfn()
+ */
+static int rt6_info_hash_nhsfn(unsigned int candidate_count,
+			       const struct flowi6 *fl6)
+{
+	unsigned int val = fl6->flowi6_proto;
+
+	val ^= fl6->daddr.s6_addr32[0];
+	val ^= fl6->daddr.s6_addr32[1];
+	val ^= fl6->daddr.s6_addr32[2];
+	val ^= fl6->daddr.s6_addr32[3];
+
+	val ^= fl6->saddr.s6_addr32[0];
+	val ^= fl6->saddr.s6_addr32[1];
+	val ^= fl6->saddr.s6_addr32[2];
+	val ^= fl6->saddr.s6_addr32[3];
+
+	/* Work only if this not encapsulated */
+	switch (fl6->flowi6_proto) {
+	case IPPROTO_UDP:
+	case IPPROTO_TCP:
+	case IPPROTO_SCTP:
+		val ^= fl6->fl6_sport;
+		val ^= fl6->fl6_dport;
+		break;
+
+	case IPPROTO_ICMPV6:
+		val ^= fl6->fl6_icmp_type;
+		val ^= fl6->fl6_icmp_code;
+		break;
+	}
+
+	/* Perhaps, we need to tune, this function? */
+	val = val ^ (val >> 7) ^ (val >> 12);
+	return val % candidate_count;
+}
+#endif
+
+/*
+ * This function return an index used to select (at random, round robin, ...)
+ * a route between any siblings.
+ *
+ * Note: fl6 can be NULL
+ */
+static unsigned int rt6_info_hashfn(const struct rt6_info *rt,
+				    const struct flowi6 *fl6)
+{
+	int candidate_count = rt->rt6i_nsiblings + 1;
+
+#if defined(CONFIG_IPV6_MULTIPATH_RR)
+	return rt6_info_hash_falserr(candidate_count);
+#elif defined(CONFIG_IPV6_MULTIPATH_RANDOM)
+	return rt6_info_hash_randomfn(candidate_count);
+#elif defined(CONFIG_IPV6_MULTIPATH_ROUTE)
+	if (fl6 == NULL)
+		return 0;
+	return rt6_info_hash_nhsfn(candidate_count, fl6);
+#else
+	return 0;
+#endif
+}
+
+static struct rt6_info *rt6_multipath_select(struct rt6_info *match,
+					     struct flowi6 *fl6)
+{
+	struct rt6_info *sibling, *next_sibling;
+	int route_choosen;
+
+	route_choosen = rt6_info_hashfn(match, fl6);
+	/* Don't change the route, if route_choosen == 0
+	 * (siblings does not include ourself)
+	 */
+	if (route_choosen)
+		list_for_each_entry_safe(sibling, next_sibling,
+				&match->rt6i_siblings, rt6i_siblings) {
+			route_choosen--;
+			if (route_choosen == 0) {
+				match = sibling;
+				break;
+			}
+		}
+	return match;
+}
+#endif /* CONFIG_IPV6_MULTIPATH */
+
 /*
  *	Route lookup. Any table->tb6_lock is implied.
  */
@@ -705,6 +828,10 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net,
 restart:
 	rt = fn->leaf;
 	rt = rt6_device_match(net, rt, &fl6->saddr, fl6->flowi6_oif, flags);
+#ifdef CONFIG_IPV6_MULTIPATH
+	if (rt->rt6i_nsiblings && fl6->flowi6_oif == 0)
+		rt = rt6_multipath_select(rt, fl6);
+#endif
 	BACKTRACK(net, &fl6->saddr);
 out:
 	dst_use(&rt->dst, jiffies);
@@ -866,7 +993,10 @@ restart_2:
 
 restart:
 	rt = rt6_select(fn, oif, strict | reachable);
-
+#ifdef CONFIG_IPV6_MULTIPATH
+	if (rt->rt6i_nsiblings && oif == 0)
+		rt = rt6_multipath_select(rt, fl6);
+#endif
 	BACKTRACK(net, &fl6->saddr);
 	if (rt == net->ipv6.ip6_null_entry ||
 	    rt->rt6i_flags & RTF_CACHE)
@@ -2247,6 +2377,9 @@ static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = {
 	[RTA_IIF]		= { .type = NLA_U32 },
 	[RTA_PRIORITY]          = { .type = NLA_U32 },
 	[RTA_METRICS]           = { .type = NLA_NESTED },
+#ifdef CONFIG_IPV6_MULTIPATH
+	[RTA_MULTIPATH]		= { .len = sizeof(struct rtnexthop) },
+#endif
 };
 
 static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
@@ -2324,11 +2457,69 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
 	if (tb[RTA_TABLE])
 		cfg->fc_table = nla_get_u32(tb[RTA_TABLE]);
 
+#ifdef CONFIG_IPV6_MULTIPATH
+	if (tb[RTA_MULTIPATH]) {
+		cfg->fc_mp = nla_data(tb[RTA_MULTIPATH]);
+		cfg->fc_mp_len = nla_len(tb[RTA_MULTIPATH]);
+	}
+#endif
+
 	err = 0;
 errout:
 	return err;
 }
 
+#ifdef CONFIG_IPV6_MULTIPATH
+static int ip6_route_multipath(struct fib6_config *cfg, int add)
+{
+	struct fib6_config r_cfg;
+	struct rtnexthop *rtnh;
+	int remaining;
+	int attrlen;
+	int err = 0, last_err = 0;
+
+beginning:
+	rtnh = (struct rtnexthop *)cfg->fc_mp;
+	remaining = cfg->fc_mp_len;
+
+	/* Parse a Multipath Entry */
+	while (rtnh_ok(rtnh, remaining)) {
+		memcpy(&r_cfg, cfg, sizeof(*cfg));
+		if (rtnh->rtnh_ifindex)
+			r_cfg.fc_ifindex = rtnh->rtnh_ifindex;
+
+		attrlen = rtnh_attrlen(rtnh);
+		if (attrlen > 0) {
+			struct nlattr *nla, *attrs = rtnh_attrs(rtnh);
+
+			nla = nla_find(attrs, attrlen, RTA_GATEWAY);
+			if (nla) {
+				nla_memcpy(&r_cfg.fc_gateway, nla, 16);
+				r_cfg.fc_flags |= RTF_GATEWAY;
+			}
+		}
+		err = add ? ip6_route_add(&r_cfg) : ip6_route_del(&r_cfg);
+		if (err) {
+			last_err = err;
+			/* If we are trying to remove a route, do not stop the
+			 * loop when ip6_route_del() fails (because next hop is
+			 * already gone), we should try to remove all next hops.
+			 */
+			if (add) {
+				/* If add fails, we should try to delete all
+				 * next hops that have been already added.
+				 */
+				add = 0;
+				goto beginning;
+			}
+		}
+		rtnh = rtnh_next(rtnh, &remaining);
+	}
+
+	return last_err;
+}
+#endif /* CONFIG_IPV6_MULTIPATH */
+
 static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
 {
 	struct fib6_config cfg;
@@ -2338,7 +2529,12 @@ static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *a
 	if (err < 0)
 		return err;
 
-	return ip6_route_del(&cfg);
+#ifdef CONFIG_IPV6_MULTIPATH
+	if (cfg.fc_mp)
+		return ip6_route_multipath(&cfg, 0);
+	else
+#endif
+		return ip6_route_del(&cfg);
 }
 
 static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
@@ -2350,7 +2546,12 @@ static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *a
 	if (err < 0)
 		return err;
 
-	return ip6_route_add(&cfg);
+#ifdef CONFIG_IPV6_MULTIPATH
+	if (cfg.fc_mp)
+		return ip6_route_multipath(&cfg, 1);
+	else
+#endif
+		return ip6_route_add(&cfg);
 }
 
 static inline size_t rt6_nlmsg_size(void)
-- 
1.7.12

^ permalink raw reply related

* Re: [PATCH NEXT] rtlwifi: rtl8192c: rtl8192ce: Add support for B-CUT version of RTL8188CE
From: Anisse Astier @ 2012-09-12  8:37 UTC (permalink / raw)
  To: Larry Finger
  Cc: linville-2XuSBdqkA4R54TAoqtyWWQ,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA, Li Chaoming
In-Reply-To: <1347393962-7661-1-git-send-email-Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>

On Tue, 11 Sep 2012 15:06:02 -0500, Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org> wrote :

> Realtek devices with designation RTL8188CE-VL have the so-called B-cut
> of the wireless chip. This patch adds the special programming needed by
> these devices.
> 
> Signed-off-by: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
> Cc: Anisse Astier <anisse-fwwRqrJYcP2HXe+LvDLADg@public.gmane.org>
> Cc: Li Chaoming <chaoming_li-kXabqFNEczNtrwSWzY7KCg@public.gmane.org>

Tested-by: Anisse Astier <anisse-fwwRqrJYcP2HXe+LvDLADg@public.gmane.org>

Fixes both problems I reported:
 - kernel freezing/lockup when fwlps=1 (default)
 - card not working, then freeze, even if fwlps=0.


> ---
>  drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c |   21 +++++++
>  drivers/net/wireless/rtlwifi/rtl8192ce/def.h       |    3 +
>  drivers/net/wireless/rtlwifi/rtl8192ce/hw.c        |   61 ++++++++++++++++++--
>  drivers/net/wireless/rtlwifi/rtl8192ce/phy.c       |    4 +-
>  drivers/net/wireless/rtlwifi/rtl8192ce/sw.c        |    6 +-
>  drivers/net/wireless/rtlwifi/rtl8192ce/trx.c       |    4 +-
>  6 files changed, 87 insertions(+), 12 deletions(-)
> ---
> 
> John,
> 
> This patch has the patch entitled "rtlwifi: rtl8192ce: Log message that
> B_CUT device may not work" as a pre-requisite. Unlike the previous patch,
> this one is too invasive to backport to the stable kernels, thus it should
> be applied to 3.7.
> 
> Thanks,
> 
> Larry
> ---
> 

[snip]

> diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
> index 86d73b3..bae5269 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
> @@ -896,7 +896,6 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
>  	struct rtl_phy *rtlphy = &(rtlpriv->phy);
>  	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
>  	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
> -	static bool iqk_initialized; /* initialized to false */
>  	bool rtstatus = true;
>  	bool is92c;
>  	int err;
> @@ -921,9 +920,28 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
>  
>  	rtlhal->last_hmeboxnum = 0;
>  	rtl92c_phy_mac_config(hw);
> +	/* because last function modify RCR, so we update
> +	 * rcr var here, or TP will unstable for receive_config
> +	 * is wrong, RX RCR_ACRC32 will cause TP unstabel & Rx
> +	 * RCR_APP_ICV will cause mac80211 unassoc for cisco 1252*/
> +	rtlpci->receive_config = rtl_read_dword(rtlpriv, REG_RCR);
> +	rtlpci->receive_config &= ~(RCR_ACRC32 | RCR_AICV);
> +	rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config);
>  	rtl92c_phy_bb_config(hw);
>  	rtlphy->rf_mode = RF_OP_BY_SW_3WIRE;
>  	rtl92c_phy_rf_config(hw);
> +	if (IS_VENDOR_UMC_A_CUT(rtlhal->version) &&
> +	    !IS_92C_SERIAL(rtlhal->version)) {
> +		rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1, MASKDWORD, 0x30255);
> +		rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G2, MASKDWORD, 0x50a00);
> +	} else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) {
> +		rtl_set_rfreg(hw, RF90_PATH_A, 0x0C, MASKDWORD, 0x894AE);
> +		rtl_set_rfreg(hw, RF90_PATH_A, 0x0A, MASKDWORD, 0x1AF31);
> +		rtl_set_rfreg(hw, RF90_PATH_A, RF_IPA, MASKDWORD, 0x8F425);
> +		rtl_set_rfreg(hw, RF90_PATH_A, RF_SYN_G2, MASKDWORD, 0x4F200);
> +		rtl_set_rfreg(hw, RF90_PATH_A, RF_RCK1, MASKDWORD, 0x44053);
> +		rtl_set_rfreg(hw, RF90_PATH_A, RF_RCK2, MASKDWORD, 0x80201);
> +	}
>  	rtlphy->rfreg_chnlval[0] = rtl_get_rfreg(hw, (enum radio_path)0,
>  						 RF_CHNLBW, RFREG_OFFSET_MASK);
>  	rtlphy->rfreg_chnlval[1] = rtl_get_rfreg(hw, (enum radio_path)1,
> @@ -945,11 +963,11 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
>  
>  	if (ppsc->rfpwr_state == ERFON) {
>  		rtl92c_phy_set_rfpath_switch(hw, 1);
> -		if (iqk_initialized) {
> +		if (rtlphy->iqk_initialized) {
>  			rtl92c_phy_iq_calibrate(hw, true);
>  		} else {
>  			rtl92c_phy_iq_calibrate(hw, false);
> -			iqk_initialized = true;
> +			rtlphy->iqk_initialized = true;
>  		}
>  
>  		rtl92c_dm_check_txpower_tracking(hw);
> @@ -1004,6 +1022,13 @@ static enum version_8192c _rtl92ce_read_chip_version(struct ieee80211_hw *hw)
>  				   ? CHIP_VENDOR_UMC_B_CUT : CHIP_UNKNOWN) |
>  				   CHIP_VENDOR_UMC));
>  		}
> +		if (IS_92C_SERIAL(version)) {
> +			value32 = rtl_read_dword(rtlpriv, REG_HPON_FSM);
> +			version = (enum version_8192c)(version |
> +				   ((CHIP_BONDING_IDENTIFIER(value32)
> +				   == CHIP_BONDING_92C_1T2R) ?
> +				   RF_TYPE_1T2R : 0));
> +		}
>  	}
>  
>  	switch (version) {
> @@ -1019,12 +1044,30 @@ static enum version_8192c _rtl92ce_read_chip_version(struct ieee80211_hw *hw)
>  	case VERSION_A_CHIP_88C:
>  		versionid = "A_CHIP_88C";
>  		break;
> +	case VERSION_NORMAL_UMC_CHIP_92C_1T2R_A_CUT:
> +		versionid = "A_CUT_92C_1T2R";
> +		break;
> +	case VERSION_NORMAL_UMC_CHIP_92C_A_CUT:
> +		versionid = "A_CUT_92C";
> +		break;
> +	case VERSION_NORMAL_UMC_CHIP_88C_A_CUT:
> +		versionid = "A_CUT_88C";
> +		break;
> +	case VERSION_NORMAL_UMC_CHIP_92C_1T2R_B_CUT:
> +		versionid = "B_CUT_92C_1T2R";
> +		break;
> +	case VERSION_NORMAL_UMC_CHIP_92C_B_CUT:
> +		versionid = "B_CUT_92C";
> +		break;
> +	case VERSION_NORMAL_UMC_CHIP_88C_B_CUT:
> +		versionid = "B_CUT_88C";
> +		break;
>  	default:
>  		versionid = "Unknown. Bug?";
>  		break;
>  	}
>  
> -	RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
> +	RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG,
>  		 "Chip Version ID: %s\n", versionid);
>  
>  	switch (version & 0x3) {
> @@ -1197,6 +1240,7 @@ static void _rtl92ce_poweroff_adapter(struct ieee80211_hw *hw)
>  {
>  	struct rtl_priv *rtlpriv = rtl_priv(hw);
>  	struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw);
> +	struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
>  	u8 u1b_tmp;
>  	u32 u4b_tmp;
>  
> @@ -1225,7 +1269,8 @@ static void _rtl92ce_poweroff_adapter(struct ieee80211_hw *hw)
>  	rtl_write_word(rtlpriv, REG_GPIO_IO_SEL, 0x0790);
>  	rtl_write_word(rtlpriv, REG_LEDCFG0, 0x8080);
>  	rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL, 0x80);
> -	rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x23);
> +	if (!IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version))
> +		rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x23);
>  	if (rtlpcipriv->bt_coexist.bt_coexistence) {
>  		u4b_tmp = rtl_read_dword(rtlpriv, REG_AFE_XTAL_CTRL);
>  		u4b_tmp |= 0x03824800;
> @@ -1254,6 +1299,9 @@ void rtl92ce_card_disable(struct ieee80211_hw *hw)
>  		rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF);
>  	RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
>  	_rtl92ce_poweroff_adapter(hw);
> +
> +	/* after power off we should do iqk again */
> +	rtlpriv->phy.iqk_initialized = false;
>  }
>  
>  void rtl92ce_interrupt_recognized(struct ieee80211_hw *hw,
> @@ -1912,6 +1960,8 @@ static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw,
>  			ratr_bitmap &= 0x0f0ff0ff;
>  		break;
>  	}
> +	sta_entry->ratr_index = ratr_index;
> +
>  	RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG,
>  		 "ratr_bitmap :%x\n", ratr_bitmap);
>  	*(u32 *)&rate_mask = (ratr_bitmap & 0x0fffffff) |
> @@ -2291,3 +2341,4 @@ void rtl92ce_suspend(struct ieee80211_hw *hw)
>  void rtl92ce_resume(struct ieee80211_hw *hw)
>  {
>  }
> +
Whitespace.


Reviewed-by: Anisse Astier <anisse-fwwRqrJYcP2HXe+LvDLADg@public.gmane.org>

Regards,

Anisse
--
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


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox