Skip to contentSkip to conversation

IPoIB IPv4 multicast

PATCH In review Roland Dreier 6 participants 31 messages Nov 22, 2004 – Nov 23, 2004 1 message not in the archive

Subsystems (5)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 6/12 IPoIB IPv4 multicast

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

include/linux/if_infiniband.h new file +29 -0
Index: linux-bk/include/linux/if_infiniband.h
===================================================================
@@ -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 */
include/net/ip.h +33 -0
Index: linux-bk/include/net/ip.h
===================================================================
@@ -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
net/ipv4/arp.c +3 -0
Index: linux-bk/net/ipv4/arp.c
===================================================================
@@ -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);
#2 lore raw

PATCH 7/12 IPoIB IPv6 support

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

include/net/if_inet6.h +15 -0
Index: linux-bk/include/net/if_inet6.h
===================================================================
@@ -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
net/ipv6/addrconf.c +8 -0
Index: linux-bk/net/ipv6/addrconf.c
===================================================================
@@ -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;
net/ipv6/ndisc.c +3 -0
Index: linux-bk/net/ipv6/ndisc.c
===================================================================
@@ -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);
#3 lore raw

PATCH 8/12 Add IPoIB (IP-over-InfiniBand) driver

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 [email protected] 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

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.

Although IB has a special multicast group join mode intended to support IP multicast routing (non member join), no means to identify different multicast styles has yet been determined, so all joins by the driver are currently full member joins. We are looking for guidance in how to solve this.

The IPoIB protocol/encapsulation is described in the Internet-Drafts
http://www.ietf.org/internet-drafts/draft-ietf-ipoib-architecture-04.txt
http://www.ietf.org/internet-drafts/draft-ietf-ipoib-ip-over-infiniband-07.txt

drivers/infiniband/Kconfig +2 -0
Index: linux-bk/drivers/infiniband/Kconfig
===================================================================
@@ -10,4 +10,6 @@
 
 source "drivers/infiniband/hw/mthca/Kconfig"
 
+source "drivers/infiniband/ulp/ipoib/Kconfig"
+
 endmenu
drivers/infiniband/Makefile +1 -0
Index: linux-bk/drivers/infiniband/Makefile
===================================================================
@@ -1,2 +1,3 @@
 obj-$(CONFIG_INFINIBAND)		+= core/
 obj-$(CONFIG_INFINIBAND_MTHCA)		+= hw/mthca/
+obj-$(CONFIG_INFINIBAND_IPOIB)		+= ulp/ipoib/
drivers/infiniband/ulp/ipoib/Kconfig new file +33 -0
Index: linux-bk/drivers/infiniband/ulp/ipoib/Kconfig
===================================================================
@@ -0,0 +1,33 @@
+config INFINIBAND_IPOIB
+	tristate "IP-over-InfiniBand"
+	depends on INFINIBAND && NETDEVICES && INET
+	---help---
+	  Support for the IP-over-InfiniBand protocol (IPoIB). This
+	  transports IP packets over InfiniBand so you can use your IB
+	  device as a fancy NIC.
+
+	  The IPoIB protocol is defined by the IETF ipoib working
+	  group: <http://www.ietf.org/html.charters/ipoib-charter.html>.
+
+config INFINIBAND_IPOIB_DEBUG
+	bool "IP-over-InfiniBand debugging"
+	depends on INFINIBAND_IPOIB
+	---help---
+	  This option causes debugging code to be compiled into the
+	  IPoIB driver.  The output can be turned on via the
+	  debug_level and mcast_debug_level module parameters (which
+	  can also be set after the driver is loaded through sysfs).
+
+	  This option also creates an "ipoib_debugfs," which can be
+	  mounted to expose debugging information about IB multicast
+	  groups used by the IPoIB driver.
+
+config INFINIBAND_IPOIB_DEBUG_DATA
+	bool "IP-over-InfiniBand data path debugging"
+	depends on INFINIBAND_IPOIB_DEBUG
+	---help---
+	  This option compiles debugging code into the the data path
+	  of the IPoIB driver.  The output can be turned on by setting
+	  the debug_level parameter to 2; however, even with output
+	  turned off, this debugging code will have some performance
+	  impact.
drivers/infiniband/ulp/ipoib/Makefile new file +11 -0
Index: linux-bk/drivers/infiniband/ulp/ipoib/Makefile
===================================================================
@@ -0,0 +1,11 @@
+EXTRA_CFLAGS += -Idrivers/infiniband/include
+
+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
+ib_ipoib-$(CONFIG_INFINIBAND_IPOIB_DEBUG)	+= ipoib_fs.o
+
drivers/infiniband/ulp/ipoib/ipoib.h new file +314 -0

