/usr/include/rdma/fi_eq.h is in libfabric-dev 1.5.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | /*
* Copyright (c) 2013-2014 Intel Corporation. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef FI_EQ_H
#define FI_EQ_H
#ifndef _WIN32
#include <pthread.h>
#endif /* _WIN32 */
#include <rdma/fabric.h>
#include <rdma/fi_errno.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Wait Set
* Allows associating multiple EQs and counters with a single wait object.
*/
/* Use fi_control GETWAIT to get underlying wait object(s) */
enum fi_wait_obj {
FI_WAIT_NONE,
FI_WAIT_UNSPEC,
FI_WAIT_SET,
FI_WAIT_FD,
FI_WAIT_MUTEX_COND /* pthread mutex & cond */
};
struct fi_wait_attr {
enum fi_wait_obj wait_obj;
uint64_t flags;
};
struct fi_ops_wait {
size_t size;
int (*wait)(struct fid_wait *waitset, int timeout);
};
struct fid_wait {
struct fid fid;
struct fi_ops_wait *ops;
};
#ifndef _WIN32
struct fi_mutex_cond {
pthread_mutex_t *mutex;
pthread_cond_t *cond;
};
#endif /* _WIN32 */
/*
* Poll Set
* Allows polling multiple event queues and counters for progress
*/
struct fi_poll_attr {
uint64_t flags;
};
struct fi_ops_poll {
size_t size;
int (*poll)(struct fid_poll *pollset, void **context, int count);
int (*poll_add)(struct fid_poll *pollset, struct fid *event_fid,
uint64_t flags);
int (*poll_del)(struct fid_poll *pollset, struct fid *event_fid,
uint64_t flags);
};
struct fid_poll {
struct fid fid;
struct fi_ops_poll *ops;
};
/*
* EQ = Event Queue
* Used to report various control (not data transfer) events and operations.
*/
struct fi_eq_attr {
size_t size;
uint64_t flags;
enum fi_wait_obj wait_obj;
int signaling_vector;
struct fid_wait *wait_set;
};
/* Standard EQ events */
enum {
FI_NOTIFY,
FI_CONNREQ,
FI_CONNECTED,
FI_SHUTDOWN,
FI_MR_COMPLETE,
FI_AV_COMPLETE,
FI_JOIN_COMPLETE,
};
struct fi_eq_entry {
fid_t fid;
void *context;
uint64_t data;
};
struct fi_eq_err_entry {
fid_t fid;
void *context;
uint64_t data;
int err;
int prov_errno;
/* err_data is available until the next time the EQ is read */
void *err_data;
size_t err_data_size;
};
struct fi_eq_cm_entry {
fid_t fid;
/* user must call fi_freeinfo to release info */
struct fi_info *info;
/* connection data placed here, up to space provided */
uint8_t data[];
};
struct fi_ops_eq {
size_t size;
ssize_t (*read)(struct fid_eq *eq, uint32_t *event,
void *buf, size_t len, uint64_t flags);
ssize_t (*readerr)(struct fid_eq *eq, struct fi_eq_err_entry *buf,
uint64_t flags);
ssize_t (*write)(struct fid_eq *eq, uint32_t event,
const void *buf, size_t len, uint64_t flags);
ssize_t (*sread)(struct fid_eq *eq, uint32_t *event,
void *buf, size_t len, int timeout, uint64_t flags);
const char * (*strerror)(struct fid_eq *eq, int prov_errno,
const void *err_data, char *buf, size_t len);
};
struct fid_eq {
struct fid fid;
struct fi_ops_eq *ops;
};
/*
* CQ = Complete Queue
* Used to report the completion of data transfer operations.
*/
enum fi_cq_format {
FI_CQ_FORMAT_UNSPEC,
FI_CQ_FORMAT_CONTEXT,
FI_CQ_FORMAT_MSG,
FI_CQ_FORMAT_DATA,
FI_CQ_FORMAT_TAGGED,
};
struct fi_cq_entry {
void *op_context;
};
struct fi_cq_msg_entry {
void *op_context;
uint64_t flags;
size_t len;
};
struct fi_cq_data_entry {
void *op_context;
uint64_t flags;
size_t len;
void *buf;
/* data depends on operation and/or flags - e.g. remote EQ data */
uint64_t data;
};
struct fi_cq_tagged_entry {
void *op_context;
uint64_t flags;
size_t len;
void *buf;
uint64_t data;
uint64_t tag;
};
struct fi_cq_err_entry {
void *op_context;
uint64_t flags;
size_t len;
void *buf;
uint64_t data;
uint64_t tag;
size_t olen;
int err;
int prov_errno;
/* err_data is available until the next time the CQ is read */
void *err_data;
size_t err_data_size;
};
enum fi_cq_wait_cond {
FI_CQ_COND_NONE,
FI_CQ_COND_THRESHOLD /* size_t threshold */
};
struct fi_cq_attr {
size_t size;
uint64_t flags;
enum fi_cq_format format;
enum fi_wait_obj wait_obj;
int signaling_vector;
enum fi_cq_wait_cond wait_cond;
struct fid_wait *wait_set;
};
struct fi_ops_cq {
size_t size;
ssize_t (*read)(struct fid_cq *cq, void *buf, size_t count);
ssize_t (*readfrom)(struct fid_cq *cq, void *buf, size_t count,
fi_addr_t *src_addr);
ssize_t (*readerr)(struct fid_cq *cq, struct fi_cq_err_entry *buf,
uint64_t flags);
ssize_t (*sread)(struct fid_cq *cq, void *buf, size_t count,
const void *cond, int timeout);
ssize_t (*sreadfrom)(struct fid_cq *cq, void *buf, size_t count,
fi_addr_t *src_addr, const void *cond, int timeout);
int (*signal)(struct fid_cq *cq);
const char * (*strerror)(struct fid_cq *cq, int prov_errno,
const void *err_data, char *buf, size_t len);
};
struct fid_cq {
struct fid fid;
struct fi_ops_cq *ops;
};
/*
* CNTR = Counter
* Used to report the number of completed of asynchronous operations.
*/
enum fi_cntr_events {
FI_CNTR_EVENTS_COMP
};
struct fi_cntr_attr {
enum fi_cntr_events events;
enum fi_wait_obj wait_obj;
struct fid_wait *wait_set;
uint64_t flags;
};
struct fi_ops_cntr {
size_t size;
uint64_t (*read)(struct fid_cntr *cntr);
uint64_t (*readerr)(struct fid_cntr *cntr);
int (*add)(struct fid_cntr *cntr, uint64_t value);
int (*set)(struct fid_cntr *cntr, uint64_t value);
int (*wait)(struct fid_cntr *cntr, uint64_t threshold, int timeout);
int (*adderr)(struct fid_cntr *cntr, uint64_t value);
int (*seterr)(struct fid_cntr *cntr, uint64_t value);
};
struct fid_cntr {
struct fid fid;
struct fi_ops_cntr *ops;
};
#ifdef FABRIC_DIRECT
#include <rdma/fi_direct_eq.h>
#endif /* FABRIC_DIRECT */
#ifndef FABRIC_DIRECT_EQ
static inline int
fi_trywait(struct fid_fabric *fabric, struct fid **fids, int count)
{
return fabric->ops->trywait(fabric, fids, count);
}
static inline int
fi_wait(struct fid_wait *waitset, int timeout)
{
return waitset->ops->wait(waitset, timeout);
}
static inline int
fi_poll(struct fid_poll *pollset, void **context, int count)
{
return pollset->ops->poll(pollset, context, count);
}
static inline int
fi_poll_add(struct fid_poll *pollset, struct fid *event_fid, uint64_t flags)
{
return pollset->ops->poll_add(pollset, event_fid, flags);
}
static inline int
fi_poll_del(struct fid_poll *pollset, struct fid *event_fid, uint64_t flags)
{
return pollset->ops->poll_del(pollset, event_fid, flags);
}
static inline int
fi_eq_open(struct fid_fabric *fabric, struct fi_eq_attr *attr,
struct fid_eq **eq, void *context)
{
return fabric->ops->eq_open(fabric, attr, eq, context);
}
static inline ssize_t
fi_eq_read(struct fid_eq *eq, uint32_t *event, void *buf,
size_t len, uint64_t flags)
{
return eq->ops->read(eq, event, buf, len, flags);
}
static inline ssize_t
fi_eq_readerr(struct fid_eq *eq, struct fi_eq_err_entry *buf, uint64_t flags)
{
return eq->ops->readerr(eq, buf, flags);
}
static inline ssize_t
fi_eq_write(struct fid_eq *eq, uint32_t event, const void *buf,
size_t len, uint64_t flags)
{
return eq->ops->write(eq, event, buf, len, flags);
}
static inline ssize_t
fi_eq_sread(struct fid_eq *eq, uint32_t *event, void *buf, size_t len,
int timeout, uint64_t flags)
{
return eq->ops->sread(eq, event, buf, len, timeout, flags);
}
static inline const char *
fi_eq_strerror(struct fid_eq *eq, int prov_errno, const void *err_data,
char *buf, size_t len)
{
return eq->ops->strerror(eq, prov_errno, err_data, buf, len);
}
static inline ssize_t fi_cq_read(struct fid_cq *cq, void *buf, size_t count)
{
return cq->ops->read(cq, buf, count);
}
static inline ssize_t
fi_cq_readfrom(struct fid_cq *cq, void *buf, size_t count, fi_addr_t *src_addr)
{
return cq->ops->readfrom(cq, buf, count, src_addr);
}
static inline ssize_t
fi_cq_readerr(struct fid_cq *cq, struct fi_cq_err_entry *buf, uint64_t flags)
{
return cq->ops->readerr(cq, buf, flags);
}
static inline ssize_t
fi_cq_sread(struct fid_cq *cq, void *buf, size_t count, const void *cond, int timeout)
{
return cq->ops->sread(cq, buf, count, cond, timeout);
}
static inline ssize_t
fi_cq_sreadfrom(struct fid_cq *cq, void *buf, size_t count,
fi_addr_t *src_addr, const void *cond, int timeout)
{
return cq->ops->sreadfrom(cq, buf, count, src_addr, cond, timeout);
}
static inline int fi_cq_signal(struct fid_cq *cq)
{
return cq->ops->signal(cq);
}
static inline const char *
fi_cq_strerror(struct fid_cq *cq, int prov_errno, const void *err_data,
char *buf, size_t len)
{
return cq->ops->strerror(cq, prov_errno, err_data, buf, len);
}
static inline uint64_t fi_cntr_read(struct fid_cntr *cntr)
{
return cntr->ops->read(cntr);
}
static inline uint64_t fi_cntr_readerr(struct fid_cntr *cntr)
{
return cntr->ops->readerr(cntr);
}
static inline int fi_cntr_add(struct fid_cntr *cntr, uint64_t value)
{
return cntr->ops->add(cntr, value);
}
static inline int fi_cntr_adderr(struct fid_cntr *cntr, uint64_t value)
{
return FI_CHECK_OP(cntr->ops, struct fi_ops_cntr, adderr) ?
cntr->ops->adderr(cntr, value) : -FI_ENOSYS;
}
static inline int fi_cntr_set(struct fid_cntr *cntr, uint64_t value)
{
return cntr->ops->set(cntr, value);
}
static inline int fi_cntr_seterr(struct fid_cntr *cntr, uint64_t value)
{
return FI_CHECK_OP(cntr->ops, struct fi_ops_cntr, seterr) ?
cntr->ops->seterr(cntr, value) : -FI_ENOSYS;
}
static inline int
fi_cntr_wait(struct fid_cntr *cntr, uint64_t threshold, int timeout)
{
return cntr->ops->wait(cntr, threshold, timeout);
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* FI_EQ_H */
|