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 (c) 2010, Oracle and/or its affiliates. All rights reserved. 24 */ 25 26 /* 27 * This is the Solaris uCMA header file. This contains Solaris specific 28 * data structures and defines for the sol_ucma driver. 29 */ 30 #ifndef _SYS_IB_CLIENTS_OF_SOL_UCMA_SOL_UCMA_H 31 #define _SYS_IB_CLIENTS_OF_SOL_UCMA_SOL_UCMA_H 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #include <sys/types.h> 38 #include <sys/ksynch.h> 39 #include <sys/ib/clients/of/ofa_solaris.h> 40 #include <sys/ib/clients/of/sol_ofs/sol_ofs_common.h> 41 #include <sys/ib/clients/of/sol_ucma/sol_rdma_user_cm.h> 42 43 /* 44 * MAX Number of PATHS supported. This is the same as 45 * supported by RDMA CM library API revisit - TBD 46 * 47 * MAX Number of Listens supported 48 */ 49 #define SOL_UCMA_MAX_PATHS 2 50 #define SOL_UCMA_MAX_LISTEN 128 51 52 /* Defines for file_evt_close_flag */ 53 #define SOL_UCMA_EVT_NONE 0x00 54 #define SOL_UCMA_EVT_PROGRESS 0x01 55 #define SOL_UCMA_EVT_DISABLED 0x02 56 57 /* 58 * RDMA-CM Event File structure 59 */ 60 typedef struct { 61 sol_ofs_uobj_t file_uobj; 62 kmutex_t file_mutex; 63 genlist_t file_id_list; 64 65 /* 66 * Events data 67 * pollhead - for chpoll(9e) 68 * event_cv - for blocking wait at GET_EVENT 69 * evt_list - List of Events 70 * pending_evt_cnt - Pending Events to be pushed 71 * to userland. 72 */ 73 struct pollhead *file_pollhead; 74 kcondvar_t file_evt_cv; 75 kcondvar_t file_evt_close_cv; 76 genlist_t file_evt_list; 77 uint32_t file_pending_evt_cnt; 78 uint8_t file_evt_close_flag; 79 } sol_ucma_file_t; 80 81 typedef enum { 82 SOL_UCMA_FLUSH_QP_NONE, 83 SOL_UCMA_FLUSH_QP_DONE, 84 SOL_UCMA_FLUSH_QP_PENDING, 85 } sol_ucma_flush_qp_t; 86 87 /* 88 * Structure for each IDs created using rdma_create_id() 89 */ 90 #define SOL_UCMA_CHAN_CONNECT_FLAG 0x01 91 92 typedef struct { 93 sol_ofs_uobj_t chan_uobj; 94 kmutex_t chan_mutex; 95 genlist_entry_t *chan_list_ent; 96 sol_ucma_file_t *chan_file; 97 98 /* Channel id and user ID for this Channel */ 99 uint32_t chan_id; 100 uint64_t chan_user_id; 101 102 /* Total events for this channel */ 103 uint32_t chan_evt_cnt; 104 105 /* rdma_cm_id for this channel */ 106 struct rdma_cm_id *chan_rdma_id; 107 108 uint32_t chan_qp_num; 109 void *chan_qp_hdl; 110 111 /* Flush QP flag for this channel */ 112 sol_ucma_flush_qp_t chan_flush_qp_flag; 113 114 int chan_backlog; 115 116 uint16_t chan_flags; 117 } sol_ucma_chan_t; 118 119 typedef struct sol_ucma_mcast_s { 120 sol_ofs_uobj_t mcast_uobj; 121 uint64_t mcast_uid; 122 uint32_t mcast_id; 123 sol_ucma_chan_t *mcast_chan; 124 struct sockaddr mcast_addr; 125 uint32_t mcast_events; 126 } sol_ucma_mcast_t; 127 128 /* 129 * UCMA Event Structure 130 */ 131 typedef struct sol_ucma_event_s { 132 sol_ucma_event_resp_t event_resp; 133 sol_ucma_chan_t *event_chan; 134 sol_ucma_mcast_t *event_mcast; 135 } sol_ucma_event_t; 136 137 /* 138 * Global structure for Solaris UCMA Driver. 139 */ 140 #define SOL_UCMA_CLNT_HDL_UNINITIALIZED 0x00 141 #define SOL_UCMA_CLNT_HDL_INITIALIZING 0x01 142 #define SOL_UCMA_CLNT_HDL_INITIALIZED 0x02 143 typedef struct sol_ucma_s { 144 kmutex_t ucma_mutex; 145 kcondvar_t ucma_open_cv; 146 dev_info_t *ucma_dip; 147 uint_t ucma_num_file; 148 149 ldi_ident_t ucma_ldi_ident; 150 ldi_handle_t ucma_ldi_hdl; 151 ddi_modhandle_t ucma_mod_hdl; 152 153 void *ucma_ib_clnt_hdl; 154 void *ucma_iw_clnt_hdl; 155 156 /* Client Handle flag */ 157 uint8_t ucma_clnt_hdl_flag; 158 } sol_ucma_t; 159 160 #ifdef __cplusplus 161 } 162 #endif 163 164 #endif /* _SYS_IB_CLIENTS_OF_SOL_UCMA_SOL_UCMA_H */ 165