示例#1
0
文件: epacket.c 项目: OPSF/uClinux
NDIS_STATUS NDIS_API PacketReset(POPEN_INSTANCE pOpen)
{
  // reset the protocol

  PLIST_ENTRY ResetListEntry;
  NDIS_STATUS Status;

  
  // Acquire request element from list
  NdisAllocateSpinLock(&pOpen->RequestSpinLock);
  
  if (IsListEmpty(&pOpen->RequestList)) { 
    NdisReleaseSpinLock(&pOpen->RequestSpinLock);
    return NDIS_STATUS_RESOURCES;
  }

  ResetListEntry = RemoveHeadList(&pOpen->RequestList);
  NdisReleaseSpinLock(&pOpen->RequestSpinLock);
  
  // Insert Reset IRP into Request Queue
  NdisAcquireSpinLock(&pOpen->ResetSpinLock);
  
  InsertTailList(&pOpen->ResetIrpList, ResetListEntry);
  
  NdisReleaseSpinLock(&pOpen->ResetSpinLock);
  
  // Reset the adapter
  NdisReset(&Status, pOpen->AdapterHandle);
  
  if (Status != NDIS_STATUS_PENDING)
    PacketResetComplete(pOpen, Status);
  return Status;
}
示例#2
0
/************************************************************
Start the reset of a instance of the driver
************************************************************/
VOID
PacketReset( PNDIS_STATUS	pStatus,
             POPEN_INSTANCE	pOpen )
{
    PLIST_ENTRY	ResetListEntry;

    TRACE_ENTER( "PacketReset" );

    NdisAcquireSpinLock( &pOpen->RequestSpinLock );
    ResetListEntry = PacketRemoveHeadList( &pOpen->RequestList );
    NdisReleaseSpinLock( &pOpen->RequestSpinLock );
    if ( ResetListEntry == NULL )
    {
        *pStatus = NDIS_STATUS_RESOURCES;
        TRACE_LEAVE( "PacketReset" );
        return;
    }
    NdisAcquireSpinLock( &pOpen->ResetSpinLock );
    InsertTailList( &pOpen->ResetIrpList, ResetListEntry );
    NdisReleaseSpinLock( &pOpen->ResetSpinLock );

    /*Call NDIS to reset the adapter*/
    NdisReset( pStatus, pOpen->AdapterHandle );
    if ( *pStatus != NDIS_STATUS_PENDING )
    {
        /*synchronous reset of the adapter*/
        PacketResetComplete( pOpen, *pStatus );
    }
    TRACE_LEAVE( "PacketReset" );
    return;
}
示例#3
0
/*
 * Function called to reset the adapter
 *
 */
BOOL PKTReset (POPEN_INSTANCE pOI)
{
	NDIS_STATUS Status;

	// Call NDIS to reset the adapter
	NdisReset (&Status, pOI->AdapterHandle);
	if (Status == NDIS_STATUS_PENDING) {
		SuspendExecution (pOI);
	} else {
		PacketResetComplete (pOI, Status);
	}

	if (Status != NDIS_STATUS_SUCCESS) {
		return FALSE;
	}

	return TRUE;
}