svn commit: r273864 - in stable/9: contrib/ofed/libibverbs/examples contrib/ofed/libmlx4/src contrib/ofed/libsdp/src/linux contrib/ofed/management/infiniband-diags/src contrib/ofed/management/opens...

Hans Petter Selasky hselasky at FreeBSD.org
Thu Oct 30 15:41:30 UTC 2014


Author: hselasky
Date: Thu Oct 30 15:41:25 2014
New Revision: 273864
URL: https://svnweb.freebsd.org/changeset/base/273864

Log:
  MFC r254122, r254123, r256116, r255970, r247671, r269861, r268314, r256269,
    r255969, r256179, r230135, r254121, r255932, r255972, r255973, r256281,
    r256470, r257867, r259608, r269862, r271127, r272407, r257864, r256682,
    r258276, r254734, r247675, r254735 and r272683:
  
  Hardware driver update from Mellanox Technologies, including:
   - improved performance
   - better stability
   - new features
   - bugfixes
  
  Supported HCAs:
   - ConnectX-2
   - ConnectX-3
   - ConnectX-3 Pro
  
  NOTE:
    - TSO feature needs r271946, which is not yet merged.
  
  Sponsored by:	Mellanox Technologies

Added:
  stable/9/sys/modules/ibcore/
     - copied from r255932, head/sys/modules/ibcore/
  stable/9/sys/modules/ipoib/
     - copied from r255932, head/sys/modules/ipoib/
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/alias_GUID.c
     - copied, changed from r255932, head/sys/ofed/drivers/infiniband/hw/mlx4/alias_GUID.c
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/cm.c
     - copied, changed from r255932, head/sys/ofed/drivers/infiniband/hw/mlx4/cm.c
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c
     - copied, changed from r255932, head/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/sysfs.c
     - copied, changed from r255932, head/sys/ofed/drivers/infiniband/hw/mlx4/sysfs.c
  stable/9/sys/ofed/drivers/net/mlx4/mlx4_stats.h
     - copied unchanged from r272407, stable/10/sys/ofed/drivers/net/mlx4/mlx4_stats.h
  stable/9/sys/ofed/drivers/net/mlx4/resource_tracker.c
     - copied, changed from r255932, head/sys/ofed/drivers/net/mlx4/resource_tracker.c
  stable/9/sys/ofed/drivers/net/mlx4/sys_tune.c
     - copied, changed from r255932, head/sys/ofed/drivers/net/mlx4/sys_tune.c
  stable/9/sys/ofed/drivers/net/mlx4/utils.c
     - copied unchanged from r272407, stable/10/sys/ofed/drivers/net/mlx4/utils.c
  stable/9/sys/ofed/drivers/net/mlx4/utils.h
     - copied unchanged from r272407, stable/10/sys/ofed/drivers/net/mlx4/utils.h
  stable/9/sys/ofed/include/linux/cache.h
     - copied unchanged from r271127, stable/10/sys/ofed/include/linux/cache.h
  stable/9/sys/ofed/include/linux/clocksource.h
     - copied, changed from r255932, head/sys/ofed/include/linux/clocksource.h
  stable/9/sys/ofed/include/linux/etherdevice.h
     - copied unchanged from r271127, stable/10/sys/ofed/include/linux/etherdevice.h
  stable/9/sys/ofed/include/linux/kmod.h
     - copied unchanged from r271127, stable/10/sys/ofed/include/linux/kmod.h
  stable/9/sys/ofed/include/linux/ktime.h
     - copied unchanged from r271127, stable/10/sys/ofed/include/linux/ktime.h
  stable/9/sys/ofed/include/linux/math64.h
     - copied unchanged from r271127, stable/10/sys/ofed/include/linux/math64.h
  stable/9/sys/ofed/include/net/if_inet6.h
     - copied unchanged from r271127, stable/10/sys/ofed/include/net/if_inet6.h
  stable/9/sys/ofed/include/rdma/ib_pma.h
     - copied unchanged from r255932, head/sys/ofed/include/rdma/ib_pma.h
Deleted:
  stable/9/sys/ofed/include/asm/current.h
  stable/9/sys/ofed/include/asm/semaphore.h
  stable/9/sys/ofed/include/asm/system.h
  stable/9/sys/ofed/include/linux/bitmap.h
  stable/9/sys/ofed/include/linux/ctype.h
  stable/9/sys/ofed/include/linux/init.h
  stable/9/sys/ofed/include/linux/rtnetlink.h
  stable/9/sys/ofed/include/linux/stddef.h
  stable/9/sys/ofed/include/net/addrconf.h
  stable/9/sys/ofed/include/net/arp.h
  stable/9/sys/ofed/include/net/ip6_route.h
  stable/9/sys/ofed/include/net/neighbour.h
