SCSI port context.

Hi all!
I’ve got one more question on Win2K SCSI port driver functionality.

We have two identical HBAs. Will the port driver context allow us
to complete SRB came to the first HBA from context of the
second one (of course calling ScsiPortNotification with pointer to
DeviceExtension of the first HBA).

Thanks in advance.

> We have two identical HBAs. Will the port driver context allow
us

to complete SRB came to the first HBA from context of the
second one (of course calling ScsiPortNotification with pointer to

No, they have different spinlocks.

Max

Max,

Thanks for your reply.

It’s still very interesting to know how SCSI port uses spinlocks and
what exactly restictions port context applies.
We tryed to use the stack of the first HBA to “talk” to the second one. For that purpose we “remembered” DeviceExtension, passed to ScsiStartIo in
SrbExtension of corresponding Srb, then changed DeviceExtension.
And in InterruptServiceRoutine when it was time to Notify Port, we used DeviceExtension, stored in SrbExtension.
…And that realy worked.

BOOLEAN
ScsiStartIo(
IN PVOID HwDeviceExtension, //first HBA
IN PSCSI_REQUEST_BLOCK Srb
)
{
PDEV_EXTENSION pDevExt = (PDEV_EXTENSION)HwDeviceExtension;
PSRB_EXTENSION SrbExtension = (PSRB_EXTENSION)Srb->SrbExtension;

SrbExtension->pDevExt =
HwDeviceExtension; //store HwDeviceExtension of the first HBA
//in SrbExtension of corresponding Srb
pDevExt = pDevExt ->pSecondDevExt; //second HBA

…***…

}

BOOLEAN
ScsiISR (
IN PDEV_EXTENSION HwDeviceExtension //second HBA
)
{

ScsiPortNotification(
RequestComplete,SrbExtension->pDevExt , …); //Notify with
// HwDeviceExtension of the first HBA


}

Thank You in advance.
SH.

> We have two identical HBAs. Will the port driver context allow
us
> to complete SRB came to the first HBA from context of the
> second one (of course calling ScsiPortNotification with pointer to

No, they have different spinlocks.

Max

scsiport keeps HBAs completely separate. It allocates resources for a
request and tracks its state relative to the controller it was sent on.
Attempting to complete the request on a second controller could easily
corrupt the internal state of scsiport on both controllers. You could
also end up accessing resources on controller A while holding the
spinlock for controller B, another bad situation.

the fact that you didn’t see anything go wrong immediately when you did
this does not imply that you’ve found some great mechanism of getting
around scsiport. It just implies that you were lucky in testing. The
chances of your customers being that lucky is quite slim.

why are you trying to complete requests on the other controller?

-p

-----Original Message-----
From: Shaggy Head [mailto:xxxxx@hotmail.com]
Sent: Monday, June 10, 2002 3:50 AM
To: NT Developers Interest List
Subject: [ntdev] Re: SCSI port context.

Max,

Thanks for your reply.

It’s still very interesting to know how SCSI port uses spinlocks and
what exactly restictions port context applies.
We tryed to use the stack of the first HBA to “talk” to the second one.
For that purpose we “remembered” DeviceExtension, passed to ScsiStartIo
in SrbExtension of corresponding Srb, then changed DeviceExtension.
And in InterruptServiceRoutine when it was time to Notify Port, we used
DeviceExtension, stored in SrbExtension. …And that realy worked.

BOOLEAN
ScsiStartIo(
IN PVOID HwDeviceExtension, //first HBA
IN PSCSI_REQUEST_BLOCK Srb
)
{
PDEV_EXTENSION pDevExt = (PDEV_EXTENSION)HwDeviceExtension;
PSRB_EXTENSION SrbExtension = (PSRB_EXTENSION)Srb->SrbExtension;

SrbExtension->pDevExt =
HwDeviceExtension; //store HwDeviceExtension of the first
HBA
//in SrbExtension of corresponding Srb
pDevExt = pDevExt ->pSecondDevExt; //second HBA

…***…

}

BOOLEAN
ScsiISR (
IN PDEV_EXTENSION HwDeviceExtension //second HBA
)
{

ScsiPortNotification(
RequestComplete,SrbExtension->pDevExt , …); //Notify with
// HwDeviceExtension of the first
HBA


}

Thank You in advance.
SH.

> We have two identical HBAs. Will the port driver context allow
us
> to complete SRB came to the first HBA from context of the second one

> (of course calling ScsiPortNotification with pointer to

No, they have different spinlocks.

Max


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%

>the fact that you didn’t see anything go wrong immediately when you
did

this does not imply that you’ve found some great mechanism of getting
around scsiport.

There are also SCSIPORT replacements on the market, which tears away
the SCSIPORT’s synchronization limitations and allow the miniports to
be deserialized, subject to usual NT’s serialization rules.

Max