Add IPoIB (IP-over-InfiniBand) driver
Subsystems (3)
PATCH 6/12 Add IPoIB (IP-over-InfiniBand) driver
In reply to a message not in the archiveAdd a driver that implements the (IPoIB) IP-over-InfiniBand protocol. This is a network device driver of type ARPHRD_INFINIBAND (and addr_len 20 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.
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 +1 -0
@@ -8,6 +8,7 @@ any protocols you wish to use as well as drivers for your InfiniBand hardware. +source "drivers/infiniband/ulp/Kconfig" source "drivers/infiniband/hw/Kconfig" endmenu
drivers/infiniband/Makefile +1 -1
@@ -1 +1 @@ -obj-$(CONFIG_INFINIBAND) += core/ hw/ +obj-$(CONFIG_INFINIBAND) += core/ ulp/ hw/
drivers/infiniband/ulp/Kconfig new file +33 -0
@@ -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/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_INFINIBAND_IPOIB) += ipoib/
drivers/infiniband/ulp/ipoib/Makefile new file +14 -0
@@ -0,0 +1,14 @@ +EXTRA_CFLAGS += -Idrivers/infiniband/include + +obj-$(CONFIG_INFINIBAND_IPOIB) += ib_ipoib.o + +ib_ipoib-objs := \ + ipoib_main.o \ + ipoib_ib.o \ + ipoib_multicast.o \ + ipoib_verbs.o \ + ipoib_vlan.o + +ifeq ($(CONFIG_INFINIBAND_IPOIB_DEBUG),y) + ib_ipoib-objs += ipoib_fs.o +endif
drivers/infiniband/ulp/ipoib/ipoib.h new file +311 -0
311 lines not on this page · raw message
drivers/infiniband/ulp/ipoib/ipoib_fs.c new file +247 -0
247 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 +945 -0
945 lines not on this page · raw message
drivers/infiniband/ulp/ipoib/ipoib_multicast.c new file +929 -0
814 lines not on this page · raw message
drivers/infiniband/ulp/ipoib/ipoib_proto.h new file +37 -0
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 +176 -0
176 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.
This patch escaped before it was ready! Please ignore it for now (a new version will be coming in a few days)
Sorry,
Roland
drivers/infiniband/ulp/ipoib/Makefile line 1
Quoted 4 lines
drivers/infiniband/ulp/ipoib/Makefile new file +1
-0@@ -0,0 +1,14 @@ +EXTRA_CFLAGS += -Idrivers/infiniband/include
Please avoid -I statements for kernel code wherever possible. Just put the Infiniband Kernel Internal API into $(TOPDIR)/include/infiniband/
drivers/infiniband/ulp/ipoib/Makefile line 14
Quoted 12 lines
drivers/infiniband/ulp/ipoib/Makefile new file +12
-0+obj-$(CONFIG_INFINIBAND_IPOIB) += ib_ipoib.o + +ib_ipoib-objs := \ + ipoib_main.o \ + ipoib_ib.o \ + ipoib_multicast.o \ + ipoib_verbs.o \ + ipoib_vlan.o + +ifeq ($(CONFIG_INFINIBAND_IPOIB_DEBUG),y) + ib_ipoib-objs += ipoib_fs.o +endif
This should read more like:
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
obj-$(CONFIG_INFINIBAND_IPOIB) += ib_ipoib.o
Also ib_ipoib is a rather strange name, the double ib doesn't make much sense.
drivers/infiniband/ulp/ipoib/Makefile
Quoted 7 lines
drivers/infiniband/ulp/ipoib/Makefile new file +7
-0+ * 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>.
Please don't refer to licenses at urls as they can changed easily. There's a toplevel COPYING file you can reference, and if you want additional license bits I'd suggets to keep them simple enough to be in the file header. Or better just stop the dual-licensing sillyness - you'll copy code from other parts of the kernel sooner or later that are GPL-only.
Quoted 1 line
+#define
IPOIB_PATH(neigh)(*(structipoib_path**) ((neigh)->ha + 24))
Please make this and inline so you have proper typechecking. (And give it a less shouting name)
drivers/infiniband/ulp/ipoib/Makefile
Quoted 7 lines
drivers/infiniband/ulp/ipoib/Makefile new file +6
-0+ +extern struct workqueue_struct *ipoib_workqueue; + +/* list of IPoIB network devices */ +extern struct semaphore ipoib_device_mutex; +extern struct list_head ipoib_device_list;
Please try to avoid global lists. Looking at the code this is used in two places:
(1) the debugging pseudo fs
(2) ipoib_remove_one
the latter would be much better served with a per ib_device list anyway, and for (1) there must be a better way than the global list either.
drivers/infiniband/ulp/ipoib/Makefile
Quoted 5 lines
drivers/infiniband/ulp/ipoib/Makefile new file +5
-0+ pci_unmap_single(priv->ca->dma_device, + pci_unmap_addr(&priv->rx_ring[wr_id], + mapping), + IPOIB_BUF_SIZE, + PCI_DMA_FROMDEVICE);
Please don't use PCI dma calls in highlevel protocol handlers. At least use the dma_* calls or even better restructure the code to avoid dma mapping outside the HCA driver.
Thanks for the comments (although as I said before my original email was a mistake and should have been ignored :)
I'll try to address these before the real submission :)
- Roland
OK, the "real" patches are coming now. I just thought I would let you know which of your comments I've acted on and which are still pending....
Christoph> Please avoid -I statements for kernel code wherever Christoph> possible. Just put the Infiniband Kernel Internal API Christoph> into $(TOPDIR)/include/infiniband/
This is no problem to do. However, I'd like to see whether we can get a consensus about where to put .h files.
Christoph> This should read more like:
OK, Makefile is fixed. I didn't realize foo-objs and foo-y worked the same, thanks for teaching me.
Christoph> Also ib_ipoib is a rather strange name, the double ib Christoph> doesn't make much sense.
True. We use ib_xxx for all our module names, so ib_ipoib is consistent, but changing to ipoib for the IPoIB driver is easy to do if that's the right way to go.
Christoph> Please don't refer to licenses at urls as they can Christoph> changed easily. There's a toplevel COPYING file you Christoph> can reference, and if you want additional license bits Christoph> I'd suggets to keep them simple enough to be in the Christoph> file header. Or better just stop the dual-licensing Christoph> sillyness - you'll copy code from other parts of the Christoph> kernel sooner or later that are GPL-only.
License is not fixed yet (needs to be cleared with all contributors).
Christoph> Please make this and inline so you have proper Christoph> typechecking. (And give it a less shouting name)
Done.
Christoph> Please try to avoid global lists. Looking at the code Christoph> this is used in two places:
Christoph> (1) the debugging pseudo fs (2) ipoib_remove_one
Christoph> the latter would be much better served with a per Christoph> ib_device list anyway, and for (1) there must be a Christoph> better way than the global list either.
OK, I got rid of the global list, although the debug fs keeps a list of devices added before the fs was mounted (static to the file with debugging code). I could get rid of that list by just creating the fs superblock etc. at startup rather than waiting for a mount request, but I didn't do that yet. (I don't want to call kern_mount because then the module use count gets bumped and the module can't be unloaded)
Christoph> Please don't use PCI dma calls in highlevel protocol Christoph> handlers. At least use the dma_* calls or even better Christoph> restructure the code to avoid dma mapping outside the Christoph> HCA driver.
We can switch to dma_* (and in fact I see some reasons to do so). However Greg KH suggested sticking with pci_* stuff until there's a non-PCI device to deal with.
I'm pretty convinced that the DMA mapping needs to be exposed outside the low-level driver. Otherwise you're limiting what upper level code can do with reusing DMA mappings, DMA pools, etc.
Thanks,
Roland
Quoted 3 lines
We can switch to dma_* (and in fact I see some reasons to do so). However Greg KH suggested sticking with pci_* stuff until there's a non-PCI device to deal with.
That just means avoidable interface changes sooner or later. The dma_ interfaces also have the added benefit of allowing better control of the type of consistant allocation interface.
Note that pathscale already has direct to HT infiniband components, but it's not sure whether they'll ever be supported by the OpenIB codebase.
Christoph> That just means avoidable interface changes sooner or Christoph> later. The dma_ interfaces also have the added benefit Christoph> of allowing better control of the type of consistant Christoph> allocation interface.
OK, I have no problem making this change.
Christoph> Note that pathscale already has direct to HT infiniband Christoph> components, but it's not sure whether they'll ever be Christoph> supported by the OpenIB codebase.
HT actually looks like PCI to software... however I do see advantages to using the dma_* stuff for supporting the pathscale hardware, if they every open up their specs.
- R.
Christoph> That just means avoidable interface changes sooner or Christoph> later. The dma_ interfaces also have the added benefit Christoph> of allowing better control of the type of consistant Christoph> allocation interface.
Is there a dma_xxx equivalent to DECLARE_PCI_UNMAP_ADDR(), pci_unmap_addr_set() and friends, or does a driver always have to save off the DMA address from dma_map_xxx?
Thanks,
Roland
Quoted 8 lines · Roland Dreier
Christoph> That just means avoidable interface changes sooner or Christoph> later. The
dma_interfaces also have the added benefit Christoph> of allowing better control of the type of consistant Christoph> allocation interface.Is there a
dma_xxxequivalent toDECLARE_PCI_UNMAP_ADDR(),pci_unmap_addr_set()and friends, or does a driver always have to save off the DMA address fromdma_map_xxx?
Good question. In pratice I can't find a case were DECLARE_PCI_UNMAP_ADDR() wouldn't simply work for dma_*, but we should probably document that somewhere.
Christoph> Good question. In pratice I can't find a case were Christoph> DECLARE_PCI_UNMAP_ADDR() wouldn't simply work for Christoph> dma_*, but we should probably document that somewhere.
OK, I'll leave the DECLARE_PCI_UNMAP_ADDR() stuff in for now. Longer term maybe I'll submit a patch to add DECLARE_DMA_UNMAP_ADDR() et al to clean this up.
Thanks,
Roland