[PATCH 1/1] IB: rxe: replace spin lock with bitops in rxe cq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is a common way to use bitops to indicate the state. So replace spin
lock with bitops.

Signed-off-by: Zhu Yanjun <yanjun.zhu@xxxxxxxxxx>
---
 drivers/infiniband/sw/rxe/rxe_cq.c    | 14 +++-----------
 drivers/infiniband/sw/rxe/rxe_verbs.h |  4 +++-
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c
index a57276f..7b34d04 100644
--- a/drivers/infiniband/sw/rxe/rxe_cq.c
+++ b/drivers/infiniband/sw/rxe/rxe_cq.c
@@ -69,14 +69,9 @@ int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq,
 static void rxe_send_complete(unsigned long data)
 {
 	struct rxe_cq *cq = (struct rxe_cq *)data;
-	unsigned long flags;
 
-	spin_lock_irqsave(&cq->cq_lock, flags);
-	if (cq->is_dying) {
-		spin_unlock_irqrestore(&cq->cq_lock, flags);
+	if (test_bit(RXE_CQ_IS_DYING, &cq->is_dying))
 		return;
-	}
-	spin_unlock_irqrestore(&cq->cq_lock, flags);
 
 	cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
 }
@@ -105,7 +100,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
 	if (uresp)
 		cq->is_user = 1;
 
-	cq->is_dying = false;
+	clear_bit(RXE_CQ_IS_DYING, &cq->is_dying);
 
 	tasklet_init(&cq->comp_task, rxe_send_complete, (unsigned long)cq);
 
@@ -169,11 +164,8 @@ int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cqe, int solicited)
 
 void rxe_cq_disable(struct rxe_cq *cq)
 {
-	unsigned long flags;
 
-	spin_lock_irqsave(&cq->cq_lock, flags);
-	cq->is_dying = true;
-	spin_unlock_irqrestore(&cq->cq_lock, flags);
+	set_bit(RXE_CQ_IS_DYING, &cq->is_dying);
 }
 
 void rxe_cq_cleanup(struct rxe_pool_entry *arg)
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h
index 74e0480..ba3f726 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.h
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.h
@@ -84,13 +84,15 @@ struct rxe_cqe {
 	};
 };
 
+#define	RXE_CQ_IS_DYING		0
+
 struct rxe_cq {
 	struct rxe_pool_entry	pelem;
 	struct ib_cq		ibcq;
 	struct rxe_queue	*queue;
 	spinlock_t		cq_lock;
 	u8			notify;
-	bool			is_dying;
+	unsigned long		is_dying;
 	int			is_user;
 	struct tasklet_struct	comp_task;
 };
-- 
2.7.4





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux