Pseudo SCSI Miniport driver

Hi all,
I am writing a pseudo scsi miniport driver (i am new to NT). I cannot
complete the IO requests in the StartIo function itself. I have created a
thread that will finish the job and call ScsiPortNotification to complete
the request. But this is not working. ScsiPort driver times out and
invokes the “ResetBus” function. In the resetbus fn i just say
“ScsiPortNotification(NextRequest, devExt)”.

How to solve this.

You should not call ScsiPortNotification from your thread. It should be
called in the mini-port context. Please search for previous posts in
this group. This topic was discussed several times.

-----Original Message-----
From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]
Posted At: 17 September 2002 11:43
Posted To: ntdev
Conversation: [ntdev] Pseudo SCSI Miniport driver
Subject: [ntdev] Pseudo SCSI Miniport driver

Hi all,
I am writing a pseudo scsi miniport driver (i am new to NT). I cannot
complete the IO requests in the StartIo function itself. I have created
a
thread that will finish the job and call ScsiPortNotification to
complete
the request. But this is not working. ScsiPort driver times out and
invokes the “ResetBus” function. In the resetbus fn i just say
“ScsiPortNotification(NextRequest, devExt)”.

How to solve this.


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

Hi,
But how do i get into miniport’s context ?
If i use ScsiPortNotification(RequestTimerCall…, 1 microsecond), My
timeout fn is not called before calling the ResetBus fn

Thanks
Varada

You should not call ScsiPortNotification from your thread. It should be
called in the mini-port context. Please search for previous posts in
this group. This topic was discussed several times.

-----Original Message-----
From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]=20
Posted At: 17 September 2002 11:43
Posted To: ntdev
Conversation: [ntdev] Pseudo SCSI Miniport driver
Subject: [ntdev] Pseudo SCSI Miniport driver

Hi all,
I am writing a pseudo scsi miniport driver (i am new to NT). I cannot
complete the IO requests in the StartIo function itself. I have created
a
thread that will finish the job and call ScsiPortNotification to
complete
the request. But this is not working. ScsiPort driver times out and
invokes the “ResetBus” function. In the resetbus fn i just say
“ScsiPortNotification(NextRequest, devExt)”.

How to solve this.


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

I don’t why it is. I have recently impletemented such driver and it
works fine.

Here is Pseudo code of mine,

BOOLEAN
MyHwInitialize(
IN PVOID HbaExtension
)
{
PHW_DEVICE_EXTENSION hbaExtension = HbaExtension;

UCHAR status;
ULONG i = 0;

//
// Inform the port driver that the bus has been reset.
//

if( MyResetBus( hbaExtension, 0 ) ) {

ScsiPortNotification( ResetDetected, hbaExtension, 0 );

return TRUE;
}
return FALSE;
}

BOOLEAN
MyStartIo(
IN PVOID HbaExtension,
IN PSCSI_REQUEST_BLOCK Srb
)

{
PHW_DEVICE_EXTENSION hbaExtension = HbaExtension;

PHW_LU_EXTENSION luExtension =
ScsiPortGetLogicalUnit(
hbaExtension,
Srb->PathId,
Srb->TargetId,
Srb->Lun);

switch (Srb->Function) {

case SRB_FUNCTION_ABORT_COMMAND: {

//
// Verify that SRB to abort is still
outstanding.
//

if ((luExtension == NULL) ||
(luExtension->CurrentSrb == NULL)) {

//
// Complete abort SRB.
//

Srb->SrbStatus =
SRB_STATUS_ABORT_FAILED;
}

break;
}

case SRB_FUNCTION_RESET_BUS: {

Srb->SrbStatus = SRB_STATUS_SUCCESS;

break;
}

case SRB_FUNCTION_EXECUTE_SCSI: {
Srb->SrbStatus = MyGenericRequestRouter(

hbaExtension,
Srb,
FALSE );

break;
}

case SRB_FUNCTION_IO_CONTROL: {

Srb->SrbStatus = MyGenericRequestRouter(

hbaExtension,
Srb,
TRUE );

break;
}

case SRB_FUNCTION_RESET_DEVICE: {

//
// Drop through to default.
//

break;
}

default: {

//
// Set error, complete request
// and signal ready for next request.
//

Srb->ScsiStatus = SCSISTAT_CHECK_CONDITION;
Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;

break;
} // end default

} // end switch

if( Srb->SrbStatus == SRB_STATUS_BUSY ) {

ScsiPortNotification( RequestComplete,
HbaExtension,
Srb );

return FALSE;
}
else if( Srb->SrbStatus == SRB_STATUS_PENDING ) {

ScsiPortNotification( RequestTimerCall,
HbaExtension,
MyTimerCallBack,
500 );
}
else {

//
// Adapter is not busy.
//
ScsiPortNotification(RequestComplete,
hbaExtension,
Srb);

ScsiPortNotification(NextRequest,
hbaExtension,
NULL);
}

return TRUE;
}