Modified:
  stable/9/contrib/ofed/libibverbs/examples/asyncwatch.c
  stable/9/contrib/ofed/libibverbs/examples/device_list.c
  stable/9/contrib/ofed/libibverbs/examples/devinfo.c
  stable/9/contrib/ofed/libmlx4/src/mlx4-abi.h
  stable/9/contrib/ofed/libsdp/src/linux/sdp_inet.h
  stable/9/contrib/ofed/management/infiniband-diags/src/sminfo.c
  stable/9/contrib/ofed/management/opensm/opensm/osm_console.c
  stable/9/contrib/ofed/management/opensm/opensm/osm_subnet.c
  stable/9/sys/conf/files
  stable/9/sys/contrib/dev/npe/LICENSE
  stable/9/sys/contrib/dev/nve/amd64/nvenetlib.README
  stable/9/sys/contrib/dev/nve/i386/nvenetlib.README
  stable/9/sys/contrib/rdma/ib_umem.h
  stable/9/sys/contrib/rdma/krping/getopt.c
  stable/9/sys/contrib/rdma/krping/krping.c
  stable/9/sys/contrib/rdma/krping/krping.h
  stable/9/sys/contrib/rdma/krping/krping_dev.c
  stable/9/sys/dev/cxgb/cxgb_osdep.h
  stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c
  stable/9/sys/dev/vxge/include/vxgehal-ll.h
  stable/9/sys/modules/Makefile
  stable/9/sys/modules/mlx4/Makefile
  stable/9/sys/modules/mlx4ib/Makefile
  stable/9/sys/modules/mlxen/Makefile
  stable/9/sys/modules/rdma/Makefile
  stable/9/sys/ofed/drivers/infiniband/core/addr.c
  stable/9/sys/ofed/drivers/infiniband/core/cm.c
  stable/9/sys/ofed/drivers/infiniband/core/cma.c
  stable/9/sys/ofed/drivers/infiniband/core/core_priv.h
  stable/9/sys/ofed/drivers/infiniband/core/device.c
  stable/9/sys/ofed/drivers/infiniband/core/iwcm.c
  stable/9/sys/ofed/drivers/infiniband/core/local_sa.c
  stable/9/sys/ofed/drivers/infiniband/core/notice.c
  stable/9/sys/ofed/drivers/infiniband/core/sa_query.c
  stable/9/sys/ofed/drivers/infiniband/core/sysfs.c
  stable/9/sys/ofed/drivers/infiniband/core/ucm.c
  stable/9/sys/ofed/drivers/infiniband/core/umem.c
  stable/9/sys/ofed/drivers/infiniband/core/user_mad.c
  stable/9/sys/ofed/drivers/infiniband/core/uverbs_cmd.c
  stable/9/sys/ofed/drivers/infiniband/core/uverbs_main.c
  stable/9/sys/ofed/drivers/infiniband/core/verbs.c
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/Kconfig
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/Makefile
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/ah.c
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/cq.c
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/mad.c
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/main.c
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/mr.c
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/qp.c
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/srq.c
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/user.h
  stable/9/sys/ofed/drivers/infiniband/hw/mlx4/wc.c
  stable/9/sys/ofed/drivers/infiniband/hw/mthca/mthca_allocator.c
  stable/9/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c
  stable/9/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c
  stable/9/sys/ofed/drivers/infiniband/hw/mthca/mthca_memfree.c
  stable/9/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c
  stable/9/sys/ofed/drivers/infiniband/hw/mthca/mthca_reset.c
  stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
  stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
  stable/9/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h
  stable/9/sys/ofed/drivers/net/mlx4/Makefile
  stable/9/sys/ofed/drivers/net/mlx4/alloc.c
  stable/9/sys/ofed/drivers/net/mlx4/catas.c
  stable/9/sys/ofed/drivers/net/mlx4/cmd.c
  stable/9/sys/ofed/drivers/net/mlx4/cq.c
  stable/9/sys/ofed/drivers/net/mlx4/en_cq.c
  stable/9/sys/ofed/drivers/net/mlx4/en_ethtool.c
  stable/9/sys/ofed/drivers/net/mlx4/en_main.c
  stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c
  stable/9/sys/ofed/drivers/net/mlx4/en_port.c
  stable/9/sys/ofed/drivers/net/mlx4/en_port.h
  stable/9/sys/ofed/drivers/net/mlx4/en_resources.c
  stable/9/sys/ofed/drivers/net/mlx4/en_rx.c
  stable/9/sys/ofed/drivers/net/mlx4/en_selftest.c
  stable/9/sys/ofed/drivers/net/mlx4/en_tx.c
  stable/9/sys/ofed/drivers/net/mlx4/eq.c
  stable/9/sys/ofed/drivers/net/mlx4/fw.c
  stable/9/sys/ofed/drivers/net/mlx4/fw.h
  stable/9/sys/ofed/drivers/net/mlx4/icm.c
  stable/9/sys/ofed/drivers/net/mlx4/icm.h
  stable/9/sys/ofed/drivers/net/mlx4/intf.c
  stable/9/sys/ofed/drivers/net/mlx4/main.c
  stable/9/sys/ofed/drivers/net/mlx4/mcg.c
  stable/9/sys/ofed/drivers/net/mlx4/mlx4.h
  stable/9/sys/ofed/drivers/net/mlx4/mlx4_en.h
  stable/9/sys/ofed/drivers/net/mlx4/mr.c
  stable/9/sys/ofed/drivers/net/mlx4/pd.c
  stable/9/sys/ofed/drivers/net/mlx4/port.c
  stable/9/sys/ofed/drivers/net/mlx4/profile.c
  stable/9/sys/ofed/drivers/net/mlx4/qp.c
  stable/9/sys/ofed/drivers/net/mlx4/reset.c
  stable/9/sys/ofed/drivers/net/mlx4/sense.c
  stable/9/sys/ofed/drivers/net/mlx4/srq.c
  stable/9/sys/ofed/drivers/net/mlx4/xrcd.c
  stable/9/sys/ofed/include/asm/atomic-long.h
  stable/9/sys/ofed/include/asm/atomic.h
  stable/9/sys/ofed/include/asm/byteorder.h
  stable/9/sys/ofed/include/asm/fcntl.h
  stable/9/sys/ofed/include/asm/io.h
  stable/9/sys/ofed/include/asm/page.h
  stable/9/sys/ofed/include/asm/pgtable.h
  stable/9/sys/ofed/include/asm/types.h
  stable/9/sys/ofed/include/asm/uaccess.h
  stable/9/sys/ofed/include/linux/bitops.h
  stable/9/sys/ofed/include/linux/cdev.h
  stable/9/sys/ofed/include/linux/compat.h
  stable/9/sys/ofed/include/linux/compiler.h
  stable/9/sys/ofed/include/linux/completion.h
  stable/9/sys/ofed/include/linux/delay.h
  stable/9/sys/ofed/include/linux/device.h
  stable/9/sys/ofed/include/linux/dma-attrs.h
  stable/9/sys/ofed/include/linux/dma-mapping.h
  stable/9/sys/ofed/include/linux/dmapool.h
  stable/9/sys/ofed/include/linux/err.h
  stable/9/sys/ofed/include/linux/errno.h
  stable/9/sys/ofed/include/linux/ethtool.h
  stable/9/sys/ofed/include/linux/file.h
  stable/9/sys/ofed/include/linux/fs.h
  stable/9/sys/ofed/include/linux/gfp.h
  stable/9/sys/ofed/include/linux/hardirq.h
  stable/9/sys/ofed/include/linux/idr.h
  stable/9/sys/ofed/include/linux/if_arp.h
  stable/9/sys/ofed/include/linux/if_ether.h
  stable/9/sys/ofed/include/linux/if_vlan.h
  stable/9/sys/ofed/include/linux/in.h
  stable/9/sys/ofed/include/linux/in6.h
  stable/9/sys/ofed/include/linux/inet.h
  stable/9/sys/ofed/include/linux/inetdevice.h
  stable/9/sys/ofed/include/linux/interrupt.h
  stable/9/sys/ofed/include/linux/io-mapping.h
  stable/9/sys/ofed/include/linux/io.h
  stable/9/sys/ofed/include/linux/ioctl.h
  stable/9/sys/ofed/include/linux/jiffies.h
  stable/9/sys/ofed/include/linux/kdev_t.h
  stable/9/sys/ofed/include/linux/kernel.h
  stable/9/sys/ofed/include/linux/kobject.h
  stable/9/sys/ofed/include/linux/kref.h
  stable/9/sys/ofed/include/linux/kthread.h
  stable/9/sys/ofed/include/linux/linux_compat.c
  stable/9/sys/ofed/include/linux/linux_idr.c
  stable/9/sys/ofed/include/linux/linux_radix.c
  stable/9/sys/ofed/include/linux/list.h
  stable/9/sys/ofed/include/linux/lockdep.h
  stable/9/sys/ofed/include/linux/log2.h
  stable/9/sys/ofed/include/linux/miscdevice.h
  stable/9/sys/ofed/include/linux/mlx4/cmd.h
  stable/9/sys/ofed/include/linux/mlx4/cq.h
  stable/9/sys/ofed/include/linux/mlx4/device.h
  stable/9/sys/ofed/include/linux/mlx4/driver.h
  stable/9/sys/ofed/include/linux/mlx4/qp.h
  stable/9/sys/ofed/include/linux/mlx4/srq.h
  stable/9/sys/ofed/include/linux/mm.h
  stable/9/sys/ofed/include/linux/module.h
  stable/9/sys/ofed/include/linux/moduleparam.h
  stable/9/sys/ofed/include/linux/mount.h
  stable/9/sys/ofed/include/linux/mutex.h
  stable/9/sys/ofed/include/linux/net.h
  stable/9/sys/ofed/include/linux/netdevice.h
  stable/9/sys/ofed/include/linux/notifier.h
  stable/9/sys/ofed/include/linux/page.h
  stable/9/sys/ofed/include/linux/pci.h
  stable/9/sys/ofed/include/linux/poll.h
  stable/9/sys/ofed/include/linux/radix-tree.h
  stable/9/sys/ofed/include/linux/random.h
  stable/9/sys/ofed/include/linux/rbtree.h
  stable/9/sys/ofed/include/linux/rwlock.h
  stable/9/sys/ofed/include/linux/rwsem.h
  stable/9/sys/ofed/include/linux/scatterlist.h
  stable/9/sys/ofed/include/linux/sched.h
  stable/9/sys/ofed/include/linux/semaphore.h
  stable/9/sys/ofed/include/linux/slab.h
  stable/9/sys/ofed/include/linux/socket.h
  stable/9/sys/ofed/include/linux/spinlock.h
  stable/9/sys/ofed/include/linux/string.h
  stable/9/sys/ofed/include/linux/sysfs.h
  stable/9/sys/ofed/include/linux/timer.h
  stable/9/sys/ofed/include/linux/types.h
  stable/9/sys/ofed/include/linux/uaccess.h
  stable/9/sys/ofed/include/linux/vmalloc.h
  stable/9/sys/ofed/include/linux/wait.h
  stable/9/sys/ofed/include/linux/workqueue.h
  stable/9/sys/ofed/include/net/ip.h
  stable/9/sys/ofed/include/net/ipv6.h
  stable/9/sys/ofed/include/net/netevent.h
  stable/9/sys/ofed/include/net/tcp.h
  stable/9/sys/ofed/include/rdma/ib_cm.h
  stable/9/sys/ofed/include/rdma/ib_mad.h
  stable/9/sys/ofed/include/rdma/ib_sa.h
  stable/9/sys/ofed/include/rdma/ib_umem.h
  stable/9/sys/ofed/include/rdma/ib_user_verbs.h
  stable/9/sys/ofed/include/rdma/ib_verbs.h
  stable/9/sys/ofed/include/rdma/sdp_socket.h
  stable/9/sys/sys/socket.h
