[PATCH][RFC/v1][6/12] IPoIB IPv4 multicast

STALE7938d

5 messages, 3 authors, 2004-11-22 · open the first message on its own page

[PATCH][RFC/v1][6/12] IPoIB IPv4 multicast

From: Roland Dreier <hidden>
Date: 2004-11-22 15:41:08

Add ip_ib_mc_map() to convert IPv4 multicast addresses to IPoIB
hardware addresses.  Also add <linux/if_infiniband.h> so INFINIBAND_ALEN
has a home.

The mapping for multicast addresses is described in
  http://www.ietf.org/internet-drafts/draft-ietf-ipoib-ip-over-infiniband-07.txt

Signed-off-by: Roland Dreier <redacted>


Index: linux-bk/include/linux/if_infiniband.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-bk/include/linux/if_infiniband.h	2004-11-21 21:25:56.078881371 -0800
@@ -0,0 +1,29 @@
+/*
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available at
+ * <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD
+ * license, available in the LICENSE.TXT file accompanying this
+ * software.  These details are also available at
+ * <http://openib.org/license.html>.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Copyright (c) 2004 Topspin Communications.  All rights reserved.
+ *
+ * $Id$
+ */
+
+#ifndef _LINUX_IF_INFINIBAND_H
+#define _LINUX_IF_INFINIBAND_H
+
+#define INFINIBAND_ALEN		20	/* Octets in IPoIB HW addr	*/
+
+#endif /* _LINUX_IF_INFINIBAND_H */
Index: linux-bk/include/net/ip.h
===================================================================
--- linux-bk.orig/include/net/ip.h	2004-11-21 21:07:12.110687532 -0800
+++ linux-bk/include/net/ip.h	2004-11-21 21:25:56.078881371 -0800
@@ -229,6 +229,39 @@
 	buf[3]=addr&0x7F;
 }
 
+/*
+ *	Map a multicast IP onto multicast MAC for type IP-over-InfiniBand.
+ *	Leave P_Key as 0 to be filled in by driver.
+ */
+
+static inline void ip_ib_mc_map(u32 addr, char *buf)
+{
+	buf[0]  = 0;		/* Reserved */
+	buf[1]  = 0xff;		/* Multicast QPN */
+	buf[2]  = 0xff;
+	buf[3]  = 0xff;
+	addr    = ntohl(addr);
+	buf[4]  = 0xff;
+	buf[5]  = 0x12;		/* link local scope */
+	buf[6]  = 0x40;		/* IPv4 signature */
+	buf[7]  = 0x1b;
+	buf[8]  = 0;		/* P_Key */
+	buf[9]  = 0;
+	buf[10] = 0;
+	buf[11] = 0;
+	buf[12] = 0;
+	buf[13] = 0;
+	buf[14] = 0;
+	buf[15] = 0;
+	buf[19] = addr & 0xff;
+	addr  >>= 8;
+	buf[18] = addr & 0xff;
+	addr  >>= 8;
+	buf[17] = addr & 0xff;
+	addr  >>= 8;
+	buf[16] = addr & 0x0f;
+}
+
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 #include <linux/ipv6.h>
 #endif
Index: linux-bk/net/ipv4/arp.c
===================================================================
--- linux-bk.orig/net/ipv4/arp.c	2004-11-21 21:07:24.904787535 -0800
+++ linux-bk/net/ipv4/arp.c	2004-11-21 21:25:56.079881223 -0800
@@ -213,6 +213,9 @@
 	case ARPHRD_IEEE802_TR:
 		ip_tr_mc_map(addr, haddr);
 		return 0;
