diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2005-11-29 14:33:46 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-11-29 14:33:46 -0500 |
commit | e0ae9ecf469fdd3c1ad999efbf4fe6b782f49900 (patch) | |
tree | 9896d3c1093ded78c62da6b9a52b71e282c763e0 /drivers | |
parent | 267ee88ed34c76dc527eeb3d95f9f9558ac99973 (diff) |
IB/mthca: fix posting of send lists of length >= 255 on mem-free HCAs
On mem-free HCAs, when posting a long list of send requests, a
doorbell must be rung every 255 requests. Add code to handle this.
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_qp.c | 31 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_wqe.h | 3 |
2 files changed, 31 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index f9c8eb9845c9..7450550db736 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -1822,6 +1822,7 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1822 | { | 1822 | { |
1823 | struct mthca_dev *dev = to_mdev(ibqp->device); | 1823 | struct mthca_dev *dev = to_mdev(ibqp->device); |
1824 | struct mthca_qp *qp = to_mqp(ibqp); | 1824 | struct mthca_qp *qp = to_mqp(ibqp); |
1825 | __be32 doorbell[2]; | ||
1825 | void *wqe; | 1826 | void *wqe; |
1826 | void *prev_wqe; | 1827 | void *prev_wqe; |
1827 | unsigned long flags; | 1828 | unsigned long flags; |
@@ -1841,6 +1842,34 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1841 | ind = qp->sq.head & (qp->sq.max - 1); | 1842 | ind = qp->sq.head & (qp->sq.max - 1); |
1842 | 1843 | ||
1843 | for (nreq = 0; wr; ++nreq, wr = wr->next) { | 1844 | for (nreq = 0; wr; ++nreq, wr = wr->next) { |
1845 | if (unlikely(nreq == MTHCA_ARBEL_MAX_WQES_PER_SEND_DB)) { | ||
1846 | nreq = 0; | ||
1847 | |||
1848 | doorbell[0] = cpu_to_be32((MTHCA_ARBEL_MAX_WQES_PER_SEND_DB << 24) | | ||
1849 | ((qp->sq.head & 0xffff) << 8) | | ||
1850 | f0 | op0); | ||
1851 | doorbell[1] = cpu_to_be32((qp->qpn << 8) | size0); | ||
1852 | |||
1853 | qp->sq.head += MTHCA_ARBEL_MAX_WQES_PER_SEND_DB; | ||
1854 | size0 = 0; | ||
1855 | |||
1856 | /* | ||
1857 | * Make sure that descriptors are written before | ||
1858 | * doorbell record. | ||
1859 | */ | ||
1860 | wmb(); | ||
1861 | *qp->sq.db = cpu_to_be32(qp->sq.head & 0xffff); | ||
1862 | |||
1863 | /* | ||
1864 | * Make sure doorbell record is written before we | ||
1865 | * write MMIO send doorbell. | ||
1866 | */ | ||
1867 | wmb(); | ||
1868 | mthca_write64(doorbell, | ||
1869 | dev->kar + MTHCA_SEND_DOORBELL, | ||
1870 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
1871 | } | ||
1872 | |||
1844 | if (mthca_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) { | 1873 | if (mthca_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) { |
1845 | mthca_err(dev, "SQ %06x full (%u head, %u tail," | 1874 | mthca_err(dev, "SQ %06x full (%u head, %u tail," |
1846 | " %d max, %d nreq)\n", qp->qpn, | 1875 | " %d max, %d nreq)\n", qp->qpn, |
@@ -2017,8 +2046,6 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
2017 | 2046 | ||
2018 | out: | 2047 | out: |
2019 | if (likely(nreq)) { | 2048 | if (likely(nreq)) { |
2020 | __be32 doorbell[2]; | ||
2021 | |||
2022 | doorbell[0] = cpu_to_be32((nreq << 24) | | 2049 | doorbell[0] = cpu_to_be32((nreq << 24) | |
2023 | ((qp->sq.head & 0xffff) << 8) | | 2050 | ((qp->sq.head & 0xffff) << 8) | |
2024 | f0 | op0); | 2051 | f0 | op0); |
diff --git a/drivers/infiniband/hw/mthca/mthca_wqe.h b/drivers/infiniband/hw/mthca/mthca_wqe.h index 73f1c0b9021e..e7d2c1e86199 100644 --- a/drivers/infiniband/hw/mthca/mthca_wqe.h +++ b/drivers/infiniband/hw/mthca/mthca_wqe.h | |||
@@ -50,7 +50,8 @@ enum { | |||
50 | 50 | ||
51 | enum { | 51 | enum { |
52 | MTHCA_INVAL_LKEY = 0x100, | 52 | MTHCA_INVAL_LKEY = 0x100, |
53 | MTHCA_TAVOR_MAX_WQES_PER_RECV_DB = 256 | 53 | MTHCA_TAVOR_MAX_WQES_PER_RECV_DB = 256, |
54 | MTHCA_ARBEL_MAX_WQES_PER_SEND_DB = 255 | ||
54 | }; | 55 | }; |
55 | 56 | ||
56 | struct mthca_next_seg { | 57 | struct mthca_next_seg { |