Directory Properties:
  stable/9/contrib/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/modules/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/contrib/ofed/libibverbs/examples/asyncwatch.c
==============================================================================
--- stable/9/contrib/ofed/libibverbs/examples/asyncwatch.c	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/contrib/ofed/libibverbs/examples/asyncwatch.c	Thu Oct 30 15:41:25 2014	(r273864)
@@ -35,8 +35,6 @@
 #endif /* HAVE_CONFIG_H */
 
 #include <stdio.h>
-#include <endian.h>
-#include <byteswap.h>
 
 #include <infiniband/verbs.h>
 

Modified: stable/9/contrib/ofed/libibverbs/examples/device_list.c
==============================================================================
--- stable/9/contrib/ofed/libibverbs/examples/device_list.c	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/contrib/ofed/libibverbs/examples/device_list.c	Thu Oct 30 15:41:25 2014	(r273864)
@@ -36,9 +36,6 @@
 
 #include <stdio.h>
 
-#include <endian.h>
-#include <byteswap.h>
-
 #include <infiniband/verbs.h>
 #include <infiniband/arch.h>
 

Modified: stable/9/contrib/ofed/libibverbs/examples/devinfo.c
==============================================================================
--- stable/9/contrib/ofed/libibverbs/examples/devinfo.c	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/contrib/ofed/libibverbs/examples/devinfo.c	Thu Oct 30 15:41:25 2014	(r273864)
@@ -41,8 +41,6 @@
 #include <string.h>
 #include <getopt.h>
 #include <netinet/in.h>
-#include <endian.h>
-#include <byteswap.h>
 
 #include <infiniband/verbs.h>
 #include <infiniband/driver.h>

Modified: stable/9/contrib/ofed/libmlx4/src/mlx4-abi.h
==============================================================================
--- stable/9/contrib/ofed/libmlx4/src/mlx4-abi.h	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/contrib/ofed/libmlx4/src/mlx4-abi.h	Thu Oct 30 15:41:25 2014	(r273864)
@@ -36,7 +36,7 @@
 #include <infiniband/kern-abi.h>
 
 #define MLX4_UVERBS_MIN_ABI_VERSION	2
-#define MLX4_UVERBS_MAX_ABI_VERSION	3
+#define MLX4_UVERBS_MAX_ABI_VERSION	4
 
 struct mlx4_alloc_ucontext_resp {
 	struct ibv_get_context_resp	ibv_resp;

Modified: stable/9/contrib/ofed/libsdp/src/linux/sdp_inet.h
==============================================================================
--- stable/9/contrib/ofed/libsdp/src/linux/sdp_inet.h	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/contrib/ofed/libsdp/src/linux/sdp_inet.h	Thu Oct 30 15:41:25 2014	(r273864)
@@ -29,8 +29,12 @@
  */
 
 #ifndef SOLARIS_BUILD
+#ifdef __FreeBSD__
+#include <sys/socket.h>
+#else
 #define AF_INET_SDP 27			  /* SDP socket protocol family */
 #define AF_INET6_SDP 28                   /* SDP socket protocol family */
+#endif
 #else
 #define AF_INET_SDP 31  /* This is an invalid family on native solaris
                          * and will only work using QuickTransit */

Modified: stable/9/contrib/ofed/management/infiniband-diags/src/sminfo.c
==============================================================================
--- stable/9/contrib/ofed/management/infiniband-diags/src/sminfo.c	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/contrib/ofed/management/infiniband-diags/src/sminfo.c	Thu Oct 30 15:41:25 2014	(r273864)
@@ -72,10 +72,10 @@ enum {
 };
 
 char *statestr[] = {
-	[SMINFO_NOTACT] "SMINFO_NOTACT",
-	[SMINFO_DISCOVER] "SMINFO_DISCOVER",
-	[SMINFO_STANDBY] "SMINFO_STANDBY",
-	[SMINFO_MASTER] "SMINFO_MASTER",
+	[SMINFO_NOTACT] = "SMINFO_NOTACT",
+	[SMINFO_DISCOVER] = "SMINFO_DISCOVER",
+	[SMINFO_STANDBY] = "SMINFO_STANDBY",
+	[SMINFO_MASTER] = "SMINFO_MASTER",
 };
 
 #define STATESTR(s)	(((unsigned)(s)) < SMINFO_STATE_LAST ? statestr[s] : "???")

Modified: stable/9/contrib/ofed/management/opensm/opensm/osm_console.c
==============================================================================
--- stable/9/contrib/ofed/management/opensm/opensm/osm_console.c	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/contrib/ofed/management/opensm/opensm/osm_console.c	Thu Oct 30 15:41:25 2014	(r273864)
@@ -67,7 +67,10 @@ static struct {
 	time_t previous;
 	void (*loop_function) (osm_opensm_t * p_osm, FILE * out);
 } loop_command = {
-on: 0, delay_s: 2, loop_function:NULL};
+	.on = 0,
+	.delay_s = 2,
+	.loop_function = NULL,
+};
 
 static const struct command console_cmds[];
 

Modified: stable/9/contrib/ofed/management/opensm/opensm/osm_subnet.c
==============================================================================
--- stable/9/contrib/ofed/management/opensm/opensm/osm_subnet.c	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/contrib/ofed/management/opensm/opensm/osm_subnet.c	Thu Oct 30 15:41:25 2014	(r273864)
@@ -482,7 +482,7 @@ static void log_report(const char *fmt, 
 	va_start(args, fmt);
 	vsnprintf(buf, sizeof(buf), fmt, args);
 	va_end(args);
-	printf(buf);
+	printf("%s", buf);
 	cl_log_event("OpenSM", CL_LOG_INFO, buf, NULL, 0);
 }
 
@@ -500,7 +500,7 @@ static void log_config_value(char *name,
 		n = sizeof(buf);
 	snprintf(buf + n, sizeof(buf) - n, "\n");
 	va_end(args);
-	printf(buf);
+	printf("%s", buf);
 	cl_log_event("OpenSM", CL_LOG_INFO, buf, NULL, 0);
 }
 

Modified: stable/9/sys/conf/files
==============================================================================
--- stable/9/sys/conf/files	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/sys/conf/files	Thu Oct 30 15:41:25 2014	(r273864)
@@ -3236,6 +3236,18 @@ ofed/drivers/infiniband/ulp/sdp/sdp_tx.c
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/"
 
