Skip to content

Commit e0ae9ec

Browse files
Michael S. TsirkinRoland Dreier
authored andcommitted
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 <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent 267ee88 commit e0ae9ec

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

drivers/infiniband/hw/mthca/mthca_qp.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,7 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
18221822
{
18231823
struct mthca_dev *dev = to_mdev(ibqp->device);
18241824
struct mthca_qp *qp = to_mqp(ibqp);
1825+
__be32 doorbell[2];
18251826
void *wqe;
18261827
void *prev_wqe;
18271828
unsigned long flags;
@@ -1841,6 +1842,34 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
18411842
ind = qp->sq.head & (qp->sq.max - 1);
18421843

18431844
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+
18441873
if (mthca_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) {
18451874
mthca_err(dev, "SQ %06x full (%u head, %u tail,"
18461875
" %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,
20172046

20182047
out:
20192048
if (likely(nreq)) {
2020-
__be32 doorbell[2];
2021-
20222049
doorbell[0] = cpu_to_be32((nreq << 24) |
20232050
((qp->sq.head & 0xffff) << 8) |
20242051
f0 | op0);

drivers/infiniband/hw/mthca/mthca_wqe.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ enum {
5050

5151
enum {
5252
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
5455
};
5556

5657
struct mthca_next_seg {

0 commit comments

Comments
 (0)