linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chad Dupuis <chad.dupuis@qlogic.com>
To: jbottomley@parallels.com
Cc: giridhar.malavali@qlogic.com, chad.dupuis@qlogic.com,
	andrew.vasquez@qlogic.com, linux-scsi@vger.kernel.org
Subject: [PATCH 12/29] qla2xxx: Prep zero-length BSG data-transfer requests.
Date: Thu, 9 Feb 2012 11:15:44 -0800	[thread overview]
Message-ID: <1328814961-21866-13-git-send-email-chad.dupuis@qlogic.com> (raw)
In-Reply-To: <1328814961-21866-1-git-send-email-chad.dupuis@qlogic.com>

From: Andrew Vasquez <andrew.vasquez@qlogic.com>

During command failure/non-recognition, the upper-layer
FC-transport expects the drivers to set
job-reply->reply_payload_rcv_len.  Do this in a consistent manner
to avoid duplication.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
---
 drivers/scsi/qla2xxx/qla_bsg.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index b2b6644..0207143 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -108,8 +108,6 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
 	uint32_t len;
 	uint32_t oper;
 
-	bsg_job->reply->reply_payload_rcv_len = 0;
-
 	if (!(IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) || IS_QLA82XX(ha))) {
 		ret = -EINVAL;
 		goto exit_fcp_prio_cfg;
@@ -729,7 +727,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
 			if (qla81xx_get_port_config(vha, config)) {
 				ql_log(ql_log_warn, vha, 0x701f,
 				    "Get port config failed.\n");
-				bsg_job->reply->reply_payload_rcv_len = 0;
 				bsg_job->reply->result = (DID_ERROR << 16);
 				rval = -EPERM;
 				goto done_free_dma_req;
@@ -743,8 +740,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
 					new_config)) {
 					ql_log(ql_log_warn, vha, 0x7024,
 					    "Internal loopback failed.\n");
-					bsg_job->reply->reply_payload_rcv_len =
-						0;
 					bsg_job->reply->result =
 						(DID_ERROR << 16);
 					rval = -EPERM;
@@ -756,8 +751,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
 				 */
 				if (qla81xx_reset_internal_loopback(vha,
 					config, 1)) {
-					bsg_job->reply->reply_payload_rcv_len =
-						0;
 					bsg_job->reply->result =
 						(DID_ERROR << 16);
 					rval = -EPERM;
@@ -794,7 +787,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
 					    "MPI reset failed.\n");
 				}
 
-				bsg_job->reply->reply_payload_rcv_len = 0;
 				bsg_job->reply->result = (DID_ERROR << 16);
 				rval = -EIO;
 				goto done_free_dma_req;
@@ -819,7 +811,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
 		fw_sts_ptr += sizeof(response);
 		*fw_sts_ptr = command_sent;
 		rval = 0;
