diff options
author | Roland Dreier <roland@topspin.com> | 2005-04-16 18:26:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:26:23 -0400 |
commit | ddb934e0eead2feadc7467b1f7bf9c81aa241232 (patch) | |
tree | 0fd855bc5f99d0decf977a1630d42cf1f43f6dd8 | |
parent | b87dcfbacee9c57b39738f43f32834f02ec302d5 (diff) |
[PATCH] IB/mthca: implement RDMA/atomic operations for mem-free mode
Add code to support RDMA and atomic send work requests in mem-free mode.
Signed-off-by: Roland Dreier <roland@topspin.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_qp.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 1992effe3f8b..2d3b1815c04e 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -1775,6 +1775,53 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1775 | size = sizeof (struct mthca_next_seg) / 16; | 1775 | size = sizeof (struct mthca_next_seg) / 16; |
1776 | 1776 | ||
1777 | switch (qp->transport) { | 1777 | switch (qp->transport) { |
1778 | case RC: | ||
1779 | switch (wr->opcode) { | ||
1780 | case IB_WR_ATOMIC_CMP_AND_SWP: | ||
1781 | case IB_WR_ATOMIC_FETCH_AND_ADD: | ||
1782 | ((struct mthca_raddr_seg *) wqe)->raddr = | ||
1783 | cpu_to_be64(wr->wr.atomic.remote_addr); | ||
1784 | ((struct mthca_raddr_seg *) wqe)->rkey = | ||
1785 | cpu_to_be32(wr->wr.atomic.rkey); | ||
1786 | ((struct mthca_raddr_seg *) wqe)->reserved = 0; | ||
1787 | |||
1788 | wqe += sizeof (struct mthca_raddr_seg); | ||
1789 | |||
1790 | if (wr->opcode == IB_WR_ATOMIC_CMP_AND_SWP) { | ||
1791 | ((struct mthca_atomic_seg *) wqe)->swap_add = | ||
1792 | cpu_to_be64(wr->wr.atomic.swap); | ||
1793 | ((struct mthca_atomic_seg *) wqe)->compare = | ||
1794 | cpu_to_be64(wr->wr.atomic.compare_add); | ||
1795 | } else { | ||
1796 | ((struct mthca_atomic_seg *) wqe)->swap_add = | ||
1797 | cpu_to_be64(wr->wr.atomic.compare_add); | ||
1798 | ((struct mthca_atomic_seg *) wqe)->compare = 0; | ||
1799 | } | ||
1800 | |||
1801 | wqe += sizeof (struct mthca_atomic_seg); | ||
1802 | size += sizeof (struct mthca_raddr_seg) / 16 + | ||
1803 | sizeof (struct mthca_atomic_seg); | ||
1804 | break; | ||
1805 | |||
1806 | case IB_WR_RDMA_WRITE: | ||
1807 | case IB_WR_RDMA_WRITE_WITH_IMM: | ||
1808 | case IB_WR_RDMA_READ: | ||
1809 | ((struct mthca_raddr_seg *) wqe)->raddr = | ||
1810 | cpu_to_be64(wr->wr.rdma.remote_addr); | ||
1811 | ((struct mthca_raddr_seg *) wqe)->rkey = | ||
1812 | cpu_to_be32(wr->wr.rdma.rkey); | ||
1813 | ((struct mthca_raddr_seg *) wqe)->reserved = 0; | ||
1814 | wqe += sizeof (struct mthca_raddr_seg); | ||
1815 | size += sizeof (struct mthca_raddr_seg) / 16; | ||
1816 | break; | ||
1817 | |||
1818 | default: | ||
1819 | /* No extra segments required for sends */ | ||
1820 | break; | ||
1821 | } | ||
1822 | |||
1823 | break; | ||
1824 | |||
1778 | case UD: | 1825 | case UD: |
1779 | memcpy(((struct mthca_arbel_ud_seg *) wqe)->av, | 1826 | memcpy(((struct mthca_arbel_ud_seg *) wqe)->av, |
1780 | to_mah(wr->wr.ud.ah)->av, MTHCA_AV_SIZE); | 1827 | to_mah(wr->wr.ud.ah)->av, MTHCA_AV_SIZE); |