Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilnanal committed Oct 15, 2024
1 parent d514343 commit ca75985
Show file tree
Hide file tree
Showing 7 changed files with 364 additions and 5 deletions.
31 changes: 31 additions & 0 deletions prov/xxx/xxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,36 @@
#include <rdma/fi_trigger.h>
#include <rdma/providers/fi_prov.h>

#include <ofi.h>
#include <ofi_enosys.h>
#include <ofi_rbuf.h>
#include <ofi_list.h>
#include <ofi_signal.h>
#include <ofi_epoll.h>
#include <ofi_util.h>
#include <ofi_atomic.h>
#include <ofi_iov.h>
#include <ofi_mr.h>
#include <ofi_lock.h>



extern struct fi_provider xxx_prov;
extern struct fi_info xxx_info;
extern struct util_prov xxx_util_prov;

int xxx_fabric(struct fi_fabric_attr *attr, struct fid_fabric **fabric,
void *context);
int xxx_av_open(struct fid_domain *domain_fid, struct fi_av_attr *attr,
struct fid_av **fid_av, void *context);
int xnet_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
struct fid_cq **cq_fid, void *context);
int xxx_endpoint(struct fid_domain *domain, struct fi_info *info,
struct fid_ep **ep_fid, void *context);
int xxx_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
struct fid_cntr **cntr_fid, void *context);
int xxx_srx_context (struct fid_domain *domain, struct fi_rx_attr *attr,
struct fid_ep **rx_ep, void *context);

int xxx_srx_context (struct fid_domain *domain, struct fi_rx_attr *attr,
struct fid_ep **rx_ep, void *context);
10 changes: 9 additions & 1 deletion prov/xxx/xxx_atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@
* 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.
*/
*/

#include "xxx.h"

int xxx_query_atomic(struct fid_domain *domain, enum fi_datatype datatype,
enum fi_op op, struct fi_atomic_attr *attr, uint64_t flags)
{
return fi_no_query_atomic(domain, datatype, op, attr, flags);
}
10 changes: 9 additions & 1 deletion prov/xxx/xxx_cq.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@
* 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.
*/
*/

#include "xxx.h"

int xnet_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
struct fid_cq **cq_fid, void *context)
{
return fi_no_cq_open(domain, attr, cq_fid, context);
}
108 changes: 107 additions & 1 deletion prov/xxx/xxx_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,110 @@
* 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.
*/
*/

#include "xxx.h"

static int xxx_query_collective(struct fid_domain *domain,
enum fi_collective_op coll,
struct fi_collective *attr, uint64_t flags)
{
return fi_no_query_collective(domain, coll, attr, flags);
}

static struct fi_ops_domain xxx_domain_ops = {
.size = sizeof(struct fi_ops_domain),
.av_open = xxx_av_open,
.cq_open = xxx_cq_open,
.endpoint = xxx_endpoint,
.scalable_ep = fi_no_scalable_ep,
.cntr_open = xxx_cntr_open,
.poll_open = fi_no_poll_create,
.stx_ctx = fi_no_stx_context,
.srx_ctx = xxx_srx_context,
.query_atomic = xxx_query_atomic,
.query_collective = fi_no_query_collective,
};

static int xxx_domain_close(fid_t fid)
{
int ret;
struct xxx_domain *domain;

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

ret = ofi_domain_close(&domain->util_domain);
if (ret)
return ret;

free(domain);
return 0;
}

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

static int xxx_mr_reg(struct fid *fid, const void *buf, size_t len,
uint64_t access, uint64_t offset, uint64_t requested_key,
uint64_t flags, struct fid_mr **mr_fid, void *context)
{
return ofi_mr_reg(fid, buf, len, access, offset, requested_key, flags,
mr_fid, context);
}

static int xxx_mr_regv(struct fid *fid, const struct iovec *iov, size_t count,
uint64_t access, uint64_t offset, uint64_t requested_key,
uint64_t flags, struct fid_mr **mr_fid, void *context)
{
return ofi_mr_regv(fid, iov, count, access, offset, requested_key,
flags, mr_fid, context);
}

static int xxx_mr_regattr(struct fid *fid, const struct fi_mr_attr *attr,
uint64_t flags, struct fid_mr **mr_fid)
{
return ofi_mr_regattr(fid, attr, flags, mr_fid);
}

static struct fi_ops_mr xxx_mr_ops = {
.size = sizeof(struct fi_ops_mr),
.reg = xxx_mr_reg,
.regv = xxx_mr_regv,
.regattr = xxx_mr_regattr,
};