-----Original Message-----
From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]
Posted At: 17 September 2002 12:42
Posted To: ntdev
Conversation: [ntdev] RE: Pseudo SCSI Miniport driver
Subject: [ntdev] RE: Pseudo SCSI Miniport driver

Hi,
But how do i get into miniport’s context ?
If i use ScsiPortNotification(RequestTimerCall…, 1 microsecond), My
timeout fn is not called before calling the ResetBus fn

Thanks
Varada

You should not call ScsiPortNotification from your thread. It should
be
called in the mini-port context. Please search for previous posts in
this group. This topic was discussed several times.

-----Original Message-----
From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]=20
Posted At: 17 September 2002 11:43
Posted To: ntdev
Conversation: [ntdev] Pseudo SCSI Miniport driver
Subject: [ntdev] Pseudo SCSI Miniport driver

Hi all,
I am writing a pseudo scsi miniport driver (i am new to NT). I cannot
complete the IO requests in the StartIo function itself. I have
created
a
thread that will finish the job and call ScsiPortNotification to
complete
the request. But this is not working. ScsiPort driver times out and
invokes the “ResetBus” function. In the resetbus fn i just say
“ScsiPortNotification(NextRequest, devExt)”.

How to solve this.


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


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

Well known problem. Read the archives of this list. There areprobably
1000 messages on this.

Jamey Kirby
StorageCraft

Makers of VSPORT; the Virtual SCSI Port for Windows.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of N. Varadarajan
Sent: Tuesday, September 17, 2002 3:43 AM
To: NT Developers Interest List
Subject: [ntdev] Pseudo SCSI Miniport driver

Hi all,
I am writing a pseudo scsi miniport driver (i am new to NT). I cannot
complete the IO requests in the StartIo function itself. I have created
a
thread that will finish the job and call ScsiPortNotification to
complete
the request. But this is not working. ScsiPort driver times out and
invokes the “ResetBus” function. In the resetbus fn i just say
“ScsiPortNotification(NextRequest, devExt)”.

How to solve this.


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

Of course, this will add 10+ ms delay in processing each SRB :frowning:

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bala
Sent: Tuesday, September 17, 2002 3:47 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Pseudo SCSI Miniport driver

You should not call ScsiPortNotification from your thread. It should be
called in the mini-port context. Please search for previous posts in
this group. This topic was discussed several times.

-----Original Message-----
From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]
Posted At: 17 September 2002 11:43
Posted To: ntdev
Conversation: [ntdev] Pseudo SCSI Miniport driver
Subject: [ntdev] Pseudo SCSI Miniport driver

Hi all,
I am writing a pseudo scsi miniport driver (i am new to NT). I cannot
complete the IO requests in the StartIo function itself. I have created
a
thread that will finish the job and call ScsiPortNotification to
complete
the request. But this is not working. ScsiPort driver times out and
invokes the “ResetBus” function. In the resetbus fn i just say
“ScsiPortNotification(NextRequest, devExt)”.

How to solve this.


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


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

scsiport notification must ALWAYS be called from within the miniport
context unfortunately. In order to setup the timer you would need to do
so from your StartIO routine.

-p

-----Original Message-----
From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]
Sent: Tuesday, September 17, 2002 4:42 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Pseudo SCSI Miniport driver

