diff options
author | Dennis Dalessandro <dennis.dalessandro@intel.com> | 2016-02-14 12:44:43 -0800 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-03-10 20:38:12 -0500 |
commit | bb5df5f9eea6b9efb5911a5fef63b4614af01c89 (patch) | |
tree | 86546989b76cec2c584603a44f75cd525e978993 /drivers/staging/rdma/hfi1/ud.c | |
parent | 45842abbb292338d7d328c40bae411218242d2cd (diff) | |
download | linux-stable-bb5df5f9eea6b9efb5911a5fef63b4614af01c89.tar.gz linux-stable-bb5df5f9eea6b9efb5911a5fef63b4614af01c89.tar.bz2 linux-stable-bb5df5f9eea6b9efb5911a5fef63b4614af01c89.zip |
staging/rdma/hfi1: Remove header memcpy from sdma send path.
Instead of writing the header into a buffer then copying it into another
buffer to be sent, remove that memcpy and instead build the header directly
into the tx request that will be sent.
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Vennila Megavannan <vennila.megavannan@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/staging/rdma/hfi1/ud.c')
-rw-r--r-- | drivers/staging/rdma/hfi1/ud.c | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/drivers/staging/rdma/hfi1/ud.c b/drivers/staging/rdma/hfi1/ud.c index ba78e2e3e0bb..a7118bca0d2a 100644 --- a/drivers/staging/rdma/hfi1/ud.c +++ b/drivers/staging/rdma/hfi1/ud.c @@ -54,6 +54,7 @@ #include "hfi.h" #include "mad.h" #include "qp.h" +#include "verbs_txreq.h" /** * ud_loopback - handle send on loopback QPs @@ -265,7 +266,7 @@ drop: * * Return 1 if constructed; otherwise, return 0. */ -int hfi1_make_ud_req(struct rvt_qp *qp) +int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) { struct hfi1_qp_priv *priv = qp->priv; struct hfi1_other_headers *ohdr; @@ -278,10 +279,13 @@ int hfi1_make_ud_req(struct rvt_qp *qp) u32 bth0; u16 lrh0; u16 lid; - int ret = 0; int next_cur; u8 sc5; + ps->s_txreq = get_txreq(ps->dev, qp); + if (IS_ERR(ps->s_txreq)) + goto bail_no_tx; + if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_NEXT_SEND_OK)) { if (!(ib_rvt_state_ops[qp->state] & RVT_FLUSH_SEND)) goto bail; @@ -296,7 +300,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp) } wqe = rvt_get_swqe_ptr(qp, qp->s_last); hfi1_send_complete(qp, wqe, IB_WC_WR_FLUSH_ERR); - goto done; + goto done_free_tx; } /* see post_one_send() */ @@ -337,7 +341,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp) ud_loopback(qp, wqe); spin_lock_irqsave(&qp->s_lock, flags); hfi1_send_complete(qp, wqe, IB_WC_SUCCESS); - goto done; + goto done_free_tx; } } @@ -359,11 +363,12 @@ int hfi1_make_ud_req(struct rvt_qp *qp) if (ah_attr->ah_flags & IB_AH_GRH) { /* Header size in 32-bit words. */ - qp->s_hdrwords += hfi1_make_grh(ibp, &priv->s_hdr->ibh.u.l.grh, - &ah_attr->grh, - qp->s_hdrwords, nwords); + qp->s_hdrwords += hfi1_make_grh(ibp, + &ps->s_txreq->phdr.hdr.u.l.grh, + &ah_attr->grh, + qp->s_hdrwords, nwords); lrh0 = HFI1_LRH_GRH; - ohdr = &priv->s_hdr->ibh.u.l.oth; + ohdr = &ps->s_txreq->phdr.hdr.u.l.oth; /* * Don't worry about sending to locally attached multicast * QPs. It is unspecified by the spec. what happens. @@ -371,7 +376,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp) } else { /* Header size in 32-bit words. */ lrh0 = HFI1_LRH_BTH; - ohdr = &priv->s_hdr->ibh.u.oth; + ohdr = &ps->s_txreq->phdr.hdr.u.oth; } if (wqe->wr.opcode == IB_WR_SEND_WITH_IMM) { qp->s_hdrwords++; @@ -389,19 +394,20 @@ int hfi1_make_ud_req(struct rvt_qp *qp) priv->s_sc = sc5; } priv->s_sde = qp_to_sdma_engine(qp, priv->s_sc); - priv->s_hdr->ibh.lrh[0] = cpu_to_be16(lrh0); - priv->s_hdr->ibh.lrh[1] = cpu_to_be16(ah_attr->dlid); /* DEST LID */ - priv->s_hdr->ibh.lrh[2] = + ps->s_txreq->phdr.hdr.lrh[0] = cpu_to_be16(lrh0); + ps->s_txreq->phdr.hdr.lrh[1] = cpu_to_be16(ah_attr->dlid); + ps->s_txreq->phdr.hdr.lrh[2] = cpu_to_be16(qp->s_hdrwords + nwords + SIZE_OF_CRC); - if (ah_attr->dlid == be16_to_cpu(IB_LID_PERMISSIVE)) - priv->s_hdr->ibh.lrh[3] = IB_LID_PERMISSIVE; - else { + if (ah_attr->dlid == be16_to_cpu(IB_LID_PERMISSIVE)) { + ps->s_txreq->phdr.hdr.lrh[3] = IB_LID_PERMISSIVE; + } else { lid = ppd->lid; if (lid) { lid |= ah_attr->src_path_bits & ((1 << ppd->lmc) - 1); - priv->s_hdr->ibh.lrh[3] = cpu_to_be16(lid); - } else - priv->s_hdr->ibh.lrh[3] = IB_LID_PERMISSIVE; + ps->s_txreq->phdr.hdr.lrh[3] = cpu_to_be16(lid); + } else { + ps->s_txreq->phdr.hdr.lrh[3] = IB_LID_PERMISSIVE; + } } if (wqe->wr.send_flags & IB_SEND_SOLICITED) bth0 |= IB_BTH_SOLICITED; @@ -426,11 +432,21 @@ int hfi1_make_ud_req(struct rvt_qp *qp) priv->s_hdr->tx_flags = 0; priv->s_hdr->sde = NULL; -done: return 1; + +done_free_tx: + hfi1_put_txreq(ps->s_txreq); + ps->s_txreq = NULL; + return 1; + bail: + hfi1_put_txreq(ps->s_txreq); + +bail_no_tx: + ps->s_txreq = NULL; qp->s_flags &= ~RVT_S_BUSY; - return ret; + qp->s_hdrwords = 0; + return 0; } /* |