components/open-fabrics/libibumad/patches/base.patch
author Boris Chiu <Boris.Chiu@oracle.COM>
Wed, 29 Feb 2012 22:39:04 +0000
changeset 715 eed3ed08f692
parent 636 da28b1dc61e7
child 900 63d3bf696d85
permissions -rw-r--r--
6926434 ib_read_bw, ib_read_lat: OFED utilities sometimes hang when using "-e" (event) flag 6996726 "rds-stress --show-perfdata" option is broken. 7003185 rds-stress man page needs cleanup 7005654 qperf: 32bit only: qperf fails in all RC/UD streaming tests 7024095 set_nodedesc.sh: heading whitespace of HCA specific desc string is ignored if '-N' not specified 7043392 OFED 1.5.3: test_verbs: 'resize CQ' test failed on tavor 7043758 OFED 1.5.3: test_verbs: core dump while during async test on tavor with snv_166 7044543 ibsysstat server process fails to get cpu info 7046730 ibstatus needs to clean up after itself 7050802 OFED 1.5.3: ib_send_bw/ib_send_lat doesn't work with '-g' option 7061241 OFED 1.5.3 ib_read_lat/ib_read_bw don't work between tavor and hermon 7087339 modify solaris changes to libmlx4 to use returned inline size from hermon driver 7090343 solaris_set_nodedesc: the -N option does not work 7091277 /usr/man/man3/ibnd_debug.3 and ibnd_destroy_fabric.3 refer to non-existence ibnd_discover_fabric.3 7091649 OFED 1.5.3: ibdiagnet: "-vlr -r" shows file open failure messages on Solaris 7093499 ib_rdma_lat, ib_read_lat, ib_write_lat and other IB verb latency tools should use gethrtime 7095000 mem leak in libibvers ibv_read_sysfs_file() 7095879 resize cq in libmlx4 incorrect 7095943 rdma_lat & rdma_bw core dump on non ib system 7099692 Add man pages for OFUV perftest utilities 7108873 definitions in sol_uverbs_ioctl.h & sol_umad_ioctl.h are duplicated in solaris_compatibility.c 7119924 ibportstate: operations enable, disable, and reset should only be allowed on switch ports 7120891 ibv_devinfo should report a valid active_mtu instead of 'Unknown' 7141996 sol_uverbs should provide ioctl calls to get GIDs and PKEYs for libibverbs (userland changes) 7144445 setnodedesc.sh -v white space issue 7146479 qperf --cpu_affinity doesn't match with solaris cpu no. 7146482 qperf -cm1 sometimes failed with "rdma_listen failed" message

diff -r -u /tmp/libibumad-1.3.7/Makefile.in libibumad-1.3.7/Makefile.in
--- /tmp/libibumad-1.3.7/Makefile.in	Mon Feb 14 06:18:00 2011
+++ libibumad-1.3.7/Makefile.in	Fri Feb 25 03:11:40 2011
@@ -367,8 +367,8 @@
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
 	}
 
 uninstall-libLTLIBRARIES:
diff -r -u /tmp/libibumad-1.3.7/include/infiniband/umad.h libibumad-1.3.7/include/infiniband/umad.h
--- /tmp/libibumad-1.3.7/include/infiniband/umad.h	Mon Feb 14 01:08:29 2011
+++ libibumad-1.3.7/include/infiniband/umad.h	Fri May 13 04:28:12 2011
@@ -96,7 +96,11 @@
 
 #define UMAD_MAX_PORTS		64
 
+#if defined(__SVR4) && defined(__sun)
+#define	UMAD_DEV_DIR		"/dev/infiniband/ofs"
+#else
 #define UMAD_DEV_DIR		"/dev/infiniband"
+#endif
 
 #define SYS_CA_PORTS_DIR	"ports"
 
diff -r -u /tmp/libibumad-1.3.7/configure libibumad-1.3.7/configure
--- /tmp/libibumad-1.3.7/configure	Mon Feb 14 06:18:01 2011
+++ libibumad-1.3.7/configure	Thu Feb 24 11:27:18 2011
@@ -8713,6 +8713,7 @@
 	;;
       esac
       link_all_deplibs=yes
+      hardcode_libdir_flag_spec=
       ;;
 
     sunos4*)
