> 1) I set the parameters u seggested, as well as
AutoRequestSense, but
how to handle sense data? Do I need to fill in sense data?
When you have an error to report, you copy/make the sense data into the
SenseInfoBuffer for that request.
My routine that does this is:
static ULONG
XenVbd_MakeSense(PXENVBD_DEVICE_DATA xvdd, PSCSI_REQUEST_BLOCK srb,
UCHAR sense_key, UCHAR additional_sense_code)
{
PSENSE_DATA sd = srb->SenseInfoBuffer;
UNREFERENCED_PARAMETER(xvdd);
if (!srb->SenseInfoBuffer)
return 0;
sd->ErrorCode = 0x70;
sd->Valid = 1;
sd->SenseKey = sense_key;
sd->AdditionalSenseLength = sizeof(SENSE_DATA) -
FIELD_OFFSET(SENSE_DATA, AdditionalSenseLength);
sd->AdditionalSenseCode = additional_sense_code;
return sizeof(SENSE_DATA);
}
Which is called by:
static VOID
XenVbd_MakeAutoSense(PXENVBD_DEVICE_DATA xvdd, PSCSI_REQUEST_BLOCK srb)
{
if (srb->SrbStatus == SRB_STATUS_SUCCESS || srb->SrbFlags &
SRB_FLAGS_DISABLE_AUTOSENSE)
return;
XenVbd_MakeSense(xvdd, srb, xvdd->last_sense_key,
xvdd->last_additional_sense_code);
srb->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID;
}
I can’t remember if you are dealing with a physical block device that
might report real errors. In my case all I get from my underlying
storage is a flag that tells me an error occurred, so my last_sense_key
is SCSI_SENSE_MEDIUM_ERROR and my last_additional_sense_code is
SCSI_ADSENSE_NO_SENSE. There really isn’t much else to report in my
case, but you may get more information so maybe you can map your errors
to SCSI errors in a useful way.
- Is there a possibility that SCSI port queued the IOs
internally, but
send those requests to miniport sequentially? Now that the HBA can
handle
requests simutaneously, and send out an interrupt after it finished
those
commands. I just cannot write more than 1 SRB to HBA before HBA send
out an
interrupt. That is really the bottleneck of this driver.
Are you saying that your HBA can only accept one request at a time, or
that you get an interrupt per request and you only want an interrupt
once a few requests are ready?
James