public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: linux-scsi@vger.kernel.org
Cc: abjoglek@cisco.com, giridhar.malavali@qlogic.com,
	james.smart@emulex.com, bprakash@broadcom.com
Subject: [RFC PATCH v2 09/10] fc: Add a hbaapi_lib attribute to the fcport structure
Date: Fri, 11 Mar 2011 13:55:16 -0800	[thread overview]
Message-ID: <20110311215516.18760.39185.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20110311215428.18760.80632.stgit@localhost6.localdomain6>

Currently, libhbalinux, a LGPL implementation of the
HBAAPI interface relies on the sub-string " over " in
the host's symbolic_name to determine if the library
is responsible for the driver. This is obviously error
prone, so this patch adds a new attribute so the LLD
can specify it's HBAAPI library.

Since both fcoe and fnic use libhbalinux I've update
those drivers to use this new attribute.

Signed-off-by: Robert Love <robert.w.love@intel.com>
---
 drivers/fc/fcport.c      |    2 ++
 drivers/scsi/fcoe/fcoe.c |    4 ++++
 include/fc/fc.h          |   10 +++++++++-
 3 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/fc/fcport.c b/drivers/fc/fcport.c
index 299f220..2a6cd5d 100644
--- a/drivers/fc/fcport.c
+++ b/drivers/fc/fcport.c
@@ -113,6 +113,7 @@ static FC_DEVICE_ATTR(fcport, speed, S_IRUGO, show_port_speed, NULL);
 
 fc_port_rd_attr(maxframe_size, "%u bytes\n", 20);
 fc_port_rd_attr(serial_number, "%s\n", (FC_SERIAL_NUMBER_SIZE + 1));
+fc_port_rd_attr(hbaapi_lib, "%s\n", (FC_HBAAPI_LIB_SIZE + 1));
 
 /* used by supported_speeds */
 static ssize_t show_port_supported_speeds(struct device *dev,
@@ -312,6 +313,7 @@ struct fc_port *fc_port_add(struct device *pdev,
 	FC_SETUP_COND_ATTR_RD(fcport, supported_classes);
 	FC_SETUP_COND_ATTR_RD(fcport, serial_number);
 	FC_SETUP_COND_ATTR_RD(fcport, speed);
+	FC_SETUP_COND_ATTR_RD(fcport, hbaapi_lib);
 
 	BUG_ON(count > FC_PORT_NUM_ATTRS);
 	FC_CREATE_ATTRS(fcport, count);
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 8603b8c..230f047 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -195,6 +195,7 @@ struct fc_port_function_template fcoe_fcport_fcn_tmpl = {
 	.show_fcport_supported_fc4s = 1,
 	.show_fcport_active_fc4s = 1,
 	.show_fcport_serial_number = 1,
+	.show_fcport_hbaapi_lib = 1,
 
 	.dd_fcport_size = sizeof(struct fcoe_interface),
 
@@ -442,6 +443,9 @@ static struct fcoe_interface *fcoe_interface_create(struct net_device *netdev,
 		goto out;
  	}
 
+	strncpy(fc_port_hbaapi_lib(fcport), LIBHBALINUX,
+		strlen(LIBHBALINUX));
+
 	fcoe = fc_port_priv(fcport);
 
 	dev_hold(netdev);
diff --git a/include/fc/fc.h b/include/fc/fc.h
index 6158095..270be37 100644
--- a/include/fc/fc.h
+++ b/include/fc/fc.h
@@ -359,7 +359,7 @@ struct _fc_cos_names {
 #define	dev_to_fcrport(d)			\
 	container_of((d), struct fc_rport, dev)
 
-#define FC_PORT_NUM_ATTRS    9
+#define FC_PORT_NUM_ATTRS   10
 #define FC_VPORT_NUM_ATTRS  16
 #define FC_RPORT_NUM_ATTRS   9
 #define FC_FABRIC_NUM_ATTRS  6
@@ -591,6 +591,9 @@ static inline void *fc_fabric_priv(const struct fc_fabric *fcfabric)
 #define fcfabric_to_fcport(x)			\
 	dev_to_fcport((x)->dev.parent)
 
+#define FC_HBAAPI_LIB_SIZE 80
+#define LIBHBALINUX        "libhbalinux"
+
 struct fc_port_function_template {
 	void (*get_fcport_speed)(struct fc_port *);
 	void (*get_fcport_active_fc4s)(struct fc_port *);
@@ -605,6 +608,7 @@ struct fc_port_function_template {
 	unsigned long show_fcport_active_fc4s:1;
 	unsigned long show_fcport_supported_classes:1;
 	unsigned long show_fcport_serial_number:1;
+	unsigned long show_fcport_hbaapi_lib:1;
 
 	u32 dd_fcport_size;
 
@@ -640,6 +644,8 @@ struct fc_port {
 	u32  maxframe_size;
 	u32  supported_classes;
 	char serial_number[FC_SERIAL_NUMBER_SIZE];
+	char hbaapi_lib[FC_HBAAPI_LIB_SIZE];
+
 
 	/* Dynamic Attributes*/
 	u8 active_fc4s[FC_FC4_LIST_SIZE];
@@ -690,6 +696,8 @@ static inline void *fc_port_priv(const struct fc_port *fcport)
 	((x)->supported_classes)
 #define fc_port_serial_number(x)		\
 	((x)->serial_number)
+#define fc_port_hbaapi_lib(x)			\
+	((x)->hbaapi_lib)
 
 /*
  * FC Virtual Port Attributes


  parent reply	other threads:[~2011-03-11 21:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11 21:54 [RFC PATCH v2 00/10] FC Sysfs and FCoE attributes Robert Love
2011-03-11 21:54 ` [RFC PATCH v2 01/10] libfcoe: Remove mutex_trylock/restart_syscall checks Robert Love
2011-03-11 21:54 ` [RFC PATCH v2 02/10] fcoe: " Robert Love
2011-03-11 21:54 ` [RFC PATCH v2 03/10] fc: Create FC sybsystem Robert Love
2011-03-11 21:54 ` [RFC PATCH v2 04/10] scsi_transport_fcp: Create FC/SCSI interaction layer Robert Love
2011-03-11 21:54 ` [RFC PATCH v2 05/10] libfc, libfcoe, fcoe: Make use of FC subsystem Robert Love
2011-03-11 21:55 ` [RFC PATCH v2 06/10] fc: Add FCoE attributes to FC sysfs Robert Love
2011-03-11 21:55 ` [RFC PATCH v2 07/10] libfcoe, fcoe: Use FCoE attributes Robert Love
2011-03-11 21:55 ` [RFC PATCH v2 08/10] fnic: Convert to new FC Sysfs infrastructure Robert Love
2011-03-11 21:55 ` Robert Love [this message]
2011-03-11 21:55 ` [RFC PATCH v2 10/10] Documentation: Add fc_sysfs document Robert Love

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=20110311215516.18760.39185.stgit@localhost6.localdomain6 \
    --to=robert.w.love@intel.com \
    --cc=abjoglek@cisco.com \
    --cc=bprakash@broadcom.com \
    --cc=giridhar.malavali@qlogic.com \
    --cc=james.smart@emulex.com \
    --cc=linux-scsi@vger.kernel.org \
    /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