diff mbox

IPv6: use ipv6_addr_v4mapped()

Message ID 4AF89241.7060203@hp.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Brian Haley Nov. 9, 2009, 10:05 p.m. UTC
Change udp6_portaddr_hash() to use ipv6_addr_v4mapped()
inline instead of ipv6_addr_type().

Signed-off-by: Brian Haley <brian.haley@hp.com>
---

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

Comments

Eric Dumazet Nov. 9, 2009, 10:59 p.m. UTC | #1
Brian Haley a écrit :
> Change udp6_portaddr_hash() to use ipv6_addr_v4mapped()
> inline instead of ipv6_addr_type().
> 
> Signed-off-by: Brian Haley <brian.haley@hp.com>
> ---
> 
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index 2915e1d..0ed1637 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -89,7 +89,7 @@ static unsigned int udp6_portaddr_hash(struct net *net,
>  
>  	if (ipv6_addr_any(addr6))
>  		hash = jhash_1word(0, mix);
> -	else if (ipv6_addr_type(addr6) == IPV6_ADDR_MAPPED)
> +	else if (ipv6_addr_v4mapped(addr6))
>  		hash = jhash_1word(addr6->s6_addr32[3], mix);
>  	else
>  		hash = jhash2(addr6->s6_addr32, 4, mix);

Indeed, its a bit faster ;)

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Thanks Brian

--
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
David Miller Nov. 11, 2009, 6:34 a.m. UTC | #2
From: Brian Haley <brian.haley@hp.com>
Date: Mon, 09 Nov 2009 17:05:53 -0500

> Change udp6_portaddr_hash() to use ipv6_addr_v4mapped()
> inline instead of ipv6_addr_type().
> 
> Signed-off-by: Brian Haley <brian.haley@hp.com>

Applied to net-next-2.6
--
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
diff mbox

Patch

diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 2915e1d..0ed1637 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -89,7 +89,7 @@  static unsigned int udp6_portaddr_hash(struct net *net,
 
 	if (ipv6_addr_any(addr6))
 		hash = jhash_1word(0, mix);
-	else if (ipv6_addr_type(addr6) == IPV6_ADDR_MAPPED)
+	else if (ipv6_addr_v4mapped(addr6))
 		hash = jhash_1word(addr6->s6_addr32[3], mix);
 	else
 		hash = jhash2(addr6->s6_addr32, 4, mix);