| 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_DOMAIN_H_ |
| 36 |
#define _FI_DIRECT_DOMAIN_H_ |
| 37 |
|
| 38 |
#define FABRIC_DIRECT_DOMAIN 1 |
| 39 |
|
| 40 |
/******************************************************************************* |
| 41 |
* GNI API Functions |
| 42 |
******************************************************************************/ |
| 43 |
extern int gnix_domain_open(struct fid_fabric *fabric, struct fi_info *info, |
| 44 |
struct fid_domain **dom, void *context); |
| 45 |
|
| 46 |
extern int gnix_domain_bind(struct fid_domain *domain, struct fid *fid, |
| 47 |
uint64_t flags); |
| 48 |
|
| 49 |
extern int gnix_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr, |
| 50 |
struct fid_cq **cq, void *context); |
| 51 |
|
| 52 |
extern int gnix_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr, |
| 53 |
struct fid_cntr **cntr, void *context); |
| 54 |
|
| 55 |
extern int gnix_wait_open(struct fid_fabric *fabric, struct fi_wait_attr *attr, |
| 56 |
struct fid_wait **waitset); |
| 57 |
|
| 58 |
extern int gnix_poll_open(struct fid_domain *domain, struct fi_poll_attr *attr, |
| 59 |
struct fid_poll **pollset); |
| 60 |
|
| 61 |
extern int gnix_mr_reg(struct fid *fid, const void *buf, size_t len, |
| 62 |
uint64_t access, uint64_t offset, uint64_t requested_key, |
| 63 |
uint64_t flags, struct fid_mr **mr_o, void *context); |
| 64 |
|
| 65 |
extern int gnix_mr_bind(fid_t fid, struct fid *bfid, uint64_t flags); |
| 66 |
|
| 67 |
extern int gnix_av_open(struct fid_domain *domain, struct fi_av_attr *attr, |
| 68 |
struct fid_av **av, void *context); |
| 69 |
|
| 70 |
extern int gnix_av_bind(struct fid_av *av, struct fid *fid, uint64_t flags); |
| 71 |
|
| 72 |
extern int gnix_av_insert(struct fid_av *av, const void *addr, size_t count, |
| 73 |
fi_addr_t *fi_addr, uint64_t flags, void *context); |
| 74 |
|
| 75 |
extern int gnix_av_insertsvc(struct fid_av *av, const char *node, |
| 76 |
const char *service, fi_addr_t *fi_addr, |
| 77 |
uint64_t flags, void *context); |
| 78 |
|
| 79 |
extern int gnix_av_insertsym(struct fid_av *av, const char *node, |
| 80 |
size_t nodecnt, const char *service, size_t svccnt, |
| 81 |
fi_addr_t *fi_addr, uint64_t flags, void *context); |
| 82 |
|
| 83 |
extern int gnix_av_remove(struct fid_av *av, fi_addr_t *fi_addr, size_t count, |
| 84 |
uint64_t flags); |
| 85 |
|
| 86 |
extern int gnix_av_lookup(struct fid_av *av, fi_addr_t fi_addr, void *addr, |
| 87 |
size_t *addrlen); |
| 88 |
|
| 89 |
extern const char *gnix_av_straddr(struct fid_av *av, const void *addr, |
| 90 |
char *buf, size_t *len); |
| 91 |
|
| 92 |
/******************************************************************************* |
| 93 |
* Libfabric API Functions |
| 94 |
******************************************************************************/ |
| 95 |
static inline int fi_domain(struct fid_fabric *fabric, struct fi_info *info, |
| 96 |
struct fid_domain **domain, void *context) |
| 97 |
{ |
| 98 |
return gnix_domain_open(fabric, info, domain, context); |
| 99 |
} |
| 100 |
|
| 101 |
static inline int fi_domain_bind(struct fid_domain *domain, struct fid *fid, |
| 102 |
uint64_t flags) |
| 103 |
{ |
| 104 |
return gnix_domain_bind(domain, fid, flags); |
| 105 |
} |
| 106 |
|
| 107 |
static inline int fi_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr, |
| 108 |
struct fid_cq **cq, void *context) |
| 109 |
{ |
| 110 |
return gnix_cq_open(domain, attr, cq, context); |
| 111 |
} |
| 112 |
|
| 113 |
static inline int fi_cntr_open(struct fid_domain *domain, |
| 114 |
struct fi_cntr_attr *attr, |
| 115 |
struct fid_cntr **cntr, void *context) |
| 116 |
{ |
| 117 |
return gnix_cntr_open(domain, attr, cntr, context); |
| 118 |
} |
| 119 |
|
| 120 |
static inline int fi_wait_open(struct fid_fabric *fabric, |
| 121 |
struct fi_wait_attr *attr, |
| 122 |
struct fid_wait **waitset) |
| 123 |
{ |
| 124 |
return gnix_wait_open(fabric, attr, waitset); |
| 125 |
} |
| 126 |
|
| 127 |
static inline int fi_poll_open(struct fid_domain *domain, |
| 128 |
struct fi_poll_attr *attr, |
| 129 |
struct fid_poll **pollset) |
| 130 |
{ |
| 131 |
return gnix_poll_open(domain, attr, pollset); |
| 132 |
} |
| 133 |
|
| 134 |
static inline int fi_mr_reg(struct fid_domain *domain, const void *buf, |
| 135 |
size_t len, uint64_t access, uint64_t offset, |
| 136 |
uint64_t requested_key, uint64_t flags, |
| 137 |
struct fid_mr **mr, void *context) |
| 138 |
{ |
| 139 |
return gnix_mr_reg(&domain->fid, buf, len, access, offset, |
| 140 |
requested_key, flags, mr, context); |
| 141 |
} |
| 142 |
|
| 143 |
static inline void *fi_mr_desc(struct fid_mr *mr) |
| 144 |
{ |
| 145 |
return mr->mem_desc; |
| 146 |
} |
| 147 |
|
| 148 |
static inline uint64_t fi_mr_key(struct fid_mr *mr) |
| 149 |
{ |
| 150 |
return mr->key; |
| 151 |
} |
| 152 |
|
| 153 |
static inline int fi_mr_bind(struct fid_mr *mr, struct fid *bfid, |
| 154 |
uint64_t flags) |
| 155 |
{ |
| 156 |
return gnix_mr_bind(&mr->fid, bfid, flags); |
| 157 |
} |
| 158 |
|
| 159 |
static inline int fi_av_open(struct fid_domain *domain, struct fi_av_attr *attr, |
| 160 |
struct fid_av **av, void *context) |
| 161 |
{ |
| 162 |
return gnix_av_open(domain, attr, av, context); |
| 163 |
} |
| 164 |
|
| 165 |
static inline int fi_av_bind(struct fid_av *av, struct fid *fid, uint64_t flags) |
| 166 |
{ |
| 167 |
return gnix_av_bind(av, fid, flags); |
| 168 |
} |
| 169 |
|
| 170 |
static inline int fi_av_insert(struct fid_av *av, const void *addr, |
| 171 |
size_t count, fi_addr_t *fi_addr, uint64_t flags, |
| 172 |
void *context) |
| 173 |
{ |
| 174 |
return gnix_av_insert(av, addr, count, fi_addr, flags, context); |
| 175 |
} |
| 176 |
|
| 177 |
static inline int fi_av_insertsvc(struct fid_av *av, const char *node, |
| 178 |
const char *service, fi_addr_t *fi_addr, |
| 179 |
uint64_t flags, void *context) |
| 180 |
{ |
| 181 |
return gnix_av_insertsvc(av, node, service, fi_addr, flags, context); |
| 182 |
} |
| 183 |
|
| 184 |
static inline int fi_av_insertsym(struct fid_av *av, const char *node, |
| 185 |
size_t nodecnt, const char *service, |
| 186 |
size_t svccnt, fi_addr_t *fi_addr, |
| 187 |
uint64_t flags, void *context) |
| 188 |
{ |
| 189 |
return gnix_av_insertsym(av, node, nodecnt, service, svccnt, fi_addr, |
| 190 |
flags, context); |
| 191 |
} |
| 192 |
|
| 193 |
static inline int fi_av_remove(struct fid_av *av, fi_addr_t *fi_addr, |
| 194 |
size_t count, uint64_t flags) |
| 195 |
{ |
| 196 |
return gnix_av_remove(av, fi_addr, count, flags); |
| 197 |
} |
| 198 |
|
| 199 |
static inline int fi_av_lookup(struct fid_av *av, fi_addr_t fi_addr, void *addr, |
| 200 |
size_t *addrlen) |
| 201 |
{ |
| 202 |
return gnix_av_lookup(av, fi_addr, addr, addrlen); |
| 203 |
} |
| 204 |
|
| 205 |
static inline const char *fi_av_straddr(struct fid_av *av, const void *addr, |
| 206 |
char *buf, size_t *len) |
| 207 |
{ |
| 208 |
return gnix_av_straddr(av, addr, buf, len); |
| 209 |
} |
| 210 |
|
| 211 |
static inline fi_addr_t fi_rx_addr(fi_addr_t fi_addr, int rx_index, |
| 212 |
int rx_ctx_bits) |
| 213 |
{ |
| 214 |
return (fi_addr_t)(((uint64_t)rx_index << (64 - rx_ctx_bits)) | |
| 215 |
fi_addr); |
| 216 |
} |
| 217 |
|
| 218 |
#endif /* _FI_DIRECT_DOMAIN_H_ */ |