Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net] bnx2: Fix bug in bnx2_free_tx_skbs().
From: David Miller @ 2012-07-11  6:37 UTC (permalink / raw)
  To: mchan; +Cc: netdev
In-Reply-To: <1341950680-12266-1-git-send-email-mchan@broadcom.com>

From: "Michael Chan" <mchan@broadcom.com>
Date: Tue, 10 Jul 2012 13:04:40 -0700

> In rare cases, bnx2x_free_tx_skbs() can unmap the wrong DMA address
> when it gets to the last entry of the tx ring.  We were not using
> the proper macro to skip the last entry when advancing the tx index.
> 
> Reported-by: Zongyun Lai <zlai@vmware.com>
> Reviewed-by: Jeffrey Huang <huangjw@broadcom.com>
> Signed-off-by: Michael Chan <mchan@broadcom.com>

Applied and queued up for -stable.

^ permalink raw reply

* Re: [net] net: Fix memory leak - vlan_info struct
From: David Miller @ 2012-07-11  6:36 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: amir.hanania, netdev, gospo, sassmann
In-Reply-To: <1341902839-13181-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Mon,  9 Jul 2012 23:47:19 -0700

> From: Amir Hanania <amir.hanania@intel.com>
> 
> In driver reload test there is a memory leak.
> The structure vlan_info was not freed when the driver was removed.
> It was not released since the nr_vids var is one after last vlan was removed.
> The nr_vids is one, since vlan zero is added to the interface when the interface
> is being set, but the vlan zero is not deleted at unregister.
> Fix - delete vlan zero when we unregister the device.
> 
> Signed-off-by: Amir Hanania <amir.hanania@intel.com>
> Acked-by: John Fastabend <john.r.fastabend@intel.com>
> Tested-by: Aaron Brown <aaron.f.brown@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply

* Re: linux-next: build failure after merge of the net-next tree
From: David Miller @ 2012-07-11  6:36 UTC (permalink / raw)
  To: sfr; +Cc: netdev, linux-next, linux-kernel, bjorn
In-Reply-To: <20120710130848.1014fbe05e5146a33a3c7d39@canb.auug.org.au>

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Tue, 10 Jul 2012 13:08:48 +1000

> I added the following merge fix patch:
> 
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Tue, 10 Jul 2012 13:06:01 +1000
> Subject: [PATCH] net: fix for qmi_wwan_unbind_shared changes
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>

Thanks Stephen, I'll incorporate this when I merge net into net-next.

Thanks again!

^ permalink raw reply

* Re: [PATCH net] Bug fix for batman-adv 2012-07-06
From: David Miller @ 2012-07-11  6:36 UTC (permalink / raw)
  To: ordex-GaUfNO9RBHfsrOwW+9ziJQ
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <20120705225140.GA9745-E/2OGukznS5g9hUCZPvPmw@public.gmane.org>

From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
Date: Fri, 6 Jul 2012 00:51:40 +0200

> here you have our instructions to resolve the conflicts that you will hit while
> merging net into net-next:

Thanks for this.

^ permalink raw reply

* Re: [PATCH net] Bug fix for batman-adv 2012-07-06
From: David Miller @ 2012-07-11  6:35 UTC (permalink / raw)
  To: ordex-GaUfNO9RBHfsrOwW+9ziJQ
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <1341528514-27906-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>

From: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
Date: Fri,  6 Jul 2012 00:48:33 +0200

>   git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem

Pulled, thanks.

^ permalink raw reply

* [patch] net/mlx4_en: dereferencing freed memory
From: Dan Carpenter @ 2012-07-11  6:34 UTC (permalink / raw)
  To: Yevgeny Petrilin
  Cc: David S. Miller, Amir Vadai, Or Gerlitz, Alexander Guller, netdev,
	kernel-janitors

We dereferenced "mclist" after the kfree().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 94375a8..4ce5ca8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -503,9 +503,7 @@ static void mlx4_en_do_set_multicast(struct work_struct *work)
 				/* remove from list */
 				list_del(&mclist->list);
 				kfree(mclist);