Hi,
But how do i get into miniport’s context ?
If i use ScsiPortNotification(RequestTimerCall…, 1 microsecond), My
timeout fn is not called before calling the ResetBus fn

Thanks
Varada

You should not call ScsiPortNotification from your thread. It should
be called in the mini-port context. Please search for previous posts
in this group. This topic was discussed several times.

-----Original Message-----
From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]=20
Posted At: 17 September 2002 11:43
Posted To: ntdev
Conversation: [ntdev] Pseudo SCSI Miniport driver
Subject: [ntdev] Pseudo SCSI Miniport driver

Hi all,
I am writing a pseudo scsi miniport driver (i am new to NT). I cannot
complete the IO requests in the StartIo function itself. I have
created a thread that will finish the job and call
ScsiPortNotification to complete
the request. But this is not working. ScsiPort driver times out and
invokes the “ResetBus” function. In the resetbus fn i just say
“ScsiPortNotification(NextRequest, devExt)”.

How to solve this.


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


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

After all is said and done, SCSIPORT is not friendly to psuedo or virtual
SCSI mini-ports. As Jamey suggested, do a search on virtual SCSI ports in
this list. I posted a treatise on why this is so, about two months back.

It is not a “context” problem … as in you can’t call a SCSIPORT function
from outside a SCSI miniport. The problem lies in not being able to queue
the SCSIPORT DpcForIsr unless you call ScsiPortNotification with
RequestComplete from within either the SCSPORT ISR callback to your miniport
or while in the timer call from RequestTimer. Those two logic paths are the
only places that will set things up to queue the SCSIPORT DpcForIsr
functions which does a callback to your miniports CallEnableInterrupts
callback function, where you normally complete an SRB.

Yes there are ways of faking out SCSIPORT or STORPORT, most of which means
programming outside the box and probably will not be transparent to the next
OS release and/or service pack. Neither will they be very speedy since it
take a lot of overhead to do such endruns. Your best bet may well be a third
party SCSI support package and not attempting to do this using SCSIPORT,
STORPORT. I have used and would recommend Storage Crafts VSPORT.

Gary G. Little
Unemployed kernel mode driver developer
909-551-2105
909-698-3191

“Peter Wieland” wrote in message
news:xxxxx@ntdev…

scsiport notification must ALWAYS be called from within the miniport
context unfortunately. In order to setup the timer you would need to do
so from your StartIO routine.

-p

-----Original Message-----
From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]
Sent: Tuesday, September 17, 2002 4:42 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Pseudo SCSI Miniport driver

Hi,
But how do i get into miniport’s context ?
If i use ScsiPortNotification(RequestTimerCall…, 1 microsecond), My
timeout fn is not called before calling the ResetBus fn

Thanks
Varada
> You should not call ScsiPortNotification from your thread. It should
> be called in the mini-port context. Please search for previous posts
> in this group. This topic was discussed several times.
>
> -----Original Message-----
> From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]=20
> Posted At: 17 September 2002 11:43
> Posted To: ntdev
> Conversation: [ntdev] Pseudo SCSI Miniport driver
> Subject: [ntdev] Pseudo SCSI Miniport driver
>
> Hi all,
> I am writing a pseudo scsi miniport driver (i am new to NT). I cannot
> complete the IO requests in the StartIo function itself. I have
> created a thread that will finish the job and call
> ScsiPortNotification to complete
> the request. But this is not working. ScsiPort driver times out and
> invokes the “ResetBus” function. In the resetbus fn i just say
> “ScsiPortNotification(NextRequest, devExt)”.
>
> How to solve this.
>
> —
> You are currently subscribed to ntdev as: xxxxx@avantisworld.com To
> unsubscribe send a blank email to %%email.unsub%%


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

Balderdash … I knew I would get the logic wrong …

You cannot complete an SRB unless your are in the callback to
CallEnableInterrupts, and you can’t get there unless your get there via an
ISR or a timer function, which means you are in the SCSIPORT DpcForIsr.
Outside of the SCSIPORT ISR or timer function there is no way to queue
SCSIPORT’s DpcForIsr function.

Gary G. Little
Unemployed kernel mode driver developer
909-551-2105
909-698-3191