314 lines not on this page · raw message

drivers/infiniband/ulp/ipoib/ipoib_fs.c new file +276 -0

276 lines not on this page · raw message

drivers/infiniband/ulp/ipoib/ipoib_ib.c new file +626 -0

626 lines not on this page · raw message

drivers/infiniband/ulp/ipoib/ipoib_main.c new file +953 -0

953 lines not on this page · raw message

drivers/infiniband/ulp/ipoib/ipoib_multicast.c new file +929 -0

778 lines not on this page · raw message

drivers/infiniband/ulp/ipoib/ipoib_proto.h new file +37 -0
Index: linux-bk/drivers/infiniband/ulp/ipoib/ipoib_proto.h
===================================================================

Lines of this file are not shown. View the raw message.

drivers/infiniband/ulp/ipoib/ipoib_verbs.c new file +248 -0

248 lines not on this page · raw message

drivers/infiniband/ulp/ipoib/ipoib_vlan.c new file +166 -0

166 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#4 lore raw

PATCH 9/12 Add InfiniBand userspace MAD support

Add a driver that provides a character special device for each InfiniBand port. This device allows userspace to send and receive MADs via write() and read() (with some control operations implemented as ioctls).

All operations are 32/64 clean and have been tested with 32-bit userspace running on a ppc64 kernel.

drivers/infiniband/core/Makefile +4 -1
Index: linux-bk/drivers/infiniband/core/Makefile
===================================================================
@@ -3,7 +3,8 @@
 obj-$(CONFIG_INFINIBAND) += \
     ib_core.o \
     ib_mad.o \
-    ib_sa.o
+    ib_sa.o \
+    ib_umad.o
 
 ib_core-objs := \
     packer.o \
@@ -20,3 +21,5 @@
     agent.o
 
 ib_sa-objs := sa_query.o
+
+ib_umad-objs := user_mad.o
drivers/infiniband/core/user_mad.c new file +649 -0

649 lines not on this page · raw message

drivers/infiniband/include/ib_user_mad.h new file +111 -0

111 lines not on this page · raw message

#5 lore raw

PATCH 10/12 Document InfiniBand ioctl use

Add the 0x1b ioctl magic number used by ib_umad module to Documentation/ioctl-number.txt.

Documentation/ioctl-number.txt +1 -0
Index: linux-bk/Documentation/ioctl-number.txt
===================================================================
@@ -72,6 +72,7 @@
 0x09	all	linux/md.h
 0x12	all	linux/fs.h
 		linux/blkpg.h
+0x1b	all	InfiniBand Subsystem	<http://www.openib.org/>
 0x20	all	drivers/cdrom/cm206.h
 0x22	all	scsi/sg.h
 '#'	00-3F	IEEE 1394 Subsystem	Block for the entire subsystem
#6 lore raw

PATCH 11/12 Add InfiniBand Documentation files

Add files to Documentation/infiniband that describe the tree under /sys/class/infiniband, the IPoIB driver and the userspace MAD access driver.

