c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This file contains definitions used in OFED defined user/kernel
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * interfaces. These are imported from the OFED header ib_verbs.h. Oracle
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * elects to have and use the contents of ib_verbs.h under and governed
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * by the OpenIB.org BSD license (see below for full license text). However,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * the following notice accompanied the original version of this file:
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2004 Infinicon Corporation. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2004 Intel Corporation. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2004 Topspin Corporation. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2005, 2006, 2007 Cisco Systems. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This software is available to you under a choice of one of two
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * licenses. You may choose to be licensed under the terms of the GNU
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * General Public License (GPL) Version 2, available from the file
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * COPYING in the main directory of this source tree, or the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * OpenIB.org BSD license below:
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Redistribution and use in source and binary forms, with or
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * without modification, are permitted provided that the following
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * conditions are met:
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * - Redistributions of source code must retain the above
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * copyright notice, this list of conditions and the following
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * disclaimer.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * - Redistributions in binary form must reproduce the above
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * copyright notice, this list of conditions and the following
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * disclaimer in the documentation and/or other materials
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * provided with the distribution.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * SOFTWARE.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifndef _SYS_IB_CLIENTS_OF_IB_VERBS_H
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define _SYS_IB_CLIENTS_OF_IB_VERBS_H
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef __cplusplus
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarextern "C" {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/atomic.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/mutex.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/ib/ibtl/ibvti.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/ib/clients/of/ofa_solaris.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/ib/clients/of/sol_ofs/sol_ofs_common.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef struct sol_ofs_client_s *ofs_client_p_t;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarunion ib_gid {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t raw[16];
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t subnet_prefix;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t interface_id;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } global;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum rdma_node_type {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /* IB values map to NodeInfo:NodeType. */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar RDMA_NODE_IB_CA = 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar RDMA_NODE_IB_SWITCH,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar RDMA_NODE_IB_ROUTER,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar RDMA_NODE_RNIC
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum rdma_transport_type {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar RDMA_TRANSPORT_IB,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar RDMA_TRANSPORT_IWARP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define __attribute_const__ __attribute__((__const__))
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum rdma_transport_type
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarrdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_device_cap_flags {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_RESIZE_MAX_WR = 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_BAD_PKEY_CNTR = (1<<1),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_BAD_QKEY_CNTR = (1<<2),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_RAW_MULTI = (1<<3),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_AUTO_PATH_MIG = (1<<4),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_CHANGE_PHY_PORT = (1<<5),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_UD_AV_PORT_ENFORCE = (1<<6),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_CURR_QP_STATE_MOD = (1<<7),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_SHUTDOWN_PORT = (1<<8),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_INIT_TYPE = (1<<9),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_PORT_ACTIVE_EVENT = (1<<10),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_SYS_IMAGE_GUID = (1<<11),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_RC_RNR_NAK_GEN = (1<<12),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_SRQ_RESIZE = (1<<13),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_N_NOTIFY_CQ = (1<<14),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_ZERO_STAG = (1<<15),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_SEND_W_INV = (1<<16),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_MEM_WINDOW = (1<<17)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_atomic_cap {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_ATOMIC_NONE,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_ATOMIC_HCA,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_ATOMIC_GLOB
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_device_attr {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t fw_ver;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t sys_image_guid;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t max_mr_size;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t page_size_cap;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t vendor_id;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t vendor_part_id;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t hw_ver;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_qp;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_qp_wr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int device_cap_flags;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_sge;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_sge_rd;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_cq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_cqe;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_mr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_pd;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_qp_rd_atom;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_ee_rd_atom;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_res_rd_atom;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_qp_init_rd_atom;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_ee_init_rd_atom;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_atomic_cap atomic_cap;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_ee;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_rdd;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_mw;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_raw_ipv6_qp;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_raw_ethy_qp;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_mcast_grp;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_mcast_qp_attach;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_total_mcast_qp_attach;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_ah;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_fmr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_map_per_fmr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_srq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_srq_wr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int max_srq_sge;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint16_t max_pkeys;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t local_ca_ack_delay;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_mtu {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar OFED_IB_MTU_256 = 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar OFED_IB_MTU_512 = 2,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar OFED_IB_MTU_1024 = 3,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar OFED_IB_MTU_2048 = 4,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar OFED_IB_MTU_4096 = 5
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_port_state {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_NOP = 0,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_DOWN = 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_INIT = 2,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_ARMED = 3,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_ACTIVE = 4,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_ACTIVE_DEFER = 5
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_port_cap_flags {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_SM = 1 << 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_NOTICE_SUP = 1 << 2,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_TRAP_SUP = 1 << 3,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_OPT_IPD_SUP = 1 << 4,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_AUTO_MIGR_SUP = 1 << 5,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_SL_MAP_SUP = 1 << 6,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_MKEY_NVRAM = 1 << 7,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_PKEY_NVRAM = 1 << 8,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_LED_INFO_SUP = 1 << 9,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_SM_DISABLED = 1 << 10,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_SYS_IMAGE_GUID_SUP = 1 << 11,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_CM_SUP = 1 << 16,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_SNMP_TUNNEL_SUP = 1 << 17,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_REINIT_SUP = 1 << 18,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_DEVICE_MGMT_SUP = 1 << 19,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_VENDOR_CLASS_SUP = 1 << 20,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_DR_NOTICE_SUP = 1 << 21,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_CAP_MASK_NOTICE_SUP = 1 << 22,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_BOOT_MGMT_SUP = 1 << 23,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_LINK_LATENCY_SUP = 1 << 24,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_CLIENT_REG_SUP = 1 << 25
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_port_width {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WIDTH_1X = 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WIDTH_4X = 2,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WIDTH_8X = 4,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WIDTH_12X = 8
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstatic inline int ib_width_enum_to_int(enum ib_port_width width)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar{
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar switch (width) {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar case IB_WIDTH_1X: return 1;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar case IB_WIDTH_4X: return 4;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar case IB_WIDTH_8X: return 8;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar case IB_WIDTH_12X: return 12;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar default: return -1;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar }
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar}
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_port_attr {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_port_state state;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_mtu max_mtu;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_mtu active_mtu;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int gid_tbl_len;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t port_cap_flags;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t max_msg_sz;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t bad_pkey_cntr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t qkey_viol_cntr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint16_t pkey_tbl_len;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint16_t lid;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint16_t sm_lid;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t lmc;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t max_vl_num;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t sm_sl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t subnet_timeout;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t init_type_reply;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t active_width;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t active_speed;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t phys_state;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_device_modify_flags {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_MODIFY_SYS_IMAGE_GUID = 1 << 0,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEVICE_MODIFY_NODE_DESC = 1 << 1
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_device_modify {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t sys_image_guid;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar char node_desc[64];
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_port_modify_flags {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_SHUTDOWN = 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_INIT_TYPE = (1<<2),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_PORT_RESET_QKEY_CNTR = (1<<3)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_port_modify {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t set_port_cap_mask;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t clr_port_cap_mask;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t init_type;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_event_type {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_CQ_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_QP_FATAL,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_QP_REQ_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_QP_ACCESS_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_COMM_EST,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_SQ_DRAINED,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_PATH_MIG,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_PATH_MIG_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_DEVICE_FATAL,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_PORT_ACTIVE,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_PORT_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_LID_CHANGE,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_PKEY_CHANGE,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_SM_CHANGE,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_SRQ_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_SRQ_LIMIT_REACHED,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_QP_LAST_WQE_REACHED,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_EVENT_CLIENT_REREGISTER
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_event {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_device *device;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar union {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_cq *cq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_qp *qp;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_srq *srq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t port_num;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } element;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_event_type event;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_event_handler {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_device *device;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void (*handler)(struct ib_event_handler *,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_event *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar llist_head_t list;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_global_route {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar union ib_gid dgid;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t flow_label;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t sgid_index;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t hop_limit;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t traffic_class;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_ah_flags {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_AH_GRH = 1
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_rate {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RATE_PORT_CURRENT = 0,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RATE_2_5_GBPS = 2,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RATE_5_GBPS = 5,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RATE_10_GBPS = 3,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RATE_20_GBPS = 6,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RATE_30_GBPS = 4,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RATE_40_GBPS = 7,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RATE_60_GBPS = 8,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RATE_80_GBPS = 9,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RATE_120_GBPS = 10
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_ah_attr {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_global_route grh;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint16_t dlid;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t sl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t src_path_bits;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t static_rate;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t ah_flags;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t port_num;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_wc_status {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_SUCCESS,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_LOC_LEN_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_LOC_QP_OP_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_LOC_EEC_OP_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_LOC_PROT_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_WR_FLUSH_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_MW_BIND_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_BAD_RESP_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_LOC_ACCESS_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_REM_INV_REQ_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_REM_ACCESS_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_REM_OP_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_RETRY_EXC_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_RNR_RETRY_EXC_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_LOC_RDD_VIOL_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_REM_INV_RD_REQ_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_REM_ABORT_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_INV_EECN_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_INV_EEC_STATE_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_FATAL_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_RESP_TIMEOUT_ERR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_GENERAL_ERR
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_wc_opcode {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_SEND,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_RDMA_WRITE,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_RDMA_READ,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_COMP_SWAP,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_FETCH_ADD,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_BIND_MW,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Set value of IB_WC_RECV so consumers can test if a completion is a
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * receive by testing (opcode & IB_WC_RECV).
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_RECV = 1 << 7,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_RECV_RDMA_WITH_IMM
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_wc_flags {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_GRH = 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WC_WITH_IMM = (1<<1),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_wc {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t wr_id;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_wc_status status;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_wc_opcode opcode;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t vendor_err;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t byte_len;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_qp *qp;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t imm_data;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t src_qp;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int wc_flags;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint16_t pkey_index;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint16_t slid;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t sl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t dlid_path_bits;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t port_num;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_cq_notify_flags {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_CQ_SOLICITED = 1 << 0,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_CQ_NEXT_COMP = 1 << 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_CQ_SOLICITED_MASK = IB_CQ_SOLICITED | IB_CQ_NEXT_COMP,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_CQ_REPORT_MISSED_EVENTS = 1 << 2,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_srq_attr_mask {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_SRQ_MAX_WR = 1 << 0,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_SRQ_LIMIT = 1 << 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_srq_attr {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t max_wr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t max_sge;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t srq_limit;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_srq_init_attr {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void (*event_handler)(struct ib_event *, void *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void *srq_context;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_srq_attr attr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_qp_cap {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t max_send_wr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t max_recv_wr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t max_send_sge;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t max_recv_sge;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t max_inline_data;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_sig_type {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_SIGNAL_ALL_WR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_SIGNAL_REQ_WR
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_qp_type {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * IB_QPT_SMI and IB_QPT_GSI have to be the first two entries
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * here (and in that order) since the MAD layer uses them as
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * indices into a 2-entry table.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPT_SMI,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPT_GSI,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPT_RC,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPT_UC,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPT_UD,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPT_RAW_IPV6,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPT_RAW_ETY
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_qp_init_attr {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void (*event_handler)(struct ib_event *, void *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void *qp_context;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_cq *send_cq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_cq *recv_cq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_srq *srq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_qp_cap cap;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_sig_type sq_sig_type;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_qp_type qp_type;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t port_num; /* special QP types only */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_rnr_timeout {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_655_36 = 0,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_01 = 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_02 = 2,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_03 = 3,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_04 = 4,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_06 = 5,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_08 = 6,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_12 = 7,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_16 = 8,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_24 = 9,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_32 = 10,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_48 = 11,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_64 = 12,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_000_96 = 13,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_001_28 = 14,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_001_92 = 15,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_002_56 = 16,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_003_84 = 17,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_005_12 = 18,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_007_68 = 19,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_010_24 = 20,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_015_36 = 21,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_020_48 = 22,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_030_72 = 23,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_040_96 = 24,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_061_44 = 25,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_081_92 = 26,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_122_88 = 27,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_163_84 = 28,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_245_76 = 29,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_327_68 = 30,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_RNR_TIMER_491_52 = 31
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_qp_attr_mask {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_STATE = 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_CUR_STATE = (1<<1),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_EN_SQD_ASYNC_NOTIFY = (1<<2),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_ACCESS_FLAGS = (1<<3),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_PKEY_INDEX = (1<<4),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_PORT = (1<<5),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_QKEY = (1<<6),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_AV = (1<<7),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_PATH_MTU = (1<<8),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_TIMEOUT = (1<<9),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_RETRY_CNT = (1<<10),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_RNR_RETRY = (1<<11),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_RQ_PSN = (1<<12),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_MAX_QP_RD_ATOMIC = (1<<13),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_ALT_PATH = (1<<14),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_MIN_RNR_TIMER = (1<<15),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_SQ_PSN = (1<<16),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_MAX_DEST_RD_ATOMIC = (1<<17),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_PATH_MIG_STATE = (1<<18),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_CAP = (1<<19),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QP_DEST_QPN = (1<<20)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_qp_state {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPS_RESET,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPS_INIT,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPS_RTR,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPS_RTS,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPS_SQD,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPS_SQE,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_QPS_ERR
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_mig_state {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_MIG_MIGRATED,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_MIG_REARM,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_MIG_ARMED
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_qp_attr {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_qp_state qp_state;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_qp_state cur_qp_state;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_mtu path_mtu;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_mig_state path_mig_state;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t qkey;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t rq_psn;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t sq_psn;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t dest_qp_num;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int qp_access_flags;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_qp_cap cap;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_ah_attr ah_attr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_ah_attr alt_ah_attr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint16_t pkey_index;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint16_t alt_pkey_index;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t en_sqd_async_notify;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t sq_draining;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t max_rd_atomic;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t max_dest_rd_atomic;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t min_rnr_timer;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t port_num;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t timeout;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t retry_cnt;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t rnr_retry;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t alt_port_num;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t alt_timeout;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_wr_opcode {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WR_RDMA_WRITE,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WR_RDMA_WRITE_WITH_IMM,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WR_SEND,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WR_SEND_WITH_IMM,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WR_RDMA_READ,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WR_ATOMIC_CMP_AND_SWP,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_WR_ATOMIC_FETCH_AND_ADD
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarenum ib_access_flags {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_ACCESS_LOCAL_WRITE = 1,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_ACCESS_REMOTE_WRITE = (1<<1),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_ACCESS_REMOTE_READ = (1<<2),
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_ACCESS_REMOTE_ATOMIC = (1<<3),
fffafeb2cc01732fd6a28ed530e4424094685eceJohnny Cheung IB_ACCESS_MW_BIND = (1<<4),
fffafeb2cc01732fd6a28ed530e4424094685eceJohnny Cheung IB_ACCESS_SO = (1<<5) /* MR with Strong Ordering */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_pd {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_device *device;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar ibt_pd_hdl_t ibt_pd;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef void (*ib_comp_handler)(struct ib_cq *cq, void *cq_context);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_cq {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_device *device;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar ib_comp_handler comp_handler;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void (*event_handler)(struct ib_event *, void *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void *cq_context;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int cqe;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar ibt_cq_hdl_t ibt_cq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar kmutex_t lock;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_srq {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_device *device;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_pd *pd;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void (*event_handler)(struct ib_event *, void *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void *srq_context;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar ibt_srq_hdl_t ibt_srq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct ib_qp {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_device *device;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_pd *pd;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_cq *send_cq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_cq *recv_cq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct ib_srq *srq;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void (*event_handler)(struct ib_event *, void *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void *qp_context;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t qp_num;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum ib_qp_type qp_type;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar ibt_qp_hdl_t ibt_qp;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar kmutex_t lock;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar};
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define IB_DEVICE_NAME_MAX 64
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef struct ib_device {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar ibt_hca_hdl_t hca_hdl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar char name[IB_DEVICE_NAME_MAX];
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t node_guid;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t local_dma_lkey;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t phys_port_cnt;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t node_type;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEV_UNINITIALIZED,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEV_REGISTERED,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEV_UNREGISTERED,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEV_CLOSE = 100,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_DEV_OPEN
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } reg_state;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void *data;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar ofs_client_p_t clnt_hdl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct llist_head list;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar} ib_device_t;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef struct ib_client {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar char *name;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void (*add) (struct ib_device *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void (*remove)(struct ib_device *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar dev_info_t *dip;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar ofs_client_p_t clnt_hdl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar enum {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_CLNT_UNINITIALIZED,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar IB_CLNT_INITIALIZED
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar } state;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar} ib_client_t;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaint ib_register_client(struct ib_client *client);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otavoid ib_unregister_client(struct ib_client *client);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otavoid *ib_get_client_data(struct ib_device *device, struct ib_client *client);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otavoid ib_set_client_data(struct ib_device *device, struct ib_client *client,
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota void *data);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaint ib_query_device(struct ib_device *device,
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota struct ib_device_attr *device_attr);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * ib_alloc_pd - Allocates an unused protection domain.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @device: The device on which to allocate the protection domain.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota *
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * A protection domain object provides an association between QPs, shared
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * receive queues, address handles, memory regions, and memory windows.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otastruct ib_pd *ib_alloc_pd(struct ib_device *device);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * ib_dealloc_pd - Deallocates a protection domain.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @pd: The protection domain to deallocate.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaint ib_dealloc_pd(struct ib_pd *pd);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * ib_create_qp - Creates a QP associated with the specified protection
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * domain.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @pd: The protection domain associated with the QP.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @qp_init_attr: A list of initial attributes required to create the
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * QP. If QP creation succeeds, then the attributes are updated to
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * the actual capabilities of the created QP.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otastruct ib_qp *ib_create_qp(struct ib_pd *pd,
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota struct ib_qp_init_attr *qp_init_attr);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * ib_modify_qp - Modifies the attributes for the specified QP and then
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * transitions the QP to the given state.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @qp: The QP to modify.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @qp_attr: On input, specifies the QP attributes to modify. On output,
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * the current values of selected QP attributes are returned.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @qp_attr_mask: A bit-mask used to specify which attributes of the QP
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * are being modified.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaint ib_modify_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota int qp_attr_mask);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * ib_destroy_qp - Destroys the specified QP.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @qp: The QP to destroy.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaint ib_destroy_qp(struct ib_qp *qp);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
cadbfdc3bdb156e92d7a88978bc98ea87f6e037fEiji Ota/*
cadbfdc3bdb156e92d7a88978bc98ea87f6e037fEiji Ota * IB_CQ_VECTOR_LEAST_ATTACHED: The constant specifies that
cadbfdc3bdb156e92d7a88978bc98ea87f6e037fEiji Ota * the CQ will be attached to the completion vector that has
cadbfdc3bdb156e92d7a88978bc98ea87f6e037fEiji Ota * the least number of CQs already attached to it.
cadbfdc3bdb156e92d7a88978bc98ea87f6e037fEiji Ota */
cadbfdc3bdb156e92d7a88978bc98ea87f6e037fEiji Ota#define IB_CQ_VECTOR_LEAST_ATTACHED 0xffffffff
cadbfdc3bdb156e92d7a88978bc98ea87f6e037fEiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * ib_create_cq - Creates a CQ on the specified device.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @device: The device on which to create the CQ.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @comp_handler: A user-specified callback that is invoked when a
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * completion event occurs on the CQ.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @event_handler: A user-specified callback that is invoked when an
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * asynchronous event not associated with a completion occurs on the CQ.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @cq_context: Context associated with the CQ returned to the user via
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * the associated completion and event handlers.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @cqe: The minimum size of the CQ.
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor * @comp_vector - Completion queue sched handle.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota *
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Users can examine the cq structure to determine the actual CQ size.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otastruct ib_cq *ib_create_cq(struct ib_device *device,
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota ib_comp_handler comp_handler,
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota void (*event_handler)(struct ib_event *, void *),
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor void *cq_context, int cqe, void *comp_vector);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * ib_destroy_cq - Destroys the specified CQ.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @cq: The CQ to destroy.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaint ib_destroy_cq(struct ib_cq *cq);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * ib_poll_cq - poll a CQ for completion(s)
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @cq:the CQ being polled
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @num_entries:maximum number of completions to return
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @wc:array of at least @num_entries &struct ib_wc where completions
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * will be returned
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota *
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Poll a CQ for (possibly multiple) completions. If the return value
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * is < 0, an error occurred. If the return value is >= 0, it is the
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * number of completions returned. If the return value is
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * non-negative and < num_entries, then the CQ was emptied.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaint ib_poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota/*
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * ib_req_notify_cq - Request completion notification on a CQ.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @cq: The CQ to generate an event for.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * @flags:
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Must contain exactly one of %IB_CQ_SOLICITED or %IB_CQ_NEXT_COMP
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * to request an event on the next solicited event or next work
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * completion at any type, respectively. %IB_CQ_REPORT_MISSED_EVENTS
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * may also be |ed in to request a hint about missed events, as
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * described below.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota *
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * Return Value:
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * < 0 means an error occurred while requesting notification
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * == 0 means notification was requested successfully, and if
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * IB_CQ_REPORT_MISSED_EVENTS was passed in, then no events
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * were missed and it is safe to wait for another event. In
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * this case is it guaranteed that any work completions added
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * to the CQ since the last CQ poll will trigger a completion
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * notification event.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * > 0 is only returned if IB_CQ_REPORT_MISSED_EVENTS was passed
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * in. It means that the consumer must poll the CQ again to
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * make sure it is empty to avoid missing an event because of a
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * race between requesting notification and an entry being
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * added to the CQ. This return value means it is possible
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * (but not guaranteed) that a work completion has been added
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * to the CQ since the last poll without triggering a
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota * completion notification event.
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota */
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaint ib_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags flags);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otastruct rdma_cm_id;
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaibt_hca_hdl_t ib_get_ibt_hca_hdl(struct ib_device *device);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaibt_channel_hdl_t
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Otaib_get_ibt_channel_hdl(struct rdma_cm_id *cm);
c0dd49bdd68c0d758a67d56f07826f3b45cfc664Eiji Ota
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef __cplusplus
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar}
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif /* _SYS_IB_CLIENTS_OF_IB_VERBS_H */