lpfc updates for 11.4.0.5
Subsystems (3)
v2 cover lpfc updates for 11.4.0.5
This patch set provides a number of bug fixes and additions to the driver.
The patches were cut against the Martin's 4.15/scsi-queue tree. There are no outside dependencies and are expected to be pulled via Martins tree.
v2:
Rework patch 1 per review
Add signed-by's on other patches
James Smart (17):
lpfc: FLOGI failures are reported when connected to a private loop.
lpfc: Expand WQE capability of every NVME hardware queue
lpfc: Handle XRI_ABORTED_CQE in soft IRQ
lpfc: Fix crash after bad bar setup on driver attachment
lpfc: Fix NVME LS abort_xri
lpfc: Raise maximum NVME sg list size for 256 elements
lpfc: Driver fails to detect direct attach storage array
lpfc: Fix display for debugfs queInfo
lpfc: Adjust default value of lpfc_nvmet_mrq
lpfc: Fix ndlp ref count for pt2pt mode issue RSCN
lpfc: Linux LPFC driver does not process all RSCNs
lpfc: correct port registrations with nvme_fc
lpfc: Correct driver deregistrations with host nvme transport
lpfc: Fix crash during driver unload with running nvme traffic
lpfc: Fix driver handling of nvme resources during unload
lpfc: small sg cnt cleanup
lpfc: update driver version to 11.4.0.5
drivers/scsi/lpfc/lpfc.h | 4 +- drivers/scsi/lpfc/lpfc_attr.c | 13 ++- drivers/scsi/lpfc/lpfc_crtn.h | 2 + drivers/scsi/lpfc/lpfc_ct.c | 19 +++ drivers/scsi/lpfc/lpfc_debugfs.c | 16 +-- drivers/scsi/lpfc/lpfc_disc.h | 2 + drivers/scsi/lpfc/lpfc_els.c | 71 ++++++------ drivers/scsi/lpfc/lpfc_hbadisc.c | 31 +++-- drivers/scsi/lpfc/lpfc_hw4.h | 6 +- drivers/scsi/lpfc/lpfc_init.c | 243 +++++++++++++++++++++++++-------------- drivers/scsi/lpfc/lpfc_nvme.c | 227 +++++++++++++++++++++++++++++++++--- drivers/scsi/lpfc/lpfc_nvme.h | 5 +- drivers/scsi/lpfc/lpfc_nvmet.c | 13 ++- drivers/scsi/lpfc/lpfc_nvmet.h | 4 + drivers/scsi/lpfc/lpfc_sli.c | 169 ++++++++++++++------------- drivers/scsi/lpfc/lpfc_sli4.h | 10 +- drivers/scsi/lpfc/lpfc_version.h | 2 +- 17 files changed, 588 insertions(+), 249 deletions(-)
Signature · 1 line
2.13.1
PATCH v2 1/17 lpfc: FLOGI failures are reported when connected to a private loop.
When the HBA is connected to a private loop, the driver reports FLOGI loop-open failure as functional error. This is an expected condition.
Mark loop-open failure as a warning instead of error.
---
v2:
Reworked printf. v1 printed 2 messages if not a loop open failure. This prints a single message if not a loop open failure. A single message still exists if a loop open failure if warnings enabled.
--- drivers/scsi/lpfc/lpfc_els.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +14 -13
@@ -1030,30 +1030,31 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, stop_rr_fcf_flogi:/* FLOGI failure */ -lpfc_printf_vlog (vport,KERN_ERR ,LOG_ELS , -"2858 FLOGI failure Status:x%x/x%x TMO:x%x " -"Data x%x x%x\n" , - irsp->ulpStatus, irsp->un.ulpWord[4 ], - irsp->ulpTimeout, phba->hba_flag, - phba->fcf.fcf_flag); +if (!(irsp->ulpStatus ==IOSTAT_LOCAL_REJECT && + ((irsp->un.ulpWord[4 ] &IOERR_PARAM_MASK ) == +IOERR_LOOP_OPEN_FAILURE ))) +lpfc_printf_vlog (vport,KERN_ERR ,LOG_ELS , +"2858 FLOGI failure Status:x%x/x%x " +"TMO:x%x Data x%x x%x\n" , + irsp->ulpStatus, irsp->un.ulpWord[4 ], + irsp->ulpTimeout, phba->hba_flag, + phba->fcf.fcf_flag);/* Check for retry */ if (lpfc_els_retry (phba, cmdiocb, rspiocb)) goto out; -/* FLOGI failure */ -lpfc_printf_vlog (vport,KERN_ERR ,LOG_ELS , -"0100 FLOGI failure Status:x%x/x%x TMO:x%x\n" , - irsp->ulpStatus, irsp->un.ulpWord[4 ], - irsp->ulpTimeout); - -/* If this is not a loop open failure, bail out */ if (!(irsp->ulpStatus ==IOSTAT_LOCAL_REJECT && ((irsp->un.ulpWord[4 ] &IOERR_PARAM_MASK ) ==IOERR_LOOP_OPEN_FAILURE ))) goto flogifail; +lpfc_printf_vlog (vport,KERN_WARNING ,LOG_ELS , +"0150 FLOGI failure Status:x%x/x%x TMO:x%x\n" , + irsp->ulpStatus, irsp->un.ulpWord[4 ], + irsp->ulpTimeout); +/* FLOGI failed, so there is no fabric */ spin_lock_irq (shost->host_lock); vport->fc_flag &= ~(FC_FABRIC |FC_PUBLIC_LOOP );
Signature · 1 line
2.13.1
Re: [PATCH v2 01/17] lpfc: FLOGI failures are reported when connected to a private loop.
Quoted 9 lines · James Smart
When the HBA is connected to a private loop, the driver reports FLOGI loop-open failure as functional error. This is an expected condition.
Mark loop-open failure as a warning instead of error.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>
Quoted 9 lines
---
v2:
Reworked printf. v1 printed 2 messages if not a loop open failure. This prints a single message if not a loop open failure. A single message still exists if a loop open failure if warnings enabled.--- drivers/scsi/lpfc/lpfc_els.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH v2 2/17 lpfc: Expand WQE capability of every NVME hardware queue
In reply to James SmartHardware queues are a fast staging area to push commands into the adapter. The adapter should drain them extremely quickly. However, under heavy io load, the host cpu is pushing commands faster than the drain rate of the adapter causing the driver to resource busy commands.
Enlarge the hardware queue (wq & cq) to support a larger number of queue entries (4x the prior size) before backpressure. Enlarging the queue requires larger contiguous buffers (16k) per logical page for the hardware. This changed calling sequences that were expecting 4K page sizes that now must pass a parameter with the page sizes. It also required use of a new version of an adapter command that can vary the page size values.
--- drivers/scsi/lpfc/lpfc_hw4.h | 6 +++- drivers/scsi/lpfc/lpfc_init.c | 67 ++++++++++++++++++++++++++-------------- drivers/scsi/lpfc/lpfc_nvme.h | 3 +- drivers/scsi/lpfc/lpfc_sli.c | 71 +++++++++++++++++++++++++++++++++---------- drivers/scsi/lpfc/lpfc_sli4.h | 8 +++-- 5 files changed, 112 insertions(+), 43 deletions(-)
drivers/scsi/lpfc/lpfc_hw4.h +5 -1
@@ -1122,6 +1122,7 @@ struct cq_context {#define LPFC_CQ_CNT_256 0x0#define LPFC_CQ_CNT_512 0x1#define LPFC_CQ_CNT_1024 0x2 +#define LPFC_CQ_CNT_WORD7 0x3uint32_t word1;#define lpfc_cq_eq_id_SHIFT 22/* Version 0 Only */ #define lpfc_cq_eq_id_MASK 0x000000FF
@@ -1129,7 +1130,7 @@ struct cq_context {#define lpfc_cq_eq_id_2_SHIFT 0/* Version 2 Only */ #define lpfc_cq_eq_id_2_MASK 0x0000FFFF#define lpfc_cq_eq_id_2_WORD word1 -uint32_t reserved0; +uint32_t lpfc_cq_context_count;/* Version 2 Only */ uint32_t reserved1; };
@@ -1193,6 +1194,9 @@ struct lpfc_mbx_cq_create_set {#define lpfc_mbx_cq_create_set_arm_SHIFT 31#define lpfc_mbx_cq_create_set_arm_MASK 0x00000001#define lpfc_mbx_cq_create_set_arm_WORD word2 +#define lpfc_mbx_cq_create_set_cq_cnt_SHIFT 16 +#define lpfc_mbx_cq_create_set_cq_cnt_MASK 0x00007FFF +#define lpfc_mbx_cq_create_set_cq_cnt_WORD word2#define lpfc_mbx_cq_create_set_num_cq_SHIFT 0#define lpfc_mbx_cq_create_set_num_cq_MASK 0x0000FFFF#define lpfc_mbx_cq_create_set_num_cq_WORD word2
drivers/scsi/lpfc/lpfc_init.c +44 -23
200 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nvme.h +2 -1
@@ -22,7 +22,8 @@********************************************************************/ #define LPFC_NVME_DEFAULT_SEGS (64 + 1)/* 256K IOs */ -#define LPFC_NVME_WQSIZE 256 +#define LPFC_NVME_WQSIZE 1024 +#define LPFC_NVME_CQSIZE 4096#define LPFC_NVME_ERSP_LEN 0x20
drivers/scsi/lpfc/lpfc_sli.c +55 -16
178 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli4.h +6 -2
@@ -161,7 +161,6 @@ struct lpfc_queue {#define LPFC_RELEASE_NOTIFICATION_INTERVAL 32/* For WQs */ uint32_t queue_id;/* Queue ID assigned by the hardware */ uint32_t assoc_qid;/* Queue ID associated with, for CQ/WQ/MQ */ -uint32_t page_count;/* Number of pages allocated for this queue */ uint32_t host_index;/* The host's index for putting or getting */ uint32_t hba_index;/* The last known hba index for get or put */
@@ -169,6 +168,11 @@ struct lpfc_queue {struct lpfc_rqb *rqbp;/* ptr to RQ buffers */ uint32_t q_mode; +uint16_t page_count;/* Number of pages allocated for this queue */ +uint16_t page_size;/* size of page allocated for this queue */ +#define LPFC_NVME_PAGE_SIZE 16384 +#define LPFC_DEFAULT_PAGE_SIZE 4096 +uint16_t chann;/* IO channel this queue is associated with */ uint16_t db_format;#define LPFC_DB_RING_FORMAT 0x01#define LPFC_DB_LIST_FORMAT 0x02
@@ -769,7 +773,7 @@ int lpfc_sli4_mbx_read_fcf_rec(struct lpfc_hba *, struct lpfcMboxq *,void lpfc_sli4_hba_reset (struct lpfc_hba *);struct lpfc_queue *lpfc_sli4_queue_alloc (struct lpfc_hba *,uint32_t , -uint32_t ); +uint32_t ,uint32_t );void lpfc_sli4_queue_free (struct lpfc_queue *);int lpfc_eq_create (struct lpfc_hba *,struct lpfc_queue *,uint32_t ); int lpfc_modify_hba_eq_delay(struct lpfc_hba *phba, uint32_t startq,
Signature · 1 line
2.13.1
PATCH v2 3/17 lpfc: Handle XRI_ABORTED_CQE in soft IRQ
In reply to James SmartXRI_ABORTED_CQE completions were not being handled in the fast path. They were being queued and deferred to the lpfc worker thread for processing. This is an artifact of the driver design prior to moving queue processing out of the isr and into a workq element. Now that queue processing is already in a deferred context, remove this artifact and process them directly.
--- drivers/scsi/lpfc/lpfc.h | 1 - drivers/scsi/lpfc/lpfc_hbadisc.c | 2 - drivers/scsi/lpfc/lpfc_init.c | 8 ---- drivers/scsi/lpfc/lpfc_sli.c | 97 +++++++++++++++------------------------- drivers/scsi/lpfc/lpfc_sli4.h | 2 - 5 files changed, 35 insertions(+), 75 deletions(-)
drivers/scsi/lpfc/lpfc.h +0 -1
@@ -705,7 +705,6 @@ struct lpfc_hba {* capability */ #define HBA_NVME_IOQ_FLUSH 0x80000/* NVME IO queues flushed. */ -#define NVME_XRI_ABORT_EVENT 0x100000uint32_t fcp_ring_in_use;/* When polling test if intr-hndlr active*/ struct lpfc_dmabuf slim2p;
drivers/scsi/lpfc/lpfc_hbadisc.c +0 -2
@@ -640,8 +640,6 @@ lpfc_work_done(struct lpfc_hba *phba)lpfc_handle_rrq_active (phba);if (phba->hba_flag &FCP_XRI_ABORT_EVENT )lpfc_sli4_fcp_xri_abort_event_proc (phba); -if (phba->hba_flag &NVME_XRI_ABORT_EVENT ) -lpfc_sli4_nvme_xri_abort_event_proc (phba);if (phba->hba_flag &ELS_XRI_ABORT_EVENT )lpfc_sli4_els_xri_abort_event_proc (phba);if (phba->hba_flag &ASYNC_EVENT )
drivers/scsi/lpfc/lpfc_init.c +0 -8
@@ -5954,9 +5954,6 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)INIT_LIST_HEAD (&phba->sli4_hba.lpfc_abts_nvme_buf_list);INIT_LIST_HEAD (&phba->sli4_hba.lpfc_abts_nvmet_ctx_list);INIT_LIST_HEAD (&phba->sli4_hba.lpfc_nvmet_io_wait_list); - -/* Fast-path XRI aborted CQ Event work queue list */ -INIT_LIST_HEAD (&phba->sli4_hba.sp_nvme_xri_aborted_work_queue); }/* This abort list used by worker thread */
@@ -9199,11 +9196,6 @@ lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba)/* Pending ELS XRI abort events */ list_splice_init (&phba->sli4_hba.sp_els_xri_aborted_work_queue, &cqelist); -if (phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) { -/* Pending NVME XRI abort events */ -list_splice_init (&phba->sli4_hba.sp_nvme_xri_aborted_work_queue, - &cqelist); - }/* Pending asynnc events */ list_splice_init (&phba->sli4_hba.sp_asynce_work_queue, &cqelist);
drivers/scsi/lpfc/lpfc_sli.c +35 -62
142 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli4.h +0 -2
@@ -672,7 +672,6 @@ struct lpfc_sli4_hba {struct list_head sp_asynce_work_queue;struct list_head sp_fcp_xri_aborted_work_queue;struct list_head sp_els_xri_aborted_work_queue; -struct list_head sp_nvme_xri_aborted_work_queue;struct list_head sp_unsol_work_queue;struct lpfc_sli4_link link_state;struct lpfc_sli4_lnk_info lnk_info;
@@ -824,7 +823,6 @@ void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *);int lpfc_sli4_resume_rpi (struct lpfc_nodelist *,void (*)(struct lpfc_hba *,LPFC_MBOXQ_t *),void *);void lpfc_sli4_fcp_xri_abort_event_proc (struct lpfc_hba *); -void lpfc_sli4_nvme_xri_abort_event_proc (struct lpfc_hba *phba);void lpfc_sli4_els_xri_abort_event_proc (struct lpfc_hba *);void lpfc_sli4_fcp_xri_aborted (struct lpfc_hba *,struct sli4_wcqe_xri_aborted *);
Signature · 1 line
2.13.1
PATCH v2 4/17 lpfc: Fix crash after bad bar setup on driver attachment
In reply to James SmartIn test cases where an instance of the driver is detached and reattached, the driver will crash on reattachment. There is a compound if statement that will skip over the bar setup if the pci_resource_start call is not successful. The driver erroneously returns success to its bar setup in this scenario even though the bars aren't properly configured.
Rework the offending code segment for proper initialization steps. If the pci_resource_start call fails, -ENOMEM is now returned.
Sample stack:
rport-5:0-10: blocked FC remote port time out: removing rport
BUG: unable to handle kernel NULL pointer dereference at (null) ... lpfc_sli4_wait_bmbx_ready+0x32/0x70 [lpfc] ... ... RIP: 0010:... ... lpfc_sli4_wait_bmbx_ready+0x32/0x70 [lpfc] Call Trace: ... lpfc_sli4_post_sync_mbox+0x106/0x4d0 [lpfc] ... ? __alloc_pages_nodemask+0x176/0x420 ... ? __kmalloc+0x2e/0x230 ... lpfc_sli_issue_mbox_s4+0x533/0x720 [lpfc] ... ? mempool_alloc+0x69/0x170 ... ? dma_generic_alloc_coherent+0x8f/0x140 ... lpfc_sli_issue_mbox+0xf/0x20 [lpfc] ... lpfc_sli4_driver_resource_setup+0xa6f/0x1130 [lpfc] ... ? lpfc_pci_probe_one+0x23e/0x16f0 [lpfc] ... lpfc_pci_probe_one+0x445/0x16f0 [lpfc] ... local_pci_probe+0x45/0xa0 ... work_for_cpu_fn+0x14/0x20 ... process_one_work+0x17a/0x440
--- drivers/scsi/lpfc/lpfc_init.c | 84 ++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 33 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +51 -33
@@ -9437,44 +9437,62 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)lpfc_sli4_bar0_register_memmap (phba, if_type); } -if ((if_type ==LPFC_SLI_INTF_IF_TYPE_0 ) && - (pci_resource_start (pdev,PCI_64BIT_BAR2 ))) { -/* -* Map SLI4 if type 0 HBA Control Register base to a kernel -* virtual address and setup the registers. -*/ - phba->pci_bar1_map =pci_resource_start (pdev,PCI_64BIT_BAR2 ); - bar1map_len =pci_resource_len (pdev,PCI_64BIT_BAR2 ); - phba->sli4_hba.ctrl_regs_memmap_p = -ioremap (phba->pci_bar1_map, bar1map_len); -if (!phba->sli4_hba.ctrl_regs_memmap_p) { -dev_printk (KERN_ERR , &pdev->dev, -"ioremap failed for SLI4 HBA control registers.\n" ); +if (if_type ==LPFC_SLI_INTF_IF_TYPE_0 ) { +if (pci_resource_start (pdev,PCI_64BIT_BAR2 )) { +/* +* Map SLI4 if type 0 HBA Control Register base to a +* kernel virtual address and setup the registers. +*/ + phba->pci_bar1_map =pci_resource_start (pdev, +PCI_64BIT_BAR2 ); + bar1map_len =pci_resource_len (pdev,PCI_64BIT_BAR2 ); + phba->sli4_hba.ctrl_regs_memmap_p = +ioremap (phba->pci_bar1_map, + bar1map_len); +if (!phba->sli4_hba.ctrl_regs_memmap_p) { +dev_err (&pdev->dev, +"ioremap failed for SLI4 HBA " +"control registers.\n" ); + error = -ENOMEM ; + goto out_iounmap_conf; + } + phba->pci_bar2_memmap_p = + phba->sli4_hba.ctrl_regs_memmap_p; +lpfc_sli4_bar1_register_memmap (phba); + }else { + error = -ENOMEM ; goto out_iounmap_conf; } - phba->pci_bar2_memmap_p = phba->sli4_hba.ctrl_regs_memmap_p; -lpfc_sli4_bar1_register_memmap (phba); } -if ((if_type ==LPFC_SLI_INTF_IF_TYPE_0 ) && - (pci_resource_start (pdev,PCI_64BIT_BAR4 ))) { -/* -* Map SLI4 if type 0 HBA Doorbell Register base to a kernel -* virtual address and setup the registers. -*/ - phba->pci_bar2_map =pci_resource_start (pdev,PCI_64BIT_BAR4 ); - bar2map_len =pci_resource_len (pdev,PCI_64BIT_BAR4 ); - phba->sli4_hba.drbl_regs_memmap_p = -ioremap (phba->pci_bar2_map, bar2map_len); -if (!phba->sli4_hba.drbl_regs_memmap_p) { -dev_printk (KERN_ERR , &pdev->dev, -"ioremap failed for SLI4 HBA doorbell registers.\n" ); - goto out_iounmap_ctrl; - } - phba->pci_bar4_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; - error =lpfc_sli4_bar2_register_memmap (phba,LPFC_VF0 ); -if (error) +if (if_type ==LPFC_SLI_INTF_IF_TYPE_0 ) { +if (pci_resource_start (pdev,PCI_64BIT_BAR4 )) { +/* +* Map SLI4 if type 0 HBA Doorbell Register base to +* a kernel virtual address and setup the registers. +*/ + phba->pci_bar2_map =pci_resource_start (pdev, +PCI_64BIT_BAR4 ); + bar2map_len =pci_resource_len (pdev,PCI_64BIT_BAR4 ); + phba->sli4_hba.drbl_regs_memmap_p = +ioremap (phba->pci_bar2_map, + bar2map_len); +if (!phba->sli4_hba.drbl_regs_memmap_p) { +dev_err (&pdev->dev, +"ioremap failed for SLI4 HBA" +" doorbell registers.\n" ); + error = -ENOMEM ; + goto out_iounmap_ctrl; + } + phba->pci_bar4_memmap_p = + phba->sli4_hba.drbl_regs_memmap_p; + error =lpfc_sli4_bar2_register_memmap (phba,LPFC_VF0 ); +if (error) + goto out_iounmap_all; + }else { + error = -ENOMEM ; goto out_iounmap_all; + } }return 0 ;
Signature · 1 line
2.13.1
PATCH v2 5/17 lpfc: Fix NVME LS abort_xri
In reply to James Smartperforming an LS abort results in the following message being seen:
0603 Invalid CQ subtype 6: 00000300 22000002 ffff0016 d0050000
and the associated exchange is not properly freed.
The code did not recognize the exchange type that was aborted, thus it was not properly handled.
Correct by adding the NVME LS ELS type to the exchange types that are recognized.
--- drivers/scsi/lpfc/lpfc_sli.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/lpfc/lpfc_sli.c +1 -0
@@ -12814,6 +12814,7 @@ lpfc_sli4_sp_handle_abort_xri_wcqe(struct lpfc_hba *phba,spin_unlock_irqrestore (&phba->hbalock, iflags); workposted = true;break ; +case LPFC_NVME_LS :/* NVME LS uses ELS resources */ case LPFC_ELS : cq_event =lpfc_cq_event_setup ( phba, wcqe,sizeof (struct sli4_wcqe_xri_aborted ));
Signature · 1 line
2.13.1
PATCH v2 6/17 lpfc: Raise maximum NVME sg list size for 256 elements
In reply to James SmartRaise the maximum NVME sg list size allowed to 256 elements.
--- drivers/scsi/lpfc/lpfc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc.h +1 -1
@@ -57,7 +57,7 @@ struct lpfc_sli2_slim;#define LPFC_MAX_SG_SEG_CNT 4096/* sg element count per scsi cmnd */ #define LPFC_MAX_SGL_SEG_CNT 512/* SGL element count per scsi cmnd */ #define LPFC_MAX_BPL_SEG_CNT 4096/* BPL element count per scsi cmnd */ -#define LPFC_MAX_NVME_SEG_CNT 128/* max SGL element cnt per NVME cmnd */ +#define LPFC_MAX_NVME_SEG_CNT 256/* max SGL element cnt per NVME cmnd */ #define LPFC_MAX_SGE_SIZE 0x80000000/* Maximum data allowed in a SGE */ #define LPFC_IOCB_LIST_CNT 2250/* list of IOCBs for fast-path usage. */
Signature · 1 line
2.13.1
PATCH v2 7/17 lpfc: Driver fails to detect direct attach storage array
In reply to James SmartThe driver does not respond to PLOGI from the direct attach target. The driver uses incorrect S_ID in CONFIG_LINK, after FLOGI completion
Correct by issuing CONFIG_LINK with the correct S_ID after receiving the PLOGI from the target
--- drivers/scsi/lpfc/lpfc_els.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +20 -16
@@ -858,6 +858,9 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, vport->fc_flag |=FC_PT2PT ;spin_unlock_irq (shost->host_lock); +/* If we are pt2pt with another NPort, force NPIV off! */ + phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED ; +/* If physical FC port changed, unreg VFI and ALL VPIs / RPIs */ if ((phba->sli_rev ==LPFC_SLI_REV4 ) && phba->fc_topology_changed) {lpfc_unregister_fcf_prep (phba);
@@ -916,28 +919,29 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,spin_lock_irq (shost->host_lock); ndlp->nlp_flag |=NLP_NPR_2B_DISC ;spin_unlock_irq (shost->host_lock); - }else + + mbox =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL ); +if (!mbox) + goto fail; + +lpfc_config_link (phba, mbox); + + mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link; + mbox->vport = vport; + rc =lpfc_sli_issue_mbox (phba, mbox,MBX_NOWAIT ); +if (rc ==MBX_NOT_FINISHED ) { +mempool_free (mbox, phba->mbox_mem_pool); + goto fail; + } + }else {/* This side will wait for the PLOGI, decrement ndlp reference * count indicating that ndlp can be released when other * references to it are done. */ lpfc_nlp_put (ndlp); -/* If we are pt2pt with another NPort, force NPIV off! */ - phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED ; - - mbox =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL ); -if (!mbox) - goto fail; - -lpfc_config_link (phba, mbox); - - mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link; - mbox->vport = vport; - rc =lpfc_sli_issue_mbox (phba, mbox,MBX_NOWAIT ); -if (rc ==MBX_NOT_FINISHED ) { -mempool_free (mbox, phba->mbox_mem_pool); - goto fail; +/* Start discovery - this should just do CLEAR_LA */ +lpfc_disc_start (vport); }return 0 ;
Signature · 1 line
2.13.1
PATCH v2 8/17 lpfc: Fix display for debugfs queInfo
In reply to James SmartDisplay for lpfc/fnX/iDiag/queInfo isn't formatted perfectly. Corrected the format strings for the queue info debug messages.
--- drivers/scsi/lpfc/lpfc_debugfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/scsi/lpfc/lpfc_debugfs.c +7 -7
@@ -3248,7 +3248,7 @@ __lpfc_idiag_print_eq(struct lpfc_queue *qp, char *eqtype, len +=snprintf (pbuffer + len,LPFC_QUE_INFO_GET_BUF_SIZE - len,"\n%s EQ info: EQ-STAT[max:x%x noE:x%x " -"bs:x%x proc:x%llx eqd %d]\n" , +"cqe_proc:x%x eqe_proc:x%llx eqd %d]\n" , eqtype, qp->q_cnt_1, qp->q_cnt_2, qp->q_cnt_3, (unsigned long long )qp->q_cnt_4, qp->q_mode); len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
@@ -3368,6 +3368,12 @@ lpfc_idiag_queinfo_read(struct file *file, char __user *buf, size_t nbytes,if (len >= max_cnt) goto too_big; + qp = phba->sli4_hba.hdr_rq; + len =__lpfc_idiag_print_rqpair (qp, phba->sli4_hba.dat_rq, +"ELS RQpair" , pbuffer, len); +if (len >= max_cnt) + goto too_big; +/* Slow-path NVME LS response CQ */ qp = phba->sli4_hba.nvmels_cq; len = __lpfc_idiag_print_cq(qp, "NVME LS",
@@ -3385,12 +3391,6 @@ lpfc_idiag_queinfo_read(struct file *file, char __user *buf, size_t nbytes,if (len >= max_cnt) goto too_big; - qp = phba->sli4_hba.hdr_rq; - len =__lpfc_idiag_print_rqpair (qp, phba->sli4_hba.dat_rq, -"RQpair" , pbuffer, len); -if (len >= max_cnt) - goto too_big; - goto out; }
Signature · 1 line
2.13.1
PATCH v2 9/17 lpfc: Adjust default value of lpfc_nvmet_mrq
In reply to James SmartThe current default for async hw receive queues is 1, which presents issues under heavy load as number of queues influence the available async receive buffer limits.
Raise the default to the either the current hw limit (16) or the number of hw qs configured (io channel value).
Revise the attribute definition for mrq to better reflect what we do for hw queues. E.g. 0 means default to optimal (# of cpus), non-zero specifies a specific limit. Before this change, mrq=0 meant target mode was disabled. As 0 now has a different meaning, rework the if tests to use the better nvmet_support check.
--- drivers/scsi/lpfc/lpfc_attr.c | 11 ++++++++-- drivers/scsi/lpfc/lpfc_debugfs.c | 2 +- drivers/scsi/lpfc/lpfc_init.c | 47 ++++++++++++++++++++++++---------------- drivers/scsi/lpfc/lpfc_nvmet.h | 4 ++++ 4 files changed, 42 insertions(+), 22 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +9 -2
@@ -3361,12 +3361,13 @@ LPFC_ATTR_R(suppress_rsp, 1, 0, 1,/* * lpfc_nvmet_mrq: Specify number of RQ pairs for processing NVMET cmds +* lpfc_nvmet_mrq = 0 driver will calcualte optimal number of RQ pairs * lpfc_nvmet_mrq = 1 use a single RQ pair * lpfc_nvmet_mrq >= 2 use specified RQ pairs for MRQ * */ LPFC_ATTR_R (nvmet_mrq, -1 ,1 ,16 , +LPFC_NVMET_MRQ_AUTO ,LPFC_NVMET_MRQ_AUTO ,LPFC_NVMET_MRQ_MAX ,"Specify number of RQ pairs for processing NVMET cmds" );/*
@@ -6357,6 +6358,9 @@ lpfc_nvme_mod_param_dep(struct lpfc_hba *phba) phba->cfg_nvmet_fb_size =LPFC_NVMET_FB_SZ_MAX ; } +if (!phba->cfg_nvmet_mrq) + phba->cfg_nvmet_mrq = phba->cfg_nvme_io_channel; +/* Adjust lpfc_nvmet_mrq to avoid running out of WQE slots */ if (phba->cfg_nvmet_mrq > phba->cfg_nvme_io_channel) { phba->cfg_nvmet_mrq = phba->cfg_nvme_io_channel;
@@ -6364,10 +6368,13 @@ lpfc_nvme_mod_param_dep(struct lpfc_hba *phba)"6018 Adjust lpfc_nvmet_mrq to %d\n" , phba->cfg_nvmet_mrq); } +if (phba->cfg_nvmet_mrq >LPFC_NVMET_MRQ_MAX ) + phba->cfg_nvmet_mrq =LPFC_NVMET_MRQ_MAX ; + }else {/* Not NVME Target mode. Turn off Target parameters. */ phba->nvmet_support =0 ; - phba->cfg_nvmet_mrq =0 ; + phba->cfg_nvmet_mrq =LPFC_NVMET_MRQ_OFF ; phba->cfg_nvmet_fb_size =0 ; }
drivers/scsi/lpfc/lpfc_debugfs.c +1 -1
@@ -3215,7 +3215,7 @@ lpfc_idiag_cqs_for_eq(struct lpfc_hba *phba, char *pbuffer,return 1 ; } -if (eqidx < phba->cfg_nvmet_mrq) { +if ((eqidx < phba->cfg_nvmet_mrq) && phba->nvmet_support) {/* NVMET CQset */ qp = phba->sli4_hba.nvmet_cqset[eqidx]; *len =__lpfc_idiag_print_cq (qp,"NVMET CQset" , pbuffer, *len);
drivers/scsi/lpfc/lpfc_init.c +28 -19
75 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nvmet.h +4 -0
@@ -25,6 +25,10 @@#define LPFC_NVMET_RQE_DEF_COUNT 512#define LPFC_NVMET_SUCCESS_LEN 12 +#define LPFC_NVMET_MRQ_OFF 0xffff +#define LPFC_NVMET_MRQ_AUTO 0 +#define LPFC_NVMET_MRQ_MAX 16 +/* Used for NVME Target */ struct lpfc_nvmet_tgtport {struct lpfc_hba *phba;
Signature · 1 line
2.13.1
PATCH v2 10/17 lpfc: Fix ndlp ref count for pt2pt mode issue RSCN
In reply to James Smartpt2pt ndlp ref count prematurely goes to 0. There was reference removed that should only be removed if connected to a switch, not if in point-to-point mode.
Add a mode check before the reference remove.
--- drivers/scsi/lpfc/lpfc_els.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +2 -2
@@ -2956,8 +2956,8 @@ lpfc_issue_els_scr(struct lpfc_vport *vport, uint32_t nportid, uint8_t retry)/* This will cause the callback-function lpfc_cmpl_els_cmd to * trigger the release of node. */ - -lpfc_nlp_put (ndlp); +if (!(vport->fc_flag &FC_PT2PT )) +lpfc_nlp_put (ndlp);return 0 ; }
Signature · 1 line
2.13.1
Re: [PATCH v2 10/17] lpfc: Fix ndlp ref count for pt2pt mode issue RSCN
Quoted 18 lines · James Smart
pt2pt ndlp ref count prematurely goes to 0. There was reference removed that should only be removed if connected to a switch, not if in point-to-point mode.
Add a mode check before the reference remove.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_els.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/lpfc/lpfc_els.c +0
-0
drivers/scsi/lpfc/lpfc_els.c lpfc_issue_els_scr(struct lpfc_vport *vport, uint32_t nportid, uint8_t retry) · line 2963
Quoted 10 lines
drivers/scsi/lpfc/lpfc_els.c +2
-2@@ -2956,8 +2956,8 @@ lpfc_issue_els_scr(struct lpfc_vport *vport, uint32_t nportid, uint8_t retry)/* This will cause the callback-function lpfc_cmpl_els_cmd to * trigger the release of node. */ - -lpfc_nlp_put (ndlp); +if (!(vport->fc_flag &FC_PT2PT )) +lpfc_nlp_put (ndlp);return 0 ; }
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH v2 11/17 lpfc: Linux LPFC driver does not process all RSCNs
In reply to James SmartDuring RSCN storms, the driver does not rediscover some targets. The driver marks some RSCN as to be handled after the ones it's working on. The driver missed processing some deferred RSCN.
Move where the driver checks for deferred RSCNs and initiate deferred RSCN handling if the flag was set. Also revise nport state within the RSCN confirm routine. Add some state data to a possible debug print to aid future debugging.
--- drivers/scsi/lpfc/lpfc_ct.c | 19 +++++++++++++++++++ drivers/scsi/lpfc/lpfc_els.c | 4 +--- drivers/scsi/lpfc/lpfc_hbadisc.c | 9 +++++++-- 3 files changed, 27 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +19 -0
@@ -685,6 +685,25 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,lpfc_els_flush_rscn (vport); goto out; } + +spin_lock_irq (shost->host_lock); +if (vport->fc_flag &FC_RSCN_DEFERRED ) { + vport->fc_flag &= ~FC_RSCN_DEFERRED ; +spin_unlock_irq (shost->host_lock); + +/* +* Skip processing the NS response +* Re-issue the NS cmd +*/ +lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS , +"0151 Process Deferred RSCN Data: x%x x%x\n" , + vport->fc_flag, vport->fc_rscn_id_cnt); +lpfc_els_handle_rscn (vport); + + goto out; + } +spin_unlock_irq (shost->host_lock); +if (irsp->ulpStatus) {/* Check for retry */ if (vport->fc_ns_retry <LPFC_MAX_NS_RETRY ) {
drivers/scsi/lpfc/lpfc_els.c +1 -3
@@ -1675,6 +1675,7 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,/* Two ndlps cannot have the same did on the nodelist */ ndlp->nlp_DID = keepDID; +lpfc_nlp_set_state (vport, ndlp, keep_nlp_state);if (phba->sli_rev ==LPFC_SLI_REV4 && active_rrqs_xri_bitmap) memcpy(ndlp->active_rrqs_xri_bitmap,
@@ -6177,9 +6178,6 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,lpfc_els_rsp_acc (vport,ELS_CMD_ACC , cmdiocb, ndlp,NULL );/* send RECOVERY event for ALL nodes that match RSCN payload */ lpfc_rscn_recovery_check (vport); -spin_lock_irq (shost->host_lock); - vport->fc_flag &= ~FC_RSCN_DEFERRED ; -spin_unlock_irq (shost->host_lock);return 0 ; } lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
drivers/scsi/lpfc/lpfc_hbadisc.c +7 -2
@@ -5832,14 +5832,19 @@ static struct lpfc_nodelist * __lpfc_find_node(struct lpfc_vport *vport, node_filter filter, void *param) { struct lpfc_nodelist *ndlp; +uint32_t data1;list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) {if (filter (ndlp, param)) { + data1 = (((uint32_t ) ndlp->nlp_state <<24 ) | + ((uint32_t ) ndlp->nlp_xri <<16 ) | + ((uint32_t ) ndlp->nlp_type <<8 ) | + ((uint32_t ) ndlp->nlp_rpi &0xff ));lpfc_printf_vlog (vport,KERN_INFO ,LOG_NODE ,"3185 FIND node filter %p DID " -"Data: x%p x%x x%x\n" , +"Data: x%p x%x x%x x%x\n" , filter, ndlp, ndlp->nlp_DID, - ndlp->nlp_flag); + ndlp->nlp_flag, data1);return ndlp; } }
Signature · 1 line
2.13.1
Re: [PATCH v2 11/17] lpfc: Linux LPFC driver does not process all RSCNs
Quoted 86 lines · James Smart
During RSCN storms, the driver does not rediscover some targets. The driver marks some RSCN as to be handled after the ones it's working on. The driver missed processing some deferred RSCN.
Move where the driver checks for deferred RSCNs and initiate deferred RSCN handling if the flag was set. Also revise nport state within the RSCN confirm routine. Add some state data to a possible debug print to aid future debugging.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_ct.c | 19 +++++++++++++++++++ drivers/scsi/lpfc/lpfc_els.c | 4 +--- drivers/scsi/lpfc/lpfc_hbadisc.c | 9 +++++++-- 3 files changed, 27 insertions(+), 5 deletions(-)drivers/scsi/lpfc/lpfc_ct.c +19
-0@@ -685,6 +685,25 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,lpfc_els_flush_rscn (vport); goto out; } + +spin_lock_irq (shost->host_lock); +if (vport->fc_flag &FC_RSCN_DEFERRED ) { + vport->fc_flag &= ~FC_RSCN_DEFERRED ; +spin_unlock_irq (shost->host_lock); + +/* +* Skip processing the NS response +* Re-issue the NS cmd +*/ +lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS , +"0151 Process Deferred RSCN Data: x%x x%x\n" , + vport->fc_flag, vport->fc_rscn_id_cnt); +lpfc_els_handle_rscn (vport); + + goto out; + } +spin_unlock_irq (shost->host_lock); +if (irsp->ulpStatus) {/* Check for retry */ if (vport->fc_ns_retry <LPFC_MAX_NS_RETRY ) {drivers/scsi/lpfc/lpfc_els.c +1
-3@@ -1675,6 +1675,7 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,/* Two ndlps cannot have the same did on the nodelist */ ndlp->nlp_DID = keepDID; +lpfc_nlp_set_state (vport, ndlp, keep_nlp_state);if (phba->sli_rev ==LPFC_SLI_REV4 && active_rrqs_xri_bitmap) memcpy(ndlp->active_rrqs_xri_bitmap,@@ -6177,9 +6178,6 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,lpfc_els_rsp_acc (vport,ELS_CMD_ACC , cmdiocb, ndlp,NULL );/* send RECOVERY event for ALL nodes that match RSCN payload */ lpfc_rscn_recovery_check (vport); -spin_lock_irq (shost->host_lock); - vport->fc_flag &= ~FC_RSCN_DEFERRED ; -spin_unlock_irq (shost->host_lock);return 0 ; } lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,drivers/scsi/lpfc/lpfc_hbadisc.c +5
-0@@ -5832,14 +5832,19 @@ static struct lpfc_nodelist * __lpfc_find_node(struct lpfc_vport *vport, node_filter filter, void *param) { struct lpfc_nodelist *ndlp; +uint32_t data1;list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) {if (filter (ndlp, param)) { + data1 = (((uint32_t ) ndlp->nlp_state <<24 ) | + ((uint32_t ) ndlp->nlp_xri <<16 ) | + ((uint32_t ) ndlp->nlp_type <<8 ) | + ((uint32_t ) ndlp->nlp_rpi &0xff ));
drivers/scsi/lpfc/lpfc_hbadisc.c static struct lpfc_nodelist * · line 5850
Quoted 10 lines
drivers/scsi/lpfc/lpfc_hbadisc.c +2
-2lpfc_printf_vlog (vport,KERN_INFO ,LOG_NODE ,"3185 FIND node filter %p DID " -"Data: x%p x%x x%x\n" , +"Data: x%p x%x x%x x%x\n" , filter, ndlp, ndlp->nlp_DID, - ndlp->nlp_flag); + ndlp->nlp_flag, data1);return ndlp; } }
Where _is_ the point of that?
Please use individual entries for the variables, and don't shift them atop some random variable just so save some coding.
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH v2 12/17 lpfc: correct port registrations with nvme_fc
In reply to James SmartThe driver currently registers any remote port that has NVME support. It should only be registering target ports.
Register only target ports.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 20 ++++++++++++-------- drivers/scsi/lpfc/lpfc_nvme.c | 3 ++- 2 files changed, 14 insertions(+), 9 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +12 -8
@@ -4176,12 +4176,14 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,if (ndlp->nlp_fc4_type &NLP_FC4_NVME ) { vport->phba->nport_event_cnt++; -if (vport->phba->nvmet_support ==0 ) -/* Start devloss */ -lpfc_nvme_unregister_port (vport, ndlp); -else +if (vport->phba->nvmet_support ==0 ) { +/* Start devloss if target. */ +if (ndlp->nlp_type &NLP_NVME_TARGET ) +lpfc_nvme_unregister_port (vport, ndlp); + }else {/* NVMET has no upcall. */ lpfc_nlp_put (ndlp); + } } }
@@ -4205,11 +4207,13 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, ndlp->nlp_fc4_type & NLP_FC4_NVME) {if (vport->phba->nvmet_support ==0 ) {/* Register this rport with the transport. -* Initiators take the NDLP ref count in -* the register. +* Only NVME Target Rports are registered with +* the transport. */ - vport->phba->nport_event_cnt++; -lpfc_nvme_register_port (vport, ndlp); +if (ndlp->nlp_type &NLP_NVME_TARGET ) { + vport->phba->nport_event_cnt++; +lpfc_nvme_register_port (vport, ndlp); + } }else {/* Just take an NDLP ref count since the * target does not register rports.
drivers/scsi/lpfc/lpfc_nvme.c +2 -1
@@ -2473,7 +2473,8 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)/* Sanity check ndlp type. Only call for NVME ports. Don't * clear any rport state until the transport calls back. */ -if (ndlp->nlp_type & (NLP_NVME_TARGET |NLP_NVME_INITIATOR )) { + +if (ndlp->nlp_type &NLP_NVME_TARGET ) {init_completion (&rport->rport_unreg_done);/* No concern about the role change on the nvme remoteport.
Signature · 1 line
2.13.1
Re: [PATCH v2 12/17] lpfc: correct port registrations with nvme_fc
Quoted 12 lines · James Smart
The driver currently registers any remote port that has NVME support. It should only be registering target ports.
Register only target ports.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_hbadisc.c | 20 ++++++++++++-------- drivers/scsi/lpfc/lpfc_nvme.c | 3 ++- 2 files changed, 14 insertions(+), 9 deletions(-)
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH v2 13/17 lpfc: Correct driver deregistrations with host nvme transport
In reply to James SmartThe driver's interaction with the host nvme transport has been incorrect for a while. The driver did not wait for the unregister callbacks (waited only 5 jiffies). Thus the driver may remove objects that may be referenced by subsequent abort commands from the transport, and the actual unregister callback was effectively a noop. This was especially problematic if the driver was unloaded.
The driver now waits for the unregister callbacks, as it should, before continuing with teardown.
--- drivers/scsi/lpfc/lpfc_disc.h | 2 + drivers/scsi/lpfc/lpfc_nvme.c | 113 ++++++++++++++++++++++++++++++++++++++++-- drivers/scsi/lpfc/lpfc_nvme.h | 2 + 3 files changed, 113 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_disc.h +2 -0
@@ -134,6 +134,8 @@ struct lpfc_nodelist {struct lpfc_scsicmd_bkt *lat_data;/* Latency data */ uint32_t fc4_prli_sent;uint32_t upcall_flags; +#define NLP_WAIT_FOR_UNREG 0x1 +uint32_t nvme_fb_size;/* NVME target's supported byte cnt */ #define NVME_FB_BIT_SHIFT 9/* PRLI Rsp first burst in 512B units. */ };
drivers/scsi/lpfc/lpfc_nvme.c +109 -4
158 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nvme.h +2 -0
@@ -27,6 +27,8 @@#define LPFC_NVME_ERSP_LEN 0x20 +#define LPFC_NVME_WAIT_TMO 10 +struct lpfc_nvme_qhandle {uint32_t index;/* WQ index to use */ uint32_t qidx;/* queue index passed to create */
Signature · 1 line
2.13.1
Re: [PATCH v2 13/17] lpfc: Correct driver deregistrations with host nvme transport
Quoted 189 lines · James Smart
The driver's interaction with the host nvme transport has been incorrect for a while. The driver did not wait for the unregister callbacks (waited only 5 jiffies). Thus the driver may remove objects that may be referenced by subsequent abort commands from the transport, and the actual unregister callback was effectively a noop. This was especially problematic if the driver was unloaded.
The driver now waits for the unregister callbacks, as it should, before continuing with teardown.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_disc.h | 2 + drivers/scsi/lpfc/lpfc_nvme.c | 113 ++++++++++++++++++++++++++++++++++++++++-- drivers/scsi/lpfc/lpfc_nvme.h | 2 + 3 files changed, 113 insertions(+), 4 deletions(-)drivers/scsi/lpfc/lpfc_disc.h +2
-0@@ -134,6 +134,8 @@ struct lpfc_nodelist {struct lpfc_scsicmd_bkt *lat_data;/* Latency data */ uint32_t fc4_prli_sent;uint32_t upcall_flags; +#define NLP_WAIT_FOR_UNREG 0x1 +uint32_t nvme_fb_size;/* NVME target's supported byte cnt */ #define NVME_FB_BIT_SHIFT 9/* PRLI Rsp first burst in 512B units. */ };drivers/scsi/lpfc/lpfc_nvme.c +104
-3@@ -154,6 +154,10 @@ lpfc_nvme_localport_delete(struct nvme_fc_local_port *localport) {struct lpfc_nvme_lport *lport = localport->private; +lpfc_printf_vlog (lport->vport,KERN_INFO ,LOG_NVME , +"6173 localport %p delete complete\n" , + lport); +/* release any threads waiting for the unreg to complete */ complete (&lport->lport_unreg_done); }@@ -946,10 +950,19 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, freqpriv->nvme_buf =NULL ;/* NVME targets need completion held off until the abort exchange -* completes. +* completes unless the NVME Rport is getting unregistered. */ -if (!(lpfc_ncmd->flags &LPFC_SBUF_XBUSY )) +if (!(lpfc_ncmd->flags &LPFC_SBUF_XBUSY ) || + ndlp->upcall_flags &NLP_WAIT_FOR_UNREG ) { +/* Clear the XBUSY flag to prevent double completions. +* The nvme rport is getting unregistered and there is +* no need to defer the IO. +*/ +if (lpfc_ncmd->flags &LPFC_SBUF_XBUSY ) + lpfc_ncmd->flags &= ~LPFC_SBUF_XBUSY ; + nCmd->done (nCmd); + }spin_lock_irqsave (&phba->hbalock, flags); lpfc_ncmd->nrport =NULL ;@@ -2234,6 +2247,47 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport)return ret; } +/* lpfc_nvme_lport_unreg_wait - Wait for the host to complete an lport unreg. +* +* The driver has to wait for the host nvme transport to callback +* indicating the localport has successfully unregistered all +* resources. Since this is an uninterruptible wait, loop every ten +* seconds and print a message indicating no progress. +* +* An uninterruptible wait is used because of the risk of transport-to- +* driver state mismatch. +*/ +void +lpfc_nvme_lport_unreg_wait (struct lpfc_vport *vport, +struct lpfc_nvme_lport *lport) +{ +#if (IS_ENABLED (CONFIG_NVME_FC )) +u32 wait_tmo; +int ret; + +/* Host transport has to clean up and confirm requiring an indefinite +* wait. Print a message if a 10 second wait expires and renew the +* wait. This is unexpected. +*/ + wait_tmo =msecs_to_jiffies (LPFC_NVME_WAIT_TMO *1000 ); +while (true) { + ret =wait_for_completion_timeout (&lport->lport_unreg_done, + wait_tmo); +if (unlikely (!ret)) { +lpfc_printf_vlog (vport,KERN_ERR ,LOG_NVME_IOERR , +"6176 Lport %p Localport %p wait " +"timed out. Renewing.\n" , + lport, vport->localport); +continue ; + } +break ; + } +lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME_IOERR , +"6177 Lport %p Localport %p Complete Success\n" , + lport, vport->localport); +#endif +} +/** * lpfc_nvme_destroy_localport - Destroy lpfc_nvme bound to nvme transport. * @pnvme: pointer to lpfc nvme data structure. @@ -2268,7 +2322,11 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport)*/ init_completion (&lport->lport_unreg_done); ret =nvme_fc_unregister_localport (localport); -wait_for_completion_timeout (&lport->lport_unreg_done,5 ); + +/* Wait for completion. This either blocks +* indefinitely or succeeds +*/ +lpfc_nvme_lport_unreg_wait (vport, lport);/* Regardless of the unregister upcall response, clear * nvmei_support. All rports are unregistered and the @@ -2424,6 +2482,47 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)#endif } +/* lpfc_nvme_rport_unreg_wait - Wait for the host to complete an rport unreg. +* +* The driver has to wait for the host nvme transport to callback +* indicating the remoteport has successfully unregistered all +* resources. Since this is an uninterruptible wait, loop every ten +* seconds and print a message indicating no progress. +* +* An uninterruptible wait is used because of the risk of transport-to- +* driver state mismatch. +*/ +void +lpfc_nvme_rport_unreg_wait (struct lpfc_vport *vport, +struct lpfc_nvme_rport *rport) +{ +#if (IS_ENABLED (CONFIG_NVME_FC )) +u32 wait_tmo; +int ret; + +/* Host transport has to clean up and confirm requiring an indefinite +* wait. Print a message if a 10 second wait expires and renew the +* wait. This is unexpected. +*/ + wait_tmo =msecs_to_jiffies (LPFC_NVME_WAIT_TMO *1000 ); +while (true) { + ret =wait_for_completion_timeout (&rport->rport_unreg_done, + wait_tmo); +if (unlikely (!ret)) { +lpfc_printf_vlog (vport,KERN_ERR ,LOG_NVME_IOERR , +"6174 Rport %p Remoteport %p wait " +"timed out. Renewing.\n" , + rport, rport->remoteport); +continue ; + } +break ; + } +lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME_IOERR , +"6175 Rport %p Remoteport %p Complete Success\n" , + rport, rport->remoteport); +#endif +} +/* lpfc_nvme_unregister_port - unbind the DID and port_role from this rport. * * There is no notion of Devloss or rport recovery from the current @@ -2480,14 +2579,20 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)/* No concern about the role change on the nvme remoteport. * The transport will update it. */ + ndlp->upcall_flags |=NLP_WAIT_FOR_UNREG ; ret =nvme_fc_unregister_remoteport (remoteport);if (ret !=0 ) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_NVME_DISC ,"6167 NVME unregister failed %d " "port_state x%x\n" , ret, remoteport->port_state); + }else {
drivers/scsi/lpfc/lpfc_nvme.c lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · line 2598
Quoted 10 lines
drivers/scsi/lpfc/lpfc_nvme.c +5
-1+/* Wait for completion. This either blocks +* indefinitely or succeeds +*/ +lpfc_nvme_rport_unreg_wait (vport, rport); + ndlp->upcall_flags &= ~NLP_WAIT_FOR_UNREG ; } - }return ;
Shouldn't the flag be reset in the failure case, too?
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH v2 14/17 lpfc: Fix crash during driver unload with running nvme traffic
In reply to James SmartWhen the driver is unloading, the nvme transport could be in the process of submitting new requests, will send abort requests to terminate associations, or may make LS-related requests. The driver's abort and request entry points currently is ignorant of the unloading state and is starting the requests even though the infrastructure to complete them continues to teardown.
Change the entry points for new requests to check whether unloading and if so, reject the requests. Abort routines check unloading, and if so, noop the request. An abort is noop'd as the teardown paths are already aborting/terminating the io outstanding at the time the teardown initiated.
--- drivers/scsi/lpfc/lpfc_nvme.c | 14 ++++++++++++++ drivers/scsi/lpfc/lpfc_nvmet.c | 11 +++++++++++ 2 files changed, 25 insertions(+)
drivers/scsi/lpfc/lpfc_nvme.c +14 -0
@@ -423,6 +423,9 @@ lpfc_nvme_ls_req(struct nvme_fc_local_port *pnvme_lport,if (vport->load_flag &FC_UNLOADING )return -ENODEV ; +if (vport->load_flag &FC_UNLOADING ) +return -ENODEV ; + ndlp =lpfc_findnode_did (vport, pnvme_rport->port_id);if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) { lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE | LOG_NVME_IOERR,
@@ -538,6 +541,9 @@ lpfc_nvme_ls_abort(struct nvme_fc_local_port *pnvme_lport, vport = lport->vport; phba = vport->phba; +if (vport->load_flag &FC_UNLOADING ) +return ; + ndlp =lpfc_findnode_did (vport, pnvme_rport->port_id);if (!ndlp) { lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_ABTS,
@@ -1273,6 +1279,11 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport, goto out_fail; } +if (vport->load_flag &FC_UNLOADING ) { + ret = -ENODEV ; + goto out_fail; + } +/* Validate pointers. */ if (!pnvme_lport || !pnvme_rport || !freqpriv) { lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR | LOG_NODE,
@@ -1500,6 +1511,9 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport, vport = lport->vport; phba = vport->phba; +if (vport->load_flag &FC_UNLOADING ) +return ; +/* Announce entry to new IO submit field. */ lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME_ABTS , "6002 Abort Request to rport DID x%06x "
drivers/scsi/lpfc/lpfc_nvmet.c +11 -0
@@ -635,6 +635,9 @@ lpfc_nvmet_xmt_ls_rsp(struct nvmet_fc_target_port *tgtport,if (phba->pport->load_flag &FC_UNLOADING )return -ENODEV ; +if (phba->pport->load_flag &FC_UNLOADING ) +return -ENODEV ; +lpfc_printf_log (phba,KERN_INFO ,LOG_NVME_DISC ,"6023 NVMET LS rsp oxid x%x\n" , ctxp->oxid);
@@ -721,6 +724,11 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *tgtport, goto aerr; } +if (phba->pport->load_flag &FC_UNLOADING ) { + rc = -ENODEV ; + goto aerr; + } +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS if (ctxp->ts_cmd_nvme) {if (rsp->op ==NVMET_FCOP_RSP )
@@ -823,6 +831,9 @@ lpfc_nvmet_xmt_fcp_abort(struct nvmet_fc_target_port *tgtport,if (phba->pport->load_flag &FC_UNLOADING )return ; +if (phba->pport->load_flag &FC_UNLOADING ) +return ; +lpfc_printf_log (phba,KERN_INFO ,LOG_NVME_ABTS ,"6103 NVMET Abort op: oxri x%x flg x%x ste %d\n" , ctxp->oxid, ctxp->flag, ctxp->state);
Signature · 1 line
2.13.1
Re: [PATCH v2 14/17] lpfc: Fix crash during driver unload with running nvme traffic
Quoted 13 lines · James Smart
When the driver is unloading, the nvme transport could be in the process of submitting new requests, will send abort requests to terminate associations, or may make LS-related requests. The driver's abort and request entry points currently is ignorant of the unloading state and is starting the requests even though the infrastructure to complete them continues to teardown.
Change the entry points for new requests to check whether unloading and if so, reject the requests. Abort routines check unloading, and if so, noop the request. An abort is noop'd as the teardown paths are already aborting/terminating the io outstanding at the time the teardown initiated.
Quoted 7 lines
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_nvme.c | 14 ++++++++++++++ drivers/scsi/lpfc/lpfc_nvmet.c | 11 +++++++++++ 2 files changed, 25 insertions(+)
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH v2 15/17 lpfc: Fix driver handling of nvme resources during unload
In reply to James SmartDuring driver unload, the driver may crash due to NULL pointers. The NULL pointers were due to the driver not protecting itself sufficiently during some of the teardown paths. Additionally, the driver was not waiting for and cleanup up nvme io resources. As such, the driver wasn't making the callbacks to the transport, stalling the transports association teardown.
This patch waits for io clean up before tearding down and adds checks for possible NULL pointers.
--- drivers/scsi/lpfc/lpfc_crtn.h | 2 + drivers/scsi/lpfc/lpfc_init.c | 18 ++++++++ drivers/scsi/lpfc/lpfc_nvme.c | 96 ++++++++++++++++++++++++++++++++++++++----- 3 files changed, 105 insertions(+), 11 deletions(-)
drivers/scsi/lpfc/lpfc_crtn.h +2 -0
@@ -254,6 +254,8 @@ void lpfc_nvmet_ctxbuf_post(struct lpfc_hba *phba, struct lpfc_nvmet_ctxbuf *ctxp);int lpfc_nvmet_rcv_unsol_abort (struct lpfc_vport *vport,struct fc_frame_header *fc_hdr); +void lpfc_sli_flush_nvme_rings (struct lpfc_hba *phba); +void lpfc_nvme_wait_for_io_drain (struct lpfc_hba *phba);void lpfc_sli4_build_dflt_fcf_record (struct lpfc_hba *,struct fcf_record *,uint16_t ); int lpfc_sli4_rq_put(struct lpfc_queue *hq, struct lpfc_queue *dq,
drivers/scsi/lpfc/lpfc_init.c +18 -0
@@ -10136,6 +10136,16 @@ lpfc_sli4_xri_exchange_busy_wait(struct lpfc_hba *phba)int fcp_xri_cmpl =1 ;int els_xri_cmpl =list_empty (&phba->sli4_hba.lpfc_abts_els_sgl_list); +/* Driver just aborted IOs during the hba_unset process. Pause +* here to give the HBA time to complete the IO and get entries +* into the abts lists. +*/ +msleep (LPFC_XRI_EXCH_BUSY_WAIT_T1 *5 ); + +/* Wait for NVME pending IO to flush back to transport. */ +if (phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) +lpfc_nvme_wait_for_io_drain (phba); +if (phba->cfg_enable_fc4_type &LPFC_ENABLE_FCP ) fcp_xri_cmpl =list_empty (&phba->sli4_hba.lpfc_abts_scsi_buf_list);
@@ -11659,6 +11669,10 @@ lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba)/* Flush all driver's outstanding SCSI I/Os as we are to reset */ lpfc_sli_flush_fcp_rings (phba); +/* Flush the outstanding NVME IOs if fc4 type enabled. */ +if (phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) +lpfc_sli_flush_nvme_rings (phba); +/* stop all timers */ lpfc_stop_hba_timers (phba);
@@ -11690,6 +11704,10 @@ lpfc_sli4_prep_dev_for_perm_failure(struct lpfc_hba *phba)/* Clean up all driver's outstanding SCSI I/Os */ lpfc_sli_flush_fcp_rings (phba); + +/* Flush the outstanding NVME IOs if fc4 type enabled. */ +if (phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) +lpfc_sli_flush_nvme_rings (phba); }/**
drivers/scsi/lpfc/lpfc_nvme.c +85 -11
146 lines not on this page · raw message
Signature · 1 line
2.13.1
Re: [PATCH v2 15/17] lpfc: Fix driver handling of nvme resources during unload
Quoted 10 lines · James Smart
During driver unload, the driver may crash due to NULL pointers. The NULL pointers were due to the driver not protecting itself sufficiently during some of the teardown paths. Additionally, the driver was not waiting for and cleanup up nvme io resources. As such, the driver wasn't making the callbacks to the transport, stalling the transports association teardown.
This patch waits for io clean up before tearding down and adds checks for possible NULL pointers.
Quoted 9 lines
Cc <[email protected]> # 4.12+Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_crtn.h | 2 + drivers/scsi/lpfc/lpfc_init.c | 18 ++++++++ drivers/scsi/lpfc/lpfc_nvme.c | 96 ++++++++++++++++++++++++++++++++++++++----- 3 files changed, 105 insertions(+), 11 deletions(-)
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH v2 16/17 lpfc: small sg cnt cleanup
In reply to James SmartThe logic for sg_seg_cnt is a bit convoluted. This patch tries to clean up a couple of areas, especially around the +2 and +1 logic.
This patch:
- cleans up the lpfc_sg_seg_cnt attribute to specify a real minimum rather than making the minimum be whatever the default is.
- Remove the hardcoding of +2 (for the number of elements we use in a sgl for cmd iu and rsp iu) and +1 (an additional entry to compensate for nvme's reduction of io size based on a possible partial page) logic in sg list initialization. In the case where the +1 logic is referenced in host and target io checks, use the values set in the transport template as that value was properly set.
There can certainly be more done in this area and it will be addressed in combined host/target driver effort.
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_attr.c | 2 +- drivers/scsi/lpfc/lpfc_init.c | 19 ++++++++++++++----- drivers/scsi/lpfc/lpfc_nvme.c | 3 ++- drivers/scsi/lpfc/lpfc_nvmet.c | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -0
@@ -55,6 +55,7 @@ struct lpfc_sli2_slim;#define LPFC_MAX_SG_SLI4_SEG_CNT_DIF 128/* sg element count per scsi cmnd */ #define LPFC_MAX_SG_SEG_CNT_DIF 512/* sg element count per scsi cmnd */ #define LPFC_MAX_SG_SEG_CNT 4096/* sg element count per scsi cmnd */ +#define LPFC_MIN_SG_SEG_CNT 32/* sg element count per scsi cmnd */ #define LPFC_MAX_SGL_SEG_CNT 512/* SGL element count per scsi cmnd */ #define LPFC_MAX_BPL_SEG_CNT 4096/* BPL element count per scsi cmnd */ #define LPFC_MAX_NVME_SEG_CNT 256/* max SGL element cnt per NVME cmnd */
drivers/scsi/lpfc/lpfc_attr.c +1 -1
@@ -5135,7 +5135,7 @@ LPFC_ATTR(delay_discovery, 0, 0, 1,* this parameter will be limited to 128 if BlockGuard is enabled under SLI4 * and will be limited to 512 if BlockGuard is enabled under SLI3. */ -LPFC_ATTR_R (sg_seg_cnt,LPFC_DEFAULT_SG_SEG_CNT ,LPFC_DEFAULT_SG_SEG_CNT , +LPFC_ATTR_R (sg_seg_cnt,LPFC_MIN_SG_SEG_CNT ,LPFC_DEFAULT_SG_SEG_CNT ,LPFC_MAX_SG_SEG_CNT ,"Max Scatter Gather Segment Count" );/*
drivers/scsi/lpfc/lpfc_init.c +14 -5
@@ -5812,6 +5812,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)struct lpfc_mqe *mqe;int longs;int fof_vectors =0 ; +int extra;uint64_t wwn; phba->sli4_hba.num_online_cpu =num_online_cpus ();
@@ -5867,13 +5868,21 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)*/ /* +* 1 for cmd, 1 for rsp, NVME adds an extra one +* for boundary conditions in its max_sgl_segment template. +*/ + extra =2 ; +if (phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) + extra++; + +/* * It doesn't matter what family our adapter is in, we are * limited to 2 Pages, 512 SGEs, for our SGL. * There are going to be 2 reserved SGEs: 1 FCP cmnd + 1 FCP rsp */ max_buf_size = (2 *SLI4_PAGE_SIZE ); -if (phba->cfg_sg_seg_cnt >LPFC_MAX_SGL_SEG_CNT -2 ) - phba->cfg_sg_seg_cnt =LPFC_MAX_SGL_SEG_CNT -2 ; +if (phba->cfg_sg_seg_cnt >LPFC_MAX_SGL_SEG_CNT - extra) + phba->cfg_sg_seg_cnt =LPFC_MAX_SGL_SEG_CNT - extra;/* * Since lpfc_sg_seg_cnt is module param, the sg_dma_buf_size
@@ -5906,14 +5915,14 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)*/ phba->cfg_sg_dma_buf_size =sizeof (struct fcp_cmnd ) +sizeof (struct fcp_rsp ) + - ((phba->cfg_sg_seg_cnt +2 ) * + ((phba->cfg_sg_seg_cnt + extra) *sizeof (struct sli4_sge ));/* Total SGEs for scsi_sg_list */ - phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt +2 ; + phba->cfg_total_seg_cnt = phba->cfg_sg_seg_cnt + extra;/* -* NOTE: if (phba->cfg_sg_seg_cnt + 2) <= 256 we only +* NOTE: if (phba->cfg_sg_seg_cnt + extra) <= 256 we only * need to post 1 page for the SGL. */ }
drivers/scsi/lpfc/lpfc_nvme.c +2 -1
@@ -62,6 +62,7 @@ lpfc_get_nvme_buf(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp);static void lpfc_release_nvme_buf (struct lpfc_hba *,struct lpfc_nvme_buf *); +static struct nvme_fc_port_template lpfc_nvme_template;/** * lpfc_nvme_create_queue -
@@ -1174,7 +1175,7 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport, first_data_sgl = sgl; lpfc_ncmd->seg_cnt = nCmd->sg_cnt; -if (lpfc_ncmd->seg_cnt > phba->cfg_nvme_seg_cnt +1 ) { +if (lpfc_ncmd->seg_cnt > lpfc_nvme_template.max_sgl_segments) {lpfc_printf_log (phba,KERN_ERR ,LOG_NVME_IOERR ,"6058 Too many sg segments from " "NVME Transport. Max %d, "
drivers/scsi/lpfc/lpfc_nvmet.c +1 -1
@@ -2003,7 +2003,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,return NULL ; } -if (rsp->sg_cnt > phba->cfg_nvme_seg_cnt) { +if (rsp->sg_cnt > lpfc_tgttemplate.max_sgl_segments) { lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR, "6109 NVMET prep FCP wqe: seg cnt err: " "NPORT x%x oxid x%x ste %d cnt %d\n",
Signature · 1 line
2.13.1
Re: [PATCH v2 16/17] lpfc: small sg cnt cleanup
Quoted 18 lines · James Smart
The logic for
sg_seg_cntis a bit convoluted. This patch tries to clean up a couple of areas, especially around the +2 and +1 logic.This patch:
- cleans up thelpfc_sg_seg_cntattribute to specify a real minimum rather than making the minimum be whatever the default is.
- Remove the hardcoding of +2 (for the number of elements we use in a sgl for cmd iu and rsp iu) and +1 (an additional entry to compensate for nvme's reduction of io size based on a possible partial page) logic in sg list initialization. In the case where the +1 logic is referenced in host and target io checks, use the values set in the transport template as that value was properly set.There can certainly be more done in this area and it will be addressed in combined host/target driver effort.
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>
Quoted 8 lines
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_attr.c | 2 +- drivers/scsi/lpfc/lpfc_init.c | 19 ++++++++++++++----- drivers/scsi/lpfc/lpfc_nvme.c | 3 ++- drivers/scsi/lpfc/lpfc_nvmet.c | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-)
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
PATCH v2 17/17 lpfc: update driver version to 11.4.0.5
In reply to James SmartUpdate the driver version to 11.4.0.5
--- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_version.h +1 -1
@@ -20,7 +20,7 @@* included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "11.4.0.4" +#define LPFC_DRIVER_VERSION "11.4.0.5"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
Signature · 1 line
2.13.1
Re: [PATCH v2 17/17] lpfc: update driver version to 11.4.0.5
Quoted 14 lines · James Smart
Update the driver version to 11.4.0.5
Signed-off-by Dick Kennedy <[email protected]>Signed-off-by James Smart <[email protected]>--- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/lpfc/lpfc_version.h +0
-0
drivers/scsi/lpfc/lpfc_version.h line 26
Quoted 8 lines
drivers/scsi/lpfc/lpfc_version.h +1
-1@@ -20,7 +20,7 @@* included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "11.4.0.4" +#define LPFC_DRIVER_VERSION "11.4.0.5"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)