diff options
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 35 | ||||
-rw-r--r-- | drivers/scsi/fcoe/fcoe_transport.c | 35 | ||||
-rw-r--r-- | include/scsi/libfcoe.h | 1 |
3 files changed, 36 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) |
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index 746bc587ae34..6c59ba7af28a 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
@@ -260,6 +260,7 @@ void __fcoe_get_lesb(struct fc_lport *lport, struct fc_els_lesb *fc_lesb, | |||
260 | struct net_device *netdev); | 260 | struct net_device *netdev); |
261 | void fcoe_wwn_to_str(u64 wwn, char *buf, int len); | 261 | void fcoe_wwn_to_str(u64 wwn, char *buf, int len); |
262 | int fcoe_validate_vport_create(struct fc_vport *vport); | 262 | int fcoe_validate_vport_create(struct fc_vport *vport); |
263 | int fcoe_link_speed_update(struct fc_lport *); | ||
263 | 264 | ||
264 | /** | 265 | /** |
265 | * is_fip_mode() - returns true if FIP mode selected. | 266 | * is_fip_mode() - returns true if FIP mode selected. |