+	case ARPHRD_INFINIBAND:
+		ip_ib_mc_map(addr, haddr);
+		return 0;
 	default:
 		if (dir) {
 			memcpy(haddr, dev->broadcast, dev->addr_len);

[PATCH][RFC/v1][8/12] Add IPoIB (IP-over-InfiniBand) driver

From: Roland Dreier <hidden>
Date: 2004-11-22 15:41:04

Spam detection software, running on the system "openib.ca.sandia.gov", has
identified this incoming email as possible spam.  The original message
has been attached to this so you can view it (if it isn't spam) or block
similar future email.  If you have any questions, see
postmaster@openib.org for details.

Content preview:  Add a driver that implements the (IPoIB)
  IP-over-InfiniBand protocol. This is a network device driver of type
  ARPHRD_INFINIBAND (and addr_len INFINIBAND_ALEN bytes). The ARP/ND
  implementation for this driver is not completely straightforward,
  because InfiniBand requires an additional path lookup be performed
  (through an IB-specific mechanism) after a remote hardware address has
  been resolved. We are very open to suggestions of a better way to
  handle this than the current implementation. [...] 

Content analysis details:   (6.6 points, 6.5 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 2.4 RATWARE_HASH_2_V2      Bulk email fingerprint (hash 2 v2) found
 1.2 RATWARE_HASH_2         Bulk email fingerprint (hash 2) found
 1.8 DOMAIN_BODY            BODY: Domain registration spam body
 1.1 REMOVE_REMOVAL_NEAR    List removal information

[PATCH][RFC/v1][7/12] IPoIB IPv6 support

From: Roland Dreier <hidden>
Date: 2004-11-22 15:41:07

Add ipv6_ib_mc_map() to convert IPv6 multicast addresses to IPoIB
hardware addresses, and add support for autoconfiguration for devices
with type ARPHRD_INFINIBAND.

The mapping for multicast addresses is described in
  http://www.ietf.org/internet-drafts/draft-ietf-ipoib-ip-over-infiniband-07.txt

Signed-off-by: Nitin Hande <redacted>
Signed-off-by: Roland Dreier <redacted>


Index: linux-bk/include/net/if_inet6.h
===================================================================
--- linux-bk.orig/include/net/if_inet6.h	2004-11-21 21:07:35.126269616 -0800
+++ linux-bk/include/net/if_inet6.h	2004-11-21 21:25:56.386835692 -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-bk/net/ipv6/addrconf.c
===================================================================
--- linux-bk.orig/net/ipv6/addrconf.c	2004-11-21 21:07:29.222146392 -0800
+++ linux-bk/net/ipv6/addrconf.c	2004-11-21 21:25:56.387835544 -0800
@@ -48,6 +48,7 @@
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
 #include <linux/if_arcnet.h>
+#include <linux/if_infiniband.h>
 #include <linux/route.h>
 #include <linux/inetdevice.h>
 #include <linux/init.h>
@@ -1098,6 +1099,12 @@
 		memset(eui, 0, 7);
 		eui[7] = *(u8*)dev->dev_addr;
 		return 0;
+	case ARPHRD_INFINIBAND:
+		if (dev->addr_len != INFINIBAND_ALEN)
+			return -1;
+		memcpy(eui, dev->dev_addr + 12, 8);
+		eui[0] |= 2;
+		return 0;
 	}
 	return -1;
 }
@@ -1797,6 +1804,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-bk/net/ipv6/ndisc.c
===================================================================
--- linux-bk.orig/net/ipv6/ndisc.c	2004-11-21 21:07:06.642499599 -0800
+++ linux-bk/net/ipv6/ndisc.c	2004-11-21 21:25:56.388835395 -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);

Re: [PATCH][RFC/v1][8/12] Add IPoIB (IP-over-InfiniBand) driver

From: Sam Ravnborg <hidden>
Date: 2004-11-22 19:43:26

More nitpicking..

	Sam
	
quoted hunk
+++ linux-bk/drivers/infiniband/Makefile	2004-11-21 21:25:56.794775182 -0800
@@ -1,2 +1,3 @@
 obj-$(CONFIG_INFINIBAND)		+= core/
No reason to use $(CONFIG_INFINIBAND) here - it's already done in
drivers/infiniband/Makefile
+EXTRA_CFLAGS += -Idrivers/infiniband/include
This will get killed if you move the include files...

 +
+obj-$(CONFIG_INFINIBAND_IPOIB)			+= ib_ipoib.o
+
+ib_ipoib-y					:= ipoib_main.o \
+						   ipoib_ib.o \
+						   ipoib_multicast.o \
+						   ipoib_verbs.o \
+						   ipoib_vlan.o
One or two lines.
+#include <asm/semaphore.h>
+
+#include "ipoib_proto.h"
Shoulb be included as the last file - since it's the most local one.
+
+#include <ib_verbs.h>
+#include <ib_pack.h>
+#include <ib_sa.h>

Re: [PATCH][RFC/v1][8/12] Add IPoIB (IP-over-InfiniBand) driver

From: Greg KH <hidden>
Date: 2004-11-22 22:39:45

On Mon, Nov 22, 2004 at 07:14:04AM -0800, Roland Dreier wrote:
+#define ipoib_printk(level, priv, format, arg...)	\
+	printk(level "%s: " format, ((struct ipoib_dev_priv *) priv)->dev->name , ## arg)
+#define ipoib_warn(priv, format, arg...)		\
+	ipoib_printk(KERN_WARNING, priv, format , ## arg)
What's wrong with using the dev_printk() and friends instead of your
own?

And why cast a pointer in a macro, don't you know the type of it anyway?
quoted hunk
Index: linux-bk/drivers/infiniband/ulp/ipoib/ipoib_fs.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-bk/drivers/infiniband/ulp/ipoib/ipoib_fs.c	2004-11-21 21:25:56.924755902 -0800
You're using a separate filesystem to export debug data?  I'm all for
new virtual filesystems, but why not just use sysfs for this?  What are
you doing in here that you can't do with another mechanism (netlink,
sysfs, sockets, relayfs, etc.)?
+#ifdef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA
+#define DATA_PATH_DEBUG_HELP " and data path tracing if > 1"
+#else
+#define DATA_PATH_DEBUG_HELP ""
+#endif
+
+module_param(debug_level, int, 0644);
+MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0" DATA_PATH_DEBUG_HELP);
Why not just use 2 different debug variables for this?
+
+int mcast_debug_level;
Global?

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help