#include "dapl_ep_util.h"
#include "dapl_osd.h"
-
+static inline void const_ib_wc(struct ibv_wc *iwc, struct dat_mix_wc *mwc, int entries)
+{
+ int i;
+
+ for (i=0;i<entries;i++) {
+ memset((void*)&iwc[i].wr_id, 0, sizeof(*iwc));
+ iwc[i].wr_id = mwc[i].wr_id;
+ iwc[i].status = mwc[i].status;
+ iwc[i].opcode = mwc[i].opcode;
+ iwc[i].vendor_err = mwc[i].vendor_err;
+ iwc[i].byte_len = mwc[i].byte_len;
+ iwc[i].imm_data = mwc[i].imm_data;
+ iwc[i].qp_num = mwc[i].qp_num;
+ iwc[i].src_qp = mwc[i].src_qp;
+ iwc[i].wc_flags = mwc[i].wc_flags;
+ iwc[i].pkey_index = mwc[i].pkey_index;
+ iwc[i].slid = mwc[i].slid;
+ iwc[i].sl = mwc[i].sl;
+ iwc[i].dlid_path_bits = mwc[i].dlid_path_bits;
+ }
+}
/*
* CM proxy services, MCM on MIC to MPXYD via SCIF
m_cq = (void*)pmsg->cq_ctx;
for (i=0; i<pmsg->wc_cnt; i++) {
+ struct ibv_wc ib_wc;
/* possible segmentation on mpxyd side, update length if success */
if (pmsg->wc[i].status == 0) {
cookie = (DAPL_COOKIE *) (uintptr_t) pmsg->wc[i].wr_id;
pmsg->wc[i].byte_len = cookie->val.dto.size;
}
- dapls_evd_cqe_to_event(m_cq->evd, &pmsg->wc[i]);
+ const_ib_wc(&ib_wc, &pmsg->wc[i], 1);
+ dapls_evd_cqe_to_event(m_cq->evd, &ib_wc);
}
return 0;
return 0;
}
+static inline void const_mix_wc(struct dat_mix_wc *mwc, struct ibv_wc *iwc, int entries)
+{
+ int i;
+
+ for (i=0;i<entries;i++) {
+ memset((void*)&mwc[i].wr_id, 0, sizeof(*mwc));
+ mwc[i].wr_id = iwc[i].wr_id;
+ mwc[i].status = iwc[i].status;
+ mwc[i].opcode = iwc[i].opcode;
+ mwc[i].vendor_err = iwc[i].vendor_err;
+ mwc[i].byte_len = iwc[i].byte_len;
+ mwc[i].imm_data = iwc[i].imm_data;
+ mwc[i].qp_num = iwc[i].qp_num;
+ mwc[i].src_qp = iwc[i].src_qp;
+ mwc[i].wc_flags = iwc[i].wc_flags;
+ mwc[i].pkey_index = iwc[i].pkey_index;
+ mwc[i].slid = iwc[i].slid;
+ mwc[i].sl = iwc[i].sl;
+ mwc[i].dlid_path_bits = iwc[i].dlid_path_bits;
+ }
+}
+
+static inline void const_ib_wr(struct ibv_send_wr *iwr, struct dat_mix_wr *mwr, struct ibv_sge *sg_ptr)
+{
+ memset((void*)iwr, 0, sizeof(*iwr));
+ iwr->sg_list = sg_ptr;
+ iwr->opcode = mwr->opcode;
+ iwr->send_flags = mwr->send_flags;
+ iwr->imm_data = mwr->imm_data;
+ iwr->wr.rdma.remote_addr = mwr->wr.rdma.remote_addr;
+ iwr->wr.rdma.rkey = mwr->wr.rdma.rkey;
+}
static int init_scif()
{
{
int len, ret, pcnt;
struct mcm_cq *m_cq;
+ struct ibv_wc local_wc[DAT_MIX_WC_MAX];
/* hdr already read, get operation data */
len = sizeof(dat_mix_dto_comp_t) - sizeof(dat_mix_hdr_t);
else
pcnt = pmsg->wc_cnt;
- pmsg->wc_cnt = ibv_poll_cq(m_cq->ib_cq, pcnt, pmsg->wc);
+ pmsg->wc_cnt = ibv_poll_cq(m_cq->ib_cq, pcnt, local_wc);
mlog(1," completions = %d \n", pmsg->wc_cnt);
if (pmsg->wc_cnt < 0) {
mlog(0, " ibv_poll_cq ERR %s on cq_id 0x%x, cq_ctx %p\n", strerror(errno), pmsg->cq_id, pmsg->cq_ctx);
} else
pmsg->hdr.status = 0; /* success, check pmsg->wc_cnt WC's */
- if (pmsg->wc_cnt)
+ const_mix_wc(pmsg->wc, local_wc, pmsg->wc_cnt);
+
+ if (pmsg->wc_cnt) {
mlog(1, " (ep=%d) cq %p id %d ctx %p stat %d op %d ln %d wr_id %p wc's %d verr 0x%x\n",
m_cq->smd->scif_op_ep, m_cq, m_cq->cq_id, m_cq->cq_ctx,
pmsg->wc[0].status, pmsg->wc[0].opcode, pmsg->wc[0].byte_len,
pmsg->wc[0].wr_id, pmsg->wc_cnt, pmsg->wc[0].vendor_err);
+ }
/* send back response, with client context */
pmsg->cq_id = m_cq->cq_id;
return (scif_send_msg(smd->scif_op_ep, (void*)pmsg, len));
}
-static void mix_dto_event(struct mcm_cq *m_cq, struct ibv_wc *wc, int nc)
+static void mix_dto_event(struct mcm_cq *m_cq, struct dat_mix_wc *wc, int nc)
{
dat_mix_dto_comp_t msg;
int i;
m_wr->wr.wr_id = (uint64_t)m_wr;
ret = ibv_post_send(m_qp->ib_qp, &m_wr->wr, &bad_wr);
if (ret || (cn_signal && mix_eager_completion)) {
- struct ibv_wc wc;
+ struct dat_mix_wc wc;
mlog(1, " dto_event: sig %d ret %d, %s - m_wr %p, wr_id %p\n",
cn_signal, ret, strerror(errno),
m_wr->wr.wr_id, m_wr->org_id);
mlog(1, " m_wr %p m_sge %p \n", m_wr, m_sge);
- memcpy(&m_wr->wr.num_sge, &pmsg->wr.num_sge, 40);
m_wr->org_id = pmsg->wr.wr_id;
- m_wr->wr.sg_list = m_sge;
- m_wr->wr.next = 0;
- m_wr->wr.wr.rdma.remote_addr += total_offset;
- m_wr->wr.num_sge = 0;
- m_wr->wr.wr_id = 0;
m_wr->w_idx = m_qp->wr_hd;
m_wr->flags = 0;
m_wr->context = (uint64_t)m_qp;
+ const_ib_wr(&m_wr->wr, &pmsg->wr, m_sge);
for (i=0;i<pmsg->wr.num_sge;i++) {
mlog(1, " next m_wr %p m_sge %p \n", m_wr, m_wr->sg);
- memcpy(&m_wr->wr.num_sge, &pmsg->wr.num_sge, 40);
m_wr->org_id = pmsg->wr.wr_id;
- m_wr->wr.sg_list = m_wr->sg;
- m_wr->wr.next = 0;
- m_wr->wr.wr.rdma.remote_addr += total_offset;
- m_wr->wr.num_sge = 0;
- m_wr->wr.wr_id = 0;
m_wr->w_idx = m_qp->wr_hd;
m_wr->flags = 0;
m_wr->context = (uint64_t)m_qp;
+ const_ib_wr(&m_wr->wr, &pmsg->wr, m_sge);
+ m_wr->wr.wr.rdma.remote_addr += total_offset;
}
}
}
ret = 0;
bail:
if (ret) {
- struct ibv_wc wc;
+ struct dat_mix_wc wc;
wc.wr_id = pmsg->wr.wr_id;
wc.byte_len = 0;
}
m_qp = (struct mcm_qp*)pmsg->qp_ctx;
- mlog(1, " q_id %d, q_num %x ln %d, wr_id %p, sge %d, op %x flgs %x pst %d,%d cmp %d, inl %d, %s\n",
- pmsg->qp_id, m_qp->ib_qp->qp_num, pmsg->len, pmsg->wr.wr_id,
+ mlog(1, " q_id %d, q_num %x data %d pkt %d wr_id %p, sge %d, op %x flgs %x pst %d,%d cmp %d, inl %d, %s\n",
+ pmsg->qp_id, m_qp->ib_qp->qp_num, pmsg->len, sizeof(dat_mix_send_t) + pmsg->len, pmsg->wr.wr_id,
pmsg->wr.num_sge, pmsg->wr.opcode, pmsg->wr.send_flags, m_qp->post_cnt,
m_qp->post_sig_cnt, m_qp->comp_cnt, pmsg->hdr.flags & MIX_OP_INLINE ? 1:0,
pmsg->wr.opcode == IBV_WR_SEND ? "SND":"WR");
m_wr, m_wr_prev, m_wr->sg, len, m_qp->wr_hd, m_qp->wr_tl);
/* IB_WR */
- memcpy(&m_wr->wr.num_sge, &pmsg->wr.num_sge, 40);
+ const_ib_wr(&m_wr->wr, &pmsg->wr, m_wr->sg);
m_wr->wr.sg_list = m_wr->sg;
- m_wr->wr.next = 0;
m_wr->wr.num_sge = len ? 1:0;
/* M_WR */
if (ret ||
((m_wr->flags & M_SEND_POSTED) &&
(m_wr->flags & M_SEND_CN_EAGER_SIG))) {
- struct ibv_wc wc;
+ struct dat_mix_wc wc;
wc.wr_id = pmsg->wr.wr_id;
wc.byte_len = len;
void *cq_ctx;
int i, ret, num, notify = 0;
struct ibv_wc wc[DAT_MIX_WC_MAX];
- struct ibv_wc wc_ev[DAT_MIX_WC_MAX];
+ struct dat_mix_wc wc_ev[DAT_MIX_WC_MAX];
mlog(2," m_cq(%p) \n", m_cq);
m_cq->prev_id = m_wr->org_id;
wc_ev[num].wr_id = m_wr->org_id;
wc_ev[num].status = wc[i].status;
+ wc_ev[num].vendor_err = wc[i].vendor_err;
num++;
}
}