--- a/components/open-fabrics/libibverbs/solaris_compatibility.c Tue Jan 20 05:18:57 2015 -0800
+++ b/components/open-fabrics/libibverbs/solaris_compatibility.c Fri Jan 23 08:29:14 2015 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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
@@ -101,8 +101,6 @@
#define RDMA_USER_CM_MAX_ABI_VERSION 4 /* rdma_cma_abi.h */
#define MLX4 0
-#define MAX_HCAS 260
-#define MAX_HCA_PORTS 16
#define HW_DRIVER_MAX_NAME_LEN 20
#define UVERBS_KERNEL_SYSFS_NAME_BASE "uverbs"
#define UMAD_KERNEL_SYSFS_NAME_BASE "umad"
@@ -119,6 +117,9 @@
#define INFINIHOST_DEVICE_ID_2 0x5a45
#define INFINIHOST_DEVICE_ID_4 0x6279
+#define MAX_HCAS (64*16)
+#define MAX_PORTS (MAX_HCAS*2)
+
/*
* sol_uverbs_drv_status is the status of what libibverbs knows
* about the status of sol_uverbs driver.
@@ -164,7 +165,7 @@
char ibd_node_guid_external_str[20];
char ibd_sys_image_guid[20];
char ibd_fw_ver[16];
- char ibd_name[8];
+ char ibd_name[16];
int ibd_boardid_index;
uint_t ibd_device_id;
} ibdev_cache_info_t;
@@ -178,7 +179,7 @@
uint_t uvc_vendor_id;
uint_t uvc_device_id;
int uvc_hca_instance;
- char uvc_ibdev_name[8];
+ char uvc_ibdev_name[16];
char uvc_ibdev_hca_path[MAXPATHLEN];
} uverbs_cache_info_t;
static uverbs_cache_info_t uverbs_dev_cache[MAX_HCAS];
@@ -189,7 +190,7 @@
int umc_port;
char umc_ib_dev[16];
} umad_cache_info_t;
-static umad_cache_info_t umad_dev_cache[MAX_HCAS * MAX_HCA_PORTS];
+static umad_cache_info_t umad_dev_cache[MAX_PORTS];
static int umad_abi_version = -1;
pthread_once_t oneTimeInit = PTHREAD_ONCE_INIT;
@@ -236,8 +237,7 @@
static int
umad_cache_add(uint_t dev_num, int port, char *ibdev)
{
- if ((dev_num >= (MAX_HCAS * MAX_HCA_PORTS)) ||
- (umad_cache_cnt >= (MAX_HCAS * MAX_HCA_PORTS))) {
+ if ((dev_num >= MAX_PORTS) || (umad_cache_cnt >= MAX_PORTS)) {
fprintf(stderr, "dev %d: exceeds umad cache size\n", dev_num);
return (1);
}
@@ -371,13 +371,8 @@
uverbs_cache_info_t info;
int dev_num, fd, i, bufsize, hca_cnt;
char uverbs_devpath[MAXPATHLEN];
-#ifndef IB_USER_VERBS_V2_IN_V1
sol_uverbs_info_t *uverbs_infop;
sol_uverbs_hca_info_t *hca_infop;
-#else
- sol_uverbs_info_v2_t *uverbs_infop;
- sol_uverbs_hca_info_v2_t *hca_infop;
-#endif
char *buf;
snprintf(uverbs_devpath, MAXPATHLEN, "%s/%s%d",
@@ -394,20 +389,11 @@
goto error_exit1;
}
-#ifndef IB_USER_VERBS_V2_IN_V1
bufsize = sizeof (sol_uverbs_info_t) + sizeof (sol_uverbs_hca_info_t) *
MAX_HCAS;
-#else
- bufsize = sizeof (sol_uverbs_info_v2_t) +
- sizeof (sol_uverbs_hca_info_v2_t) * MAX_HCAS;
-#endif
buf = malloc(bufsize);
memset(buf, 0, bufsize);
-#ifndef IB_USER_VERBS_V2_IN_V1
uverbs_infop = (sol_uverbs_info_t *)buf;
-#else
- uverbs_infop = (sol_uverbs_info_v2_t *)buf;
-#endif
uverbs_infop->uverbs_hca_cnt = MAX_HCAS;
if (ioctl(fd, UVERBS_IOCTL_GET_HCA_INFO, uverbs_infop) != 0) {
@@ -484,7 +470,7 @@
sol_umad_ioctl_info_t *umad_infop;
sol_umad_ioctl_port_info_t *port_infop;
- for (minor = 0; minor < MAX_HCAS * MAX_HCA_PORTS; minor++) {
+ for (minor = 0; minor < MAX_PORTS; minor++) {
snprintf(umad_devpath, MAXPATHLEN, "%s/%s%d",
IB_OFS_DEVPATH_PREFIX, UMAD_KERNEL_SYSFS_NAME_BASE,
minor);
@@ -496,7 +482,7 @@
save_errno = errno;
}
- if ((minor == MAX_HCAS * MAX_HCA_PORTS) && (fd < 0)) {
+ if ((minor == MAX_PORTS) && (fd < 0)) {
if (! save_errno)
save_errno = errno;
fprintf(stderr, "failed to open sol_umad: %s\n",
@@ -505,12 +491,12 @@
}
bufsize = sizeof (sol_umad_ioctl_info_t) +
- (sizeof (sol_umad_ioctl_port_info_t) * MAX_HCAS * MAX_HCA_PORTS);
+ (sizeof (sol_umad_ioctl_port_info_t) * MAX_PORTS);
buf = malloc(bufsize);
memset(buf, 0, bufsize);
umad_infop = (sol_umad_ioctl_info_t *)buf;
- umad_infop->umad_port_cnt = MAX_HCAS * MAX_HCA_PORTS;
+ umad_infop->umad_port_cnt = MAX_PORTS;
if (ioctl(fd, IB_USER_MAD_GET_PORT_INFO, umad_infop) != 0) {
fprintf(stderr, "sol_umad ioctl failed: %s\n",
@@ -593,7 +579,7 @@
memset(&uverbs_dev_cache, 0, (sizeof (uverbs_cache_info_t) * MAX_HCAS));
memset(&ibdev_cache, 0, (sizeof (ibdev_cache_info_t) * MAX_HCAS * 2));
memset(&umad_dev_cache, 0,
- (sizeof (umad_cache_info_t) * MAX_HCAS * MAX_HCA_PORTS));
+ (sizeof (umad_cache_info_t) * MAX_PORTS));
initialized = B_TRUE;
}
@@ -1146,6 +1132,19 @@
} else if (strcmp(path, "cap_mask") == 0) {
len = 1 + sprintf(buf, "0x%08x",
port_attr.port_cap_flags);
+ } else if (strcmp(path, "link_layer") == 0) {
+ switch (port_attr.link_layer) {
+ case IBV_LINK_LAYER_UNSPECIFIED:
+ case IBV_LINK_LAYER_INFINIBAND:
+ len = 1 + sprintf(buf, "%s", "IB");
+ break;
+ case IBV_LINK_LAYER_ETHERNET:
+ len =
+ 1 + sprintf(buf, "%s", "Ethernet");
+ break;
+ default:
+ len = 1 + sprintf(buf, "%s", "Unknown");
+ }
}
}
exit:
@@ -1396,7 +1395,7 @@
(void) pthread_mutex_unlock(&umad_cache_mutex);
if (check_path(path, CP_UMAD, &dev_num)) {
- if (dev_num >= MAX_HCAS * MAX_HCA_PORTS) {
+ if (dev_num >= MAX_PORTS) {
fprintf(stderr, "Invalid Path: %s\n", path);
goto exit;
}