diff options
author | Yi Zou <yi.zou@intel.com> | 2012-12-06 01:23:58 -0500 |
---|---|---|
committer | Robert Love <robert.w.love@intel.com> | 2012-12-14 13:38:55 -0500 |
commit | 03702689fcc985e9cb45b57099ebd5066f674739 (patch) | |
tree | 10079124d57a604c30ccfbda79ac697e362391e2 /drivers | |
parent | 66524ec9d0aeaa8bc59077c7c5f78d09ec9eeb9d (diff) |
libfcoe, fcoe: move fcoe_link_speed_update() to libfcoe and export it
With the previous patch, fcoe_link_speed_update() can be moved into libfcoe and
exported to used by fcoe, bnx2fc, and etc.
Signed-off-by: Yi Zou <yi.zou@intel.com>
Cc: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Tested-by: Marcus Dennis <marcusx.e.dennis@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 35 | ||||
-rw-r--r-- | drivers/scsi/fcoe/fcoe_transport.c | 35 |
2 files changed, 35 insertions, 35 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 4cec9ddc03ba..64bb53156af0 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -82,7 +82,6 @@ static int fcoe_rcv(struct sk_buff *, struct net_device *, | |||
82 | struct packet_type *, struct net_device *); | 82 | struct packet_type *, struct net_device *); |
83 | static int fcoe_percpu_receive_thread(void *); | 83 | static int fcoe_percpu_receive_thread(void *); |
84 | static void fcoe_percpu_clean(struct fc_lport *); | 84 | static void fcoe_percpu_clean(struct fc_lport *); |
85 | static int fcoe_link_speed_update(struct fc_lport *); | ||
86 | static int fcoe_link_ok(struct fc_lport *); | 85 | static int fcoe_link_ok(struct fc_lport *); |
87 | 86 | ||
88 | static struct fc_lport *fcoe_hostlist_lookup(const struct net_device *); | 87 | static struct fc_lport *fcoe_hostlist_lookup(const struct net_device *); |
@@ -2388,40 +2387,6 @@ static int fcoe_ctlr_alloc(struct net_device *netdev) | |||
2388 | } | 2387 | } |
2389 | 2388 | ||
2390 | /** | 2389 | /** |
2391 | * fcoe_link_speed_update() - Update the supported and actual link speeds | ||
2392 | * @lport: The local port to update speeds for | ||
2393 | * | ||
2394 | * Returns: 0 if the ethtool query was successful | ||
2395 | * -1 if the ethtool query failed | ||
2396 | */ | ||
2397 | static int fcoe_link_speed_update(struct fc_lport *lport) | ||
2398 | { | ||
2399 | struct net_device *netdev = fcoe_netdev(lport); | ||
2400 | struct ethtool_cmd ecmd; | ||
2401 | |||
2402 | if (!__ethtool_get_settings(netdev, &ecmd)) { | ||
2403 | lport->link_supported_speeds &= | ||
2404 | ~(FC_PORTSPEED_1GBIT | FC_PORTSPEED_10GBIT); | ||
2405 | if (ecmd.supported & (SUPPORTED_1000baseT_Half | | ||
2406 | SUPPORTED_1000baseT_Full)) | ||
2407 | lport->link_supported_speeds |= FC_PORTSPEED_1GBIT; | ||
2408 | if (ecmd.supported & SUPPORTED_10000baseT_Full) | ||
2409 | lport->link_supported_speeds |= | ||
2410 | FC_PORTSPEED_10GBIT; | ||
2411 | switch (ethtool_cmd_speed(&ecmd)) { | ||
2412 | case SPEED_1000: | ||
2413 | lport->link_speed = FC_PORTSPEED_1GBIT; | ||
2414 | break; | ||
2415 | case SPEED_10000: | ||
2416 | lport->link_speed = FC_PORTSPEED_10GBIT; | ||
2417 | break; | ||
2418 | } | ||
2419 | return 0; | ||
2420 | } | ||
2421 | return -1; | ||
2422 | } | ||
2423 | |||
2424 | /** | ||
2425 | * fcoe_link_ok() - Check if the link is OK for a local port | 2390 | * fcoe_link_ok() - Check if the link is OK for a local port |
2426 | * @lport: The local port to check link on | 2391 | * @lport: The local port to check link on |
2427 | * | 2392 | * |
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c index 83e78f922054..3c6846f1268b 100644 --- a/drivers/scsi/fcoe/fcoe_transport.c +++ b/drivers/scsi/fcoe/fcoe_transport.c | |||
@@ -83,6 +83,41 @@ static struct notifier_block libfcoe_notifier = { | |||
83 | .notifier_call = libfcoe_device_notification, | 83 | .notifier_call = libfcoe_device_notification, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | /** | ||
87 | * fcoe_link_speed_update() - Update the supported and actual link speeds | ||
88 | * @lport: The local port to update speeds for | ||
89 | * | ||
90 | * Returns: 0 if the ethtool query was successful | ||
91 | * -1 if the ethtool query failed | ||
92 | */ | ||
93 | int fcoe_link_speed_update(struct fc_lport *lport) | ||
94 | { | ||
95 | struct net_device *netdev = fcoe_get_netdev(lport); | ||
96 | struct ethtool_cmd ecmd; | ||
97 | |||
98 | if (!__ethtool_get_settings(netdev, &ecmd)) { | ||
99 | lport->link_supported_speeds &= | ||
100 | ~(FC_PORTSPEED_1GBIT | FC_PORTSPEED_10GBIT); | ||
101 | if (ecmd.supported & (SUPPORTED_1000baseT_Half | | ||
102 | SUPPORTED_1000baseT_Full)) | ||
103 | lport->link_supported_speeds |= FC_PORTSPEED_1GBIT; | ||
104 | if (ecmd.supported & SUPPORTED_10000baseT_Full) | ||
105 | lport->link_supported_speeds |= | ||
106 | FC_PORTSPEED_10GBIT; | ||
107 | switch (ethtool_cmd_speed(&ecmd)) { | ||
108 | case SPEED_1000: | ||
109 | lport->link_speed = FC_PORTSPEED_1GBIT; | ||
110 | break; | ||
111 | case SPEED_10000: | ||
112 | lport->link_speed = FC_PORTSPEED_10GBIT; | ||
113 | break; | ||
114 | } | ||
115 | return 0; | ||
116 | } | ||
117 | return -1; | ||
118 | } | ||
119 | EXPORT_SYMBOL_GPL(fcoe_link_speed_update); | ||
120 | |||
86 | void __fcoe_get_lesb(struct fc_lport *lport, | 121 | void __fcoe_get_lesb(struct fc_lport *lport, |
87 | struct fc_els_lesb *fc_lesb, | 122 | struct fc_els_lesb *fc_lesb, |
88 | struct net_device *netdev) | 123 | struct net_device *netdev) |