[openib-general] [PATCH] Enable inet6 on ib interface

Roland Dreier roland at topspin.com
Thu Nov 11 12:13:42 PST 2004


OK, with the patch below all the correct IPv6 groups seem to be
created and used.  Ping works at least...

One question about IPv6 and IPoIB: currently the IPoIB driver joins
the IPv4 broadcast group and then uses those parameters to join or
create (as needed) the other groups, including all IPv6 multicast
groups.  Is this correct, or is there a distinguished IPv6 MCG that is
supposed to be used as a base as the IPv4 broadcast group is?

Thanks,
  Roland

Signed-off-by: Nitin Hande <Nitin.Hande at Sun.Com>
Signed-off-by: Roland Dreier <roland at topspin.com>

Index: linux-2.6.9/include/net/if_inet6.h
===================================================================
--- linux-2.6.9.orig/include/net/if_inet6.h	2004-10-18 14:55:28.000000000 -0700
+++ linux-2.6.9/include/net/if_inet6.h	2004-11-11 11:38:20.000000000 -0800
@@ -266,5 +266,20 @@
 {
 	buf[0] = 0x00;
 }
+
+static inline void ipv6_ib_mc_map(struct in6_addr *addr, char *buf)
+{
+	buf[0]  = 0;		/* Reserved */
+	buf[1]  = 0xff;		/* Multicast QPN */
+	buf[2]  = 0xff;
+	buf[3]  = 0xff;
+	buf[4]  = 0xff;
+	buf[5]  = 0x12;		/* link local scope */
+	buf[6]  = 0x60;		/* IPv6 signature */
+	buf[7]  = 0x1b;
+	buf[8]  = 0;		/* P_Key */
+	buf[9]  = 0;
+	memcpy(buf + 10, addr->s6_addr + 6, 10);
+}
 #endif
 #endif
Index: linux-2.6.9/net/ipv6/addrconf.c
===================================================================
--- linux-2.6.9.orig/net/ipv6/addrconf.c	2004-10-18 14:55:24.000000000 -0700
+++ linux-2.6.9/net/ipv6/addrconf.c	2004-11-11 11:35:23.000000000 -0800
@@ -1110,6 +1110,13 @@
 		memset(eui, 0, 7);
 		eui[7] = *(u8*)dev->dev_addr;
 		return 0;
+	case ARPHRD_INFINIBAND:
+		/* XXX: replace len with IPOIB_HW_ADDR_LEN later */
+		if (dev->addr_len != 20)
+			return -1;
+		memcpy(eui, dev->dev_addr + 12, 8);
+		eui[0] |= 2;
+		return 0;
 	}
 	return -1;
 }
@@ -1809,6 +1816,7 @@
 	if ((dev->type != ARPHRD_ETHER) && 
 	    (dev->type != ARPHRD_FDDI) &&
 	    (dev->type != ARPHRD_IEEE802_TR) &&
+	    (dev->type != ARPHRD_INFINIBAND) &&
 	    (dev->type != ARPHRD_ARCNET)) {
 		/* Alas, we support only Ethernet autoconfiguration. */
 		return;
Index: linux-2.6.9/net/ipv6/ndisc.c
===================================================================
--- linux-2.6.9.orig/net/ipv6/ndisc.c	2004-10-18 14:54:32.000000000 -0700
+++ linux-2.6.9/net/ipv6/ndisc.c	2004-11-11 11:35:50.000000000 -0800
@@ -260,6 +260,9 @@
 	case ARPHRD_ARCNET:
 		ipv6_arcnet_mc_map(addr, buf);
 		return 0;
+	case ARPHRD_INFINIBAND:
+		ipv6_ib_mc_map(addr, buf);
+		return 0;
 	default:
 		if (dir) {
 			memcpy(buf, dev->broadcast, dev->addr_len);



More information about the general mailing list