kiblnd_tx_done(tx);
}
+
static void
-kiblnd_init_tx_msg(struct lnet_ni *ni, struct kib_tx *tx, int type,
- int body_nob)
+kiblnd_init_tx_sge(struct kib_tx *tx, u64 addr, unsigned int len)
{
+ struct ib_sge *sge = &tx->tx_sge[tx->tx_nsge];
struct kib_hca_dev *hdev = tx->tx_pool->tpo_hdev;
- struct ib_sge *sge = &tx->tx_msgsge;
- struct ib_rdma_wr *wrq;
- int nob = offsetof(struct kib_msg, ibm_u) + body_nob;
#ifdef HAVE_IB_GET_DMA_MR
struct ib_mr *mr = hdev->ibh_mrs;
#endif
- LASSERT(tx->tx_nwrq >= 0);
- LASSERT(tx->tx_nwrq <= IBLND_MAX_RDMA_FRAGS);
- LASSERT(nob <= IBLND_MSG_SIZE);
+ *sge = (struct ib_sge) {
#ifdef HAVE_IB_GET_DMA_MR
- LASSERT(mr != NULL);
+ .lkey = mr->lkey,
+#else
+ .lkey = hdev->ibh_pd->local_dma_lkey,
#endif
+ .addr = addr,
+ .length = len,
+ };
- kiblnd_init_msg(tx->tx_msg, type, body_nob);
+ tx->tx_nsge++;
+}
-#ifdef HAVE_IB_GET_DMA_MR
- sge->lkey = mr->lkey;
-#else
- sge->lkey = hdev->ibh_pd->local_dma_lkey;
-#endif
- sge->addr = tx->tx_msgaddr;
- sge->length = nob;
+static void
+kiblnd_init_tx_msg(struct lnet_ni *ni, struct kib_tx *tx, int type,
+ int body_nob)
+{
+ struct ib_rdma_wr *wrq;
+ int nob = offsetof(struct kib_msg, ibm_u) + body_nob;
+
+ LASSERT(tx->tx_nwrq >= 0);
+ LASSERT(tx->tx_nwrq < IBLND_MAX_RDMA_FRAGS + 1);
+ LASSERT(nob <= IBLND_MSG_SIZE);
+
+ kiblnd_init_msg(tx->tx_msg, type, body_nob);
wrq = &tx->tx_wrq[tx->tx_nwrq];
- memset(wrq, 0, sizeof(*wrq));
-
- wrq->wr.next = NULL;
- wrq->wr.wr_id = kiblnd_ptr2wreqid(tx, IBLND_WID_TX);
- wrq->wr.sg_list = sge;
- wrq->wr.num_sge = 1;
- wrq->wr.opcode = IB_WR_SEND;
- wrq->wr.send_flags = IB_SEND_SIGNALED;
+
+ *wrq = (struct ib_rdma_wr) {
+ .wr = {
+ .wr_id = kiblnd_ptr2wreqid(tx, IBLND_WID_TX),
+ .num_sge = 1,
+ .sg_list = &tx->tx_sge[tx->tx_nsge],
+ .opcode = IB_WR_SEND,
+ .send_flags = IB_SEND_SIGNALED,
+ },
+ };
+
+ kiblnd_init_tx_sge(tx, tx->tx_msgaddr, nob);
tx->tx_nwrq++;
}