“Gary G. Little” wrote in message news:xxxxx@ntdev…
>
> After all is said and done, SCSIPORT is not friendly to psuedo or virtual
> SCSI mini-ports. As Jamey suggested, do a search on virtual SCSI ports in
> this list. I posted a treatise on why this is so, about two months back.
>
> It is not a “context” problem … as in you can’t call a SCSIPORT function
> from outside a SCSI miniport. The problem lies in not being able to queue
> the SCSIPORT DpcForIsr unless you call ScsiPortNotification with
> RequestComplete from within either the SCSPORT ISR callback to your
miniport
> or while in the timer call from RequestTimer. Those two logic paths are
the
> only places that will set things up to queue the SCSIPORT DpcForIsr
> functions which does a callback to your miniports CallEnableInterrupts
> callback function, where you normally complete an SRB.
>
> Yes there are ways of faking out SCSIPORT or STORPORT, most of which means
> programming outside the box and probably will not be transparent to the
next
> OS release and/or service pack. Neither will they be very speedy since it
> take a lot of overhead to do such endruns. Your best bet may well be a
third
> party SCSI support package and not attempting to do this using SCSIPORT,
> STORPORT. I have used and would recommend Storage Crafts VSPORT.
>
> Gary G. Little
> Unemployed kernel mode driver developer
> 909-551-2105
> 909-698-3191
>
> “Peter Wieland” wrote in message
> news:xxxxx@ntdev…
>
> scsiport notification must ALWAYS be called from within the miniport
> context unfortunately. In order to setup the timer you would need to do
> so from your StartIO routine.
>
> -p
>
> -----Original Message-----
> From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]
> Sent: Tuesday, September 17, 2002 4:42 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Pseudo SCSI Miniport driver
>
>
> Hi,
> But how do i get into miniport’s context ?
> If i use ScsiPortNotification(RequestTimerCall…, 1 microsecond), My
> timeout fn is not called before calling the ResetBus fn
>
> Thanks
> Varada
> > You should not call ScsiPortNotification from your thread. It should
> > be called in the mini-port context. Please search for previous posts
> > in this group. This topic was discussed several times.
> >
> > -----Original Message-----
> > From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]=20
> > Posted At: 17 September 2002 11:43
> > Posted To: ntdev
> > Conversation: [ntdev] Pseudo SCSI Miniport driver
> > Subject: [ntdev] Pseudo SCSI Miniport driver
> >
> > Hi all,
> > I am writing a pseudo scsi miniport driver (i am new to NT). I cannot
> > complete the IO requests in the StartIo function itself. I have
> > created a thread that will finish the job and call
> > ScsiPortNotification to complete
> > the request. But this is not working. ScsiPort driver times out and
> > invokes the “ResetBus” function. In the resetbus fn i just say
> > “ScsiPortNotification(NextRequest, devExt)”.
> >
> > How to solve this.
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@avantisworld.com To
> > unsubscribe send a blank email to %%email.unsub%%
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to %%email.unsub%%
>
>
>
>
>
>

>> is no way to queue

As we both learned … there is no sane way to do that. As for insane ones
… I dont even want to recall :stuck_out_tongue:

Ciao Dan

----- Original Message -----
From: “Gary G. Little”
Newsgroups: ntdev
To: “NT Developers Interest List”
Sent: Wednesday, September 18, 2002 12:44 AM
Subject: [ntdev] Re: Pseudo SCSI Miniport driver