+ofed/drivers/infiniband/hw/mlx4/alias_GUID.c    optional mlx4ib         \
+        no-depend obj-prefix "mlx4ib_"                                  \
+        compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+ofed/drivers/infiniband/hw/mlx4/mcg.c           optional mlx4ib         \
+        no-depend obj-prefix "mlx4ib_"                                  \
+        compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+ofed/drivers/infiniband/hw/mlx4/sysfs.c         optional mlx4ib         \
+        no-depend obj-prefix "mlx4ib_"                                  \
+        compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
+ofed/drivers/infiniband/hw/mlx4/cm.c            optional mlx4ib         \
+        no-depend obj-prefix "mlx4ib_"                                  \
+        compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/ah.c		optional mlx4ib		\
 	no-depend obj-prefix "mlx4ib_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
@@ -3318,14 +3330,17 @@ ofed/drivers/net/mlx4/sense.c			optional
 ofed/drivers/net/mlx4/srq.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
-ofed/drivers/net/mlx4/xrcd.c			optional mlx4ib | mlxen	\
+ofed/drivers/net/mlx4/resource_tracker.c        optional mlx4ib | mlxen	\
+	no-depend obj-prefix "mlx4_"					\
+	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
+ofed/drivers/net/mlx4/sys_tune.c		optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 
 ofed/drivers/net/mlx4/en_cq.c			optional mlxen		\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
-ofed/drivers/net/mlx4/en_frag.c			optional mlxen		\
+ofed/drivers/net/mlx4/utils.c			optional mlxen		\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/en_main.c			optional mlxen		\

Modified: stable/9/sys/contrib/dev/npe/LICENSE
==============================================================================
--- stable/9/sys/contrib/dev/npe/LICENSE	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/sys/contrib/dev/npe/LICENSE	Thu Oct 30 15:41:25 2014	(r273864)
@@ -8,5 +8,5 @@ Redistribution. Redistribution and use i
 - Neither the name of Intel Corporation nor the names of its suppliers may be used to endorse or promote products derived from this software without specific prior written permission.
 - No reverse engineering, decompilation, or disassembly of this software is permitted.
 
-Limited patent license. Intel Corporation grants a world-wide, royalty-free, non-exclusive license under patents it now or hereafter owns or controls to make, have made, use, import, offer to sell and sell (¿Utilize¿) this software, but solely to the extent that any such patent is necessary to Utilize the software alone. The patent license shall not apply to any combinations which include this software. No hardware per se is licensed hereunder.
+Limited patent license. Intel Corporation grants a world-wide, royalty-free, non-exclusive license under patents it now or hereafter owns or controls to make, have made, use, import, offer to sell and sell ("Utilize") this software, but solely to the extent that any such patent is necessary to Utilize the software alone. The patent license shall not apply to any combinations which include this software. No hardware per se is licensed hereunder.
 DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Modified: stable/9/sys/contrib/dev/nve/amd64/nvenetlib.README
==============================================================================
--- stable/9/sys/contrib/dev/nve/amd64/nvenetlib.README	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/sys/contrib/dev/nve/amd64/nvenetlib.README	Thu Oct 30 15:41:25 2014	(r273864)
@@ -4,7 +4,7 @@ The installation and use of this softwar
 
 License For Customer Use of NVIDIA Software 
 
-IMPORTANT NOTICE -- READ CAREFULLY: This License For Customer Use of NVIDIA Software ("LICENSE") is the agreement which governs use of the software of NVIDIA Corporation and its subsidiaries (“NVIDIA”) enclosed herewith, including computer software and associated printed materials ("SOFTWARE"). By downloading, installing, copying, or otherwise using the SOFTWARE, you agree to be bound by the terms of this LICENSE. If you do not agree to the terms of this LICENSE, do not download, install or use the SOFTWARE.
+IMPORTANT NOTICE -- READ CAREFULLY: This License For Customer Use of NVIDIA Software ("LICENSE") is the agreement which governs use of the software of NVIDIA Corporation and its subsidiaries ("NVIDIA") enclosed herewith, including computer software and associated printed materials ("SOFTWARE"). By downloading, installing, copying, or otherwise using the SOFTWARE, you agree to be bound by the terms of this LICENSE. If you do not agree to the terms of this LICENSE, do not download, install or use the SOFTWARE.
 
 RECITALS
 Use of NVIDIA's products requires three elements: the SOFTWARE, the hardware on a computer motherboard, and a personal computer. The SOFTWARE is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE is not sold, and instead is only licensed for use, strictly in accordance with this document. The hardware is protected by various patents, and is sold, but this agreement does not cover that sale, since it may not necessarily be sold as a package with the SOFTWARE. This agreement sets forth the terms and conditions of the SOFTWARE LICENSE only.

Modified: stable/9/sys/contrib/dev/nve/i386/nvenetlib.README
==============================================================================
--- stable/9/sys/contrib/dev/nve/i386/nvenetlib.README	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/sys/contrib/dev/nve/i386/nvenetlib.README	Thu Oct 30 15:41:25 2014	(r273864)
@@ -4,7 +4,7 @@ The installation and use of this softwar
 
 License For Customer Use of NVIDIA Software 
 
-IMPORTANT NOTICE -- READ CAREFULLY: This License For Customer Use of NVIDIA Software ("LICENSE") is the agreement which governs use of the software of NVIDIA Corporation and its subsidiaries (“NVIDIA”) enclosed herewith, including computer software and associated printed materials ("SOFTWARE"). By downloading, installing, copying, or otherwise using the SOFTWARE, you agree to be bound by the terms of this LICENSE. If you do not agree to the terms of this LICENSE, do not download, install or use the SOFTWARE.
+IMPORTANT NOTICE -- READ CAREFULLY: This License For Customer Use of NVIDIA Software ("LICENSE") is the agreement which governs use of the software of NVIDIA Corporation and its subsidiaries ("NVIDIA") enclosed herewith, including computer software and associated printed materials ("SOFTWARE"). By downloading, installing, copying, or otherwise using the SOFTWARE, you agree to be bound by the terms of this LICENSE. If you do not agree to the terms of this LICENSE, do not download, install or use the SOFTWARE.
 
 RECITALS
 Use of NVIDIA's products requires three elements: the SOFTWARE, the hardware on a computer motherboard, and a personal computer. The SOFTWARE is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE is not sold, and instead is only licensed for use, strictly in accordance with this document. The hardware is protected by various patents, and is sold, but this agreement does not cover that sale, since it may not necessarily be sold as a package with the SOFTWARE. This agreement sets forth the terms and conditions of the SOFTWARE LICENSE only.

Modified: stable/9/sys/contrib/rdma/ib_umem.h
==============================================================================
--- stable/9/sys/contrib/rdma/ib_umem.h	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/sys/contrib/rdma/ib_umem.h	Thu Oct 30 15:41:25 2014	(r273864)
@@ -28,21 +28,17 @@
  * 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.
- *
- * $FreeBSD$
  */
 
 #ifndef IB_UMEM_H
 #define IB_UMEM_H
 
-struct ib_ucontext;
+#include <linux/list.h>
+#include <linux/scatterlist.h>
+#include <linux/workqueue.h>
+#include <linux/dma-attrs.h>
 
