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
12 changes: 12 additions & 0 deletions kernel-headers/rdma/ionic-abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct ionic_ctx_resp {
__u8 expdb_qtypes;

__u8 rsvd2[3];
__aligned_u64 phc_offset;
};

struct ionic_qdesc {
Expand Down Expand Up @@ -112,4 +113,15 @@ struct ionic_srq_resp {
__aligned_u64 rq_cmb_offset;
};

struct ionic_phc_state {
__u32 seq;
__u32 rsvd;
__aligned_u64 mask;
__aligned_u64 tick;
__aligned_u64 nsec;
__aligned_u64 frac;
__u32 mult;
__u32 shift;
};

#endif /* IONIC_ABI_H */
13 changes: 13 additions & 0 deletions providers/ionic/ionic.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>

#include "ionic.h"

Expand Down Expand Up @@ -86,6 +87,16 @@ static struct verbs_context *ionic_alloc_context(struct ibv_device *ibdev,
}
ctx->dbpage = ctx->dbpage_page + (resp.dbell_offset & mask);

if (resp.phc_offset) {
ctx->phc_state = mmap(NULL, IONIC_PAGE_SIZE, PROT_READ, MAP_SHARED,
cmd_fd, resp.phc_offset);
if (ctx->phc_state == MAP_FAILED) {
ctx->phc_state = NULL;
rc = errno;
goto err_phc;
}
}

pthread_mutex_init(&ctx->mut, NULL);
ionic_tbl_init(&ctx->qp_tbl);

Expand All @@ -98,6 +109,8 @@ static struct verbs_context *ionic_alloc_context(struct ibv_device *ibdev,
verbs_debug(&ctx->vctx, "Attached to ctx %p", ctx);
return &ctx->vctx;

err_phc:
ionic_unmap(ctx->dbpage_page, 1u << ctx->pg_shift);
err_cmd:
verbs_uninit_context(&ctx->vctx);
err_ctx:
Expand Down
21 changes: 20 additions & 1 deletion providers/ionic/ionic.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ enum {
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_EX_WITH_DLID_PATH_BITS |
IBV_WC_EX_WITH_COMPLETION_TIMESTAMP |
IBV_WC_EX_WITH_COMPLETION_TIMESTAMP_WALLCLOCK
};

struct ionic_ctx {
Expand All @@ -79,6 +81,7 @@ struct ionic_ctx {

void *dbpage_page;
uint64_t *dbpage;
struct ionic_phc_state *phc_state;

pthread_mutex_t mut;
struct ionic_tbl_root qp_tbl;
Expand Down Expand Up @@ -112,6 +115,7 @@ struct ionic_cq {
struct list_head poll_sq;
struct list_head poll_rq;
bool flush;
bool do_timestamp;
struct list_head flush_sq;
struct list_head flush_rq;
struct ionic_queue q;
Expand All @@ -123,18 +127,33 @@ struct ionic_cq {
int reserve_pending;
uint16_t arm_any_prod;
uint16_t arm_sol_prod;
uint64_t phc_tick;
};

struct ionic_phc {
uint64_t mask;
uint64_t tick;
uint64_t nsec;
uint64_t frac;
uint32_t mult;
uint32_t shift;
};

struct ionic_vcq {
struct verbs_cq vcq;
struct ionic_cq cq[2];
uint8_t udma_mask;
uint8_t poll_idx;
bool phc_update;
bool cur_wc_pending;
struct ibv_wc cur_wc; /* for use with start_poll/next_poll */
uint64_t cur_wc_timestamp;
struct ionic_phc phc;
};

struct ionic_sq_meta {
uint64_t wrid;
uint64_t cqe_timestamp;
uint32_t len;
uint16_t seq;
uint8_t ibop;
Expand Down
12 changes: 9 additions & 3 deletions providers/ionic/ionic_fw_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ union ionic_v1_pld {
struct ionic_v1_cqe {
union {
struct {
__u64 wqe_id;
__le64 wqe_idx_timestamp;
__be32 src_qpn_op;
__u8 src_mac[6];
__be16 vlan_tag;
Expand All @@ -84,13 +84,19 @@ struct ionic_v1_cqe {
__u8 rsvd[4];
__be32 msg_msn;
__u8 rsvd2[8];
__u64 npg_wqe_id;
__le64 npg_wqe_idx_timestamp;
} send;
};
__be32 status_length;
__be32 qid_type_flags;
};

/* bits for cqe wqe_idx and timestamp */
enum ionic_v1_cqe_wqe_idx_timestamp_bits {
IONIC_V1_CQE_WQE_IDX_MASK = 0xffff,
IONIC_V1_CQE_TIMESTAMP_SHIFT = 16,
};

/* bits for cqe recv */
enum ionic_v1_cqe_src_qpn_bits {
IONIC_V1_CQE_RECV_QPN_MASK = 0xffffff,
Expand Down Expand Up @@ -125,7 +131,7 @@ enum ionic_v1_cqe_qtf_bits {

/* v1 base wqe header */
struct ionic_v1_base_hdr {
__u64 wqe_id;
__le64 wqe_idx;
__u8 op;
__u8 num_sge_key;
__be16 flags;
Expand Down
Loading
Loading