Documentation/infiniband/ipoib.txt new file +55 -0
Index: linux-bk/Documentation/infiniband/ipoib.txt
===================================================================
@@ -0,0 +1,55 @@
+IP OVER INFINIBAND
+
+  The ib_ipoib driver is an implementation of the IP over InfiniBand
+  protocol as specified by the latest Internet-Drafts issued by the
+  IETF ipoib working group.  It is a "native" implementation in the
+  sense of setting the interface type to ARPHRD_INFINIBAND and the
+  hardware address length to 20 (earlier proprietary implementations
+  masqueraded to the kernel as ethernet interfaces).
+
+Partitions and P_Keys
+
+  When the IPoIB driver is loaded, it creates one interface for each
+  port using the P_Key at index 0.  To create an interface with a
+  different P_Key, write the desired P_Key into the main interface's
+  /sys/class/net/<intf name>/create_child file.  For example:
+
+    echo 0x8001 > /sys/class/net/ib0/create_child
+
+  This will create an interface named ib0.8001 with P_Key 0x8001.  To
+  remove a subinterface, use the "delete_child" file:
+
+    echo 0x8001 > /sys/class/net/ib0/delete_child
+
+  The P_Key for any interface is given by the "pkey" file, and the
+  main interface for a subinterface is in "parent."
+
+Debugging Information
+
+  By compiling the IPoIB driver with CONFIG_INFINIBAND_IPOIB_DEBUG set
+  to 'y', tracing messages are compiled into the driver.  They are
+  turned on by setting the module parameters debug_level and
+  mcast_debug_level to 1.  These parameters can be controlled at
+  runtime through files in /sys/module/ib_ipoib/.
+
+  CONFIG_INFINIBAND_IPOIB_DEBUG also enables the "ipoib_debugfs"
+  virtual filesystem.  By mounting this filesystem, for example with
+
+    mkdir -p /ipoib_debugfs
+    mount -t ipoib_debugfs none /ipoib_debufs
+
+  it is possible to get statistics about multicast groups from the
+  files /ipoib_debugfs/ib0_mcg and so on.
+
+  The performance impact of this option is negligible, so it
+  is safe to enable this option with debug_level set to 0 for normal
+  operation.
+
+  CONFIG_INFINIBAND_IPOIB_DEBUG_DATA enables even more debug output
+  in the data path when debug_level is set to 2.  However, even with
+  the output disabled, this option will affect performance.
+
+References
+
+  IETF IP over InfiniBand (ipoib) Working Group
+    http://ietf.org/html.charters/ipoib-charter.html
Documentation/infiniband/sysfs.txt new file +63 -0

63 lines not on this page · raw message

Documentation/infiniband/user_mad.txt new file +77 -0

77 lines not on this page · raw message

#7 lore raw

PATCH 12/12 InfiniBand MAINTAINERS entry

Add OpenIB maintainers information to MAINTAINERS.

MAINTAINERS +11 -0
Index: linux-bk/MAINTAINERS
===================================================================
@@ -1075,6 +1075,17 @@
 L:	[email protected]
 S:	Maintained
 
+INFINIBAND SUBSYSTEM
+P:	Roland Dreier
+M:	[email protected]
+P:	Sean Hefty
+M:	[email protected]
+P:	Hal Rosenstock
+M:	[email protected]
+L:	[email protected]
+W:	http://www.openib.org/
+S:	Supported
+
 INPUT (KEYBOARD, MOUSE, JOYSTICK) DRIVERS
 P:	Vojtech Pavlik
 M:	[email protected]
#8 lore raw

Re: [PATCH][RFC/v1][11/12] Add InfiniBand Documentation files

In reply to Roland Dreier
Quoted 4 lines
Documentation/infiniband/ipoib.txt new file +4 -0
+  When the IPoIB driver is loaded, it creates one interface for each
+  port using the P_Key at index 0.  To create an interface with a
+  different P_Key, write the desired P_Key into the main interface's
+  /sys/class/net/<intf name>/create_child file.  For example:

Documentation/infiniband/ipoib.txt line 25

Quoted 10 lines
Documentation/infiniband/ipoib.txt new file +10 -0
+
+    echo 0x8001 > /sys/class/net/ib0/create_child
+
+  This will create an interface named ib0.8001 with P_Key 0x8001.  To
+  remove a subinterface, use the "delete_child" file:
+
+    echo 0x8001 > /sys/class/net/ib0/delete_child
+
+  The P_Key for any interface is given by the "pkey" file, and the
+  main interface for a subinterface is in "parent."

Any reason this doesn't use an interface similar to the normal vlan code?

And what is a P_Key?

#9 lore raw

Re: [PATCH][RFC/v1][11/12] Add InfiniBand Documentation files

Christoph> Any reason this doesn't use an interface similar to the Christoph> normal vlan code?

The normal vlan code uses an ioctl(). I thought a simple sysfs interface would be more palatable than a new socket ioctl.

Christoph> And what is a P_Key?

It is a 16-bit identifier carried by IB packets that says which partition the packet is in. End ports have P_Key tables that list which partitions they are members of (a port can be a member of one or more partitions, and can only receive packets from that partition).

