Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] lpfc 8.1.11 : Fix lpfc_multi_ring_support

It was not accounted for in the fast/slow rings.
Genericize the implementation and control it via sysfs

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by

James Smart and committed by
James Bottomley
a4bc3379 2fb9bd8b

+67 -21
+2
drivers/scsi/lpfc/lpfc.h
··· 296 296 uint32_t cfg_cr_delay; 297 297 uint32_t cfg_cr_count; 298 298 uint32_t cfg_multi_ring_support; 299 + uint32_t cfg_multi_ring_rctl; 300 + uint32_t cfg_multi_ring_type; 299 301 uint32_t cfg_fdmi_on; 300 302 uint32_t cfg_discovery_threads; 301 303 uint32_t cfg_max_luns;
+20 -1
drivers/scsi/lpfc/lpfc_attr.c
··· 802 802 # LOG_MBOX 0x4 Mailbox events 803 803 # LOG_INIT 0x8 Initialization events 804 804 # LOG_LINK_EVENT 0x10 Link events 805 - # LOG_IP 0x20 IP traffic history 806 805 # LOG_FCP 0x40 FCP traffic history 807 806 # LOG_NODE 0x80 Node table events 808 807 # LOG_MISC 0x400 Miscellaneous events ··· 915 916 "SLI rings to spread IOCB entries across"); 916 917 917 918 /* 919 + # lpfc_multi_ring_rctl: If lpfc_multi_ring_support is enabled, this 920 + # identifies what rctl value to configure the additional ring for. 921 + # Value range is [1,0xff]. Default value is 4 (Unsolicated Data). 922 + */ 923 + LPFC_ATTR_R(multi_ring_rctl, FC_UNSOL_DATA, 1, 924 + 255, "Identifies RCTL for additional ring configuration"); 925 + 926 + /* 927 + # lpfc_multi_ring_type: If lpfc_multi_ring_support is enabled, this 928 + # identifies what type value to configure the additional ring for. 929 + # Value range is [1,0xff]. Default value is 5 (LLC/SNAP). 930 + */ 931 + LPFC_ATTR_R(multi_ring_type, FC_LLC_SNAP, 1, 932 + 255, "Identifies TYPE for additional ring configuration"); 933 + 934 + /* 918 935 # lpfc_fdmi_on: controls FDMI support. 919 936 # 0 = no FDMI support 920 937 # 1 = support FDMI without attribute of hostname ··· 989 974 &class_device_attr_lpfc_cr_delay, 990 975 &class_device_attr_lpfc_cr_count, 991 976 &class_device_attr_lpfc_multi_ring_support, 977 + &class_device_attr_lpfc_multi_ring_rctl, 978 + &class_device_attr_lpfc_multi_ring_type, 992 979 &class_device_attr_lpfc_fdmi_on, 993 980 &class_device_attr_lpfc_max_luns, 994 981 &class_device_attr_nport_evt_cnt, ··· 1788 1771 lpfc_cr_delay_init(phba, lpfc_cr_delay); 1789 1772 lpfc_cr_count_init(phba, lpfc_cr_count); 1790 1773 lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); 1774 + lpfc_multi_ring_rctl_init(phba, lpfc_multi_ring_rctl); 1775 + lpfc_multi_ring_type_init(phba, lpfc_multi_ring_type); 1791 1776 lpfc_lun_queue_depth_init(phba, lpfc_lun_queue_depth); 1792 1777 lpfc_fcp_class_init(phba, lpfc_fcp_class); 1793 1778 lpfc_use_adisc_init(phba, lpfc_use_adisc);
+3 -3
drivers/scsi/lpfc/lpfc_els.c
··· 1128 1128 mempool_free(mbox, 1129 1129 phba->mbox_mem_pool); 1130 1130 lpfc_disc_flush_list(phba); 1131 - psli->ring[(psli->ip_ring)]. 1131 + psli->ring[(psli->extra_ring)]. 1132 1132 flag &= 1133 1133 ~LPFC_STOP_IOCB_EVENT; 1134 1134 psli->ring[(psli->fcp_ring)]. ··· 3046 3046 /* FARP-REQ received from DID <did> */ 3047 3047 lpfc_printf_log(phba, 3048 3048 KERN_INFO, 3049 - LOG_IP, 3049 + LOG_ELS, 3050 3050 "%d:0601 FARP-REQ received from DID x%x\n", 3051 3051 phba->brd_no, did); 3052 3052 ··· 3108 3108 /* FARP-RSP received from DID <did> */ 3109 3109 lpfc_printf_log(phba, 3110 3110 KERN_INFO, 3111 - LOG_IP, 3111 + LOG_ELS, 3112 3112 "%d:0600 FARP-RSP received from DID x%x\n", 3113 3113 phba->brd_no, did); 3114 3114
+6 -6
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 525 525 psli = &phba->sli; 526 526 mb = &pmb->mb; 527 527 /* Since we don't do discovery right now, turn these off here */ 528 - psli->ring[psli->ip_ring].flag &= ~LPFC_STOP_IOCB_EVENT; 528 + psli->ring[psli->extra_ring].flag &= ~LPFC_STOP_IOCB_EVENT; 529 529 psli->ring[psli->fcp_ring].flag &= ~LPFC_STOP_IOCB_EVENT; 530 530 psli->ring[psli->next_ring].flag &= ~LPFC_STOP_IOCB_EVENT; 531 531 ··· 641 641 if (rc == MBX_NOT_FINISHED) { 642 642 mempool_free(pmb, phba->mbox_mem_pool); 643 643 lpfc_disc_flush_list(phba); 644 - psli->ring[(psli->ip_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 644 + psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 645 645 psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 646 646 psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 647 647 phba->hba_state = LPFC_HBA_READY; ··· 696 696 == MBX_NOT_FINISHED) { 697 697 mempool_free( pmb, phba->mbox_mem_pool); 698 698 lpfc_disc_flush_list(phba); 699 - psli->ring[(psli->ip_ring)].flag &= 699 + psli->ring[(psli->extra_ring)].flag &= 700 700 ~LPFC_STOP_IOCB_EVENT; 701 701 psli->ring[(psli->fcp_ring)].flag &= 702 702 ~LPFC_STOP_IOCB_EVENT; ··· 1424 1424 if (iocb->context1 == (uint8_t *) ndlp) 1425 1425 return 1; 1426 1426 } 1427 - } else if (pring->ringno == psli->ip_ring) { 1427 + } else if (pring->ringno == psli->extra_ring) { 1428 1428 1429 1429 } else if (pring->ringno == psli->fcp_ring) { 1430 1430 /* Skip match check if waiting to relogin to FCP target */ ··· 1889 1889 if (rc == MBX_NOT_FINISHED) { 1890 1890 mempool_free( mbox, phba->mbox_mem_pool); 1891 1891 lpfc_disc_flush_list(phba); 1892 - psli->ring[(psli->ip_ring)].flag &= 1892 + psli->ring[(psli->extra_ring)].flag &= 1893 1893 ~LPFC_STOP_IOCB_EVENT; 1894 1894 psli->ring[(psli->fcp_ring)].flag &= 1895 1895 ~LPFC_STOP_IOCB_EVENT; ··· 2268 2268 2269 2269 if (clrlaerr) { 2270 2270 lpfc_disc_flush_list(phba); 2271 - psli->ring[(psli->ip_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 2271 + psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 2272 2272 psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 2273 2273 psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 2274 2274 phba->hba_state = LPFC_HBA_READY;
+3 -3
drivers/scsi/lpfc/lpfc_hw.h
··· 42 42 #define FCELSSIZE 1024 /* maximum ELS transfer size */ 43 43 44 44 #define LPFC_FCP_RING 0 /* ring 0 for FCP initiator commands */ 45 - #define LPFC_IP_RING 1 /* ring 1 for IP commands */ 45 + #define LPFC_EXTRA_RING 1 /* ring 1 for other protocols */ 46 46 #define LPFC_ELS_RING 2 /* ring 2 for ELS commands */ 47 47 #define LPFC_FCP_NEXT_RING 3 48 48 49 49 #define SLI2_IOCB_CMD_R0_ENTRIES 172 /* SLI-2 FCP command ring entries */ 50 50 #define SLI2_IOCB_RSP_R0_ENTRIES 134 /* SLI-2 FCP response ring entries */ 51 - #define SLI2_IOCB_CMD_R1_ENTRIES 4 /* SLI-2 IP command ring entries */ 52 - #define SLI2_IOCB_RSP_R1_ENTRIES 4 /* SLI-2 IP response ring entries */ 51 + #define SLI2_IOCB_CMD_R1_ENTRIES 4 /* SLI-2 extra command ring entries */ 52 + #define SLI2_IOCB_RSP_R1_ENTRIES 4 /* SLI-2 extra response ring entries */ 53 53 #define SLI2_IOCB_CMD_R1XTRA_ENTRIES 36 /* SLI-2 extra FCP cmd ring entries */ 54 54 #define SLI2_IOCB_RSP_R1XTRA_ENTRIES 52 /* SLI-2 extra FCP rsp ring entries */ 55 55 #define SLI2_IOCB_CMD_R2_ENTRIES 20 /* SLI-2 ELS command ring entries */
+2 -2
drivers/scsi/lpfc/lpfc_init.c
··· 349 349 phba->hba_state = LPFC_LINK_DOWN; 350 350 351 351 /* Only process IOCBs on ring 0 till hba_state is READY */ 352 - if (psli->ring[psli->ip_ring].cmdringaddr) 353 - psli->ring[psli->ip_ring].flag |= LPFC_STOP_IOCB_EVENT; 352 + if (psli->ring[psli->extra_ring].cmdringaddr) 353 + psli->ring[psli->extra_ring].flag |= LPFC_STOP_IOCB_EVENT; 354 354 if (psli->ring[psli->fcp_ring].cmdringaddr) 355 355 psli->ring[psli->fcp_ring].flag |= LPFC_STOP_IOCB_EVENT; 356 356 if (psli->ring[psli->next_ring].cmdringaddr)
+30 -5
drivers/scsi/lpfc/lpfc_sli.c
··· 1098 1098 lpfc_sli_pcimem_bcopy((uint32_t *) entry, 1099 1099 (uint32_t *) &rspiocbq.iocb, 1100 1100 sizeof (IOCB_t)); 1101 + INIT_LIST_HEAD(&(rspiocbq.list)); 1101 1102 irsp = &rspiocbq.iocb; 1102 1103 1103 1104 type = lpfc_sli_iocb_cmd_type(irsp->ulpCommand & CMD_IOCB_MASK); ··· 1149 1148 iflag); 1150 1149 } 1151 1150 } 1151 + break; 1152 + case LPFC_UNSOL_IOCB: 1153 + spin_unlock_irqrestore(phba->host->host_lock, iflag); 1154 + lpfc_sli_process_unsol_iocb(phba, pring, &rspiocbq); 1155 + spin_lock_irqsave(phba->host->host_lock, iflag); 1152 1156 break; 1153 1157 default: 1154 1158 if (irsp->ulpCommand == CMD_ADAPTER_MSG) { ··· 2478 2472 psli = &phba->sli; 2479 2473 2480 2474 /* Adjust cmd/rsp ring iocb entries more evenly */ 2475 + 2476 + /* Take some away from the FCP ring */ 2481 2477 pring = &psli->ring[psli->fcp_ring]; 2482 2478 pring->numCiocb -= SLI2_IOCB_CMD_R1XTRA_ENTRIES; 2483 2479 pring->numRiocb -= SLI2_IOCB_RSP_R1XTRA_ENTRIES; 2484 2480 pring->numCiocb -= SLI2_IOCB_CMD_R3XTRA_ENTRIES; 2485 2481 pring->numRiocb -= SLI2_IOCB_RSP_R3XTRA_ENTRIES; 2486 2482 2487 - pring = &psli->ring[1]; 2483 + /* and give them to the extra ring */ 2484 + pring = &psli->ring[psli->extra_ring]; 2485 + 2488 2486 pring->numCiocb += SLI2_IOCB_CMD_R1XTRA_ENTRIES; 2489 2487 pring->numRiocb += SLI2_IOCB_RSP_R1XTRA_ENTRIES; 2490 2488 pring->numCiocb += SLI2_IOCB_CMD_R3XTRA_ENTRIES; ··· 2498 2488 pring->iotag_max = 4096; 2499 2489 pring->num_mask = 1; 2500 2490 pring->prt[0].profile = 0; /* Mask 0 */ 2501 - pring->prt[0].rctl = FC_UNSOL_DATA; 2502 - pring->prt[0].type = 5; 2491 + pring->prt[0].rctl = phba->cfg_multi_ring_rctl; 2492 + pring->prt[0].type = phba->cfg_multi_ring_type; 2503 2493 pring->prt[0].lpfc_sli_rcv_unsol_event = NULL; 2504 2494 return 0; 2505 2495 } ··· 2515 2505 psli->sli_flag = 0; 2516 2506 psli->fcp_ring = LPFC_FCP_RING; 2517 2507 psli->next_ring = LPFC_FCP_NEXT_RING; 2518 - psli->ip_ring = LPFC_IP_RING; 2508 + psli->extra_ring = LPFC_EXTRA_RING; 2519 2509 2520 2510 psli->iocbq_lookup = NULL; 2521 2511 psli->iocbq_lookup_len = 0; ··· 2538 2528 pring->fast_iotag = pring->iotag_max; 2539 2529 pring->num_mask = 0; 2540 2530 break; 2541 - case LPFC_IP_RING: /* ring 1 - IP */ 2531 + case LPFC_EXTRA_RING: /* ring 1 - EXTRA */ 2542 2532 /* numCiocb and numRiocb are used in config_port */ 2543 2533 pring->numCiocb = SLI2_IOCB_CMD_R1_ENTRIES; 2544 2534 pring->numRiocb = SLI2_IOCB_RSP_R1_ENTRIES; ··· 3248 3238 lpfc_sli_handle_fast_ring_event(phba, 3249 3239 &phba->sli.ring[LPFC_FCP_RING], 3250 3240 status); 3241 + 3242 + if (phba->cfg_multi_ring_support == 2) { 3243 + /* 3244 + * Process all events on extra ring. Take the optimized path 3245 + * for extra ring IO. Any other IO is slow path and is handled 3246 + * by the worker thread. 3247 + */ 3248 + status = (ha_copy & (HA_RXMASK << (4*LPFC_EXTRA_RING))); 3249 + status >>= (4*LPFC_EXTRA_RING); 3250 + if (status & HA_RXATT) { 3251 + lpfc_sli_handle_fast_ring_event(phba, 3252 + &phba->sli.ring[LPFC_EXTRA_RING], 3253 + status); 3254 + } 3255 + } 3251 3256 return IRQ_HANDLED; 3252 3257 3253 3258 } /* lpfc_intr_handler */
+1 -1
drivers/scsi/lpfc/lpfc_sli.h
··· 198 198 int fcp_ring; /* ring used for FCP initiator commands */ 199 199 int next_ring; 200 200 201 - int ip_ring; /* ring used for IP network drv cmds */ 201 + int extra_ring; /* extra ring used for other protocols */ 202 202 203 203 struct lpfc_sli_stat slistat; /* SLI statistical info */ 204 204 struct list_head mboxq;