@@ -300,6 +300,7 @@ int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd,
300300 struct rxe_cq * rcq = to_rcq (init -> recv_cq );
301301 struct rxe_cq * scq = to_rcq (init -> send_cq );
302302 struct rxe_srq * srq = init -> srq ? to_rsrq (init -> srq ) : NULL ;
303+ unsigned long flags ;
303304
304305 rxe_get (pd );
305306 rxe_get (rcq );
@@ -325,10 +326,10 @@ int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd,
325326 if (err )
326327 goto err2 ;
327328
328- spin_lock_bh (& qp -> state_lock );
329+ spin_lock_irqsave (& qp -> state_lock , flags );
329330 qp -> attr .qp_state = IB_QPS_RESET ;
330331 qp -> valid = 1 ;
331- spin_unlock_bh (& qp -> state_lock );
332+ spin_unlock_irqrestore (& qp -> state_lock , flags );
332333
333334 return 0 ;
334335
@@ -492,24 +493,28 @@ static void rxe_qp_reset(struct rxe_qp *qp)
492493/* move the qp to the error state */
493494void rxe_qp_error (struct rxe_qp * qp )
494495{
495- spin_lock_bh (& qp -> state_lock );
496+ unsigned long flags ;
497+
498+ spin_lock_irqsave (& qp -> state_lock , flags );
496499 qp -> attr .qp_state = IB_QPS_ERR ;
497500
498501 /* drain work and packet queues */
499502 rxe_sched_task (& qp -> resp .task );
500503 rxe_sched_task (& qp -> comp .task );
501504 rxe_sched_task (& qp -> req .task );
502- spin_unlock_bh (& qp -> state_lock );
505+ spin_unlock_irqrestore (& qp -> state_lock , flags );
503506}
504507
505508static void rxe_qp_sqd (struct rxe_qp * qp , struct ib_qp_attr * attr ,
506509 int mask )
507510{
508- spin_lock_bh (& qp -> state_lock );
511+ unsigned long flags ;
512+
513+ spin_lock_irqsave (& qp -> state_lock , flags );
509514 qp -> attr .sq_draining = 1 ;
510515 rxe_sched_task (& qp -> comp .task );
511516 rxe_sched_task (& qp -> req .task );
512- spin_unlock_bh (& qp -> state_lock );
517+ spin_unlock_irqrestore (& qp -> state_lock , flags );
513518}
514519
515520/* caller should hold qp->state_lock */
@@ -555,14 +560,16 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
555560 qp -> attr .cur_qp_state = attr -> qp_state ;
556561
557562 if (mask & IB_QP_STATE ) {
558- spin_lock_bh (& qp -> state_lock );
563+ unsigned long flags ;
564+
565+ spin_lock_irqsave (& qp -> state_lock , flags );
559566 err = __qp_chk_state (qp , attr , mask );
560567 if (!err ) {
561568 qp -> attr .qp_state = attr -> qp_state ;
562569 rxe_dbg_qp (qp , "state -> %s\n" ,
563570 qps2str [attr -> qp_state ]);
564571 }
565- spin_unlock_bh (& qp -> state_lock );
572+ spin_unlock_irqrestore (& qp -> state_lock , flags );
566573
567574 if (err )
568575 return err ;
@@ -688,6 +695,8 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
688695/* called by the query qp verb */
689696int rxe_qp_to_attr (struct rxe_qp * qp , struct ib_qp_attr * attr , int mask )
690697{
698+ unsigned long flags ;
699+
691700 * attr = qp -> attr ;
692701
693702 attr -> rq_psn = qp -> resp .psn ;
@@ -708,12 +717,12 @@ int rxe_qp_to_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask)
708717 /* Applications that get this state typically spin on it.
709718 * Yield the processor
710719 */
711- spin_lock_bh (& qp -> state_lock );
720+ spin_lock_irqsave (& qp -> state_lock , flags );
712721 if (qp -> attr .sq_draining ) {
713- spin_unlock_bh (& qp -> state_lock );
722+ spin_unlock_irqrestore (& qp -> state_lock , flags );
714723 cond_resched ();
715724 } else {
716- spin_unlock_bh (& qp -> state_lock );
725+ spin_unlock_irqrestore (& qp -> state_lock , flags );
717726 }
718727
719728 return 0 ;
@@ -737,10 +746,11 @@ int rxe_qp_chk_destroy(struct rxe_qp *qp)
737746static void rxe_qp_do_cleanup (struct work_struct * work )
738747{
739748 struct rxe_qp * qp = container_of (work , typeof (* qp ), cleanup_work .work );
749+ unsigned long flags ;
740750
741- spin_lock_bh (& qp -> state_lock );
751+ spin_lock_irqsave (& qp -> state_lock , flags );
742752 qp -> valid = 0 ;
743- spin_unlock_bh (& qp -> state_lock );
753+ spin_unlock_irqrestore (& qp -> state_lock , flags );
744754 qp -> qp_timeout_jiffies = 0 ;
745755
746756 if (qp_type (qp ) == IB_QPT_RC ) {
0 commit comments