-struct ib_umem_chunk {
-	TAILQ_ENTRY(ib_umem_chunk) entry;
-	int                     nents;
-	int                     nmap;
-	struct rdma_scatterlist page_list[0];
-};
+struct ib_ucontext;
 
 struct ib_umem {
 	struct ib_ucontext     *context;
@@ -50,28 +46,76 @@ struct ib_umem {
 	int			offset;
 	int			page_size;
 	int                     writable;
-	TAILQ_HEAD(, ib_umem_chunk) chunk_list;
-#ifdef notyet	
+	int                     hugetlb;
+	struct list_head	chunk_list;
 	struct work_struct	work;
 	struct mm_struct       *mm;
-#endif	
 	unsigned long		diff;
 };
 
+/* contiguous memory structure */
+struct ib_cmem {
+
+	struct ib_ucontext     *context;
+	size_t			length;
+	/* Link list of contiguous blocks being part of that cmem  */
+	struct list_head ib_cmem_block;
+
+	/* Order of cmem block,  2^ block_order will equal number
+	     of physical pages per block
+	*/
+	unsigned long    block_order;
+	/* Refernce counter for that memory area
+	  - When value became 0 pages will be returned to the kernel.
+	*/
+	struct kref refcount;
+};
+
+
+struct ib_cmem_block {
+
+	struct list_head	list;
+	/* page will point to the page struct of the head page
+	    in the current compound page.
+	    block order is saved once as part of ib_cmem.
+	*/
+	struct page            *page;
+};
+
+
+
+struct ib_umem_chunk {
+	struct list_head	list;
+	int                     nents;
+	int                     nmap;
+	struct dma_attrs	attrs;
+	struct scatterlist      page_list[0];
+};
+
 #ifdef CONFIG_INFINIBAND_USER_MEM
 
 struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
-			    size_t size, int access);
+			    size_t size, int access, int dmasync);
 void ib_umem_release(struct ib_umem *umem);
 int ib_umem_page_count(struct ib_umem *umem);
 
+int ib_cmem_map_contiguous_pages_to_vma(struct ib_cmem *ib_cmem,
+	struct vm_area_struct *vma);
+struct ib_cmem *ib_cmem_alloc_contiguous_pages(struct ib_ucontext *context,
+				unsigned long total_size,
+				unsigned long page_size_order);
+void ib_cmem_release_contiguous_pages(struct ib_cmem *cmem);
+int ib_umem_map_to_vma(struct ib_umem *umem,
+				struct vm_area_struct *vma);
+
 #else /* CONFIG_INFINIBAND_USER_MEM */
 
+#include <linux/err.h>
 
 static inline struct ib_umem *ib_umem_get(struct ib_ucontext *context,
 					  unsigned long addr, size_t size,
-					  int access) {
-	return ERR_PTR(EINVAL);
+					  int access, int dmasync) {
+	return ERR_PTR(-EINVAL);
 }
 static inline void ib_umem_release(struct ib_umem *umem) { }
 static inline int ib_umem_page_count(struct ib_umem *umem) { return 0; }

Modified: stable/9/sys/contrib/rdma/krping/getopt.c
==============================================================================
--- stable/9/sys/contrib/rdma/krping/getopt.c	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/sys/contrib/rdma/krping/getopt.c	Thu Oct 30 15:41:25 2014	(r273864)
@@ -5,9 +5,10 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <sys/ctype.h>
-#include <sys/param.h>
-#include <sys/libkern.h>
+#include <sys/types.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+
 #include "getopt.h"
 
 /**
@@ -49,29 +50,29 @@ int krping_getopt(const char *caller, ch
 				if (opts->has_arg & OPT_NOPARAM) {
 					return opts->val;
 				}
-				printf("%s: the %s option requires "
+				printk(KERN_INFO "%s: the %s option requires "
 				       "an argument\n", caller, token);
 				return -EINVAL;
 			}
 			if (opts->has_arg & OPT_INT) {
 				char* v;
 
-				*value = strtoul(val, &v, 0);
+				*value = simple_strtoul(val, &v, 0);
 				if (!*v) {
 					return opts->val;
 				}
-				printf("%s: invalid numeric value "
+				printk(KERN_INFO "%s: invalid numeric value "
 				       "in %s=%s\n", caller, token, val);
 				return -EDOM;
 			}
 			if (opts->has_arg & OPT_STRING) {
 				return opts->val;
 			}
-			printf("%s: unexpected argument %s to the "
+			printk(KERN_INFO "%s: unexpected argument %s to the "
 			       "%s option\n", caller, val, token);
 			return -EINVAL;
 		}
 	}
-	printf("%s: Unrecognized option %s\n", caller, token);
+	printk(KERN_INFO "%s: Unrecognized option %s\n", caller, token);
 	return -EOPNOTSUPP;
 }

Modified: stable/9/sys/contrib/rdma/krping/krping.c
==============================================================================
--- stable/9/sys/contrib/rdma/krping/krping.c	Thu Oct 30 14:36:27 2014	(r273863)
+++ stable/9/sys/contrib/rdma/krping/krping.c	Thu Oct 30 15:41:25 2014	(r273864)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2005 Ammasso, Inc. All rights reserved.
- * Copyright (c) 2006 Open Grid Computing, Inc. All rights reserved.
+ * Copyright (c) 2006-2009 Open Grid Computing, Inc. All rights reserved.
  *
  * 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
@@ -34,39 +34,50 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <sys/ctype.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/slab.h>
+#include <linux/err.h>
+#include <linux/string.h>
+#include <linux/inet.h>
+#include <linux/list.h>
+#include <linux/in.h>
+#include <linux/device.h>
+#include <linux/pci.h>
+#include <linux/sched.h>
 
-#include <sys/param.h>
-#include <sys/condvar.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/endian.h>
-#include <sys/limits.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/rwlock.h>
-#include <sys/queue.h>
-#include <sys/taskqueue.h>
-#include <sys/syslog.h>
-#include <netinet/in.h>
+#include <asm/atomic.h>
 
-#include <vm/vm.h>
-#include <vm/pmap.h>
-
-#include <linux/types.h>
+#include <rdma/ib_verbs.h>
 #include <rdma/rdma_cm.h>
 
-#include "getopt.h"
 #include "krping.h"
+#include "getopt.h"
 
-#define PFX "krping: "
+extern int krping_debug;
+#define DEBUG_LOG(cb, x...) if (krping_debug) krping_printf((cb)->cookie, x)
+#define PRINTF(cb, x...) krping_printf((cb)->cookie, x)
 
-static int debug = 0;
-#define DEBUG_LOG if (debug) printf
+MODULE_AUTHOR("Steve Wise");
+MODULE_DESCRIPTION("RDMA ping client/server");
+MODULE_LICENSE("Dual BSD/GPL");
+
+static __inline uint64_t
+get_cycles(void)
+{
+	uint32_t low, high;
+	__asm __volatile("rdtsc" : "=a" (low), "=d" (high));
+	return (low | ((u_int64_t)high << 32));
+}
+
+typedef uint64_t cycles_t;
+
+enum mem_type {
+	DMA = 1,
+	FASTREG = 2,
+	MW = 3,
+	MR = 4
+};
 
 static const struct krping_option krping_opts[] = {
 	{"count", OPT_INT, 'C'},
@@ -77,23 +88,29 @@ static const struct krping_option krping
 	{"validate", OPT_NOPARAM, 'V'},
 	{"server", OPT_NOPARAM, 's'},
 	{"client", OPT_NOPARAM, 'c'},
-	{"dmamr", OPT_NOPARAM, 'D'},
-	{"debug", OPT_NOPARAM, 'd'},
-	{"wlat", OPT_NOPARAM, 'l'},
-	{"rlat", OPT_NOPARAM, 'L'},
-	{"bw", OPT_NOPARAM, 'B'},
-	{"tx-depth", OPT_INT, 't'},
-  	{"poll", OPT_NOPARAM, 'P'},
-  	{"memlimit", OPT_INT, 'm'},
+	{"mem_mode", OPT_STRING, 'm'},
+	{"server_inv", OPT_NOPARAM, 'I'},
+ 	{"wlat", OPT_NOPARAM, 'l'},
+ 	{"rlat", OPT_NOPARAM, 'L'},
+ 	{"bw", OPT_NOPARAM, 'B'},
+ 	{"duplex", OPT_NOPARAM, 'd'},
+ 	{"txdepth", OPT_INT, 'T'},
+ 	{"poll", OPT_NOPARAM, 'P'},
+ 	{"local_dma_lkey", OPT_NOPARAM, 'Z'},
+ 	{"read_inv", OPT_NOPARAM, 'R'},
+ 	{"fr", OPT_NOPARAM, 'f'},
 	{NULL, 0, 0}
 };
 
-struct mtx krping_mutex;
+#define htonll(x) cpu_to_be64((x))
+#define ntohll(x) cpu_to_be64((x))
+
+static struct mutex krping_mutex;
 
 /*
  * List of running krping threads.
  */
