aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorRobert Walsh <robert.walsh@qlogic.com>2007-06-18 17:24:48 -0400
committerRoland Dreier <rolandd@cisco.com>2007-07-09 23:12:26 -0400
commitb506e1dc59726a1c608f26e7294b9fe186255139 (patch)
treeae8550e392380cb953e19ab92ba0ae0716bcc1ab /drivers/infiniband/hw
parente8e7ad711509f576b1bffd92c3ae4672fe92ec48 (diff)
IB/ipath: Send ACK invalid where appropriate
The IB specification ch. 9.9.3 table 58 says that a QP which isn't set up for the operation should return a NAK invalid request. Signed-off-by: Robert Walsh <robert.walsh@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_rc.c13
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ruc.c22
2 files changed, 25 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c
index 9e7123987ae6..6423d9ef4175 100644
--- a/drivers/infiniband/hw/ipath/ipath_rc.c
+++ b/drivers/infiniband/hw/ipath/ipath_rc.c
@@ -1711,6 +1711,9 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1711 case OP(RDMA_WRITE_FIRST): 1711 case OP(RDMA_WRITE_FIRST):
1712 case OP(RDMA_WRITE_ONLY): 1712 case OP(RDMA_WRITE_ONLY):
1713 case OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE): 1713 case OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE):
1714 if (unlikely(!(qp->qp_access_flags &
1715 IB_ACCESS_REMOTE_WRITE)))
1716 goto nack_inv;
1714 /* consume RWQE */ 1717 /* consume RWQE */
1715 /* RETH comes after BTH */ 1718 /* RETH comes after BTH */
1716 if (!header_in_data) 1719 if (!header_in_data)
@@ -1740,9 +1743,6 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1740 qp->r_sge.sge.length = 0; 1743 qp->r_sge.sge.length = 0;
1741 qp->r_sge.sge.sge_length = 0; 1744 qp->r_sge.sge.sge_length = 0;
1742 } 1745 }
1743 if (unlikely(!(qp->qp_access_flags &
1744 IB_ACCESS_REMOTE_WRITE)))
1745 goto nack_acc;
1746 if (opcode == OP(RDMA_WRITE_FIRST)) 1746 if (opcode == OP(RDMA_WRITE_FIRST))
1747 goto send_middle; 1747 goto send_middle;
1748 else if (opcode == OP(RDMA_WRITE_ONLY)) 1748 else if (opcode == OP(RDMA_WRITE_ONLY))
@@ -1756,8 +1756,9 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1756 u32 len; 1756 u32 len;
1757 u8 next; 1757 u8 next;
1758 1758
1759 if (unlikely(!(qp->qp_access_flags & IB_ACCESS_REMOTE_READ))) 1759 if (unlikely(!(qp->qp_access_flags &
1760 goto nack_acc; 1760 IB_ACCESS_REMOTE_READ)))
1761 goto nack_inv;
1761 next = qp->r_head_ack_queue + 1; 1762 next = qp->r_head_ack_queue + 1;
1762 if (next > IPATH_MAX_RDMA_ATOMIC) 1763 if (next > IPATH_MAX_RDMA_ATOMIC)
1763 next = 0; 1764 next = 0;
@@ -1832,7 +1833,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1832 1833
1833 if (unlikely(!(qp->qp_access_flags & 1834 if (unlikely(!(qp->qp_access_flags &
1834 IB_ACCESS_REMOTE_ATOMIC))) 1835 IB_ACCESS_REMOTE_ATOMIC)))
1835 goto nack_acc; 1836 goto nack_inv;
1836 next = qp->r_head_ack_queue + 1; 1837 next = qp->r_head_ack_queue + 1;
1837 if (next > IPATH_MAX_RDMA_ATOMIC) 1838 if (next > IPATH_MAX_RDMA_ATOMIC)
1838 next = 0; 1839 next = 0;
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c
index 1b0e62b761bb..d47ad7c8a0d2 100644
--- a/drivers/infiniband/hw/ipath/ipath_ruc.c
+++ b/drivers/infiniband/hw/ipath/ipath_ruc.c
@@ -319,12 +319,22 @@ again:
319 break; 319 break;
320 320
321 case IB_WR_RDMA_WRITE_WITH_IMM: 321 case IB_WR_RDMA_WRITE_WITH_IMM:
322 if (unlikely(!(qp->qp_access_flags &
323 IB_ACCESS_REMOTE_WRITE))) {
324 wc.status = IB_WC_REM_INV_REQ_ERR;
325 goto err;
326 }
322 wc.wc_flags = IB_WC_WITH_IMM; 327 wc.wc_flags = IB_WC_WITH_IMM;
323 wc.imm_data = wqe->wr.imm_data; 328 wc.imm_data = wqe->wr.imm_data;
324 if (!ipath_get_rwqe(qp, 1)) 329 if (!ipath_get_rwqe(qp, 1))
325 goto rnr_nak; 330 goto rnr_nak;
326 /* FALLTHROUGH */ 331 /* FALLTHROUGH */
327 case IB_WR_RDMA_WRITE: 332 case IB_WR_RDMA_WRITE:
333 if (unlikely(!(qp->qp_access_flags &
334 IB_ACCESS_REMOTE_WRITE))) {
335 wc.status = IB_WC_REM_INV_REQ_ERR;
336 goto err;
337 }
328 if (wqe->length == 0) 338 if (wqe->length == 0)
329 break; 339 break;
330 if (unlikely(!ipath_rkey_ok(qp, &qp->r_sge, wqe->length, 340 if (unlikely(!ipath_rkey_ok(qp, &qp->r_sge, wqe->length,
@@ -354,8 +364,10 @@ again:
354 364
355 case IB_WR_RDMA_READ: 365 case IB_WR_RDMA_READ:
356 if (unlikely(!(qp->qp_access_flags & 366 if (unlikely(!(qp->qp_access_flags &
357 IB_ACCESS_REMOTE_READ))) 367 IB_ACCESS_REMOTE_READ))) {
358 goto acc_err; 368 wc.status = IB_WC_REM_INV_REQ_ERR;
369 goto err;
370 }
359 if (unlikely(!ipath_rkey_ok(qp, &sqp->s_sge, wqe->length, 371 if (unlikely(!ipath_rkey_ok(qp, &sqp->s_sge, wqe->length,
360 wqe->wr.wr.rdma.remote_addr, 372 wqe->wr.wr.rdma.remote_addr,
361 wqe->wr.wr.rdma.rkey, 373 wqe->wr.wr.rdma.rkey,
@@ -369,8 +381,10 @@ again:
369 case IB_WR_ATOMIC_CMP_AND_SWP: 381 case IB_WR_ATOMIC_CMP_AND_SWP:
370 case IB_WR_ATOMIC_FETCH_AND_ADD: 382 case IB_WR_ATOMIC_FETCH_AND_ADD:
371 if (unlikely(!(qp->qp_access_flags & 383 if (unlikely(!(qp->qp_access_flags &
372 IB_ACCESS_REMOTE_ATOMIC))) 384 IB_ACCESS_REMOTE_ATOMIC))) {
373 goto acc_err; 385 wc.status = IB_WC_REM_INV_REQ_ERR;
386 goto err;
387 }
374 if (unlikely(!ipath_rkey_ok(qp, &qp->r_sge, sizeof(u64), 388 if (unlikely(!ipath_rkey_ok(qp, &qp->r_sge, sizeof(u64),
375 wqe->wr.wr.atomic.remote_addr, 389 wqe->wr.wr.atomic.remote_addr,
376 wqe->wr.wr.atomic.rkey, 390 wqe->wr.wr.atomic.rkey,