Skip to content

Commit

Permalink
prov/peer: Remove peer_cq implementation
Browse files Browse the repository at this point in the history
struct peer_cq is no longer needed.

Signed-off-by: Tomasz Gromadzki <[email protected]>
  • Loading branch information
grom72 committed Dec 6, 2022
1 parent 9e6eb35 commit 80f3b96
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 116 deletions.
7 changes: 0 additions & 7 deletions include/ofi_peer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,4 @@

#include <ofi_util.h>

int ofi_peer_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
struct fid_cq **cq_fid, void *context);

ssize_t ofi_peer_cq_write(struct fid_cq *cq, void *context, uint64_t flags,
size_t len, void *buf, uint64_t data, uint64_t tag,
fi_addr_t src);

#endif /* _OFI_PEER_H_ */
2 changes: 1 addition & 1 deletion prov/coll/src/coll_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
static struct fi_ops_domain coll_domain_ops = {
.size = sizeof(struct fi_ops_domain),
.av_open = coll_av_open,
.cq_open = ofi_peer_cq_open,
.cq_open = fi_no_cq_open,
.endpoint = coll_endpoint,
.scalable_ep = fi_no_scalable_ep,
.cntr_open = fi_no_cntr_open,
Expand Down
108 changes: 0 additions & 108 deletions prov/peer/src/peer_cq.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,111 +31,3 @@
*/

#include "peer.h"

static int peer_cq_close(struct fid *fid)
{
struct peer_cq *cq;
int ret;

cq = container_of(fid, struct peer_cq, util_cq.cq_fid.fid);

ret = ofi_cq_cleanup(&cq->util_cq);
if (ret)
return ret;

free(cq);
return 0;
}

static struct fi_ops peer_cq_fi_ops = {
.size = sizeof(struct fi_ops),
.close = peer_cq_close,
.bind = fi_no_bind,
.control = fi_no_control,
.ops_open = fi_no_ops_open,
};

static struct fi_ops_cq peer_cq_ops = {
.size = sizeof(struct fi_ops_cq),
.read = fi_no_cq_read,
.readfrom = fi_no_cq_readfrom,
.readerr = fi_no_cq_readerr,
.sread = fi_no_cq_sread,
.sreadfrom = fi_no_cq_sreadfrom,
.signal = fi_no_cq_signal,
.strerror = fi_no_cq_strerror,
};

static int peer_cq_init(const struct fi_provider* provider,
struct fid_domain *domain, struct fi_cq_attr *attr,
struct fid_cq **cq_fid, struct fi_peer_cq_context *peer_context)
{
struct peer_cq *cq;
int ret;

if (!attr || !(attr->flags & FI_PEER)) {
FI_WARN(provider, FI_LOG_CORE, "FI_PEER flag required\n");
return -FI_EINVAL;
}

if (!peer_context || peer_context->size < sizeof(*peer_context)) {
FI_WARN(provider, FI_LOG_CORE, "invalid peer CQ context\n");
return -FI_EINVAL;
}

cq = calloc(1, sizeof(*cq));
if (!cq)
return -FI_ENOMEM;

cq->peer_cq = peer_context->cq;

ret = ofi_cq_init(provider, domain, attr, &cq->util_cq,
&ofi_cq_progress, NULL);
if (ret)
goto err;

*cq_fid = &cq->util_cq.cq_fid;
(*cq_fid)->fid.ops = &peer_cq_fi_ops;
(*cq_fid)->ops = &peer_cq_ops;
return 0;

err:
free(cq);
return ret;
}

int ofi_peer_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
struct fid_cq **cq_fid, void *context)
{
struct util_domain *util_domain;
struct fi_peer_cq_context *peer_context;

util_domain = container_of(domain, struct util_domain, domain_fid.fid);
peer_context = context;

return peer_cq_init(util_domain->fabric->prov, domain, attr,
cq_fid, peer_context);
}

ssize_t ofi_peer_cq_write(struct fid_cq *cq_fid, void *context, uint64_t flags,
size_t len, void *buf, uint64_t data, uint64_t tag,
fi_addr_t src)
{
struct peer_cq *cq;

cq = container_of(cq_fid, struct peer_cq, util_cq.cq_fid);

return cq->peer_cq->owner_ops->write(cq->peer_cq, context,
flags, len, buf, data, tag, src);
}


ssize_t ofi_peer_cq_writeerr(struct fid_cq *cq_fid,
const struct fi_cq_err_entry *err_entry)
{
struct peer_cq *cq;

cq = container_of(cq_fid, struct peer_cq, util_cq.cq_fid);

return cq->peer_cq->owner_ops->writeerr(cq->peer_cq, err_entry);
}

0 comments on commit 80f3b96

Please sign in to comment.