-struct krping_cb_list krping_cbs;
+static LIST_HEAD(krping_cbs);
 
 /*
  * krping "ping/pong" loop:
@@ -109,24 +126,118 @@ struct krping_cb_list krping_cbs;
  */
 
 /*
+ * These states are used to signal events between the completion handler
+ * and the main client or server thread.
+ *
+ * Once CONNECTED, they cycle through RDMA_READ_ADV, RDMA_WRITE_ADV,
+ * and RDMA_WRITE_COMPLETE for each ping.
+ */
+enum test_state {
+	IDLE = 1,
+	CONNECT_REQUEST,
+	ADDR_RESOLVED,
+	ROUTE_RESOLVED,
+	CONNECTED,
+	RDMA_READ_ADV,
+	RDMA_READ_COMPLETE,
+	RDMA_WRITE_ADV,
+	RDMA_WRITE_COMPLETE,
+	ERROR
+};
+
+struct krping_rdma_info {
+	uint64_t buf;
+	uint32_t rkey;
+	uint32_t size;
+};
+
+/*
  * Default max buffer size for IO...
  */
 #define RPING_BUFSIZE 128*1024
-#define RPING_SQ_DEPTH 32
+#define RPING_SQ_DEPTH 64
 
-static void krping_wait(struct krping_cb *cb, int state)
-{
-	int rc;
-	mtx_lock(&cb->lock);
-	while (cb->state < state) {
-		rc = msleep(cb, &cb->lock, 0, "krping", 0);
-		if (rc && rc != ERESTART) {
-			cb->state = ERROR;
-			break;
-		}
-	}
-	mtx_unlock(&cb->lock);
-}
+/*
+ * Control block struct.
+ */
+struct krping_cb {
+	void *cookie;
+	int server;			/* 0 iff client */
+	struct ib_cq *cq;
+	struct ib_pd *pd;
+	struct ib_qp *qp;
+
+	enum mem_type mem;
+	struct ib_mr *dma_mr;
+
+	struct ib_fast_reg_page_list *page_list;
+	int page_list_len;
+	struct ib_send_wr fastreg_wr;
+	struct ib_send_wr invalidate_wr;
+	struct ib_mr *fastreg_mr;
+	int server_invalidate;
+	int read_inv;
+	u8 key;
+
+	struct ib_mw *mw;
+	struct ib_mw_bind bind_attr;
+
+	struct ib_recv_wr rq_wr;	/* recv work request record */
+	struct ib_sge recv_sgl;		/* recv single SGE */
+	struct krping_rdma_info recv_buf;/* malloc'd buffer */
+	u64 recv_dma_addr;
+	DECLARE_PCI_UNMAP_ADDR(recv_mapping)
+	struct ib_mr *recv_mr;
+
+	struct ib_send_wr sq_wr;	/* send work requrest record */
+	struct ib_sge send_sgl;
+	struct krping_rdma_info send_buf;/* single send buf */
+	u64 send_dma_addr;
+	DECLARE_PCI_UNMAP_ADDR(send_mapping)
+	struct ib_mr *send_mr;
+
+	struct ib_send_wr rdma_sq_wr;	/* rdma work request record */
+	struct ib_sge rdma_sgl;		/* rdma single SGE */
+	char *rdma_buf;			/* used as rdma sink */
+	u64  rdma_dma_addr;
+	DECLARE_PCI_UNMAP_ADDR(rdma_mapping)
+	struct ib_mr *rdma_mr;
+
+	uint32_t remote_rkey;		/* remote guys RKEY */
+	uint64_t remote_addr;		/* remote guys TO */
+	uint32_t remote_len;		/* remote guys LEN */
+
+	char *start_buf;		/* rdma read src */
+	u64  start_dma_addr;
+	DECLARE_PCI_UNMAP_ADDR(start_mapping)
+	struct ib_mr *start_mr;
+
+	enum test_state state;		/* used for cond/signalling */
+	wait_queue_head_t sem;
+	struct krping_stats stats;
+
+	uint16_t port;			/* dst port in NBO */
+	struct in_addr addr;		/* dst addr in NBO */
+	char *addr_str;			/* dst addr string */
+	int verbose;			/* verbose logging */
+	int count;			/* ping count */
+	int size;			/* ping data size */
+	int validate;			/* validate ping data */
+	int wlat;			/* run wlat test */
+	int rlat;			/* run rlat test */
+	int bw;				/* run bw test */
+	int duplex;			/* run bw full duplex test */
+	int poll;			/* poll or block for rlat test */
+	int txdepth;			/* SQ depth */
+	int local_dma_lkey;		/* use 0 for lkey */
+	int frtest;			/* fastreg test */
+
+	/* CM stuff */
+	struct rdma_cm_id *cm_id;	/* connection on client side,*/
+					/* listener on server side. */
+	struct rdma_cm_id *child_cm_id;	/* connection on server side */
+	struct list_head list;
+};
 
 static int krping_cma_event_handler(struct rdma_cm_id *cma_id,
 				   struct rdma_cm_event *event)
