Date: Thu, 25 Mar 1999 09:48:15 -0700 (MST) From: "Kenneth D. Merry" <ken@plutotech.com> To: amobbs@allstor-sw.co.uk Cc: freebsd-scsi@FreeBSD.ORG Subject: Re: CAM flags Message-ID: <199903251648.JAA86680@panzer.plutotech.com> In-Reply-To: <8025673F.0056448A.00@mail.plasmon.co.uk> from "amobbs@allstor-sw.co.uk" at "Mar 25, 1999 3:42:15 pm"
index | next in thread | previous in thread | raw e-mail
amobbs@allstor-sw.co.uk wrote...
>
> Could somebody please explain what effect "CAM_DEV_QFRZDIS" has, beyond
> "Disable DEV Q freezing", i.e. what is "DEV Q freezing", do I want it
> disabled, and if so, why?
Whenever an error occurs for a SCSI CCB, the command queue for the device
in question is frozen until error recovery actions have completed.
If you're writing an application that goes through the passthrough driver,
and you want to do your own error recovery, you'll probably want to disable
queue freezing since you control your own queue of commands, and can do
your own error recovery.
Otherwise, you'll have to unfreeze the queue if an error occurs. You can
tell if the queue has been frozen by looking at the CAM_DEV_QFRZN bit of
the status field in the CCB header.
This only applies when autosense is enabled, which is the default. If
autosense is disabled (CAM_DIS_AUTOSENSE), the controller won't freeze
the queue in case of an error.
> In general, what flags should I use? I'm writing a driver to use the
> passthrough device driver, for both control and I/O. I've got
> CAM_PASS_ERR_RECOVER and the appropriate direction flag for a given
> command, is there anything else I should be aware of?
Well, you'll only need to set the direction flag if you're using
cam_fill_csio(), since all of the CCB building functions automatically set
the direction flags properly. Remember to use CAM_DIR_NONE if the command
does not transfer any data. (like Test Unit Ready)
The CAM_PASS_ERR_RECOVER flag causes the kernel to do error recovery
actions for commands that fail. For instance, if a device returns
0x04,0x02 (logical unit not ready, initializing command required), the
error recovery code will issue a start unit command to try to spin it up.
If the device returns 0x04,{0x00,0x01}, the error recovery code will send
a test unit ready command every .5 seconds for a minute before giving up
on the device becoming ready.
Turning on the kernel's error recovery code is also necessary for retry
counts to be honored at all. Without error recovery turned on, a command
will not be retried. (since that is, by definition, a form of error
recovery)
If you want to do something other than the default kernel error recovery
actions, you should disable queue freezing, and don't use the kernel's
error recovery. It all depends on how simple or complex your application
is. If you're writing a complex application, you may want to do your own
error recovery. If it's a simple application (e.g. camcontrol), the
kernel's error recovery may be sufficient.
As for which flags to use, I think that pretty much covers it.
Ken
--
Kenneth Merry
ken@plutotech.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903251648.JAA86680>
