linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Vasquez <andrew.vasquez@qlogic.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
	Linux-SCSI Mailing List <linux-scsi@vger.kernel.org>,
	James Smart <james.smart@emulex.com>
Subject: Re: [PATCH 11/12] qla2xxx: Add an 'Issue LIP' device attribute.
Date: Thu, 27 Oct 2005 16:03:37 -0700	[thread overview]
Message-ID: <20051027230337.GE7889@plap.qlogic.org> (raw)
In-Reply-To: <20051014094843.GB22347@infradead.org>

On Fri, 14 Oct 2005, Christoph Hellwig wrote:

> On Thu, Oct 13, 2005 at 04:17:24PM -0700, Andrew Vasquez wrote:
> > Subject: Add an 'Issue LIP' device attribute.
> > 
> > Add a scsi_host device attribute to allow a user to initiate
> > a LIP.
> 
> This kind of thing belongs into the transport class so that we have
> a common API over all HBA drivers.

Ok, here's a patch to add such a common API for fc transport users.
Relevant LLD changes (lpfc and qla2xxx) also present.

Reasonable?

--
AV

---

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 2cab556..0467422 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -222,7 +222,7 @@ static void fc_rport_terminate(struct fc
  */
 #define FC_STARGET_NUM_ATTRS 	3
 #define FC_RPORT_NUM_ATTRS	9
-#define FC_HOST_NUM_ATTRS	15
+#define FC_HOST_NUM_ATTRS	16
 
 struct fc_internal {
 	struct scsi_transport_template t;
@@ -715,9 +715,11 @@ static FC_CLASS_DEVICE_ATTR(host, field,
 	count++
 
 #define SETUP_PRIVATE_HOST_ATTRIBUTE_RW(field)			\
+{									\
 	i->private_host_attrs[count] = class_device_attr_host_##field;	\
 	i->host_attrs[count] = &i->private_host_attrs[count];		\
-	count++
+	count++;							\
+}
 
 
 /* Fixed Host Attributes */
@@ -848,6 +850,26 @@ static FC_CLASS_DEVICE_ATTR(host, tgtid_
 			show_fc_private_host_tgtid_bind_type,
 			store_fc_private_host_tgtid_bind_type);
 
+static ssize_t
+store_fc_private_host_issue_lip(struct class_device *cdev,
+	const char *buf, size_t count)
+{
+	struct Scsi_Host *shost = transport_class_to_shost(cdev);
+	struct fc_internal *i = to_fc_internal(shost->transportt);
+	int ret;
+
+	/* ignore any data value written to the attribute */
+	if (i->f->issue_fc_host_lip) {
+		ret = i->f->issue_fc_host_lip(shost);
+		return ret ? ret: count;
+	}
+
+	return -ENOENT;
+}
+
+static FC_CLASS_DEVICE_ATTR(host, issue_lip, S_IWUSR, NULL,
+			store_fc_private_host_issue_lip);
+
 /*
  * Host Statistics Management
  */
@@ -1114,6 +1136,8 @@ fc_attach_transport(struct fc_function_t
 
 	/* Transport-managed attributes */
 	SETUP_PRIVATE_HOST_ATTRIBUTE_RW(tgtid_bind_type);
+	if (ft->issue_fc_host_lip)
+		SETUP_PRIVATE_HOST_ATTRIBUTE_RW(issue_lip);
 
 	BUG_ON(count > FC_HOST_NUM_ATTRS);
 
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index b0d4454..4496b32 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -384,6 +384,8 @@ struct fc_function_template {
 	struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *);
 	void	(*reset_fc_host_stats)(struct Scsi_Host *);
 
+	int	(*issue_fc_host_lip)(struct Scsi_Host *);
+
 	/* allocation lengths for host-specific data */
 	u32	 			dd_fcrport_size;
 
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index acae7c4..445da1d 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -200,19 +200,13 @@ lpfc_num_discovered_ports_show(struct cl
 }
 
 
-static ssize_t
-lpfc_issue_lip (struct class_device *cdev, const char *buf, size_t count)
+static int
+lpfc_issue_lip(struct Scsi_Host *host)
 {
-	struct Scsi_Host *host = class_to_shost(cdev);
 	struct lpfc_hba *phba = (struct lpfc_hba *) host->hostdata[0];
-	int val = 0;
 	LPFC_MBOXQ_t *pmboxq;
 	int mbxstatus = MBXERR_ERROR;
 
-	if ((sscanf(buf, "%d", &val) != 1) ||
-	    (val != 1))
-		return -EINVAL;
-
 	if ((phba->fc_flag & FC_OFFLINE_MODE) ||
 	    (phba->hba_state != LPFC_HBA_READY))
 		return -EPERM;
@@ -234,7 +228,7 @@ lpfc_issue_lip (struct class_device *cde
 	if (mbxstatus == MBXERR_ERROR)
 		return -EIO;
 
-	return strlen(buf);
+	return 0;
 }
 
 static ssize_t
@@ -364,7 +358,6 @@ static CLASS_DEVICE_ATTR(lpfc_drvr_versi
 			 NULL);
 static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show,
 			 NULL);
-static CLASS_DEVICE_ATTR(issue_lip, S_IWUSR, NULL, lpfc_issue_lip);
 static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR,
 			 lpfc_board_online_show, lpfc_board_online_store);
 
@@ -537,7 +530,6 @@ struct class_device_attribute *lpfc_host
 	&class_device_attr_lpfc_max_luns,
 	&class_device_attr_nport_evt_cnt,
 	&class_device_attr_management_version,
-	&class_device_attr_issue_lip,
 	&class_device_attr_board_online,
 	NULL,
 };
@@ -1234,6 +1226,8 @@ struct fc_function_template lpfc_transpo
 
 	.get_starget_port_name = lpfc_get_starget_port_name,
 	.show_starget_port_name = 1,
+
+	.issue_fc_host_lip = lpfc_issue_lip,
 };
 
 void
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index fc25cd8..d921725 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -432,6 +432,15 @@ qla2x00_set_rport_loss_tmo(struct fc_rpo
 	rport->dev_loss_tmo = ha->port_down_retry_count + 5;
 }
 
+static int
+qla2x00_issue_lip(struct Scsi_Host *shost)
+{
+	scsi_qla_host_t *ha = to_qla_host(shost);
+
+	set_bit(LOOP_RESET_NEEDED, &ha->dpc_flags);
+	return 0;
+}
+
 struct fc_function_template qla2xxx_transport_functions = {
 
 	.show_host_node_name = 1,
@@ -455,6 +464,7 @@ struct fc_function_template qla2xxx_tran
 	.set_rport_dev_loss_tmo = qla2x00_set_rport_loss_tmo,
 	.show_rport_dev_loss_tmo = 1,
 
+	.issue_fc_host_lip = qla2x00_issue_lip,
 };
 
 void
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 8982978..9d90558 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2186,6 +2186,12 @@ qla2x00_do_dpc(void *data)
 			    ha->host_no));
 		}
 