- Roland

#10 lore raw

Re: [openib-general] Re: [PATCH][RFC/v1][11/12] Add InfiniBand Documentation files

In reply to Christoph Hellwig
Quoted 17 lines · Christoph Hellwig
Quoted 4 lines
Documentation/infiniband/ipoib.txt new file +4 -0
+  When the IPoIB driver is loaded, it creates one interface for each
+  port using the P_Key at index 0.  To create an interface with a
+  different P_Key, write the desired P_Key into the main interface's
+  /sys/class/net/<intf name>/create_child file.  For example:

Documentation/infiniband/ipoib.txt line 25

Quoted 10 lines
Documentation/infiniband/ipoib.txt new file +10 -0
+
+    echo 0x8001 > /sys/class/net/ib0/create_child
+
+  This will create an interface named ib0.8001 with P_Key 0x8001.  To
+  remove a subinterface, use the "delete_child" file:
+
+    echo 0x8001 > /sys/class/net/ib0/delete_child
+
+  The P_Key for any interface is given by the "pkey" file, and the
+  main interface for a subinterface is in "parent."

Any reason this doesn't use an interface similar to the normal vlan code?

Quoted 1 line

And what is a P_Key?

IB version of a vlan identifier.

Eric

#11 lore raw

Re: [PATCH][RFC/v1][11/12] Add InfiniBand Documentation files

In reply to Roland Dreier

Documentation/infiniband/user_mad.txt line 77

Quoted 12 lines · Roland Dreier
Documentation/infiniband/user_mad.txt new file +12 -0
+/dev files
+
+  To create the appropriate character device files automatically with
+  udev, a rule like
+
+    KERNEL="umad*", NAME="infiniband/%s{ibdev}/ports/%s{port}/mad"
+
+  can be used.  This will create a device node named
+
+    /dev/infiniband/mthca0/ports/1/mad
+
+  for port 1 of device mthca0, and so on.

Why do you propose such a "deep" nesting of directories for umad devices? That's not the LANNANA way.

Oh, have you asked for a real major number to be reserved for umad?

thanks,

greg k-h

#12 lore raw

Re: [PATCH][RFC/v1][11/12] Add InfiniBand Documentation files

Greg> Why do you propose such a "deep" nesting of directories for Greg> umad devices? That's not the LANNANA way.

No real reason, I'm open to better suggestions.

Greg> Oh, have you asked for a real major number to be reserved Greg> for umad?

No, I think we're fine with a dynamic major. Is there any reason to want a real major?

- Roland

#13 lore raw

Re: [PATCH][RFC/v1][11/12] Add InfiniBand Documentation files

Quoted 4 lines · Roland Dreier

Greg> Why do you propose such a "deep" nesting of directories for Greg> umad devices? That's not the LANNANA way.

No real reason, I'm open to better suggestions.

/dev/umad*
/dev/ib/umad*

Quoted 5 lines

Greg> Oh, have you asked for a real major number to be reserved Greg> for umad?

No, I think we're fine with a dynamic major. Is there any reason to want a real major?

People who do not use udev will not like you.

thanks,

greg k-h

#14 lore raw

Re: [PATCH][RFC/v1][11/12] Add InfiniBand Documentation files

    Greg> /dev/umad* /dev/ib/umad*

Right now the umad module creates devices with kernel names like umad0, umad1, etc, but it puts ibdev and port files in sysfs so userspace can figure out which IB device and port the file corresponds to. I would really prefer to have this info reflected in the /dev name...

Greg> People who do not use udev will not like you.

OK, I guess we will apply to LANANA.

- R.

#15 lore raw

Re: [openib-general] Re: [PATCH][RFC/v1][11/12] Add InfiniBand Documentation files

In reply to Greg KH
Quoted 8 lines · Greg KH
Quoted 5 lines · Roland Dreier

Greg> Oh, have you asked for a real major number to be reserved Greg> for umad?

No, I think we're fine with a dynamic major. Is there any reason to want a real major?

People who do not use udev will not like you.

I don't quite understand this. Given things like udev, wouldn't dynamic majors work just like having a static major number?

JE

#16 lore raw

Re: [openib-general] Re: [PATCH][RFC/v1][11/12] Add InfiniBand Documentation files

