[ofa-general] [PATCH] cma_zero_addr

Aleksey Senin alekseys at voltaire.com
Tue Dec 2 04:58:00 PST 2008


This is not really bug fix, but more cosmetic change. There is
ipv6_addr_any function in the kernel, so I propose to use it instead of
the same code duplicated in cma_zero_addr.


>From affd57c591799101f89b552973624b39e433e217 Mon Sep 17 00:00:00 2001
From: Aleksey Senin <alekseys at voltaire.com>
Date: Tue, 2 Dec 2008 14:52:27 +0200
Subject: [PATCH] cma_zero_addr optimized

Using builtin kernel function to check zero address

Signed-off-by: Aleksey Senin <alekseys at voltaire.com>

:100644 100644 f69dda4... 17864d6... M	drivers/infiniband/core/cma.c

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index f69dda4..17864d6 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -623,16 +623,12 @@ EXPORT_SYMBOL(rdma_init_qp_attr);
 
 static inline int cma_zero_addr(struct sockaddr *addr)
 {
-	struct in6_addr *ip6;
-
 	if (addr->sa_family == AF_INET)
 		return ipv4_is_zeronet(
 			((struct sockaddr_in *)addr)->sin_addr.s_addr);
-	else {
-		ip6 = &((struct sockaddr_in6 *) addr)->sin6_addr;
-		return (ip6->s6_addr32[0] | ip6->s6_addr32[1] |
-			ip6->s6_addr32[2] | ip6->s6_addr32[3]) == 0;
-	}
+	else
+		return ipv6_addr_any(
+			&((struct sockaddr_in6 *)addr)->sin6_addr);
 }
 
 static inline int cma_loopback_addr(struct sockaddr *addr)
-- 
1.5.6





More information about the general mailing list