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) 2002-2003, Network Appliance, Inc. All rights reserved. 24 */ 25 26 /* 27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 28 * Use is subject to license terms. 29 */ 30 31 /* 32 * 33 * MODULE: dapl_ia_query.c 34 * 35 * PURPOSE: Interface Adapter management 36 * Description: Interfaces in this file are completely described in 37 * the DAPL 1.1 API, Chapter 6, section 2 38 * 39 * $Id: dapl_ia_query.c,v 1.20 2003/08/06 14:04:27 sjs2 Exp $ 40 */ 41 42 #include "dapl.h" 43 #include "dapl_adapter_util.h" 44 #include "dapl_vendor.h" 45 46 /* 47 * dapl_ia_query 48 * 49 * DAPL Requirements Version xxx, 6.2.1.3 50 * 51 * Provide the consumer with Interface Adapter and Provider parameters. 52 * 53 * Input: 54 * ia_handle 55 * ia_mask 56 * provider_mask 57 * 58 * Output: 59 * async_evd_handle 60 * ia_parameters 61 * provider_parameters 62 * 63 * Returns: 64 * DAT_SUCCESS 65 * DAT_INVALID_PARAMETER 66 */ 67 DAT_RETURN 68 dapl_ia_query( 69 IN DAT_IA_HANDLE ia_handle, 70 OUT DAT_EVD_HANDLE *async_evd_handle, 71 IN DAT_IA_ATTR_MASK ia_attr_mask, 72 OUT DAT_IA_ATTR *ia_attr, 73 IN DAT_PROVIDER_ATTR_MASK provider_attr_mask, 74 OUT DAT_PROVIDER_ATTR *provider_attr) 75 { 76 DAPL_IA *ia_ptr; 77 DAT_RETURN dat_status; 78 struct evd_merge_type { 79 DAT_BOOLEAN array[6][6]; 80 } *evd_merge; 81 int i; 82 int j; 83 84 dapl_dbg_log(DAPL_DBG_TYPE_API, 85 "dapl_ia_query (%p, %p, 0x%x, %p, 0x%x, %p)\n", 86 ia_handle, 87 async_evd_handle, 88 ia_attr_mask, 89 ia_attr, 90 provider_attr_mask, 91 provider_attr); 92 93 ia_ptr = (DAPL_IA *)ia_handle; 94 dat_status = DAT_SUCCESS; 95 96 if (DAPL_BAD_HANDLE(ia_ptr, DAPL_MAGIC_IA)) { 97 dat_status = DAT_ERROR(DAT_INVALID_HANDLE, 98 DAT_INVALID_HANDLE_IA); 99 goto bail; 100 } 101 102 if (NULL != async_evd_handle) { 103 *async_evd_handle = ia_ptr->async_error_evd; 104 } 105 106 if (ia_attr_mask & DAT_IA_ALL) { 107 if (NULL == ia_attr) { 108 dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, 109 DAT_INVALID_ARG4); 110 goto bail; 111 } 112 113 /* 114 * Obtain parameters from the HCA. Protect against multiple 115 * IAs beating on the HCA at the same time. 116 */ 117 dat_status = dapls_ib_query_hca(ia_ptr->hca_ptr, ia_attr, NULL, 118 NULL, NULL); 119 if (dat_status != DAT_SUCCESS) { 120 goto bail; 121 } 122 } 123 124 if (ia_attr_mask & ~DAT_IA_ALL) { 125 dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3); 126 goto bail; 127 } 128 129 if (provider_attr_mask & DAT_PROVIDER_FIELD_ALL) { 130 if (NULL == provider_attr) { 131 dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, 132 DAT_INVALID_ARG6); 133 goto bail; 134 } 135 136 (void) dapl_os_strncpy(provider_attr->provider_name, 137 ia_ptr->header.provider->device_name, 138 DAT_NAME_MAX_LENGTH); 139 provider_attr->provider_version_major = VN_PROVIDER_MAJOR; 140 provider_attr->provider_version_minor = VN_PROVIDER_MINOR; 141 provider_attr->dapl_version_major = DAT_VERSION_MAJOR; 142 provider_attr->dapl_version_minor = DAT_VERSION_MINOR; 143 provider_attr->lmr_mem_types_supported = 144 DAT_MEM_TYPE_VIRTUAL | DAT_MEM_TYPE_LMR; 145 #if VN_MEM_SHARED_VIRTUAL_SUPPORT > 0 146 provider_attr->lmr_mem_types_supported |= 147 DAT_MEM_TYPE_SHARED_VIRTUAL; 148 #endif 149 provider_attr->iov_ownership_on_return = DAT_IOV_CONSUMER; 150 provider_attr->dat_qos_supported = DAT_QOS_BEST_EFFORT; 151 provider_attr->completion_flags_supported = 152 DAT_COMPLETION_DEFAULT_FLAG; 153 provider_attr->is_thread_safe = DAT_FALSE; 154 provider_attr->max_private_data_size = 155 DAPL_CONSUMER_MAX_PRIVATE_DATA_SIZE; 156 provider_attr->supports_multipath = DAT_TRUE; 157 provider_attr->ep_creator = 158 DAT_PSP_CREATES_EP_NEVER; 159 provider_attr->optimal_buffer_alignment = 160 DAT_OPTIMAL_ALIGNMENT; 161 provider_attr->num_provider_specific_attr = 0; 162 provider_attr->srq_supported = DAT_TRUE; 163 /* 164 * 0x000 no watermarks support 165 * 0x001 low watermark support 166 * 0x010 soft high watermark support 167 * 0x100 hard high watermark support 168 */ 169 provider_attr->srq_watermarks_supported = 0x00; 170 provider_attr->srq_ep_pz_difference_supported = DAT_FALSE; 171 /* 172 * 0x01 available_dto_count 173 * 0x10 outstanding_dto_count 174 */ 175 provider_attr->srq_info_supported = 0x10; 176 /* 177 * 0x00 no ep recv info support 178 * 0x01 nbufs_allocated returned from dat_ep_recv_query 179 * 0x10 bufs_alloc_span returned from dat_ep_recv_query 180 */ 181 provider_attr->ep_recv_info_supported = 0; 182 /* 183 * we want the application to use the lmr_sync_rdma 184 * as a programming model and thus always true from the 185 * provider perspective. dat_registry will return success 186 * to consumers on platforms with coherent memory 187 */ 188 provider_attr->lmr_sync_req = DAT_TRUE; 189 provider_attr->dto_async_return_guaranteed = DAT_FALSE; 190 provider_attr->rdma_write_for_rdma_read_req = DAT_FALSE; 191 provider_attr->provider_specific_attr = NULL; 192 /* 193 * Set up evd_stream_merging_supported options. Note there is 194 * one bit per allowable combination, using the ordinal 195 * position of the DAT_EVD_FLAGS as positions in the 196 * array. e.g. 197 * [0][0] is DAT_EVD_SOFTWARE_FLAG | DAT_EVD_SOFTWARE_FLAG, 198 * [0][1] is DAT_EVD_SOFTWARE_FLAG | DAT_EVD_CR_FLAG, and 199 * [2][4] is DAT_EVD_DTO_FLAG | DAT_EVD_RMR_BIND_FLAG 200 * 201 * Most combinations are true, so initialize the array that way. 202 * Then finish by resetting the bad combinations. 203 */ 204 205 evd_merge = (struct evd_merge_type *)&provider_attr-> 206 evd_stream_merging_supported[0][0]; 207 for (i = 0; i < 6; i++) { 208 for (j = 0; j < 6; j++) { 209 if (j == 5 || i == 5) { 210 /* DAT_EVD_ASYNC_FLAG is disallowed */ 211 evd_merge->array[i][j] = DAT_FALSE; 212 } else { 213 evd_merge->array[i][j] = DAT_TRUE; 214 } 215 } 216 } 217 } 218 219 bail: 220 dapl_dbg_log(DAPL_DBG_TYPE_RTN, 221 "dapl_ia_query () returns 0x%x\n", 222 dat_status); 223 224 return (dat_status); 225 } 226 227 /* 228 * Local variables: 229 * c-indent-level: 4 230 * c-basic-offset: 4 231 * tab-width: 8 232 * End: 233 */ 234