| 1 |
/* |
| 2 |
* Copyright (c) 2002-2006, Network Appliance, Inc. All rights reserved. |
| 3 |
* |
| 4 |
* This Software is licensed under one of the following licenses: |
| 5 |
* |
| 6 |
* 1) under the terms of the "Common Public License 1.0" a copy of which is |
| 7 |
* in the file LICENSE.txt in the root directory. The license is also |
| 8 |
* available from the Open Source Initiative, see |
| 9 |
* http://www.opensource.org/licenses/cpl.php. |
| 10 |
* |
| 11 |
* 2) under the terms of the "The BSD License" a copy of which is in the file |
| 12 |
* LICENSE2.txt in the root directory. The license is also available from |
| 13 |
* the Open Source Initiative, see |
| 14 |
* http://www.opensource.org/licenses/bsd-license.php. |
| 15 |
* |
| 16 |
* 3) under the terms of the "GNU General Public License (GPL) Version 2" a |
| 17 |
* copy of which is in the file LICENSE3.txt in the root directory. The |
| 18 |
* license is also available from the Open Source Initiative, see |
| 19 |
* http://www.opensource.org/licenses/gpl-license.php. |
| 20 |
* |
| 21 |
* Licensee has the right to choose one of the above licenses. |
| 22 |
* |
| 23 |
* Redistributions of source code must retain the above copyright |
| 24 |
* notice and one of the license notices. |
| 25 |
* |
| 26 |
* Redistributions in binary form must reproduce both the above copyright |
| 27 |
* notice, one of the license notices in the documentation |
| 28 |
* and/or other materials provided with the distribution. |
| 29 |
*/ |
| 30 |
/********************************************************************** |
| 31 |
* |
| 32 |
* HEADER: dat_iw_extensions.h |
| 33 |
* |
| 34 |
* PURPOSE: extensions to the DAT API for iWARP transport specific services |
| 35 |
* NOTE: |
| 36 |
* Applications MUST recompile with new dat.h definitions |
| 37 |
* and include this file. |
| 38 |
* |
| 39 |
* Description: Header file for "uDAPL: User Direct Access Programming |
| 40 |
* Library, Version: 2.0" |
| 41 |
* |
| 42 |
* Mapping rules: |
| 43 |
* All global symbols are prepended with "DAT_" or "dat_" |
| 44 |
* All DAT objects have an 'api' tag which, such as 'ep' or 'lmr' |
| 45 |
* The method table is in the provider definition structure. |
| 46 |
* |
| 47 |
* |
| 48 |
**********************************************************************/ |
| 49 |
#ifndef _DAT_IW_EXTENSIONS_H_ |
| 50 |
#define _DAT_IW_EXTENSIONS_H_ |
| 51 |
|
| 52 |
/* |
| 53 |
* Provider specific attribute strings for extension support |
| 54 |
* returned with dat_ia_query() and |
| 55 |
* DAT_PROVIDER_ATTR_MASK == DAT_PROVIDER_FIELD_PROVIDER_SPECIFIC_ATTR |
| 56 |
* |
| 57 |
* DAT_NAMED_ATTR name == extended operations and version, |
| 58 |
* version_value = version number of extension API |
| 59 |
*/ |
| 60 |
#define DAT_EXTENSION_ATTR "DAT_EXTENSION_INTERFACE" |
| 61 |
#define DAT_EXTENSION_ATTR_VERSION "DAT_EXTENSION_VERSION" |
| 62 |
#define DAT_EXTENSION_ATTR_VERSION_VALUE "2.0.1" |
| 63 |
#define DAT_IW_ATTR_SSP "DAT_IW_ATTR_SSP" |
| 64 |
|
| 65 |
|
| 66 |
/* |
| 67 |
* The iWARP extension supports Socket Service Points |
| 68 |
* These enable establishing a TCP connection first, then converting |
| 69 |
* it to RDMA usage. |
| 70 |
*/ |
| 71 |
typedef enum dat_handle_iw_ext_type { |
| 72 |
DAT_IW_HANDLE_TYPE_SSP = DAT_HANDLE_TYPE_EXTENSION_BASE, |
| 73 |
} DAT_HANDLE_IW_EXT_TYPE; |
| 74 |
typedef DAT_HANDLE DAT_IW_SSP_HANDLE; |
| 75 |
|
| 76 |
typedef enum dat_iw_ssp_state |
| 77 |
{ |
| 78 |
DAT_IW_SSP_STATE_OPERATIONAL, |
| 79 |
DAT_IW_SSP_STATE_NON_OPERATIONAL |
| 80 |
} DAT_IW_SSP_STATE; |
| 81 |
|
| 82 |
/* The Socket ID is a local identifier for the socket. It is used for Socket |
| 83 |
* based connection model. The format of the DAT_IW_SOCKET follows the native |
| 84 |
* sockets programming practice of each target Operating System. The Consumer must |
| 85 |
* follow normal sockets programming procedures provided by the host platform. |
| 86 |
* |
| 87 |
* This include assumes that a socket handle is an int unless we are in |
| 88 |
* Linux Kernel code, in which case it is a struct socket pointer. This |
| 89 |
* distinction could be moved either to a distinct file (for iWARP specific, |
| 90 |
* platform specific types) or to dat_platform_specific.h (where the fact |
| 91 |
* that it was iWARP specific would be awkward). The coin flip was heads, |
| 92 |
* so the awkwardness of platform specific typing is in the iWARP specific |
| 93 |
* file instead. |
| 94 |
*/ |
| 95 |
#if defined(__linux__) && defined(__KERNEL__) |
| 96 |
typyedef struct socket *DAT_IW_SOCKET; |
| 97 |
#else |
| 98 |
typedef int DAT_IW_SOCKET; |
| 99 |
#endif |
| 100 |
|
| 101 |
typedef struct dat_iw_ssp_param |
| 102 |
{ |
| 103 |
DAT_IA_HANDLE ia_handle; |
| 104 |
DAT_IW_SOCKET socket_id; |
| 105 |
DAT_EVD_HANDLE evd_handle; |
| 106 |
DAT_EP_HANDLE ep_handle; |
| 107 |
DAT_IW_SSP_STATE ssp_state; |
| 108 |
} DAT_IW_SSP_PARAM; |
| 109 |
|
| 110 |
typedef enum dat_iw_ssp_param_mask |
| 111 |
{ |
| 112 |
DAT_IW_SSP_FIELD_IA_HANDLE = 0x01, |
| 113 |
DAT_IW_SSP_FIELD_SOCKET_ID = 0x02, |
| 114 |
DAT_IW_SSP_FIELD_EVD_HANDLE = 0x04, |
| 115 |
DAT_IW_SSP_FIELD_EP_HANDLE = 0x08, |
| 116 |
DAT_IW_SSP_FIELD_SSP_STATE = 0x10, |
| 117 |
DAT_IW_SSP_FIELD_ALL = 0x1F |
| 118 |
} DAT_IW_SSP_PARAM_MASK; |
| 119 |
|
| 120 |
|
| 121 |
/* |
| 122 |
* Extension operations |
| 123 |
*/ |
| 124 |
typedef enum dat_iw_op |
| 125 |
{ |
| 126 |
DAT_IW_SSP_CREATE_OP, |
| 127 |
DAT_IW_SSP_FREE_OP, |
| 128 |
DAT_IW_SSP_QUERY_OP, |
| 129 |
DAT_IW_SOCKET_CONNECT_OP |
| 130 |
} DAT_IW_OP; |
| 131 |
|
| 132 |
/* |
| 133 |
* Extended IW transport specific APIs |
| 134 |
* redirection via DAT extension function |
| 135 |
*/ |
| 136 |
|
| 137 |
/* dat_iw_ssp_create creates an iWARP Socket Service Point given an |
| 138 |
* already connected Socket |
| 139 |
*/ |
| 140 |
|
| 141 |
#define dat_iw_ssp_create (ia,socket_id,ep_handle,evd_handle,\ |
| 142 |
final_sm_msg,final_sm_msg_len,ssp_handle) \ |
| 143 |
dat_extension_op (ia,DAT_IW_SSP_CREATE_OP,ia,socket_id, \ |
| 144 |
ep_handle,evd_handle,final_sm_msg, \ |
| 145 |
final_sm_msg_len,ssp_handle) |
| 146 |
|
| 147 |
/* dat_iw_ssp_free destroys the specified instance of an SSP |
| 148 |
*/ |
| 149 |
#define dat_iw_ssp_free (ssp_handle) \ |
| 150 |
dat_extension_op (ssp_handle,DAT_IW_SSP_FREE_OP) |
| 151 |
|
| 152 |
/* dat_iw_ssq_query obtains the SSP_PARAMs for an ssp |
| 153 |
*/ |
| 154 |
#define dat_iw_ssp_query (ssp_handle,ssp_param_mask,ssp_param) \ |
| 155 |
dat_extension_op (ssp_handle,DAT_IW_SSP_QUERY_OP, \ |
| 156 |
ssp_param_maks,ssp_param) |
| 157 |
|
| 158 |
/* dat_iw_socket_connect initates a connection using an SSP |
| 159 |
*/ |
| 160 |
#define dat_iw_socket_connect (ep_handle,socket_id,timeout, \ |
| 161 |
private_data_size,private_data) \ |
| 162 |
dat_extension_op (ep_handle,DAT_IW_SOCKET_CONNECT_OP,\ |
| 163 |
socket_id,timeout,private_data_size,\ |
| 164 |
private_data) |
| 165 |
|
| 166 |
#endif /* _DAT_IW_EXTENSIONS_H_ */ |
| 167 |
|