ibti_common.h revision 43ed929a6988c3778f00123f4a4a8541e515ec16
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER START
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The contents of this file are subject to the terms of the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Common Development and Distribution License, Version 1.0 only
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (the "License"). You may not use this file except in compliance
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * with the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * or http://www.opensolaris.org/os/licensing.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * See the License for the specific language governing permissions
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * and limitations under the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When distributing Covered Code, include this CDDL HEADER in each
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * If applicable, add the following below this CDDL HEADER, with the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * fields enclosed by brackets "[]" replaced with your own identifying
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * information: Portions Copyright [yyyy] [name of copyright owner]
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER END
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * Use is subject to license terms.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#ifndef _SYS_IB_IBTL_IBTI_COMMON_H
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define _SYS_IB_IBTL_IBTI_COMMON_H
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#pragma ident "%Z%%M% %I% %E% SMI"
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibti_common.h
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * This file contains the shared/common transport data types and function
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * prototypes.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi#include <sys/ib/ibtl/ibtl_types.h>
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#include <sys/ib/ibtl/ibti_cm.h>
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#include <sys/isa_defs.h>
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#include <sys/byteorder.h>
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi#ifdef __cplusplus
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern "C" {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#endif
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Endian Macros
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * h2b - host endian to big endian protocol
940d71d237794874e18a0eb72f6564821a823517eschrock * b2h - big endian protocol to host endian
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * h2l - host endian to little endian protocol
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * l2h - little endian protocol to host endian
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi#if defined(_LITTLE_ENDIAN)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define h2b16(x) (htons(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define h2b32(x) (htonl(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define h2b64(x) (ddi_swap64(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define b2h16(x) (ntohs(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define b2h32(x) (ntohl(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define b2h64(x) (ddi_swap64(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define h2l16(x) (x)
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define h2l32(x) (x)
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define h2l64(x) (x)
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define l2h16(x) (x)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define l2h32(x) (x)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define l2h64(x) (x)
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#elif defined(_BIG_ENDIAN)
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define h2b16(x) (x)
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define h2b32(x) (x)
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define h2b64(x) (x)
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define b2h16(x) (x)
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define b2h32(x) (x)
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define b2h64(x) (x)
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define h2l16(x) (ddi_swap16(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define h2l32(x) (ddi_swap32(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define h2l64(x) (ddi_swap64(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define l2h16(x) (ddi_swap16(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define l2h32(x) (ddi_swap32(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define l2h64(x) (ddi_swap64(x))
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#else
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#error "what endian is this machine?"
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#endif
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Max number of paths that can be requested in an ibt_get_paths() call,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * if IBT_PATH_PERF or IBT_PATH_AVAIL flag (ibt_path_flags_t) is set.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define IBT_MAX_SPECIAL_PATHS 2
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * The name of DDI Event, generated when the properties of IOC device
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * node properties were modified.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define IB_PROP_UPDATE_EVENT "SUNW,IB:IB_PROP_UPDATE"
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/* Transport Interface version */
c40d7343efa60b18ad1ceb316eb337caeea79046cinditypedef enum ibt_version_e {
c40d7343efa60b18ad1ceb316eb337caeea79046cindi IBTI_V1 = 1,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj IBTI_V2 = 2 /* FMR Support */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj} ibt_version_t;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Driver class type. Identifies a type of client driver so that
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * "IBTF Policy" decisions can be made on a driver class basis.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * The last class should always be IBT_CLNT_NUM, and any new classes added
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * must be defined before IBT_CLNT_NUM. The class values must be above 0.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Any class values below or equal to 0 shall be invalid
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditypedef enum ibt_clnt_class_e {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_STORAGE_DEV = 0x1, /* SCSI, FC, etc.. */
908f1e1388f616898b4e515d343c0414f2a6472esd IBT_NETWORK_DEV, /* Network driver with associated client H/W */
184cd04c26b064536977dfbb913a1240eaf6f708cth IBT_GENERIC_DEV, /* Generic client H/W device driver */
908f1e1388f616898b4e515d343c0414f2a6472esd IBT_NETWORK, /* Network driver with no associated */
14ea4bb737263733ad80a36b4f73f681c30a6b45sd /* client H/W, e.g., IPoIB */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_GENERIC, /* A generic IB driver not */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi /* associated with client H/W */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_USER, /* A user application IBT interface driver */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_IBMA, /* The IBMA Module */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CM, /* The CM Module */
908f1e1388f616898b4e515d343c0414f2a6472esd IBT_DM, /* The DM Module */
940d71d237794874e18a0eb72f6564821a823517eschrock IBT_CLASS_NUM /* Place holder for class count */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi} ibt_clnt_class_t;
13faa91230bde46da937bf33010b9accc5bdeb59sd
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi#define IBT_TEST_DEV 999 /* Place holder for modules that test IBTL */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
908f1e1388f616898b4e515d343c0414f2a6472esd#define IBT_CLNT_DEVICE_CLASS(class) ((class) == IBT_STORAGE_DEV || \
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (class) == IBT_NETWORK_DEV || \
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj (class) == IBT_GENERIC_DEV)
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi#define IBT_CLNT_GENERAL_CLASS(class) ((class) == IBT_NETWORK || \
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (class) == IBT_GENERIC || \
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (class) == IBT_USER)
13faa91230bde46da937bf33010b9accc5bdeb59sd
908f1e1388f616898b4e515d343c0414f2a6472esd#define IBT_CLNT_MGMT_CLASS(class) ((class) == IBT_IBMA || \
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (class) == IBT_CM || \
908f1e1388f616898b4e515d343c0414f2a6472esd (class) == IBT_DM || \
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (class) == IBT_TEST_DEV)
14ea4bb737263733ad80a36b4f73f681c30a6b45sd/*
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * Event record & status returns for asynchronous events and errors.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditypedef struct ibt_async_event_s {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi uint64_t ev_fma_ena; /* FMA Error data */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_channel_hdl_t ev_chan_hdl; /* Channel handle */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_cq_hdl_t ev_cq_hdl; /* CQ handle */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ib_guid_t ev_hca_guid; /* HCA node GUID */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi uint8_t ev_port; /* HCA port */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_srq_hdl_t ev_srq_hdl; /* SRQ handle */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi} ibt_async_event_t;
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * IBT Client Callback function typedefs.
908f1e1388f616898b4e515d343c0414f2a6472esd *
908f1e1388f616898b4e515d343c0414f2a6472esd * ibt_async_handler_t
940d71d237794874e18a0eb72f6564821a823517eschrock * Pointer to an async event/error handler function. This function is
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * called when an async event/error is detected on a HCA that is being
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * used by the IBT client driver that registered the function.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd */
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditypedef void (*ibt_async_handler_t)(void *clnt_private,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_hca_hdl_t hca_hdl, ibt_async_code_t code, ibt_async_event_t *event);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * IBT Client Memory Error Callback function typedefs.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_memory_handler_t
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Pointer to an memory event/error handler function.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef void (*ibt_memory_handler_t)(void *clnt_private,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_hca_hdl_t hca_hdl, ibt_mem_code_t code, ibt_mem_data_t *data);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Define a client module information structure. All clients MUST
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * define a global of type ibt_clnt_modinfo_t. A pointer to this global
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * is passed into the IBTF by a client when calling ibt_attach().
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * This struct must persist during the life of the client.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi *
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * The client's mi_async_handler is called when an async event/error is
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * detected on a HCA that is being used by this client.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditypedef struct ibt_clnt_modinfo_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_version_t mi_ibt_version; /* TI version */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_clnt_class_t mi_clnt_class; /* Type of client */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_async_handler_t mi_async_handler; /* Async Handler */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_memory_handler_t mi_reserved; /* Memory handler */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi char *mi_clnt_name; /* Client Name. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_clnt_modinfo_t;
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Definitions for use with ibt_register_subnet_notices()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditypedef enum ibt_subnet_event_code_e {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SM_EVENT_MCG_CREATED = 1,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SM_EVENT_MCG_DELETED = 2,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SM_EVENT_AVAILABLE = 3,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SM_EVENT_UNAVAILABLE = 4,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SM_EVENT_GID_AVAIL = 5,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SM_EVENT_GID_UNAVAIL = 6
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi} ibt_subnet_event_code_t;
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditypedef struct ibt_subnet_event_s {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ib_gid_t sm_notice_gid;
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi} ibt_subnet_event_t;
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditypedef void (*ibt_sm_notice_handler_t)(void *private, ib_gid_t gid,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_subnet_event_code_t code, ibt_subnet_event_t *event);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * MTU Request type.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditypedef struct ibt_mtu_req_s {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ib_mtu_t r_mtu; /* Requested MTU */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_selector_t r_selector; /* Qualifier for r_mtu */
9dd0f810214fdc8e1af881a9a5c4b6927629ff9ecindi} ibt_mtu_req_t;
9dd0f810214fdc8e1af881a9a5c4b6927629ff9ecindi
9dd0f810214fdc8e1af881a9a5c4b6927629ff9ecindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Qflags, used by ibt_resize_queues().
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditypedef enum ibt_qflags_e {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SEND_Q = 1 << 0, /* Op applies to the Send Q */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_RECV_Q = 1 << 1 /* Op applies to the Recv Q */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi} ibt_qflags_t;
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj/*
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj * CQ priorities
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * The IBTF will attempt to implement a coarse 3 level priority scheme
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * (IBT_CQ_LOW, IBT_CQ_MEDIUM, IBT_CQ_HIGH) based on the class of client
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * driver. The requested priority is not guaranteed. If a CI implementation
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * has the ability to implement priority CQs, then the IBTF will take advantage
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * of that when calling the CI to create a CQ by passing a priority indicator
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * to the CI.
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj */
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robjtypedef enum ibt_cq_priority_e {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_DEFAULT = 0x0,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_LOW = 0x1,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_MEDIUM = 0x2,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_HIGH = 0x3,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_1 = 0x4,
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj IBT_CQ_OPAQUE_2 = 0x5,
2eeaed14a5e2ed9bd811643ad5bffc3510ca0310robj IBT_CQ_OPAQUE_3 = 0x6,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_4 = 0x7,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_5 = 0x8,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_6 = 0x9,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_7 = 0xA,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_8 = 0xB,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_9 = 0xC,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_10 = 0xD,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_11 = 0xE,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_12 = 0xF,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_13 = 0x10,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_14 = 0x11,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_15 = 0x12,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_CQ_OPAQUE_16 = 0x13
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi} ibt_cq_priority_t;
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Attributes when creating a Completion Queue Scheduling Handle.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_cq_sched_attr_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cq_sched_flags_t cqs_flags;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cq_priority_t cqs_priority;
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi uint_t cqs_load;
9dd0f810214fdc8e1af881a9a5c4b6927629ff9ecindi ibt_sched_hdl_t cqs_affinity_hdl;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_cq_sched_attr_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_cq_handler_t
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Pointer to a work request completion handler function. This function
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * is called when a WR completes on a CQ that is being used by the IBTF
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * client driver that registered the function.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef void (*ibt_cq_handler_t)(ibt_cq_hdl_t ibt_cq, void *arg);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Service Data and flags.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (IBTA Spec Release 1.1, Vol-1 Ref: 15.2.5.14.4)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The ServiceData8.1 (sb_data8[0]) through ServiceData64.2 (sb_data64[1])
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * components together constitutes a 64-byte area in which any data may be
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * placed. It is intended to be a convenient way for a service to provide its
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * clients with some initial data.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * In addition, this 64-byte area is formally divided into a total of 30
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * components, 16 8-bit (uint8_t) components, then 8 16-bit (uint16_t)
9dd0f810214fdc8e1af881a9a5c4b6927629ff9ecindi * components, then 6 32-bit (uint32_t) components, then 2 64-bit (uint64_t)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * components, thereby assigning ComponentMask bits (ibt_srv_data_flags_t) to
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * variously-sized segments of the data. All data are in host endian format.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * This allows query operations (ibt_get_paths()) to be used which match
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * parts of the Service Data, making it possible, for example, for
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * service-specific parts of the ServiceData to serve as a binary-coded
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * extension to the ServiceName for purposes of lookup.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef enum ibt_srv_data_flags_e {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_NO_SDATA = 0,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SDATA8_0 = (1 << 0),
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SDATA8_1 = (1 << 1),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA8_2 = (1 << 2),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA8_3 = (1 << 3),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA8_4 = (1 << 4),
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SDATA8_5 = (1 << 5),
47911a7d5f24c2fc37e7b5bcc696fe32e750c16ccy IBT_SDATA8_6 = (1 << 6),
47911a7d5f24c2fc37e7b5bcc696fe32e750c16ccy IBT_SDATA8_7 = (1 << 7),
47911a7d5f24c2fc37e7b5bcc696fe32e750c16ccy IBT_SDATA8_8 = (1 << 8),
47911a7d5f24c2fc37e7b5bcc696fe32e750c16ccy IBT_SDATA8_9 = (1 << 9),
47911a7d5f24c2fc37e7b5bcc696fe32e750c16ccy IBT_SDATA8_10 = (1 << 10),
47911a7d5f24c2fc37e7b5bcc696fe32e750c16ccy IBT_SDATA8_11 = (1 << 11),
9dd0f810214fdc8e1af881a9a5c4b6927629ff9ecindi IBT_SDATA8_12 = (1 << 12),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA8_13 = (1 << 13),
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SDATA8_14 = (1 << 14),
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi IBT_SDATA8_15 = (1 << 15),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA16_0 = (1 << 16),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA16_1 = (1 << 17),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA16_2 = (1 << 18),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA16_3 = (1 << 19),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA16_4 = (1 << 20),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA16_5 = (1 << 21),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA16_6 = (1 << 22),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA16_7 = (1 << 23),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA32_0 = (1 << 24),
c40d7343efa60b18ad1ceb316eb337caeea79046cindi IBT_SDATA32_1 = (1 << 25),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA32_2 = (1 << 26),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA32_3 = (1 << 27),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj IBT_SDATA64_0 = (1 << 28),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SDATA64_1 = (1 << 29),
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj IBT_SDATA_ALL = 0x3FFFFFFF
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_srv_data_flags_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_srv_data_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint8_t s_data8[16]; /* 8-bit service data fields. */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi uint16_t s_data16[8]; /* 16-bit service data fields. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint32_t s_data32[4]; /* 32-bit service data fields. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint64_t s_data64[2]; /* 64-bit service data fields. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_srv_data_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Path flags, used in ibt_get_paths()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef enum ibt_path_flags_e {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_PATH_NO_FLAGS = 0,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_PATH_APM = 1 << 0, /* APM is desired. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_PATH_AVAIL = 1 << 2,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_PATH_PERF = 1 << 3,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_PATH_MULTI_SVC_DEST = 1 << 4, /* Multiple ServiceRecords */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_PATH_HOP = 1 << 5, /* pa_hop is specified. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_PATH_PKEY = 1 << 6 /* pa_pkey is specified. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_path_flags_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Path attributes.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * The ibt_path_attr_t structure is used to specify required attributes in a
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * path from the requesting (source) node to a specified destination node.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Attributes that are don't care should be set to NULL or '0'.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * A destination must be specified, where a destination can be defined as
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * one of the following:
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * o Service Name
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * o Service ID (SID)
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * o Array of DGIDs.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * o Service Name and Array of DGIDs.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjtypedef struct ibt_path_attr_s {
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ib_gid_t *pa_dgids; /* Array of DGIDs */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ib_gid_t pa_sgid;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ib_guid_t pa_hca_guid;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj char *pa_sname; /* ASCII Service name */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj /* NULL Terminated */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ib_svc_id_t pa_sid; /* Service ID */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_srv_data_flags_t pa_sd_flags; /* Service Data flags. */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_srv_data_t pa_sdata; /* Service Data */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint8_t pa_hca_port_num;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint8_t pa_num_dgids; /* size of pa_dgids array */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint8_t pa_sl:4;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_mtu_req_t pa_mtu;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_srate_req_t pa_srate;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_pkt_lt_req_t pa_pkt_lt; /* Packet Life Time Request */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint_t pa_flow:20;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint8_t pa_hop; /* IBT_PATH_HOP */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint8_t pa_tclass;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ib_pkey_t pa_pkey; /* IBT_PATH_PKEY */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_path_attr_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Path Information.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * The ibt_get_paths() performs SA Path record lookups to select a path(s) to
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * a given destination(s), details of selected path(s) are returned in this
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * structure.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * The ibt_path_info_t contains all the attributes of the best path(s), as
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * as determined by IBTL, to the specified destination(s), including the
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * local HCA and HCA port to use to access the fabric.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * The Service ID (pi_sid) and Service Data (pi_sdata) are returned only for
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * lookups based on Service ID or/and Service Name.
12cc75c814f0c017004a9bbc96429911e008601bcindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cinditypedef struct ibt_path_info_s {
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_guid_t pi_hca_guid; /* Local HCA GUID; 0 implies */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi /* this record is invalid */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_svc_id_t pi_sid; /* Service ID */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_srv_data_t pi_sdata; /* Service Data */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_cep_path_t pi_prim_cep_path; /* Contains CEP adds info */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_cep_path_t pi_alt_cep_path; /* RC & UC Only, valid if */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi /* cep_hca_port_num is not */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi /* '0' */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_mtu_t pi_path_mtu; /* Common path MTU */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_time_t pi_prim_pkt_lt;
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_time_t pi_alt_pkt_lt;
c40d7343efa60b18ad1ceb316eb337caeea79046cindi} ibt_path_info_t;
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Optional Alternate Path attributes.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The ibt_alt_path_attr_t structure is used to specify additional optional
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * attributes when requesting an alternate path for an existing channel.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Attributes that are don't care should be set to NULL or '0'.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjtypedef struct ibt_alt_path_attr_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_gid_t apa_sgid;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_gid_t apa_dgid;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_srate_req_t apa_srate;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_pkt_lt_req_t apa_pkt_lt; /* Packet Life Time Request */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint_t apa_flow:20;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint8_t apa_sl:4;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint8_t apa_hop;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint8_t apa_tclass;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_alt_path_attr_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Path Information for Alternate Path - input to ibt_set_alt_path().
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_alt_path_info_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cep_path_t ap_alt_cep_path; /* RC & UC Only, valid if */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* cep_hca_port_num is not */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* '0' */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_time_t ap_alt_pkt_lt;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_alt_path_info_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Open Channel flags, Used in ibt_open_rc_channel call
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef enum ibt_chan_open_flags_e {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_OCHAN_NO_FLAGS = 0,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_OCHAN_REDIRECTED = 1 << 0,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_OCHAN_PORT_REDIRECTED = 1 << 1,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_OCHAN_DUP = 1 << 2,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_OCHAN_PORT_FIXED = 1 << 3,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_OCHAN_OPAQUE1 = 1 << 4,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_OCHAN_OPAQUE2 = 1 << 5,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_OCHAN_OPAQUE3 = 1 << 6,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_OCHAN_OPAQUE4 = 1 << 7,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_OCHAN_OPAQUE5 = 1 << 8
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_chan_open_flags_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Arguments for ibt_open_rc_channel().
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * oc_priv_data should be NULL or point to a buffer allocated by the caller,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * the size of which should be in oc_priv_data_len, where oc_priv_data_len <=
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * IBT_REQ_PRIV_DATA_SZ.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When ibt_open_rc_channel returns with ibt_cm_reason_t of
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * IBT_CM_REDIRECT_PORT, the client can re-issue ibt_open_rc_channel setting
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * new fields as follows:
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Set (ibt_chan_args_t)->oc_cm_cep_path =
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * original (ibt_chan_open_args_t)->oc_path->pi_prim_cep_path.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Set (ibt_chan_args_t)->oc_cm_pkt_lt =
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * original (ibt_chan_open_args_t)->oc_prim_pkt_lt.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Update (ibt_chan_args_t)->oc_path based on path information returned
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * from ibt_get_paths using the gid in the return data below:
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * (ibt_rc_returns_t)->rc_arej_info.ari_redirect_info.ari_gid.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Set flags to IBT_OCHAN_PORT_REDIRECTED.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Note : oc_cm_path is not used for any other scenario, and must be set for
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * IBT_OCHAN_PORT_REDIRECTED.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When ibt_open_rc_channel returns with ibt_cm_reason_t of
74a31ce69a88d851777ca840d31ec610ce9ecab3timh * IBT_CM_REDIRECT_CM, the client can re-issue ibt_open_rc_channel setting
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * new fields as follows:
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Update (ibt_chan_args_t)->oc_path based on path information returned
74a31ce69a88d851777ca840d31ec610ce9ecab3timh * from ibt_get_paths using the return data in
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * (ibt_rc_returns_t)->rc_arej_info.ari_redirect_info.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
74a31ce69a88d851777ca840d31ec610ce9ecab3timh * Set (ibt_chan_args_t)->oc_cm_redirect_info =
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Returned (ibt_rc_returns_t)->rc_arej_info.ari_redirect_info.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Set flags to IBT_OCHAN_REDIRECTED.
74a31ce69a88d851777ca840d31ec610ce9ecab3timh *
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Note:
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
74a31ce69a88d851777ca840d31ec610ce9ecab3timh * IBT_OCHAN_PORT_REDIRECTED flag cannot be used to specify a remote CM MAD
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * address, that is on a different subnet than the RC connection itself.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
74a31ce69a88d851777ca840d31ec610ce9ecab3timh * Not specified attributes should be set to "NULL" or "0".
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_chan_open_args_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_path_info_t *oc_path; /* Primary & Alternate */
74a31ce69a88d851777ca840d31ec610ce9ecab3timh ibt_cm_handler_t oc_cm_handler; /* cm_handler - required */
74a31ce69a88d851777ca840d31ec610ce9ecab3timh void *oc_cm_clnt_private; /* First argument to */
74a31ce69a88d851777ca840d31ec610ce9ecab3timh /* cm_handler */
74a31ce69a88d851777ca840d31ec610ce9ecab3timh ibt_rnr_retry_cnt_t oc_path_rnr_retry_cnt;
74a31ce69a88d851777ca840d31ec610ce9ecab3timh uint8_t oc_path_retry_cnt:3;
74a31ce69a88d851777ca840d31ec610ce9ecab3timh uint8_t oc_rdma_ra_out;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint8_t oc_rdma_ra_in;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_priv_data_len_t oc_priv_data_len; /* Number of bytes of */
74a31ce69a88d851777ca840d31ec610ce9ecab3timh /* REQ Private data */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void *oc_priv_data; /* REQ private data */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_channel_hdl_t oc_dup_channel; /* IBT_OCHAN_DUP */
74a31ce69a88d851777ca840d31ec610ce9ecab3timh ibt_redirect_info_t *oc_cm_redirect_info; /* Redirect params */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* for port and CM */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* redirection */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cep_path_t *oc_cm_cep_path; /* Optional Path for */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* CM MADs on */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* port redirection */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_time_t oc_cm_pkt_lt; /* Pkt life time for */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* CM MADs */
74a31ce69a88d851777ca840d31ec610ce9ecab3timh uint32_t oc_opaque1:4;
74a31ce69a88d851777ca840d31ec610ce9ecab3timh uint32_t oc_opaque2:24;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint32_t oc_opaque3;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint32_t oc_opaque4;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_chan_open_args_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
74a31ce69a88d851777ca840d31ec610ce9ecab3timh
74a31ce69a88d851777ca840d31ec610ce9ecab3timh/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Define an optional RC return arguments structure. This contains return
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * parameters from ibt_open_rc_channel() when called in BLOCKING mode.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * rc_priv_data should be NULL or point to a buffer allocated by the caller,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * the size of which should be in rc_priv_data_len, where rc_priv_data_len <=
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * IBT_REP_PRIV_DATA_SZ.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjtypedef struct ibt_rc_returns_s {
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint8_t rc_rdma_ra_in; /* Arbitrated resp resources */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint8_t rc_rdma_ra_out; /* Arbitrated initiator depth */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_arej_info_t rc_arej_info;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_cm_reason_t rc_status;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint8_t rc_failover_status; /* Failover status */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_priv_data_len_t rc_priv_data_len;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj void *rc_priv_data;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj} ibt_rc_returns_t;
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Define a callback function that can be used in Non-Blocking calls to
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_recycle_rc().
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef void (*ibt_recycle_handler_t)(ibt_status_t ibt_status, void *arg);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Define an optional return arguments structure from ibt_set_alt_path()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * This contains return parameters, when called in BLOCKING mode.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ap_priv_data should be NULL or point to a buffer allocated by the caller,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * the size of which should be in ap_priv_data_len, where ap_priv_data_len <=
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * IBT_APR_PRIV_DATA_SZ.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The private data from APR is returned in ap_priv_data.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The caller specifies amount of APR private data to be returned in
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ap_priv_data_len.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_ap_returns_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_ap_status_t ap_status;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi boolean_t ap_arej_info_valid;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_arej_info_t ap_arej_info; /* Only valid if redirect */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_priv_data_len_t ap_priv_data_len;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void *ap_priv_data;
12cc75c814f0c017004a9bbc96429911e008601bcindi} ibt_ap_returns_t;
12cc75c814f0c017004a9bbc96429911e008601bcindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
12cc75c814f0c017004a9bbc96429911e008601bcindi * UD remote destination attributes.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ud_sid, ud_addr, ud_pkt_lt and ud_pkey_ix must be specified.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * These values can be as returned in an ibt_path_info_t struct from an
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_get_paths() call.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ud_priv_data should be NULL or point to a buffer allocated by the caller,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * the size of which is in ud_priv_data_len, where ud_priv_data_len <=
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * IBT_SIDR_REQ_PRIV_DATA_SZ.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_ud_dest_attr_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_svc_id_t ud_sid; /* Service ID */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_adds_vect_t *ud_addr; /* Address Info */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint16_t ud_pkey_ix; /* Pkey Index */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_time_t ud_pkt_lt;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cm_ud_handler_t ud_cm_handler; /* An optional CM UD event */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* which must be NULL */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* if not specified. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void *ud_cm_private; /* First arg to ud_cm_handler */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_priv_data_len_t ud_priv_data_len;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void *ud_priv_data; /* SIDR REQ private data */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_ud_dest_attr_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Define an optional UD return arguments structure.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ud_priv_data should be NULL or point to a buffer allocated by the caller,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * the size of which should be in ud_priv_data_len, where ud_priv_data_len <=
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * IBT_SIDR_REP_PRIV_DATA_SZ.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_ud_returns_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_sidr_status_t ud_status;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_redirect_info_t ud_redirect;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_qpn_t ud_dqpn; /* Returned destination QPN */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_qkey_t ud_qkey; /* Q_Key for destination QPN */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_priv_data_len_t ud_priv_data_len;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void *ud_priv_data;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi} ibt_ud_returns_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Multicast group attributes
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Not specified attributes should be set to "NULL" or "0".
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Used by ibt_join_mcg()/ibt_query_mcg().
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * mc_qkey, mc_pkey, mc_flow, mc_tclass, mc_sl, mc_join_state are required for
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * create - ibt_join_mcg().
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_mcg_attr_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_gid_t mc_mgid; /* MGID */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_gid_t mc_pgid; /* SGID of the end port being */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi /* added to the MCG. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_qkey_t mc_qkey; /* Q_Key */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_pkey_t mc_pkey; /* Partition key for this MCG */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_mtu_req_t mc_mtu_req; /* MTU */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_srate_req_t mc_rate_req; /* Static rate */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_pkt_lt_req_t mc_pkt_lt_req; /* Packet Life Time Request */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint_t mc_flow:20; /* FlowLabel. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint8_t mc_hop; /* HopLimit */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint8_t mc_tclass; /* Traffic Class. */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint8_t mc_sl:4; /* Service Level */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint8_t mc_scope:4, /* Multicast Address Scope */
12cc75c814f0c017004a9bbc96429911e008601bcindi mc_join_state:4; /* FULL For create */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_lid_t mc_opaque1;
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi} ibt_mcg_attr_t;
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
12cc75c814f0c017004a9bbc96429911e008601bcindi * Multicast group attributes.
12cc75c814f0c017004a9bbc96429911e008601bcindi * returned by ibt_join_mcg()/ibt_query_mcg().
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_mcg_info_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_adds_vect_t mc_adds_vect; /* Address information */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_mtu_t mc_mtu; /* MTU */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_qkey_t mc_qkey; /* Q_Key */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint16_t mc_pkey_ix; /* Pkey Index */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi uint8_t mc_scope:4; /* Multicast Address Scope */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi clock_t mc_opaque2;
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi} ibt_mcg_info_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Define a callback function that can be used in Non-Blocking calls to
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_join_mcg().
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef void (*ibt_mcg_handler_t)(void *arg, ibt_status_t retval,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_mcg_info_t *mcg_info_p);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Service Flags - sd_flags
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * IBT_SRV_PEER_TYPE_SID Peer-to-peer Service IDs.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditypedef enum ibt_service_flags_e {
12cc75c814f0c017004a9bbc96429911e008601bcindi IBT_SRV_NO_FLAGS = 0x0,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_SRV_PEER_TYPE_SID = 0x1
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi} ibt_service_flags_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Define a Service ID Registration structure.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_srv_desc_s {
12cc75c814f0c017004a9bbc96429911e008601bcindi ibt_cm_ud_handler_t sd_ud_handler; /* UD Service Handler */
12cc75c814f0c017004a9bbc96429911e008601bcindi ibt_cm_handler_t sd_handler; /* Non-UD Service Handler */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_service_flags_t sd_flags; /* Flags */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi} ibt_srv_desc_t;
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Flag to indicate ibt_bind_service() to or NOT-to clean-up Stale matching
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Local Service Records with SA prior to binding the new request.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define IBT_SBIND_NO_FLAGS 0
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define IBT_SBIND_NO_CLEANUP 1
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Define a Service ID Binding structure (data for service records).
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_srv_bind_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint64_t sb_key[2]; /* Service Key */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi char *sb_name; /* Service Name (up to 63 chars) */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint32_t sb_lease; /* Service Lease period (in seconds) */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ib_pkey_t sb_pkey; /* Service P_Key */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_srv_data_t sb_data; /* Service Data */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint_t sb_flag; /* indicates to/not-to clean-up stale */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* matching local service records. */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi} ibt_srv_bind_t;
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_cm_delay() flags.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Refer to InfiniBand Architecture Release Volume 1 Rev 1.0a:
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Section 12.6.6 MRA
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef enum ibt_cmdelay_flags_e {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_CM_DELAY_REQ = 0,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi IBT_CM_DELAY_REP = 1,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi IBT_CM_DELAY_LAP = 2
c40d7343efa60b18ad1ceb316eb337caeea79046cindi} ibt_cmdelay_flags_t;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The payload for DDI events passed on IB_PROP_UPDATE_EVENT.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * This is passed as the bus nexus data to event_handler(9e).
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecinditypedef struct ibt_prop_update_payload_s {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi union {
c40d7343efa60b18ad1ceb316eb337caeea79046cindi struct {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint32_t srv_updated:1;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint32_t gid_updated:1;
c40d7343efa60b18ad1ceb316eb337caeea79046cindi } _ib_prop_update_struct;
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint32_t prop_updated;
c40d7343efa60b18ad1ceb316eb337caeea79046cindi } _ib_prop_update_union;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_status_t ib_reprobe_status;
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define ib_srv_prop_updated \
c40d7343efa60b18ad1ceb316eb337caeea79046cindi _ib_prop_update_union._ib_prop_update_struct.srv_updated
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define ib_gid_prop_updated \
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi _ib_prop_update_union._ib_prop_update_struct.gid_updated
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define ib_prop_updated \
c40d7343efa60b18ad1ceb316eb337caeea79046cindi _ib_prop_update_union.prop_updated
c40d7343efa60b18ad1ceb316eb337caeea79046cindi} ibt_prop_update_payload_t;
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
12cc75c814f0c017004a9bbc96429911e008601bcindi/*
12cc75c814f0c017004a9bbc96429911e008601bcindi * FUNCTION PROTOTYPES.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
12cc75c814f0c017004a9bbc96429911e008601bcindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_attach() and ibt_detach():
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * These are the calls into IBTF used during client driver attach() and
12cc75c814f0c017004a9bbc96429911e008601bcindi * detach().
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The IBTF returns an ibt_clnt_hdl_t to the client. This handle is used
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * to identify this client device in all subsequent calls into the IBTF.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * The ibt_detach() routine is called from a client driver's detach()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * routine to deregister itself from the IBTF.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiibt_status_t ibt_attach(ibt_clnt_modinfo_t *mod_infop, dev_info_t *arg,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi void *clnt_private, ibt_clnt_hdl_t *ibt_hdl_p);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiibt_status_t ibt_detach(ibt_clnt_hdl_t ibt_hdl);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * HCA FUNCTIONS
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_get_hca_list()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Returns the number of HCAs in a system and their node GUIDS.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi *
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * If hca_list_p is not NULL then the memory for the array of GUIDs is
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * allocated by the IBTF and should be freed by the caller using
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_free_hca_list(). If hca_list_p is NULL then no memory is allocated
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * by ibt_get_hca_list and only the number of HCAs in a system is returned.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi *
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * It is assumed that the caller can block in kmem_alloc.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj *
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_free_hca_list()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Free the memory allocated by ibt_get_hca_list().
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiuint_t ibt_get_hca_list(ib_guid_t **hca_list_p);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindivoid ibt_free_hca_list(ib_guid_t *hca_list, uint_t entries);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_open_hca() - Open/Close a HCA. HCA can only be opened/closed
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_close_hca() once. ibt_open_hca() takes a client's ibt handle
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * and a GUID and returns a unique IBT client HCA
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * handle.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi *
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * These routines can not be called from interrupt context.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiibt_status_t ibt_open_hca(ibt_clnt_hdl_t ibt_hdl, ib_guid_t hca_guid,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_hca_hdl_t *hca_hdl);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_close_hca(ibt_hca_hdl_t hca_hdl);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_query_hca()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_query_hca_byguid()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Returns the static attributes of the specified HCA
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiibt_status_t ibt_query_hca(ibt_hca_hdl_t hca_hdl, ibt_hca_attr_t *hca_attrs);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiibt_status_t ibt_query_hca_byguid(ib_guid_t hca_guid,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_hca_attr_t *hca_attrs);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_query_hca_ports()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_query_hca_ports_byguid()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Returns HCA port/ports attributes for the specified HCA port/ports.
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * ibt_query_hca_ports() allocates the memory required for the
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_hca_portinfo_t struct as well as the memory required for the SGID
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * and P_Key tables contained within that struct.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi *
14ea4bb737263733ad80a36b4f73f681c30a6b45sd * ibt_free_portinfo()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Frees the memory allocated for a specified ibt_hca_portinfo_t struct.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiibt_status_t ibt_query_hca_ports(ibt_hca_hdl_t hca_hdl, uint8_t port,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_hca_portinfo_t **port_info_p, uint_t *ports_p, uint_t *size_p);
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrockibt_status_t ibt_query_hca_ports_byguid(ib_guid_t hca_guid, uint8_t port,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_hca_portinfo_t **port_info_p, uint_t *ports_p, uint_t *size_p);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindivoid ibt_free_portinfo(ibt_hca_portinfo_t *port_info, uint_t size);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_set_hca_private() - Set/get the client private data.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_get_hca_private()
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindivoid ibt_set_hca_private(ibt_hca_hdl_t hca_hdl, void *clnt_private);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindivoid *ibt_get_hca_private(ibt_hca_hdl_t hca_hdl);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_hca_handle_to_guid()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * A helper function to retrieve HCA GUID for the specified handle.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Returns HCA GUID on which the specified Channel is allocated. Valid
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * if it is non-NULL on return.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjib_guid_t ibt_hca_handle_to_guid(ibt_hca_hdl_t hca);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_hca_guid_to_handle()
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * A helper function to retrieve a hca handle from a HCA GUID.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_hca_guid_to_handle(ibt_clnt_hdl_t ibt_hdl, ib_guid_t hca_guid,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_hca_hdl_t *hca_hdl);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * CONNECTION ESTABLISHMENT/TEAR DOWN FUNCTIONS.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_get_paths
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Finds the best path to a specified destination (as determined by the
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * IBTL) that satisfies the requirements specified in an ibt_path_attr_t
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * struct.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_get_paths(ibt_clnt_hdl_t ibt_hdl, ibt_path_flags_t flags,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_path_attr_t *attr, uint8_t max_paths, ibt_path_info_t *paths,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint8_t *num_paths_p);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Callback function that can be used in ibt_aget_paths(), a Non-Blocking
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * version of ibt_get_paths().
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjtypedef void (*ibt_path_handler_t)(void *arg, ibt_status_t retval,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_path_info_t *paths, uint8_t num_paths);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Find path(s) to a given destination or service asynchronously.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_aget_paths() is a Non-Blocking version of ibt_get_paths().
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_aget_paths(ibt_clnt_hdl_t ibt_hdl, ibt_path_flags_t flags,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_path_attr_t *attr, uint8_t max_paths, ibt_path_handler_t func,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj void *arg);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_get_alt_path
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Finds the best alternate path to a specified channel (as determined by
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * the IBTL) that satisfies the requirements specified in an
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_alt_path_attr_t struct. The specified channel must have been
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * previously opened successfully using ibt_open_rc_channel.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_get_alt_path(ibt_channel_hdl_t chan, ibt_path_flags_t flags,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_alt_path_attr_t *attr, ibt_alt_path_info_t *alt_path);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_open_rc_channel
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_open_rc_channel() opens a previously allocated RC communication
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * channel. The IBTL initiates the channel establishment protocol.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_open_rc_channel(ibt_channel_hdl_t rc_chan,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_chan_open_flags_t flags, ibt_execution_mode_t mode,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_chan_open_args_t *args, ibt_rc_returns_t *returns);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_close_rc_channel
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Close the specified channel. Outstanding work requests are flushed
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * so that the client can do the associated clean up. After that, the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * client will usually deregister the previously registered memory,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * then free the channel by calling ibt_free_rc_channel().
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * This function will reuse CM event Handler provided in
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_open_rc_channel().
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_close_rc_channel(ibt_channel_hdl_t rc_chan,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_execution_mode_t mode, void *priv_data,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ibt_priv_data_len_t priv_data_len, uint8_t *ret_status,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void *ret_priv_data, ibt_priv_data_len_t *ret_priv_data_len_p);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_prime_close_rc_channel
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Allocates resources required for a close rc channel operation.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Calling ibt_prime_close_rc_channel() allows a channel to be
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * subsequently closed in interrupt context.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * A call is first made to ibt_prime_close_rc_channel in non-interrupt
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * context, followed by ibt_close_rc_channel in non-blocking mode from
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * interrupt context
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_prime_close_rc_channel() can only be called on a previously opened
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * channel.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_prime_close_rc_channel(ibt_channel_hdl_t rc_chan);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_recycle_rc
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Recycle a RC channel which has transitioned to Error state. The
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_recycle_rc() function transitions the channel from Error
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * state (IBT_STATE_ERROR) to the state ready for use by
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_open_rc_channel. Basically, this function is very similar to
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_alloc_rc_channel, but reuses an existing RC channel.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Clients are allowed to make resource clean up/free calls in the CM handler
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Client(s) must not invoke blocking version (ie., func specified as NULL) of
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_recycle_rc from cm callback for IBT_CM_EVENT_CONN_CLOSED
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Clients are strongly advised not to issue blocking calls from func, as this
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * would block the CM threads, and could delay or block other client connections
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * and ibtl related API invocations.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_recycle_rc(ibt_channel_hdl_t rc_chan, ibt_cep_flags_t control,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi uint8_t hca_port_num, ibt_recycle_handler_t func, void *arg);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_recycle_ud
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Recycle a UD channel which has transitioned to Error state. The
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_recycle_ud() function transitions the channel from Error
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * state (IBT_STATE_ERROR) to a usable state (IBT_STATE_RTS).
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Basically, this function is very similar to ibt_alloc_ud_channel,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * but reuses an existing UD channel.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_recycle_ud(ibt_channel_hdl_t ud_chan, uint8_t hca_port_num,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint16_t pkey_ix, ib_qkey_t qkey);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * MODIFY CHANNEL ATTRIBUTE FUNCTIONs.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_pause_sendq
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_unpause_sendq
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Place the send queue of the specified channel into the send queue
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * drained state.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Applicable for both RC and UD channels.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_pause_sendq(ibt_channel_hdl_t chan,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cep_modify_flags_t modify_flags);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_unpause_sendq(ibt_channel_hdl_t chan);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_resize_queues()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Resize the SendQ/RecvQ sizes of a channel.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Applicable for both RC and UD channels.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_resize_queues(ibt_channel_hdl_t chan, ibt_qflags_t flags,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_queue_sizes_t *request_sz, ibt_queue_sizes_t *actual_sz);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_query_queues()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Query the SendQ/RecvQ sizes of a channel.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Applicable for both RC and UD channels.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_query_queues(ibt_channel_hdl_t chan,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_queue_sizes_t *actual_sz);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_modify_rdma
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Enable/disable RDMA operations.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Applicable for RC channels only.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_modify_rdma(ibt_channel_hdl_t rc_chan,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cep_modify_flags_t modify_flags, ibt_cep_flags_t flags);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_set_rdma_resource
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Change the number of resources to be used for incoming and outgoing
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * RDMA reads & Atomics.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_set_rdma_resource(ibt_channel_hdl_t rc_chan,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cep_modify_flags_t modify_flags, uint8_t rdma_ra_out,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi uint8_t rdma_ra_in);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_change_port
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Change the primary physical port of an RC channel. (This is done only
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * if HCA supports this capability). Can only be called on a paused
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * channel.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Applicable for RC channels only.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_change_port(ibt_channel_hdl_t rc_chan, uint8_t port_num);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * SERVICE REGISTRATION FUNCTIONS
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_register_service()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_deregister_service()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Register/deregister a Service (range of Service IDs) with the IBTF.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_bind_service()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_unbind_service()
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_unbind_all_services()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Bind a Service to a given port (GID), and optionally create
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * service record(s) with the SA for ibt_get_paths() to find.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiibt_status_t ibt_register_service(ibt_clnt_hdl_t ibt_hdl,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_srv_desc_t *service, ib_svc_id_t sid, int num_sids,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_srv_hdl_t *srv_hdl_p, ib_svc_id_t *ret_sid_p);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_deregister_service(ibt_clnt_hdl_t ibt_hdl,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_srv_hdl_t srv_hdl);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_bind_service(ibt_srv_hdl_t srv_hdl, ib_gid_t gid,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_srv_bind_t *srv_bind, void *cm_private, ibt_sbind_hdl_t *sb_hdl_p);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_unbind_service(ibt_srv_hdl_t srv_hdl, ibt_sbind_hdl_t sb_hdl);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_unbind_all_services(ibt_srv_hdl_t srv_hdl);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_cm_delay
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * A client CM handler/srv_handler function can call this function to
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * extend its response time to a CM event.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Applicable for RC channels only.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_cm_delay(ibt_cmdelay_flags_t flags, void *cm_session_id,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi clock_t service_time, void *priv_data, ibt_priv_data_len_t priv_data_len);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_cm_proceed
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * An IBT client calls ibt_cm_proceed() to proceed with a connection that
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * previously deferred by the client returning IBT_CM_DEFER on a CM handler
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * callback. CM events that can be deferred and continued with ibt_cm_proceed()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * are REQ_RCV, REP_RCV, LAP_RCV, and DREQ_RCV.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * NOTE :
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Typically CM completes processing of a client's CM handler return, with
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * IBT_CM_DEFER status, before processing of the corresponding ibt_cm_proceed()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * is started. However a race exists where by CM may not have completed the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * client's handler return processing when ibt_cm_proceed() is called by a
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * client. In this case ibt_cm_proceed() will block until processing of the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * client's CM handler return is complete.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * A client that returns IBT_CM_DEFER from the cm handler must
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * subsequently make a call to ibt_cm_proceed(). It is illegal to call
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_cm_proceed() on a channel that has not had the connection
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * establishment deferred.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Client cannot call ibt_cm_proceed from the cm handler.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_cm_proceed(ibt_cm_event_type_t event, void *session_id,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cm_status_t status, ibt_cm_proceed_reply_t *cm_event_data,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void *priv_data, ibt_priv_data_len_t priv_data_len);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_cm_ud_proceed
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * An IBT client calls ibt_cm_ud_proceed() to proceed with an
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * IBT_CM_UD_EVENT_SIDR_REQ UD event that was previously deferred by the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * client returning IBT_CM_DEFER on a CM UD handler callback.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * NOTE :
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Typically CM completes processing of a client's CM handler return, with
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * IBT_CM_DEFER status, before processing of the corresponding
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_cm_ud_proceed() is started. However a race exists where by CM may not
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * have completed the client's handler return processing when
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_cm_ud_proceed() is called by a client. In this case ibt_cm_ud_proceed()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * will block until processing of the client's CM handler return is complete.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * A client that returns IBT_CM_DEFER from the cm handler must
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * subsequently make a call to ibt_cm_ud_proceed(). It is illegal to call
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_cm_ud_proceed() on a channel that has not had the connection
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * establishment deferred.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Client cannot call ibt_cm_ud_proceed from the cm handler.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_cm_ud_proceed(void *session_id, ibt_channel_hdl_t ud_channel,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cm_status_t status, ibt_redirect_info_t *redirect_infop,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void *priv_data, ibt_priv_data_len_t priv_data_len);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi * COMPLETION QUEUES.
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_alloc_cq_sched()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Reserve CQ scheduling class resources
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * ibt_free_cq_sched()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Free CQ scheduling class resources
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiibt_status_t ibt_alloc_cq_sched(ibt_hca_hdl_t hca_hdl,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cq_sched_attr_t *attr, ibt_sched_hdl_t *sched_hdl_p);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiibt_status_t ibt_free_cq_sched(ibt_hca_hdl_t hca_hdl,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_sched_hdl_t sched_hdl, uint_t load);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/*
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi * ibt_alloc_cq()
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi * Allocate a completion queue.
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi */
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindiibt_status_t ibt_alloc_cq(ibt_hca_hdl_t hca_hdl, ibt_cq_attr_t *cq_attr,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi ibt_cq_hdl_t *ibt_cq_p, uint_t *real_size);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi/*
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi * ibt_free_cq()
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi * Free allocated CQ resources.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi */
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindiibt_status_t ibt_free_cq(ibt_cq_hdl_t ibt_cq);
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi/*
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi * ibt_enable_cq_notify()
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi * Enable notification requests on the specified CQ.
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi * Applicable for both RC and UD channels.
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi *
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi * Completion notifications are disabled by setting the completion
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi * handler to NULL by calling ibt_set_cq_handler().
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi */
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindiibt_status_t ibt_enable_cq_notify(ibt_cq_hdl_t ibt_cq,
89c0ae934a35c2ab26de63e1d9fba6bcb04c6306cindi ibt_cq_notify_flags_t notify_type);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi/*
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * ibt_set_cq_handler()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Register a work request completion handler with the IBTF.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Applicable for both RC and UD channels.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi *
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Completion notifications are disabled by setting the completion
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * handler to NULL. When setting the handler to NULL, no additional
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * calls to the CQ handler will be initiated.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * This function does not otherwise change the state of previous
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * calls to ibt_enable_cq_notify().
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
940d71d237794874e18a0eb72f6564821a823517eschrockvoid ibt_set_cq_handler(ibt_cq_hdl_t ibt_cq,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_cq_handler_t completion_handler, void *arg);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_poll_cq()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Poll the specified CQ for the completion of work requests (WRs).
940d71d237794874e18a0eb72f6564821a823517eschrock * If the CQ contains completed WRs, up to num_wc of them are returned.
940d71d237794874e18a0eb72f6564821a823517eschrock * Applicable for both RC and UD channels.
940d71d237794874e18a0eb72f6564821a823517eschrock */
940d71d237794874e18a0eb72f6564821a823517eschrockibt_status_t ibt_poll_cq(ibt_cq_hdl_t ibt_cq, ibt_wc_t *work_completions,
940d71d237794874e18a0eb72f6564821a823517eschrock uint_t num_wc, uint_t *num_polled);
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrock/*
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_query_cq()
940d71d237794874e18a0eb72f6564821a823517eschrock * Return the total number of entries in the CQ.
940d71d237794874e18a0eb72f6564821a823517eschrock */
940d71d237794874e18a0eb72f6564821a823517eschrockibt_status_t ibt_query_cq(ibt_cq_hdl_t ibt_cq, uint_t *entries);
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrock/*
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_resize_cq()
940d71d237794874e18a0eb72f6564821a823517eschrock * Change the size of a CQ.
940d71d237794874e18a0eb72f6564821a823517eschrock */
940d71d237794874e18a0eb72f6564821a823517eschrockibt_status_t ibt_resize_cq(ibt_cq_hdl_t ibt_cq, uint_t new_sz, uint_t *real_sz);
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrock/*
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_set_cq_private()
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_get_cq_private()
940d71d237794874e18a0eb72f6564821a823517eschrock * Set/get the client private data.
940d71d237794874e18a0eb72f6564821a823517eschrock */
940d71d237794874e18a0eb72f6564821a823517eschrockvoid ibt_set_cq_private(ibt_cq_hdl_t ibt_cq, void *clnt_private);
940d71d237794874e18a0eb72f6564821a823517eschrockvoid *ibt_get_cq_private(ibt_cq_hdl_t ibt_cq);
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrock/*
940d71d237794874e18a0eb72f6564821a823517eschrock * Memory Management Functions.
940d71d237794874e18a0eb72f6564821a823517eschrock * Applicable for both RC and UD channels.
940d71d237794874e18a0eb72f6564821a823517eschrock *
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_register_mr()
940d71d237794874e18a0eb72f6564821a823517eschrock * Prepares a virtually addressed memory region for use by a HCA. A
940d71d237794874e18a0eb72f6564821a823517eschrock * description of the registered memory suitable for use in Work Requests
940d71d237794874e18a0eb72f6564821a823517eschrock * (WRs) is returned in the ibt_mr_desc_t parameter.
940d71d237794874e18a0eb72f6564821a823517eschrock *
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_register_buf()
940d71d237794874e18a0eb72f6564821a823517eschrock * Prepares a memory region described by a buf(9S) struct for use by a
940d71d237794874e18a0eb72f6564821a823517eschrock * HCA. A description of the registered memory suitable for use in
940d71d237794874e18a0eb72f6564821a823517eschrock * Work Requests (WRs) is returned in the ibt_mr_desc_t parameter.
940d71d237794874e18a0eb72f6564821a823517eschrock *
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_query_mr()
940d71d237794874e18a0eb72f6564821a823517eschrock * Retrieves information about a specified memory region.
940d71d237794874e18a0eb72f6564821a823517eschrock *
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_deregister_mr()
940d71d237794874e18a0eb72f6564821a823517eschrock * Remove a memory region from a HCA translation table, and free all
940d71d237794874e18a0eb72f6564821a823517eschrock * resources associated with the memory region.
940d71d237794874e18a0eb72f6564821a823517eschrock *
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_reregister_mr()
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_reregister_buf()
940d71d237794874e18a0eb72f6564821a823517eschrock * Modify the attributes of an existing memory region.
940d71d237794874e18a0eb72f6564821a823517eschrock *
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_register_shared_mr()
940d71d237794874e18a0eb72f6564821a823517eschrock * Given an existing memory region, a new memory region associated with
940d71d237794874e18a0eb72f6564821a823517eschrock * the same physical locations is created.
940d71d237794874e18a0eb72f6564821a823517eschrock *
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_sync_mr()
940d71d237794874e18a0eb72f6564821a823517eschrock * Sync a memory region for either RDMA reads or RDMA writes
940d71d237794874e18a0eb72f6564821a823517eschrock *
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_alloc_mw()
940d71d237794874e18a0eb72f6564821a823517eschrock * Allocate a memory window.
940d71d237794874e18a0eb72f6564821a823517eschrock *
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_query_mw()
940d71d237794874e18a0eb72f6564821a823517eschrock * Retrieves information about a specified memory window.
940d71d237794874e18a0eb72f6564821a823517eschrock *
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_free_mw()
940d71d237794874e18a0eb72f6564821a823517eschrock * De-allocate the Memory Window.
940d71d237794874e18a0eb72f6564821a823517eschrock */
940d71d237794874e18a0eb72f6564821a823517eschrockibt_status_t ibt_register_mr(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
940d71d237794874e18a0eb72f6564821a823517eschrock ibt_mr_attr_t *mem_attr, ibt_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc);
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrockibt_status_t ibt_register_buf(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
940d71d237794874e18a0eb72f6564821a823517eschrock ibt_smr_attr_t *mem_bpattr, struct buf *bp, ibt_mr_hdl_t *mr_hdl_p,
940d71d237794874e18a0eb72f6564821a823517eschrock ibt_mr_desc_t *mem_desc);
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrockibt_status_t ibt_query_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl,
940d71d237794874e18a0eb72f6564821a823517eschrock ibt_mr_query_attr_t *attr);
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrockibt_status_t ibt_deregister_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl);
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrockibt_status_t ibt_reregister_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl,
940d71d237794874e18a0eb72f6564821a823517eschrock ibt_pd_hdl_t pd, ibt_mr_attr_t *mem_attr, ibt_mr_hdl_t *mr_hdl_p,
940d71d237794874e18a0eb72f6564821a823517eschrock ibt_mr_desc_t *mem_desc);
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrockibt_status_t ibt_reregister_buf(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl,
940d71d237794874e18a0eb72f6564821a823517eschrock ibt_pd_hdl_t pd, ibt_smr_attr_t *mem_bpattr, struct buf *bp,
940d71d237794874e18a0eb72f6564821a823517eschrock ibt_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc);
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrockibt_status_t ibt_register_shared_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl,
940d71d237794874e18a0eb72f6564821a823517eschrock ibt_pd_hdl_t pd, ibt_smr_attr_t *mem_sattr, ibt_mr_hdl_t *mr_hdl_p,
940d71d237794874e18a0eb72f6564821a823517eschrock ibt_mr_desc_t *mem_desc);
940d71d237794874e18a0eb72f6564821a823517eschrock
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_sync_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_sync_t *mr_segments,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi size_t num_segments);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
78432d5ed5122db8b0bbfa41e00d063bf8ae7171cyibt_status_t ibt_alloc_mw(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
78432d5ed5122db8b0bbfa41e00d063bf8ae7171cy ibt_mw_flags_t flags, ibt_mw_hdl_t *mw_hdl_p, ibt_rkey_t *rkey);
78432d5ed5122db8b0bbfa41e00d063bf8ae7171cy
78432d5ed5122db8b0bbfa41e00d063bf8ae7171cyibt_status_t ibt_query_mw(ibt_hca_hdl_t hca_hdl, ibt_mw_hdl_t mw_hdl,
78432d5ed5122db8b0bbfa41e00d063bf8ae7171cy ibt_mw_query_attr_t *mw_attr_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_free_mw(ibt_hca_hdl_t hca_hdl, ibt_mw_hdl_t mw_hdl);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_alloc_lkey()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Allocates physical buffer list resources for use in memory
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * registrations.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Applicable for both RC and UD channels.
940d71d237794874e18a0eb72f6564821a823517eschrock */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_alloc_lkey(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_lkey_flags_t flags, uint_t phys_buf_list_sz, ibt_mr_hdl_t *mr_p,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_pmr_desc_t *mem_desc_p);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Physical Memory Management Functions.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Applicable for both RC and UD channels.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_register_phys_mr()
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Prepares a physically addressed memory region for use by a HCA.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_reregister_phys_mr()
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Modify the attributes of an existing memory region.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_register_phys_mr(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_pmr_attr_t *mem_pattr, ibt_mr_hdl_t *mr_hdl_p,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_pmr_desc_t *mem_desc_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_reregister_phys_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_pd_hdl_t pd, ibt_pmr_attr_t *mem_pattr, ibt_mr_hdl_t *mr_hdl_p,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_pmr_desc_t *mem_desc_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Address Translation.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
01e689ccb14727455003b77ee332005223497875cindi * ibt_map_mem_area()
01e689ccb14727455003b77ee332005223497875cindi * Translate a kernel virtual address range into HCA physical addresses.
940d71d237794874e18a0eb72f6564821a823517eschrock * A set of physical addresses, that can be used with "Reserved L_Key",
940d71d237794874e18a0eb72f6564821a823517eschrock * register physical, and "Fast Registration Work Request" operations
940d71d237794874e18a0eb72f6564821a823517eschrock * is returned.
940d71d237794874e18a0eb72f6564821a823517eschrock */
01e689ccb14727455003b77ee332005223497875cindiibt_status_t ibt_map_mem_area(ibt_hca_hdl_t hca_hdl, ibt_va_attr_t *va_attrs,
940d71d237794874e18a0eb72f6564821a823517eschrock uint_t paddr_list_len, ibt_phys_buf_t *paddr_list_p, uint_t *num_paddr_p,
940d71d237794874e18a0eb72f6564821a823517eschrock size_t *paddr_bufsz_p, ib_memlen_t *paddr_offset_p, ibt_ma_hdl_t *ma_hdl_p);
940d71d237794874e18a0eb72f6564821a823517eschrock
940d71d237794874e18a0eb72f6564821a823517eschrock/*
940d71d237794874e18a0eb72f6564821a823517eschrock * ibt_unmap_mem_area()
01e689ccb14727455003b77ee332005223497875cindi * Un pin physical pages pinned during an ibt_map_mem_area() call.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_unmap_mem_area(ibt_hca_hdl_t hca_hdl, ibt_ma_hdl_t ma_hdl);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Work Request Functions
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Applicable for RC and UD channels.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_post_send()
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Post send work requests to the specified channel.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_post_recv()
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_post_srq()
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Post receive work requests to the specified channel.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_post_send(ibt_channel_hdl_t chan, ibt_send_wr_t *wr_list,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint_t num_wr, uint_t *posted);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_post_recv(ibt_channel_hdl_t chan, ibt_recv_wr_t *wr_list,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint_t num_wr, uint_t *posted);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_post_srq(ibt_srq_hdl_t srq, ibt_recv_wr_t *wr_list,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj uint_t num_wr, uint_t *posted);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Alternate Path Migration Functions.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Applicable for RC channels only.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_get_alt_path()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Finds the best alternate path to a specified channel (as determined by
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * the IBTL) that satisfies the requirements specified in an
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_alt_path_attr_t struct. The specified channel must have been
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * previously opened successfully using ibt_open_rc_channel.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * This function also ensures that the service being accessed by the
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * channel is available at the selected alternate port.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Note: The apa_dgid must be on the same destination channel adapter,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * if specified.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj *
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_set_alt_path()
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Load the specified alternate path. Causes the CM to send an LAP message
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * to the remote node. If successful, the local channel is updated with
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * the new alternate path and the channel migration state is set to REARM.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Can only be called on a previously opened RC channel. The channel must
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * be either in RTS or paused state.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_migrate_path()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Force the CI to use the alternate path. The alternate path becomes
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * the primary path. A new alternate path should be loaded and enabled.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_get_alt_path(ibt_channel_hdl_t rc_chan, ibt_path_flags_t flags,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_alt_path_attr_t *attr, ibt_alt_path_info_t *alt_pathp);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_set_alt_path(ibt_channel_hdl_t rc_chan,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_execution_mode_t mode, ibt_alt_path_info_t *alt_pinfo, void *priv_data,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_priv_data_len_t priv_data_len, ibt_ap_returns_t *ret_args);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_migrate_path(ibt_channel_hdl_t rc_chan);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Multicast group Functions.
918a0d8ae0916c29c35aae9b95c22b02a0c6e390robj * Applicable for UD channels only.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
918a0d8ae0916c29c35aae9b95c22b02a0c6e390robj
918a0d8ae0916c29c35aae9b95c22b02a0c6e390robj/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_attach_mcg()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Attaches a UD channel to the specified multicast group. On successful
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * completion, this channel will be provided with a copy of every
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * multicast message addressed to the group specified by the MGID
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * (mcg_info->mc_adds_vect.av_dgid) and received on the HCA port with
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * which the channel is associated.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_attach_mcg(ibt_channel_hdl_t ud_chan,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_mcg_info_t *mcg_info);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_detach_mcg()
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Detach the specified UD channel from the specified multicast group.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj */
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjibt_status_t ibt_detach_mcg(ibt_channel_hdl_t ud_chan,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj ibt_mcg_info_t *mcg_info);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj/*
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ibt_join_mcg()
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Join a multicast group. The first full member "join" causes the MCG
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * to be created.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
940d71d237794874e18a0eb72f6564821a823517eschrockibt_status_t ibt_join_mcg(ib_gid_t rgid, ibt_mcg_attr_t *mcg_attr,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_mcg_info_t *mcg_info_p, ibt_mcg_handler_t func, void *arg);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_leave_mcg()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * The port associated with the port GID shall be removed from the
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * multicast group specified by MGID (mc_gid) or from all the multicast
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * groups of which it is a member if the MGID (mc_gid) is not specified
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * (i.e. mc_gid.mgid_prefix must have 8-bits of 11111111 at the start of
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * the GID to identify this as being a multicast GID).
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * The last full member to leave causes the destruction of the Multicast
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Group.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_leave_mcg(ib_gid_t rgid, ib_gid_t mc_gid, ib_gid_t port_gid,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint8_t mc_join_state);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_query_mcg()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Request information on multicast groups that match the parameters
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * specified in mcg_attr. Information on each multicast group is returned
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * to the caller in the form of an array of ibt_mcg_info_t.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_query_mcg() allocates the memory for this array and returns a
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * pointer to the array (mcgs_p) and the number of entries in the array
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * (entries_p). This memory should be freed by the client using
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_free_mcg_info().
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_query_mcg(ib_gid_t rgid, ibt_mcg_attr_t *mcg_attr,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint_t mcgs_max_num, ibt_mcg_info_t **mcgs_info_p, uint_t *entries_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_free_mcg_info()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Free the memory allocated by successful ibt_query_mcg()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindivoid ibt_free_mcg_info(ibt_mcg_info_t *mcgs_info, uint_t entries);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_register_subnet_notices()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Register a handler to be called for subnet notifications.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindivoid ibt_register_subnet_notices(ibt_clnt_hdl_t ibt_hdl,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_sm_notice_handler_t sm_notice_handler, void *private);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Protection Domain Functions.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_alloc_pd()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_free_pd()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Allocate/Release a protection domain
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_alloc_pd(ibt_hca_hdl_t hca_hdl, ibt_pd_flags_t flags,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_pd_hdl_t *pd);
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_free_pd(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * P_Key to P_Key Index conversion Functions.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_pkey2index_byguid
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_pkey2index Convert a P_Key into a P_Key index.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_index2pkey_byguid
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_index2pkey Convert a P_Key Index into a P_Key.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_pkey2index(ibt_hca_hdl_t hca_hdl, uint8_t port_num,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_pkey_t pkey, uint16_t *pkey_ix);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_index2pkey(ibt_hca_hdl_t hca_hdl, uint8_t port_num,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint16_t pkey_ix, ib_pkey_t *pkey);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_pkey2index_byguid(ib_guid_t hca_guid, uint8_t port_num,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_pkey_t pkey, uint16_t *pkey_ix);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_index2pkey_byguid(ib_guid_t hca_guid, uint8_t port_num,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint16_t pkey_ix, ib_pkey_t *pkey);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_ci_data_in()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Pass CI specific userland data for CI objects to the CI.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
78432d5ed5122db8b0bbfa41e00d063bf8ae7171cyibt_status_t ibt_ci_data_in(ibt_hca_hdl_t hca, ibt_ci_data_flags_t flags,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_object_type_t object, void *ibt_object_handle, void *data_p,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi size_t data_sz);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_ci_data_out()
918a0d8ae0916c29c35aae9b95c22b02a0c6e390robj *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Obtain CI specific userland data for CI objects.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_ci_data_out(ibt_hca_hdl_t hca, ibt_ci_data_flags_t flags,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_object_type_t object, void *ibt_object_handle, void *data_p,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi size_t data_sz);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Node Information.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/* Node type : n_node_type */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define IBT_NODE_TYPE_CHANNEL_ADAPTER 1 /* HCA or TCA */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define IBT_NODE_TYPE_SWITCH 2
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define IBT_NODE_TYPE_ROUTER 3
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cinditypedef struct ibt_node_info_s {
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_guid_t n_sys_img_guid; /* System Image GUID */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_guid_t n_node_guid; /* Node GUID */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_guid_t n_port_guid; /* Port GUID */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint16_t n_dev_id; /* Device ID */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint32_t n_revision; /* Device Revision */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint32_t n_vendor_id:24; /* Device Vendor ID */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint8_t n_num_ports; /* Number of ports on this node. */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint8_t n_port_num; /* Port number. */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint8_t n_node_type; /* Node type */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi char n_description[64]; /* NULL terminated ASCII string */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi} ibt_node_info_t;
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_gid_to_node_info()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Retrieve node information for the specified GID.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_gid_to_node_info(ib_gid_t gid, ibt_node_info_t *node_info_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_reprobe_dev
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Reprobe properties for IOC device node.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_reprobe_dev(dev_info_t *dip);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_get_companion_port_gids()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Get list of GID's available on a companion port(s) of the specified
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * GID or list of GIDs available on a specified Node GUID/System Image
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * GUID.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_get_companion_port_gids(ib_gid_t gid, ib_guid_t hca_guid,
78432d5ed5122db8b0bbfa41e00d063bf8ae7171cy ib_guid_t sysimg_guid, ib_gid_t **gids_p, uint_t *num_gids_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * SHARED RECEIVE QUEUE
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
918a0d8ae0916c29c35aae9b95c22b02a0c6e390robj
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_alloc_srq()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Allocate a shared receive queue.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_alloc_srq(ibt_hca_hdl_t hca_hdl, ibt_srq_flags_t flags,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_pd_hdl_t pd, ibt_srq_sizes_t *sizes, ibt_srq_hdl_t *ibt_srq_p,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_srq_sizes_t *real_size_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_free_srq()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Free allocated SRQ resources.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_free_srq(ibt_srq_hdl_t ibt_srq);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_query_srq()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Query a shared receive queue.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_query_srq(ibt_srq_hdl_t ibt_srq, ibt_pd_hdl_t *pd_p,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_srq_sizes_t *sizes_p, uint_t *limit_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_modify_srq()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Modify a shared receive queue.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_modify_srq(ibt_srq_hdl_t ibt_srq, ibt_srq_modify_flags_t flags,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint_t size, uint_t limit, uint_t *real_size_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_set_srq_private()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_get_srq_private()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Set/get the SRQ client private data.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindivoid ibt_set_srq_private(ibt_srq_hdl_t ibt_srq, void *clnt_private);
c40d7343efa60b18ad1ceb316eb337caeea79046cindivoid *ibt_get_srq_private(ibt_srq_hdl_t ibt_srq);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_check_failure()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Function to test for special case failures
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_failure_type_t ibt_check_failure(ibt_status_t status, uint64_t *reserved_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_hw_is_present() returns 0 when there is no IB hardware actively
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * running. This is primarily useful for modules like rpcmod which needs a
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * quick check to decide whether or not it should try to use InfiniBand.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiint ibt_hw_is_present();
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * CONTRACT PRIVATE ONLY INTERFACES
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * DO NOT USE THE FOLLOWING FUNCTIONS WITHOUT SIGNING THE CONTRACT
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * WITH IBTF GROUP.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/* Define an Address Record structure (data for ATS service records). */
c40d7343efa60b18ad1ceb316eb337caeea79046cinditypedef struct ibt_ar_s {
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_gid_t ar_gid; /* GID of local HCA port */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_pkey_t ar_pkey; /* P_Key valid on port of ar_gid */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi uint8_t ar_data[16]; /* Data affiliated with GID/P_Key */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi} ibt_ar_t;
78432d5ed5122db8b0bbfa41e00d063bf8ae7171cy
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_register_ar()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_deregister_ar()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Register/deregister an Address Record with the SA.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_query_ar()
918a0d8ae0916c29c35aae9b95c22b02a0c6e390robj * Query the SA for Address Records matching either GID/P_Key or Data.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_register_ar(ibt_clnt_hdl_t ibt_hdl, ibt_ar_t *arp);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_deregister_ar(ibt_clnt_hdl_t ibt_hdl, ibt_ar_t *arp);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_query_ar(ib_gid_t *sgid, ibt_ar_t *queryp, ibt_ar_t *resultp);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_modify_system_image()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_modify_system_image_byguid()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Modify specified HCA's system image GUID.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_modify_system_image(ibt_hca_hdl_t hca_hdl, ib_guid_t sys_guid);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_modify_system_image_byguid(ib_guid_t hca_guid,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_guid_t sys_guid);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_modify_port()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_modify_port_byguid()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Modify the specified port, or all ports attribute(s).
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_modify_port(ibt_hca_hdl_t hca_hdl, uint8_t port,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_port_modify_flags_t flags, uint8_t init_type);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_modify_port_byguid(ib_guid_t hca_guid, uint8_t port,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_port_modify_flags_t flags, uint8_t init_type);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_get_port_state()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_get_port_state_byguid()
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Return the most commonly requested attributes of an HCA port.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * If the link state is not IBT_PORT_ACTIVE, the other returned values
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * are undefined.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_get_port_state(ibt_hca_hdl_t hca_hdl, uint8_t port,
24db46411fd54f70c35b94bb952eb7ba040e43b4eschrock ib_gid_t *sgid_p, ib_lid_t *base_lid_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_get_port_state_byguid(ib_guid_t hca_guid, uint8_t port,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ib_gid_t *sgid_p, ib_lid_t *base_lid_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/*
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Fast Memory Registration (FMR).
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_create_fmr_pool
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Not fast-path.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_create_fmr_pool() verifies that the HCA supports FMR and allocates
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * and initializes an "FMR pool". This pool contains state specific to
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * this registration, including the watermark setting to determine when
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * to sync, and the total number of FMR regions available within this pool.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_destroy_fmr_pool
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_destroy_fmr_pool() deallocates all of the FMR regions in a specific
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * pool. All state and information regarding the pool are destroyed and
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * returned as free space once again. No more use of FMR regions in this
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * pool are possible without a subsequent call to ibt_create_fmr_pool().
78432d5ed5122db8b0bbfa41e00d063bf8ae7171cy *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_flush_fmr_pool
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_flush_fmr_pool forces a flush to occur. At the client's request,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * any unmapped FMR regions (See 'ibt_deregister_mr())') are returned to
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * a free state. This function allows for an asynchronous cleanup of
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * formerly used FMR regions. Sync operation is also performed internally
918a0d8ae0916c29c35aae9b95c22b02a0c6e390robj * by HCA driver, when 'watermark' settings for the number of free FMR
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * regions left in the "pool" is reached.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_register_physical_fmr
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_register_physical_fmr() assigns a "free" entry from the FMR Pool.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * It first consults the "FMR cache" to see if this is a duplicate memory
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * registration to something already in use. If not, then a free entry
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * in the "pool" is marked used.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi *
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ibt_deregister_fmr
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * The ibt_deregister_fmr un-maps the resources reserved from the FMR
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * pool by ibt_register_physical_fmr(). The ibt_deregister_fmr() will
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * mark the region as free in the FMR Pool.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_create_fmr_pool(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_fmr_pool_attr_t *fmr_params, ibt_fmr_pool_hdl_t *fmr_pool_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_destroy_fmr_pool(ibt_hca_hdl_t hca_hdl,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_fmr_pool_hdl_t fmr_pool);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_flush_fmr_pool(ibt_hca_hdl_t hca_hdl,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_fmr_pool_hdl_t fmr_pool);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_register_physical_fmr(ibt_hca_hdl_t hca_hdl,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_fmr_pool_hdl_t fmr_pool, ibt_pmr_attr_t *mem_pattr,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ibt_mr_hdl_t *mr_hdl_p, ibt_pmr_desc_t *mem_desc_p);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindiibt_status_t ibt_deregister_fmr(ibt_hca_hdl_t hca, ibt_mr_hdl_t mr_hdl);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#ifdef __cplusplus
c40d7343efa60b18ad1ceb316eb337caeea79046cindi}
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#endif
c40d7343efa60b18ad1ceb316eb337caeea79046cindi
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#endif /* _SYS_IB_IBTL_IBTI_COMMON_H */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi