lpfc 8.3.24: Add resource extent support
Subsystems (2)
PATCH 5/8 lpfc 8.3.24: Add resource extent support
This patch adds support for hardware that returns resource ids via extents rather than contiguous ranges.
Signed-off-by Alex Iannicelli <[email protected]>
Signed-off-by James Smart <[email protected]>
---
lpfc.h | 3 lpfc_bsg.c | 6 lpfc_crtn.h | 6 lpfc_ct.c | 2 lpfc_els.c | 28 - lpfc_hbadisc.c | 32 - lpfc_hw.h | 2 lpfc_hw4.h | 207 +++++-- lpfc_init.c | 127 +++- lpfc_mbox.c | 166 ++++- lpfc_mem.c | 13 lpfc_nportdisc.c | 17 lpfc_scsi.c | 53 + lpfc_sli.c | 1525 +++++++++++++++++++++++++++++++++++++++++++++++++++---- lpfc_sli.h | 1 lpfc_sli4.h | 27 lpfc_vport.c | 2 17 files changed, 1939 insertions(+), 278 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +6 -0
@@ -332,6 +332,8 @@ lpfc_bsg_send_mgmt_cmd(struct fc_bsg_job cmd->ulpLe =1 ; cmd->ulpClass =CLASS3 ; cmd->ulpContext = ndlp->nlp_rpi; +if (phba->sli_rev ==LPFC_SLI_REV4 ) + cmd->ulpContext = phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; cmd->ulpOwner =OWN_CHIP ; cmdiocbq->vport = phba->pport; cmdiocbq->context3 = bmp;
@@ -1336,6 +1338,10 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, } icmd->un.ulpWord[3 ] = ndlp->nlp_rpi; +if (phba->sli_rev ==LPFC_SLI_REV4 ) + icmd->ulpContext = + phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; +/* The exchange is done, mark the entry as invalid */ phba->ct_ctx[tag].flags &= ~UNSOL_VALID ; }else
drivers/scsi/lpfc/lpfc_crtn.h +6 -0
@@ -55,6 +55,8 @@ void lpfc_request_features(struct lpfc_hvoid lpfc_supported_pages (struct lpfcMboxq *);void lpfc_pc_sli4_params (struct lpfcMboxq *);int lpfc_pc_sli4_params_get (struct lpfc_hba *,LPFC_MBOXQ_t *); +int lpfc_sli4_mbox_rsrc_extent (struct lpfc_hba *,struct lpfcMboxq *, +uint16_t ,uint16_t ,bool );int lpfc_get_sli4_parameters (struct lpfc_hba *,LPFC_MBOXQ_t *);struct lpfc_vport *lpfc_find_vport_by_did (struct lpfc_hba *,uint32_t );void lpfc_cleanup_rcv_buffers (struct lpfc_vport *);
@@ -366,6 +368,10 @@ extern void lpfc_debugfs_slow_ring_trc(s uint32_t, uint32_t);extern struct lpfc_hbq_init *lpfc_hbq_defs[]; +/* SLI4 if_type 2 externs. */ +int lpfc_sli4_alloc_resource_identifiers (struct lpfc_hba *); +int lpfc_sli4_dealloc_resource_identifiers (struct lpfc_hba *); +/* externs BlockGuard */ extern char *_dump_buf_data;extern unsigned long _dump_buf_data_order;
drivers/scsi/lpfc/lpfc_ct.c +2 -0
@@ -352,6 +352,8 @@ lpfc_gen_req(struct lpfc_vport *vport, s icmd->ulpLe =1 ; icmd->ulpClass =CLASS3 ; icmd->ulpContext = ndlp->nlp_rpi; +if (phba->sli_rev ==LPFC_SLI_REV4 ) + icmd->ulpContext = phba->sli4_hba.rpi_ids[ndlp->nlp_rpi];if (phba->sli3_options &LPFC_SLI3_NPIV_ENABLED ) {/* For GEN_REQUEST64_CR, use the RPI */
drivers/scsi/lpfc/lpfc_els.c +25 -3
@@ -250,7 +250,7 @@ lpfc_prep_els_iocb(struct lpfc_vport *vp icmd->un.elsreq64.myID = vport->fc_myDID;/* For ELS_REQUEST64_CR, use the VPI by default */ - icmd->ulpContext = vport->vpi + phba->vpi_base; + icmd->ulpContext = phba->vpi_ids[vport->vpi]; icmd->ulpCt_h =0 ;/* The CT field must be 0=INVALID_RPI for the ECHO cmd */ if (elscmd ==ELS_CMD_ECHO )
@@ -454,6 +454,7 @@ lpfc_issue_reg_vfi(struct lpfc_vport *vp rc = -ENOMEM ; goto fail_free_dmabuf; } + mboxq =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (!mboxq) { rc = -ENOMEM ;
@@ -6585,6 +6586,26 @@ lpfc_find_vport_by_vpid(struct lpfc_hba {struct lpfc_vport *vport;unsigned long flags; +int i; + +/* The physical ports are always vpi 0 - translate is unnecessary. */ +if (vpi >0 ) { +/* +* Translate the physical vpi to the logical vpi. The +* vport stores the logical vpi. +*/ +for (i =0 ; i < phba->max_vpi; i++) { +if (vpi == phba->vpi_ids[i]) +break ; + } + +if (i >= phba->max_vpi) { +lpfc_printf_log (phba,KERN_ERR ,LOG_ELS , +"2936 Could not find Vport mapped " +"to vpi %d\n" , vpi); +return NULL ; + } + }spin_lock_irqsave (&phba->hbalock, flags);list_for_each_entry (vport, &phba->port_list, listentry) {
@@ -6641,8 +6662,9 @@ lpfc_els_unsol_event(struct lpfc_hba *ph vport = phba->pport; else vport =lpfc_find_vport_by_vpid (phba, - icmd->unsli3.rcvsli3.vpi - phba->vpi_base); + icmd->unsli3.rcvsli3.vpi); } +/* If there are no BDEs associated * with this IOCB, there is nothing to do. */
@@ -7222,7 +7244,7 @@ lpfc_issue_els_fdisc(struct lpfc_vport * elsiocb->iocb.ulpCt_h = (SLI4_CT_VPI >>1 ) &1 ; elsiocb->iocb.ulpCt_l =SLI4_CT_VPI &1 ;/* Set the ulpContext to the vpi */ - elsiocb->iocb.ulpContext = vport->vpi + phba->vpi_base; + elsiocb->iocb.ulpContext = phba->vpi_ids[vport->vpi]; }else {/* For FDISC, Let FDISC rsp set the NPortID for this VPI */ icmd->ulpCt_h =1 ;
drivers/scsi/lpfc/lpfc.h +3 -0
@@ -780,6 +780,9 @@ struct lpfc_hba {uint16_t vpi_base;uint16_t vfi_base;unsigned long *vpi_bmask;/* vpi allocation table */ +uint16_t *vpi_ids; +uint16_t vpi_count; +struct list_head lpfc_vpi_blk_list;/* Data structure used by fabric iocb scheduler */ struct list_head fabric_iocb_list;
drivers/scsi/lpfc/lpfc_hbadisc.c +19 -13
@@ -881,7 +881,7 @@ lpfc_linkdown(struct lpfc_hba *phba)/* Clean up any firmware default rpi's */ mb =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (mb) { -lpfc_unreg_did (phba,0xffff ,0xffffffff , mb); +lpfc_unreg_did (phba,0xffff ,LPFC_UNREG_ALL_DFLT_RPIS , mb); mb->vport = vport; mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; if (lpfc_sli_issue_mbox(phba, mb, MBX_NOWAIT)
@@ -3421,7 +3421,8 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpreturn ; } - ndlp->nlp_rpi = mb->un.varWords[0 ]; +if (phba->sli_rev <LPFC_SLI_REV4 ) + ndlp->nlp_rpi = mb->un.varWords[0 ]; ndlp->nlp_flag |=NLP_RPI_REGISTERED ; ndlp->nlp_type |=NLP_FABRIC ;lpfc_nlp_set_state (vport, ndlp,NLP_STE_UNMAPPED_NODE );
@@ -3495,7 +3496,8 @@ out:return ; } - ndlp->nlp_rpi = mb->un.varWords[0 ]; +if (phba->sli_rev <LPFC_SLI_REV4 ) + ndlp->nlp_rpi = mb->un.varWords[0 ]; ndlp->nlp_flag |=NLP_RPI_REGISTERED ; ndlp->nlp_type |=NLP_FABRIC ;lpfc_nlp_set_state (vport, ndlp,NLP_STE_UNMAPPED_NODE );
@@ -3582,7 +3584,6 @@ lpfc_register_remote_port(struct lpfc_vpif (ndlp->nlp_type &NLP_FCP_INITIATOR ) rport_ids.roles |=FC_RPORT_ROLE_FCP_INITIATOR ; -if (rport_ids.roles !=FC_RPORT_ROLE_UNKNOWN )fc_remote_port_rolechg (rport, rport_ids.roles);
@@ -4097,11 +4098,16 @@ lpfc_unreg_rpi(struct lpfc_vport *vport,struct lpfc_hba *phba = vport->phba;LPFC_MBOXQ_t *mbox;int rc; +uint16_t rpi;if (ndlp->nlp_flag &NLP_RPI_REGISTERED ) { mbox =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (mbox) { -lpfc_unreg_login (phba, vport->vpi, ndlp->nlp_rpi, mbox); +/* SLI4 ports require the physical rpi value. */ + rpi = ndlp->nlp_rpi; +if (phba->sli_rev ==LPFC_SLI_REV4 ) + rpi = phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; +lpfc_unreg_login (phba, vport->vpi, rpi, mbox); mbox->vport = vport; mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; rc =lpfc_sli_issue_mbox (phba, mbox,MBX_NOWAIT );
@@ -4170,7 +4176,8 @@ lpfc_unreg_all_rpis(struct lpfc_vport *v mbox =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (mbox) { -lpfc_unreg_login (phba, vport->vpi,0xffff , mbox); +lpfc_unreg_login (phba, vport->vpi,LPFC_UNREG_ALL_RPIS_VPORT , + mbox); mbox->vport = vport; mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; mbox->context1 =NULL ;
@@ -4194,7 +4201,8 @@ lpfc_unreg_default_rpis(struct lpfc_vpor mbox =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (mbox) { -lpfc_unreg_did (phba, vport->vpi,0xffffffff , mbox); +lpfc_unreg_did (phba, vport->vpi,LPFC_UNREG_ALL_DFLT_RPIS , + mbox); mbox->vport = vport; mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; mbox->context1 =NULL ;
@@ -4644,10 +4652,7 @@ lpfc_disc_start(struct lpfc_vport *vportif (num_sent)return ; -/* -* For SLI3, cmpl_reg_vpi will set port_state to READY, and -* continue discovery. -*/ +/* Register the VPI for SLI3, NON-NPIV only. */ if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && !(vport->fc_flag & FC_PT2PT) && !(vport->fc_flag & FC_RSCN_MODE) &&
@@ -4934,7 +4939,7 @@ restart_disc:if (phba->sli_rev <LPFC_SLI_REV4 ) {if (phba->sli3_options &LPFC_SLI3_NPIV_ENABLED )lpfc_issue_reg_vpi (phba, vport); -else {/* NPIV Not enabled */ +else {lpfc_issue_clear_la (phba, vport); vport->port_state =LPFC_VPORT_READY ; }
@@ -5060,7 +5065,8 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc pmb->context1 =NULL ; pmb->context2 =NULL ; - ndlp->nlp_rpi = mb->un.varWords[0 ]; +if (phba->sli_rev <LPFC_SLI_REV4 ) + ndlp->nlp_rpi = mb->un.varWords[0 ]; ndlp->nlp_flag |=NLP_RPI_REGISTERED ; ndlp->nlp_type |=NLP_FABRIC ;lpfc_nlp_set_state (vport, ndlp,NLP_STE_UNMAPPED_NODE );
drivers/scsi/lpfc/lpfc_hw4.h +159 -48
281 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hw.h +2 -0
@@ -64,6 +64,8 @@#define SLI3_IOCB_CMD_SIZE 128#define SLI3_IOCB_RSP_SIZE 64 +#define LPFC_UNREG_ALL_RPIS_VPORT 0xffff +#define LPFC_UNREG_ALL_DFLT_RPIS 0xffffffff/* vendor ID used in SCSI netlink calls */ #define LPFC_NL_VENDOR_ID (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX)
drivers/scsi/lpfc/lpfc_init.c +85 -42
298 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_mbox.c +131 -35
286 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_mem.c +0 -13
@@ -62,7 +62,6 @@ int lpfc_mem_alloc(struct lpfc_hba *phba, int align) {struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool; -int longs;int i;if (phba->sli_rev ==LPFC_SLI_REV4 )
@@ -138,17 +137,8 @@ lpfc_mem_alloc(struct lpfc_hba *phba, in phba->lpfc_hrb_pool =NULL ; phba->lpfc_drb_pool =NULL ; } -/* vpi zero is reserved for the physical port so add 1 to max */ - longs = ((phba->max_vpi +1 ) +BITS_PER_LONG -1 ) /BITS_PER_LONG ; - phba->vpi_bmask =kzalloc (longs *sizeof (unsigned long ),GFP_KERNEL ); -if (!phba->vpi_bmask) - goto fail_free_dbq_pool;return 0 ; - - fail_free_dbq_pool: -pci_pool_destroy (phba->lpfc_drb_pool); - phba->lpfc_drb_pool =NULL ; fail_free_hrb_pool:pci_pool_destroy (phba->lpfc_hrb_pool); phba->lpfc_hrb_pool =NULL ;
@@ -191,9 +181,6 @@ lpfc_mem_free(struct lpfc_hba *phba)int i;struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool; -/* Free VPI bitmask memory */ -kfree (phba->vpi_bmask); -/* Free HBQ pools */ lpfc_sli_hbqbuf_free_all (phba);if (phba->lpfc_drb_pool)
drivers/scsi/lpfc/lpfc_nportdisc.c +13 -4
@@ -652,6 +652,7 @@ lpfc_disc_set_adisc(struct lpfc_vport *vlpfc_unreg_rpi (vport, ndlp);return 0 ; } +/** * lpfc_release_rpi - Release a RPI by issuing unreg_login mailbox cmd. * @phba : Pointer to lpfc_hba structure.
@@ -1394,8 +1395,11 @@ lpfc_cmpl_reglogin_reglogin_issue(structif (mb->mbxStatus) {/* RegLogin failed */ lpfc_printf_vlog (vport,KERN_ERR ,LOG_DISCOVERY , -"0246 RegLogin failed Data: x%x x%x x%x\n" , - did, mb->mbxStatus, vport->port_state); +"0246 RegLogin failed Data: x%x x%x x%x x%x " +"x%x\n" , + did, mb->mbxStatus, vport->port_state, + mb->un.varRegLogin.vpi, + mb->un.varRegLogin.rpi);/* * If RegLogin failed due to lack of HBA resources do not * retry discovery.
@@ -1419,7 +1423,10 @@ lpfc_cmpl_reglogin_reglogin_issue(structreturn ndlp->nlp_state; } - ndlp->nlp_rpi = mb->un.varWords[0 ]; +/* SLI4 ports have preallocated logical rpis. */ +if (vport->phba->sli_rev <LPFC_SLI_REV4 ) + ndlp->nlp_rpi = mb->un.varWords[0 ]; + ndlp->nlp_flag |=NLP_RPI_REGISTERED ;/* Only if we are not a fabric nport do we issue PRLI */
@@ -2020,7 +2027,9 @@ lpfc_cmpl_reglogin_npr_node(struct lpfc_MAILBOX_t *mb = &pmb->u.mb;if (!mb->mbxStatus) { - ndlp->nlp_rpi = mb->un.varWords[0 ]; +/* SLI4 ports have preallocated logical rpis. */ +if (vport->phba->sli_rev <LPFC_SLI_REV4 ) + ndlp->nlp_rpi = mb->un.varWords[0 ]; ndlp->nlp_flag |=NLP_RPI_REGISTERED ; }else {if (ndlp->nlp_flag &NLP_NODEV_REMOVE ) {
drivers/scsi/lpfc/lpfc_scsi.c +43 -10
115 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli4.h +25 -2
@@ -310,7 +310,6 @@ struct lpfc_max_cfg_param {uint16_t vfi_base;uint16_t vfi_used;uint16_t max_fcfi; -uint16_t fcfi_base;uint16_t fcfi_used;uint16_t max_eq;uint16_t max_rq;
@@ -449,10 +448,13 @@ struct lpfc_sli4_hba {uint32_t intr_enable;struct lpfc_bmbx bmbx;struct lpfc_max_cfg_param max_cfg_param; +uint16_t extents_in_use;/* must allocate resource extents. */ +uint16_t rpi_hdrs_in_use;/* must post rpi hdrs if set. */ uint16_t next_xri;/* last_xri - max_cfg_param.xri_base = used */ uint16_t next_rpi;uint16_t scsi_xri_max;uint16_t scsi_xri_cnt; +uint16_t scsi_xri_start;struct list_head lpfc_free_sgl_list;struct list_head lpfc_sgl_list;struct lpfc_sglq **lpfc_els_sgl_array;
@@ -463,7 +465,17 @@ struct lpfc_sli4_hba {struct lpfc_sglq **lpfc_sglq_active_list;struct list_head lpfc_rpi_hdr_list;unsigned long *rpi_bmask; +uint16_t *rpi_ids;uint16_t rpi_count; +struct list_head lpfc_rpi_blk_list; +unsigned long *xri_bmask; +uint16_t *xri_ids; +uint16_t xri_count; +struct list_head lpfc_xri_blk_list; +unsigned long *vfi_bmask; +uint16_t *vfi_ids; +uint16_t vfi_count; +struct list_head lpfc_vfi_blk_list;struct lpfc_sli4_flags sli4_flags;struct list_head sp_queue_event;struct list_head sp_cqe_event_pool;
@@ -496,6 +508,7 @@ struct lpfc_sglq {enum lpfc_sgl_state state;struct lpfc_nodelist *ndlp;/* ndlp associated with IO */ uint16_t iotag;/* pre-assigned IO tag */ +uint16_t sli4_lxritag;/* logical pre-assigned xri. */ uint16_t sli4_xritag;/* pre-assigned XRI, (OXID) tag. */ struct sli4_sge *sgl;/* pre-assigned SGL */ void *virt;/* virtual address. */
@@ -510,6 +523,13 @@ struct lpfc_rpi_hdr {uint32_t start_rpi; }; +struct lpfc_rsrc_blks { +struct list_head list; +uint16_t rsrc_start; +uint16_t rsrc_size; +uint16_t rsrc_used; +}; +/* * SLI4 specific function prototypes */
@@ -549,8 +569,11 @@ int lpfc_sli4_post_sgl(struct lpfc_hba *int lpfc_sli4_repost_scsi_sgl_list (struct lpfc_hba *);uint16_t lpfc_sli4_next_xritag (struct lpfc_hba *);int lpfc_sli4_post_async_mbox (struct lpfc_hba *); -int lpfc_sli4_post_sgl_list (struct lpfc_hba *phba); +int lpfc_sli4_post_els_sgl_list (struct lpfc_hba *phba); +int lpfc_sli4_post_els_sgl_list_ext (struct lpfc_hba *phba);int lpfc_sli4_post_scsi_sgl_block (struct lpfc_hba *,struct list_head *,int ); +int lpfc_sli4_post_scsi_sgl_blk_ext (struct lpfc_hba *,struct list_head *, +int );struct lpfc_cq_event *__lpfc_sli4_cq_event_alloc (struct lpfc_hba *);struct lpfc_cq_event *lpfc_sli4_cq_event_alloc (struct lpfc_hba *);void __lpfc_sli4_cq_event_release (struct lpfc_hba *,struct lpfc_cq_event *);
drivers/scsi/lpfc/lpfc_sli.c +1418 -107
1,661 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.