Quoted 5 lines · Johannes Erdfelt
Quoted 4 lines · Greg KH
Quoted 3 lines · Roland Dreier

Greg> Oh, have you asked for a real major number to be reserved Greg> for umad?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

No, I think we're fine with a dynamic major. Is there any reason to want a real major?

People who do not use udev will not like you.

I don't quite understand this. Given things like udev, wouldn't dynamic majors work just like having a static major number?

Yes, but people who do not use udev, will have a hard time creating the device nodes by hand every time.

thanks,

greg k-h

#17 lore raw

Re: [openib-general] Re: [PATCH][RFC/v1][11/12] Add InfiniBand Documentation files

Quoted 9 lines · Greg KH
Quoted 5 lines · Johannes Erdfelt
Quoted 1 line · Greg KH

People who do not use udev will not like you.

I don't quite understand this. Given things like udev, wouldn't dynamic majors work just like having a static major number?

Yes, but people who do not use udev, will have a hard time creating the device nodes by hand every time.

Ok, I can understand that for now.

Is the eventual plan to move to dynamic majors for all devices?

JE

#18 lore raw

Re: [openib-general] Re: [PATCH][RFC/v1][11/12] Add InfiniBand Documentation files

Quoted 2 lines · Johannes Erdfelt

Is the eventual plan to move to dynamic majors for all devices?

No, some people will not allow that to happen, it would break too many old programs and configurations.

