/usr/include/rdma/fabric.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 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | /*
* Copyright (c) 2013-2017 Intel Corporation. All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. 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 FABRIC_H
#define FABRIC_H
#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
#ifdef __GNUC__
#define FI_DEPRECATED_FUNC __attribute__((deprecated))
#define FI_DEPRECATED_FIELD __attribute__((deprecated))
#elif defined(_MSC_VER)
#define FI_DEPRECATED_FUNC __declspec(deprecated)
#define FI_DEPRECATED_FIELD
#else
#define FI_DEPRECATED_FUNC
#define FI_DEPRECATED_FIELD
#endif
#if defined(_WIN32)
#include <BaseTsd.h>
#include <windows.h>
typedef SSIZE_T ssize_t;
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef container_of
#define container_of(ptr, type, field) \
((type *) ((char *)ptr - offsetof(type, field)))
#endif
/* API version (which is not necessarily the same as the
* tarball/libfabric package version number).
*/
#define FI_MAJOR_VERSION 1
#define FI_MINOR_VERSION 5
enum {
FI_PATH_MAX = 256,
FI_NAME_MAX = 64,
FI_VERSION_MAX = 64
};
#define FI_VERSION(major, minor) ((major << 16) | (minor))
#define FI_MAJOR(version) (version >> 16)
#define FI_MINOR(version) (version & 0xFFFF)
#define FI_VERSION_GE(v1, v2) ((FI_MAJOR(v1) > FI_MAJOR(v2)) || \
(FI_MAJOR(v1) == FI_MAJOR(v2) && FI_MINOR(v1) == FI_MINOR(v2)) || \
(FI_MAJOR(v1) == FI_MAJOR(v2) && FI_MINOR(v1) > FI_MINOR(v2)))
#define FI_VERSION_LT(v1, v2) ((FI_MAJOR(v1) < FI_MAJOR(v2)) || \
(FI_MAJOR(v1) == FI_MAJOR(v2) && FI_MINOR(v1) < FI_MINOR(v2)))
uint32_t fi_version(void);
struct fid;
struct fid_fabric;
struct fid_domain;
struct fid_av;
struct fid_wait;
struct fid_poll;
struct fid_eq;
struct fid_cq;
struct fid_cntr;
struct fid_ep;
struct fid_pep;
struct fid_stx;
struct fid_mr;
typedef struct fid *fid_t;
/*
* Provider specific values are indicated by setting the high-order bit.
*/
#define FI_PROV_SPECIFIC (1U << 31)
/*
* Flags
* The 64-bit flag field is used as follows:
* 1-grow up common (usable with multiple operations)
* 59-grow down operation specific (used for single call/class)
* 60 - 63 provider specific
*/
#define FI_MSG (1ULL << 1)
#define FI_RMA (1ULL << 2)
#define FI_TAGGED (1ULL << 3)
#define FI_ATOMIC (1ULL << 4)
#define FI_ATOMICS FI_ATOMIC
#define FI_MULTICAST (1ULL << 5)
#define FI_READ (1ULL << 8)
#define FI_WRITE (1ULL << 9)
#define FI_RECV (1ULL << 10)
#define FI_SEND (1ULL << 11)
#define FI_TRANSMIT FI_SEND
#define FI_REMOTE_READ (1ULL << 12)
#define FI_REMOTE_WRITE (1ULL << 13)
#define FI_MULTI_RECV (1ULL << 16)
#define FI_REMOTE_CQ_DATA (1ULL << 17)
#define FI_MORE (1ULL << 18)
#define FI_PEEK (1ULL << 19)
#define FI_TRIGGER (1ULL << 20)
#define FI_FENCE (1ULL << 21)
#define FI_COMPLETION (1ULL << 24)
#define FI_EVENT FI_COMPLETION
#define FI_INJECT (1ULL << 25)
#define FI_INJECT_COMPLETE (1ULL << 26)
#define FI_TRANSMIT_COMPLETE (1ULL << 27)
#define FI_DELIVERY_COMPLETE (1ULL << 28)
#define FI_AFFINITY (1ULL << 29)
#define FI_SOURCE_ERR (1ULL << 50)
#define FI_LOCAL_COMM (1ULL << 51)
#define FI_REMOTE_COMM (1ULL << 52)
#define FI_SHARED_AV (1ULL << 53)
#define FI_PROV_ATTR_ONLY (1ULL << 54)
#define FI_NUMERICHOST (1ULL << 55)
#define FI_RMA_EVENT (1ULL << 56)
#define FI_SOURCE (1ULL << 57)
#define FI_NAMED_RX_CTX (1ULL << 58)
#define FI_DIRECTED_RECV (1ULL << 59)
struct fi_ioc {
void *addr;
size_t count;
};
/*
* Format for transport addresses to insert into address vectors
*/
enum {
FI_FORMAT_UNSPEC, /* void * */
FI_SOCKADDR, /* struct sockaddr */
FI_SOCKADDR_IN, /* struct sockaddr_in */
FI_SOCKADDR_IN6, /* struct sockaddr_in6 */
FI_SOCKADDR_IB, /* struct sockaddr_ib */
FI_ADDR_PSMX, /* uint64_t */
FI_ADDR_GNI,
FI_ADDR_BGQ,
FI_ADDR_MLX,
FI_ADDR_STR, /* formatted char * */
FI_ADDR_PSMX2, /* uint64_t[2] */
};
#define FI_ADDR_UNSPEC ((uint64_t) -1)
#define FI_ADDR_NOTAVAIL ((uint64_t) -1)
#define FI_KEY_NOTAVAIL ((uint64_t) -1)
#define FI_SHARED_CONTEXT SIZE_MAX
typedef uint64_t fi_addr_t;
enum fi_av_type {
FI_AV_UNSPEC,
FI_AV_MAP,
FI_AV_TABLE
};
/* Named enum for backwards compatibility */
enum fi_mr_mode {
FI_MR_UNSPEC,
FI_MR_BASIC, /* (1 << 0) */
FI_MR_SCALABLE, /* (1 << 1) */
};
#define FI_MR_LOCAL (1 << 2)
#define FI_MR_RAW (1 << 3)
#define FI_MR_VIRT_ADDR (1 << 4)
#define FI_MR_ALLOCATED (1 << 5)
#define FI_MR_PROV_KEY (1 << 6)
#define FI_MR_MMU_NOTIFY (1 << 7)
#define FI_MR_RMA_EVENT (1 << 8)
#define FI_MR_ENDPOINT (1 << 9)
enum fi_progress {
FI_PROGRESS_UNSPEC,
FI_PROGRESS_AUTO,
FI_PROGRESS_MANUAL
};
enum fi_threading {
FI_THREAD_UNSPEC,
FI_THREAD_SAFE,
FI_THREAD_FID,
FI_THREAD_DOMAIN,
FI_THREAD_COMPLETION,
FI_THREAD_ENDPOINT,
};
enum fi_resource_mgmt {
FI_RM_UNSPEC,
FI_RM_DISABLED,
FI_RM_ENABLED
};
#define FI_ORDER_NONE 0
#define FI_ORDER_RAR (1 << 0)
#define FI_ORDER_RAW (1 << 1)
#define FI_ORDER_RAS (1 << 2)
#define FI_ORDER_WAR (1 << 3)
#define FI_ORDER_WAW (1 << 4)
#define FI_ORDER_WAS (1 << 5)
#define FI_ORDER_SAR (1 << 6)
#define FI_ORDER_SAW (1 << 7)
#define FI_ORDER_SAS (1 << 8)
#define FI_ORDER_STRICT 0x1FF
#define FI_ORDER_DATA (1 << 16)
enum fi_ep_type {
FI_EP_UNSPEC,
FI_EP_MSG,
FI_EP_DGRAM,
FI_EP_RDM,
FI_EP_SOCK_STREAM,
FI_EP_SOCK_DGRAM,
};
/* Endpoint protocol
* If two providers support the same protocol, then they shall interoperate
* when the protocol capabilities match.
*/
enum {
FI_PROTO_UNSPEC,
FI_PROTO_RDMA_CM_IB_RC,
FI_PROTO_IWARP,
FI_PROTO_IB_UD,
FI_PROTO_PSMX,
FI_PROTO_UDP,
FI_PROTO_SOCK_TCP,
/* MXM provider is deprecated.
* We will keep this value in order to save binary compatibility.
*/
FI_PROTO_MXM,
FI_PROTO_IWARP_RDM,
FI_PROTO_IB_RDM,
FI_PROTO_GNI,
FI_PROTO_RXM,
FI_PROTO_RXD,
FI_PROTO_MLX,
FI_PROTO_NETWORKDIRECT,
FI_PROTO_PSMX2,
};
/* Mode bits */
#define FI_CONTEXT (1ULL << 59)
#define FI_MSG_PREFIX (1ULL << 58)
#define FI_ASYNC_IOV (1ULL << 57)
#define FI_RX_CQ_DATA (1ULL << 56)
#define FI_LOCAL_MR (1ULL << 55)
#define FI_NOTIFY_FLAGS_ONLY (1ULL << 54)
#define FI_RESTRICTED_COMP (1ULL << 53)
#define FI_CONTEXT2 (1ULL << 52)
struct fi_tx_attr {
uint64_t caps;
uint64_t mode;
uint64_t op_flags;
uint64_t msg_order;
uint64_t comp_order;
size_t inject_size;
size_t size;
size_t iov_limit;
size_t rma_iov_limit;
};
struct fi_rx_attr {
uint64_t caps;
uint64_t mode;
uint64_t op_flags;
uint64_t msg_order;
uint64_t comp_order;
size_t total_buffered_recv;
size_t size;
size_t iov_limit;
};
struct fi_ep_attr {
enum fi_ep_type type;
uint32_t protocol;
uint32_t protocol_version;
size_t max_msg_size;
size_t msg_prefix_size;
size_t max_order_raw_size;
size_t max_order_war_size;
size_t max_order_waw_size;
uint64_t mem_tag_format;
size_t tx_ctx_cnt;
size_t rx_ctx_cnt;
size_t auth_key_size;
uint8_t *auth_key;
};
struct fi_domain_attr {
struct fid_domain *domain;
char *name;
enum fi_threading threading;
enum fi_progress control_progress;
enum fi_progress data_progress;
enum fi_resource_mgmt resource_mgmt;
enum fi_av_type av_type;
int mr_mode;
size_t mr_key_size;
size_t cq_data_size;
size_t cq_cnt;
size_t ep_cnt;
size_t tx_ctx_cnt;
size_t rx_ctx_cnt;
size_t max_ep_tx_ctx;
size_t max_ep_rx_ctx;
size_t max_ep_stx_ctx;
size_t max_ep_srx_ctx;
size_t cntr_cnt;
size_t mr_iov_limit;
uint64_t caps;
uint64_t mode;
uint8_t *auth_key;
size_t auth_key_size;
size_t max_err_data;
size_t mr_cnt;
};
struct fi_fabric_attr {
struct fid_fabric *fabric;
char *name;
char *prov_name;
uint32_t prov_version;
uint32_t api_version;
};
struct fi_info {
struct fi_info *next;
uint64_t caps;
uint64_t mode;
uint32_t addr_format;
size_t src_addrlen;
size_t dest_addrlen;
void *src_addr;
void *dest_addr;
fid_t handle;
struct fi_tx_attr *tx_attr;
struct fi_rx_attr *rx_attr;
struct fi_ep_attr *ep_attr;
struct fi_domain_attr *domain_attr;
struct fi_fabric_attr *fabric_attr;
};
enum {
FI_CLASS_UNSPEC,
FI_CLASS_FABRIC,
FI_CLASS_DOMAIN,
FI_CLASS_EP,
FI_CLASS_SEP,
FI_CLASS_RX_CTX,
FI_CLASS_SRX_CTX,
FI_CLASS_TX_CTX,
FI_CLASS_STX_CTX,
FI_CLASS_PEP,
FI_CLASS_INTERFACE,
FI_CLASS_AV,
FI_CLASS_MR,
FI_CLASS_EQ,
FI_CLASS_CQ,
FI_CLASS_CNTR,
FI_CLASS_WAIT,
FI_CLASS_POLL,
FI_CLASS_CONNREQ,
FI_CLASS_MC,
};
struct fi_eq_attr;
struct fi_wait_attr;
/* fi_bind()-specific flags */
#define FI_SELECTIVE_COMPLETION (1ULL << 59)
struct fi_ops {
size_t size;
int (*close)(struct fid *fid);
int (*bind)(struct fid *fid, struct fid *bfid, uint64_t flags);
int (*control)(struct fid *fid, int command, void *arg);
int (*ops_open)(struct fid *fid, const char *name,
uint64_t flags, void **ops, void *context);
};
/* All fabric interface descriptors must start with this structure */
struct fid {
size_t fclass;
void *context;
struct fi_ops *ops;
};
int fi_getinfo(uint32_t version, const char *node, const char *service,
uint64_t flags, struct fi_info *hints, struct fi_info **info);
void fi_freeinfo(struct fi_info *info);
struct fi_info *fi_dupinfo(const struct fi_info *info);
static inline struct fi_info *fi_allocinfo(void)
{
return fi_dupinfo(NULL);
}
struct fi_ops_fabric {
size_t size;
int (*domain)(struct fid_fabric *fabric, struct fi_info *info,
struct fid_domain **dom, void *context);
int (*passive_ep)(struct fid_fabric *fabric, struct fi_info *info,
struct fid_pep **pep, void *context);
int (*eq_open)(struct fid_fabric *fabric, struct fi_eq_attr *attr,
struct fid_eq **eq, void *context);
int (*wait_open)(struct fid_fabric *fabric, struct fi_wait_attr *attr,
struct fid_wait **waitset);
int (*trywait)(struct fid_fabric *fabric, struct fid **fids,
int count);
};
struct fid_fabric {
struct fid fid;
struct fi_ops_fabric *ops;
uint32_t api_version;
};
int fi_fabric(struct fi_fabric_attr *attr, struct fid_fabric **fabric, void *context);
#define FI_CHECK_OP(ops, opstype, op) \
((ops->size > offsetof(opstype, op)) && ops->op)
static inline int fi_close(struct fid *fid)
{
return fid->ops->close(fid);
}
struct fi_alias {
struct fid **fid;
uint64_t flags;
};
struct fi_mr_raw_attr {
uint64_t flags;
uint64_t *base_addr;
uint8_t *raw_key;
size_t *key_size;
};
struct fi_mr_map_raw {
uint64_t flags;
uint64_t base_addr;
uint8_t *raw_key;
size_t key_size;
uint64_t *key;
};
/* control commands */
enum {
FI_GETFIDFLAG, /* uint64_t flags */
FI_SETFIDFLAG, /* uint64_t flags */
FI_GETOPSFLAG, /* uint64_t flags */
FI_SETOPSFLAG, /* uint64_t flags */
FI_ALIAS, /* struct fi_alias * */
FI_GETWAIT, /* void * wait object */
FI_ENABLE, /* NULL */
FI_BACKLOG, /* integer * */
FI_GET_RAW_MR, /* fi_mr_raw_attr */
FI_MAP_RAW_MR, /* fi_mr_map_raw */
FI_UNMAP_KEY, /* uint64_t key */
FI_QUEUE_WORK, /* struct fi_deferred_work */
FI_CANCEL_WORK, /* struct fi_deferred_work */
FI_FLUSH_WORK, /* NULL */
FI_REFRESH, /* mr: fi_mr_modify */
};
static inline int fi_control(struct fid *fid, int command, void *arg)
{
return fid->ops->control(fid, command, arg);
}
static inline int fi_alias(struct fid *fid, struct fid **alias_fid, uint64_t flags)
{
struct fi_alias alias;
alias.fid = alias_fid;
alias.flags = flags;
return fi_control(fid, FI_ALIAS, &alias);
}
static inline int
fi_open_ops(struct fid *fid, const char *name, uint64_t flags,
void **ops, void *context)
{
return fid->ops->ops_open(fid, name, flags, ops, context);
}
enum fi_type {
FI_TYPE_INFO,
FI_TYPE_EP_TYPE,
FI_TYPE_CAPS,
FI_TYPE_OP_FLAGS,
FI_TYPE_ADDR_FORMAT,
FI_TYPE_TX_ATTR,
FI_TYPE_RX_ATTR,
FI_TYPE_EP_ATTR,
FI_TYPE_DOMAIN_ATTR,
FI_TYPE_FABRIC_ATTR,
FI_TYPE_THREADING,
FI_TYPE_PROGRESS,
FI_TYPE_PROTOCOL,
FI_TYPE_MSG_ORDER,
FI_TYPE_MODE,
FI_TYPE_AV_TYPE,
FI_TYPE_ATOMIC_TYPE,
FI_TYPE_ATOMIC_OP,
FI_TYPE_VERSION,
FI_TYPE_EQ_EVENT,
FI_TYPE_CQ_EVENT_FLAGS,
FI_TYPE_MR_MODE,
FI_TYPE_OP_TYPE,
};
char *fi_tostr(const void *data, enum fi_type datatype);
enum fi_param_type {
FI_PARAM_STRING,
FI_PARAM_INT,
FI_PARAM_BOOL
};
struct fi_param {
const char *name;
enum fi_param_type type;
const char *help_string;
const char *value;
};
int fi_getparams(struct fi_param **params, int *count);
void fi_freeparams(struct fi_param *params);
#ifdef FABRIC_DIRECT
#include <rdma/fi_direct.h>
#endif /* FABRIC_DIRECT */
#ifndef FABRIC_DIRECT_
struct fi_context {
void *internal[4];
};
struct fi_context2 {
void *internal[8];
};
#endif
#ifdef __cplusplus
}
#endif
#endif /* FABRIC_H */
|