| 1 |
/* |
| 2 |
* Copyright (c) 2015-2016 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_EQ_H_ |
| 36 |
#define _FI_DIRECT_EQ_H_ |
| 37 |
|
| 38 |
#define FABRIC_DIRECT_EQ 1 |
| 39 |
|
| 40 |
/******************************************************************************* |
| 41 |
* GNI API Functions |
| 42 |
******************************************************************************/ |
| 43 |
extern int gnix_fabric_trywait(struct fid_fabric *fabric, struct fid **fids, |
| 44 |
int count); |
| 45 |
|
| 46 |
extern int gnix_wait_wait(struct fid_wait *wait, int timeout); |
| 47 |
|
| 48 |
extern int gnix_poll_poll(struct fid_poll *pollset, void **context, int count); |
| 49 |
|
| 50 |
extern int gnix_poll_add(struct fid_poll *pollset, struct fid *event_fid, |
| 51 |
uint64_t flags); |
| 52 |
|
| 53 |
extern int gnix_poll_del(struct fid_poll *pollset, struct fid *event_fid, |
| 54 |
uint64_t flags); |
| 55 |
|
| 56 |
extern int gnix_eq_open(struct fid_fabric *fabric, struct fi_eq_attr *attr, |
| 57 |
struct fid_eq **eq, void *context); |
| 58 |
|
| 59 |
extern ssize_t gnix_eq_read(struct fid_eq *eq, uint32_t *event, void *buf, |
| 60 |
size_t len, uint64_t flags); |
| 61 |
|
| 62 |
extern ssize_t gnix_eq_readerr(struct fid_eq *eq, struct fi_eq_err_entry *buf, |
| 63 |
uint64_t flags); |
| 64 |
|
| 65 |
extern ssize_t gnix_eq_write(struct fid_eq *eq, uint32_t event, const void *buf, |
| 66 |
size_t len, uint64_t flags); |
| 67 |
|
| 68 |
extern ssize_t gnix_eq_sread(struct fid_eq *eq, uint32_t *event, void *buf, |
| 69 |
size_t len, int timeout, uint64_t flags); |
| 70 |
|
| 71 |
extern const char *gnix_eq_strerror(struct fid_eq *eq, int prov_errno, |
| 72 |
const void *err_data, char *buf, |
| 73 |
size_t len); |
| 74 |
|
| 75 |
extern ssize_t gnix_cq_read(struct fid_cq *cq, void *buf, size_t count); |
| 76 |
|
| 77 |
extern ssize_t gnix_cq_readfrom(struct fid_cq *cq, void *buf, size_t count, |
| 78 |
fi_addr_t *src_addr); |
| 79 |
|
| 80 |
extern ssize_t gnix_cq_readerr(struct fid_cq *cq, struct fi_cq_err_entry *buf, |
| 81 |
uint64_t flags); |
| 82 |
|
| 83 |
extern ssize_t gnix_cq_sread(struct fid_cq *cq, void *buf, size_t count, |
| 84 |
const void *cond, int timeout); |
| 85 |
|
| 86 |
extern ssize_t gnix_cq_sreadfrom(struct fid_cq *cq, void *buf, size_t count, |
| 87 |
fi_addr_t *src_addr, const void *cond, |
| 88 |
int timeout); |
| 89 |
|
| 90 |
extern int gnix_cq_signal(struct fid_cq *cq); |
| 91 |
|
| 92 |
extern const char *gnix_cq_strerror(struct fid_cq *cq, int prov_errno, |
| 93 |
const void *err_data, char *buf, |
| 94 |
size_t len); |
| 95 |
|
| 96 |
extern uint64_t gnix_cntr_read(struct fid_cntr *cntr); |
| 97 |
|
| 98 |
extern uint64_t gnix_cntr_readerr(struct fid_cntr *cntr); |
| 99 |
|
| 100 |
extern int gnix_cntr_add(struct fid_cntr *cntr, uint64_t value); |
| 101 |
|
| 102 |
extern int gnix_cntr_set(struct fid_cntr *cntr, uint64_t value); |
| 103 |
|
| 104 |
extern int gnix_cntr_wait(struct fid_cntr *cntr, uint64_t threshold, |
| 105 |
int timeout); |
| 106 |
|
| 107 |
extern int gnix_cntr_adderr(struct fid_cntr *cntr, uint64_t value); |
| 108 |
|
| 109 |
extern int gnix_cntr_seterr(struct fid_cntr *cntr, uint64_t value); |
| 110 |
|
| 111 |
/******************************************************************************* |
| 112 |
* Libfabric API Functions |
| 113 |
******************************************************************************/ |
| 114 |
static inline int |
| 115 |
fi_trywait(struct fid_fabric *fabric, struct fid **fids, int count) |
| 116 |
{ |
| 117 |
return gnix_fabric_trywait(fabric, fids, count); |
| 118 |
} |
| 119 |
|
| 120 |
static inline int fi_wait(struct fid_wait *waitset, int timeout) |
| 121 |
{ |
| 122 |
return gnix_wait_wait(waitset, timeout); |
| 123 |
} |
| 124 |
|
| 125 |
static inline int fi_poll(struct fid_poll *pollset, void **context, int count) |
| 126 |
{ |
| 127 |
return gnix_poll_poll(pollset, context, count); |
| 128 |
} |
| 129 |
|
| 130 |
static inline int fi_poll_add(struct fid_poll *pollset, struct fid *event_fid, |
| 131 |
uint64_t flags) |
| 132 |
{ |
| 133 |
return gnix_poll_add(pollset, event_fid, flags); |
| 134 |
} |
| 135 |
|
| 136 |
static inline int fi_poll_del(struct fid_poll *pollset, struct fid *event_fid, |
| 137 |
uint64_t flags) |
| 138 |
{ |
| 139 |
return gnix_poll_del(pollset, event_fid, flags); |
| 140 |
} |
| 141 |
|
| 142 |
static inline int fi_eq_open(struct fid_fabric *fabric, struct fi_eq_attr *attr, |
| 143 |
struct fid_eq **eq, void *context) |
| 144 |
{ |
| 145 |
return gnix_eq_open(fabric, attr, eq, context); |
| 146 |
} |
| 147 |
|
| 148 |
static inline ssize_t fi_eq_read(struct fid_eq *eq, uint32_t *event, void *buf, |
| 149 |
size_t len, uint64_t flags) |
| 150 |
{ |
| 151 |
return gnix_eq_read(eq, event, buf, len, flags); |
| 152 |
} |
| 153 |
|
| 154 |
static inline ssize_t fi_eq_readerr(struct fid_eq *eq, |
| 155 |
struct fi_eq_err_entry *buf, uint64_t flags) |
| 156 |
{ |
| 157 |
return gnix_eq_readerr(eq, buf, flags); |
| 158 |
} |
| 159 |
|
| 160 |
static inline ssize_t fi_eq_write(struct fid_eq *eq, uint32_t event, |
| 161 |
const void *buf, size_t len, uint64_t flags) |
| 162 |
{ |
| 163 |
return gnix_eq_write(eq, event, buf, len, flags); |
| 164 |
} |
| 165 |
|
| 166 |
static inline ssize_t fi_eq_sread(struct fid_eq *eq, uint32_t *event, void *buf, |
| 167 |
size_t len, int timeout, uint64_t flags) |
| 168 |
{ |
| 169 |
return gnix_eq_sread(eq, event, buf, len, timeout, flags); |
| 170 |
} |
| 171 |
|
| 172 |
static inline const char *fi_eq_strerror(struct fid_eq *eq, int prov_errno, |
| 173 |
const void *err_data, char *buf, |
| 174 |
size_t len) |
| 175 |
{ |
| 176 |
return gnix_eq_strerror(eq, prov_errno, err_data, buf, len); |
| 177 |
} |
| 178 |
|
| 179 |
static inline ssize_t fi_cq_read(struct fid_cq *cq, void *buf, size_t count) |
| 180 |
{ |
| 181 |
return gnix_cq_read(cq, buf, count); |
| 182 |
} |
| 183 |
|
| 184 |
static inline ssize_t fi_cq_readfrom(struct fid_cq *cq, void *buf, size_t count, |
| 185 |
fi_addr_t *src_addr) |
| 186 |
{ |
| 187 |
return gnix_cq_readfrom(cq, buf, count, src_addr); |
| 188 |
} |
| 189 |
|
| 190 |
static inline ssize_t fi_cq_readerr(struct fid_cq *cq, |
| 191 |
struct fi_cq_err_entry *buf, uint64_t flags) |
| 192 |
{ |
| 193 |
return gnix_cq_readerr(cq, buf, flags); |
| 194 |
} |
| 195 |
|
| 196 |
static inline ssize_t fi_cq_sread(struct fid_cq *cq, void *buf, size_t count, |
| 197 |
const void *cond, int timeout) |
| 198 |
{ |
| 199 |
return gnix_cq_sread(cq, buf, count, cond, timeout); |
| 200 |
} |
| 201 |
|
| 202 |
static inline ssize_t fi_cq_sreadfrom(struct fid_cq *cq, void *buf, |
| 203 |
size_t count, fi_addr_t *src_addr, |
| 204 |
const void *cond, int timeout) |
| 205 |
{ |
| 206 |
return gnix_cq_sreadfrom(cq, buf, count, src_addr, cond, timeout); |
| 207 |
} |
| 208 |
|
| 209 |
static inline int fi_cq_signal(struct fid_cq *cq) |
| 210 |
{ |
| 211 |
return gnix_cq_signal(cq); |
| 212 |
} |
| 213 |
|
| 214 |
static inline const char *fi_cq_strerror(struct fid_cq *cq, int prov_errno, |
| 215 |
const void *err_data, char *buf, |
| 216 |
size_t len) |
| 217 |
{ |
| 218 |
return gnix_cq_strerror(cq, prov_errno, err_data, buf, len); |
| 219 |
} |
| 220 |
|
| 221 |
static inline uint64_t fi_cntr_read(struct fid_cntr *cntr) |
| 222 |
{ |
| 223 |
return gnix_cntr_read(cntr); |
| 224 |
} |
| 225 |
|
| 226 |
static inline uint64_t fi_cntr_readerr(struct fid_cntr *cntr) |
| 227 |
{ |
| 228 |
return gnix_cntr_readerr(cntr); |
| 229 |
} |
| 230 |
|
| 231 |
static inline int fi_cntr_add(struct fid_cntr *cntr, uint64_t value) |
| 232 |
{ |
| 233 |
return gnix_cntr_add(cntr, value); |
| 234 |
} |
| 235 |
|
| 236 |
static inline int fi_cntr_set(struct fid_cntr *cntr, uint64_t value) |
| 237 |
{ |
| 238 |
return gnix_cntr_set(cntr, value); |
| 239 |
} |
| 240 |
|
| 241 |
static inline int fi_cntr_wait(struct fid_cntr *cntr, uint64_t threshold, |
| 242 |
int timeout) |
| 243 |
{ |
| 244 |
return gnix_cntr_wait(cntr, threshold, timeout); |
| 245 |
} |
| 246 |
|
| 247 |
static inline int fi_cntr_adderr(struct fid_cntr *cntr, uint64_t value) |
| 248 |
{ |
| 249 |
return gnix_cntr_adderr(cntr, value); |
| 250 |
} |
| 251 |
|
| 252 |
static inline int fi_cntr_seterr(struct fid_cntr *cntr, uint64_t value) |
| 253 |
{ |
| 254 |
return gnix_cntr_seterr(cntr, value); |
| 255 |
} |
| 256 |
|
| 257 |
#endif /* _FI_DIRECT_EQ_H_ */ |