All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Hicks <mort@wildopensource.com>
To: andrew.vasquez@qlogic.com
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH] Add FC transport attributes support to qla2xxx
Date: Mon, 22 Mar 2004 13:40:05 -0500	[thread overview]
Message-ID: <20040322184005.GT19428@localhost> (raw)

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]


Hi Andrew,

Here is a patch that adds FC transport attributes to the qla2xxx driver.
The patch should apply cleanly to a recent 2.6 kernel with the FC
attributes update that I just sent to linux-scsi.

There are two patches.  The first one contains the driver changes and
the second one contains a Kconfig update.

thanks
mh

-- 
Martin Hicks                Wild Open Source Inc.
mort@wildopensource.com     613-266-2296

[-- Attachment #2: qla2xxx-trans-attrs.patch --]
[-- Type: text/plain, Size: 4015 bytes --]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1814  -> 1.1815 
#	drivers/scsi/qla2xxx/qla_os.h	1.2     -> 1.3    
#	drivers/scsi/qla2xxx/qla_os.c	1.6     -> 1.7    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/03/22	mort@tomahawk.engr.sgi.com	1.1815
# Update qla2xxx to export a few attributes to sysfs using
# the Transport attributes API
# --------------------------------------------
#
diff -Nru a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c	Mon Mar 22 09:13:23 2004
+++ b/drivers/scsi/qla2xxx/qla_os.c	Mon Mar 22 09:13:23 2004
@@ -175,6 +175,8 @@
 	.max_sectors		= 0xFFFF,
 };
 
+static struct scsi_transport_template *qla2xxx_transport_template = NULL;
+
 static void qla2x00_display_fc_names(scsi_qla_host_t *);
 
 void qla2x00_blink_led(scsi_qla_host_t *);
@@ -1766,7 +1768,7 @@
 }
 
 /**************************************************************************
-* qla2x00_slave_configure
+* qla2xxx_slave_configure
 *
 * Description:
 **************************************************************************/
@@ -2061,6 +2063,8 @@
 	host->max_cmd_len = MAX_CMDSZ;
 	host->max_channel = ha->ports - 1;
 	host->max_lun = ha->max_luns;
+	BUG_ON(qla2xxx_transport_template == NULL);
+	host->transportt = qla2xxx_transport_template;
 	host->unique_id = ha->instance;
 	host->max_id = ha->max_targets;
 
@@ -4448,6 +4452,64 @@
 	return -ETIMEDOUT;
 }
 
+static void
+qla2xxx_get_port_id(struct scsi_device *sdev)
+{
+	scsi_qla_host_t *ha = to_qla_host(sdev->host);
+	struct fc_port *fc;
+
+	list_for_each_entry(fc, &ha->fcports, list) {
+		if (fc->os_target_id == sdev->id) {
+			fc_port_id(sdev) = fc->d_id.b.domain << 16 |
+				fc->d_id.b.area << 8 | 
+				fc->d_id.b.al_pa;
+			return;
+		}
+	}
+	fc_port_id(sdev) = -1;
+}
+
+static void
+qla2xxx_get_port_name(struct scsi_device *sdev)
+{
+	scsi_qla_host_t *ha = to_qla_host(sdev->host);
+	struct fc_port *fc;
+
+	list_for_each_entry(fc, &ha->fcports, list) {
+		if (fc->os_target_id == sdev->id) {
+			fc_port_name(sdev) =
+				__be64_to_cpu(*(uint64_t *)fc->port_name);
+			return;
+		}
+	}
+	fc_port_name(sdev) = -1;
+}
+
+static void
+qla2xxx_get_node_name(struct scsi_device *sdev)
+{
+	scsi_qla_host_t *ha = to_qla_host(sdev->host);
+	struct fc_port *fc;
+
+	list_for_each_entry(fc, &ha->fcports, list) {
+		if (fc->os_target_id == sdev->id) {
+			fc_node_name(sdev) =
+				__be64_to_cpu(*(uint64_t *)fc->node_name);
+			return;
+		}
+	}
+	fc_node_name(sdev) = -1;
+}
+
+static struct fc_function_template qla2xxx_transport_functions = {
+	.get_port_id = qla2xxx_get_port_id,
+	.show_port_id = 1,
+	.get_port_name = qla2xxx_get_port_name,
+	.show_port_name = 1,
+	.get_node_name = qla2xxx_get_node_name,
+	.show_node_name = 1,
+};
+
 /**
  * qla2x00_module_init - Module initialization.
  **/
