easily exceeds the maximum of 256 tags used by the scsipi layer because
the tag information from the scsipi layer was ignored and all the tagging
is handled implicitly internal to ciss(4). But with the DIAGNOSTIC option,
the scsipi layer does a check for > 256 tags and will panic. So, lets just
limit the adapt_max_periph to 256 so the scsipi layer won't try to user more.
queueing at the scsipi midlayer, and if the midlayer is not requested to
enable tagged queueing, the midlayer will only queue one command to the
adapter driver for each device. The SmartArray adapter is capable of
handling multiple commands, and in the rather common case where there is
no battery backup and no write cache, doing single write commands is very
slow. The SmartArray adapter runs much better when several commands can
be issued to a device.
This has been observed and discussed in several list threads, notably:
http://mail-index.NetBSD.org/netbsd-users/2008/10/01/msg002083.htmlhttp://mail-index.NetBSD.org/tech-kern/2008/11/30/msg003704.html
This also addresses PR kern/39686.
To enable tagged queueing, the adapter driver responds to the midlayer
request to set the transfer mode. However, the SmartArray does not respond
to the SCSI INQUIRY command with an ANSII field of 2 or more, so the
scsipi midlayer will ignore the CmdQue bit in the flags3 field of the
inquiry data. This fix will patch the inquiry data so set the ANSII field
to 2, and responds to the midlayer request to set the transfer mode by
requesting tagged queueing.
In addition, the original port of the driver did not set up the adapter
parameters correctly as mentioned in the second list thread mentioned
above. The adapt_openings is the total number of commands that the
adapter will accept rather than the number of commands divided by the
number of logical drives. Also, the adapt_max_periph is the maximum number
of commands which can be queued per peripheral device, not the number of
logical drives [which in the case of a single logical drive limited the
number of commands queued to 1].
I'm also suppressing an error message for invalid commands if the error
was due to the SCSI_SYNCHRONIZE_CACHE_10 command, since that command is
not supported by the SmartArray adapter, but used with wapbl(4) meta-data
journaling. Setting the ANSII version to 2 to allow enabling tagged queueing
also enables the use of the SCSI_SYNCHRONIZE_CACHE_10 command.
To paraphrase:
Some ciss(4) firmwares use different physical drive addressing, resulting
in bioctl(8) functions not being available.
Tested on both types of controller.
physical drives belong to which logical drive, so all the physical drives
will show up for logical drive 0, and also appear for logical drives that
are rebuilding so that the rebuild state will show the physical drive
being rebuilt. Locking for the scratch buffer is currently missing - system
quickly quits responding when I try to lock the buffer with mutex_{enter,exit}().
After revision 1.135 of scsipi_base.c, it's a big no-no to set
XS_STS_DONE before calling scsipi_done(). Besides, scsipi_done()
sets XS_STS_DONE itself after checking that it's not already set.
This puts this driver back in working order; before this change
the probe of the logical drives would cause a hang.