-			}
-
-			if (mclist->action == MCLIST_ADD) {
+			} else if (mclist->action == MCLIST_ADD) {
 				/* attach the address */
 				memcpy(&mc_list[10], mclist->addr, ETH_ALEN);
 				/* needed for B0 steering support */

^ permalink raw reply related

* [patch] net/mlx4: off by one in parse_trans_rule()
From: Dan Carpenter @ 2012-07-11  6:33 UTC (permalink / raw)
  To: Hadar Hen Zion
  Cc: David S. Miller, Or Gerlitz, Eugenia Emantayev, Yevgeny Petrilin,
	netdev, kernel-janitors

This should be ">=" here instead of ">".  MLX4_NET_TRANS_RULE_NUM is 6.
We use "spec->id" as an array offset into the __rule_hw_sz[] and
__sw_id_hw[] arrays which have 6 elements.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c
index bc62f53..5bac0df 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mcg.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c
@@ -773,7 +773,7 @@ static int parse_trans_rule(struct mlx4_dev *dev, struct mlx4_spec_list *spec,
 		[MLX4_NET_TRANS_RULE_ID_UDP] =
 			sizeof(struct mlx4_net_trans_rule_hw_tcp_udp)
 	};
-	if (spec->id > MLX4_NET_TRANS_RULE_NUM) {
+	if (spec->id >= MLX4_NET_TRANS_RULE_NUM) {
 		mlx4_err(dev, "Invalid network rule id. id = %d\n", spec->id);
 		return -EINVAL;
 	}

^ permalink raw reply related

* [patch -next] net: writes past the end of the struct
From: Dan Carpenter @ 2012-07-11  6:32 UTC (permalink / raw)
  To: David S. Miller
  Cc: Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy, netdev, kernel-janitors

There are a couple places that try to set part of the struct to 0 by
doing:

    memset(&rt->rt6i_table, 0, sizeof(*rt) - sizeof(struct dst_entry));

It assumes that the first element is a dst_entry and the second element
is ->rt6_table.  The problem is we changed the struct in 97cac0821a
('ipv6: Store route neighbour in rt6_info struct.') and we aren't
clearing rt->n but instead we're writing past the end of the array.

I've changed it to:
    memset(&rt->n, 0, sizeof(*rt) - offsetof(struct rt6_info, n));

The memset in ip6_dst_alloc() was ok but I changed it to use offsetof()
as a cleanup.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 6e97855..c2186a7 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1353,8 +1353,8 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
 	xdst = dst_alloc(dst_ops, NULL, 0, 0, 0);
 
 	if (likely(xdst)) {
-		memset(&xdst->u.rt6.rt6i_table, 0,
-			sizeof(*xdst) - sizeof(struct dst_entry));
+		memset(&xdst->u.rt6.n, 0,
+			sizeof(*xdst) - offsetof(struct rt6_info, n));
 		xdst->flo.ops = &xfrm_bundle_fc_ops;
 	} else
 		xdst = ERR_PTR(-ENOBUFS);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6cc6c88..41693f6 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -274,7 +274,7 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net,
 
 	if (rt) {
 		memset(&rt->n, 0,
-		       sizeof(*rt) - sizeof(struct dst_entry));
+		       sizeof(*rt) - offsetof(struct rt6_info, n));
 		rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers);
 	}
 	return rt;
