ioctl features of scsi

A while ago I asked if ioctl interface of SCSI
supported request greater then 512 bytes and was
told the limit was 32767.

A little background into what I’m trying to do:
I’m porting a Window application to QNX4. The
application makes use of ASPI. That wasn’t
too bad to port. However I’m getting problem
when read big chunk of data.

At first I didn’t realized the Windows application made
read (READ6 command) of 32768. Curiously this
resulted in only 8 bytes being returned? I though this
was cause be 32768 being greater then 32767. I then
lower the block size to 8192, but that didn’t change
anything. I lowered it to 80 and it appears to work (not
100% sure yet), but the read speed was a low 15K/sec
as compare to 1M/sec for the Windows version (ran
on the same machine). I increased the read size to
512 and speed when up to 35k, totaly unacceptable.
I increase to 1024 but now I get the whole buffer
filled with garbage???

There does appears to be a 512 byte limit to read size,
and using the block size the speed is way way to slow.

There is lots of think I’m not sure I didn’t bread during
the porting (like transfert rate calculation…), but one think
is for sure, if I read > 512 I get garbage!

Any pointers?

I recall that the 32 bit IOCTL interface was somewhat
obscure. I think that the data was broken up into 512 byte
chunks. You might want to check your code carefully. If you
send or post it, I’ll take a look. That’s not to say that
there might not be a bug, or that it might never have worked.
I have not pushed it beyond 512 bytes.



Previously, Mario Charest wrote in qdn.public.qnx4:

A while ago I asked if ioctl interface of SCSI
supported request greater then 512 bytes and was
told the limit was 32767.

A little background into what I’m trying to do:
I’m porting a Window application to QNX4. The
application makes use of ASPI. That wasn’t
too bad to port. However I’m getting problem
when read big chunk of data.

At first I didn’t realized the Windows application made
read (READ6 command) of 32768. Curiously this
resulted in only 8 bytes being returned? I though this
was cause be 32768 being greater then 32767. I then
lower the block size to 8192, but that didn’t change
anything. I lowered it to 80 and it appears to work (not
100% sure yet), but the read speed was a low 15K/sec
as compare to 1M/sec for the Windows version (ran
on the same machine). I increased the read size to
512 and speed when up to 35k, totaly unacceptable.
I increase to 1024 but now I get the whole buffer
filled with garbage???

There does appears to be a 512 byte limit to read size,
and using the block size the speed is way way to slow.

There is lots of think I’m not sure I didn’t bread during
the porting (like transfert rate calculation…), but one think
is for sure, if I read > 512 I get garbage!

Any pointers?




\


Mitchell Schoenbrun --------- maschoen@pobox.com

“Mitchell Schoenbrun” <maschoen@pobox.com> wrote in message
news:Voyager.010715232151.229A@schoenbrun.com

I recall that the 32 bit IOCTL interface was somewhat
obscure. I think that the data was broken up into 512 byte
chunks. You might want to check your code carefully. If you
send or post it, I’ll take a look. That’s not to say that
there might not be a bug, or that it might never have worked.
I have not pushed it beyond 512 bytes.

I don’t have the source with me at this time, but basicly the program
uses the scsi interface as found in the scsi_util.tgz utility. Everything
is based on qnx_ioctlmx.

The uscsi_cmd structure is setup as the first mx[0] component.
Then the CDByte is setup as the mx[1]. Then for the reply
mx[2] is setup to the buffer where data should be dropped.



CDByte[0] = 0x08 (READ6 command)
CDByte[1] = 0
CDByte[2] = 0;
CDByte[3] = 0x20; (for 8192)
CDByte[4] = 0;

That’s it.

I’ll post some code later today!


Previously, Mario Charest wrote in qdn.public.qnx4:

A while ago I asked if ioctl interface of SCSI
supported request greater then 512 bytes and was
told the limit was 32767.

