Firewire driver can't release isoch bandwidth after surprise removal

Hello experts,

This is my 1’st post. I inherited the maintenance of our middle layer FW
driver, but although I am an experienced programmer, I have little driver
development experience.

When our FW device is unplugged unexpectedly from the FW bus, our driver
tries to release all allocated isochronous resources. It does things in the
following order, the same order in which it is done when the device is shut
down normally:

  1. Stop isoch, if still running
  2. Release any remaining attached buffers
  3. Free isoch resources
  4. Free isoch channel
  5. Free isoch bandwidth

All of the operations complete successfully, except for the last one, which
returns the error INVALID_GENERATION_COUNT. As far as I can tell, the
generation count is not a parameter in this operation (I know it is required
in asynchronous writes and reads). I have tried changing the order of the
operations by putting #5 after #2, but it makes no difference.

Here is the relevant code:

// Free bandwidth, if still allocated
if (pDevExt->hIsochBandwidth != NULL)
{
KdPrint(("\tBandwidth still allocated, freeing … "));

IoInitializeIrp(pIrp, IoSizeOfIrp(stackSize), stackSize);
RtlZeroMemory (pIrb, sizeof (IRB));

pIrb->FunctionNumber = REQUEST_ISOCH_FREE_BANDWIDTH;
pIrb->Flags = 0;
pIrb->u.IsochFreeBandwidth.hBandwidth = pDevExt->hIsochBandwidth;

ntStatus = MF1394SubmitIrpSynch(pDevExt, pIrp, pIrb);
if ( NT_SUCCESS(ntStatus) )
{
KdPrint((“successful\n”));
pDevExt->hIsochBandwidth = NULL;
}
else
KdPrint((“\nFreeing bandwidth FAILED, status = 0x%08X\n”, ntStatus));
}

Thanks for any help.

Harry

According to the latest DDK documentation on REQUEST_ISOCH_FREE_BANDWIDTH:

“A status of STATUS_INVALID_GENERATION also indicates success. Caller should
not retry the request with a new generation count.”
Bill M.

“Harry Rosenstein” wrote in message
news:xxxxx@ntdev…
> Hello experts,
>
> This is my 1’st post. I inherited the maintenance of our middle layer FW
> driver, but although I am an experienced programmer, I have little driver
> development experience.
>
> When our FW device is unplugged unexpectedly from the FW bus, our driver
> tries to release all allocated isochronous resources. It does things in
> the
> following order, the same order in which it is done when the device is
> shut
> down normally:
>
> 1. Stop isoch, if still running
> 2. Release any remaining attached buffers
> 3. Free isoch resources
> 4. Free isoch channel
> 5. Free isoch bandwidth
>
> All of the operations complete successfully, except for the last one,
> which
> returns the error INVALID_GENERATION_COUNT. As far as I can tell, the
> generation count is not a parameter in this operation (I know it is
> required
> in asynchronous writes and reads). I have tried changing the order of the
> operations by putting #5 after #2, but it makes no difference.
>
> Here is the relevant code:
>
> // Free bandwidth, if still allocated
> if (pDevExt->hIsochBandwidth != NULL)
> {
> KdPrint((“\tBandwidth still allocated, freeing … “));
>
> IoInitializeIrp(pIrp, IoSizeOfIrp(stackSize), stackSize);
> RtlZeroMemory (pIrb, sizeof (IRB));
>
> pIrb->FunctionNumber = REQUEST_ISOCH_FREE_BANDWIDTH;
> pIrb->Flags = 0;
> pIrb->u.IsochFreeBandwidth.hBandwidth = pDevExt->hIsochBandwidth;
>
> ntStatus = MF1394SubmitIrpSynch(pDevExt, pIrp, pIrb);
> if ( NT_SUCCESS(ntStatus) )
> {
> KdPrint((“successful\n”));
> pDevExt->hIsochBandwidth = NULL;
> }
> else
> KdPrint((”\nFreeing bandwidth FAILED, status = 0x%08X\n”, ntStatus));
> }
>
> Thanks for any help.
>
> Harry
>
>
>
>
>