aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdit Ranadive <aditr@vmware.com>2019-01-09 18:08:49 -0500
committerJason Gunthorpe <jgg@mellanox.com>2019-01-10 19:00:28 -0500
commit6325e01b6cdf4636b721cf7259c1616e3cf28ce2 (patch)
treedec6788add6ae4dd552b12787aadc3da9cabe016
parent917cb8a72a94d198073ad1e087685f801292042d (diff)
RDMA/vmw_pvrdma: Return the correct opcode when creating WR
Since the IB_WR_REG_MR opcode value changed, let's set the PVRDMA device opcodes explicitly. Reported-by: Ruishuang Wang <ruishuangw@vmware.com> Fixes: 9a59739bd01f ("IB/rxe: Revise the ib_wr_opcode enum") Cc: stable@vger.kernel.org Reviewed-by: Bryan Tan <bryantan@vmware.com> Reviewed-by: Ruishuang Wang <ruishuangw@vmware.com> Reviewed-by: Vishnu Dasa <vdasa@vmware.com> Signed-off-by: Adit Ranadive <aditr@vmware.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r--drivers/infiniband/hw/vmw_pvrdma/pvrdma.h35
-rw-r--r--drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c6
-rw-r--r--include/uapi/rdma/vmw_pvrdma-abi.h1
3 files changed, 41 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
index 42b8685c997e..3c633ab58052 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h
@@ -427,7 +427,40 @@ static inline enum ib_qp_state pvrdma_qp_state_to_ib(enum pvrdma_qp_state state)
427 427
428static inline enum pvrdma_wr_opcode ib_wr_opcode_to_pvrdma(enum ib_wr_opcode op) 428static inline enum pvrdma_wr_opcode ib_wr_opcode_to_pvrdma(enum ib_wr_opcode op)
429{ 429{
430 return (enum pvrdma_wr_opcode)op; 430 switch (op) {
431 case IB_WR_RDMA_WRITE:
432 return PVRDMA_WR_RDMA_WRITE;
433 case IB_WR_RDMA_WRITE_WITH_IMM:
434 return PVRDMA_WR_RDMA_WRITE_WITH_IMM;
435 case IB_WR_SEND:
436 return PVRDMA_WR_SEND;
437 case IB_WR_SEND_WITH_IMM:
438 return PVRDMA_WR_SEND_WITH_IMM;
439 case IB_WR_RDMA_READ:
440 return PVRDMA_WR_RDMA_READ;
441 case IB_WR_ATOMIC_CMP_AND_SWP:
442 return PVRDMA_WR_ATOMIC_CMP_AND_SWP;
443 case IB_WR_ATOMIC_FETCH_AND_ADD:
444 return PVRDMA_WR_ATOMIC_FETCH_AND_ADD;
445 case IB_WR_LSO:
446 return PVRDMA_WR_LSO;
447 case IB_WR_SEND_WITH_INV:
448 return PVRDMA_WR_SEND_WITH_INV;
449 case IB_WR_RDMA_READ_WITH_INV:
450 return PVRDMA_WR_RDMA_READ_WITH_INV;
451 case IB_WR_LOCAL_INV:
452 return PVRDMA_WR_LOCAL_INV;
453 case IB_WR_REG_MR:
454 return PVRDMA_WR_FAST_REG_MR;
455 case IB_WR_MASKED_ATOMIC_CMP_AND_SWP:
456 return PVRDMA_WR_MASKED_ATOMIC_CMP_AND_SWP;
457 case IB_WR_MASKED_ATOMIC_FETCH_AND_ADD:
458 return PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD;
459 case IB_WR_REG_SIG_MR:
460 return PVRDMA_WR_REG_SIG_MR;
461 default:
462 return PVRDMA_WR_ERROR;
463 }
431} 464}
432 465
433static inline enum ib_wc_status pvrdma_wc_status_to_ib( 466static inline enum ib_wc_status pvrdma_wc_status_to_ib(
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
index 3acf74cbe266..1ec3646087ba 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
@@ -721,6 +721,12 @@ int pvrdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
721 wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM) 721 wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM)
722 wqe_hdr->ex.imm_data = wr->ex.imm_data; 722 wqe_hdr->ex.imm_data = wr->ex.imm_data;
723 723
724 if (unlikely(wqe_hdr->opcode == PVRDMA_WR_ERROR)) {
725 *bad_wr = wr;
726 ret = -EINVAL;
727 goto out;
728 }
729
724 switch (qp->ibqp.qp_type) { 730 switch (qp->ibqp.qp_type) {
725 case IB_QPT_GSI: 731 case IB_QPT_GSI:
726 case IB_QPT_UD: 732 case IB_QPT_UD:
diff --git a/include/uapi/rdma/vmw_pvrdma-abi.h b/include/uapi/rdma/vmw_pvrdma-abi.h
index d13fd490b66d..6e73f0274e41 100644
--- a/include/uapi/rdma/vmw_pvrdma-abi.h
+++ b/include/uapi/rdma/vmw_pvrdma-abi.h
@@ -78,6 +78,7 @@ enum pvrdma_wr_opcode {
78 PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD, 78 PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD,
79 PVRDMA_WR_BIND_MW, 79 PVRDMA_WR_BIND_MW,
80 PVRDMA_WR_REG_SIG_MR, 80 PVRDMA_WR_REG_SIG_MR,
81 PVRDMA_WR_ERROR,
81}; 82};
82 83
83enum pvrdma_wc_status { 84enum pvrdma_wc_status {