aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c34
-rw-r--r--drivers/infiniband/hw/mthca/mthca_wqe.h3
2 files changed, 34 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index dd4e13303e96..7450550db736 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -871,7 +871,10 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
871 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); 871 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL);
872 872
873 mthca_wq_init(&qp->sq); 873 mthca_wq_init(&qp->sq);
874 qp->sq.last = get_send_wqe(qp, qp->sq.max - 1);
875
874 mthca_wq_init(&qp->rq); 876 mthca_wq_init(&qp->rq);
877 qp->rq.last = get_recv_wqe(qp, qp->rq.max - 1);
875 878
876 if (mthca_is_memfree(dev)) { 879 if (mthca_is_memfree(dev)) {
877 *qp->sq.db = 0; 880 *qp->sq.db = 0;
@@ -1819,6 +1822,7 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1819{ 1822{
1820 struct mthca_dev *dev = to_mdev(ibqp->device); 1823 struct mthca_dev *dev = to_mdev(ibqp->device);
1821 struct mthca_qp *qp = to_mqp(ibqp); 1824 struct mthca_qp *qp = to_mqp(ibqp);
1825 __be32 doorbell[2];
1822 void *wqe; 1826 void *wqe;
1823 void *prev_wqe; 1827 void *prev_wqe;
1824 unsigned long flags; 1828 unsigned long flags;
@@ -1838,6 +1842,34 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1838 ind = qp->sq.head & (qp->sq.max - 1); 1842 ind = qp->sq.head & (qp->sq.max - 1);
1839 1843
1840 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
1841 if (mthca_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) { 1873 if (mthca_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) {
1842 mthca_err(dev, "SQ %06x full (%u head, %u tail," 1874 mthca_err(dev, "SQ %06x full (%u head, %u tail,"
1843 " %d max, %d nreq)\n", qp->qpn, 1875 " %d max, %d nreq)\n", qp->qpn,
@@ -2014,8 +2046,6 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
2014 2046
2015out: 2047out:
2016 if (likely(nreq)) { 2048 if (likely(nreq)) {
2017 __be32 doorbell[2];
2018
2019 doorbell[0] = cpu_to_be32((nreq << 24) | 2049 doorbell[0] = cpu_to_be32((nreq << 24) |
2020 ((qp->sq.head & 0xffff) << 8) | 2050 ((qp->sq.head & 0xffff) << 8) |
2021 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
51enum { 51enum {
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
56struct mthca_next_seg { 57struct mthca_next_seg {