It will probably be a config option if people wish to try it out (it's only about a 3 line change to the kernel to enable this, I need to just submit the patch one of these days...)

thanks,

greg k-h

#19 lore raw

Re: [PATCH][RFC/v1][9/12] Add InfiniBand userspace MAD support

In reply to Roland Dreier
Quoted 4 lines · Roland Dreier

Add a driver that provides a character special device for each InfiniBand port. This device allows userspace to send and receive MADs via write() and read() (with some control operations implemented as ioctls).

Do you really need these ioctls?

For example:

drivers/infiniband/core/user_mad.c line 424

Quoted 7 lines
drivers/infiniband/core/user_mad.c new file +7 -0
+static int ib_umad_ioctl(struct inode *inode, struct file *filp,
+			 unsigned int cmd, unsigned long arg)
+{
+	switch (cmd) {
+	case IB_USER_MAD_GET_ABI_VERSION:
+		return put_user(IB_USER_MAD_ABI_VERSION,
+				(u32 __user *) arg) ? -EFAULT : 0;

This could be in a sysfs file, right?

drivers/infiniband/core/user_mad.c line 428

Quoted 4 lines
drivers/infiniband/core/user_mad.c new file +4 -0
+	case IB_USER_MAD_REGISTER_AGENT:
+		return ib_umad_reg_agent(filp->private_data, arg);
+	case IB_USER_MAD_UNREGISTER_AGENT:
+		return ib_umad_unreg_agent(filp->private_data, arg);

You are letting any user, with any privilege register or unregister an "agent"?

And shouldn't you lock your list of agent ids when adding or removing one, or are you relying on the BKL of the ioctl call? If so, please document this.

Also, these "agents" seem to be a type of filter, right? Is there no other way to implement this than an ioctl?

thanks,

greg k-h

#20 lore raw

Re: [PATCH][RFC/v1][9/12] Add InfiniBand userspace MAD support

Quoted 4 lines
Quoted 4 lines

Add a driver that provides a character special device for each InfiniBand port. This device allows userspace to send and receive MADs via write() and read() (with some control operations implemented as ioctls).

Greg> Do you really need these ioctls?

Greg> This could be in a sysfs file, right?

The API version definitely can be, good point.

Greg> You are letting any user, with any privilege register or Greg> unregister an "agent"?

They have to be able to open the device node. We could add a check that they have it open for writing but there's not really much point in opening this device read-only.

Greg> And shouldn't you lock your list of agent ids when adding or Greg> removing one, or are you relying on the BKL of the ioctl Greg> call? If so, please document this.

Each file has an "agent_mutex" rwsem that protects this... the global list of agents handled by the lower level API is protected by its own locking.

Greg> Also, these "agents" seem to be a type of filter, right? Is Greg> there no other way to implement this than an ioctl?

ioctl seems to be the least bad way to me. This really feels like a legitimate use of ioctl to me -- we use read/write to handle passing data through our file descriptor, and ioctl for control of the properties of the descriptor.

What would you suggest as an ioctl replacement?

Thanks,
Roland

#21 lore raw

Re: [PATCH][RFC/v1][9/12] Add InfiniBand userspace MAD support

Quoted 6 lines · Roland Dreier

Greg> You are letting any user, with any privilege register or Greg> unregister an "agent"?

They have to be able to open the device node. We could add a check that they have it open for writing but there's not really much point in opening this device read-only.

Ok, I remember this conversation a while ago. We discussed this same thing a number of months back on the openib mailing list. Nevermind :)

Quoted 9 lines

Greg> Also, these "agents" seem to be a type of filter, right? Is Greg> there no other way to implement this than an ioctl?

ioctl seems to be the least bad way to me. This really feels like a legitimate use of ioctl to me -- we use read/write to handle passing data through our file descriptor, and ioctl for control of the properties of the descriptor.

What would you suggest as an ioctl replacement?

I really can't think of anything else. It just will require a _lot_ of vigilant attention to prevent people from adding other ioctls to this one, right?

Do you have other ioctls planned for this same interface for stage 2 and future stages of ib implementation for Linux?

thanks,

greg k-h

#22 lore raw

Re: [PATCH][RFC/v1][9/12] Add InfiniBand userspace MAD support

Greg> Do you have other ioctls planned for this same interface for Greg> stage 2 and future stages of ib implementation for Linux?

Not that I know of.

- Roland

#23 lore raw

Re: [PATCH][RFC/v1][9/12] Add InfiniBand userspace MAD support

In reply to Greg KH

Greg> This could be in a sysfs file, right?

Ugh, how does one add an attribute (like the ABI version) to a class_simple? It shouldn't be per-device but I don't see anything like class_create_file() that could work for class_simple.

Thanks,
Roland

#24 lore raw

Re: [PATCH][RFC/v1][9/12] Add InfiniBand userspace MAD support

Quoted 5 lines · Roland Dreier

Greg> This could be in a sysfs file, right?

Ugh, how does one add an attribute (like the ABI version) to a class_simple? It shouldn't be per-device but I don't see anything like class_create_file() that could work for class_simple.

class_simple_device_add returns a pointer to a struct class_device * that you can then use to create a file in sysfs with. That should be what you're looking for.

thanks,

greg k-h

#25 lore raw

Re: [PATCH][RFC/v1][9/12] Add InfiniBand userspace MAD support

Greg> class_simple_device_add returns a pointer to a struct Greg> class_device * that you can then use to create a file in Greg> sysfs with. That should be what you're looking for.

Shouldn't the ABI version be an attribute in /sys/class/infiniband_mad rather than being per-device? (I'm already creating several per-device attributes for the devices I get back from class_simple_device_add).

- R.

#26 lore raw

Re: [PATCH][RFC/v1][9/12] Add InfiniBand userspace MAD support

Quoted 6 lines · Roland Dreier

Greg> class_simple_device_add returns a pointer to a struct Greg> class_device * that you can then use to create a file in Greg> sysfs with. That should be what you're looking for.

Shouldn't the ABI version be an attribute in /sys/class/infiniband_mad rather than being per-device?

Yes, it probably should be. Hm, no, we don't allow you to put class specific files if you use the class_simple API, sorry I misread your question. You can just handle the class yourself and use the CLASS_ATTR() macro to define your api version function.

thanks,

greg k-h

#27 lore raw

Re: [PATCH][RFC/v1][9/12] Add InfiniBand userspace MAD support

Greg> Yes, it probably should be. Hm, no, we don't allow you to Greg> put class specific files if you use the class_simple API, Greg> sorry I misread your question. You can just handle the Greg> class yourself and use the CLASS_ATTR() macro to define your Greg> api version function.

Ugh, then we end up duplicating the class_simple code. Would you accept a patch that adds class_simple_create_file()/class_simple_remove_file()?

Thanks,
Roland

#28 lore raw

Re: [PATCH][RFC/v1][9/12] Add InfiniBand userspace MAD support

Quoted 8 lines · Roland Dreier

Greg> Yes, it probably should be. Hm, no, we don't allow you to Greg> put class specific files if you use the class_simple API, Greg> sorry I misread your question. You can just handle the Greg> class yourself and use the CLASS_ATTR() macro to define your Greg> api version function.

Ugh, then we end up duplicating the class_simple code. Would you accept a patch that adds class_simple_create_file()/class_simple_remove_file()?

Ick, ok, sure. Just make sure to mark them as EXPORT_SYMBOL_GPL() :)