@@ -4470,6 +4532,10 @@
 		return -ENOMEM;
 	}
 
+	qla2xxx_transport_template = fc_attach_transport(&qla2xxx_transport_functions);
+	if (!qla2xxx_transport_template)
+		return -ENODEV;
+
 	printk(KERN_INFO
 	    "QLogic Fibre Channel HBA Driver (%p)\n", qla2x00_set_info);
 
@@ -4491,6 +4557,8 @@
 		}
 		srb_cachep = NULL;
 	}
+
+	fc_release_transport(qla2xxx_transport_template);
 }
 
 module_init(qla2x00_module_init);
diff -Nru a/drivers/scsi/qla2xxx/qla_os.h b/drivers/scsi/qla2xxx/qla_os.h
--- a/drivers/scsi/qla2xxx/qla_os.h	Mon Mar 22 09:13:23 2004
+++ b/drivers/scsi/qla2xxx/qla_os.h	Mon Mar 22 09:13:23 2004
@@ -45,6 +45,7 @@
 #include <linux/bio.h>
 #include <linux/moduleparam.h>
 #include <linux/capability.h>
+#include <linux/list.h>
 
 #include <asm/system.h>
 
@@ -62,6 +63,8 @@
 
 #include <scsi/scsicam.h>
 #include <scsi/scsi_ioctl.h>
+#include <scsi/scsi_transport.h>
+#include <scsi/scsi_transport_fc.h>
 
 //TODO Fix this!!!
 /*

[-- Attachment #3: qla2xxx-trans-attrs-Kconfig.patch --]
[-- Type: text/plain, Size: 2110 bytes --]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1832  -> 1.1833 
#	drivers/scsi/qla2xxx/Kconfig	1.5     -> 1.6    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/03/22	mort@tomahawk.engr.sgi.com	1.1833
# Make all qla2xxx drivers require FC transport attributes
# --------------------------------------------
#
diff -Nru a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig
--- a/drivers/scsi/qla2xxx/Kconfig	Mon Mar 22 10:29:07 2004
+++ b/drivers/scsi/qla2xxx/Kconfig	Mon Mar 22 10:29:07 2004
@@ -6,18 +6,21 @@
 config SCSI_QLA21XX
 	tristate "QLogic ISP2100 host adapter family support"
 	depends on SCSI_QLA2XXX
+        select SCSI_FC_ATTRS
 	---help---
 	This driver supports the QLogic 21xx (ISP2100) host adapter family.
 
 config SCSI_QLA22XX
 	tristate "QLogic ISP2200 host adapter family support"
 	depends on SCSI_QLA2XXX
+        select SCSI_FC_ATTRS
 	---help---
 	This driver supports the QLogic 22xx (ISP2200) host adapter family.
 
 config SCSI_QLA2300
 	tristate "QLogic ISP2300 host adapter family support"
 	depends on SCSI_QLA2XXX
+        select SCSI_FC_ATTRS
 	---help---
 	This driver supports the QLogic 2300 (ISP2300, and ISP2312) host
 	adapter family.
@@ -25,17 +28,20 @@
 config SCSI_QLA2322
 	tristate "QLogic ISP2322 host adapter family support"
 	depends on SCSI_QLA2XXX
+        select SCSI_FC_ATTRS
 	---help---
 	This driver supports the QLogic 2322 (ISP2322) host adapter family.
 
 config SCSI_QLA6312
 	tristate "QLogic ISP6312 host adapter family support"
 	depends on SCSI_QLA2XXX
+        select SCSI_FC_ATTRS
 	---help---
 	This driver supports the QLogic 6312 (ISP6312) host adapter family.
 
 config SCSI_QLA6322
 	tristate "QLogic ISP6322 host adapter family support"
 	depends on SCSI_QLA2XXX
+        select SCSI_FC_ATTRS
 	---help---
 	This driver supports the QLogic 6322 (ISP6322) host adapter family.

             reply	other threads:[~2004-03-22 18:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-22 18:40 Martin Hicks [this message]
2004-03-23 18:44 ` [PATCH] Add FC transport attributes support to qla2xxx Andrew Vasquez

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=20040322184005.GT19428@localhost \
    --to=mort@wildopensource.com \
    --cc=andrew.vasquez@qlogic.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.