From: Andrew Vasquez <andrew.vasquez@qlogic.com>
To: SCSI Mailing List <linux-scsi@vger.kernel.org>,
James Bottomley <James.Bottomley@steeleye.com>
Subject: PATCH [7/18] qla2xxx: Tape command handling fixes
Date: Mon, 21 Jun 2004 22:53:32 -0700 [thread overview]
Message-ID: <20040622055332.GA8432@linux.local.home> (raw)
ChangeSet
1.1843 04/06/04 08:09:21 andrew.vasquez@apc.qlogic.com +3 -0
Fix several tape handling issue:
1) When the firmware receives the LOGO from the device, any
active exchanges will be returned with a completion status
of 0x29 -- this will cause the port to be marked as lost and
request made to the DPC routine to begin a relogin attempt.
The problem is, since we've never actually logged out of the
device and cannot do so in interrupt context, we must be
sure to perform the logout before the qla2x00_fabric_login()
in the RELOGIN_NEEDED code.
2) Sets the Get Port Database options to ZERO when issuing
the call to qla2x00_get_port_database(). This consolidates
actuall login handling in the place it should be, in the
previous qla2x00_fabric_login() call rather than depending
on any 'hidden' behaviour of the firmware. If a device did
a LOGO after the login, then any subsequent exachanges will
be returned with an 0x29 completion status and the
RELOGIN_NEEDED code will handle the login.
3) Finally, if the master and slave state do not indicate a
logged-in state from the Get Port Database call, then one
cannot depend on the information returned from the firmware
-- the firmware typically wipes out the PCB information for
a given loopID when logged out. So, return immediately with
a failed status.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
drivers/scsi/qla2xxx/qla_init.c | 2 -
drivers/scsi/qla2xxx/qla_mbx.c | 54 ++++++++++++++++++++--------------------
drivers/scsi/qla2xxx/qla_os.c | 9 +++++-
3 files changed, 36 insertions(+), 29 deletions(-)
diff -Nru a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
--- a/drivers/scsi/qla2xxx/qla_init.c 2004-06-21 15:37:56 -07:00
+++ b/drivers/scsi/qla2xxx/qla_init.c 2004-06-21 15:37:56 -07:00
@@ -2886,7 +2886,7 @@
rval = qla2x00_fabric_login(ha, fcport, next_loopid);
if (rval == QLA_SUCCESS) {
- rval = qla2x00_get_port_database(ha, fcport, BIT_1 | BIT_0);
+ rval = qla2x00_get_port_database(ha, fcport, 0);
if (rval != QLA_SUCCESS) {
qla2x00_fabric_logout(ha, fcport->loop_id);
} else {
diff -Nru a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
--- a/drivers/scsi/qla2xxx/qla_mbx.c 2004-06-21 15:37:56 -07:00
+++ b/drivers/scsi/qla2xxx/qla_mbx.c 2004-06-21 15:37:56 -07:00
@@ -1431,35 +1431,37 @@
mcp->flags = MBX_DMA_IN;
mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2);
rval = qla2x00_mailbox_command(ha, mcp);
+ if (rval != QLA_SUCCESS)
+ goto gpd_error_out;
- if (rval == QLA_SUCCESS) {
- /* Names are little-endian. */
- memcpy(fcport->node_name, pd->node_name, WWN_SIZE);
- memcpy(fcport->port_name, pd->port_name, WWN_SIZE);
-
- /* Get port_id of device. */
- fcport->d_id.b.al_pa = pd->port_id[2];
- fcport->d_id.b.area = pd->port_id[3];
- fcport->d_id.b.domain = pd->port_id[0];
- fcport->d_id.b.rsvd_1 = 0;
-
- /* Check for device require authentication. */
- pd->common_features & BIT_5 ? (fcport->flags |= FCF_AUTH_REQ) :
- (fcport->flags &= ~FCF_AUTH_REQ);
-
- /* If not target must be initiator or unknown type. */
- if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0) {
- fcport->port_type = FCT_INITIATOR;
- } else {
- fcport->port_type = FCT_TARGET;
-
- /* Check for logged in. */
- if (pd->master_state != PD_STATE_PORT_LOGGED_IN &&
- pd->slave_state != PD_STATE_PORT_LOGGED_IN)
- rval = QLA_FUNCTION_FAILED;
- }
+ /* Check for logged in state. */
+ if (pd->master_state != PD_STATE_PORT_LOGGED_IN &&
+ pd->slave_state != PD_STATE_PORT_LOGGED_IN) {
+ rval = QLA_FUNCTION_FAILED;
+ goto gpd_error_out;
}
+ /* Names are little-endian. */
+ memcpy(fcport->node_name, pd->node_name, WWN_SIZE);
+ memcpy(fcport->port_name, pd->port_name, WWN_SIZE);
+
+ /* Get port_id of device. */
+ fcport->d_id.b.al_pa = pd->port_id[2];
+ fcport->d_id.b.area = pd->port_id[3];
+ fcport->d_id.b.domain = pd->port_id[0];
+ fcport->d_id.b.rsvd_1 = 0;
+
+ /* Check for device require authentication. */
+ pd->common_features & BIT_5 ? (fcport->flags |= FCF_AUTH_REQ) :
+ (fcport->flags &= ~FCF_AUTH_REQ);
+
+ /* If not target must be initiator or unknown type. */
+ if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0)
+ fcport->port_type = FCT_INITIATOR;
+ else
+ fcport->port_type = FCT_TARGET;
+
+gpd_error_out:
pci_free_consistent(ha->pdev, PORT_DATABASE_SIZE, pd, pd_dma);
if (rval != QLA_SUCCESS) {
diff -Nru a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c 2004-06-21 15:37:56 -07:00
+++ b/drivers/scsi/qla2xxx/qla_os.c 2004-06-21 15:37:56 -07:00
@@ -3428,10 +3428,15 @@
fcport->login_retry) {
fcport->login_retry--;
- if (fcport->flags & FCF_FABRIC_DEVICE)
+ if (fcport->flags & FCF_FABRIC_DEVICE) {
+ if (fcport->flags &
+ FCF_TAPE_PRESENT)
+ qla2x00_fabric_logout(
+ ha,
+ fcport->loop_id);
status = qla2x00_fabric_login(
ha, fcport, &next_loopid);
- else
+ } else
status =
qla2x00_local_device_login(
ha, fcport->loop_id);
reply other threads:[~2004-06-22 5:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20040622055332.GA8432@linux.local.home \
--to=andrew.vasquez@qlogic.com \
--cc=James.Bottomley@steeleye.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