diff options
author | James Smart <James.Smart@Emulex.Com> | 2007-04-25 09:53:08 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-06 10:33:15 -0400 |
commit | 685f0bf7afe087940d34f98ac0fd1df84091d360 (patch) | |
tree | 7e7fbfc856f13a3c4c64e14784b7050812753521 /drivers/scsi/lpfc/lpfc_attr.c | |
parent | 329f9bc735b4665d42267259b1612191f72c4d42 (diff) |
[SCSI] lpfc 8.1.12 : Collapse discovery lists to a single node list
Collapse discovery lists to a single node list.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 64 |
1 files changed, 24 insertions, 40 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index df9847ea1a12..2605bd3502a9 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -1781,67 +1781,51 @@ lpfc_reset_stats(struct Scsi_Host *shost) | |||
1781 | * The LPFC driver treats linkdown handling as target loss events so there | 1781 | * The LPFC driver treats linkdown handling as target loss events so there |
1782 | * are no sysfs handlers for link_down_tmo. | 1782 | * are no sysfs handlers for link_down_tmo. |
1783 | */ | 1783 | */ |
1784 | static void | 1784 | |
1785 | lpfc_get_starget_port_id(struct scsi_target *starget) | 1785 | static struct lpfc_nodelist * |
1786 | lpfc_get_node_by_target(struct scsi_target *starget) | ||
1786 | { | 1787 | { |
1787 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1788 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
1788 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; | 1789 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; |
1789 | uint32_t did = -1; | 1790 | struct lpfc_nodelist *ndlp; |
1790 | struct lpfc_nodelist *ndlp = NULL; | ||
1791 | 1791 | ||
1792 | spin_lock_irq(shost->host_lock); | 1792 | spin_lock_irq(shost->host_lock); |
1793 | /* Search the mapped list for this target ID */ | 1793 | /* Search for this, mapped, target ID */ |
1794 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { | 1794 | list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) { |
1795 | if (starget->id == ndlp->nlp_sid) { | 1795 | if (ndlp->nlp_state == NLP_STE_MAPPED_NODE && |
1796 | did = ndlp->nlp_DID; | 1796 | starget->id == ndlp->nlp_sid) { |
1797 | break; | 1797 | spin_unlock_irq(shost->host_lock); |
1798 | return ndlp; | ||
1798 | } | 1799 | } |
1799 | } | 1800 | } |
1800 | spin_unlock_irq(shost->host_lock); | 1801 | spin_unlock_irq(shost->host_lock); |
1802 | return NULL; | ||
1803 | } | ||
1801 | 1804 | ||
1802 | fc_starget_port_id(starget) = did; | 1805 | static void |
1806 | lpfc_get_starget_port_id(struct scsi_target *starget) | ||
1807 | { | ||
1808 | struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget); | ||
1809 | |||
1810 | fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1; | ||
1803 | } | 1811 | } |
1804 | 1812 | ||
1805 | static void | 1813 | static void |
1806 | lpfc_get_starget_node_name(struct scsi_target *starget) | 1814 | lpfc_get_starget_node_name(struct scsi_target *starget) |
1807 | { | 1815 | { |
1808 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1816 | struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget); |
1809 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; | ||
1810 | u64 node_name = 0; | ||
1811 | struct lpfc_nodelist *ndlp = NULL; | ||
1812 | 1817 | ||
1813 | spin_lock_irq(shost->host_lock); | 1818 | fc_starget_node_name(starget) = |
1814 | /* Search the mapped list for this target ID */ | 1819 | ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0; |
1815 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { | ||
1816 | if (starget->id == ndlp->nlp_sid) { | ||
1817 | node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn); | ||
1818 | break; | ||
1819 | } | ||
1820 | } | ||
1821 | spin_unlock_irq(shost->host_lock); | ||
1822 | |||
1823 | fc_starget_node_name(starget) = node_name; | ||
1824 | } | 1820 | } |
1825 | 1821 | ||
1826 | static void | 1822 | static void |
1827 | lpfc_get_starget_port_name(struct scsi_target *starget) | 1823 | lpfc_get_starget_port_name(struct scsi_target *starget) |
1828 | { | 1824 | { |
1829 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1825 | struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget); |
1830 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; | ||
1831 | u64 port_name = 0; | ||
1832 | struct lpfc_nodelist *ndlp = NULL; | ||
1833 | |||
1834 | spin_lock_irq(shost->host_lock); | ||
1835 | /* Search the mapped list for this target ID */ | ||
1836 | list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { | ||
1837 | if (starget->id == ndlp->nlp_sid) { | ||
1838 | port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn); | ||
1839 | break; | ||
1840 | } | ||
1841 | } | ||
1842 | spin_unlock_irq(shost->host_lock); | ||
1843 | 1826 | ||
1844 | fc_starget_port_name(starget) = port_name; | 1827 | fc_starget_port_name(starget) = |
1828 | ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0; | ||
1845 | } | 1829 | } |
1846 | 1830 | ||
1847 | static void | 1831 | static void |