+		if (test_and_clear_bit(LOOP_RESET_NEEDED, &ha->dpc_flags)) {
+			DEBUG(printk("scsi(%ld): dpc: sched loop_reset()\n",
+			    ha->host_no));
+			qla2x00_loop_reset(ha);
+		}
+
 		if (test_and_clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) &&
 		    (!(test_and_set_bit(RESET_ACTIVE, &ha->dpc_flags)))) {
 
@@ -2487,6 +2493,7 @@ qla2x00_timer(scsi_qla_host_t *ha)
 	/* Schedule the DPC routine if needed */
 	if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
 	    test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) ||
+	    test_bit(LOOP_RESET_NEEDED, &ha->dpc_flags) ||
 	    start_dpc ||
 	    test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags) ||
 	    test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) ||

  parent reply	other threads:[~2005-10-27 23:03 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-13 23:15 [PATCH 0/16] qla2xxx: update qla2xxx driver to 8.01.02-k Andrew Vasquez
2005-10-13 23:15 ` [PATCH 1/12] qla2xxx: Correct issue where fcport is prematurely marked DEAD Andrew Vasquez
2005-10-13 23:15 ` [PATCH 2/12] qla2xxx: Add support to dynamically enable/disable ZIO Andrew Vasquez
2005-10-13 23:16 ` [PATCH 3/12] qla2xxx: Collapse ISP2xxx queuecommand implementations Andrew Vasquez
2005-10-14 10:24   ` Christoph Hellwig
2005-10-14 22:43     ` Andrew Vasquez
2005-10-13 23:16 ` [PATCH 4/12] qla2xxx: Update license Andrew Vasquez
2005-10-14  7:30   ` Arjan van de Ven
2005-10-14 13:37     ` Douglas Gilbert
2005-10-14 13:53       ` Arjan van de Ven
2005-10-14 16:27     ` Andrew Vasquez
2005-10-14 18:47       ` Arjan van de Ven
2005-10-19 17:37         ` Andrew Vasquez
2005-10-19 17:43           ` Christoph Hellwig
2005-10-19 17:50             ` Andrew Vasquez
2005-10-19 18:22               ` Christoph Hellwig
2005-10-19 18:18           ` Arjan van de Ven
2005-10-15 11:56   ` Christoph Hellwig
2005-10-16  0:38     ` Douglas Gilbert
2005-10-16  8:32       ` Arjan van de Ven
2005-10-13 23:16 ` [PATCH 5/12] qla2xxx: Add support for embedded ISP24xx firmware Andrew Vasquez
2005-10-14  9:47   ` Christoph Hellwig
2005-10-14 16:50     ` Andrew Vasquez
2005-10-15 11:58       ` Christoph Hellwig
2005-10-17 21:34         ` Andrew Vasquez
2005-10-19 16:19           ` Christoph Hellwig
2005-10-13 23:16 ` [PATCH 6/12] qla2xxx: Resync with latest released firmware -- 4.00.12 Andrew Vasquez
2005-10-13 23:16 ` [PATCH 7/12] qla2xxx: Add hotplug firmware-load support for all ISP types Andrew Vasquez
2005-10-13 23:16 ` [PATCH 8/12] qla2xxx: Resync with latest released ISP23xx/63xx firmware -- 3.03.18 Andrew Vasquez
2005-10-13 23:17 ` [PATCH 9/12] qla2xxx: Use midlayer's int_to_scsilun() function Andrew Vasquez
2005-10-15 11:58   ` Christoph Hellwig
2005-10-13 23:17 ` [PATCH 10/12] qla2xxx: Correct fw-loader module-use referencing Andrew Vasquez
2005-10-13 23:17 ` [PATCH 11/12] qla2xxx: Add an 'Issue LIP' device attribute Andrew Vasquez
2005-10-14  9:48   ` Christoph Hellwig
2005-10-14 22:44     ` Andrew Vasquez
2005-10-27 23:03     ` Andrew Vasquez [this message]
2005-10-28 22:53       ` Christoph Hellwig
2005-10-13 23:17 ` [PATCH 12/12] qla2xxx: Update version number to 8.01.02-k Andrew Vasquez
2005-10-19 17:42 ` [PATCH 0/16] qla2xxx: update qla2xxx driver " Andrew Vasquez
2005-10-20 23:47   ` James Bottomley
2005-10-21 21:07     ` 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=20051027230337.GE7889@plap.qlogic.org \
    --to=andrew.vasquez@qlogic.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=hch@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).