@@ -134,39 +245,37 @@ static int krping_cma_event_handler(stru
 	int ret;
 	struct krping_cb *cb = cma_id->context;
 
-	DEBUG_LOG(PFX "cma_event type %d cma_id %p (%s)\n", event->event, cma_id,
-		  (cma_id == cb->cm_id) ? "parent" : "child");
+	DEBUG_LOG(cb, "cma_event type %d cma_id %p (%s)\n", event->event,
+	    cma_id, (cma_id == cb->cm_id) ? "parent" : "child");
 
-	mtx_lock(&cb->lock);
 	switch (event->event) {
 	case RDMA_CM_EVENT_ADDR_RESOLVED:
 		cb->state = ADDR_RESOLVED;
 		ret = rdma_resolve_route(cma_id, 2000);
 		if (ret) {
-			log(LOG_ERR, "rdma_resolve_route error %d\n", 
-			       ret);
-			wakeup(cb);
+			PRINTF(cb, "rdma_resolve_route error %d\n", ret);
+			wake_up_interruptible(&cb->sem);
 		}
 		break;
 
 	case RDMA_CM_EVENT_ROUTE_RESOLVED:
 		cb->state = ROUTE_RESOLVED;
-		wakeup(cb);
+		wake_up_interruptible(&cb->sem);
 		break;
 
 	case RDMA_CM_EVENT_CONNECT_REQUEST:
 		cb->state = CONNECT_REQUEST;
 		cb->child_cm_id = cma_id;
-		DEBUG_LOG(PFX "child cma %p\n", cb->child_cm_id);
-		wakeup(cb);
+		DEBUG_LOG(cb, "child cma %p\n", cb->child_cm_id);
+		wake_up_interruptible(&cb->sem);
 		break;
 
 	case RDMA_CM_EVENT_ESTABLISHED:
-		DEBUG_LOG(PFX "ESTABLISHED\n");
+		DEBUG_LOG(cb, "ESTABLISHED\n");
 		if (!cb->server) {
 			cb->state = CONNECTED;
-			wakeup(cb);
 		}
+		wake_up_interruptible(&cb->sem);
 		break;
 
 	case RDMA_CM_EVENT_ADDR_ERROR:
@@ -174,35 +283,34 @@ static int krping_cma_event_handler(stru
 	case RDMA_CM_EVENT_CONNECT_ERROR:
 	case RDMA_CM_EVENT_UNREACHABLE:
 	case RDMA_CM_EVENT_REJECTED:
-		log(LOG_ERR, "cma event %d, error %d\n", event->event,
+		PRINTF(cb, "cma event %d, error %d\n", event->event,
 		       event->status);
 		cb->state = ERROR;
-		wakeup(cb);
+		wake_up_interruptible(&cb->sem);
 		break;
 
 	case RDMA_CM_EVENT_DISCONNECTED:
-		DEBUG_LOG(PFX "DISCONNECT EVENT...\n");
+		PRINTF(cb, "DISCONNECT EVENT...\n");
 		cb->state = ERROR;
-		wakeup(cb);
+		wake_up_interruptible(&cb->sem);
 		break;
 
 	case RDMA_CM_EVENT_DEVICE_REMOVAL:
-		DEBUG_LOG(PFX "cma detected device removal!!!!\n");
+		PRINTF(cb, "cma detected device removal!!!!\n");
 		break;
 
 	default:
-		log(LOG_ERR, "oof bad type!\n");
-		wakeup(cb);
+		PRINTF(cb, "oof bad type!\n");
+		wake_up_interruptible(&cb->sem);
 		break;
 	}
-	mtx_unlock(&cb->lock);
 	return 0;
 }
 
 static int server_recv(struct krping_cb *cb, struct ib_wc *wc)
 {
 	if (wc->byte_len != sizeof(cb->recv_buf)) {
-		log(LOG_ERR, "Received bogus data, size %d\n", 
+		PRINTF(cb, "Received bogus data, size %d\n", 
 		       wc->byte_len);
 		return -1;
 	}
@@ -210,7 +318,7 @@ static int server_recv(struct krping_cb 
 	cb->remote_rkey = ntohl(cb->recv_buf.rkey);
 	cb->remote_addr = ntohll(cb->recv_buf.buf);
 	cb->remote_len  = ntohl(cb->recv_buf.size);
-	DEBUG_LOG(PFX "Received rkey %x addr %llx len %d from peer\n",
+	DEBUG_LOG(cb, "Received rkey %x addr %llx len %d from peer\n",
 		  cb->remote_rkey, (unsigned long long)cb->remote_addr, 
 		  cb->remote_len);
 
@@ -225,7 +333,7 @@ static int server_recv(struct krping_cb 
 static int client_recv(struct krping_cb *cb, struct ib_wc *wc)
 {
 	if (wc->byte_len != sizeof(cb->recv_buf)) {
-		log(LOG_ERR, "Received bogus data, size %d\n", 
+		PRINTF(cb, "Received bogus data, size %d\n", 
 		       wc->byte_len);
 		return -1;
 	}
@@ -245,11 +353,13 @@ static void krping_cq_event_handler(stru
 	struct ib_recv_wr *bad_wr;
 	int ret;
 
-	mtx_lock(&cb->lock);
-	KASSERT(cb->cq == cq, ("bad condition"));
+	BUG_ON(cb->cq != cq);
 	if (cb->state == ERROR) {
-		log(LOG_ERR,  "cq completion in ERROR state\n");
-		mtx_unlock(&cb->lock);
+		PRINTF(cb, "cq completion in ERROR state\n");
+		return;
+	}
+	if (cb->frtest) {
+		PRINTF(cb, "cq completion event in frtest!\n");
 		return;
 	}
 	if (!cb->wlat && !cb->rlat && !cb->bw)
@@ -257,76 +367,77 @@ static void krping_cq_event_handler(stru
 	while ((ret = ib_poll_cq(cb->cq, 1, &wc)) == 1) {
 		if (wc.status) {
 			if (wc.status == IB_WC_WR_FLUSH_ERR) {
-				DEBUG_LOG("cq flushed\n");
+				DEBUG_LOG(cb, "cq flushed\n");
 				continue;
 			} else {
-				log(LOG_CRIT, "cq completion failed status %d\n",
-					wc.status);
+				PRINTF(cb, "cq completion failed with "
+				       "wr_id %Lx status %d opcode %d vender_err %x\n",
+					wc.wr_id, wc.status, wc.opcode, wc.vendor_err);
 				goto error;
 			}
 		}
 
 		switch (wc.opcode) {
 		case IB_WC_SEND:
-			DEBUG_LOG(PFX "send completion\n");
+			DEBUG_LOG(cb, "send completion\n");
 			cb->stats.send_bytes += cb->send_sgl.length;
 			cb->stats.send_msgs++;
 			break;
 
 		case IB_WC_RDMA_WRITE:
-			DEBUG_LOG(PFX "rdma write completion\n");
+			DEBUG_LOG(cb, "rdma write completion\n");
 			cb->stats.write_bytes += cb->rdma_sq_wr.sg_list->length;
 			cb->stats.write_msgs++;
 			cb->state = RDMA_WRITE_COMPLETE;
-			wakeup(cb);
+			wake_up_interruptible(&cb->sem);
 			break;
 
 		case IB_WC_RDMA_READ:
-			DEBUG_LOG(PFX "rdma read completion\n");
+			DEBUG_LOG(cb, "rdma read completion\n");
 			cb->stats.read_bytes += cb->rdma_sq_wr.sg_list->length;
 			cb->stats.read_msgs++;
 			cb->state = RDMA_READ_COMPLETE;
-			wakeup(cb);
+			wake_up_interruptible(&cb->sem);
 			break;
 
 		case IB_WC_RECV:
-			DEBUG_LOG(PFX "recv completion\n");
+			DEBUG_LOG(cb, "recv completion\n");
 			cb->stats.recv_bytes += sizeof(cb->recv_buf);
 			cb->stats.recv_msgs++;
 			if (cb->wlat || cb->rlat || cb->bw)
 				ret = server_recv(cb, &wc);
 			else
 				ret = cb->server ? server_recv(cb, &wc) :
-					   client_recv(cb, &wc);
+						   client_recv(cb, &wc);
 			if (ret) {
-				log(LOG_ERR, "recv wc error: %d\n", ret);
+				PRINTF(cb, "recv wc error: %d\n", ret);
 				goto error;
 			}
 
 			ret = ib_post_recv(cb->qp, &cb->rq_wr, &bad_wr);
 			if (ret) {
-				log(LOG_ERR, "post recv error: %d\n", 
+				PRINTF(cb, "post recv error: %d\n", 
 				       ret);
 				goto error;
 			}
-			wakeup(cb);
+			wake_up_interruptible(&cb->sem);
 			break;
 
 		default:
-			log(LOG_ERR, "unknown!!!!! completion\n");
+			PRINTF(cb, 
+			       "%s:%d Unexpected opcode %d, Shutting down\n",
+			       __func__, __LINE__, wc.opcode);
 			goto error;
 		}
 	}
 	if (ret) {
-		log(LOG_ERR, "poll error %d\n", ret);
+		PRINTF(cb, "poll error %d\n", ret);
 		goto error;
 	}
-	mtx_unlock(&cb->lock);
 	return;
 error:
 	cb->state = ERROR;
-	wakeup(cb);
-	mtx_unlock(&cb->lock);
+	wake_up_interruptible(&cb->sem);
 }
 
 static int krping_accept(struct krping_cb *cb)
@@ -334,7 +445,7 @@ static int krping_accept(struct krping_c
 	struct rdma_conn_param conn_param;
 	int ret;
 
-	DEBUG_LOG(PFX "accepting client connection request\n");
+	DEBUG_LOG(cb, "accepting client connection request\n");
 
 	memset(&conn_param, 0, sizeof conn_param);
 	conn_param.responder_resources = 1;
@@ -342,14 +453,15 @@ static int krping_accept(struct krping_c
 
 	ret = rdma_accept(cb->child_cm_id, &conn_param);
 	if (ret) {
-		log(LOG_ERR, "rdma_accept error: %d\n", ret);
+		PRINTF(cb, "rdma_accept error: %d\n", ret);
 		return ret;
 	}
 
 	if (!cb->wlat && !cb->rlat && !cb->bw) {
-		krping_wait(cb, CONNECTED);
+		wait_event_interruptible(cb->sem, cb->state >= CONNECTED);
 		if (cb->state == ERROR) {
-			log(LOG_ERR,  "wait for CONNECTED state %d\n", cb->state);
+			PRINTF(cb, "wait for CONNECTED state %d\n", 
+				cb->state);
 			return -1;
 		}
 	}
@@ -358,19 +470,22 @@ static int krping_accept(struct krping_c
 
 static void krping_setup_wr(struct krping_cb *cb)
 {
-	/* XXX X86 only here... not mapping for dma! */
-	cb->recv_sgl.addr = vtophys(&cb->recv_buf);
+	cb->recv_sgl.addr = cb->recv_dma_addr;
 	cb->recv_sgl.length = sizeof cb->recv_buf;
-	if (cb->use_dmamr)
+	if (cb->local_dma_lkey)
+		cb->recv_sgl.lkey = cb->qp->device->local_dma_lkey;
+	else if (cb->mem == DMA)
 		cb->recv_sgl.lkey = cb->dma_mr->lkey;
 	else
 		cb->recv_sgl.lkey = cb->recv_mr->lkey;
 	cb->rq_wr.sg_list = &cb->recv_sgl;
 	cb->rq_wr.num_sge = 1;
 
-	cb->send_sgl.addr = vtophys(&cb->send_buf);
+	cb->send_sgl.addr = cb->send_dma_addr;
 	cb->send_sgl.length = sizeof cb->send_buf;
-	if (cb->use_dmamr)
+	if (cb->local_dma_lkey)
+		cb->send_sgl.lkey = cb->qp->device->local_dma_lkey;
+	else if (cb->mem == DMA)
 		cb->send_sgl.lkey = cb->dma_mr->lkey;
 	else
 		cb->send_sgl.lkey = cb->send_mr->lkey;
@@ -380,18 +495,39 @@ static void krping_setup_wr(struct krpin
 	cb->sq_wr.sg_list = &cb->send_sgl;
 	cb->sq_wr.num_sge = 1;
 
-	cb->rdma_addr = vtophys(cb->rdma_buf);
-	cb->rdma_sgl.addr = cb->rdma_addr;
-	if (cb->use_dmamr)
-		cb->rdma_sgl.lkey = cb->dma_mr->lkey;
-	else
-		cb->rdma_sgl.lkey = cb->rdma_mr->lkey;
-	cb->rdma_sq_wr.send_flags = IB_SEND_SIGNALED;
-	cb->rdma_sq_wr.sg_list = &cb->rdma_sgl;
-	cb->rdma_sq_wr.num_sge = 1;
+	if (cb->server || cb->wlat || cb->rlat || cb->bw) {
+		cb->rdma_sgl.addr = cb->rdma_dma_addr;
+		if (cb->mem == MR)
+			cb->rdma_sgl.lkey = cb->rdma_mr->lkey;
+		cb->rdma_sq_wr.send_flags = IB_SEND_SIGNALED;
+		cb->rdma_sq_wr.sg_list = &cb->rdma_sgl;
+		cb->rdma_sq_wr.num_sge = 1;
+	}
+
+	switch(cb->mem) {
+	case FASTREG:
+
+		/* 
+		 * A chain of 2 WRs, INVALDATE_MR + FAST_REG_MR.
+		 * both unsignaled.  The client uses them to reregister
+		 * the rdma buffers with a new key each iteration.
+		 */
+		cb->fastreg_wr.opcode = IB_WR_FAST_REG_MR;
+		cb->fastreg_wr.wr.fast_reg.page_shift = PAGE_SHIFT;
+		cb->fastreg_wr.wr.fast_reg.length = cb->size;
+		cb->fastreg_wr.wr.fast_reg.page_list = cb->page_list;
+		cb->fastreg_wr.wr.fast_reg.page_list_len = cb->page_list_len;
 
-	if (!cb->server || cb->wlat || cb->rlat || cb->bw) {
-		cb->start_addr = vtophys(cb->start_buf);
+		cb->invalidate_wr.next = &cb->fastreg_wr;
+		cb->invalidate_wr.opcode = IB_WR_LOCAL_INV;
+		break;
+	case MW:
+		cb->bind_attr.wr_id = 0xabbaabba;
+		cb->bind_attr.send_flags = 0; /* unsignaled */
+		cb->bind_attr.length = cb->size;
+		break;
+	default:
+		break;
 	}
 }
 
@@ -401,134 +537,207 @@ static int krping_setup_buffers(struct k
 	struct ib_phys_buf buf;
 	u64 iovbase;
 
-	DEBUG_LOG(PFX "krping_setup_buffers called on cb %p\n", cb);
+	DEBUG_LOG(cb, "krping_setup_buffers called on cb %p\n", cb);
+
+	cb->recv_dma_addr = dma_map_single(cb->pd->device->dma_device, 
+				   &cb->recv_buf, 
+				   sizeof(cb->recv_buf), DMA_BIDIRECTIONAL);
+	pci_unmap_addr_set(cb, recv_mapping, cb->recv_dma_addr);
+	cb->send_dma_addr = dma_map_single(cb->pd->device->dma_device, 
+					   &cb->send_buf, sizeof(cb->send_buf),
+					   DMA_BIDIRECTIONAL);
+	pci_unmap_addr_set(cb, send_mapping, cb->send_dma_addr);
 
-	if (cb->use_dmamr) {
+	if (cb->mem == DMA) {
 		cb->dma_mr = ib_get_dma_mr(cb->pd, IB_ACCESS_LOCAL_WRITE|
 					   IB_ACCESS_REMOTE_READ|
 				           IB_ACCESS_REMOTE_WRITE);
 		if (IS_ERR(cb->dma_mr)) {
-			log(LOG_ERR, "reg_dmamr failed\n");
-			return PTR_ERR(cb->dma_mr);
+			DEBUG_LOG(cb, "reg_dmamr failed\n");
+			ret = PTR_ERR(cb->dma_mr);
+			goto bail;
 		}
 	} else {
+		if (!cb->local_dma_lkey) {
+			buf.addr = cb->recv_dma_addr;
+			buf.size = sizeof cb->recv_buf;
+			DEBUG_LOG(cb, "recv buf dma_addr %llx size %d\n", buf.addr, 
+				(int)buf.size);
+			iovbase = cb->recv_dma_addr;
+			cb->recv_mr = ib_reg_phys_mr(cb->pd, &buf, 1, 
+						     IB_ACCESS_LOCAL_WRITE, 
+						     &iovbase);
+
+			if (IS_ERR(cb->recv_mr)) {
+				DEBUG_LOG(cb, "recv_buf reg_mr failed\n");
+				ret = PTR_ERR(cb->recv_mr);
+				goto bail;
+			}
 
-		buf.addr = vtophys(&cb->recv_buf);
-		buf.size = sizeof cb->recv_buf;
-		iovbase = vtophys(&cb->recv_buf);
-		cb->recv_mr = ib_reg_phys_mr(cb->pd, &buf, 1, 
-					     IB_ACCESS_LOCAL_WRITE, 
-					     &iovbase);
-
-		if (IS_ERR(cb->recv_mr)) {
-			log(LOG_ERR, "recv_buf reg_mr failed\n");
-			return PTR_ERR(cb->recv_mr);
-		}
-
-		buf.addr = vtophys(&cb->send_buf);
-		buf.size = sizeof cb->send_buf;
-		iovbase = vtophys(&cb->send_buf);
-		cb->send_mr = ib_reg_phys_mr(cb->pd, &buf, 1, 
-					     0, &iovbase);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list