> Balderdash … I knew I would get the logic wrong …
>
> You cannot complete an SRB unless your are in the callback to
> CallEnableInterrupts, and you can’t get there unless your get there via an
> ISR or a timer function, which means you are in the SCSIPORT DpcForIsr.
> Outside of the SCSIPORT ISR or timer function there is no way to queue
> SCSIPORT’s DpcForIsr function.
>
> Gary G. Little
> Unemployed kernel mode driver developer
> 909-551-2105
> 909-698-3191
>
> “Gary G. Little” wrote in message news:xxxxx@ntdev…
> >
> > After all is said and done, SCSIPORT is not friendly to psuedo or
virtual
> > SCSI mini-ports. As Jamey suggested, do a search on virtual SCSI ports
in
> > this list. I posted a treatise on why this is so, about two months back.
> >
> > It is not a “context” problem … as in you can’t call a SCSIPORT
function
> > from outside a SCSI miniport. The problem lies in not being able to
queue
> > the SCSIPORT DpcForIsr unless you call ScsiPortNotification with
> > RequestComplete from within either the SCSPORT ISR callback to your
> miniport
> > or while in the timer call from RequestTimer. Those two logic paths are
> the
> > only places that will set things up to queue the SCSIPORT DpcForIsr
> > functions which does a callback to your miniports CallEnableInterrupts
> > callback function, where you normally complete an SRB.
> >
> > Yes there are ways of faking out SCSIPORT or STORPORT, most of which
means
> > programming outside the box and probably will not be transparent to the
> next
> > OS release and/or service pack. Neither will they be very speedy since
it
> > take a lot of overhead to do such endruns. Your best bet may well be a
> third
> > party SCSI support package and not attempting to do this using SCSIPORT,
> > STORPORT. I have used and would recommend Storage Crafts VSPORT.
> >
> > Gary G. Little
> > Unemployed kernel mode driver developer
> > 909-551-2105
> > 909-698-3191
> >
> > “Peter Wieland” wrote in message
> > news:xxxxx@ntdev…
> >
> > scsiport notification must ALWAYS be called from within the miniport
> > context unfortunately. In order to setup the timer you would need to do
> > so from your StartIO routine.
> >
> > -p
> >
> > -----Original Message-----
> > From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]
> > Sent: Tuesday, September 17, 2002 4:42 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] RE: Pseudo SCSI Miniport driver
> >
> >
> > Hi,
> > But how do i get into miniport’s context ?
> > If i use ScsiPortNotification(RequestTimerCall…, 1 microsecond), My
> > timeout fn is not called before calling the ResetBus fn
> >
> > Thanks
> > Varada
> > > You should not call ScsiPortNotification from your thread. It should
> > > be called in the mini-port context. Please search for previous posts
> > > in this group. This topic was discussed several times.
> > >
> > > -----Original Message-----
> > > From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]=20
> > > Posted At: 17 September 2002 11:43
> > > Posted To: ntdev
> > > Conversation: [ntdev] Pseudo SCSI Miniport driver
> > > Subject: [ntdev] Pseudo SCSI Miniport driver
> > >
> > > Hi all,
> > > I am writing a pseudo scsi miniport driver (i am new to NT). I cannot
> > > complete the IO requests in the StartIo function itself. I have
> > > created a thread that will finish the job and call
> > > ScsiPortNotification to complete
> > > the request. But this is not working. ScsiPort driver times out and
> > > invokes the “ResetBus” function. In the resetbus fn i just say
> > > “ScsiPortNotification(NextRequest, devExt)”.
> > >
> > > How to solve this.
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@avantisworld.com To
> > > unsubscribe send a blank email to %%email.unsub%%
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> > unsubscribe send a blank email to %%email.unsub%%
> >
> >
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to %%email.unsub%%
>

still not quite - you can complete an SRB any time scsiport calls the
miniport. HwInterrupt, HwReset, HwStartIo, HwTimer - any of these would
be a fine time to complete an SRB IFF scsiport is the caller. If some
external component just happens to get the function pointer and call
them nothing will happen until the next time scsiport checks its
internal flags.

-p

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@inland.net]
Sent: Tuesday, September 17, 2002 2:44 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Pseudo SCSI Miniport driver

Balderdash … I knew I would get the logic wrong …

You cannot complete an SRB unless your are in the callback to
CallEnableInterrupts, and you can’t get there unless your get there via
an ISR or a timer function, which means you are in the SCSIPORT
DpcForIsr. Outside of the SCSIPORT ISR or timer function there is no
way to queue SCSIPORT’s DpcForIsr function.

Gary G. Little
Unemployed kernel mode driver developer
909-551-2105
909-698-3191

