Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions debian/ibverbs-providers.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,19 @@ libionic.so.1 ibverbs-providers #MINVER#
ionic_dv_pd_set_udma_mask@IONIC_1.0 59
ionic_dv_pd_set_sqcmb@IONIC_1.0 59
ionic_dv_pd_set_rqcmb@IONIC_1.0 59
IONIC_1.1@IONIC_1.1 65
ionic_dv_is_ionic_ctx@IONIC_1.1 65
ionic_dv_is_ionic_pd@IONIC_1.1 65
ionic_dv_is_ionic_cq@IONIC_1.1 65
ionic_dv_is_ionic_qp@IONIC_1.1 65
ionic_dv_cq_get_udma_mask@IONIC_1.1 65
ionic_dv_qp_get_udma_idx@IONIC_1.1 65
ionic_dv_pd_set_expdb_mask@IONIC_1.1 65
ionic_dv_qp_set_gda@IONIC_1.1 65
ionic_dv_qp_get_send_dbell_data@IONIC_1.1 65
ionic_dv_qp_get_recv_dbell_data@IONIC_1.1 65
ionic_dv_get_ctx@IONIC_1.1 65
ionic_dv_get_cq@IONIC_1.1 65
ionic_dv_get_qp@IONIC_1.1 65
ionic_dv_create_cq_ex@IONIC_1.1 65

