linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: linux-scsi@vger.kernel.org
Cc: Bhanu Prakash Gollapudi <bprakash@broadcom.com>,
	Marcus Dennis <marcusx.e.dennis@intel.com>,
	Yi Zou <yi.zou@intel.com>
Subject: [PATCH 11/16] libfcoe, fcoe: move fcoe_link_speed_update() to libfcoe and export it
Date: Wed, 12 Dec 2012 15:23:02 -0800	[thread overview]
Message-ID: <20121212232302.13084.54816.stgit@fritz> (raw)
In-Reply-To: <20121212232203.13084.3630.stgit@fritz>

From: Yi Zou <yi.zou@intel.com>

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>
---
 drivers/scsi/fcoe/fcoe.c           |   35 -----------------------------------
 drivers/scsi/fcoe/fcoe_transport.c |   35 +++++++++++++++++++++++++++++++++++
 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 4cec9dd..64bb531 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 *,
 		    struct packet_type *, struct net_device *);
 static int fcoe_percpu_receive_thread(void *);
 static void fcoe_percpu_clean(struct fc_lport *);
-static int fcoe_link_speed_update(struct fc_lport *);
 static int fcoe_link_ok(struct fc_lport *);
 
 static struct fc_lport *fcoe_hostlist_lookup(const struct net_device *);
@@ -2388,40 +2387,6 @@ static int fcoe_ctlr_alloc(struct net_device *netdev)
 }
 
 /**
- * fcoe_link_speed_update() - Update the supported and actual link speeds
- * @lport: The local port to update speeds for
- *
- * Returns: 0 if the ethtool query was successful
- *          -1 if the ethtool query failed
- */
-static int fcoe_link_speed_update(struct fc_lport *lport)
-{
-	struct net_device *netdev = fcoe_netdev(lport);
-	struct ethtool_cmd ecmd;
-
-	if (!__ethtool_get_settings(netdev, &ecmd)) {
-		lport->link_supported_speeds &=
-			~(FC_PORTSPEED_1GBIT | FC_PORTSPEED_10GBIT);
-		if (ecmd.supported & (SUPPORTED_1000baseT_Half |
-				      SUPPORTED_1000baseT_Full))
-			lport->link_supported_speeds |= FC_PORTSPEED_1GBIT;
-		if (ecmd.supported & SUPPORTED_10000baseT_Full)
-			lport->link_supported_speeds |=
-				FC_PORTSPEED_10GBIT;
-		switch (ethtool_cmd_speed(&ecmd)) {
-		case SPEED_1000:
-			lport->link_speed = FC_PORTSPEED_1GBIT;
-			break;
-		case SPEED_10000:
-			lport->link_speed = FC_PORTSPEED_10GBIT;
-			break;
-		}
-		return 0;
-	}
-	return -1;
-}
-
-/**
  * fcoe_link_ok() - Check if the link is OK for a local port
  * @lport: The local port to check link on
  *
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index 83e78f9..3c6846f 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 = {
 	.notifier_call = libfcoe_device_notification,
 };
 
+/**
+ * fcoe_link_speed_update() - Update the supported and actual link speeds
+ * @lport: The local port to update speeds for
+ *
+ * Returns: 0 if the ethtool query was successful
+ *          -1 if the ethtool query failed
+ */
+int fcoe_link_speed_update(struct fc_lport *lport)
+{
+	struct net_device *netdev = fcoe_get_netdev(lport);
+	struct ethtool_cmd ecmd;
+
+	if (!__ethtool_get_settings(netdev, &ecmd)) {
+		lport->link_supported_speeds &=
+			~(FC_PORTSPEED_1GBIT | FC_PORTSPEED_10GBIT);
+		if (ecmd.supported & (SUPPORTED_1000baseT_Half |
+				      SUPPORTED_1000baseT_Full))
+			lport->link_supported_speeds |= FC_PORTSPEED_1GBIT;
+		if (ecmd.supported & SUPPORTED_10000baseT_Full)
+			lport->link_supported_speeds |=
+				FC_PORTSPEED_10GBIT;
+		switch (ethtool_cmd_speed(&ecmd)) {
+		case SPEED_1000:
+			lport->link_speed = FC_PORTSPEED_1GBIT;
+			break;
+		case SPEED_10000:
+			lport->link_speed = FC_PORTSPEED_10GBIT;
+			break;
+		}
+		return 0;
+	}
+	return -1;
+}
+EXPORT_SYMBOL_GPL(fcoe_link_speed_update);
+
 void __fcoe_get_lesb(struct fc_lport *lport,
 		     struct fc_els_lesb *fc_lesb,
 		     struct net_device *netdev)
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 746bc58..6c59ba7 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,
 		     struct net_device *netdev);
 void fcoe_wwn_to_str(u64 wwn, char *buf, int len);
 int fcoe_validate_vport_create(struct fc_vport *vport);