diff -r -u /tmp/libibumad-1.3.7/src/sysfs.c libibumad-1.3.7/src/sysfs.c
--- /tmp/libibumad-1.3.7/src/sysfs.c	Mon Feb 14 01:08:29 2011
+++ libibumad-1.3.7/src/sysfs.c	Thu Feb 24 11:27:30 2011
@@ -46,9 +46,14 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#if !(defined(__SVR4) && defined(__sun))
 #include <endian.h>
 #include <byteswap.h>
+#endif
 #include <netinet/in.h>
+#if defined(__SVR4) && defined(__sun)
+#include <infiniband/driver.h>
+#endif
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #define htonll(x) bswap_64(x)
@@ -70,6 +75,16 @@
 	char path[256], *s;
 	int fd, r;
 
+#if defined(__SVR4) && defined(__sun)
+	if ((r = ibv_read_sysfs_file(dir_name, file_name, str, max_len)) < 0) {
+		return -EINVAL;
+	}
+
+	str[(r < max_len) ? r : max_len - 1] = 0;
+
+	if ((s = strrchr(str, '\n')))
+		*s = 0;
+#else
 	snprintf(path, sizeof(path), "%s/%s", dir_name, file_name);
 
 	if ((fd = open(path, O_RDONLY)) < 0)
@@ -88,6 +103,7 @@
 		*s = 0;
 
 	close(fd);
+#endif
 	return 0;
 }
 
diff -r -u /tmp/libibumad-1.3.7/src/umad.c libibumad-1.3.7/src/umad.c
--- /tmp/libibumad-1.3.7/src/umad.c	Mon Feb 14 01:08:29 2011
+++ libibumad-1.3.7/src/umad.c	Fri May  6 05:18:47 2011
@@ -50,6 +50,10 @@
 
 #include "umad.h"
 
+#if defined(__SVR4) && defined(__sun)
+#include <infiniband/verbs.h>
+#endif
+
 #define IB_OPENIB_OUI                 (0x001405)
 
 #ifdef HAVE_VALGRIND_MEMCHECK_H
@@ -82,7 +86,7 @@
 extern int sys_read_uint64(char *dir_name, char *file_name, uint64_t * u);
 extern int sys_read_uint(char *dir_name, char *file_name, unsigned *u);
 
-#define IBWARN(fmt, args...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", getpid(), __func__, ## args)
+#define IBWARN(fmt, args...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", (int)getpid(), __func__, ## args)
 
 #define TRACE	if (umaddebug)	IBWARN
 #define DEBUG	if (umaddebug)	IBWARN
@@ -172,6 +176,73 @@
 	memcpy(&port->port_guid, gid + 8, sizeof port->port_guid);
 
 	snprintf(port_dir + len, sizeof(port_dir) - len, "/pkeys");
