Subject: Re: CVS commit: src/dist/iscsi
To: Alistair G. Crooks <agc@netbsd.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: source-changes
Date: 03/30/2006 20:02:08
--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Mar 23, 2006 at 12:01:48AM +0000, Alistair G. Crooks wrote:
>=20
> Module Name:	src
> Committed By:	agc
> Date:		Thu Mar 23 00:01:48 UTC 2006
>=20
> Modified Files:
> 	src/dist/iscsi/include: scsi_cmd_codes.h
> 	src/dist/iscsi/src: disk.c
>=20
> Log Message:
> First stab at implementing INQUIRY for Vital Product Data, aka Page 83
> information in the Solaris initiator, with information taken from
> SPC3, T10/1416-D Revision 23, from www.t10.org.
>=20
> This is untested, work-in-progress.

This change isn't fully correct (which I expect you knew :-)

The concept behind the "done" variable is wrong. If you see the VPD bit is=
=20
set, you should NEVER send back non-VPD data.

For readability, I recommend folding the inquiry code into its own file.=20

So the default: code in the switch(cdb[2]) block also needs changing. As=20
per SPC2 (7.3.4) and SPC3 (6.4.4), if the VPD info isn't known about, you=
=20
are supposed to terminate the task with CHECK CONDITION status, with the
sense key set to ILLEGAL REQUEST and ASC/Q INVALID FIELD IN CDB.

strlcpy() aren't correct for inquiry data. They NUL-terminate the=20
string, while the vendor, product, and are fixed-length, space-filled=20
strings. Also, the product revision field is only 4 characters.

The VPD info isn't right, either. The INQUIRY_DEVICE_ISCSI_PROTOCOL use=20
needs the PIV bit set.

I recommend factoring the VPD identifier info into: a) build outer frame,
b) shove VPD identifiers into it. The number of identifiers will grow over
time (you already are supposed to really have almost the same identifier
for the LU too; you should have something for
INQUIRY_DEVICE_ASSOCIATION_TARGET_LU).

If you haven't already, I recommend registering "NetBSD" as a SCSI vendor.=
=20
It's free, you just send an EMail to some address at t10.

Take care,

Bill

--ew6BAiZeqk4r7MaW
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFELKnAWz+3JHUci9cRAi8bAJ48DblVWrxeFGf3yynZAWXaqTSqYwCfSZQv
8Y8pkQfDJjnj0KxW1WR90aw=
=gnkz
-----END PGP SIGNATURE-----

--ew6BAiZeqk4r7MaW--