docs/how-to-build.md: use proper markup for directory names
[unleashed/tickless.git] / include / sys / ib / mgt / ibdma / ibdma_impl.h
blob6c993791298c61a8726f7fce3580915ff2c2516c
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 #ifndef _IBDMA_IMPL_H
27 #define _IBDMA_IMPL_H
30 * ibdma_impl.h
32 * Device Management Agent private prototypes and structures.
35 #ifdef __cpluplus
36 extern "C" {
37 #endif
39 #include <sys/ib/ibtl/ibvti.h> /* IB verrbs interfaces */
40 #include <sys/ib/mgt/ib_dm_attr.h> /* IB DM defines/structures */
41 #include <sys/ib/mgt/ib_mad.h> /* IB MAD defines/structures */
43 enum {
44 IBDMA_MAD_SIZE = 256,
45 IBDMA_DM_MAD_HDR_SIZE = 40,
46 IBDMA_DM_RESP_TIME = 20,
47 IBDMA_MAX_IOC = 16
51 * Implementation of handle returned to consumer.
53 typedef struct ibdma_hdl_impl_s {
54 list_node_t ih_node;
55 ib_guid_t ih_iou_guid;
56 uint8_t ih_ioc_ndx;
57 } ibdma_hdl_impl_t;
60 * Each I/O Controller slot for the I/O Unit.
62 typedef struct ibdma_ioc_s {
63 uint8_t ii_inuse;
65 * Just to map handle back to slot number and hca
67 int ii_slot;
68 struct ibdma_hca_s *ii_hcap;
71 * Profile provided by the I/O Controller, must be stored
72 * in network order. Note that the profile indicates the
73 * number of service entries pointed to by ii_srvcs.
75 ib_dm_ioc_ctrl_profile_t ii_profile;
76 ib_dm_srv_t *ii_srvcs;
77 } ibdma_ioc_t;
80 * The ibdma_hca_t structure is only used internally by the
81 * IB DM Agent. It is created when the associated HCA is
82 * opened as part of initialization or as a result of a
83 * notification via IBTF. It is destroyed when the HCA
84 * is closed as part of fini processing or as a result of
85 * a notification via IBTF. The structure is not directly
86 * accessed by IBMF call-backs or the consumer API.
88 typedef struct ibdma_port_s {
89 ibmf_handle_t ip_ibmf_hdl;
90 ibmf_register_info_t ip_ibmf_reg;
91 ibmf_impl_caps_t ip_ibmf_caps;
92 struct ibdma_hca_s *ip_hcap;
93 } ibdma_port_t;
95 typedef struct ibdma_hca_s {
96 list_node_t ih_node;
97 ibt_hca_hdl_t ih_ibt_hdl;
100 * Consumer handles associated with I/O Controllers
101 * that have registered with this I/O Unit.
103 list_t ih_hdl_list;
106 * The I/O Unit that is presented to the IB Fabric.
107 * It is stored in network order.
109 krwlock_t ih_iou_rwlock;
110 ib_guid_t ih_iou_guid;
111 ib_dm_io_unitinfo_t ih_iou;
112 ibdma_ioc_t ih_ioc[IBDMA_MAX_IOC];
113 uint8_t ih_nports;
114 ibdma_port_t ih_port[1];
115 } ibdma_hca_t;
119 * The IBDMA module state information created and initialized
120 * at _init() and freed at _fini().
122 typedef struct ibdma_mod_state_s {
123 ibt_clnt_hdl_t ms_ibt_hdl;
126 * The HCA list lock is used protect the HCA list and
127 * is held during consumer routines (in place of a
128 * reference count) to ensure the HCA exists for the
129 * duration of it's use in the routine.
131 kmutex_t ms_hca_list_lock;
132 list_t ms_hca_list;
133 uint_t ms_num_hcas;
135 } ibdma_mod_state_t;
139 * Client API internal helpers
141 typedef enum ibdma_ioc_state_e {
142 IBDMA_IOC_NOT_INSTALLED = 0,
143 IBDMA_IOC_PRESENT = 1,
144 IBDMA_IOC_DOES_NOT_EXIST = 255,
145 IBDMA_HDL_MAGIC = 0x00931000
146 } ibdma_ioc_state_t;
148 static void
149 ibdma_set_ioc_state(ibdma_hca_t *hca, int slot, ibdma_ioc_state_t state);
150 static ibdma_ioc_state_t ibdma_get_ioc_state(ibdma_hca_t *hca, int slot);
152 #endif /* _IBDMA_IMPL_H */