aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2012-08-03 12:35:34 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-09-14 09:37:45 -0400
commit7e56aa25e3510ae72f0feada4b2d04eda48f95db (patch)
treec43b41e5d41cc9be0f81eabfbec5e7dd54a1997a /drivers/scsi/lpfc/lpfc_sli.c
parentb9a7c631d4f0ddd482e2c3183d5e02148bdf5365 (diff)
[SCSI] lpfc 8.3.33: Formally separate lpfc_sli_ring SLI-3 and SLI-4 variantions
Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c182
1 files changed, 104 insertions, 78 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 296a6f8473e0..51c7fc746de1 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -475,8 +475,8 @@ lpfc_sli4_rq_release(struct lpfc_queue *hq, struct lpfc_queue *dq)
475static inline IOCB_t * 475static inline IOCB_t *
476lpfc_cmd_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 476lpfc_cmd_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
477{ 477{
478 return (IOCB_t *) (((char *) pring->cmdringaddr) + 478 return (IOCB_t *) (((char *) pring->sli.sli3.cmdringaddr) +
479 pring->cmdidx * phba->iocb_cmd_size); 479 pring->sli.sli3.cmdidx * phba->iocb_cmd_size);
480} 480}
481 481
482/** 482/**
@@ -492,8 +492,8 @@ lpfc_cmd_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
492static inline IOCB_t * 492static inline IOCB_t *
493lpfc_resp_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 493lpfc_resp_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
494{ 494{
495 return (IOCB_t *) (((char *) pring->rspringaddr) + 495 return (IOCB_t *) (((char *) pring->sli.sli3.rspringaddr) +
496 pring->rspidx * phba->iocb_rsp_size); 496 pring->sli.sli3.rspidx * phba->iocb_rsp_size);
497} 497}
498 498
499/** 499/**
@@ -1323,21 +1323,23 @@ static IOCB_t *
1323lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 1323lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
1324{ 1324{
1325 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; 1325 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno];
1326 uint32_t max_cmd_idx = pring->numCiocb; 1326 uint32_t max_cmd_idx = pring->sli.sli3.numCiocb;
1327 if ((pring->next_cmdidx == pring->cmdidx) && 1327 if ((pring->sli.sli3.next_cmdidx == pring->sli.sli3.cmdidx) &&
1328 (++pring->next_cmdidx >= max_cmd_idx)) 1328 (++pring->sli.sli3.next_cmdidx >= max_cmd_idx))
1329 pring->next_cmdidx = 0; 1329 pring->sli.sli3.next_cmdidx = 0;
1330 1330
1331 if (unlikely(pring->local_getidx == pring->next_cmdidx)) { 1331 if (unlikely(pring->sli.sli3.local_getidx ==
1332 pring->sli.sli3.next_cmdidx)) {
1332 1333
1333 pring->local_getidx = le32_to_cpu(pgp->cmdGetInx); 1334 pring->sli.sli3.local_getidx = le32_to_cpu(pgp->cmdGetInx);
1334 1335
1335 if (unlikely(pring->local_getidx >= max_cmd_idx)) { 1336 if (unlikely(pring->sli.sli3.local_getidx >= max_cmd_idx)) {
1336 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 1337 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
1337 "0315 Ring %d issue: portCmdGet %d " 1338 "0315 Ring %d issue: portCmdGet %d "
1338 "is bigger than cmd ring %d\n", 1339 "is bigger than cmd ring %d\n",
1339 pring->ringno, 1340 pring->ringno,
1340 pring->local_getidx, max_cmd_idx); 1341 pring->sli.sli3.local_getidx,
1342 max_cmd_idx);
1341 1343
1342 phba->link_state = LPFC_HBA_ERROR; 1344 phba->link_state = LPFC_HBA_ERROR;
1343 /* 1345 /*
@@ -1352,7 +1354,7 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
1352 return NULL; 1354 return NULL;
1353 } 1355 }
1354 1356
1355 if (pring->local_getidx == pring->next_cmdidx) 1357 if (pring->sli.sli3.local_getidx == pring->sli.sli3.next_cmdidx)
1356 return NULL; 1358 return NULL;
1357 } 1359 }
1358 1360
@@ -1487,8 +1489,8 @@ lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1487 * Let the HBA know what IOCB slot will be the next one the 1489 * Let the HBA know what IOCB slot will be the next one the
1488 * driver will put a command into. 1490 * driver will put a command into.
1489 */ 1491 */
1490 pring->cmdidx = pring->next_cmdidx; 1492 pring->sli.sli3.cmdidx = pring->sli.sli3.next_cmdidx;
1491 writel(pring->cmdidx, &phba->host_gp[pring->ringno].cmdPutInx); 1493 writel(pring->sli.sli3.cmdidx, &phba->host_gp[pring->ringno].cmdPutInx);
1492} 1494}
1493 1495
1494/** 1496/**
@@ -2789,7 +2791,7 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
2789 "0312 Ring %d handler: portRspPut %d " 2791 "0312 Ring %d handler: portRspPut %d "
2790 "is bigger than rsp ring %d\n", 2792 "is bigger than rsp ring %d\n",
2791 pring->ringno, le32_to_cpu(pgp->rspPutInx), 2793 pring->ringno, le32_to_cpu(pgp->rspPutInx),
2792 pring->numRiocb); 2794 pring->sli.sli3.numRiocb);
2793 2795
2794 phba->link_state = LPFC_HBA_ERROR; 2796 phba->link_state = LPFC_HBA_ERROR;
2795 2797
@@ -2876,7 +2878,7 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
2876 * The next available response entry should never exceed the maximum 2878 * The next available response entry should never exceed the maximum
2877 * entries. If it does, treat it as an adapter hardware error. 2879 * entries. If it does, treat it as an adapter hardware error.
2878 */ 2880 */
2879 portRspMax = pring->numRiocb; 2881 portRspMax = pring->sli.sli3.numRiocb;
2880 portRspPut = le32_to_cpu(pgp->rspPutInx); 2882 portRspPut = le32_to_cpu(pgp->rspPutInx);
2881 if (unlikely(portRspPut >= portRspMax)) { 2883 if (unlikely(portRspPut >= portRspMax)) {
2882 lpfc_sli_rsp_pointers_error(phba, pring); 2884 lpfc_sli_rsp_pointers_error(phba, pring);
@@ -2890,7 +2892,7 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
2890 phba->fcp_ring_in_use = 1; 2892 phba->fcp_ring_in_use = 1;
2891 2893
2892 rmb(); 2894 rmb();
2893 while (pring->rspidx != portRspPut) { 2895 while (pring->sli.sli3.rspidx != portRspPut) {
2894 /* 2896 /*
2895 * Fetch an entry off the ring and copy it into a local data 2897 * Fetch an entry off the ring and copy it into a local data
2896 * structure. The copy involves a byte-swap since the 2898 * structure. The copy involves a byte-swap since the
@@ -2899,8 +2901,8 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
2899 entry = lpfc_resp_iocb(phba, pring); 2901 entry = lpfc_resp_iocb(phba, pring);
2900 phba->last_completion_time = jiffies; 2902 phba->last_completion_time = jiffies;
2901 2903
2902 if (++pring->rspidx >= portRspMax) 2904 if (++pring->sli.sli3.rspidx >= portRspMax)
2903 pring->rspidx = 0; 2905 pring->sli.sli3.rspidx = 0;
2904 2906
2905 lpfc_sli_pcimem_bcopy((uint32_t *) entry, 2907 lpfc_sli_pcimem_bcopy((uint32_t *) entry,
2906 (uint32_t *) &rspiocbq.iocb, 2908 (uint32_t *) &rspiocbq.iocb,
@@ -3001,9 +3003,10 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
3001 * been updated, sync the pgp->rspPutInx and fetch the new port 3003 * been updated, sync the pgp->rspPutInx and fetch the new port
3002 * response put pointer. 3004 * response put pointer.
3003 */ 3005 */
3004 writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); 3006 writel(pring->sli.sli3.rspidx,
3007 &phba->host_gp[pring->ringno].rspGetInx);
3005 3008
3006 if (pring->rspidx == portRspPut) 3009 if (pring->sli.sli3.rspidx == portRspPut)
3007 portRspPut = le32_to_cpu(pgp->rspPutInx); 3010 portRspPut = le32_to_cpu(pgp->rspPutInx);
3008 } 3011 }
3009 3012
@@ -3018,7 +3021,7 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
3018 pring->stats.iocb_cmd_empty++; 3021 pring->stats.iocb_cmd_empty++;
3019 3022
3020 /* Force update of the local copy of cmdGetInx */ 3023 /* Force update of the local copy of cmdGetInx */
3021 pring->local_getidx = le32_to_cpu(pgp->cmdGetInx); 3024 pring->sli.sli3.local_getidx = le32_to_cpu(pgp->cmdGetInx);
3022 lpfc_sli_resume_iocb(phba, pring); 3025 lpfc_sli_resume_iocb(phba, pring);
3023 3026
3024 if ((pring->lpfc_sli_cmd_available)) 3027 if ((pring->lpfc_sli_cmd_available))
@@ -3250,7 +3253,7 @@ lpfc_sli_handle_slow_ring_event_s3(struct lpfc_hba *phba,
3250 * The next available response entry should never exceed the maximum 3253 * The next available response entry should never exceed the maximum
3251 * entries. If it does, treat it as an adapter hardware error. 3254 * entries. If it does, treat it as an adapter hardware error.
3252 */ 3255 */
3253 portRspMax = pring->numRiocb; 3256 portRspMax = pring->sli.sli3.numRiocb;
3254 portRspPut = le32_to_cpu(pgp->rspPutInx); 3257 portRspPut = le32_to_cpu(pgp->rspPutInx);
3255 if (portRspPut >= portRspMax) { 3258 if (portRspPut >= portRspMax) {
3256 /* 3259 /*
@@ -3272,7 +3275,7 @@ lpfc_sli_handle_slow_ring_event_s3(struct lpfc_hba *phba,
3272 } 3275 }
3273 3276
3274 rmb(); 3277 rmb();
3275 while (pring->rspidx != portRspPut) { 3278 while (pring->sli.sli3.rspidx != portRspPut) {
3276 /* 3279 /*
3277 * Build a completion list and call the appropriate handler. 3280 * Build a completion list and call the appropriate handler.
3278 * The process is to get the next available response iocb, get 3281 * The process is to get the next available response iocb, get
@@ -3300,8 +3303,8 @@ lpfc_sli_handle_slow_ring_event_s3(struct lpfc_hba *phba,
3300 phba->iocb_rsp_size); 3303 phba->iocb_rsp_size);
3301 irsp = &rspiocbp->iocb; 3304 irsp = &rspiocbp->iocb;
3302 3305
3303 if (++pring->rspidx >= portRspMax) 3306 if (++pring->sli.sli3.rspidx >= portRspMax)
3304 pring->rspidx = 0; 3307 pring->sli.sli3.rspidx = 0;
3305 3308
3306 if (pring->ringno == LPFC_ELS_RING) { 3309 if (pring->ringno == LPFC_ELS_RING) {
3307 lpfc_debugfs_slow_ring_trc(phba, 3310 lpfc_debugfs_slow_ring_trc(phba,
@@ -3311,7 +3314,8 @@ lpfc_sli_handle_slow_ring_event_s3(struct lpfc_hba *phba,
3311 *(((uint32_t *) irsp) + 7)); 3314 *(((uint32_t *) irsp) + 7));
3312 } 3315 }
3313 3316
3314 writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx); 3317 writel(pring->sli.sli3.rspidx,
3318 &phba->host_gp[pring->ringno].rspGetInx);
3315 3319
3316 spin_unlock_irqrestore(&phba->hbalock, iflag); 3320 spin_unlock_irqrestore(&phba->hbalock, iflag);
3317 /* Handle the response IOCB */ 3321 /* Handle the response IOCB */
@@ -3323,10 +3327,10 @@ lpfc_sli_handle_slow_ring_event_s3(struct lpfc_hba *phba,
3323 * the pgp->rspPutInx in the MAILBOX_tand fetch the new port 3327 * the pgp->rspPutInx in the MAILBOX_tand fetch the new port
3324 * response put pointer. 3328 * response put pointer.
3325 */ 3329 */
3326 if (pring->rspidx == portRspPut) { 3330 if (pring->sli.sli3.rspidx == portRspPut) {
3327 portRspPut = le32_to_cpu(pgp->rspPutInx); 3331 portRspPut = le32_to_cpu(pgp->rspPutInx);
3328 } 3332 }
3329 } /* while (pring->rspidx != portRspPut) */ 3333 } /* while (pring->sli.sli3.rspidx != portRspPut) */
3330 3334
3331 if ((rspiocbp != NULL) && (mask & HA_R0RE_REQ)) { 3335 if ((rspiocbp != NULL) && (mask & HA_R0RE_REQ)) {
3332 /* At least one response entry has been freed */ 3336 /* At least one response entry has been freed */
@@ -3341,7 +3345,7 @@ lpfc_sli_handle_slow_ring_event_s3(struct lpfc_hba *phba,
3341 pring->stats.iocb_cmd_empty++; 3345 pring->stats.iocb_cmd_empty++;
3342 3346
3343 /* Force update of the local copy of cmdGetInx */ 3347 /* Force update of the local copy of cmdGetInx */
3344 pring->local_getidx = le32_to_cpu(pgp->cmdGetInx); 3348 pring->sli.sli3.local_getidx = le32_to_cpu(pgp->cmdGetInx);
3345 lpfc_sli_resume_iocb(phba, pring); 3349 lpfc_sli_resume_iocb(phba, pring);
3346 3350
3347 if ((pring->lpfc_sli_cmd_available)) 3351 if ((pring->lpfc_sli_cmd_available))
@@ -3862,10 +3866,10 @@ lpfc_sli_brdreset(struct lpfc_hba *phba)
3862 for (i = 0; i < psli->num_rings; i++) { 3866 for (i = 0; i < psli->num_rings; i++) {
3863 pring = &psli->ring[i]; 3867 pring = &psli->ring[i];
3864 pring->flag = 0; 3868 pring->flag = 0;
3865 pring->rspidx = 0; 3869 pring->sli.sli3.rspidx = 0;
3866 pring->next_cmdidx = 0; 3870 pring->sli.sli3.next_cmdidx = 0;
3867 pring->local_getidx = 0; 3871 pring->sli.sli3.local_getidx = 0;
3868 pring->cmdidx = 0; 3872 pring->sli.sli3.cmdidx = 0;
3869 pring->missbufcnt = 0; 3873 pring->missbufcnt = 0;
3870 } 3874 }
3871 3875
@@ -8404,13 +8408,21 @@ int
8404lpfc_sli_issue_iocb(struct lpfc_hba *phba, uint32_t ring_number, 8408lpfc_sli_issue_iocb(struct lpfc_hba *phba, uint32_t ring_number,
8405 struct lpfc_iocbq *piocb, uint32_t flag) 8409 struct lpfc_iocbq *piocb, uint32_t flag)
8406{ 8410{
8411 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
8407 unsigned long iflags; 8412 unsigned long iflags;
8408 int rc; 8413 int rc;
8409 8414
8410 spin_lock_irqsave(&phba->hbalock, iflags); 8415 if (phba->sli_rev == LPFC_SLI_REV4) {
8411 rc = __lpfc_sli_issue_iocb(phba, ring_number, piocb, flag); 8416 pring = &phba->sli.ring[ring_number];
8412 spin_unlock_irqrestore(&phba->hbalock, iflags); 8417 spin_lock_irqsave(&pring->ring_lock, iflags);
8413 8418 rc = __lpfc_sli_issue_iocb(phba, ring_number, piocb, flag);
8419 spin_unlock_irqrestore(&pring->ring_lock, iflags);
8420 } else {
8421 /* For now, SLI2/3 will still use hbalock */
8422 spin_lock_irqsave(&phba->hbalock, iflags);
8423 rc = __lpfc_sli_issue_iocb(phba, ring_number, piocb, flag);
8424 spin_unlock_irqrestore(&phba->hbalock, iflags);
8425 }
8414 return rc; 8426 return rc;
8415} 8427}
8416 8428
@@ -8437,18 +8449,18 @@ lpfc_extra_ring_setup( struct lpfc_hba *phba)
8437 8449
8438 /* Take some away from the FCP ring */ 8450 /* Take some away from the FCP ring */
8439 pring = &psli->ring[psli->fcp_ring]; 8451 pring = &psli->ring[psli->fcp_ring];
8440 pring->numCiocb -= SLI2_IOCB_CMD_R1XTRA_ENTRIES; 8452 pring->sli.sli3.numCiocb -= SLI2_IOCB_CMD_R1XTRA_ENTRIES;
8441 pring->numRiocb -= SLI2_IOCB_RSP_R1XTRA_ENTRIES; 8453 pring->sli.sli3.numRiocb -= SLI2_IOCB_RSP_R1XTRA_ENTRIES;
8442 pring->numCiocb -= SLI2_IOCB_CMD_R3XTRA_ENTRIES; 8454 pring->sli.sli3.numCiocb -= SLI2_IOCB_CMD_R3XTRA_ENTRIES;
8443 pring->numRiocb -= SLI2_IOCB_RSP_R3XTRA_ENTRIES; 8455 pring->sli.sli3.numRiocb -= SLI2_IOCB_RSP_R3XTRA_ENTRIES;
8444 8456
8445 /* and give them to the extra ring */ 8457 /* and give them to the extra ring */
8446 pring = &psli->ring[psli->extra_ring]; 8458 pring = &psli->ring[psli->extra_ring];
8447 8459
8448 pring->numCiocb += SLI2_IOCB_CMD_R1XTRA_ENTRIES; 8460 pring->sli.sli3.numCiocb += SLI2_IOCB_CMD_R1XTRA_ENTRIES;
8449 pring->numRiocb += SLI2_IOCB_RSP_R1XTRA_ENTRIES; 8461 pring->sli.sli3.numRiocb += SLI2_IOCB_RSP_R1XTRA_ENTRIES;
8450 pring->numCiocb += SLI2_IOCB_CMD_R3XTRA_ENTRIES; 8462 pring->sli.sli3.numCiocb += SLI2_IOCB_CMD_R3XTRA_ENTRIES;
8451 pring->numRiocb += SLI2_IOCB_RSP_R3XTRA_ENTRIES; 8463 pring->sli.sli3.numRiocb += SLI2_IOCB_RSP_R3XTRA_ENTRIES;
8452 8464
8453 /* Setup default profile for this ring */ 8465 /* Setup default profile for this ring */
8454 pring->iotag_max = 4096; 8466 pring->iotag_max = 4096;
@@ -8710,16 +8722,20 @@ lpfc_sli_setup(struct lpfc_hba *phba)
8710 switch (i) { 8722 switch (i) {
8711 case LPFC_FCP_RING: /* ring 0 - FCP */ 8723 case LPFC_FCP_RING: /* ring 0 - FCP */
8712 /* numCiocb and numRiocb are used in config_port */ 8724 /* numCiocb and numRiocb are used in config_port */
8713 pring->numCiocb = SLI2_IOCB_CMD_R0_ENTRIES; 8725 pring->sli.sli3.numCiocb = SLI2_IOCB_CMD_R0_ENTRIES;
8714 pring->numRiocb = SLI2_IOCB_RSP_R0_ENTRIES; 8726 pring->sli.sli3.numRiocb = SLI2_IOCB_RSP_R0_ENTRIES;
8715 pring->numCiocb += SLI2_IOCB_CMD_R1XTRA_ENTRIES; 8727 pring->sli.sli3.numCiocb +=
8716 pring->numRiocb += SLI2_IOCB_RSP_R1XTRA_ENTRIES; 8728 SLI2_IOCB_CMD_R1XTRA_ENTRIES;
8717 pring->numCiocb += SLI2_IOCB_CMD_R3XTRA_ENTRIES; 8729 pring->sli.sli3.numRiocb +=
8718 pring->numRiocb += SLI2_IOCB_RSP_R3XTRA_ENTRIES; 8730 SLI2_IOCB_RSP_R1XTRA_ENTRIES;
8719 pring->sizeCiocb = (phba->sli_rev == 3) ? 8731 pring->sli.sli3.numCiocb +=
8732 SLI2_IOCB_CMD_R3XTRA_ENTRIES;
8733 pring->sli.sli3.numRiocb +=
8734 SLI2_IOCB_RSP_R3XTRA_ENTRIES;
8735 pring->sli.sli3.sizeCiocb = (phba->sli_rev == 3) ?
8720 SLI3_IOCB_CMD_SIZE : 8736 SLI3_IOCB_CMD_SIZE :
8721 SLI2_IOCB_CMD_SIZE; 8737 SLI2_IOCB_CMD_SIZE;
8722 pring->sizeRiocb = (phba->sli_rev == 3) ? 8738 pring->sli.sli3.sizeRiocb = (phba->sli_rev == 3) ?
8723 SLI3_IOCB_RSP_SIZE : 8739 SLI3_IOCB_RSP_SIZE :
8724 SLI2_IOCB_RSP_SIZE; 8740 SLI2_IOCB_RSP_SIZE;
8725 pring->iotag_ctr = 0; 8741 pring->iotag_ctr = 0;
@@ -8730,12 +8746,12 @@ lpfc_sli_setup(struct lpfc_hba *phba)
8730 break; 8746 break;
8731 case LPFC_EXTRA_RING: /* ring 1 - EXTRA */ 8747 case LPFC_EXTRA_RING: /* ring 1 - EXTRA */
8732 /* numCiocb and numRiocb are used in config_port */ 8748 /* numCiocb and numRiocb are used in config_port */
8733 pring->numCiocb = SLI2_IOCB_CMD_R1_ENTRIES; 8749 pring->sli.sli3.numCiocb = SLI2_IOCB_CMD_R1_ENTRIES;
8734 pring->numRiocb = SLI2_IOCB_RSP_R1_ENTRIES; 8750 pring->sli.sli3.numRiocb = SLI2_IOCB_RSP_R1_ENTRIES;
8735 pring->sizeCiocb = (phba->sli_rev == 3) ? 8751 pring->sli.sli3.sizeCiocb = (phba->sli_rev == 3) ?
8736 SLI3_IOCB_CMD_SIZE : 8752 SLI3_IOCB_CMD_SIZE :
8737 SLI2_IOCB_CMD_SIZE; 8753 SLI2_IOCB_CMD_SIZE;
8738 pring->sizeRiocb = (phba->sli_rev == 3) ? 8754 pring->sli.sli3.sizeRiocb = (phba->sli_rev == 3) ?
8739 SLI3_IOCB_RSP_SIZE : 8755 SLI3_IOCB_RSP_SIZE :
8740 SLI2_IOCB_RSP_SIZE; 8756 SLI2_IOCB_RSP_SIZE;
8741 pring->iotag_max = phba->cfg_hba_queue_depth; 8757 pring->iotag_max = phba->cfg_hba_queue_depth;
@@ -8743,12 +8759,12 @@ lpfc_sli_setup(struct lpfc_hba *phba)
8743 break; 8759 break;
8744 case LPFC_ELS_RING: /* ring 2 - ELS / CT */ 8760 case LPFC_ELS_RING: /* ring 2 - ELS / CT */
8745 /* numCiocb and numRiocb are used in config_port */ 8761 /* numCiocb and numRiocb are used in config_port */
8746 pring->numCiocb = SLI2_IOCB_CMD_R2_ENTRIES; 8762 pring->sli.sli3.numCiocb = SLI2_IOCB_CMD_R2_ENTRIES;
8747 pring->numRiocb = SLI2_IOCB_RSP_R2_ENTRIES; 8763 pring->sli.sli3.numRiocb = SLI2_IOCB_RSP_R2_ENTRIES;
8748 pring->sizeCiocb = (phba->sli_rev == 3) ? 8764 pring->sli.sli3.sizeCiocb = (phba->sli_rev == 3) ?
8749 SLI3_IOCB_CMD_SIZE : 8765 SLI3_IOCB_CMD_SIZE :
8750 SLI2_IOCB_CMD_SIZE; 8766 SLI2_IOCB_CMD_SIZE;
8751 pring->sizeRiocb = (phba->sli_rev == 3) ? 8767 pring->sli.sli3.sizeRiocb = (phba->sli_rev == 3) ?
8752 SLI3_IOCB_RSP_SIZE : 8768 SLI3_IOCB_RSP_SIZE :
8753 SLI2_IOCB_RSP_SIZE; 8769 SLI2_IOCB_RSP_SIZE;
8754 pring->fast_iotag = 0; 8770 pring->fast_iotag = 0;
@@ -8789,8 +8805,9 @@ lpfc_sli_setup(struct lpfc_hba *phba)
8789 lpfc_sli4_ct_abort_unsol_event; 8805 lpfc_sli4_ct_abort_unsol_event;
8790 break; 8806 break;
8791 } 8807 }
8792 totiocbsize += (pring->numCiocb * pring->sizeCiocb) + 8808 totiocbsize += (pring->sli.sli3.numCiocb *
8793 (pring->numRiocb * pring->sizeRiocb); 8809 pring->sli.sli3.sizeCiocb) +
8810 (pring->sli.sli3.numRiocb * pring->sli.sli3.sizeRiocb);
8794 } 8811 }
8795 if (totiocbsize > MAX_SLIM_IOCB_SIZE) { 8812 if (totiocbsize > MAX_SLIM_IOCB_SIZE) {
8796 /* Too many cmd / rsp ring entries in SLI2 SLIM */ 8813 /* Too many cmd / rsp ring entries in SLI2 SLIM */
@@ -8831,14 +8848,15 @@ lpfc_sli_queue_setup(struct lpfc_hba *phba)
8831 for (i = 0; i < psli->num_rings; i++) { 8848 for (i = 0; i < psli->num_rings; i++) {
8832 pring = &psli->ring[i]; 8849 pring = &psli->ring[i];
8833 pring->ringno = i; 8850 pring->ringno = i;
8834 pring->next_cmdidx = 0; 8851 pring->sli.sli3.next_cmdidx = 0;
8835 pring->local_getidx = 0; 8852 pring->sli.sli3.local_getidx = 0;
8836 pring->cmdidx = 0; 8853 pring->sli.sli3.cmdidx = 0;
8837 INIT_LIST_HEAD(&pring->txq); 8854 INIT_LIST_HEAD(&pring->txq);
8838 INIT_LIST_HEAD(&pring->txcmplq); 8855 INIT_LIST_HEAD(&pring->txcmplq);
8839 INIT_LIST_HEAD(&pring->iocb_continueq); 8856 INIT_LIST_HEAD(&pring->iocb_continueq);
8840 INIT_LIST_HEAD(&pring->iocb_continue_saveq); 8857 INIT_LIST_HEAD(&pring->iocb_continue_saveq);
8841 INIT_LIST_HEAD(&pring->postbufq); 8858 INIT_LIST_HEAD(&pring->postbufq);
8859 spin_lock_init(&pring->ring_lock);
8842 } 8860 }
8843 spin_unlock_irq(&phba->hbalock); 8861 spin_unlock_irq(&phba->hbalock);
8844 return 1; 8862 return 1;
@@ -9337,6 +9355,7 @@ lpfc_sli_abort_iotag_issue(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
9337 IOCB_t *icmd = NULL; 9355 IOCB_t *icmd = NULL;
9338 IOCB_t *iabt = NULL; 9356 IOCB_t *iabt = NULL;
9339 int retval; 9357 int retval;
9358 unsigned long iflags;
9340 9359
9341 /* 9360 /*
9342 * There are certain command types we don't want to abort. And we 9361 * There are certain command types we don't want to abort. And we
@@ -9389,7 +9408,17 @@ lpfc_sli_abort_iotag_issue(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
9389 iabt->un.acxri.abortIoTag, 9408 iabt->un.acxri.abortIoTag,
9390 iabt->un.acxri.abortContextTag, 9409 iabt->un.acxri.abortContextTag,
9391 abtsiocbp->iotag); 9410 abtsiocbp->iotag);
9392 retval = __lpfc_sli_issue_iocb(phba, pring->ringno, abtsiocbp, 0); 9411
9412 if (phba->sli_rev == LPFC_SLI_REV4) {
9413 /* Note: both hbalock and ring_lock need to be set here */
9414 spin_lock_irqsave(&pring->ring_lock, iflags);
9415 retval = __lpfc_sli_issue_iocb(phba, pring->ringno,
9416 abtsiocbp, 0);
9417 spin_unlock_irqrestore(&pring->ring_lock, iflags);
9418 } else {
9419 retval = __lpfc_sli_issue_iocb(phba, pring->ringno,
9420 abtsiocbp, 0);
9421 }
9393 9422
9394 if (retval) 9423 if (retval)
9395 __lpfc_sli_release_iocbq(phba, abtsiocbp); 9424 __lpfc_sli_release_iocbq(phba, abtsiocbp);
@@ -10950,12 +10979,12 @@ lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *phba,
10950 unsigned long iflags; 10979 unsigned long iflags;
10951 10980
10952 wcqe = &irspiocbq->cq_event.cqe.wcqe_cmpl; 10981 wcqe = &irspiocbq->cq_event.cqe.wcqe_cmpl;
10953 spin_lock_irqsave(&phba->hbalock, iflags); 10982 spin_lock_irqsave(&pring->ring_lock, iflags);
10954 pring->stats.iocb_event++; 10983 pring->stats.iocb_event++;
10955 /* Look up the ELS command IOCB and create pseudo response IOCB */ 10984 /* Look up the ELS command IOCB and create pseudo response IOCB */
10956 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, 10985 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring,
10957 bf_get(lpfc_wcqe_c_request_tag, wcqe)); 10986 bf_get(lpfc_wcqe_c_request_tag, wcqe));
10958 spin_unlock_irqrestore(&phba->hbalock, iflags); 10987 spin_unlock_irqrestore(&pring->ring_lock, iflags);
10959 10988
10960 if (unlikely(!cmdiocbq)) { 10989 if (unlikely(!cmdiocbq)) {
10961 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, 10990 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
@@ -11169,7 +11198,7 @@ lpfc_sli4_sp_handle_els_wcqe(struct lpfc_hba *phba,
11169{ 11198{
11170 struct lpfc_iocbq *irspiocbq; 11199 struct lpfc_iocbq *irspiocbq;
11171 unsigned long iflags; 11200 unsigned long iflags;
11172 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_FCP_RING]; 11201 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
11173 11202
11174 /* Get an irspiocbq for later ELS response processing use */ 11203 /* Get an irspiocbq for later ELS response processing use */
11175 irspiocbq = lpfc_sli_get_iocbq(phba); 11204 irspiocbq = lpfc_sli_get_iocbq(phba);
@@ -11520,10 +11549,6 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba,
11520 struct lpfc_iocbq irspiocbq; 11549 struct lpfc_iocbq irspiocbq;
11521 unsigned long iflags; 11550 unsigned long iflags;
11522 11551
11523 spin_lock_irqsave(&phba->hbalock, iflags);
11524 pring->stats.iocb_event++;
11525 spin_unlock_irqrestore(&phba->hbalock, iflags);
11526
11527 /* Check for response status */ 11552 /* Check for response status */
11528 if (unlikely(bf_get(lpfc_wcqe_c_status, wcqe))) { 11553 if (unlikely(bf_get(lpfc_wcqe_c_status, wcqe))) {
11529 /* If resource errors reported from HBA, reduce queue 11554 /* If resource errors reported from HBA, reduce queue
@@ -11546,10 +11571,11 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba,
11546 } 11571 }
11547 11572
11548 /* Look up the FCP command IOCB and create pseudo response IOCB */ 11573 /* Look up the FCP command IOCB and create pseudo response IOCB */
11549 spin_lock_irqsave(&phba->hbalock, iflags); 11574 spin_lock_irqsave(&pring->ring_lock, iflags);
11575 pring->stats.iocb_event++;
11550 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, 11576 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring,
11551 bf_get(lpfc_wcqe_c_request_tag, wcqe)); 11577 bf_get(lpfc_wcqe_c_request_tag, wcqe));
11552 spin_unlock_irqrestore(&phba->hbalock, iflags); 11578 spin_unlock_irqrestore(&pring->ring_lock, iflags);
11553 if (unlikely(!cmdiocbq)) { 11579 if (unlikely(!cmdiocbq)) {
11554 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, 11580 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
11555 "0374 FCP complete with no corresponding " 11581 "0374 FCP complete with no corresponding "