+
+#if defined(__SVR4) && defined(__sun)
+	{
+		struct ibv_device	**root_dev_list, **dev_list = NULL;
+		struct ibv_context	*ctx = NULL;
+		struct ibv_port_attr	port_attr;
+		int			num_dev;
+
+		root_dev_list = dev_list = ibv_get_device_list(&num_dev);
+		if (!dev_list) {
+			IBWARN("No HCA devices found");
+			goto clean;
+		}
+
+		for (i = 0; i < num_dev; i++, dev_list++) {
+			if (strcmp(ibv_get_device_name(*dev_list), ca_name)
+			    == 0) {
+				break;
+			}
+		}
+
+		if (i == num_dev) {
+			IBWARN("Could not find \"%s\"", ca_name);
+			ibv_free_device_list(root_dev_list);
+			goto clean;
+		}
+
+		if (!(ctx = ibv_open_device(*dev_list))) {
+			IBWARN("failed to open device \"%s\"", ca_name);
+			ibv_free_device_list(root_dev_list);
+			goto clean;
+		}
+
+		if (ibv_query_port(ctx, portnum, &port_attr)) {
+			IBWARN("Could not query \"%s\" port %d", ca_name,
+			    portnum);
+			ibv_close_device(ctx);
+			ibv_free_device_list(root_dev_list);
+			goto clean;
+		}
+
+		port->pkeys =
+		    malloc(sizeof (uint16_t) * port_attr.pkey_tbl_len);
+
+		if (!port->pkeys) {
+			IBWARN("Could not retrieve pkeys for \"%s\"", ca_name);
+			ibv_close_device(ctx);
+			ibv_free_device_list(root_dev_list);
+			goto clean;
+		}
+	
+		/*
+		 * set high bit of port_num, and try get all pkeys in one go.
+		 */
+		portnum |= 0x80;
+		num_pkeys = ibv_query_pkey(ctx, portnum, port_attr.pkey_tbl_len,
+		    port->pkeys);
+		if (num_pkeys != 0) {
+			IBWARN("get_port: ibv_query_pkey() failed for \"%s\"",
+			    ca_name);
+			ibv_close_device(ctx);
+			ibv_free_device_list(root_dev_list);
+			goto clean;
+		}
+		port->pkeys_size = port_attr.pkey_tbl_len;
+	}
+#else
 	num_pkeys = scandir(port_dir, &namelist, check_for_digit_name, NULL);
 	if (num_pkeys <= 0) {
 		IBWARN("no pkeys found for %s:%u (at dir %s)...",
@@ -193,6 +264,8 @@
 	port->pkeys_size = num_pkeys;
 	free(namelist);
 	namelist = NULL;
+#endif
+
 	port_dir[len] = '\0';
 
 	/* FIXME: handle gids */
@@ -384,6 +457,7 @@
 	snprintf(dir_name, sizeof(dir_name), "%s/%s/%s",
 		 SYS_INFINIBAND, ca->ca_name, SYS_CA_PORTS_DIR);
 
+#if !(defined(__SVR4) && defined(__sun))
 	if (!(dir = opendir(dir_name)))
 		return -ENOENT;
 
@@ -425,15 +499,41 @@
 	free(namelist);
 
 	closedir(dir);
+#else
+	// TODO: hardcoded 2 ports
+	ca->numports = 0;
+	memset(ca->ports, 0, sizeof ca->ports);
+
+	for (portnum = 1 /* HERE */; portnum <= 2 /* HERE */; portnum++) {
+
+		if (!(ca->ports[portnum] = calloc(1, sizeof(*ca->ports[portnum])))) {
+			ret = -ENOMEM;
+			goto clean;
+		}
+		if (get_port(ca_name, dir_name, portnum, ca->ports[portnum]) < 0) {
+			free(ca->ports[portnum]);
+			ca->ports[portnum] = NULL;
+			ret = -EIO;
+			goto clean;
+		}
+		if (ca->numports < portnum)
+			ca->numports = portnum;
+	}
+#endif
+
 	put_ca(ca);
 	return 0;
 
 clean:
+#if !(defined(__SVR4) && defined(__sun))
 	for (i = 0; i < r; i++)
 		free(namelist[i]);
 	free(namelist);
+#endif
 error:
+#if !(defined(__SVR4) && defined(__sun))
 	closedir(dir);
+#endif
 	release_ca(ca);
 
 	return ret;
@@ -484,6 +584,11 @@
 int umad_init(void)
 {
 	TRACE("umad_init");
+	struct ibv_device **devlist = ibv_get_device_list(NULL);
+	if (devlist == NULL) {
+		IBWARN("No IB devices found");
+		return -1;
+	}
 	if (sys_read_uint(IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE, &abi_version) < 0) {
 		IBWARN
 		    ("can't read ABI version from %s/%s (%m): is ib_umad module loaded?",
@@ -522,6 +627,28 @@
 
 int umad_get_cas_names(char cas[][UMAD_CA_NAME_LEN], int max)
 {
+#if defined(__SVR4) && defined(__sun)
+	struct ibv_device **devlist = ibv_get_device_list(NULL);
+	int j = 0;
+
+	TRACE("max %d", max);
+
+	if (devlist) {
+		while (devlist[j] && j < max) {
+			strncpy(cas[j], ibv_get_device_name(devlist[j]),
+						UMAD_CA_NAME_LEN);
+			j++;
+		}
+		ibv_free_device_list(devlist);
+		DEBUG("return %d cas", j);
+	}
+	if (j == 0 && max > 0) {
+		/* Is this still needed ? */
+		strncpy((char *)cas, def_ca_name, UMAD_CA_NAME_LEN);
+		DEBUG("return 1 ca");
+		j = 1;
+	}
+#else
 	struct dirent **namelist;
 	int n, i, j = 0;
 
@@ -547,6 +674,7 @@
 	}
 	if (n >= 0)
 		free(namelist);
+#endif
 	return j;
 }