solaris_compatibility.c revision 736
/*
*
* 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 from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* provided with the distribution.
*
* 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.
*/
#if HAVE_CONFIG_H
#include <config.h>
#endif /* HAVE_CONFIG_H */
/*
* OFED Solaris wrapper
*/
#include <stdarg.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/processor.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <alloca.h>
#include "../include/infiniband/arch.h"
#include "../include/infiniband/verbs.h"
#include <errno.h>
#include <pthread.h>
#include <kstat.h>
/*
* The followings will be removed when changes in sol_uverbs_ioctl.h
* are delivered through ON.
*/
typedef struct sol_uverbs_pkey_s {
typedef struct sol_uverbs_gid_s {
#endif /* !defined(UVERBS_IOCTL_NO_CMDS) || (UVERBS_IOCTL_NO_CMDS < 3) */
/* end of sol_uverbs_ioctl.h contents */
/*
* duplicate ABI definitions for HCAs as the HCA abi headers are not
* installed in proto.
*/
#define MLX4 0
#define MAX_HCAS 16
#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"
#define IB_HCA_DEVPATH_PREFIX "/dev/infiniband/hca"
#define IB_OFS_DEVPATH_PREFIX "/dev/infiniband/ofs"
#define CONNECTX_NAME "mlx4_"
#define MELLANOX_VENDOR_ID 0x15b3
#define PCI_DEVICE_ID_MELLANOX_HERMON_SDR 0x6340
#define PCI_DEVICE_ID_MELLANOX_HERMON_DDR 0x634a
#define PCI_DEVICE_ID_MELLANOX_HERMON_QDR 0x6354
#define PCI_DEVICE_ID_MELLANOX_HERMON_DDR_PCIE2 0x6732
#define PCI_DEVICE_ID_MELLANOX_HERMON_QDR_PCIE2 0x673c
#define INFINIHOST_DEVICE_ID_2 0x5a45
#define INFINIHOST_DEVICE_ID_4 0x6279
/*
* sol_uverbs_drv_status is the status of what libibverbs knows
* about the status of sol_uverbs driver.
*/
#define SOL_UVERBS_DRV_STATUS_UNKNOWN 0x0
#define SOL_UVERBS_DRV_STATUS_LOADED 0x1
#define SOL_UVERBS_DRV_STATUS_UNLOADED 0x02
static int sol_uverbs_drv_status = SOL_UVERBS_DRV_STATUS_UNKNOWN;
static int sol_uverbs_minor_dev = -1;
/*
* check_path() prefixs
*/
typedef enum cp_prefix_e {
CP_SOL_UVERBS = 1,
CP_DEVICE = 2,
CP_D = 3,
CP_GIDS = 4,
CP_PKEYS = 5,
CP_MLX4 = 6,
CP_PORTS = 7,
CP_UMAD = 8,
CP_SLASH = 9,
CP_SYS = 10,
CP_CLASS = 11,
CP_INFINIBAND_VERBS = 12,
CP_INFINIBAND = 13,
CP_INFINIBAND_MAD = 14,
CP_MISC = 15,
CP_RDMA_CM = 16
} cp_prefix_t;
/*
* Some temporary cache code, until things are cleaned up as part of DR
* work. This will speed up the sysfs emulation.
*/
typedef struct ibdev_cache_info_s {
char ibd_node_guid_str[20];
char ibd_sys_image_guid[20];
char ibd_fw_ver[16];
char ibd_name[8];
int ibd_boardid_index;
/* hermon - hence 2 */
typedef struct uverbs_cache_info_s {
int uvc_hca_instance;
char uvc_ibdev_name[8];
char uvc_ibdev_hca_path[MAXPATHLEN];
static int uverbs_abi_version = -1;
typedef struct umad_cache_info_s {
int umc_port;
char umc_ib_dev[16];
static int umad_abi_version = -1;
/*
* Structure to hold the part number & PSID for an HCA card
* This is a sub-set of the file :
*/
typedef struct mlx_mdr_s {
char *mlx_pn;
char *mlx_psid;
} mlx_mdr_t;
/*
* Part Number / PSID / String ID
*/
/* For failure case, use unknown as "board-id" */
{ "unknown", "unknown" },
/* Part No PSID */
{ "375-3605-01", "SUN0160000001" },
{ "375-3382-01", "SUN0030000001" },
{ "375-3481-01", "SUN0040000001" },
{ "375-3418-01", "SUN0040000001" },
{ "375-3259-01", "SUN0010000001" },
{ "375-3259-03", "SUN0010000001" },
{ "X1289A-Z", "SUN0010010001" },
{ "375-3548-01", "SUN0060000001" },
{ "375-3549-01", "SUN0070000001" },
{ "375-3549-01", "SUN0070130001" },
{ "375-3481-01", "SUN0050000001" },
{ "375-3439-01", "SUN0051000001" },
{ "375-3260-03", "SUN0020000001" },
{ "375-3605-01", "SUN0160000002" },
{ "375-3697-01", "SUN0160000002" },
{ "375-3606-01", "SUN0150000001" },
{ "375-3606-02", "SUN0150000009" },
{ "375-3606-03", "SUN0150000009" },
{ "375-3606-02", "SUN0170000009" },
{ "375-3696-01", "SUN0170000009" },
{ "375-3551-05", "SUN0080000001" },
{ "MHEA28-XS", "MT_0250000001" },
{ "MHEA28-XSC", "MT_0390110001" },
{ "MHEA28-XT", "MT_0150000001" },
{ "MHEA28-XTC", "MT_0370110001" },
{ "MHGA28-XT", "MT_0150000002" },
{ "MHGA28-XTC", "MT_0370110002" },
{ "MHGA28-XTC", "MT_0370130002" },
{ "MHGA28-XS", "MT_0250000002" },
{ "MHGA28-XSC", "MT_0390110002" },
{ "MHGA28-XSC", "MT_0390130002" },
{ "MHEL-CF128", "MT_0190000001" },
{ "MHEL-CF128-T", "MT_00A0000001" },
{ "MTLP25208-CF128T", "MT_00A0000001" },
{ "MHEL-CF128-TC", "MT_00A0010001" },
{ "MHEL-CF128-TC", "MT_0140010001" },
{ "MHEL-CF128-SC", "MT_0190010001" },
{ "MHEA28-1TC", "MT_02F0110001" },
{ "MHEA28-1SC", "MT_0330110001" },
{ "MHGA28-1T", "MT_0200000001" },
{ "MHGA28-1TC", "MT_02F0110002" },
{ "MHGA28-1SC", "MT_0330110002" },
{ "MHGA28-1S", "MT_0430000001" },
{ "MHEL-CF256-T", "MT_00B0000001" },
{ "MTLP25208-CF256T", "MT_00B0000001" },
{ "MHEL-CF256-TC", "MT_00B0010001" },
{ "MHEA28-2TC", "MT_0300110001" },
{ "MHEA28-2SC", "MT_0340110001" },
{ "MHGA28-2T", "MT_0210000001" },
{ "MHGA28-2TC", "MT_0300110002" },
{ "MHGA28-2SC", "MT_0340110002" },
{ "MHEL-CF512-T", "MT_00C0000001" },
{ "MTLP25208-CF512T", "MT_00C0000001" },
{ "MHGA28-5T", "MT_0220000001" },
{ "MHES14-XSC", "MT_0410110001" },
{ "MHES14-XT", "MT_01F0000001" },
{ "MHES14-XTC", "MT_03F0110001" },
{ "MHES18-XS", "MT_0260000001" },
{ "MHES18-XS", "MT_0260010001" },
{ "MHES18-XSC", "MT_03D0110001" },
{ "MHES18-XSC", "MT_03D0120001" },
{ "MHES18-XSC", "MT_03D0130001" },
{ "MHES18-XT", "MT_0230000002" },
{ "MHES18-XT", "MT_0230010002" },
{ "MHES18-XTC", "MT_03B0110001" },
{ "MHES18-XTC", "MT_03B0120001" },
{ "MHES18-XTC", "MT_03B0140001" },
{ "MHGS18-XS", "MT_0260000002" },
{ "MHGS18-XSC", "MT_03D0110002" },
{ "MHGS18-XSC", "MT_03D0120002" },
{ "MHGS18-XSC", "MT_03D0130002" },
{ "MHGS18-XT", "MT_0230000001" },
{ "MHGS18-XTC", "MT_03B0110002" },
{ "MHGS18-XTC", "MT_03B0120002" },
{ "MHGS18-XTC", "MT_03B0140002" },
{ "MHXL-CF128", "MT_0180000001" },
{ "MHXL-CF128-T", "MT_0030000001" },
{ "MTLP23108-CF128T", "MT_0030000001" },
{ "MHET2X-1SC", "MT_0280110001" },
{ "MHET2X-1SC", "MT_0280120001" },
{ "MHET2X-1TC", "MT_0270110001" },
{ "MHET2X-1TC", "MT_0270120001" },
{ "MHXL-CF256-T", "MT_0040000001" },
{ "MHET2X-2SC", "MT_02D0110001" },
{ "MHET2X-2SC", "MT_02D0120001" },
{ "MHET2X-2TC", "MT_02B0110001" },
{ "MHET2X-2TC", "MT_02B0120001" },
{ "MHX-CE128-T", "MT_0000000001" },
{ "MTPB23108-CE128", "MT_0000000001" },
{ "MHX-CE256-T", "MT_0010000001" },
{ "MTPB23108-CE256", "MT_0010000001" },
{ "MHX-CE512-T", "MT_0050000001" },
{ "MTPB23108-CE512", "MT_0050000001" },
{ "MHEH28-XSC", "MT_04C0110001" },
{ "MHEH28-XSC", "MT_04C0130005" },
{ "MHEH28-XTC", "MT_04A0110001" },
{ "MHEH28-XTC", "MT_04A0130005" },
{ "MHGH28-XSC", "MT_04C0110002" },
{ "MHGH28-XSC", "MT_04C0120002" },
{ "MHGH28-XSC", "MT_04C0140005" },
{ "MHGH28-XTC", "MT_04A0110002" },
{ "MHGH28-XTC", "MT_04A0120002" },
{ "MHGH28-XTC", "MT_04A0140005" },
{ "MHGH29-XSC", "MT_0A60110002" },
{ "MHGH29-XSC", "MT_0A60120005" },
{ "MHGH29-XTC", "MT_0A50110002" },
{ "MHGH29-XTC", "MT_0A50120005" },
{ "MHJH29-XTC", "MT_04E0110003" },
{ "MHJH29-XSC", "MT_0500120005" },
{ "MHQH29-XTC", "MT_04E0120005" },
{ "MHQH19-XTC", "MT_0C40110009" },
{ "MHQH29-XTC", "MT_0BB0110003" },
{ "MHQH29-XTC", "MT_0BB0120003" },
{ "MHEH28B-XSR", "MT_0D10110001" },
{ "MHEH28B-XTR", "MT_0D20110001" },
{ "MHGH28B-XSR", "MT_0D10110002" },
{ "MHGH28B-XTR", "MT_0D20110002" },
{ "MHGH18B-XTR", "MT_0D30110002" },
{ "MNEH28B-XSR", "MT_0D40110004" },
{ "MNEH28B-XTR", "MT_0D50110004" },
{ "MNEH29B-XSR", "MT_0D40110010" },
{ "MNEH29B-XTR", "MT_0D50110010" },
{ "MHGH29B-XSR", "MT_0D10110008" },
{ "MHGH29B-XTR", "MT_0D20110008" },
{ "MHJH29B-XSR", "MT_0D10110009" },
{ "MHJH29B-XSR", "MT_0D10120009" },
{ "MHJH29B-XTR", "MT_0D20110009" },
{ "MHJH29B-XTR", "MT_0D20120009" },
{ "MHGH19B-XSR", "MT_0D60110008" },
{ "MHGH19B-XTR", "MT_0D30110008" },
{ "MHJH19B-XTR", "MT_0D30110009" },
{ "MHQH29B-XSR", "MT_0D70110009" },
{ "MHQH29B-XTR", "MT_0D80110009" },
{ "MHQH29B-XTR", "MT_0D80120009" },
{ "MHQH29B-XTR", "MT_0D80130009" },
{ "MHQH29B-XTR", "MT_0E30110009" },
{ "MHRH29B-XSR", "MT_0D70110008" },
{ "MHRH29B-XTR", "MT_0D80110008" },
{ "MHQH19B-XTR", "MT_0D90110009" },
{ "MHRH19B-XSR", "MT_0E40110009" },
{ "MHRH19B-XTR", "MT_0D90110008" },
{ "MNPH28C-XSR", "MT_0DA0110004" },
{ "MNPH28C-XTR", "MT_0DB0110004" },
{ "MNPH29C-XSR", "MT_0DA0110010" },
{ "MNPH29C-XTR", "MT_0DB0110010" },
{ "MNPH29C-XTR", "MT_0DB0120010" },
{ "MNPH29C-XTR", "MT_0DB0130010" },
{ "MNZH29-XSR", "MT_0DC0110009" },
{ "MNZH29-XTR", "MT_0DD0110009" },
{ "MNZH29-XTR", "MT_0DD0120009" },
{ "MHQH19B-XNR", "MT_0DF0110009" },
{ "MHQH19B-XNR", "MT_0DF0120009" },
{ "MNQH19-XTR", "MT_0D80110017" },
{ "MNQH19C-XTR", "MT_0E20110017" },
{ "MHZH29B-XSR", "MT_0E80110009" },
{ "MHZH29B-XTR", "MT_0E90110009" },
{ "MHZH29B-XTR", "MT_0E90110009" },
{ "MHQA19-XTR", "MT_0EA0110009" },
{ "MHRA19-XTR", "MT_0EB0110008" },
{ "MHQH29C-XTR", "MT_0EF0110009" },
{ "MHQH29C-XSR", "MT_0F00110009" },
{ "MHRH29C-XTR", "MT_0F10110008" },
{ "MHRH29C-XSR", "MT_0F20110008" },
{ "MHPH29D-XTR", "MT_0F30110010" },
{ "MHPH29D-XSR", "MT_0F40110010" },
{ "MNPA19-XTR", "MT_0F60110010" },
{ "MNPA19-XSR", "MT_0F70110010" },
/* Ethernet cards */
{ "MNEH28B-XTR", "MT_0D50110004" },
{ "MNEH29B-XSR", "MT_0D40110010" },
{ "MNEH29B-XTR", "MT_0D50110010" },
{ "MNPH28C-XSR", "MT_0DA0110004" },
{ "MNPH28C-XTR", "MT_0DB0110004" },
{ "MNPH29C-XSR", "MT_0DA0110010" },
{ "MNPH29C-XTR", "MT_0DB0110010" },
{ "X6275 M2 10GbE", "X6275M2_10G" }
};
/* Get mlx_mdr[] array size */
#define MLX_SZ_MLX_MDR sizeof (mlx_mdr)
#define MLX_SZ_MLX_MDR_STRUCT sizeof (mlx_mdr[0])
static int umad_cache_cnt = 0;
static int ibdev_cache_cnt = 0;
static int uverbs_cache_cnt = 0;
void
solaris_init(void)
{
else
}
}
void
solaris_fini(void)
{
(void) kstat_close(kc);
}
static int
{
return (1);
}
return (0);
}
static int
{
return (1);
}
sizeof (ibdev_cache_info_t));
} else {
return (1);
}
return (0);
}
static int
{
return (1);
}
sizeof (uverbs_cache_info_t));
return (0);
}
static int
{
struct ibv_device_attr device_attr;
const char *p, *ibdev;
if (!dev_list) {
goto error_exit1;
}
*dev_list);
goto error_exit2;
}
goto error_exit3;
}
(unsigned)(guid >> 0) & 0xffff);
(unsigned)(guid >> 0) & 0xffff);
dev_num);
goto error_exit3;
}
}
ret = 0;
/* clean up and Return */
if (ctx)
if (root_dev_list)
return (ret);
}
static int
{
char uverbs_devpath[MAXPATHLEN];
char *buf;
/*
* using the first sol_uverbs minor node that can be opened to get
* all the HCA information
*/
goto error_exit1;
}
goto error_exit2;
}
"IB_USER_VERBS_SOLARIS_ABI_VERSION : %d\n",
goto error_exit2;
}
if (uverbs_abi_version == -1)
sizeof (info.uvc_ibdev_hca_path),
"%s/%s%d", IB_HCA_DEVPATH_PREFIX,
else {
goto error_exit2;
}
"cache\n", dev_num);
goto error_exit2;
}
}
return (1);
return (0);
}
static int
{
int save_errno = 0;
minor);
break;
save_errno = errno;
}
if (! save_errno)
save_errno = errno;
return (0);
}
bufsize = sizeof (sol_umad_ioctl_info_t) +
goto error_exit;
}
if (umad_infop->umad_solaris_abi_version !=
"IB_USER_MAD_SOLARIS_ABI_VERSION : %d\n",
goto error_exit;
}
/*
* set port_cnt to the number of total ports for all HCAs returned
*/
if (umad_abi_version == -1)
for (i = 0; i < port_cnt; i++, port_infop++) {
goto error_exit;
}
}
return (1);
return (0);
}
void
initialize(void)
{
char uverbs_devpath[MAXPATHLEN];
/*
* find the first sol_uverbs minor node that can be opened successfully
* and set sol_uverbs_mino_dev to that minor no.
*/
minor);
continue;
} else {
break;
}
}
/*
* All minor nodes failed to open, so set sol_uverbs_drv_status to
* SOL_UVERBS_DRV_STATUS_UNLOADED to reflect that
*/
return;
}
memset(&umad_dev_cache, 0,
}
/*
* Some sysfs emulation software
*/
/*
* Check whether a path starts with prefix, and if it does, remove it
* from the string. The prefix can also contain one %d scan argument.
*/
static int
{
switch (prefix) {
case CP_SOL_UVERBS:
&pos);
break;
case CP_DEVICE:
break;
case CP_D:
break;
case CP_GIDS:
break;
case CP_PKEYS:
break;
case CP_MLX4:
break;
case CP_PORTS:
break;
case CP_UMAD:
break;
case CP_SLASH:
break;
case CP_SYS:
break;
case CP_CLASS:
break;
case CP_INFINIBAND_VERBS:
break;
case CP_INFINIBAND:
break;
case CP_INFINIBAND_MAD:
break;
case CP_MISC:
break;
case CP_RDMA_CM:
break;
default:
/* Unkown prefix */
return (0);
}
/* Some requests have several consecutive slashes. */
pos ++;
return (1);
}
return (0);
}
static ibdev_cache_info_t *
get_device_info(const char *devname)
{
const char *p = devname;
int dev_num;
if (pthread_mutex_lock(&ibdev_cache_mutex) != 0) {
return (NULL);
}
if (!ibdev_cache_initialized) {
if (ibdev_cache_init()) {
(void) pthread_mutex_unlock(&ibdev_cache_mutex);
return (NULL);
} else {
}
}
(void) pthread_mutex_unlock(&ibdev_cache_mutex);
p = p+(strlen(p)-1);
return (NULL);
}
else
} else {
"device: %s\n", devname);
}
return (info);
}
/*
* If the address of a gid pointer is passed for "gid_table", the memory
* will be allocated and the ports gid table and returned as well. The caller
* must free this memory on successful completion. If the address of a
* pkey pointer is passed for "pkey_table", the memory will be allocated
* and the ports pkey table returned as well. The caller must free this
* memory on successful completion.
*/
static int
{
if (!dev_list) {
goto error_exit1;
}
break;
}
}
if (i == num_dev) {
goto error_exit2;
}
goto error_exit2;
}
goto error_exit3;
}
if (gid_table) {
if (!gids)
goto error_exit3;
/*
* set high bit of port_num to get all gids in one shot.
*/
port_num |= 0x80;
gids);
if (rv != 0)
goto error_exit4;
}
if (pkey_table) {
*pkey_table = NULL;
if (!pkeys)
goto error_exit4;
/*
* set high bit of port_num to get all pkeys in one shot.
*/
port_num |= 0x80;
pkeys);
if (rv != 0)
goto error_exit5;
*pkey_table = pkeys;
}
ret = 0;
/*
* clean up and Return
*/
if (pkeys)
if (gids)
if (ctx)
if (root_dev_list)
return (ret);
}
/*
* In Solaris environments, the underlying hardware driver is opened to
* perform the memory mapping operations of kernel allocated memory
* into the users address space.
*/
int
ibv_open_mmap_driver(char *dev_name)
{
int fd;
#ifndef _LP64
int tmpfd;
#endif
int uverbs_indx;
/*
* Map the user verbs device (uverbs) to the associated
* hca device.
*/
NULL, 0);
if (uverbs_indx >= MAX_HCAS) {
goto err_dev;
}
goto err_dev;
}
if (fd < 0) {
goto err_dev;
}
#ifndef _LP64
/*
* libc can't handle fd's greater than 255, in order to
* ensure that these values remain available make fd > 255.
* Note: not needed for LP64
*/
if (tmpfd >= 0) {
}
#endif /* _LP64 */
goto err_close;
}
return (fd);
return (-1);
}
static int
{
unsigned int device_num;
int len = -1;
if (pthread_mutex_lock(&uverbs_cache_mutex) != 0) {
goto exit;
}
if (!uverbs_cache_initialized) {
if (uverbs_cache_init())
else
goto exit;
}
(void) pthread_mutex_unlock(&uverbs_cache_mutex);
if (device_num >= MAX_HCAS) {
goto exit;
}
goto exit;
}
/*
* Under Linux, this is a link to the PCI device entry
*/
}
}
if (uverbs_abi_version == -1) {
goto exit;
}
} else {
}
exit:
return (len);
}
static int
{
int len = -1;
unsigned int port_num;
unsigned int gid_num;
unsigned int pkey_num;
struct ibv_port_attr port_attr;
float rate;
goto exit;
goto exit;
"%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x",
(unsigned)(subnet_prefix >> 0) & 0xffff,
(unsigned)(interface_id >> 0) & 0xffff);
}
if (gids)
goto exit;
if (pkeys)
} else {
goto exit;
case IBV_PORT_NOP:
break;
case IBV_PORT_DOWN:
break;
case IBV_PORT_INIT:
break;
case IBV_PORT_ARMED:
break;
case IBV_PORT_ACTIVE:
break;
case IBV_PORT_ACTIVE_DEFER:
"%d: ACTIVE_DEFER",
break;
default:
break;
}
switch (port_attr.phys_state) {
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
"%d: PortConfigurationTraining",
break;
case 5:
break;
case 6:
"%d: LinkErrorRecovery",
break;
case 7:
"%d: Phy Test",
break;
default:
break;
}
/* rate = speed * width */
switch (port_attr.active_speed) {
case 1:
rate = 2.5;
break;
case 2:
rate = 5;
break;
case 4:
rate = 10;
break;
default:
rate = 0;
}
switch (port_attr.active_width) {
case 1:
break;
case 2:
break;
case 4:
break;
case 8:
break;
default:
rate = 0;
}
}
}
exit:
return (len);
}
/*
* This function passes the HW Part number string obtained from driver
* IOCTL. The memory for "hca_hwpn" argument has to be passed by the
* caller and has to be at least 64 bytes in size.
*/
static int
{
int rc;
&hermon_flash_info)) != 0)
return (rc);
} else {
"device: %s\n", ibd_name);
return (1);
}
return (0);
}
static void
{
int i;
int fd;
char hca_hwpn[64];
char *hwpnp;
if (pthread_mutex_lock(&uverbs_cache_mutex) != 0) {
"uverbs_cache_mutex %s\n",
goto boardid_err;
}
if (!uverbs_cache_initialized) {
}
(void) pthread_mutex_unlock(&uverbs_cache_mutex);
for (i = 0; i < MAX_HCAS; i++) {
if (uverbs_dev_cache[i].uvc_valid &&
break;
}
}
if (i == MAX_HCAS) {
goto boardid_err;
}
if (fd < 0) {
goto boardid_err;
}
goto boardid_err;
}
*hwpnp = '\0';
/*
* Find part number, set the boardid_index,
* Skip index 0, as it is for failure "unknown"
* case.
*/
for (i = 1; i < MLX_MAX_ID; i++) {
/* Set boardid_index */
ibd_info->ibd_boardid_index = i;
return;
}
}
/* Failure case, default to "unknown" */
ibd_info->ibd_boardid_index = 0;
}
static int
{
int len = -1;
unsigned int device_num;
char dev_name[10];
} else {
goto exit;
}
} else {
goto exit;
else
}
}
exit:
return (len);
}
static int
{
int len = -1;
unsigned int dev_num;
if (pthread_mutex_lock(&umad_cache_mutex) != 0) {
goto exit;
}
if (!umad_cache_initialized) {
if (umad_cache_init())
else
goto exit;
}
(void) pthread_mutex_unlock(&umad_cache_mutex);
goto exit;
}
goto exit;
}
size) + 1;
}
if (umad_abi_version == -1) {
goto exit;
}
len =
}
exit:
return (len);
}
/*
* Return -1 on error, or the length of the data (buf) on success.
*/
int
{
int len = -1;
if (!initialized) {
goto exit;
}
if (!initialized)
/*
* There was a problem in initialize()
*/
goto exit;
}
goto exit;
goto exit;
goto exit;
}
}
}
exit:
return (len);
}
int
{
if (ncpus <= 0)
return (0);
return (-1);
for (i = 0; i < ncpus; i++) {
if (i >= ncpus)
goto err_exit;
else
continue;
}
if (i >= ncpus)
goto err_exit;
else
continue;
}
== NULL) {
if (i >= ncpus)
goto err_exit;
else
continue;
}
== NULL) {
if (i >= ncpus)
goto err_exit;
else
continue;
}
info[i].cpu_number = i;
}
return (ncpus);
return (-1);
}
int
{
/* Aggregate the value of all CPUs */
for (i = 0; i < nr_cpus; i++) {
/*
* In case of some cpu_id doesn't have kstat info.,
* skip it and continue if it isn't the last one.
*/
if (i >= nr_cpus)
return (-1);
else
continue;
}
if (i >= nr_cpus)
return (-1);
else
continue;
}
if ((knp = (kstat_named_t *)
if (i >= nr_cpus)
return (-1);
else
continue;
}
if ((knp = (kstat_named_t *)
return (-1);
else
continue;
}
if ((knp = (kstat_named_t *)
if (i >= nr_cpus)
return (-1);
else
continue;
}
if ((knp = (kstat_named_t *)
if (i >= nr_cpus)
return (-1);
else
continue;
}
if ((knp = (kstat_named_t *)
if (i >= nr_cpus)
return (-1);
else
continue;
}
}
return (0);
}
int
{
char uverbs_devpath[MAXPATHLEN];
int uverbs_fd;
/*
* Not exported via sysfs, use ioctl.
*/
return (-1);
return (-1);
if (port_num & 0x80) {
start = 0;
} else {
count = 1;
}
sizeof (union ibv_gid) + sizeof (sol_uverbs_gid_t));
if (uverbs_gidp == NULL) {
return (-1);
}
#ifdef DEBUG
#endif
goto gid_error_exit;
}
#ifdef DEBUG
"IB_USER_VERBS_SOLARIS_ABI_VERSION : %d\n",
#endif
goto gid_error_exit;
}
return (0);
return (-1);
}
int
{
char uverbs_devpath[MAXPATHLEN];
int uverbs_fd;
/*
* Not exported via sysfs, use ioctl.
*/
return (-1);
return (-1);
if (port_num & 0x80) {
start = 0;
} else {
count = 1;
}
sizeof (uint16_t) + sizeof (sol_uverbs_pkey_t));
if (uverbs_pkeyp == NULL) {
return (-1);
}
#ifdef DEBUG
#endif
goto pkey_error_exit;
}
#ifdef DEBUG
"IB_USER_VERBS_SOLARIS_ABI_VERSION : %d\n",
#endif
goto pkey_error_exit;
}
return (0);
return (-1);
}
#endif