Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Support multiple auth keys per EP #9319

Closed
wants to merge 13 commits into from
16 changes: 15 additions & 1 deletion include/ofi_abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ extern "C" {
* name appended with the ABI version that it is compatible with.
*/

#define CURRENT_ABI "FABRIC_1.6"
#define CURRENT_ABI "FABRIC_1.7"

#if HAVE_ALIAS_ATTRIBUTE == 1
#define DEFAULT_SYMVER_PRE(a) a##_
Expand Down Expand Up @@ -164,6 +164,20 @@ struct fi_cq_err_entry_1_0 {
void *err_data;
};

struct fi_cq_err_entry_1_1 {
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;
};

#ifdef __cplusplus
}
Expand Down
17 changes: 17 additions & 0 deletions include/ofi_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,23 @@ ssize_t util_srx_generic_trecv(struct fid_ep *ep_fid, const struct iovec *iov,
void **desc, size_t iov_count, fi_addr_t addr,
void *context, uint64_t tag, uint64_t ignore,
uint64_t flags);

static inline void ofi_cq_err_memcpy(uint32_t api_version,
struct fi_cq_err_entry *user_buf,
const struct fi_cq_err_entry *prov_buf)
{
size_t size;

if (FI_VERSION_GE(api_version, FI_VERSION(1, 20)))
size = sizeof(struct fi_cq_err_entry);
else if (FI_VERSION_GE(api_version, FI_VERSION(1, 5)))
size = sizeof(struct fi_cq_err_entry_1_1);
else
size = sizeof(struct fi_cq_err_entry_1_0);

memcpy(user_buf, prov_buf, size);
}

#ifdef __cplusplus
}
#endif
Expand Down
8 changes: 7 additions & 1 deletion include/rdma/fabric.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ typedef struct fid *fid_t;
/* Tagged messages, buffered receives, CQ flags */
#define FI_CLAIM (1ULL << 59)
#define FI_DISCARD (1ULL << 58)

#define FI_AUTH_KEY (1ULL << 57)