int xxx_domain_open(struct fid_fabric *fabric, struct fi_info *info,
struct fid_domain **domain, void *context)
{
int ret;
struct xxx_domain *xxx_domain;

ret = ofi_prov_check_info(&xxx_util_prov, fabric->api_version, info);
if (ret)
return ret;

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

ret = ofi_domain_init(fabric, info, &xxx_domain->util_domain, context,
OFI_LOCK_SPINLOCK);
if (ret) {
free(xxx_domain);
return ret;
}

*domain = &xxx_domain->util_domain.domain_fid;
(*domain)->fid.ops = &xxx_domain_fi_ops;
(*domain)->ops = &xxx_domain_ops;
(*domain)->mr = &xxx_mr_ops;

return 0;
}
151 changes: 150 additions & 1 deletion prov/xxx/xxx_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,153 @@
* 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.
*/
*/

#include "xxx.h"

static int xxx_setname(fid_t fid, void *addr, size_t addrlen)
{
return fi_no_setname(fid, addr, addrlen);
}

static int xxx_getname(fid_t fid, void *addr, size_t *addrlen)
{
return fi_no_getname(fid, addr, addrlen);
}

static int xxx_getpeer(struct fid_ep *ep, void *addr, size_t *addrlen)
{
return fi_no_getpeer(ep, addr, addrlen);
}

static int xxx_connect(struct fid_ep *ep, const void *addr, const void *param,
size_t paramlen)
{
return fi_no_connect(ep, addr, param, paramlen);
}

static int xxx_listen(struct fid_pep *pep)
{
return fi_no_listen(pep);
}

static int xxx_accept(struct fid_ep *ep, const void *param, size_t paramlen)
{
return fi_no_accept(ep, param, paramlen);
}

static int xxx_reject(struct fid_pep *pep, fid_t handle, const void *param,
size_t paramlen)
{
return fi_no_reject(pep, handle, param, paramlen);
}

static int xxx_shutdown(struct fid_ep *ep, uint64_t flags)
{
return fi_no_shutdown(ep, flags);
}

static struct fi_ops_cm xxx_cm_ops = {
.size = sizeof(struct fi_ops_cm),
.setname = xxx_setname,
.getname = xxx_getname,
.getpeer = xxx_getpeer,
.connect = xxx_connect,
.listen = xxx_listen,
.accept = xxx_accept,
.reject = xxx_reject,
.shutdown = xxx_shutdown,
};

static ssize_t xxx_ep_cancel(struct fid_t ep_fid, void *context)
{
return -FI_ENOSYS;
}

int xxx_ep_getopt(fid_t fid, int level, int optname, void *optval,
size_t *optlen)
{
return -FI_ENOSYS;
}

int xxx_ep_setopt(fid_t fid, int level, int optname, const void *optval,
size_t optlen)
{
return -FI_ENOSYS;
}

int xxx_tx_ctx(struct fid_ep *sep, int index, struct fi_tx_attr *attr,
struct fid_ep **tx_ep, void *context)
{
return fi_no_tx_ctx(sep, index, attr, tx_ep, context);
}

int xxx_rx_ctx(struct fid_ep *sep, int index, struct fi_tx_attr *attr,
struct fid_ep **tx_ep, void *context)
{
return fi_no_rx_ctx(sep, index, attr, tx_ep, context);
}

ssize_t xxx_rx_size_left(struct fid_ep *ep)
{
return fi_no_rx_size_left(ep);
}

ssize_t xxx_tx_size_left(struct fid_ep *ep)
{
return fi_no_tx_size_left(ep);
}

static struct fi_ops_ep xxx_ep_ops = {
.size = sizeof(struct fi_ops_ep),
.cancel = xxx_ep_cancel,
.getopt = xxx_ep_getopt,
.setopt = xxx_ep_setopt,
.tx_ctx = xxx_tx_ctx,
.rx_ctx = xxx_rx_ctx,
.rx_size_left = xxx_rx_size_left,
.tx_size_left = xxx_tx_size_left,
};

static int xxx_ep_close(struct fid *ep_fid)
{
return fi_no_close(ep_fid);
}

static int xxx_ep_bind(struct fid *ep_fid, struct fid *bfid, uint64_t flags)
{
return fi_no_bind(ep_fid, bfid, flags);
}

static int xxx_ep_ctrl(struct fid *ep_fid, int command, void *arg)
{
return fi_no_control(ep_fid, command, arg);
}

static int xxx_ops_open(struct fid *fid, const char *name, uint64_t flags,
void **ops, void *context)
{
return fi_no_ops_open(fid, name, flags, ops, context);
}

static struct fi_ops xxx_ep_fi_ops = {
.size = sizeof(struct fi_ops),
.close = xxx_ep_close,
.bind = xxx_ep_bind,
.control = xxx_ep_ctrl,
.ops_open = xxx_ops_open,
.tostr = fi_no_tostr,
.ops_set = fi_no_ops_set
};

int xxx_endpoint(struct fid_domain *domain, struct fi_info *info,
struct fid_ep **ep_fid, void *context)
{
return fi_no_endpoint(domain, info, ep_fid, context);
}

int xxx_sep_open(struct fid_domain *domain, struct fi_info *info,
struct fid_ep **sep, void *context)
{
return fi_no_scalable_ep(domain, info, sep, context);
}
Loading

0 comments on commit ca75985

Please sign in to comment.