Re: [PATCH 02/17] lpfc: NVME Initiator: Base modifications Part A
Nevermind - I misread the "-" for "+". will fix -- james -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/17] lpfc: NVME Initiator: Base modifications Part A
On Wed, Jan 18, 2017 at 06:34:02PM -0800, James Smart wrote: > > > On 1/18/2017 1:50 AM, Johannes Thumshirn wrote: > > >>@@ -4959,11 +4968,11 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct > >>scsi_cmnd *cmnd, > >>int status; > >>rdata = lpfc_rport_data_from_scsi_device(cmnd->device); > >>- if (!rdata || !rdata->pnode || !NLP_CHK_NODE_ACT(rdata->pnode)) > >>- return FAILED; > >OK, I don't get this hunk. lpfc_rport_data_from_scsi_device() cannot return > >NULL anymore? > > > >I at least expected something like: > > > > rdata = lpfc_rport_data_from_scsi_device(cmnd->device); > > if (!rdata || !rdata->pnode) > > return FAILED; > > > > pnode = rdata->pnode; > > if (!NLP_CHK_NODE_ACT(pnode) > > return FAILED; > > it can and the order of precedence for the if check allows for it. I don't > see any difference in what you wrote vs what's there, other than pnode gets > an assignment. You're doing: rdata = lpfc_rport_data_from_scsi_device(cmnd->device); pnode = rdata->pnode; if (!pnode || !NLP_CHK_NODE_ACT(pnode)) return FAILED; So if rdata is already NULL, the pnode = rdata->pnode line will blow up. -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/17] lpfc: NVME Initiator: Base modifications Part A
On 1/18/2017 1:50 AM, Johannes Thumshirn wrote: @@ -4959,11 +4968,11 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct scsi_cmnd *cmnd, int status; rdata = lpfc_rport_data_from_scsi_device(cmnd->device); - if (!rdata || !rdata->pnode || !NLP_CHK_NODE_ACT(rdata->pnode)) - return FAILED; OK, I don't get this hunk. lpfc_rport_data_from_scsi_device() cannot return NULL anymore? I at least expected something like: rdata = lpfc_rport_data_from_scsi_device(cmnd->device); if (!rdata || !rdata->pnode) return FAILED; pnode = rdata->pnode; if (!NLP_CHK_NODE_ACT(pnode) return FAILED; it can and the order of precedence for the if check allows for it. I don't see any difference in what you wrote vs what's there, other than pnode gets an assignment. Agree with all your other comments and will address them. -- james -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/17] lpfc: NVME Initiator: Base modifications Part A
On 1/17/2017 11:07 PM, Hannes Reinecke wrote: - * lpfc_sli4_post_scsi_sgl_list - Post blocks of scsi buffer sgls from a list + * lpfc_sli4_post_scsi_sgl_list - Psot blocks of scsi buffer sgls from a list * @phba: pointer to lpfc hba data structure. * @post_sblist: pointer to the scsi buffer list. * Psot? Repsot? The reverse of 'Psot'? lol... bdea? Crud - caught a bunch of those but looks like a couple got through. Surprised checkpatch let them through. oh well. anyway - will fix and repost (repsot?) what you mentioned. -- james -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 02/17] lpfc: NVME Initiator: Base modifications Part A
Hi James, On Tue, Jan 17, 2017 at 05:20:45PM -0800, James Smart wrote: > > NVME Initiator: Base modifications > > This is part A of parts A..F. > > Part A is the bulk of the file list changed by the modifications as > most mods are small-ish. Changes may be for any aspect below. > > * > > This set of patches (6 parts) adds base modifications for NVME initiator > support to the lpfc driver. > > The base modifications consist of: > - Formal split of SLI3 rings from SLI-4 WQs (sometimes referred to as > rings as well) as implementation now widely varies between the two. > - Addition of configuration modes: >SCSI initiator only; NVME initiator only; NVME target only; and >SCSI and NVME initiator. >The configuration mode drives overall adapter configuration, >offloads enabled, and resource splits. >NVME support is only available on SLI-4 devices and newer fw. > - Implements the following based on configuration mode: > - Exchange resources are split by protocol; Obviously, if only > 1 mode, then no split occurs. Default is 50/50. module attribute > allows tuning. > - Each protocol has it's own set of queues, but share interrupt > vectors. > SCSI: >SLI3 devices have few queues and the original style of queue > allocation remains. >SLI4 devices piggy back on an "io-channel" concept that > eventually needs to merge with scsi-mq/blk-mq support (it is >underway). For now, the paradigm continues as it existed >prior. io channel allocates N msix and N WQs (N=4 default) >and either round robins or uses cpu # modulo N for scheduling. >A bunch of module parameters allow the configuration to be >tuned. > NVME (initiator): >Allocates an msix per cpu (or whatever pci_alloc_irq_vectors > gets) >Allocates a WQ per cpu, and maps the WQs to msix on a WQ # > modulo msix vector count basis. >Module parameters exist to cap/control the config if desired. > - Each protocol has its own buffer and dma pools. > > Unfortunately, it was very difficult to break out the above into > functional patches. A such, they are presented as a 6-patch set to > keep email size reasonable. All patches in the set must be applied to > create a functional unit. > > Signed-off-by: Dick Kennedy> Signed-off-by: James Smart > --- [...] > @@ -2704,7 +2710,7 @@ static int lpfcdiag_loop_get_xri(struct lpfc_hba *phba, > uint16_t rpi, > * @phba: Pointer to HBA context object > * > * This function allocates BSG_MBOX_SIZE (4KB) page size dma buffer and. > - * returns the pointer to the buffer. > + * retruns the pointer to the buffer. This hunk introduces a spelling error. > **/ > static struct lpfc_dmabuf * > lpfc_bsg_dma_page_alloc(struct lpfc_hba *phba) > @@ -2876,7 +2882,7 @@ static int lpfcdiag_loop_post_rxbufs(struct lpfc_hba > *phba, uint16_t rxxri, >size_t len) > { > struct lpfc_sli *psli = >sli; > - struct lpfc_sli_ring *pring = >ring[LPFC_ELS_RING]; > + struct lpfc_sli_ring *pring; > struct lpfc_iocbq *cmdiocbq; > IOCB_t *cmd = NULL; > struct list_head head, *curr, *next; > @@ -2890,6 +2896,11 @@ static int lpfcdiag_loop_post_rxbufs(struct lpfc_hba > *phba, uint16_t rxxri, > int iocb_stat; > int i = 0; > > + if (phba->sli_rev == LPFC_SLI_REV4) > + pring = phba->sli4_hba.els_wq->pring; > + else > + pring = >sli3_ring[LPFC_ELS_RING]; > + > cmdiocbq = lpfc_sli_get_iocbq(phba); > rxbmp = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL); > if (rxbmp != NULL) { > @@ -5258,7 +5269,7 @@ static int > lpfc_forced_link_speed(struct bsg_job *job) > { > struct Scsi_Host *shost = fc_bsg_to_shost(job); > - struct lpfc_vport *vport = shost_priv(shost); > + struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; Please don't. A) it's unnecessary to cast a void* and b) shost_priv() just returns shost->hostdata (casted to void*). So all's fine. [...] > diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h > index 361f5b3..1d07a5f 100644 > --- a/drivers/scsi/lpfc/lpfc_disc.h > +++ b/drivers/scsi/lpfc/lpfc_disc.h > @@ -133,6 +133,7 @@ struct lpfc_node_rrq { > /* Defines for nlp_flag (uint32) */ > #define NLP_IGNR_REG_CMPL 0x0001 /* Rcvd rscn before we cmpl reg login > */ > #define NLP_REG_LOGIN_SEND 0x0002 /* sent reglogin to adapter */ > +#define NLP_SUPPRESS_RSP 0x0010/* Remote NPort supports > suppress rsp */ > #define NLP_PLOGI_SND 0x0020/* sent PLOGI request for this > entry */ > #define NLP_PRLI_SND 0x0040/* sent PRLI request for this > entry */ > #define NLP_ADISC_SND 0x0080/* sent ADISC request for this > entry */ > diff --git a/drivers/scsi/lpfc/lpfc_els.c
Re: [PATCH 02/17] lpfc: NVME Initiator: Base modifications Part A
On 01/18/2017 02:20 AM, James Smart wrote: > > NVME Initiator: Base modifications > > This is part A of parts A..F. > > Part A is the bulk of the file list changed by the modifications as > most mods are small-ish. Changes may be for any aspect below. > > * > > This set of patches (6 parts) adds base modifications for NVME initiator > support to the lpfc driver. > > The base modifications consist of: > - Formal split of SLI3 rings from SLI-4 WQs (sometimes referred to as > rings as well) as implementation now widely varies between the two. > - Addition of configuration modes: >SCSI initiator only; NVME initiator only; NVME target only; and >SCSI and NVME initiator. >The configuration mode drives overall adapter configuration, >offloads enabled, and resource splits. >NVME support is only available on SLI-4 devices and newer fw. > - Implements the following based on configuration mode: > - Exchange resources are split by protocol; Obviously, if only > 1 mode, then no split occurs. Default is 50/50. module attribute > allows tuning. > - Each protocol has it's own set of queues, but share interrupt > vectors. > SCSI: >SLI3 devices have few queues and the original style of queue > allocation remains. >SLI4 devices piggy back on an "io-channel" concept that > eventually needs to merge with scsi-mq/blk-mq support (it is >underway). For now, the paradigm continues as it existed >prior. io channel allocates N msix and N WQs (N=4 default) >and either round robins or uses cpu # modulo N for scheduling. >A bunch of module parameters allow the configuration to be >tuned. > NVME (initiator): >Allocates an msix per cpu (or whatever pci_alloc_irq_vectors > gets) >Allocates a WQ per cpu, and maps the WQs to msix on a WQ # > modulo msix vector count basis. >Module parameters exist to cap/control the config if desired. > - Each protocol has its own buffer and dma pools. > > Unfortunately, it was very difficult to break out the above into > functional patches. A such, they are presented as a 6-patch set to > keep email size reasonable. All patches in the set must be applied to > create a functional unit. > > Signed-off-by: Dick Kennedy> Signed-off-by: James Smart > --- > drivers/scsi/lpfc/lpfc.h | 77 ++-- > drivers/scsi/lpfc/lpfc_attr.h | 1 + > drivers/scsi/lpfc/lpfc_bsg.c | 37 ++-- > drivers/scsi/lpfc/lpfc_crtn.h | 44 - > drivers/scsi/lpfc/lpfc_disc.h | 1 + > drivers/scsi/lpfc/lpfc_els.c | 56 > drivers/scsi/lpfc/lpfc_hbadisc.c | 148 +++--- > drivers/scsi/lpfc/lpfc_hw.h| 5 +- > drivers/scsi/lpfc/lpfc_hw4.h | 183 > +++-- > drivers/scsi/lpfc/lpfc_logmsg.h| 4 + > drivers/scsi/lpfc/lpfc_mbox.c | 47 ++ > drivers/scsi/lpfc/lpfc_mem.c | 111 -- > drivers/scsi/lpfc/lpfc_nportdisc.c | 9 +- > drivers/scsi/lpfc/lpfc_nvme.h | 87 ++ > drivers/scsi/lpfc/lpfc_scsi.c | 140 +++- > drivers/scsi/lpfc/lpfc_scsi.h | 18 ++-- > drivers/scsi/lpfc/lpfc_sli.h | 37 ++-- > drivers/scsi/lpfc/lpfc_sli4.h | 75 +++ > drivers/scsi/lpfc/lpfc_version.h | 1 + > drivers/scsi/lpfc/lpfc_vport.c | 3 + > 20 files changed, 854 insertions(+), 230 deletions(-) > create mode 100644 drivers/scsi/lpfc/lpfc_nvme.h > [ .. ] > @@ -605,7 +610,7 @@ lpfc_sli4_fcp_xri_aborted(struct lpfc_hba *phba, > } > > /** > - * lpfc_sli4_post_scsi_sgl_list - Post blocks of scsi buffer sgls from a list > + * lpfc_sli4_post_scsi_sgl_list - Psot blocks of scsi buffer sgls from a list > * @phba: pointer to lpfc hba data structure. > * @post_sblist: pointer to the scsi buffer list. > * Psot? > @@ -734,7 +739,7 @@ lpfc_sli4_post_scsi_sgl_list(struct lpfc_hba *phba, > } > > /** > - * lpfc_sli4_repost_scsi_sgl_list - Repost all the allocated scsi buffer sgls > + * lpfc_sli4_repost_scsi_sgl_list - Repsot all the allocated scsi buffer sgls > * @phba: pointer to lpfc hba data structure. > * > * This routine walks the list of scsi buffers that have been allocated and Repsot? The reverse of 'Psot'? [ .. ] > @@ -1133,7 +1138,7 @@ lpfc_release_scsi_buf(struct lpfc_hba *phba, struct > lpfc_scsi_buf *psb) > * > * This routine does the pci dma mapping for scatter-gather list of scsi cmnd > * field of @lpfc_cmd for device with SLI-3 interface spec. This routine > scans > - * through sg elements and format the bde. This routine also initializes all > + * through sg elements and format the bdea. This routine also initializes all > * IOCB fields which are dependent on scsi command request buffer. > * > * Return codes:
[PATCH 02/17] lpfc: NVME Initiator: Base modifications Part A
NVME Initiator: Base modifications This is part A of parts A..F. Part A is the bulk of the file list changed by the modifications as most mods are small-ish. Changes may be for any aspect below. * This set of patches (6 parts) adds base modifications for NVME initiator support to the lpfc driver. The base modifications consist of: - Formal split of SLI3 rings from SLI-4 WQs (sometimes referred to as rings as well) as implementation now widely varies between the two. - Addition of configuration modes: SCSI initiator only; NVME initiator only; NVME target only; and SCSI and NVME initiator. The configuration mode drives overall adapter configuration, offloads enabled, and resource splits. NVME support is only available on SLI-4 devices and newer fw. - Implements the following based on configuration mode: - Exchange resources are split by protocol; Obviously, if only 1 mode, then no split occurs. Default is 50/50. module attribute allows tuning. - Each protocol has it's own set of queues, but share interrupt vectors. SCSI: SLI3 devices have few queues and the original style of queue allocation remains. SLI4 devices piggy back on an "io-channel" concept that eventually needs to merge with scsi-mq/blk-mq support (it is underway). For now, the paradigm continues as it existed prior. io channel allocates N msix and N WQs (N=4 default) and either round robins or uses cpu # modulo N for scheduling. A bunch of module parameters allow the configuration to be tuned. NVME (initiator): Allocates an msix per cpu (or whatever pci_alloc_irq_vectors gets) Allocates a WQ per cpu, and maps the WQs to msix on a WQ # modulo msix vector count basis. Module parameters exist to cap/control the config if desired. - Each protocol has its own buffer and dma pools. Unfortunately, it was very difficult to break out the above into functional patches. A such, they are presented as a 6-patch set to keep email size reasonable. All patches in the set must be applied to create a functional unit. Signed-off-by: Dick KennedySigned-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 77 ++-- drivers/scsi/lpfc/lpfc_attr.h | 1 + drivers/scsi/lpfc/lpfc_bsg.c | 37 ++-- drivers/scsi/lpfc/lpfc_crtn.h | 44 - drivers/scsi/lpfc/lpfc_disc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 56 drivers/scsi/lpfc/lpfc_hbadisc.c | 148 +++--- drivers/scsi/lpfc/lpfc_hw.h| 5 +- drivers/scsi/lpfc/lpfc_hw4.h | 183 +++-- drivers/scsi/lpfc/lpfc_logmsg.h| 4 + drivers/scsi/lpfc/lpfc_mbox.c | 47 ++ drivers/scsi/lpfc/lpfc_mem.c | 111 -- drivers/scsi/lpfc/lpfc_nportdisc.c | 9 +- drivers/scsi/lpfc/lpfc_nvme.h | 87 ++ drivers/scsi/lpfc/lpfc_scsi.c | 140 +++- drivers/scsi/lpfc/lpfc_scsi.h | 18 ++-- drivers/scsi/lpfc/lpfc_sli.h | 37 ++-- drivers/scsi/lpfc/lpfc_sli4.h | 75 +++ drivers/scsi/lpfc/lpfc_version.h | 1 + drivers/scsi/lpfc/lpfc_vport.c | 3 + 20 files changed, 854 insertions(+), 230 deletions(-) create mode 100644 drivers/scsi/lpfc/lpfc_nvme.h diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 6593b07..3fad85e 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -20,6 +20,7 @@ ***/ #include +#include #if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_SCSI_LPFC_DEBUG_FS) #define CONFIG_SCSI_LPFC_DEBUG_FS @@ -53,6 +54,7 @@ struct lpfc_sli2_slim; #define LPFC_MAX_SG_SEG_CNT4096/* 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_MIN_NVME_SEG_CNT 254 #define LPFC_MAX_SGE_SIZE 0x8000 /* Maximum data allowed in a SGE */ #define LPFC_IOCB_LIST_CNT 2250/* list of IOCBs for fast-path usage. */ @@ -114,6 +116,13 @@ enum lpfc_polling_flags { DISABLE_FCP_RING_INT= 0x2 }; +struct perf_prof { + uint16_t cmd_cpu[40]; + uint16_t rsp_cpu[40]; + uint16_t qh_cpu[40]; + uint16_t wqidx[40]; +}; + /* Provide DMA memory definitions the driver uses per port instance. */ struct lpfc_dmabuf { struct list_head list; @@ -131,10 +140,24 @@ struct lpfc_dma_pool { struct hbq_dmabuf { struct lpfc_dmabuf hbuf; struct lpfc_dmabuf dbuf; - uint32_t size; + uint16_t total_size; + uint16_t bytes_recv; uint32_t tag; struct lpfc_cq_event cq_event; unsigned long time_stamp; +