diff options
| author | Roland Dreier <rolandd@cisco.com> | 2007-07-18 16:21:14 -0400 |
|---|---|---|
| committer | Roland Dreier <rolandd@cisco.com> | 2007-07-18 16:21:14 -0400 |
| commit | e535c699bfeafd0380418156f93494e370613e9d (patch) | |
| tree | e1f403e6219b4248cfd6735dd6b57cabe19eeefb | |
| parent | 400ddc11eb01a8d04c580892fde3adbd45ebdc9e (diff) | |
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>
| -rw-r--r-- | drivers/infiniband/hw/mthca/mthca_qp.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 43d4d771f2d2..b5bd704ca55d 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
| @@ -1599,6 +1599,24 @@ static __always_inline void set_atomic_seg(struct mthca_atomic_seg *aseg, | |||
| 1599 | 1599 | ||
| 1600 | } | 1600 | } |
| 1601 | 1601 | ||
| 1602 | static void set_tavor_ud_seg(struct mthca_tavor_ud_seg *useg, | ||
| 1603 | struct ib_send_wr *wr) | ||
| 1604 | { | ||
| 1605 | useg->lkey = cpu_to_be32(to_mah(wr->wr.ud.ah)->key); | ||
| 1606 | useg->av_addr = cpu_to_be64(to_mah(wr->wr.ud.ah)->avdma); | ||
| 1607 | useg->dqpn = cpu_to_be32(wr->wr.ud.remote_qpn); | ||
| 1608 | useg->qkey = cpu_to_be32(wr->wr.ud.remote_qkey); | ||
| 1609 | |||
| 1610 | } | ||
| 1611 | |||
| 1612 | static void set_arbel_ud_seg(struct mthca_arbel_ud_seg *useg, | ||
| 1613 | struct ib_send_wr *wr) | ||
| 1614 | { | ||
| 1615 | memcpy(useg->av, to_mah(wr->wr.ud.ah)->av, MTHCA_AV_SIZE); | ||
| 1616 | useg->dqpn = cpu_to_be32(wr->wr.ud.remote_qpn); | ||
| 1617 | useg->qkey = cpu_to_be32(wr->wr.ud.remote_qkey); | ||
| 1618 | } | ||
| 1619 | |||
| 1602 | int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | 1620 | int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, |
| 1603 | struct ib_send_wr **bad_wr) | 1621 | struct ib_send_wr **bad_wr) |
| 1604 | { | 1622 | { |
| @@ -1707,16 +1725,8 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
| 1707 | break; | 1725 | break; |
| 1708 | 1726 | ||
| 1709 | case UD: | 1727 | case UD: |
| 1710 | ((struct mthca_tavor_ud_seg *) wqe)->lkey = | 1728 | set_tavor_ud_seg(wqe, wr); |
| 1711 | cpu_to_be32(to_mah(wr->wr.ud.ah)->key); | 1729 | wqe += sizeof (struct mthca_tavor_ud_seg); |
| 1712 | ((struct mthca_tavor_ud_seg *) wqe)->av_addr = | ||
| 1713 | cpu_to_be64(to_mah(wr->wr.ud.ah)->avdma); | ||
| 1714 | ((struct mthca_tavor_ud_seg *) wqe)->dqpn = | ||
| 1715 | cpu_to_be32(wr->wr.ud.remote_qpn); | ||
| 1716 | ((struct mthca_tavor_ud_seg *) wqe)->qkey = | ||
| 1717 | cpu_to_be32(wr->wr.ud.remote_qkey); | ||
| 1718 | |||
| 1719 | wqe += sizeof (struct mthca_tavor_ud_seg); | ||
| 1720 | size += sizeof (struct mthca_tavor_ud_seg) / 16; | 1730 | size += sizeof (struct mthca_tavor_ud_seg) / 16; |
| 1721 | break; | 1731 | break; |
| 1722 | 1732 | ||
| @@ -2064,14 +2074,8 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
| 2064 | break; | 2074 | break; |
| 2065 | 2075 | ||
| 2066 | case UD: | 2076 | case UD: |
| 2067 | memcpy(((struct mthca_arbel_ud_seg *) wqe)->av, | 2077 | set_arbel_ud_seg(wqe, wr); |
| 2068 | to_mah(wr->wr.ud.ah)->av, MTHCA_AV_SIZE); | 2078 | wqe += sizeof (struct mthca_arbel_ud_seg); |
| 2069 | ((struct mthca_arbel_ud_seg *) wqe)->dqpn = | ||
| 2070 | cpu_to_be32(wr->wr.ud.remote_qpn); | ||
| 2071 | ((struct mthca_arbel_ud_seg *) wqe)->qkey = | ||
| 2072 | cpu_to_be32(wr->wr.ud.remote_qkey); | ||
| 2073 | |||
| 2074 | wqe += sizeof (struct mthca_arbel_ud_seg); | ||
| 2075 | size += sizeof (struct mthca_arbel_ud_seg) / 16; | 2079 | size += sizeof (struct mthca_arbel_ud_seg) / 16; |
| 2076 | break; | 2080 | break; |
| 2077 | 2081 | ||