-		bsg_job->reply->reply_payload_rcv_len = 0;
 		bsg_job->reply->result = (DID_ERROR << 16);
 	} else {
 		ql_dbg(ql_dbg_user, vha, 0x702d,
@@ -878,7 +869,7 @@ qla84xx_reset(struct fc_bsg_job *bsg_job)
 	if (rval) {
 		ql_log(ql_log_warn, vha, 0x7030,
 		    "Vendor request 84xx reset failed.\n");
-		rval = bsg_job->reply->reply_payload_rcv_len = 0;
+		rval = 0;
 		bsg_job->reply->result = (DID_ERROR << 16);
 
 	} else {
@@ -977,9 +968,8 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
 		ql_log(ql_log_warn, vha, 0x7037,
 		    "Vendor request 84xx updatefw failed.\n");
 
-		rval = bsg_job->reply->reply_payload_rcv_len = 0;
+		rval = 0;
 		bsg_job->reply->result = (DID_ERROR << 16);
-
 	} else {
 		ql_dbg(ql_dbg_user, vha, 0x7038,
 		    "Vendor request 84xx updatefw completed.\n");
@@ -1165,7 +1155,7 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
 		ql_log(ql_log_warn, vha, 0x7043,
 		    "Vendor request 84xx mgmt failed.\n");
 
-		rval = bsg_job->reply->reply_payload_rcv_len = 0;
+		rval = 0;
 		bsg_job->reply->result = (DID_ERROR << 16);
 
 	} else {
@@ -1216,8 +1206,6 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
 	uint16_t mb[MAILBOX_REGISTER_COUNT];
 	uint8_t *rsp_ptr = NULL;
 
-	bsg_job->reply->reply_payload_rcv_len = 0;
-
 	if (!IS_IIDMA_CAPABLE(vha->hw)) {
 		ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n");
 		return -EINVAL;
@@ -1310,8 +1298,6 @@ qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, scsi_qla_host_t *vha,
 	int valid = 0;
 	struct qla_hw_data *ha = vha->hw;
 
-	bsg_job->reply->reply_payload_rcv_len = 0;
-
 	if (unlikely(pci_channel_offline(ha->pdev)))
 		return -EINVAL;
 
@@ -1623,6 +1609,9 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
 	struct Scsi_Host *host;
 	scsi_qla_host_t *vha;
 
+	/* In case no data transferred. */
+	bsg_job->reply->reply_payload_rcv_len = 0;
+
 	if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) {
 		rport = bsg_job->rport;
 		fcport = *(fc_port_t **) rport->dd_data;
@@ -1661,6 +1650,7 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
 	case FC_BSG_RPT_CT:
 	default:
 		ql_log(ql_log_warn, vha, 0x705a, "Unsupported BSG request.\n");
+		bsg_job->reply->result = ret;
 		break;
 	}
 	return ret;
-- 
1.6.0.2



  parent reply	other threads:[~2012-02-09 19:32 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09 19:15 [PATCH 00/29] qla2xxx: Patches for scsi-misc Chad Dupuis
2012-02-09 19:15 ` [PATCH 01/29] qla2xxx: Enhanced the dump routines to capture multiple request and response queues Chad Dupuis
2012-02-09 19:15 ` [PATCH 02/29] qla2xxx: Enhancements to support ISP83xx Chad Dupuis
2012-02-09 19:15 ` [PATCH 03/29] qla2xxx: Use a valid enode-mac if none defined Chad Dupuis
2012-02-09 19:15 ` [PATCH 04/29] qla2xxx: Consolidation of SRB processing Chad Dupuis
2012-02-09 19:15 ` [PATCH 05/29] qla2xxx: Use consistent DL mask for ELS/CT passthru requests Chad Dupuis
2012-02-09 19:15 ` [PATCH 06/29] qla2xxx: Correct print format for edc ql_log() calls Chad Dupuis
2012-02-09 19:15 ` [PATCH 07/29] qla2xxx: Handle change notifications based on switch scan results Chad Dupuis
2012-02-09 19:15 ` [PATCH 08/29] qla2xxx: Return blank sysfs string on initial get thermal failure Chad Dupuis
2012-02-09 19:15 ` [PATCH 09/29] qla2xxx: Increase speed of flash access in ISP82xx adapters to improve firmware load speed Chad Dupuis
2012-02-09 19:15 ` [PATCH 10/29] qla2xxx: Handle failure cases during fabric_login Chad Dupuis
2012-02-09 19:15 ` [PATCH 11/29] qla2xxx: Perform implicit logout during rport tear-down Chad Dupuis
2012-02-09 19:15 ` Chad Dupuis [this message]
2012-02-09 19:15 ` [PATCH 13/29] qla2xxx: Reduce mbx-command timeout for Login/Logout requests Chad Dupuis
2012-02-09 19:15 ` [PATCH 14/29] qla2xxx: Print mailbox command opcode and return code when a command times out Chad Dupuis
2012-02-09 19:15 ` [PATCH 15/29] qla2xxx: Convert remaining printk's to ql_log format Chad Dupuis
2012-02-09 19:15 ` [PATCH 16/29] qla2xxx: Use ql_log* #define's in ql_log() and ql_log_pci() Chad Dupuis
2012-02-09 19:15 ` [PATCH 17/29] qla2xxx: Fix ql_dbg arguments Chad Dupuis
2012-02-09 19:15 ` [PATCH 18/29] qla2xxx: Add new message when a new loopid is assigned Chad Dupuis
2012-02-09 19:15 ` [PATCH 19/29] qla2xxx: Log messages to use correct vha Chad Dupuis
2012-02-09 19:15 ` [PATCH 20/29] qla2xxx: Change the log message when previous dump is available to retrieve for ISP82xx Chad Dupuis
2012-02-09 19:15 ` [PATCH 21/29] qla2xxx: Perform firmware dump procedure on mailbox command timeout Chad Dupuis
2012-02-09 19:15 ` [PATCH 22/29] qla2xxx: Update LICENSE.qla2xxx Chad Dupuis
2012-02-09 19:15 ` [PATCH 23/29] qla2xxx: Remove EDC sysfs interface Chad Dupuis
2012-02-09 19:15 ` [PATCH 24/29] qla2xxx: Cache swl during fabric discovery Chad Dupuis
2012-02-09 19:15 ` [PATCH 25/29] qla2xxx: Add ha->max_fibre_devices to keep track of the maximum number of targets Chad Dupuis
2012-02-19 14:33   ` James Bottomley
2012-02-09 19:15 ` [PATCH 26/29] qla2xxx: Handle device mapping changes due to device logout Chad Dupuis
2012-02-09 19:15 ` [PATCH 27/29] qla2xxx: Fix incorrect register access in qla2x00_start_iocbs() Chad Dupuis
2012-02-09 19:16 ` [PATCH 28/29] qla2xxx: Stop iteration after first failure in *_id functions Chad Dupuis
2012-02-09 19:16 ` [PATCH 29/29] qla2xxx: Avoid invalid request queue dereference for bad response packets Chad Dupuis

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=1328814961-21866-13-git-send-email-chad.dupuis@qlogic.com \
    --to=chad.dupuis@qlogic.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=giridhar.malavali@qlogic.com \
    --cc=jbottomley@parallels.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).