IB/mthca: Factor out setting WQE UD segment entries
Factor code to set UD entries out of the work request posting functions into inline functions set_tavor_ud_seg() and set_arbel_ud_seg(). This doesn't change the generated code in any significant way, and makes the source easier on the eyes. Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
parent
400ddc11eb
commit
e535c699bf
1 changed files with 22 additions and 18 deletions
|
@ -1599,6 +1599,24 @@ static __always_inline void set_atomic_seg(struct mthca_atomic_seg *aseg,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_tavor_ud_seg(struct mthca_tavor_ud_seg *useg,
|
||||||
|
struct ib_send_wr *wr)
|
||||||
|
{
|
||||||
|
useg->lkey = cpu_to_be32(to_mah(wr->wr.ud.ah)->key);
|
||||||
|
useg->av_addr = cpu_to_be64(to_mah(wr->wr.ud.ah)->avdma);
|
||||||
|
useg->dqpn = cpu_to_be32(wr->wr.ud.remote_qpn);
|
||||||
|
useg->qkey = cpu_to_be32(wr->wr.ud.remote_qkey);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_arbel_ud_seg(struct mthca_arbel_ud_seg *useg,
|
||||||
|
struct ib_send_wr *wr)
|
||||||
|
{
|
||||||
|
memcpy(useg->av, to_mah(wr->wr.ud.ah)->av, MTHCA_AV_SIZE);
|
||||||
|
useg->dqpn = cpu_to_be32(wr->wr.ud.remote_qpn);
|
||||||
|
useg->qkey = cpu_to_be32(wr->wr.ud.remote_qkey);
|
||||||
|
}
|
||||||
|
|
||||||
int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
|
int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
|
||||||
struct ib_send_wr **bad_wr)
|
struct ib_send_wr **bad_wr)
|
||||||
{
|
{
|
||||||
|
@ -1707,16 +1725,8 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UD:
|
case UD:
|
||||||
((struct mthca_tavor_ud_seg *) wqe)->lkey =
|
set_tavor_ud_seg(wqe, wr);
|
||||||
cpu_to_be32(to_mah(wr->wr.ud.ah)->key);
|
wqe += sizeof (struct mthca_tavor_ud_seg);
|
||||||
((struct mthca_tavor_ud_seg *) wqe)->av_addr =
|
|
||||||
cpu_to_be64(to_mah(wr->wr.ud.ah)->avdma);
|
|
||||||
((struct mthca_tavor_ud_seg *) wqe)->dqpn =
|
|
||||||
cpu_to_be32(wr->wr.ud.remote_qpn);
|
|
||||||
((struct mthca_tavor_ud_seg *) wqe)->qkey =
|
|
||||||
cpu_to_be32(wr->wr.ud.remote_qkey);
|
|
||||||
|
|
||||||
wqe += sizeof (struct mthca_tavor_ud_seg);
|
|
||||||
size += sizeof (struct mthca_tavor_ud_seg) / 16;
|
size += sizeof (struct mthca_tavor_ud_seg) / 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2064,14 +2074,8 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UD:
|
case UD:
|
||||||
memcpy(((struct mthca_arbel_ud_seg *) wqe)->av,
|
set_arbel_ud_seg(wqe, wr);
|
||||||
to_mah(wr->wr.ud.ah)->av, MTHCA_AV_SIZE);
|
wqe += sizeof (struct mthca_arbel_ud_seg);
|
||||||
((struct mthca_arbel_ud_seg *) wqe)->dqpn =
|
|
||||||
cpu_to_be32(wr->wr.ud.remote_qpn);
|
|
||||||
((struct mthca_arbel_ud_seg *) wqe)->qkey =
|
|
||||||
cpu_to_be32(wr->wr.ud.remote_qkey);
|
|
||||||
|
|
||||||
wqe += sizeof (struct mthca_arbel_ud_seg);
|
|
||||||
size += sizeof (struct mthca_arbel_ud_seg) / 16;
|
size += sizeof (struct mthca_arbel_ud_seg) / 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue