RE: PATCH [2/18] qla2xxx: Correct residual counts

Andrew Vasquez
2004-06-22T14:19:32Z

On Tuesday, June 22, 2004 12:07 AM, Arjan van de Ven wrote:
> On Tue, 2004-06-22 at 07:49, Andrew Vasquez wrote:
>
> > diff -Nru a/drivers/scsi/qla2xxx/qla_iocb.c
> b/drivers/scsi/qla2xxx/qla_iocb.c
> > --- a/drivers/scsi/qla2xxx/qla_iocb.c 2004-06-21 15:36:37 -07:00
> > +++ b/drivers/scsi/qla2xxx/qla_iocb.c 2004-06-21 15:36:37 -07:00 @@
> > -43,7 +43,7 @@ else if (cmd->sc_data_direction ==
> > DMA_FROM_DEVICE) cflags = CF_READ; else {
> > - switch (cmd->data_cmnd[0]) {
> > + switch (cmd->cmnd[0]) {
> > case WRITE_6:
> > case WRITE_10:
> > case WRITE_12:
>
> this sounds wrong.
>

Yes, it is _wrong_! This code is baggage left behind from earlier
drivers when we were 'asked' to work around certain applications'
inability to properly construct commands.

> Is there any reason qlogic drivers can't use/trust the midlayer
> instead of doing qla2x00_get_cmd_direction() to reverse engineer to
> direction ??

Sure. Especially considering an earlier thread:

http://marc.theaimsgroup.com/?t=108727983000002&r=1&w=2

Regards,
Andrew Vasquez

===== drivers/scsi/qla2xxx/qla_iocb.c 1.9 vs edited =====
--- 1.9/drivers/scsi/qla2xxx/qla_iocb.c 2004-06-03 15:44:16 -07:00
+++ edited/drivers/scsi/qla2xxx/qla_iocb.c 2004-06-22 07:11:11 -07:00
@@ -42,28 +42,6 @@
cflags = CF_WRITE;
else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
cflags = CF_READ;
- else {
- switch (cmd->cmnd[0]) {
- case WRITE_6:
- case WRITE_10:
- case WRITE_12:
- case WRITE_BUFFER:
- case WRITE_LONG:
- case WRITE_SAME:
- case WRITE_VERIFY:
- case WRITE_VERIFY_12:
- case FORMAT_UNIT:
- case SEND_VOLUME_TAG:
- case MODE_SELECT:
- case SEND_DIAGNOSTIC:
- case MODE_SELECT_10:
- cflags = CF_WRITE;
- break;
- default:
- cflags = CF_READ;
- break;
- }
- }
return (cflags);
}