@@ -991,15 +991,14 @@ lpfc_cleanup_vports_rrqs(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
991
991
* @ndlp: Targets nodelist pointer for this exchange.
992
992
* @xritag the xri in the bitmap to test.
993
993
*
994
- * This function is called with hbalock held. This function
995
- * returns 0 = rrq not active for this xri
996
- * 1 = rrq is valid for this xri.
994
+ * This function returns:
995
+ * 0 = rrq not active for this xri
996
+ * 1 = rrq is valid for this xri.
997
997
**/
998
998
int
999
999
lpfc_test_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
1000
1000
uint16_t xritag)
1001
1001
{
1002
- lockdep_assert_held(&phba->hbalock);
1003
1002
if (!ndlp)
1004
1003
return 0;
1005
1004
if (!ndlp->active_rrqs_xri_bitmap)
@@ -1102,10 +1101,11 @@ lpfc_set_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
1102
1101
* @phba: Pointer to HBA context object.
1103
1102
* @piocb: Pointer to the iocbq.
1104
1103
*
1105
- * This function is called with the ring lock held. This function
1106
- * gets a new driver sglq object from the sglq list. If the
1107
- * list is not empty then it is successful, it returns pointer to the newly
1108
- * allocated sglq object else it returns NULL.
1104
+ * The driver calls this function with either the nvme ls ring lock
1105
+ * or the fc els ring lock held depending on the iocb usage. This function
1106
+ * gets a new driver sglq object from the sglq list. If the list is not empty
1107
+ * then it is successful, it returns pointer to the newly allocated sglq
1108
+ * object else it returns NULL.
1109
1109
**/
1110
1110
static struct lpfc_sglq *
1111
1111
__lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq)
@@ -1115,9 +1115,15 @@ __lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq)
1115
1115
struct lpfc_sglq *start_sglq = NULL;
1116
1116
struct lpfc_io_buf *lpfc_cmd;
1117
1117
struct lpfc_nodelist *ndlp;
1118
+ struct lpfc_sli_ring *pring = NULL;
1118
1119
int found = 0;
1119
1120
1120
- lockdep_assert_held(&phba->hbalock);
1121
+ if (piocbq->iocb_flag & LPFC_IO_NVME_LS)
1122
+ pring = phba->sli4_hba.nvmels_wq->pring;
1123
+ else
1124
+ pring = lpfc_phba_elsring(phba);
1125
+
1126
+ lockdep_assert_held(&pring->ring_lock);
1121
1127
1122
1128
if (piocbq->iocb_flag & LPFC_IO_FCP) {
1123
1129
lpfc_cmd = (struct lpfc_io_buf *) piocbq->context1;
@@ -1560,7 +1566,8 @@ lpfc_sli_ring_map(struct lpfc_hba *phba)
1560
1566
* @pring: Pointer to driver SLI ring object.
1561
1567
* @piocb: Pointer to the driver iocb object.
1562
1568
*
1563
- * This function is called with hbalock held. The function adds the
1569
+ * The driver calls this function with the hbalock held for SLI3 ports or
1570
+ * the ring lock held for SLI4 ports. The function adds the
1564
1571
* new iocb to txcmplq of the given ring. This function always returns
1565
1572
* 0. If this function is called for ELS ring, this function checks if
1566
1573
* there is a vport associated with the ELS command. This function also
@@ -1570,7 +1577,10 @@ static int
1570
1577
lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1571
1578
struct lpfc_iocbq *piocb)
1572
1579
{
1573
- lockdep_assert_held(&phba->hbalock);
1580
+ if (phba->sli_rev == LPFC_SLI_REV4)
1581
+ lockdep_assert_held(&pring->ring_lock);
1582
+ else
1583
+ lockdep_assert_held(&phba->hbalock);
1574
1584
1575
1585
BUG_ON(!piocb);
1576
1586
@@ -2967,8 +2977,8 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
2967
2977
*
2968
2978
* This function looks up the iocb_lookup table to get the command iocb
2969
2979
* corresponding to the given response iocb using the iotag of the
2970
- * response iocb. This function is called with the hbalock held
2971
- * for sli3 devices or the ring_lock for sli4 devices .
2980
+ * response iocb. The driver calls this function with the hbalock held
2981
+ * for SLI3 ports or the ring lock held for SLI4 ports .
2972
2982
* This function returns the command iocb object if it finds the command
2973
2983
* iocb else returns NULL.
2974
2984
**/
@@ -2979,8 +2989,15 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba,
2979
2989
{
2980
2990
struct lpfc_iocbq *cmd_iocb = NULL;
2981
2991
uint16_t iotag;
2982
- lockdep_assert_held(&phba->hbalock);
2992
+ spinlock_t *temp_lock = NULL;
2993
+ unsigned long iflag = 0;
2983
2994
2995
+ if (phba->sli_rev == LPFC_SLI_REV4)
2996
+ temp_lock = &pring->ring_lock;
2997
+ else
2998
+ temp_lock = &phba->hbalock;
2999
+
3000
+ spin_lock_irqsave(temp_lock, iflag);
2984
3001
iotag = prspiocb->iocb.ulpIoTag;
2985
3002
2986
3003
if (iotag != 0 && iotag <= phba->sli.last_iotag) {
@@ -2990,10 +3007,12 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba,
2990
3007
list_del_init(&cmd_iocb->list);
2991
3008
cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ;
2992
3009
pring->txcmplq_cnt--;
3010
+ spin_unlock_irqrestore(temp_lock, iflag);
2993
3011
return cmd_iocb;
2994
3012
}
2995
3013
}
2996
3014
3015
+ spin_unlock_irqrestore(temp_lock, iflag);
2997
3016
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
2998
3017
"0317 iotag x%x is out of "
2999
3018
"range: max iotag x%x wd0 x%x\n",
@@ -3009,8 +3028,8 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba,
3009
3028
* @iotag: IOCB tag.
3010
3029
*
3011
3030
* This function looks up the iocb_lookup table to get the command iocb
3012
- * corresponding to the given iotag. This function is called with the
3013
- * hbalock held.
3031
+ * corresponding to the given iotag. The driver calls this function with
3032
+ * the ring lock held because this function is an SLI4 port only helper .
3014
3033
* This function returns the command iocb object if it finds the command
3015
3034
* iocb else returns NULL.
3016
3035
**/
@@ -3019,19 +3038,28 @@ lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba,
3019
3038
struct lpfc_sli_ring *pring, uint16_t iotag)
3020
3039
{
3021
3040
struct lpfc_iocbq *cmd_iocb = NULL;
3041
+ spinlock_t *temp_lock = NULL;
3042
+ unsigned long iflag = 0;
3022
3043
3023
- lockdep_assert_held(&phba->hbalock);
3044
+ if (phba->sli_rev == LPFC_SLI_REV4)
3045
+ temp_lock = &pring->ring_lock;
3046
+ else
3047
+ temp_lock = &phba->hbalock;
3048
+
3049
+ spin_lock_irqsave(temp_lock, iflag);
3024
3050
if (iotag != 0 && iotag <= phba->sli.last_iotag) {
3025
3051
cmd_iocb = phba->sli.iocbq_lookup[iotag];
3026
3052
if (cmd_iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ) {
3027
3053
/* remove from txcmpl queue list */
3028
3054
list_del_init(&cmd_iocb->list);
3029
3055
cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ;
3030
3056
pring->txcmplq_cnt--;
3057
+ spin_unlock_irqrestore(temp_lock, iflag);
3031
3058
return cmd_iocb;
3032
3059
}
3033
3060
}
3034
3061
3062
+ spin_unlock_irqrestore(temp_lock, iflag);
3035
3063
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
3036
3064
"0372 iotag x%x lookup error: max iotag (x%x) "
3037
3065
"iocb_flag x%x\n",
@@ -3065,17 +3093,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3065
3093
int rc = 1;
3066
3094
unsigned long iflag;
3067
3095
3068
- /* Based on the iotag field, get the cmd IOCB from the txcmplq */
3069
- if (phba->sli_rev == LPFC_SLI_REV4)
3070
- spin_lock_irqsave(&pring->ring_lock, iflag);
3071
- else
3072
- spin_lock_irqsave(&phba->hbalock, iflag);
3073
3096
cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq);
3074
- if (phba->sli_rev == LPFC_SLI_REV4)
3075
- spin_unlock_irqrestore(&pring->ring_lock, iflag);
3076
- else
3077
- spin_unlock_irqrestore(&phba->hbalock, iflag);
3078
-
3079
3097
if (cmdiocbp) {
3080
3098
if (cmdiocbp->iocb_cmpl) {
3081
3099
/*
@@ -3406,8 +3424,10 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
3406
3424
break;
3407
3425
}
3408
3426
3427
+ spin_unlock_irqrestore(&phba->hbalock, iflag);
3409
3428
cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring,
3410
3429
&rspiocbq);
3430
+ spin_lock_irqsave(&phba->hbalock, iflag);
3411
3431
if (unlikely(!cmdiocbq))
3412
3432
break;
3413
3433
if (cmdiocbq->iocb_flag & LPFC_DRIVER_ABORTED)
@@ -3601,9 +3621,12 @@ lpfc_sli_sp_handle_rspiocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3601
3621
3602
3622
case LPFC_ABORT_IOCB:
3603
3623
cmdiocbp = NULL;
3604
- if (irsp->ulpCommand != CMD_XRI_ABORTED_CX)
3624
+ if (irsp->ulpCommand != CMD_XRI_ABORTED_CX) {
3625
+ spin_unlock_irqrestore(&phba->hbalock, iflag);
3605
3626
cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring,
3606
3627
saveq);
3628
+ spin_lock_irqsave(&phba->hbalock, iflag);
3629
+ }
3607
3630
if (cmdiocbp) {
3608
3631
/* Call the specified completion routine */
3609
3632
if (cmdiocbp->iocb_cmpl) {
@@ -12976,13 +12999,11 @@ lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *phba,
12976
12999
return NULL;
12977
13000
12978
13001
wcqe = &irspiocbq->cq_event.cqe.wcqe_cmpl;
12979
- spin_lock_irqsave(&pring->ring_lock, iflags);
12980
13002
pring->stats.iocb_event++;
12981
13003
/* Look up the ELS command IOCB and create pseudo response IOCB */
12982
13004
cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring,
12983
13005
bf_get(lpfc_wcqe_c_request_tag, wcqe));
12984
13006
if (unlikely(!cmdiocbq)) {
12985
- spin_unlock_irqrestore(&pring->ring_lock, iflags);
12986
13007
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
12987
13008
"0386 ELS complete with no corresponding "
12988
13009
"cmdiocb: 0x%x 0x%x 0x%x 0x%x\n",
@@ -12992,6 +13013,7 @@ lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *phba,
12992
13013
return NULL;
12993
13014
}
12994
13015
13016
+ spin_lock_irqsave(&pring->ring_lock, iflags);
12995
13017
/* Put the iocb back on the txcmplq */
12996
13018
lpfc_sli_ringtxcmpl_put(phba, pring, cmdiocbq);
12997
13019
spin_unlock_irqrestore(&pring->ring_lock, iflags);
@@ -13762,9 +13784,9 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
13762
13784
/* Look up the FCP command IOCB and create pseudo response IOCB */
13763
13785
spin_lock_irqsave(&pring->ring_lock, iflags);
13764
13786
pring->stats.iocb_event++;
13787
+ spin_unlock_irqrestore(&pring->ring_lock, iflags);
13765
13788
cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring,
13766
13789
bf_get(lpfc_wcqe_c_request_tag, wcqe));
13767
- spin_unlock_irqrestore(&pring->ring_lock, iflags);
13768
13790
if (unlikely(!cmdiocbq)) {
13769
13791
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
13770
13792
"0374 FCP complete with no corresponding "
0 commit comments