xref: /illumos-gate/usr/src/uts/common/sys/ib/mgt/ibdma/ibdma.h (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _IBDMA_H
28 #define	_IBDMA_H
29 
30 /*
31  * ibdma.h
32  *
33  * Device Management Agent prototypes and structures shared with
34  * consumer (I/O Controller) via client API.
35  */
36 
37 /*
38  * The Infiniband Device Management Agent manages an I/O Unit
39  * for each IB HCA, providing a common view to of the I/O Unit
40  * that presents protocol specific I/O Controllers.
41  *
42  * By default, the I/O Unit is unpopulated with I/O Controllers.  Each
43  * underlying protocol transport registers their I/O Controller with
44  * the respective I/O Unit (HCA) providing their I/O Controller profile
45  * and the services they are making available.  As services change, the
46  * the transport protocol calls back into the IB DMA to update their
47  * profile and services.
48  */
49 
50 #ifdef	__cplusplus
51 extern "C" {
52 #endif
53 
54 #include <sys/ib/mgt/ibmf/ibmf.h>
55 #include <sys/ib/mgt/ib_dm_attr.h>
56 
57 typedef enum ibdma_status_e {
58 	IBDMA_SUCCESS		= 0,	/* good status */
59 	IBDMA_IOC_DUPLICATE,		/* IOC GUID already exists */
60 	IBDMA_IOU_FULL,			/* No slots available in IOU */
61 	IBDMA_BAD_IOC_PROFILE,		/* IOC profile disparity */
62 	IBDMA_BAD_PARAM			/* Invalid function parameter */
63 } ibdma_status_t;
64 
65 /*
66  * I/O Controller Provider API.
67  *
68  * The DM Agent responds to I/O Unit requests on all IB fabric ports
69  * in the system, setting each ports "isDeviceManagementSupported" bit.
70  *
71  * I/O Controllers must register their IOC profile and associated
72  * services with the DM Agent.  The DM Agent will assign a
73  * I/O Unit slot to the I/O Controller at that time.
74  */
75 typedef void*  ibdma_hdl_t;
76 
77 /*
78  * Register an IOC.
79  *
80  * Returns a handle used to un-register or update the IOC
81  * profile/services information.
82  */
83 ibdma_hdl_t  ibdma_ioc_register(ib_guid_t ioc_guid,
84 	ib_dm_ioc_ctrl_profile_t *profile, ib_dm_srv_t *services);
85 
86 /*
87  * Un-Register an IOC.
88  */
89 ibdma_status_t ibdma_ioc_unregister(ibdma_hdl_t hdl);
90 
91 /*
92  * Update a previously register IOC profile/services.
93  */
94 ibdma_status_t ibdma_ioc_update(ibdma_hdl_t hdl,
95 	ib_dm_ioc_ctrl_profile_t *profile, ib_dm_srv_t *services);
96 
97 #ifdef	__cplusplus
98 }
99 #endif
100 
101 #endif /* _IBDMA_H */
102