@@ -975,7 +975,7 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori
 
 	rt = dst_alloc(&ip6_dst_blackhole_ops, ort->dst.dev, 1, 0, 0);
 	if (rt) {
-		memset(&rt->rt6i_table, 0, sizeof(*rt) - sizeof(struct dst_entry));
+		memset(&rt->n, 0, sizeof(*rt) - offsetof(struct rt6_info, n));
 		rt6_init_peer(rt, net->ipv6.peers);
 
 		new = &rt->dst;

^ permalink raw reply related

* [patch -next] smsc95xx: signedness bug in get_regs()
From: Dan Carpenter @ 2012-07-11  6:32 UTC (permalink / raw)
  To: Steve Glendinning, Emeric Vigier
  Cc: David S. Miller, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

"retval" has to be a signed integer for the error handling to work.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 05ecf14..bd7cbaa 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -589,7 +589,8 @@ smsc95xx_ethtool_getregs(struct net_device *netdev, struct ethtool_regs *regs,
 			 void *buf)
 {
 	struct usbnet *dev = netdev_priv(netdev);
-	unsigned int i, j, retval;
+	unsigned int i, j;
+	int retval;
 	u32 *data = buf;
 
 	retval = smsc95xx_read_reg(dev, ID_REV, &regs->version);
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" 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: [RFC][PATCH 1/4] skbtrace: core feature
From: Eric Dumazet @ 2012-07-11  6:32 UTC (permalink / raw)
  To: Li Yu; +Cc: Linux Netdev List
In-Reply-To: <4FFD1A0C.8090909@gmail.com>

On Wed, 2012-07-11 at 14:15 +0800, Li Yu wrote:
> 于 2012年07月11日 12:03, Eric Dumazet 写道:

> > You said that some 'buggy' drivers set rxhash to zero, but its a valid
> > operation.
> >
> > You said 'it seems that RPS hashing can not work well for some corner
> > cases', but its a known fact.
> >
> 
> Em, we really are able to verify RPS imbalance by checking the last
> column of /proc/net/softnet_stat, but skbtrace can give us more details
> of RSS/RPS hashing. For improper RPS hashing case, it can provide more
> details of what really happen in real time.

A hash is a hash. Its rarely perfect.

RPS is a best effort, and not suitable for all needs.

If you follow netdev, maybe you saw that I suggested to use a BPF to
compute the hash, for specialized needs.

Of course, RFS can also help right now.

^ permalink raw reply

* Re: [PATCH net-next 0/9] qlge: bug fix
From: David Miller @ 2012-07-11  6:28 UTC (permalink / raw)
  To: jitendra.kalsaria; +Cc: netdev, ron.mercer, Dept_NX_Linux_NIC_Driver
In-Reply-To: <1341968259-18931-1-git-send-email-jitendra.kalsaria@qlogic.com>

From: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Date: Tue, 10 Jul 2012 20:57:30 -0400

> Please apply it to net-next.

Series applied, thanks.

^ permalink raw reply

* Re: [PATCH 0/4] Calxeda xgmac fixes and performance improvements
From: David Miller @ 2012-07-11  6:27 UTC (permalink / raw)
  To: robherring2; +Cc: netdev, linux-kernel, rob.herring
In-Reply-To: <1341879370-23385-1-git-send-email-robherring2@gmail.com>

From: Rob Herring <robherring2@gmail.com>
Date: Mon,  9 Jul 2012 19:16:06 -0500

> From: Rob Herring <rob.herring@calxeda.com>
> 
> A few fixes and performance improvements for the Calxeda xgmac driver for
> 3.6. It would be nice to get the 2 fixes into 3.5, but since it is a bit
> late in the cycle they can wait.

All applied to net-nex, thanks.

^ permalink raw reply

* Re: [PATCH] vxge/s2io: remove dead URLs
From: David Miller @ 2012-07-11  6:21 UTC (permalink / raw)
  To: jdmason; +Cc: netdev
In-Reply-To: <20120710.231832.391247031231469078.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Tue, 10 Jul 2012 23:18:32 -0700 (PDT)

> From: Jon Mason <jdmason@kudzu.us>
> Date: Mon,  9 Jul 2012 17:07:57 -0700
> 
>> URLs to neterion.com and s2io.com no longer resolve.  Remove all references to
>> these URLs in the driver source and documentation.
>> 
>> Signed-off-by: Jon Mason <jdmason@kudzu.us>
> 
> Applied, but I had to fix:
> 
>> -7. Support 
>> +6. Support 
>              ^^
> 
> that trailing whitespace.

Wow you didn't even build test this patch, otherwise you would have
seen:

drivers/net/ethernet/neterion/vxge/vxge-main.c: In function ‘vxge_probe_fw_update’:
drivers/net/ethernet/neterion/vxge/vxge-main.c:4263:3: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘u32’ [-Wformat]
drivers/net/ethernet/neterion/vxge/vxge-main.c:4263:3: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat]

I'm fixing this up, but next time this will put you on my shit
list for sure.

^ permalink raw reply

* Re: [PATCH 01/11] lance: remove unnecessary setting of skb->dev
From: David Miller @ 2012-07-11  6:18 UTC (permalink / raw)
  To: jdmason; +Cc: netdev
In-Reply-To: <1341878975-10577-1-git-send-email-jdmason@kudzu.us>


All 11 patches applied, thanks.

^ permalink raw reply

* Re: [PATCH] vxge/s2io: remove dead URLs
From: David Miller @ 2012-07-11  6:18 UTC (permalink / raw)
  To: jdmason; +Cc: netdev
In-Reply-To: <1341878877-10507-1-git-send-email-jdmason@kudzu.us>

From: Jon Mason <jdmason@kudzu.us>
Date: Mon,  9 Jul 2012 17:07:57 -0700

> URLs to neterion.com and s2io.com no longer resolve.  Remove all references to
> these URLs in the driver source and documentation.
> 
> Signed-off-by: Jon Mason <jdmason@kudzu.us>

Applied, but I had to fix:

> -7. Support 
> +6. Support 
             ^^

that trailing whitespace.

^ permalink raw reply

* Re: [RFC][PATCH 1/4] skbtrace: core feature
From: Li Yu @ 2012-07-11  6:15 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Linux Netdev List
In-Reply-To: <1341979398.3265.6648.camel@edumazet-glaptop>

于 2012年07月11日 12:03, Eric Dumazet 写道:
> On Wed, 2012-07-11 at 10:17 +0800, Li Yu wrote:
>> From: Li Yu <bingtian.ly@taobao.com>
>>
>> This implements core feature of skbtrace, which contains glue code of
>> tracepoints subsystem and relay file system, and provide skbtrace API
>> for particular networking traces.
>>
>> Thanks
>
> Hi Li
>
> This seems a huge amount of code, on an already complex stack.
>
> I am not convinced its needed. It looks like a debugging aid you had to
> write in order to understand better linux network stack.
>
> Lets see if you manage to maintain this for a while before considering
> upstreaming it.
>

Indeed, They are not toy patches and need some time to verify their
practicability. I approximately started this project on February of
this year since I am asked to repeatedly solve some similar performance
problems or explain surprised exceptional behaviors of networking stack.
Some hard investigation works also are duplicated again and again. I
hope that skbtrace such like is able to improve this problem-solve
process.

> You said that some 'buggy' drivers set rxhash to zero, but its a valid
> operation.
>
> You said 'it seems that RPS hashing can not work well for some corner
> cases', but its a known fact.
>

Em, we really are able to verify RPS imbalance by checking the last
column of /proc/net/softnet_stat, but skbtrace can give us more details
of RSS/RPS hashing. For improper RPS hashing case, it can provide more
details of what really happen in real time.

Thanks.

> Thanks
>
>
>

^ permalink raw reply

* Re: [PATCH net-next] ipv6: optimize ipv6 addresses compares
From: David Miller @ 2012-07-11  6:13 UTC (permalink / raw)
  To: eric.dumazet; +Cc: joe, netdev
In-Reply-To: <1341983157.3265.6792.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 11 Jul 2012 07:05:57 +0200

> [PATCH net-next v2]  ipv6: optimize ipv6 addresses compares
> 
> On 64 bit arches having efficient unaligned accesses (eg x86_64) we can
> use long words to reduce number of instructions for free.
> 
> Joe Perches suggested to change ipv6_masked_addr_cmp() to return a bool
> instead of 'int', to make sure ipv6_masked_addr_cmp() cannot be used
> in a sorting function.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Looks good, will apply, thanks.

^ permalink raw reply

* Re: [PATCH v2 net-next 0/5] Cleanup, mostly kernel-doc
From: David Miller @ 2012-07-11  6:11 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev
In-Reply-To: <1341953604.2605.24.camel@bwh-desktop.uk.solarflarecom.com>

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Tue, 10 Jul 2012 21:53:24 +0100

> I spotted some minor errors in the RSS policy changes, and one thing led
> to another and I ended up with all this.
> 
> v2: Avoid leaving comments starting with '/*\n'.
>     Fix a few more non-kernel-doc comments.

I'll apply this, thanks Ben.

^ permalink raw reply

* Re: [PATCH 0/16] Metrics restructuring.
From: David Miller @ 2012-07-11  6:07 UTC (permalink / raw)
  To: netdev
In-Reply-To: <20120710.080703.916560084659556593.davem@davemloft.net>


Ok, I've incorporated all the feedback and pushed the result
into net-next:

1) Namespace support for TCP metrics cache.