“Gary G. Little” wrote in message
news:xxxxx@ntdev…
>
> After all is said and done, SCSIPORT is not friendly to psuedo or
> virtual SCSI mini-ports. As Jamey suggested, do a search on virtual
> SCSI ports in this list. I posted a treatise on why this is so, about
> two months back.
>
> It is not a “context” problem … as in you can’t call a SCSIPORT
> function from outside a SCSI miniport. The problem lies in not being
> able to queue the SCSIPORT DpcForIsr unless you call
> ScsiPortNotification with RequestComplete from within either the
> SCSPORT ISR callback to your
miniport
> or while in the timer call from RequestTimer. Those two logic paths
> are
the
> only places that will set things up to queue the SCSIPORT DpcForIsr
> functions which does a callback to your miniports CallEnableInterrupts

> callback function, where you normally complete an SRB.
>
> Yes there are ways of faking out SCSIPORT or STORPORT, most of which
> means programming outside the box and probably will not be transparent

> to the
next
> OS release and/or service pack. Neither will they be very speedy since

> it take a lot of overhead to do such endruns. Your best bet may well
> be a
third
> party SCSI support package and not attempting to do this using
> SCSIPORT, STORPORT. I have used and would recommend Storage Crafts
> VSPORT.
>
> Gary G. Little
> Unemployed kernel mode driver developer
> 909-551-2105
> 909-698-3191
>
> “Peter Wieland” wrote in message
> news:xxxxx@ntdev…
>
> scsiport notification must ALWAYS be called from within the miniport
> context unfortunately. In order to setup the timer you would need to
> do so from your StartIO routine.
>
> -p
>
> -----Original Message-----
> From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]
> Sent: Tuesday, September 17, 2002 4:42 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Pseudo SCSI Miniport driver
>
>
> Hi,
> But how do i get into miniport’s context ?
> If i use ScsiPortNotification(RequestTimerCall…, 1 microsecond), My
> timeout fn is not called before calling the ResetBus fn
>
> Thanks
> Varada
> > You should not call ScsiPortNotification from your thread. It should

> > be called in the mini-port context. Please search for previous posts

> > in this group. This topic was discussed several times.
> >
> > -----Original Message-----
> > From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]=20
> > Posted At: 17 September 2002 11:43
> > Posted To: ntdev
> > Conversation: [ntdev] Pseudo SCSI Miniport driver
> > Subject: [ntdev] Pseudo SCSI Miniport driver
> >
> > Hi all,
> > I am writing a pseudo scsi miniport driver (i am new to NT). I
> > cannot complete the IO requests in the StartIo function itself. I
> > have created a thread that will finish the job and call
> > ScsiPortNotification to complete the request. But this is not
> > working. ScsiPort driver times out and invokes the “ResetBus”
> > function. In the resetbus fn i just say
> > “ScsiPortNotification(NextRequest, devExt)”.
> >
> > How to solve this.
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@avantisworld.com To
> > unsubscribe send a blank email to %%email.unsub%%
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to %%email.unsub%%
>
>
>
>
>
>


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

Peter,

True. The problem in my virtual miniport was that the ISR was owned by a
lower bus driver, so any callback I made other than through a timer was
unablet to get things set up. I was “out of context”. I did find ways of
doing it … like finding the SCSIPORT DO that conatined the device queue
and calling KeInsertQueueDpc … that works, but it was 15% slower in
throughput … though even that is better than a 10 ms delay on every
transfer.

Using a third party SCSI support library my SCSI driver was only .39 MBytes
per second slower than a SCSIPORT equivalent. I couldn’t use a true SCSIPORT
mini-port because the fibre channel bus driver supported upper layer drivers
that were not SCSI.

Gary G. Little
Unemployed kernel mode driver developer
909-551-2105
909-698-3191

“Peter Wieland” wrote in message
news:xxxxx@ntdev…

still not quite - you can complete an SRB any time scsiport calls the
miniport. HwInterrupt, HwReset, HwStartIo, HwTimer - any of these would
be a fine time to complete an SRB IFF scsiport is the caller. If some
external component just happens to get the function pointer and call
them nothing will happen until the next time scsiport checks its
internal flags.

-p

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@inland.net]
Sent: Tuesday, September 17, 2002 2:44 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Pseudo SCSI Miniport driver

