diff options
author | Vasu Dev <vasu.dev@intel.com> | 2009-03-17 14:42:18 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-04-03 10:23:05 -0400 |
commit | 5e80f7f7c87990ffe7856a0d35a94ea52b8f4c59 (patch) | |
tree | da71459b4bfa17c9b3f7f0bb63fd07aee2c702cf /drivers/scsi/fcoe/fcoe.c | |
parent | 9b34ecffd59d6ed66fdd6906e8a092a33e7c8564 (diff) |
[SCSI] fcoe: moves common FCoE library API functions to libfcoe module
Moves these functions as-is from fcoe.c to libfcoe.c, since
they're are common routines:
- fcoe_wwn_from_mac
- fcoe_libfc_config
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/fcoe/fcoe.c')
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 23983c789429..42eee5b7e5c5 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -1766,47 +1766,6 @@ int fcoe_reset(struct Scsi_Host *shost) | |||
1766 | EXPORT_SYMBOL_GPL(fcoe_reset); | 1766 | EXPORT_SYMBOL_GPL(fcoe_reset); |
1767 | 1767 | ||
1768 | /** | 1768 | /** |
1769 | * fcoe_wwn_from_mac() - Converts 48-bit IEEE MAC address to 64-bit FC WWN. | ||
1770 | * @mac: mac address | ||
1771 | * @scheme: check port | ||
1772 | * @port: port indicator for converting | ||
1773 | * | ||
1774 | * Returns: u64 fc world wide name | ||
1775 | */ | ||
1776 | u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], | ||
1777 | unsigned int scheme, unsigned int port) | ||
1778 | { | ||
1779 | u64 wwn; | ||
1780 | u64 host_mac; | ||
1781 | |||
1782 | /* The MAC is in NO, so flip only the low 48 bits */ | ||
1783 | host_mac = ((u64) mac[0] << 40) | | ||
1784 | ((u64) mac[1] << 32) | | ||
1785 | ((u64) mac[2] << 24) | | ||
1786 | ((u64) mac[3] << 16) | | ||
1787 | ((u64) mac[4] << 8) | | ||
1788 | (u64) mac[5]; | ||
1789 | |||
1790 | WARN_ON(host_mac >= (1ULL << 48)); | ||
1791 | wwn = host_mac | ((u64) scheme << 60); | ||
1792 | switch (scheme) { | ||
1793 | case 1: | ||
1794 | WARN_ON(port != 0); | ||
1795 | break; | ||
1796 | case 2: | ||
1797 | WARN_ON(port >= 0xfff); | ||
1798 | wwn |= (u64) port << 48; | ||
1799 | break; | ||
1800 | default: | ||
1801 | WARN_ON(1); | ||
1802 | break; | ||
1803 | } | ||
1804 | |||
1805 | return wwn; | ||
1806 | } | ||
1807 | EXPORT_SYMBOL_GPL(fcoe_wwn_from_mac); | ||
1808 | |||
1809 | /** | ||
1810 | * fcoe_hostlist_lookup_softc() - find the corresponding lport by a given device | 1769 | * fcoe_hostlist_lookup_softc() - find the corresponding lport by a given device |
1811 | * @device: this is currently ptr to net_device | 1770 | * @device: this is currently ptr to net_device |
1812 | * | 1771 | * |
@@ -1886,29 +1845,6 @@ int fcoe_hostlist_remove(const struct fc_lport *lp) | |||
1886 | EXPORT_SYMBOL_GPL(fcoe_hostlist_remove); | 1845 | EXPORT_SYMBOL_GPL(fcoe_hostlist_remove); |
1887 | 1846 | ||
1888 | /** | 1847 | /** |
1889 | * fcoe_libfc_config() - sets up libfc related properties for lport | ||
1890 | * @lp: ptr to the fc_lport | ||
1891 | * @tt: libfc function template | ||
1892 | * | ||
1893 | * Returns : 0 for success | ||
1894 | */ | ||
1895 | int fcoe_libfc_config(struct fc_lport *lp, struct libfc_function_template *tt) | ||
1896 | { | ||
1897 | /* Set the function pointers set by the LLDD */ | ||
1898 | memcpy(&lp->tt, tt, sizeof(*tt)); | ||
1899 | if (fc_fcp_init(lp)) | ||
1900 | return -ENOMEM; | ||
1901 | fc_exch_init(lp); | ||
1902 | fc_elsct_init(lp); | ||
1903 | fc_lport_init(lp); | ||
1904 | fc_rport_init(lp); | ||
1905 | fc_disc_init(lp); | ||
1906 | |||
1907 | return 0; | ||
1908 | } | ||
1909 | EXPORT_SYMBOL_GPL(fcoe_libfc_config); | ||
1910 | |||
1911 | /** | ||
1912 | * fcoe_init() - fcoe module loading initialization | 1848 | * fcoe_init() - fcoe module loading initialization |
1913 | * | 1849 | * |
1914 | * Returns 0 on success, negative on failure | 1850 | * Returns 0 on success, negative on failure |