2) Cleanup address comparisons and add necessary sparse casts.

3) Trailing whitespace.

Thanks everyone.

^ permalink raw reply

* Re: [PATCH net-next] ipv6: optimize ipv6 addresses compares
From: David Miller @ 2012-07-11  5:44 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, joe
In-Reply-To: <1341981861.3265.6740.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 11 Jul 2012 06:44:21 +0200

> I dont see where in demux code we have a 64bit access ?

Oh I see, we only do it in the socket, sigh.

#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
	(((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) &&	\
	 ((*((__addrpair *)&(inet_sk(__sk)->inet_daddr))) == (__cookie))  &&	\
	 ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports))   &&	\
 ...

^ permalink raw reply

* Re: [PATCH net-next] ipv6: optimize ipv6 addresses compares
From: Eric Dumazet @ 2012-07-11  5:05 UTC (permalink / raw)
  To: Joe Perches; +Cc: David Miller, netdev
In-Reply-To: <1341980090.13724.43.camel@joe2Laptop>

From: Eric Dumazet <edumazet@google.com>

On Tue, 2012-07-10 at 21:14 -0700, Joe Perches wrote:

> Come to think of it, this should probably be bool to
> avoid anyone possibly using this in a sorting function.

Yes, this sounds reasonable, thanks.