Balderdash … I knew I would get the logic wrong …

You cannot complete an SRB unless your are in the callback to
CallEnableInterrupts, and you can’t get there unless your get there via
an ISR or a timer function, which means you are in the SCSIPORT
DpcForIsr. Outside of the SCSIPORT ISR or timer function there is no
way to queue SCSIPORT’s DpcForIsr function.

Gary G. Little
Unemployed kernel mode driver developer
909-551-2105
909-698-3191

“Gary G. Little” wrote in message
news:xxxxx@ntdev…
>
> After all is said and done, SCSIPORT is not friendly to psuedo or
> virtual SCSI mini-ports. As Jamey suggested, do a search on virtual
> SCSI ports in this list. I posted a treatise on why this is so, about
> two months back.
>
> It is not a “context” problem … as in you can’t call a SCSIPORT
> function from outside a SCSI miniport. The problem lies in not being
> able to queue the SCSIPORT DpcForIsr unless you call
> ScsiPortNotification with RequestComplete from within either the
> SCSPORT ISR callback to your
miniport
> or while in the timer call from RequestTimer. Those two logic paths
> are
the
> only places that will set things up to queue the SCSIPORT DpcForIsr
> functions which does a callback to your miniports CallEnableInterrupts

> callback function, where you normally complete an SRB.
>
> Yes there are ways of faking out SCSIPORT or STORPORT, most of which
> means programming outside the box and probably will not be transparent

> to the
next
> OS release and/or service pack. Neither will they be very speedy since

> it take a lot of overhead to do such endruns. Your best bet may well
> be a
third
> party SCSI support package and not attempting to do this using
> SCSIPORT, STORPORT. I have used and would recommend Storage Crafts
> VSPORT.
>
> Gary G. Little
> Unemployed kernel mode driver developer
> 909-551-2105
> 909-698-3191
>
> “Peter Wieland” wrote in message
> news:xxxxx@ntdev…
>
> scsiport notification must ALWAYS be called from within the miniport
> context unfortunately. In order to setup the timer you would need to
> do so from your StartIO routine.
>
> -p
>
> -----Original Message-----
> From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]
> Sent: Tuesday, September 17, 2002 4:42 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Pseudo SCSI Miniport driver
>
>
> Hi,
> But how do i get into miniport’s context ?
> If i use ScsiPortNotification(RequestTimerCall…, 1 microsecond), My
> timeout fn is not called before calling the ResetBus fn
>
> Thanks
> Varada
> > You should not call ScsiPortNotification from your thread. It should

> > be called in the mini-port context. Please search for previous posts

> > in this group. This topic was discussed several times.
> >
> > -----Original Message-----
> > From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]=20
> > Posted At: 17 September 2002 11:43
> > Posted To: ntdev
> > Conversation: [ntdev] Pseudo SCSI Miniport driver
> > Subject: [ntdev] Pseudo SCSI Miniport driver
> >
> > Hi all,
> > I am writing a pseudo scsi miniport driver (i am new to NT). I
> > cannot complete the IO requests in the StartIo function itself. I
> > have created a thread that will finish the job and call
> > ScsiPortNotification to complete the request. But this is not
> > working. ScsiPort driver times out and invokes the “ResetBus”
> > function. In the resetbus fn i just say
> > “ScsiPortNotification(NextRequest, devExt)”.
> >
> > How to solve this.
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@avantisworld.com To
> > unsubscribe send a blank email to %%email.unsub%%
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to %%email.unsub%%
>
>
>
>
>
>


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

Peter,

Hmmm, gotta disagree with you on one thing …

I do believe that HwInterrupt is at DIRQL, and completeing an SRB there may
lead to a call to HwStartIo before the return from ScsiPortNotification.
Beside, completeing an SRB could lead to completing the underlying IRP, and
that you cannot do at DIRQL.

All the code I have seen hangs a request for CallEnableInterrupts that then
calls SPN with RequestComplete. Am I incorrect in that?

Gary G. Little
Unemployed kernel mode driver developer
909-551-2105
909-698-3191

“Peter Wieland” wrote in message
news:xxxxx@ntdev…