thanks,

greg k-h

#29 lore raw

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

In reply to Roland Dreier

More nitpicking..

Sam

drivers/infiniband/Makefile line 1

Quoted 3 lines

+++ linux-bk/drivers/infiniband/Makefile 2004-11-21 21:25:56.794775182 -0800

drivers/infiniband/Makefile +0 -0
@@ -1,2 +1,3 @@
 obj-$(CONFIG_INFINIBAND)		+= core/

No reason to use $(CONFIG_INFINIBAND) here - it's already done in drivers/infiniband/Makefile

drivers/infiniband/ulp/ipoib/Makefile line 1

Quoted 1 line
drivers/infiniband/ulp/ipoib/Makefile new file +1 -0
+EXTRA_CFLAGS += -Idrivers/infiniband/include

This will get killed if you move the include files...

+

drivers/infiniband/ulp/ipoib/Makefile line 9

Quoted 7 lines
drivers/infiniband/ulp/ipoib/Makefile new file +7 -0
+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.

drivers/infiniband/ulp/ipoib/ipoib.h line 41

Quoted 3 lines
drivers/infiniband/ulp/ipoib/ipoib.h new file +3 -0
+#include <asm/semaphore.h>
+
+#include "ipoib_proto.h"

Shoulb be included as the last file - since it's the most local one.

Quoted 5 lines
drivers/infiniband/ulp/ipoib/ipoib.h new file +4 -0
+
+#include <ib_verbs.h>
+#include <ib_pack.h>
+#include <ib_sa.h>
#30 lore raw

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

In reply to Roland Dreier

drivers/infiniband/ulp/ipoib/ipoib.h line 267

Quoted 5 lines · Roland Dreier
drivers/infiniband/ulp/ipoib/ipoib.h new file +4 -0
+#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?

drivers/infiniband/ulp/ipoib/ipoib_fs.c

Quoted 4 lines

Index: linux-bk/drivers/infiniband/ulp/ipoib/ipoib_fs.c
===================================================================

drivers/infiniband/ulp/ipoib/ipoib_fs.c new file +0 -0

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.)?

drivers/infiniband/ulp/ipoib/ipoib_fs.c

Quoted 8 lines
drivers/infiniband/ulp/ipoib/ipoib_fs.c new file +8 -0
+#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?

drivers/infiniband/ulp/ipoib/ipoib_fs.c

Quoted 2 lines
drivers/infiniband/ulp/ipoib/ipoib_fs.c new file +2 -0
+
+int mcast_debug_level;

Global?

thanks,

greg k-h

#31 lore raw

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

Greg> What's wrong with using the dev_printk() and friends instead Greg> of your own?

dev_printk expects a struct device, not a net_device.

Greg> And why cast a pointer in a macro, don't you know the type Greg> of it anyway?

this lets us pass in the return value of netdev_priv() directly without having to have the cast in the code that uses the macro.

Greg> You're using a separate filesystem to export debug data? Greg> I'm all for new virtual filesystems, but why not just use Greg> sysfs for this? What are you doing in here that you can't Greg> do with another mechanism (netlink, sysfs, sockets, relayfs, Greg> etc.)?

For each multicast group, we want to export the GID, how long it's been around, whether our join has completed and whether it's send-only. It wouldn't be too bad to create a kobject with all those attributes but getting the info from so many little files is a little bit of a pain, and so is dealing with kobject lifetime rules. It's even worse with netlink since then a new tool is required. (AFAIK relayfs isn't in Linus's kernel).

It's nice to be able to tell someone to just mount ipoib_debugfs and send the contents of debugfs/ib0_mcg.

The actual filesystem stuff is pretty trivial using everything libfs provides for us now...

Greg> Why not just use 2 different debug variables for this?

No real reason... I'll fix it up.

Quoted 1 line
Quoted 1 line

+ +int mcast_debug_level;

Greg> Global?

Good point, I'll move it into ipoib_multicast.c.

- R.