[PATCH net-next v2]  ipv6: optimize ipv6 addresses compares

On 64 bit arches having efficient unaligned accesses (eg x86_64) we can
use long words to reduce number of instructions for free.

Joe Perches suggested to change ipv6_masked_addr_cmp() to return a bool
instead of 'int', to make sure ipv6_masked_addr_cmp() cannot be used
in a sorting function.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Joe Perches <joe@perches.com>
---
 include/net/ipv6.h |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index aecf884..d4261d4 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -298,14 +298,23 @@ static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr
 	return memcmp(a1, a2, sizeof(struct in6_addr));
 }
 
-static inline int
+static inline bool
 ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m,
 		     const struct in6_addr *a2)
 {
+#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
+	const unsigned long *ul1 = (const unsigned long *)a1;
+	const unsigned long *ulm = (const unsigned long *)m;
+	const unsigned long *ul2 = (const unsigned long *)a2;
+
+	return !!(((ul1[0] ^ ul2[0]) & ulm[0]) |
+		  ((ul1[1] ^ ul2[1]) & ulm[1]));
+#else
 	return !!(((a1->s6_addr32[0] ^ a2->s6_addr32[0]) & m->s6_addr32[0]) |
 		  ((a1->s6_addr32[1] ^ a2->s6_addr32[1]) & m->s6_addr32[1]) |
 		  ((a1->s6_addr32[2] ^ a2->s6_addr32[2]) & m->s6_addr32[2]) |
 		  ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3]));