still not quite - you can complete an SRB any time scsiport calls the
miniport. HwInterrupt, HwReset, HwStartIo, HwTimer - any of these would
be a fine time to complete an SRB IFF scsiport is the caller. If some
external component just happens to get the function pointer and call
them nothing will happen until the next time scsiport checks its
internal flags.

-p

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@inland.net]
Sent: Tuesday, September 17, 2002 2:44 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Pseudo SCSI Miniport driver

Balderdash … I knew I would get the logic wrong …

You cannot complete an SRB unless your are in the callback to
CallEnableInterrupts, and you can’t get there unless your get there via
an ISR or a timer function, which means you are in the SCSIPORT
DpcForIsr. Outside of the SCSIPORT ISR or timer function there is no
way to queue SCSIPORT’s DpcForIsr function.

Gary G. Little
Unemployed kernel mode driver developer
909-551-2105
909-698-3191

“Gary G. Little” wrote in message
news:xxxxx@ntdev…
>
> After all is said and done, SCSIPORT is not friendly to psuedo or
> virtual SCSI mini-ports. As Jamey suggested, do a search on virtual
> SCSI ports in this list. I posted a treatise on why this is so, about
> two months back.
>
> It is not a “context” problem … as in you can’t call a SCSIPORT
> function from outside a SCSI miniport. The problem lies in not being
> able to queue the SCSIPORT DpcForIsr unless you call
> ScsiPortNotification with RequestComplete from within either the
> SCSPORT ISR callback to your
miniport
> or while in the timer call from RequestTimer. Those two logic paths
> are
the
> only places that will set things up to queue the SCSIPORT DpcForIsr
> functions which does a callback to your miniports CallEnableInterrupts

> callback function, where you normally complete an SRB.
>
> Yes there are ways of faking out SCSIPORT or STORPORT, most of which
> means programming outside the box and probably will not be transparent

> to the
next
> OS release and/or service pack. Neither will they be very speedy since

> it take a lot of overhead to do such endruns. Your best bet may well
> be a
third
> party SCSI support package and not attempting to do this using
> SCSIPORT, STORPORT. I have used and would recommend Storage Crafts
> VSPORT.
>
> Gary G. Little
> Unemployed kernel mode driver developer
> 909-551-2105
> 909-698-3191
>
> “Peter Wieland” wrote in message
> news:xxxxx@ntdev…
>
> scsiport notification must ALWAYS be called from within the miniport
> context unfortunately. In order to setup the timer you would need to
> do so from your StartIO routine.
>
> -p
>
> -----Original Message-----
> From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]
> Sent: Tuesday, September 17, 2002 4:42 AM
> To: NT Developers Interest List
> Subject: [ntdev] RE: Pseudo SCSI Miniport driver
>
>
> Hi,
> But how do i get into miniport’s context ?
> If i use ScsiPortNotification(RequestTimerCall…, 1 microsecond), My
> timeout fn is not called before calling the ResetBus fn
>
> Thanks
> Varada
> > You should not call ScsiPortNotification from your thread. It should

> > be called in the mini-port context. Please search for previous posts

> > in this group. This topic was discussed several times.
> >
> > -----Original Message-----
> > From: N. Varadarajan [mailto:xxxxx@ctd.hcltech.com]=20
> > Posted At: 17 September 2002 11:43
> > Posted To: ntdev
> > Conversation: [ntdev] Pseudo SCSI Miniport driver
> > Subject: [ntdev] Pseudo SCSI Miniport driver
> >
> > Hi all,
> > I am writing a pseudo scsi miniport driver (i am new to NT). I
> > cannot complete the IO requests in the StartIo function itself. I
> > have created a thread that will finish the job and call
> > ScsiPortNotification to complete the request. But this is not
> > working. ScsiPort driver times out and invokes the “ResetBus”
> > function. In the resetbus fn i just say
> > “ScsiPortNotification(NextRequest, devExt)”.
> >
> > How to solve this.
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@avantisworld.com To
> > unsubscribe send a blank email to %%email.unsub%%
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to %%email.unsub%%
>
>
>
>
>
>


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