Skip to content

Commit 6325e01

Browse files
Adit Ranadivejgunthorpe
authored andcommitted
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: 9a59739 ("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>
1 parent 917cb8a commit 6325e01

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

drivers/infiniband/hw/vmw_pvrdma/pvrdma.h

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,40 @@ static inline enum ib_qp_state pvrdma_qp_state_to_ib(enum pvrdma_qp_state state)
427427

428428
static inline enum pvrdma_wr_opcode ib_wr_opcode_to_pvrdma(enum ib_wr_opcode op)
429429
{
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+
}
431464
}
432465

433466
static inline enum ib_wc_status pvrdma_wc_status_to_ib(

drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,12 @@ int pvrdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
721721
wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM)
722722
wqe_hdr->ex.imm_data = wr->ex.imm_data;
723723

724+
if (unlikely(wqe_hdr->opcode == PVRDMA_WR_ERROR)) {
725+
*bad_wr = wr;
726+
ret = -EINVAL;
727+
goto out;
728+
}
729+
724730
switch (qp->ibqp.qp_type) {
725731
case IB_QPT_GSI:
726732
case IB_QPT_UD:

include/uapi/rdma/vmw_pvrdma-abi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ enum pvrdma_wr_opcode {
7878
PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD,
7979
PVRDMA_WR_BIND_MW,
8080
PVRDMA_WR_REG_SIG_MR,
81+
PVRDMA_WR_ERROR,
8182
};
8283

8384
enum pvrdma_wc_status {

0 commit comments

Comments
 (0)