struct fi_ioc {
void *addr;
Expand Down Expand Up @@ -227,6 +227,7 @@ enum {
#define FI_ADDR_NOTAVAIL ((uint64_t) -1)
#define FI_KEY_NOTAVAIL ((uint64_t) -1)
#define FI_SHARED_CONTEXT SIZE_MAX
#define FI_AV_AUTH_KEY SIZE_MAX
typedef uint64_t fi_addr_t;

enum fi_av_type {
Expand Down Expand Up @@ -392,6 +393,7 @@ struct fi_tx_attr {
size_t iov_limit;
size_t rma_iov_limit;
uint32_t tclass;
uint64_t optional_caps;
iziemba marked this conversation as resolved.
Show resolved Hide resolved
};

struct fi_rx_attr {
Expand All @@ -403,6 +405,7 @@ struct fi_rx_attr {
size_t total_buffered_recv;
size_t size;
size_t iov_limit;
uint64_t optional_caps;
};

struct fi_ep_attr {
Expand Down Expand Up @@ -449,6 +452,8 @@ struct fi_domain_attr {
size_t max_err_data;
size_t mr_cnt;
uint32_t tclass;
size_t max_ep_auth_key;
uint64_t optional_caps;
};

struct fi_fabric_attr {
Expand All @@ -475,6 +480,7 @@ struct fi_info {
struct fi_domain_attr *domain_attr;
struct fi_fabric_attr *fabric_attr;
struct fid_nic *nic;
uint64_t optional_caps;
};

struct fi_device_attr {
Expand Down
37 changes: 37 additions & 0 deletions include/rdma/fi_domain.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ struct fi_ops_av {
char *buf, size_t *len);
int (*av_set)(struct fid_av *av, struct fi_av_set_attr *attr,
struct fid_av_set **av_set, void *context);
int (*insert_auth_key)(struct fid_av *av, const void *auth_key,
size_t auth_key_size, fi_addr_t *fi_addr,
uint64_t flags);
int (*lookup_auth_key)(struct fid_av *av, fi_addr_t fi_addr,
void *auth_key, size_t *auth_key_size);
iziemba marked this conversation as resolved.
Show resolved Hide resolved
int (*set_user_id)(struct fid_av *av, fi_addr_t fi_addr,
fi_addr_t user_id);
};

struct fid_av {
Expand Down Expand Up @@ -141,6 +148,11 @@ struct fi_mr_dmabuf {
size_t len;
};

struct fi_mr_auth_key {
struct fid_av *av;
fi_addr_t src_addr;
};

struct fi_mr_attr {
union {
const struct iovec *mr_iov;
Expand Down Expand Up @@ -532,6 +544,31 @@ fi_av_straddr(struct fid_av *av, const void *addr, char *buf, size_t *len)
return av->ops->straddr(av, addr, buf, len);
}

static inline int
fi_av_insert_auth_key(struct fid_av *av, const void *auth_key,
size_t auth_key_size, fi_addr_t *fi_addr, uint64_t flags)
{
return FI_CHECK_OP(av->ops, struct fi_ops_av, insert_auth_key) ?
av->ops->insert_auth_key(av, auth_key, auth_key_size, fi_addr,
flags) : -FI_ENOSYS;
}

static inline int
fi_av_lookup_auth_key(struct fid_av *av, fi_addr_t addr, void *auth_key,
size_t *auth_key_size)
{
return FI_CHECK_OP(av->ops, struct fi_ops_av, lookup_auth_key) ?
av->ops->lookup_auth_key(av, addr, auth_key, auth_key_size) :
-FI_ENOSYS;
}

static inline int
fi_av_set_user_id(struct fid_av *av, fi_addr_t fi_addr, fi_addr_t user_id)
{
return FI_CHECK_OP(av->ops, struct fi_ops_av, set_user_id) ?
av->ops->set_user_id(av, fi_addr, user_id) : -FI_ENOSYS;
}

static inline fi_addr_t
fi_rx_addr(fi_addr_t fi_addr, int rx_index, int rx_ctx_bits)
{
Expand Down
4 changes: 4 additions & 0 deletions include/rdma/fi_eq.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ struct fi_cq_err_entry {
/* err_data is available until the next time the CQ is read */
void *err_data;
size_t err_data_size;
fi_addr_t src_addr;
iziemba marked this conversation as resolved.
Show resolved Hide resolved
};

enum fi_cq_wait_cond {
Expand Down Expand Up @@ -403,6 +404,9 @@ fi_cq_readfrom(struct fid_cq *cq, void *buf, size_t count, fi_addr_t *src_addr)
static inline ssize_t
fi_cq_readerr(struct fid_cq *cq, struct fi_cq_err_entry *buf, uint64_t flags)
{
/* For compatibility with older providers. */
if (buf)
buf->src_addr = FI_ADDR_NOTAVAIL;
return cq->ops->readerr(cq, buf, flags);
}

Expand Down
9 changes: 8 additions & 1 deletion libfabric.map.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,11 @@ FABRIC_1.5 {
FABRIC_1.6 {
global:
fi_log_ready;
} FABRIC_1.5;
} FABRIC_1.5;

FABRIC_1.7 {
global:
fi_getinfo;
fi_freeinfo;
fi_dupinfo;
} FABRIC_1.6;
17 changes: 17 additions & 0 deletions man/fabric.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,23 @@ call.

ABI version starting with libfabric 1.14. Added fi_log_ready for providers.

## ABI 1.7

ABI version starting with libfabric 1.20. Added new fields to the following
attributes:

*fi_domain_attr*
: Added max_ep_auth_key and optional_caps

*fi_info*
: Added optional_caps

*fi_tx_attr*
: Added optional_caps

*fi_rx_attr*
: Added optional_caps

# SEE ALSO

[`fi_info`(1)](fi_info.1.html),
Expand Down
Loading