+#endif
 }
 
 static inline void ipv6_addr_prefix(struct in6_addr *pfx, 
@@ -335,10 +344,17 @@ static inline void ipv6_addr_set(struct in6_addr *addr,
 static inline bool ipv6_addr_equal(const struct in6_addr *a1,
 				   const struct in6_addr *a2)
 {
+#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
+	const unsigned long *ul1 = (const unsigned long *)a1;
+	const unsigned long *ul2 = (const unsigned long *)a2;
+
+	return ((ul1[0] ^ ul2[0]) | (ul1[1] ^ ul2[1])) == 0UL;
+#else
 	return ((a1->s6_addr32[0] ^ a2->s6_addr32[0]) |
 		(a1->s6_addr32[1] ^ a2->s6_addr32[1]) |
 		(a1->s6_addr32[2] ^ a2->s6_addr32[2]) |
 		(a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0;
+#endif
 }
 
 static inline bool __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
@@ -391,8 +407,14 @@ bool ip6_frag_match(struct inet_frag_queue *q, void *a);
 
 static inline bool ipv6_addr_any(const struct in6_addr *a)
 {
+#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
+	const unsigned long *ul = (const unsigned long *)a;
+
+	return (ul[0] | ul[1]) == 0UL;
+#else
 	return (a->s6_addr32[0] | a->s6_addr32[1] |
 		a->s6_addr32[2] | a->s6_addr32[3]) == 0;
+#endif
 }
 
 static inline bool ipv6_addr_loopback(const struct in6_addr *a)

^ permalink raw reply related

* Re: 82571EB: Detected Hardware Unit Hang
From: Joe Jin @ 2012-07-11  5:03 UTC (permalink / raw)
  To: Dave, Tushar N
  Cc: e1000-devel@lists.sf.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <061C8A8601E8EE4CA8D8FD6990CEA891274EEDD7@ORSMSX102.amr.corp.intel.com>

On 07/11/12 12:05, Dave, Tushar N wrote:
> When you said you had this issue with RHEL5 and RHEL6 drivers, have you install RHEl5/6 kernel and reproduced it? If so I think I should install RHEL6 and try reproduce it locally!
> 
Yes I reproduced this on both RHEL5 and RHEL6.

So far I tried to scp big file (~1GB) will hit it at once.

Thanks,
Joe

^ permalink raw reply

* Re: [PATCH net-next] ipv6: optimize ipv6 addresses compares
From: Eric Dumazet @ 2012-07-11  4:53 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, joe
In-Reply-To: <1341981861.3265.6740.camel@edumazet-glaptop>

On Wed, 2012-07-11 at 06:44 +0200, Eric Dumazet wrote:

> I dont see where in demux code we have a 64bit access ?

I guess you meant the code in include/net/inet_hashtables.h ?

INET_ADDR_COOKIE() loads the two 32bits into one 64bit register/var
So there is no 64bit alignment in packet header itself.

Then, INET_MATCH does a *(u64 *)&(inet_sk(__sk)->inet_daddr)))

This happens to work because skc_daddr & skc_rcv_saddr are at the
beginning of struct sock_common, and its 8bytes aligned on 64bit arches.

^ permalink raw reply

* Re: [PATCH net-next] ipv6: optimize ipv6 addresses compares
From: Eric Dumazet @ 2012-07-11  4:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, joe
In-Reply-To: <20120710.211304.1112522544390324120.davem@davemloft.net>

On Tue, 2012-07-10 at 21:13 -0700, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Wed, 11 Jul 2012 06:07:58 +0200
> 
> > I dont think this 8bytes alignment is possible with ip6tables.
> 
> Hmmm, wouldn't it make more sense to make ip6tables use a special
> accessor than to penalize everyone?

But we cannot guarantee 64bit alignment everywhere.

Think of tunnels for example.

I dont see where in demux code we have a 64bit access ?

^ permalink raw reply

* Re: [PATCH net-next] ipv6: optimize ipv6 addresses compares
From: Joe Perches @ 2012-07-11  4:14 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1341978558.3265.6609.camel@edumazet-glaptop>

On Wed, 2012-07-11 at 05:49 +0200, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> On 64 bit arches having efficient unaligned accesses (eg x86_64) we can
> use long words to reduce number of instructions for free.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Joe Perches <joe@perches.com>
> ---
>  include/net/ipv6.h |   22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/include/net/ipv6.h b/include/net/ipv6.h
> index aecf884..9ac5ded 100644
> --- a/include/net/ipv6.h
> +++ b/include/net/ipv6.h
> @@ -302,10 +302,19 @@ static inline int
>  ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m,
>  		     const struct in6_addr *a2)
>  {
> +#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
> +	const unsigned long *ul1 = (const unsigned long *)a1;
> +	const unsigned long *ulm = (const unsigned long *)m;
> +	const unsigned long *ul2 = (const unsigned long *)a2;
> +
> +	return !!(((ul1[0] ^ ul2[0]) & ulm[0]) |
> +		  ((ul1[1] ^ ul2[1]) & ulm[1]));
> +#else
>  	return !!(((a1->s6_addr32[0] ^ a2->s6_addr32[0]) & m->s6_addr32[0]) |
>  		  ((a1->s6_addr32[1] ^ a2->s6_addr32[1]) & m->s6_addr32[1]) |
>  		  ((a1->s6_addr32[2] ^ a2->s6_addr32[2]) & m->s6_addr32[2]) |
>  		  ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3]));
> +#endif
>  }

Come to think of it, this should probably be bool to
avoid anyone possibly using this in a sorting function.

^ 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