+int fcoe_link_speed_update(struct fc_lport *);
 
 /**
  * is_fip_mode() - returns true if FIP mode selected.


  parent reply	other threads:[~2012-12-12 23:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12 23:22 [PATCH 00/16] libfc, libfcoe and fcoe updates for 3.8 Robert Love
2012-12-12 23:22 ` [PATCH 01/16] libfc: fix REC handling Robert Love
2012-12-12 23:22 ` [PATCH 02/16] Documentation: Add missing devices/ to devices path Robert Love
2012-12-12 23:22 ` [PATCH 03/16] libfcoe: Save some memory and optimize name lookups Robert Love
2012-12-13  7:54   ` Bart Van Assche
2012-12-14 18:36     ` Love, Robert W
2012-12-14 22:02   ` [PATCH v2] " Robert Love
2012-12-17 14:26     ` Neil Horman
2012-12-12 23:22 ` [PATCH 04/16] libfcoe: Add fcoe_sysfs debug logging level Robert Love
2012-12-12 23:22 ` [PATCH 05/16] libfcoe, fcoe, bnx2fc: Add new fcoe control interface Robert Love
2012-12-16 19:50   ` Bhanu Prakash Gollapudi
2012-12-12 23:22 ` [PATCH 06/16] fcoe: Use the fcoe_sysfs " Robert Love
2012-12-12 23:22 ` [PATCH 07/16] bnx2fc: " Robert Love
2012-12-12 23:22 ` [PATCH 08/16] libfc, libfcoe, fcoe: Convert debug_logging macros to pr_info Robert Love
2012-12-12 23:22 ` [PATCH 09/16] fcoe: prep work to start consolidate the usage of fcoe_netdev Robert Love
2012-12-12 23:22 ` [PATCH 10/16] fcoe: add support to the get_netdev() for fcoe_interface Robert Love
2012-12-12 23:23 ` Robert Love [this message]
2012-12-12 23:23 ` [PATCH 12/16] libfcoe, fcoe: consolidate the fcoe_ctlr_get_lesb/fcoe_get_lesb Robert Love
2012-12-12 23:23 ` [PATCH 13/16] bnx2fc: add support to get_netdev for bnx2f_interface Robert Love
2012-12-12 23:23 ` [PATCH 14/16] bnx2fc: use fcoe_link_speed_update() from the exported symbol in libfcoe Robert Love
2012-12-12 23:23 ` [PATCH 15/16] bnx2fc: use fcoe_get_lesb/fcoe_ctlr_get_lesb() directly from libfcoe Robert Love
2012-12-12 23:23 ` [PATCH 16/16] debris left by "[SCSI] libfcoe: Remove mutex_trylock/restart_syscall checks" Robert Love
2012-12-16 19:56 ` [PATCH 00/16] libfc, libfcoe and fcoe updates for 3.8 Bhanu Prakash Gollapudi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121212232302.13084.54816.stgit@fritz \
    --to=robert.w.love@intel.com \
    --cc=bprakash@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=marcusx.e.dennis@intel.com \
    --cc=yi.zou@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).