lpfc 8.1.12 : Reference count node structures for node lifetime management
Subsystems (2)
PATCH 10/16 lpfc 8.1.12 : Reference count node structures for node lifetime management
Reference count node structures for node lifetime management.
Signed-off-by James Smart <[email protected]>
drivers/scsi/lpfc/lpfc_crtn.h +2 -1
@@ -51,8 +51,9 @@ int lpfc_can_disctmo(struct lpfc_hba *);int lpfc_unreg_rpi (struct lpfc_hba *,struct lpfc_nodelist *);int lpfc_check_sli_ndlp (struct lpfc_hba *,struct lpfc_sli_ring *,struct lpfc_iocbq *,struct lpfc_nodelist *); -int lpfc_nlp_remove (struct lpfc_hba *,struct lpfc_nodelist *);void lpfc_nlp_init (struct lpfc_hba *,struct lpfc_nodelist *,uint32_t ); +struct lpfc_nodelist *lpfc_nlp_get (struct lpfc_nodelist *); +int lpfc_nlp_put (struct lpfc_nodelist *);struct lpfc_nodelist *lpfc_setup_disc_node (struct lpfc_hba *,uint32_t );void lpfc_disc_list_loopmap (struct lpfc_hba *);void lpfc_disc_start (struct lpfc_hba *);
drivers/scsi/lpfc/lpfc_disc.h +1 -2
@@ -69,7 +69,6 @@ struct lpfc_nodelist {uint16_t nlp_maxframe;/* Max RCV frame size */ uint8_t nlp_class_sup;/* Supported Classes */ uint8_t nlp_retry;/* used for ELS retries */ -uint8_t nlp_disc_refcnt;/* used for DSM */ uint8_t nlp_fcp_info;/* class info, bits 0-3 */ #define NLP_FCP_2_DEVICE 0x10/* FCP-2 device */
@@ -80,6 +79,7 @@ struct lpfc_nodelist {struct lpfc_work_evt els_retry_evt;unsigned long last_ramp_up_time;/* jiffy of last ramp up */ unsigned long last_q_full_time;/* jiffy of last queue full */ +struct kref kref; };/* Defines for nlp_flag (uint32) */
@@ -107,7 +107,6 @@ struct lpfc_nodelist {ACC */ #define NLP_NPR_ADISC 0x2000000/* Issue ADISC when dq'ed from NPR list */ -#define NLP_DELAY_REMOVE 0x4000000/* Defer removal till end of DSM */ #define NLP_NODEV_REMOVE 0x8000000/* Defer removal till discovery ends */ /* Defines for list searchs */
drivers/scsi/lpfc/lpfc_els.c +59 -48
345 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hbadisc.c +72 -35
256 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_init.c +7 -8
@@ -1187,12 +1187,12 @@ lpfc_cleanup(struct lpfc_hba * phba)lpfc_can_disctmo (phba);list_for_each_entry_safe (ndlp, next_ndlp, &phba->fc_nlpunmap_list, nlp_listp) { -lpfc_nlp_remove (phba, ndlp); +lpfc_nlp_put (ndlp); }list_for_each_entry_safe (ndlp, next_ndlp, &phba->fc_nlpmap_list, nlp_listp) { -lpfc_nlp_remove (phba, ndlp); +lpfc_nlp_put (ndlp); } list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_unused_list,
@@ -1202,27 +1202,27 @@ lpfc_cleanup(struct lpfc_hba * phba)list_for_each_entry_safe (ndlp, next_ndlp, &phba->fc_plogi_list, nlp_listp) { -lpfc_nlp_remove (phba, ndlp); +lpfc_nlp_put (ndlp); }list_for_each_entry_safe (ndlp, next_ndlp, &phba->fc_adisc_list, nlp_listp) { -lpfc_nlp_remove (phba, ndlp); +lpfc_nlp_put (ndlp); }list_for_each_entry_safe (ndlp, next_ndlp, &phba->fc_reglogin_list, nlp_listp) { -lpfc_nlp_remove (phba, ndlp); +lpfc_nlp_put (ndlp); }list_for_each_entry_safe (ndlp, next_ndlp, &phba->fc_prli_list, nlp_listp) { -lpfc_nlp_remove (phba, ndlp); +lpfc_nlp_put (ndlp); }list_for_each_entry_safe (ndlp, next_ndlp, &phba->fc_npr_list, nlp_listp) { -lpfc_nlp_remove (phba, ndlp); +lpfc_nlp_put (ndlp); }INIT_LIST_HEAD (&phba->fc_nlpmap_list);
@@ -1510,7 +1510,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev,INIT_LIST_HEAD (&phba->fc_prli_list);INIT_LIST_HEAD (&phba->fc_npr_list); -pci_set_master (pdev); retval =pci_set_mwi (pdev);if (retval)
drivers/scsi/lpfc/lpfc_nportdisc.c +8 -15
@@ -353,7 +353,10 @@ lpfc_rcv_plogi(struct lpfc_hba * phba,* queue this mbox command to be processed later. */ mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; - mbox->context2 = ndlp; +/* +* mbox->context2 = lpfc_nlp_get(ndlp) deferred until mailbox +* command issued in lpfc_cmpl_els_acc(). +*/ ndlp->nlp_flag |= (NLP_ACC_REGLOGIN |NLP_RCV_PLOGI );/*
@@ -773,13 +776,14 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_default : mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; } - mbox->context2 = ndlp; + mbox->context2 =lpfc_nlp_get (ndlp);if (lpfc_sli_issue_mbox (phba, mbox, (MBX_NOWAIT |MBX_STOP_IOCB )) !=MBX_NOT_FINISHED ) {lpfc_nlp_set_state (phba, ndlp,NLP_STE_REG_LOGIN_ISSUE );return ndlp->nlp_state; } +lpfc_nlp_put (ndlp); mp = (struct lpfc_dmabuf *)mbox->context1;lpfc_mbuf_free (phba, mp->virt, mp->phys);kfree (mp);
@@ -1920,7 +1924,7 @@ lpfc_disc_state_machine(struct lpfc_hbauint32_t (*func) (struct lpfc_hba *,struct lpfc_nodelist *,void *,uint32_t ); - ndlp->nlp_disc_refcnt++; +lpfc_nlp_get (ndlp); cur_state = ndlp->nlp_state;/* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */
@@ -1943,18 +1947,7 @@ lpfc_disc_state_machine(struct lpfc_hba phba->brd_no, rc, ndlp->nlp_DID, ndlp->nlp_flag); - ndlp->nlp_disc_refcnt--; +lpfc_nlp_put (ndlp); -/* Check to see if ndlp removal is deferred */ -if ((ndlp->nlp_disc_refcnt ==0 ) - && (ndlp->nlp_flag &NLP_DELAY_REMOVE )) { -spin_lock_irq (phba->host->host_lock); - ndlp->nlp_flag &= ~NLP_DELAY_REMOVE ; -spin_unlock_irq (phba->host->host_lock); -lpfc_nlp_remove (phba, ndlp); -return NLP_STE_FREED_NODE ; - } -if (rc ==NLP_STE_FREED_NODE ) -return NLP_STE_FREED_NODE ;return rc; }