| 1 |
/* |
| 2 |
* Copyright (c) 2015-2017 Los Alamos National Security, LLC. All |
| 3 |
* rights reserved. |
| 4 |
* Copyright (c) 2015-2016 Cray Inc. All rights reserved. |
| 5 |
* |
| 6 |
* This software is available to you under a choice of one of two |
| 7 |
* licenses. You may choose to be licensed under the terms of the GNU |
| 8 |
* General Public License (GPL) Version 2, available from the file |
| 9 |
* COPYING in the main directory of this source tree, or the |
| 10 |
* BSD license below: |
| 11 |
* |
| 12 |
* Redistribution and use in source and binary forms, with or |
| 13 |
* without modification, are permitted provided that the following |
| 14 |
* conditions are met: |
| 15 |
* |
| 16 |
* - Redistributions of source code must retain the above |
| 17 |
* copyright notice, this list of conditions and the following |
| 18 |
* disclaimer. |
| 19 |
* |
| 20 |
* - Redistributions in binary form must reproduce the above |
| 21 |
* copyright notice, this list of conditions and the following |
| 22 |
* disclaimer in the documentation and/or other materials |
| 23 |
* provided with the distribution. |
| 24 |
* |
| 25 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 26 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 27 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 28 |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 29 |
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 30 |
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 31 |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 32 |
* SOFTWARE. |
| 33 |
*/ |
| 34 |
|
| 35 |
#ifndef _FI_DIRECT_ENDPOINT_H_ |
| 36 |
#define _FI_DIRECT_ENDPOINT_H_ |
| 37 |
|
| 38 |
#define FABRIC_DIRECT_ENDPOINT 1 |
| 39 |
|
| 40 |
/******************************************************************************* |
| 41 |
* GNI API Functions |
| 42 |
******************************************************************************/ |
| 43 |
extern int gnix_pep_open(struct fid_fabric *fabric, struct fi_info *info, |
| 44 |
struct fid_pep **pep, void *context); |
| 45 |
|
| 46 |
extern int gnix_ep_open(struct fid_domain *domain, struct fi_info *info, |
| 47 |
struct fid_ep **ep, void *context); |
| 48 |
|
| 49 |
extern int gnix_sep_open(struct fid_domain *domain, |
| 50 |
struct fi_info *info, struct fid_ep **ep, |
| 51 |
void *context); |
| 52 |
|
| 53 |
extern int gnix_ep_bind(fid_t fid, fid_t bfid, uint64_t flags); |
| 54 |
|
| 55 |
extern int gnix_pep_bind(fid_t pep, struct fid *bfid, uint64_t flags); |
| 56 |
|
| 57 |
extern int gnix_sep_bind(fid_t sep, fid_t bfid, uint64_t flags); |
| 58 |
|
| 59 |
extern int gnix_ep_control(fid_t fid, int command, void *arg); |
| 60 |
|
| 61 |
extern ssize_t gnix_ep_cancel(fid_t fid, void *context); |
| 62 |
|
| 63 |
extern int gnix_ep_setopt(fid_t fid, int level, int optname, const void *optval, |
| 64 |
size_t optlen); |
| 65 |
|
| 66 |
extern int gnix_getopt(fid_t fid, int level, int optname, void *optval, |
| 67 |
size_t *optlen); |
| 68 |
|
| 69 |
extern int gnix_tx_context(struct fid_ep *ep, int index, |
| 70 |
struct fi_tx_attr *attr, struct fid_ep **tx_ep, |
| 71 |
void *context); |
| 72 |
|
| 73 |
extern int gnix_rx_context(struct fid_ep *ep, int index, |
| 74 |
struct fi_rx_attr *attr, struct fid_ep **rx_ep, |
| 75 |
void *context); |
| 76 |
|
| 77 |
extern ssize_t gnix_ep_tx_size_left(struct fid_ep *ep); |
| 78 |
|
| 79 |
extern ssize_t gnix_ep_rx_size_left(struct fid_ep *ep); |
| 80 |
|
| 81 |
extern int gnix_stx_open(struct fid_domain *dom, struct fi_tx_attr *tx_attr, |
| 82 |
struct fid_stx **stx, void *context); |
| 83 |
|
| 84 |
extern int gnix_srx_context(struct fid_domain *domain, struct fi_rx_attr *attr, |
| 85 |
struct fid_ep **rx_ep, void *context); |
| 86 |
|
| 87 |
extern ssize_t gnix_ep_recv(struct fid_ep *ep, void *buf, size_t len, |
| 88 |
void *desc, fi_addr_t src_addr, void *context); |
| 89 |
|
| 90 |
extern ssize_t gnix_ep_recvv(struct fid_ep *ep, const struct iovec *iov, |
| 91 |
void **desc, size_t count, fi_addr_t src_addr, |
| 92 |
void *context); |
| 93 |
|
| 94 |
extern ssize_t gnix_ep_recvmsg(struct fid_ep *ep, const struct fi_msg *msg, |
| 95 |
uint64_t flags); |
| 96 |
|
| 97 |
extern ssize_t gnix_ep_send(struct fid_ep *ep, const void *buf, size_t len, |
| 98 |
void *desc, fi_addr_t dest_addr, void *context); |
| 99 |
|
| 100 |
extern ssize_t gnix_ep_sendv(struct fid_ep *ep, const struct iovec *iov, |
| 101 |
void **desc, size_t count, fi_addr_t dest_addr, |
| 102 |
void *context); |
| 103 |
|
| 104 |
extern ssize_t gnix_ep_sendmsg(struct fid_ep *ep, const struct fi_msg *msg, |
| 105 |
uint64_t flags); |
| 106 |
|
| 107 |
extern ssize_t gnix_ep_msg_inject(struct fid_ep *ep, const void *buf, |
| 108 |
size_t len, fi_addr_t dest_addr); |
| 109 |
|
| 110 |
extern ssize_t gnix_ep_senddata(struct fid_ep *ep, const void *buf, size_t len, |
| 111 |
void *desc, uint64_t data, fi_addr_t dest_addr, |
| 112 |
void *context); |
| 113 |
|
| 114 |
extern ssize_t gnix_ep_msg_injectdata(struct fid_ep *ep, const void *buf, |
| 115 |
size_t len, uint64_t data, |
| 116 |
fi_addr_t dest_addr); |
| 117 |
|
| 118 |
/******************************************************************************* |
| 119 |
* Libfabric API Functions |
| 120 |
******************************************************************************/ |
| 121 |
static inline int fi_passive_ep(struct fid_fabric *fabric, struct fi_info *info, |
| 122 |
struct fid_pep **pep, void *context) |
| 123 |
{ |
| 124 |
return gnix_pep_open(fabric, info, pep, context); |
| 125 |
} |
| 126 |
|
| 127 |
static inline int fi_endpoint(struct fid_domain *domain, struct fi_info *info, |
| 128 |
struct fid_ep **ep, void *context) |
| 129 |
{ |
| 130 |
return gnix_ep_open(domain, info, ep, context); |
| 131 |
} |
| 132 |
|
| 133 |
static inline int fi_scalable_ep(struct fid_domain *domain, |
| 134 |
struct fi_info *info, struct fid_ep **sep, |
| 135 |
void *context) |
| 136 |
{ |
| 137 |
return gnix_sep_open(domain, info, sep, context); |
| 138 |
} |
| 139 |
|
| 140 |
static inline int fi_ep_bind(struct fid_ep *ep, fid_t bfid, uint64_t flags) |
| 141 |
{ |
| 142 |
return gnix_ep_bind(&ep->fid, bfid, flags); |
| 143 |
} |
| 144 |
|
| 145 |
static inline int fi_pep_bind(struct fid_pep *pep, fid_t bfid, uint64_t flags) |
| 146 |
{ |
| 147 |
return gnix_pep_bind(&pep->fid, bfid, flags); |
| 148 |
} |
| 149 |
|
| 150 |
static inline int fi_scalable_ep_bind(struct fid_ep *sep, fid_t bfid, |
| 151 |
uint64_t flags) |
| 152 |
{ |
| 153 |
return gnix_sep_bind(&sep->fid, bfid, flags); |
| 154 |
} |
| 155 |
|
| 156 |
static inline int fi_enable(struct fid_ep *ep) |
| 157 |
{ |
| 158 |
return gnix_ep_control(&ep->fid, FI_ENABLE, NULL); |
| 159 |
} |
| 160 |
|
| 161 |
static inline ssize_t fi_cancel(fid_t fid, void *context) |
| 162 |
{ |
| 163 |
struct fid_ep *ep = container_of(fid, struct fid_ep, fid); |
| 164 |
return gnix_ep_cancel(&ep->fid, context); |
| 165 |
} |
| 166 |
|
| 167 |
static inline int fi_setopt(fid_t fid, int level, int optname, |
| 168 |
const void *optval, size_t optlen) |
| 169 |
{ |
| 170 |
return gnix_ep_setopt(fid, level, optname, optval, optlen); |
| 171 |
} |
| 172 |
|
| 173 |
static inline int fi_getopt(fid_t fid, int level, int optname, void *optval, |
| 174 |
size_t *optlen) |
| 175 |
{ |
| 176 |
return gnix_getopt(fid, level, optname, optval, optlen); |
| 177 |
} |
| 178 |
|
| 179 |
static inline int fi_tx_context(struct fid_ep *ep, int index, |
| 180 |
struct fi_tx_attr *attr, struct fid_ep **tx_ep, |
| 181 |
void *context) |
| 182 |
{ |
| 183 |
return gnix_tx_context(ep, index, attr, tx_ep, context); |
| 184 |
} |
| 185 |
|
| 186 |
static inline int fi_rx_context(struct fid_ep *ep, int index, |
| 187 |
struct fi_rx_attr *attr, struct fid_ep **rx_ep, |
| 188 |
void *context) |
| 189 |
{ |
| 190 |
return gnix_rx_context(ep, index, attr, rx_ep, context); |
| 191 |
} |
| 192 |
|
| 193 |
static inline ssize_t fi_rx_size_left(struct fid_ep *ep) |
| 194 |
{ |
| 195 |
return gnix_ep_rx_size_left(ep); |
| 196 |
} |
| 197 |
|
| 198 |
static inline ssize_t fi_tx_size_left(struct fid_ep *ep) |
| 199 |
{ |
| 200 |
return gnix_ep_tx_size_left(ep); |
| 201 |
} |
| 202 |
|
| 203 |
static inline int fi_stx_context(struct fid_domain *domain, |
| 204 |
struct fi_tx_attr *attr, struct fid_stx **stx, |
| 205 |
void *context) |
| 206 |
{ |
| 207 |
return gnix_stx_open(domain, attr, stx, context); |
| 208 |
} |
| 209 |
|
| 210 |
static inline int fi_srx_context(struct fid_domain *domain, |
| 211 |
struct fi_rx_attr *attr, struct fid_ep **rx_ep, |
| 212 |
void *context) |
| 213 |
{ |
| 214 |
return gnix_srx_context(domain, attr, rx_ep, context); |
| 215 |
} |
| 216 |
|
| 217 |
static inline ssize_t fi_recv(struct fid_ep *ep, void *buf, size_t len, |
| 218 |
void *desc, fi_addr_t src_addr, void *context) |
| 219 |
{ |
| 220 |
return gnix_ep_recv(ep, buf, len, desc, src_addr, context); |
| 221 |
} |
| 222 |
|
| 223 |
static inline ssize_t fi_recvv(struct fid_ep *ep, const struct iovec *iov, |
| 224 |
void **desc, size_t count, fi_addr_t src_addr, |
| 225 |
void *context) |
| 226 |
{ |
| 227 |
return gnix_ep_recvv(ep, iov, desc, count, src_addr, context); |
| 228 |
} |
| 229 |
|
| 230 |
static inline ssize_t fi_recvmsg(struct fid_ep *ep, const struct fi_msg *msg, |
| 231 |
uint64_t flags) |
| 232 |
{ |
| 233 |
return gnix_ep_recvmsg(ep, msg, flags); |
| 234 |
} |
| 235 |
|
| 236 |
static inline ssize_t fi_send(struct fid_ep *ep, const void *buf, size_t len, |
| 237 |
void *desc, fi_addr_t dest_addr, void *context) |
| 238 |
{ |
| 239 |
return gnix_ep_send(ep, buf, len, desc, dest_addr, context); |
| 240 |
} |
| 241 |
|
| 242 |
static inline ssize_t fi_sendv(struct fid_ep *ep, const struct iovec *iov, |
| 243 |
void **desc, size_t count, fi_addr_t dest_addr, |
| 244 |
void *context) |
| 245 |
{ |
| 246 |
return gnix_ep_sendv(ep, iov, desc, count, dest_addr, context); |
| 247 |
} |
| 248 |
|
| 249 |
static inline ssize_t fi_sendmsg(struct fid_ep *ep, const struct fi_msg *msg, |
| 250 |
uint64_t flags) |
| 251 |
{ |
| 252 |
return gnix_ep_sendmsg(ep, msg, flags); |
| 253 |
} |
| 254 |
|
| 255 |
static inline ssize_t fi_inject(struct fid_ep *ep, const void *buf, size_t len, |
| 256 |
fi_addr_t dest_addr) |
| 257 |
{ |
| 258 |
return gnix_ep_msg_inject(ep, buf, len, dest_addr); |
| 259 |
} |
| 260 |
|
| 261 |
static inline ssize_t fi_senddata(struct fid_ep *ep, const void *buf, |
| 262 |
size_t len, void *desc, uint64_t data, |
| 263 |
fi_addr_t dest_addr, void *context) |
| 264 |
{ |
| 265 |
return gnix_ep_senddata(ep, buf, len, desc, data, dest_addr, context); |
| 266 |
} |
| 267 |
|
| 268 |
static inline ssize_t fi_injectdata(struct fid_ep *ep, const void *buf, |
| 269 |
size_t len, uint64_t data, |
| 270 |
fi_addr_t dest_addr) |
| 271 |
{ |
| 272 |
return gnix_ep_msg_injectdata(ep, buf, len, data, dest_addr); |
| 273 |
} |
| 274 |
|
| 275 |
#endif /* _FI_DIRECT_ENDPOINT_H_ */ |