public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qla2xxx data transfer direction
@ 2004-05-13 14:12 Tony Battersby
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Battersby @ 2004-05-13 14:12 UTC (permalink / raw)
  To: andrew.vasquez; +Cc: linux-scsi

I am using a QLogic QLA2200 under Linux 2.4.26 with qla2200.o version
6.06.10 from QLogic's website.

The qla2200 driver doesn't do auto-sense if the sense length is greater
than 32 bytes.  When a command fails with check condition and the driver
doesn't do auto-sense, the SCSI midlayer sends a request sense command
with scsi_cmnd::cmnd holding the request sense CDB and
scsi_cmnd::data_cmnd holding the CDB of the failed command.  The qla2200
driver determines the expected data direction by looking at
scsi_cmnd::data_cmd[0].  If the original command was a data out command
(e.g. mode select), then the qla2200 driver sets the data direction for
the request sense command incorrectly, causing it to fail.  The midlayer
gets into an endless loop trying to retrieve the sense data.

The following patch fixes the problem.  Note that there are a few other
uses of scsi_cmnd::data_cmnd in qla2x00.c under #if VSA, but I'm not
sure if they are correct or not.  Someone else will have to determine
that.

Anthony J. Battersby
Cybernetics

--- drivers/scsi/qla2xxx/qla2x00.c.orig	Thu May 13 09:24:22 2004
+++ drivers/scsi/qla2xxx/qla2x00.c	Thu May 13 09:29:05 2004
@@ -9642,7 +9642,7 @@
 		if (1)
 #endif //__VMWARE__
 		{
-			switch (cmd->data_cmnd[0]) {
+			switch (cmd->cmnd[0]) {
 				case FORMAT_UNIT:
 				case WRITE_6:
 				case MODE_SELECT:
@@ -9666,7 +9666,7 @@
 			}
 		}
 #else
-		switch (cmd->data_cmnd[0]) {
+		switch (cmd->cmnd[0]) {
 			case FORMAT_UNIT:
 			case WRITE_6:
 			case MODE_SELECT:
@@ -10173,7 +10173,7 @@
 		if (1)
 #endif //__VMWARE__
 		{
-			switch (cmd->data_cmnd[0]) {
+			switch (cmd->cmnd[0]) {
 				case FORMAT_UNIT:
 				case WRITE_6:
 				case MODE_SELECT:
@@ -10197,7 +10197,7 @@
 			}
 		}
 #else
-		switch (cmd->data_cmnd[0]) {
+		switch (cmd->cmnd[0]) {
 			case FORMAT_UNIT:
 			case WRITE_6:
 			case MODE_SELECT:



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] qla2xxx data transfer direction
@ 2004-05-13 14:49 Andrew Vasquez
  2004-05-13 21:51 ` Amit D. Chaudhary
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Vasquez @ 2004-05-13 14:49 UTC (permalink / raw)
  To: tonyb; +Cc: linux-scsi


On Thursday, May 13, 2004 7:13 AM, Tony Battersby wrote:

> I am using a QLogic QLA2200 under Linux 2.4.26 with qla2200.o
> version 6.06.10 from QLogic's website.
> 
> The qla2200 driver doesn't do auto-sense if the sense length is
> greater than 32 bytes.  When a command fails with check condition
> and the driver doesn't do auto-sense, the SCSI midlayer sends a
> request sense command with scsi_cmnd::cmnd holding the request sense
> CDB and scsi_cmnd::data_cmnd holding the CDB of the failed command.
> The qla2200 driver determines the expected data direction by looking
> at scsi_cmnd::data_cmd[0].  If the original command was a data out
> command (e.g. mode select), then the qla2200 driver sets the data
> direction for the request sense command incorrectly, causing it to
> fail.  The midlayer gets into an endless loop trying to retrieve the
> sense data.
> 

Yes -- this interrogation of the the CDB to determinine the
data-direction, should _really_ not be in the driver.  Unfortunately,
we have encountered numerous cases of SG callers never even bothering
to set the direction properly for the commands they send down.

> The following patch fixes the problem.  Note that there are a few
> other uses of scsi_cmnd::data_cmnd in qla2x00.c under #if VSA, but
> I'm not sure if they are correct or not.  Someone else will have to
> determine that. 
>

Thanks for the patch and your efforts at refining (fixing :) the
driver logic.  Neither the 6.x or 7.x series drivers (those for 2.4.x)
are integrated into the mainline kernels, so you don't necessarily
need to CC linux-scsi.  Just send either myself the patches and/or
support@qlogic.com -- and they will get properly routed.

Regards,
Andrew Vasquez

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] qla2xxx data transfer direction
  2004-05-13 14:49 [PATCH] qla2xxx data transfer direction Andrew Vasquez
@ 2004-05-13 21:51 ` Amit D. Chaudhary
  0 siblings, 0 replies; 3+ messages in thread
From: Amit D. Chaudhary @ 2004-05-13 21:51 UTC (permalink / raw)
  To: Andrew Vasquez, tonyb, linux-scsi



Andrew Vasquez wrote:

> Thanks for the patch and your efforts at refining (fixing :) the
> driver logic.  Neither the 6.x or 7.x series drivers (those for 2.4.x)
> are integrated into the mainline kernels, so you don't necessarily
> need to CC linux-scsi.  Just send either myself the patches and/or
> support@qlogic.com -- and they will get properly routed.
Actually I would recommend sending it to linux-scsi as it is 
informational both from a user and educational point of view.

Amit

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-13 21:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-13 14:49 [PATCH] qla2xxx data transfer direction Andrew Vasquez
2004-05-13 21:51 ` Amit D. Chaudhary
  -- strict thread matches above, loose matches on Subject: below --
2004-05-13 14:12 Tony Battersby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox