Skip to content

Commit b218f78

Browse files
mmarcinidledford
authored andcommitted
IB/hfi1: Use global defines for upper bits in opcode
The awkward coding for setting the allowed_ops field was tripping an smatch warning. This patch uses the more appropriate defines from include/rdma to avoid the issue. As part of the patch remove a mask that was duplicated in rdmavt include files and use that mask as appropriate. Fixes: 8bea6b1cfe6f ("IB/rdmavt: Add create queue pair functionality") Reported-by: Dan Carpenter <[email protected]> Reviewed-by: Dennis Dalessandro <[email protected]> Signed-off-by: Mike Marciniszyn <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 87717f0 commit b218f78

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

drivers/infiniband/sw/rdmavt/qp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -829,13 +829,13 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
829829
case IB_QPT_SMI:
830830
case IB_QPT_GSI:
831831
case IB_QPT_UD:
832-
qp->allowed_ops = IB_OPCODE_UD_SEND_ONLY & RVT_OPCODE_QP_MASK;
832+
qp->allowed_ops = IB_OPCODE_UD;
833833
break;
834834
case IB_QPT_RC:
835-
qp->allowed_ops = IB_OPCODE_RC_SEND_ONLY & RVT_OPCODE_QP_MASK;
835+
qp->allowed_ops = IB_OPCODE_RC;
836836
break;
837837
case IB_QPT_UC:
838-
qp->allowed_ops = IB_OPCODE_UC_SEND_ONLY & RVT_OPCODE_QP_MASK;
838+
qp->allowed_ops = IB_OPCODE_UC;
839839
break;
840840
default:
841841
ret = ERR_PTR(-EINVAL);

drivers/staging/rdma/hfi1/verbs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ static inline int qp_ok(int opcode, struct hfi1_packet *packet)
545545

546546
if (!(ib_rvt_state_ops[packet->qp->state] & RVT_PROCESS_RECV_OK))
547547
goto dropit;
548-
if (((opcode & OPCODE_QP_MASK) == packet->qp->allowed_ops) ||
548+
if (((opcode & RVT_OPCODE_QP_MASK) == packet->qp->allowed_ops) ||
549549
(opcode == IB_OPCODE_CNP))
550550
return 1;
551551
dropit:

drivers/staging/rdma/hfi1/verbs.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,6 @@ int hfi1_process_mad(struct ib_device *ibdev, int mad_flags, u8 port,
335335
#endif
336336
#define PSN_MODIFY_MASK 0xFFFFFF
337337

338-
/* Number of bits to pay attention to in the opcode for checking qp type */
339-
#define OPCODE_QP_MASK 0xE0
340-
341338
/*
342339
* Compare the lower 24 bits of the msn values.
343340
* Returns an integer <, ==, or > than zero.

0 commit comments

Comments
 (0)