A little background into what I’m trying to do:
I’m porting a Window application to QNX4. The
application makes use of ASPI. That wasn’t
too bad to port. However I’m getting problem
when read big chunk of data.

At first I didn’t realized the Windows application made
read (READ6 command) of 32768. Curiously this
resulted in only 8 bytes being returned? I though this
was cause be 32768 being greater then 32767. I then
lower the block size to 8192, but that didn’t change
anything. I lowered it to 80 and it appears to work (not
100% sure yet), but the read speed was a low 15K/sec
as compare to 1M/sec for the Windows version (ran
on the same machine). I increased the read size to
512 and speed when up to 35k, totaly unacceptable.
I increase to 1024 but now I get the whole buffer
filled with garbage???

There does appears to be a 512 byte limit to read size,
and using the block size the speed is way way to slow.

There is lots of think I’m not sure I didn’t bread during
the porting (like transfert rate calculation…), but one think
is for sure, if I read > 512 I get garbage!

Any pointers?







\

Mitchell Schoenbrun --------- > maschoen@pobox.com

Mario Charest <mcharest@zinformatic.com> wrote:
: A while ago I asked if ioctl interface of SCSI supported request
: greater then 512 bytes and was told the limit was 32767.

I’m not sure where you were told that - in this newsgroup I posted the
(correct) answer that due to the definition of IOCPARM_MASK this limit
was 13 bits (8k-1). So if you are dealing with disk blocks, that’s 15.

“John Garvey” <jgarvey@qnx.com> wrote in message
news:9iuuo9$2j2$1@nntp.qnx.com

Mario Charest <> mcharest@zinformatic.com> > wrote:
: A while ago I asked if ioctl interface of SCSI supported request
: greater then 512 bytes and was told the limit was 32767.

I’m not sure where you were told that - in this newsgroup I posted the
(correct) answer that due to the definition of IOCPARM_MASK this limit
was 13 bits (8k-1). So if you are dealing with disk blocks, that’s 15.

My mistake sorry. However with 1K block it doesn’t work. I’m still
chassing
this in order to get more information.

“John Garvey” <jgarvey@qnx.com> wrote in message
news:9iuuo9$2j2$1@nntp.qnx.com

Mario Charest <> mcharest@zinformatic.com> > wrote:
: A while ago I asked if ioctl interface of SCSI supported request
: greater then 512 bytes and was told the limit was 32767.

I’m not sure where you were told that - in this newsgroup I posted the
(correct) answer that due to the definition of IOCPARM_MASK this limit
was 13 bits (8k-1). So if you are dealing with disk blocks, that’s 15.

In the following case does the 8k-1 limit

uscsi_cmd_t cmd;

cmd.cdblen = 6;
cmd.buflen = 8191; ??

setmx ( &mx[0], &cmd … );
setmx ( &mx[1],. cdbbuf, cmd.cdblen);
setmx ( &mx[2], buf, cmd.buflen );

qnx_ioctlmx ( fd, USCSICMD, 3, 3, mx, mx );

Can’t cmd.buflen be set greater then 8k-1? In that case the
IOCPARM_MASK should not apply right?

I’m dealing with a tape and sending a READ(6) command.

I think I’m getting to the bottom of this.

I beleive the block size for the partition (tape) I’m trying to read was
set to 32768. Because of the 8k limit I can’t read it all…
Reading the SCSI-2 spec it appears I can’t read
a block starting at a specific position inside the block.