1 change: 1 addition & 0 deletions debian/libibverbs-dev.install
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ usr/include/infiniband/efadv.h
usr/include/infiniband/hnsdv.h
usr/include/infiniband/ib_user_ioctl_verbs.h
usr/include/infiniband/ionic_dv.h
usr/include/infiniband/ionic_fw_types.h
usr/include/infiniband/manadv.h
usr/include/infiniband/mlx4dv.h
usr/include/infiniband/mlx5_api.h
Expand Down
3 changes: 2 additions & 1 deletion providers/ionic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rdma_shared_provider(ionic libionic.map
1 1.0.${PACKAGE_VERSION}
1 1.1.${PACKAGE_VERSION}
ionic.c
ionic_verbs.c
ionic_memory.c
Expand All @@ -9,6 +9,7 @@ rdma_shared_provider(ionic libionic.map

publish_headers(infiniband
ionic_dv.h
ionic_fw_types.h
)

rdma_pkg_config("ionic" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}")
25 changes: 18 additions & 7 deletions providers/ionic/ionic.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "ionic-abi.h"

#include "ionic_dv.h"
#include "ionic_memory.h"
#include "ionic_queue.h"
#include "ionic_table.h"
Expand Down Expand Up @@ -47,14 +48,18 @@
#define IONIC_PD_TAG_RQ (IONIC_PD_TAG | 3)

enum {
IONIC_CQ_SUPPORTED_COMP_MASK =
IBV_CQ_INIT_ATTR_MASK_FLAGS |
IBV_CQ_INIT_ATTR_MASK_PD,

IONIC_CQ_SUPPORTED_WC_FLAGS =
IBV_WC_EX_WITH_BYTE_LEN |
IBV_WC_EX_WITH_IMM |
IBV_WC_EX_WITH_QP_NUM |
IBV_WC_EX_WITH_SRC_QP |
IBV_WC_EX_WITH_SLID |
IBV_WC_EX_WITH_SL |
IBV_WC_EX_WITH_DLID_PATH_BITS
IBV_WC_STANDARD_FLAGS,

IONIC_CQ_SUPPORTED_EXT_COMP_MASK =
IONIC_CQ_INIT_ATTR_MASK_FLAGS,

IONIC_CQ_SUPPORTED_EXT_FLAGS =
IONIC_CQ_INIT_ATTR_CCQE,
};

enum {
Expand Down Expand Up @@ -121,6 +126,7 @@ struct ionic_pd {
struct ionic_td *td;

uint8_t udma_mask;
uint8_t expdb_mask;
uint8_t sq_cmb;
uint8_t rq_cmb;

Expand Down Expand Up @@ -193,6 +199,7 @@ struct ionic_rq {
uint16_t cmb_prod;
uint8_t cmb;
bool flush;
bool gda;
};

struct ionic_sq {
Expand All @@ -213,6 +220,7 @@ struct ionic_sq {
bool flush;
bool flush_rcvd;
bool color;
bool gda;
};

struct ionic_qp {
Expand Down Expand Up @@ -354,5 +362,8 @@ static inline void ionic_dbg_xdump(struct ionic_ctx *ctx, const char *str,

/* ionic_verbs.h */
void ionic_verbs_set_ops(struct ionic_ctx *ctx);
struct ibv_cq_ex *ionic_create_cq_ex_common(struct ibv_context *ibctx,
struct ibv_cq_init_attr_ex *ex,
struct ionic_cq_init_attr_ex *ionic_ex);

#endif /* IONIC_H */
170 changes: 170 additions & 0 deletions providers/ionic/ionic_dv.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@
#include "ionic.h"
#include "ionic_dv.h"

bool ionic_dv_is_ionic_ctx(struct ibv_context *ibctx)
{
return is_ionic_ctx(ibctx);
}

bool ionic_dv_is_ionic_pd(struct ibv_pd *ibpd)
{
return is_ionic_pd(ibpd);
}

bool ionic_dv_is_ionic_cq(struct ibv_cq *ibcq)
{
return is_ionic_cq(ibcq);
}

bool ionic_dv_is_ionic_qp(struct ibv_qp *ibqp)
{
return is_ionic_qp(ibqp);
}

uint8_t ionic_dv_ctx_get_udma_count(struct ibv_context *ibctx)
{
if (!is_ionic_ctx(ibctx))
Expand All @@ -30,6 +50,22 @@ uint8_t ionic_dv_pd_get_udma_mask(struct ibv_pd *ibpd)
return to_ionic_pd(ibpd)->udma_mask;
}

uint8_t ionic_dv_cq_get_udma_mask(struct ibv_cq *ibcq)
{
if (!is_ionic_cq(ibcq))
return 0;

return to_ionic_vcq(ibcq)->udma_mask;
}

uint8_t ionic_dv_qp_get_udma_idx(struct ibv_qp *ibqp)
{
if (!is_ionic_qp(ibqp))
return 0;

return to_ionic_qp(ibqp)->udma_idx;
}

int ionic_dv_pd_set_udma_mask(struct ibv_pd *ibpd, uint8_t udma_mask)
{
if (!is_ionic_pd(ibpd))
Expand All @@ -43,6 +79,19 @@ int ionic_dv_pd_set_udma_mask(struct ibv_pd *ibpd, uint8_t udma_mask)
return 0;
}

int ionic_dv_pd_set_expdb_mask(struct ibv_pd *ibpd, uint8_t mask)
{
struct ionic_pd *pd;

if (!is_ionic_pd(ibpd))
return EPERM;

pd = to_ionic_pd(ibpd);
pd->expdb_mask = mask & ((IONIC_EXPDB_512 << 1) - 1);

return 0;
}

static uint8_t ionic_dv_cmb_val(bool enable, bool expdb, bool require)
{
uint8_t cmb = 0;
Expand Down Expand Up @@ -105,3 +154,124 @@ int ionic_dv_pd_set_rqcmb(struct ibv_pd *ibpd, bool enable, bool expdb, bool req

return 0;
}

int ionic_dv_qp_set_gda(struct ibv_qp *ibqp, bool enable_send, bool enable_recv)
{
struct ionic_qp *qp;

if (!is_ionic_qp(ibqp))
return EPERM;

qp = to_ionic_qp(ibqp);

if (enable_send && qp->sq.cmb & IONIC_CMB_EXPDB)
return EINVAL;

if (enable_recv && qp->rq.cmb & IONIC_CMB_EXPDB)
return EINVAL;

qp->sq.gda = enable_send;
qp->rq.gda = enable_recv;

return 0;
}

int ionic_dv_qp_get_send_dbell_data(struct ibv_qp *ibqp, uint64_t *dbdata)
{
struct ionic_qp *qp;

if (!is_ionic_qp(ibqp))
return EPERM;

qp = to_ionic_qp(ibqp);

*dbdata = ionic_queue_dbell_val(&qp->sq.queue);

return 0;
}

int ionic_dv_qp_get_recv_dbell_data(struct ibv_qp *ibqp, uint64_t *dbdata)
{
struct ionic_qp *qp;

if (!is_ionic_qp(ibqp))
return EPERM;

qp = to_ionic_qp(ibqp);

*dbdata = ionic_queue_dbell_val(&qp->rq.queue);

return 0;
}

int ionic_dv_get_ctx(struct ionic_dv_ctx *dvctx, struct ibv_context *ibctx)
{
struct ionic_ctx *ctx;

if (!is_ionic_ctx(ibctx))
return EPERM;

ctx = to_ionic_ctx(ibctx);

dvctx->db_page = ctx->dbpage_page;
dvctx->db_ptr = ctx->dbpage;
dvctx->sq_qtype = ctx->sq_qtype;
dvctx->rq_qtype = ctx->rq_qtype;
dvctx->cq_qtype = ctx->cq_qtype;

return 0;
}

static void ionic_dv_get_queue(struct ionic_dv_queue *dvq, struct ionic_queue *q)
{
dvq->ptr = q->ptr;
dvq->size = q->size;
dvq->db_val = q->dbell;
dvq->mask = (uint16_t)q->mask;
dvq->depth_log2 = q->depth_log2;
dvq->stride_log2 = q->stride_log2;
}

int ionic_dv_get_cq(struct ionic_dv_cq *dvcq, struct ibv_cq *ibcq, uint8_t udma_idx)
{
struct ionic_vcq *vcq;

if (!is_ionic_cq(ibcq))
return EPERM;

vcq = to_ionic_vcq(ibcq);

if (!(vcq->udma_mask & BIT(udma_idx)))
return EINVAL;

ionic_dv_get_queue(&dvcq->q, &vcq->cq[udma_idx].q);

return 0;
}

int ionic_dv_get_qp(struct ionic_dv_qp *dvqp, struct ibv_qp *ibqp)
{
struct ionic_qp *qp;

if (!is_ionic_qp(ibqp))
return EPERM;

qp = to_ionic_qp(ibqp);

ionic_dv_get_queue(&dvqp->rq, &qp->rq.queue);
ionic_dv_get_queue(&dvqp->sq, &qp->sq.queue);

return 0;
}

struct ibv_cq_ex *ionic_dv_create_cq_ex(struct ibv_context *ibctx,
struct ibv_cq_init_attr_ex *ex,
struct ionic_cq_init_attr_ex *ionic_ex)
{
if (!is_ionic_ctx(ibctx)) {
errno = EPERM;
return NULL;
}

return ionic_create_cq_ex_common(ibctx, ex, ionic_ex);
}
Loading