Пример #1
0
VOID tapWaitForReceiveNblInFlightCountZeroEvent(__in PTAP_ADAPTER_CONTEXT Adapter) {
  LONG nblCount;

  //
  // Wait until higher-level protocol has returned all NBLs
  // to the driver.
  //

  // Add one NBL "bias" to insure allow event to be reset safely.
  nblCount = NdisInterlockedIncrement(&Adapter->ReceiveNblInFlightCount);
  ASSERT(nblCount > 0);
  NdisResetEvent(&Adapter->ReceiveNblInFlightCountZeroEvent);

  //
  // Now remove the bias and wait for the ReceiveNblInFlightCountZeroEvent
  // if the count returned is not zero.
  //
  nblCount = NdisInterlockedDecrement(&Adapter->ReceiveNblInFlightCount);
  ASSERT(nblCount >= 0);

  if (nblCount) {
    LARGE_INTEGER startTime, currentTime;

    NdisGetSystemUpTimeEx(&startTime);

    for (;;) {
      BOOLEAN waitResult =
          NdisWaitEvent(&Adapter->ReceiveNblInFlightCountZeroEvent, TAP_WAIT_POLL_LOOP_TIMEOUT);

      NdisGetSystemUpTimeEx(&currentTime);

      if (waitResult) {
        break;
      }

      DEBUGP(("[%s] Waiting for %d in-flight receive NBLs to be returned.\n",
              MINIPORT_INSTANCE_ID(Adapter), Adapter->ReceiveNblInFlightCount));
    }

    DEBUGP(("[%s] Waited %d ms for all in-flight NBLs to be returned.\n",
            MINIPORT_INSTANCE_ID(Adapter), (currentTime.LowPart - startTime.LowPart)));
  }
}
Пример #2
0
void
wlan_node_update_timestamp(struct ieee80211_node_table *nt, bss_t *ni)
{
#ifdef ATHR_NWIFI
#ifndef WP7_SLDR_IMAGE
    NdisGetSystemUpTimeEx ((PLARGE_INTEGER) &ni->HostTimestamp);
#endif
#else
    ni->ni_tstamp = A_GET_MS(0);
    ni->ni_actcnt = WLAN_NODE_INACT_CNT;
#endif
    return;
}