aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_hbadisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_hbadisc.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 58ed6859c921..ba120530cf80 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1857,6 +1857,32 @@ lpfc_disable_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1857 lpfc_nlp_state_cleanup(vport, ndlp, ndlp->nlp_state, 1857 lpfc_nlp_state_cleanup(vport, ndlp, ndlp->nlp_state,
1858 NLP_STE_UNUSED_NODE); 1858 NLP_STE_UNUSED_NODE);
1859} 1859}
1860/**
1861 * lpfc_initialize_node: Initialize all fields of node object.
1862 * @vport: Pointer to Virtual Port object.
1863 * @ndlp: Pointer to FC node object.
1864 * @did: FC_ID of the node.
1865 * This function is always called when node object need to
1866 * be initialized. It initializes all the fields of the node
1867 * object.
1868 **/
1869static inline void
1870lpfc_initialize_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1871 uint32_t did)
1872{
1873 INIT_LIST_HEAD(&ndlp->els_retry_evt.evt_listp);
1874 INIT_LIST_HEAD(&ndlp->dev_loss_evt.evt_listp);
1875 init_timer(&ndlp->nlp_delayfunc);
1876 ndlp->nlp_delayfunc.function = lpfc_els_retry_delay;
1877 ndlp->nlp_delayfunc.data = (unsigned long)ndlp;
1878 ndlp->nlp_DID = did;
1879 ndlp->vport = vport;
1880 ndlp->nlp_sid = NLP_NO_SID;
1881 kref_init(&ndlp->kref);
1882 NLP_INT_NODE_ACT(ndlp);
1883 atomic_set(&ndlp->cmd_pending, 0);
1884 ndlp->cmd_qdepth = LPFC_MAX_TGT_QDEPTH;
1885}
1860 1886
1861struct lpfc_nodelist * 1887struct lpfc_nodelist *
1862lpfc_enable_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, 1888lpfc_enable_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
@@ -1897,17 +1923,7 @@ lpfc_enable_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1897 /* re-initialize ndlp except of ndlp linked list pointer */ 1923 /* re-initialize ndlp except of ndlp linked list pointer */
1898 memset((((char *)ndlp) + sizeof (struct list_head)), 0, 1924 memset((((char *)ndlp) + sizeof (struct list_head)), 0,
1899 sizeof (struct lpfc_nodelist) - sizeof (struct list_head)); 1925 sizeof (struct lpfc_nodelist) - sizeof (struct list_head));
1900 INIT_LIST_HEAD(&ndlp->els_retry_evt.evt_listp); 1926 lpfc_initialize_node(vport, ndlp, did);
1901 INIT_LIST_HEAD(&ndlp->dev_loss_evt.evt_listp);
1902 init_timer(&ndlp->nlp_delayfunc);
1903 ndlp->nlp_delayfunc.function = lpfc_els_retry_delay;
1904 ndlp->nlp_delayfunc.data = (unsigned long)ndlp;
1905 ndlp->nlp_DID = did;
1906 ndlp->vport = vport;
1907 ndlp->nlp_sid = NLP_NO_SID;
1908 /* ndlp management re-initialize */
1909 kref_init(&ndlp->kref);
1910 NLP_INT_NODE_ACT(ndlp);
1911 1927
1912 spin_unlock_irqrestore(&phba->ndlp_lock, flags); 1928 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
1913 1929
@@ -3121,19 +3137,9 @@ lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
3121 uint32_t did) 3137 uint32_t did)
3122{ 3138{
3123 memset(ndlp, 0, sizeof (struct lpfc_nodelist)); 3139 memset(ndlp, 0, sizeof (struct lpfc_nodelist));
3124 INIT_LIST_HEAD(&ndlp->els_retry_evt.evt_listp); 3140
3125 INIT_LIST_HEAD(&ndlp->dev_loss_evt.evt_listp); 3141 lpfc_initialize_node(vport, ndlp, did);
3126 init_timer(&ndlp->nlp_delayfunc);
3127 ndlp->nlp_delayfunc.function = lpfc_els_retry_delay;
3128 ndlp->nlp_delayfunc.data = (unsigned long)ndlp;
3129 ndlp->nlp_DID = did;
3130 ndlp->vport = vport;
3131 ndlp->nlp_sid = NLP_NO_SID;
3132 INIT_LIST_HEAD(&ndlp->nlp_listp); 3142 INIT_LIST_HEAD(&ndlp->nlp_listp);
3133 kref_init(&ndlp->kref);
3134 NLP_INT_NODE_ACT(ndlp);
3135 atomic_set(&ndlp->cmd_pending, 0);
3136 ndlp->cmd_qdepth = LPFC_MAX_TGT_QDEPTH;
3137 3143
3138 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE, 3144 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE,
3139 "node init: did:x%x", 3145 "node init: did:x%x",