From 17c6b0e7515d2767a5d79b12245a74eb880e1d2f Mon Sep 17 00:00:00 2001 From: Arlin Davis Date: Thu, 25 Jul 2013 09:05:06 -0700 Subject: [PATCH] mcm: convert IB wr to MIX wr on proxy post_send Signed-off-by: Arlin Davis --- dapl/openib_mcm/mix.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/dapl/openib_mcm/mix.c b/dapl/openib_mcm/mix.c index f80a79a..38008a4 100644 --- a/dapl/openib_mcm/mix.c +++ b/dapl/openib_mcm/mix.c @@ -34,6 +34,18 @@ #include "dapl_ep_util.h" #include "dapl_osd.h" +static inline void const_mix_wr(struct dat_mix_wr *mwr, struct ibv_send_wr *iwr) +{ + memset((void*)mwr, 0, sizeof(*mwr)); + mwr->wr_id = iwr->wr_id; + mwr->num_sge = iwr->num_sge; + mwr->opcode = iwr->opcode; + mwr->send_flags = iwr->send_flags; + mwr->imm_data = iwr->imm_data; + mwr->wr.rdma.remote_addr = iwr->wr.rdma.remote_addr; + mwr->wr.rdma.rkey = iwr->wr.rdma.rkey; +} + static inline void const_ib_wc(struct ibv_wc *iwc, struct dat_mix_wc *mwc, int entries) { int i; @@ -544,7 +556,8 @@ int dapli_mix_cq_create(ib_cq_handle_t m_cq) m_cq->cq_id = msg.cq_id; m_cq->cq_ctx = msg.cq_ctx; - dapl_log(DAPL_DBG_TYPE_EXTENSION, " reply on SCIF EP -> cq_id 0x%x, ctx %p\n", m_cq->cq_id, (void*)m_cq->cq_ctx ); + dapl_log(DAPL_DBG_TYPE_EXTENSION, " m_cq %p reply on SCIF EP -> cq_id 0x%x, ctx %p\n", + m_cq, m_cq->cq_id, (void*)m_cq->cq_ctx ); return 0; } @@ -686,8 +699,10 @@ int dapli_mix_post_send(ib_qp_handle_t m_qp, int txlen, struct ibv_send_wr *wr, scif_epd_t mix_ep = m_qp->tp->scif_ep; int ret, i, offset = sizeof(dat_mix_send_t); - dapl_log(DAPL_DBG_TYPE_EXTENSION," mix_post_send: msg=%p sge=%d len=%d op=%d\n", - msg, wr->num_sge, txlen, wr->opcode); + dapl_log(DAPL_DBG_TYPE_EXTENSION, + " mix_post_send: msg=%p sge=%d len=%d op=%d off=%d (%p)raddr %Lx rkey 0x%x, wr_id %LX\n", + msg, wr->num_sge, txlen, wr->opcode, offset, &wr->wr.rdma.remote_addr, + wr->wr.rdma.remote_addr, wr->wr.rdma.rkey, wr->wr_id); if (wr->opcode != IBV_WR_SEND && wr->opcode != IBV_WR_RDMA_WRITE && @@ -701,7 +716,7 @@ int dapli_mix_post_send(ib_qp_handle_t m_qp, int txlen, struct ibv_send_wr *wr, msg->len = txlen; msg->qp_id = m_qp->sqp_id; msg->qp_ctx = m_qp->sqp_ctx; - memcpy(&msg->wr, wr, sizeof(*wr)); + const_mix_wr(&msg->wr, wr); if (txlen > m_qp->m_inline) { mix_proxy_data(m_qp, msg, wr, txlen, mix_ep); @@ -1008,7 +1023,8 @@ int dapli_mix_dto_event_in(ib_hca_transport_t *tp, scif_epd_t scif_ep, dat_mix_d return ret; } dapl_log(DAPL_DBG_TYPE_EXTENSION, - " MIX_DTO_EVENT_IN: id %d ctx %p wc's %d\n", pmsg->cq_id, pmsg->cq_ctx, pmsg->wc_cnt); + " MIX_DTO_EVENT_IN: id %d ctx %p wc's %d, wc[0].wr_id=%Lx\n", + pmsg->cq_id, pmsg->cq_ctx, pmsg->wc_cnt, pmsg->wc[0].wr_id); /* Get cq and post DTO event with this WC entry */ m_cq = (void*)pmsg->cq_ctx; @@ -1018,6 +1034,7 @@ int dapli_mix_dto_event_in(ib_hca_transport_t *tp, scif_epd_t scif_ep, dat_mix_d /* 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; + dapl_os_assert((NULL != cookie)); pmsg->wc[i].byte_len = cookie->val.dto.size; } const_ib_wc(&ib_wc, &pmsg->wc[i], 1); -- 2.46.0