linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: vikas.chaudhary@qlogic.com
To: jbottomley@parallels.com, michaelc@cs.wisc.edu
Cc: linux-scsi@vger.kernel.org, vikas.chaudhary@qlogic.com,
	lalit.chandivade@qlogic.com, ravi.anand@qlogic.com,
	Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Subject: [PATCH 4/7] qla4xxx: Invoke DisableACB using BSG
Date: Wed, 10 Oct 2012 07:24:43 -0400	[thread overview]
Message-ID: <1349868286-13650-5-git-send-email-vikas.chaudhary@qlogic.com> (raw)
In-Reply-To: <1349868286-13650-1-git-send-email-vikas.chaudhary@qlogic.com>

From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>

Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_bsg.c |   42 ++++++++++++++++++++++++++++++++++++++++
 drivers/scsi/qla4xxx/ql4_bsg.h |    1 +
 2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_bsg.c b/drivers/scsi/qla4xxx/ql4_bsg.c
index fbe077a..f00b649 100644
--- a/drivers/scsi/qla4xxx/ql4_bsg.c
+++ b/drivers/scsi/qla4xxx/ql4_bsg.c
@@ -579,6 +579,45 @@ leave:
 	return rval;
 }
 
+static int qla4xxx_bsg_disable_acb(struct bsg_job *bsg_job)
+{
+	struct Scsi_Host *host = iscsi_job_to_shost(bsg_job);
+	struct scsi_qla_host *ha = to_qla_host(host);
+	struct iscsi_bsg_reply *bsg_reply = bsg_job->reply;
+	int rval = -EINVAL;
+
+	bsg_reply->reply_payload_rcv_len = 0;
+
+	if (unlikely(pci_channel_offline(ha->pdev)))
+		goto leave;
+
+	/* Only 4022 and above adapters are supported */
+	if (is_qla4010(ha))
+		goto leave;
+
+	if (ql4xxx_reset_active(ha)) {
+		ql4_printk(KERN_ERR, ha, "%s: reset active\n", __func__);
+		rval = -EBUSY;
+		goto leave;
+	}
+
+	rval = qla4xxx_disable_acb(ha);
+	if (rval) {
+		ql4_printk(KERN_ERR, ha, "%s: disable acb failed\n", __func__);
+		bsg_reply->result = DID_ERROR << 16;
+		rval = -EIO;
+	} else {
+		bsg_reply->result = DID_OK << 16;
+		wait_for_completion_timeout(&ha->disable_acb_comp,
+					    DISABLE_ACB_TOV * HZ);
+	}
+
+	bsg_job_done(bsg_job, bsg_reply->result,
+		     bsg_reply->reply_payload_rcv_len);
+leave:
+	return rval;
+}
+
 /**
  * qla4xxx_process_vendor_specific - handle vendor specific bsg request
  * @job: iscsi_bsg_job to handle
@@ -618,6 +657,9 @@ int qla4xxx_process_vendor_specific(struct bsg_job *bsg_job)
 	case QLISCSI_VND_SET_ACB:
 		return qla4xxx_bsg_set_acb(bsg_job);
 
+	case QLISCSI_VND_DISABLE_ACB:
+		return qla4xxx_bsg_disable_acb(bsg_job);
+
 	default:
 		ql4_printk(KERN_ERR, ha, "%s: invalid BSG vendor command: "
 			   "0x%x\n", __func__, bsg_req->msgcode);
diff --git a/drivers/scsi/qla4xxx/ql4_bsg.h b/drivers/scsi/qla4xxx/ql4_bsg.h
index 36d4979..2fd5860 100644
--- a/drivers/scsi/qla4xxx/ql4_bsg.h
+++ b/drivers/scsi/qla4xxx/ql4_bsg.h
@@ -17,5 +17,6 @@
 #define QLISCSI_VND_GET_ACB		7
 #define QLISCSI_VND_ABOUT_FIRMWARE	8
 #define QLISCSI_VND_SET_ACB		9
+#define QLISCSI_VND_DISABLE_ACB		10
 
 #endif
-- 
1.7.8.GIT


  parent reply	other threads:[~2012-10-10 11:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10 11:24 [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch vikas.chaudhary
2012-10-10 11:24 ` [PATCH 1/7] qla4xxx: Allow reset in link down case vikas.chaudhary
2012-10-10 11:24 ` [PATCH 2/7] qla4xxx: Added new BSG command QLISCSI_VND_ABOUT_FIRMWARE vikas.chaudhary
2012-10-10 11:24 ` [PATCH 3/7] qla4xxx: Invoke Set Address Control Block using BSG vikas.chaudhary
2012-10-10 11:24 ` vikas.chaudhary [this message]
2012-10-10 11:24 ` [PATCH 5/7] qla4xxx: Add get default DDB support " vikas.chaudhary
2012-10-10 11:24 ` [PATCH 6/7] qla4xxx: Add get " vikas.chaudhary
2012-10-10 11:24 ` [PATCH 7/7] qla4xxx: Update driver version to 5.03.00-k2 vikas.chaudhary
2012-10-10 16:08 ` [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch Michael Christie
2012-11-13 13:34   ` James Bottomley
2012-11-16  5:50     ` Lalit Chandivade

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=1349868286-13650-5-git-send-email-vikas.chaudhary@qlogic.com \
    --to=vikas.chaudhary@qlogic.com \
    --cc=harish.zunjarrao@qlogic.com \
    --cc=jbottomley@parallels.com \
    --cc=lalit.chandivade@qlogic.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=ravi.anand@qlogic.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).