The spec says READ(6) start reading data from the next block,
not from the current position ;-(

Even though i’m using qnx_ioctlmx, the 8k-1 limit still seems to exists ;-(

Suggestion?


“Mario Charest” <mcharest@zinformatic.com> wrote in message
news:9iuv8m$hj7$1@inn.qnx.com

“John Garvey” <> jgarvey@qnx.com> > wrote in message
news:9iuuo9$2j2$> 1@nntp.qnx.com> …
Mario Charest <> mcharest@zinformatic.com> > wrote:
: A while ago I asked if ioctl interface of SCSI supported request
: greater then 512 bytes and was told the limit was 32767.

I’m not sure where you were told that - in this newsgroup I posted the
(correct) answer that due to the definition of IOCPARM_MASK this limit
was 13 bits (8k-1). So if you are dealing with disk blocks, that’s 15.

My mistake sorry. However with 1K block it doesn’t work. I’m still
chassing
this in order to get more information.
\

“Mario Charest” <mcharest@zinformatic.com> wrote in message
news:9j28q1$jo7$1@inn.qnx.com

I think I’m getting to the bottom of this.

I beleive the block size for the partition (tape) I’m trying to read was
set to 32768. Because of the 8k limit I can’t read it all…
Reading the SCSI-2 spec it appears I can’t read
a block starting at a specific position inside the block.

The spec says READ(6) start reading data from the next block,
not from the current position ;-(

Even though i’m using qnx_ioctlmx, the 8k-1 limit still seems to exists
;-(

I’m now sure that if the write was done with a size of 32768 the
read must also be done with 32768. So looks like I’m in trouble.
Anyway to fix this? Is this technicaly complexe for QNX to
expand the maximum size to say 64k (the uscsi_cdm buf len
is an unsigned short…)


Suggestion?


“Mario Charest” <> mcharest@zinformatic.com> > wrote in message
news:9iuv8m$hj7$> 1@inn.qnx.com> …

“John Garvey” <> jgarvey@qnx.com> > wrote in message
news:9iuuo9$2j2$> 1@nntp.qnx.com> …
Mario Charest <> mcharest@zinformatic.com> > wrote:
: A while ago I asked if ioctl interface of SCSI supported request
: greater then 512 bytes and was told the limit was 32767.

I’m not sure where you were told that - in this newsgroup I posted the
(correct) answer that due to the definition of IOCPARM_MASK this limit
was 13 bits (8k-1). So if you are dealing with disk blocks, that’s
15.

My mistake sorry. However with 1K block it doesn’t work. I’m still
chassing
this in order to get more information.


\

“Mario Charest” <mcharest@zinformatic.com> wrote in message
news:9j4gem$2nc$1@inn.qnx.com

“Mario Charest” <> mcharest@zinformatic.com> > wrote in message
news:9j28q1$jo7$> 1@inn.qnx.com> …

I think I’m getting to the bottom of this.

I beleive the block size for the partition (tape) I’m trying to read was
set to 32768. Because of the 8k limit I can’t read it all…
Reading the SCSI-2 spec it appears I can’t read
a block starting at a specific position inside the block.

The spec says READ(6) start reading data from the next block,
not from the current position ;-(

Even though i’m using qnx_ioctlmx, the 8k-1 limit still seems to exists
;-(


I’m now sure that if the write was done with a size of 32768 the
read must also be done with 32768. So looks like I’m in trouble.
Anyway to fix this? Is this technicaly complexe for QNX to
expand the maximum size to say 64k (the uscsi_cdm buf len
is an unsigned short…)

Would begging help get an answer?

Suggestion?


“Mario Charest” <> mcharest@zinformatic.com> > wrote in message
news:9iuv8m$hj7$> 1@inn.qnx.com> …

“John Garvey” <> jgarvey@qnx.com> > wrote in message
news:9iuuo9$2j2$> 1@nntp.qnx.com> …
Mario Charest <> mcharest@zinformatic.com> > wrote:
: A while ago I asked if ioctl interface of SCSI supported request
: greater then 512 bytes and was told the limit was 32767.

I’m not sure where you were told that - in this newsgroup I posted
the
(correct) answer that due to the definition of IOCPARM_MASK this
limit
was 13 bits (8k-1). So if you are dealing with disk blocks, that’s
15.

My mistake sorry. However with 1K block it doesn’t work. I’m still
chassing
this in order to get more information.




\