[ofa-general] [RMDA CM IPv6 support. PATCHv4 5/6] IPv6 support for network discovery

Aleksey Senin alekseys at voltaire.com
Wed Nov 26 09:58:57 PST 2008


>From 14290555a2c58906214deb44423277fffd77fc4c Mon Sep 17 00:00:00 2001
From: Aleksey Senin <alekseys at voltaire.com>
Date: Wed, 13 Aug 2008 10:19:13 +0300
Subject: [PATCH] IPv6 support for network discovery

Added support for network discovery in addr_send_arp function

Signed-off-by: Aleksey Senin <alekseys at voltaire.com>
---
 drivers/infiniband/core/addr.c |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 1d785d7..460dcc2 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -43,6 +43,7 @@
 #include <net/netevent.h>
 #include <net/addrconf.h>
 #include <rdma/ib_addr.h>
+#include <net/ip6_route.h>
 
 MODULE_AUTHOR("Sean Hefty");
 MODULE_DESCRIPTION("IB Address Translation");
@@ -172,19 +173,34 @@ static void queue_req(struct addr_req *req)
 	mutex_unlock(&lock);
 }
 
-static void addr_send_arp(struct sockaddr_in *dst_in)
+static void addr_send_arp(struct sockaddr *dst_in)
 {
 	struct rtable *rt;
 	struct flowi fl;
-	__be32 dst_ip = dst_in->sin_addr.s_addr;
+	struct dst_entry *dst;
 
 	memset(&fl, 0, sizeof fl);
-	fl.nl_u.ip4_u.daddr = dst_ip;
-	if (ip_route_output_key(&init_net, &rt, &fl))
-		return;
+	if (dst_in->sa_family == AF_INET)  {
+		fl.nl_u.ip4_u.daddr =
+			((struct sockaddr_in *)dst_in)->sin_addr.s_addr;
 
-	neigh_event_send(rt->u.dst.neighbour, NULL);
-	ip_rt_put(rt);
+		if (ip_route_output_key(&init_net, &rt, &fl))
+			return;
+
+		neigh_event_send(rt->u.dst.neighbour, NULL);
+		ip_rt_put(rt);
+
+	} else {
+		fl.nl_u.ip6_u.daddr =
+			((struct sockaddr_in6 *)dst_in)->sin6_addr;
+
+		dst = ip6_route_output(&init_net, NULL, &fl);
+		if (!dst)
+			return;
+
+		neigh_event_send(dst->neighbour, NULL);
+		dst_release(dst);
+	}
 }
 
 static int addr_resolve_remote(struct sockaddr *src_in,
@@ -373,7 +389,7 @@ int rdma_resolve_ip(struct rdma_addr_client *client,
 	case -ENODATA:
 		req->timeout = msecs_to_jiffies(timeout_ms) + jiffies;
 		queue_req(req);
-		addr_send_arp((struct sockaddr_in *)dst_in);
+		addr_send_arp(dst_in);
 		break;
 	default:
 		ret = req->status;
-- 
1.5.6.dirty





More information about the general mailing list