Skip to content

Commit 350b6dd

Browse files
Bob Pearsonjgunthorpe
authored andcommitted
RDMA/rxe: Simplify cq->notify code
The flags parameter to the request notify verb is a bitmask. But, rxe driver treats cq->notify as an int. If someone ever set both the IB_CQ_SOLICITED and the IB_CQ_NEXT_COMP bits rxe_cq_post could fail to generate a completion event. This patch treats the notify flags as a bit mask consistently and can handle the above case correctly. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bob Pearson <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent ee678e5 commit 350b6dd

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

drivers/infiniband/sw/rxe/rxe_cq.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,9 @@ int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cqe, int solicited)
115115

116116
spin_unlock_irqrestore(&cq->cq_lock, flags);
117117

118-
if ((cq->notify == IB_CQ_NEXT_COMP) ||
119-
(cq->notify == IB_CQ_SOLICITED && solicited)) {
118+
if ((cq->notify & IB_CQ_NEXT_COMP) ||
119+
(cq->notify & IB_CQ_SOLICITED && solicited)) {
120120
cq->notify = 0;
121-
122121
cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
123122
}
124123

drivers/infiniband/sw/rxe/rxe_verbs.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,9 +1181,7 @@ static int rxe_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags)
11811181
unsigned long irq_flags;
11821182

11831183
spin_lock_irqsave(&cq->cq_lock, irq_flags);
1184-
if (cq->notify != IB_CQ_NEXT_COMP)
1185-
cq->notify = flags & IB_CQ_SOLICITED_MASK;
1186-
1184+
cq->notify |= flags & IB_CQ_SOLICITED_MASK;
11871185
empty = queue_empty(cq->queue, QUEUE_TYPE_TO_ULP);
11881186

11891187
if ((flags & IB_CQ_REPORT_MISSED_EVENTS) && !empty)

0 commit comments

Comments
 (0)