static int authRsnTxCompleteHandler( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus )
{
    tBtampContext *ctx = (tBtampContext *)VOS_GET_BAP_CB( pvosGCtx );
    tAuthRsnFsm *fsm;

    vos_pkt_return_packet( pPacket );
    if (NULL == ctx) 
    {
        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
                     "ctx is NULL in %s", __func__);

        return ANI_ERROR;
    }

    fsm = &ctx->uFsm.authFsm;
    if (NULL == fsm) 
    {
        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
                     "fsm is NULL in %s", __func__);

        return ANI_ERROR;
    }

    if(!VOS_IS_STATUS_SUCCESS( retStatus ) )
    {
        //No need to do anything. Retransmit is handled by timeout
        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
            "Auth: TL Tx complete with error %d current state is %d \n", retStatus, fsm->currentState );
    }
    if( PTK_START == fsm->currentState )
    {
        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
            " Auth: start msg2 timer\n" );
        //Start msg2Timer
        fsm->numTries++;
        vos_timer_stop( &fsm->msg2Timer );
        vos_timer_start(&fsm->msg2Timer, authConsts.timeoutPeriod);
    }
    else if( ( PTK_INIT_NEGO == fsm->currentState ) || 
        ( PTK_INIT_NEGO_TX == fsm->currentState ) )
    {
        VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO,
            " Auth: start msg4 timer\n" );
        fsm->numTries++;
        vos_timer_stop( &fsm->msg4Timer );
        vos_timer_start(&fsm->msg4Timer, authConsts.timeoutPeriod);
    }

    return ANI_OK;
}
Exemplo n.º 2
0
/*==========================================================================

  FUNCTION    WLANBAP_StartTxPacketMonitorTimer

  DESCRIPTION
    Start the Tx Packet Monitor Timer.

  DEPENDENCIES

  PARAMETERS

    IN
    pBtampCtx:   pointer to the BAP control block
    interval:    time interval.

  RETURN VALUE
    The result code associated with performing the operation

    VOS_STATUS_E_FAULT:  access would cause a page fault
    VOS_STATUS_SUCCESS:  Everything is good :)

  SIDE EFFECTS

============================================================================*/
VOS_STATUS
WLANBAP_StartTxPacketMonitorTimer
(
  ptBtampContext  pBtampCtx
)
{
  VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
  v_U32_t     uInterval = WLAN_BAP_TX_PKT_MONITOR_TIME;
  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/


  /*------------------------------------------------------------------------
    Sanity check BAP control block
   ------------------------------------------------------------------------*/
  if ( NULL == pBtampCtx )
  {
    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
                 "Invalid BAP pointer in %s", __func__);
    return VOS_STATUS_E_FAULT;
  }

  /*Start the timer */
  vosStatus = vos_timer_start( &pBtampCtx->bapTxPktMonitorTimer,
                                uInterval);

  return vosStatus;
}/* WLANBAP_StartTxPacketMonitorTimer */
Exemplo n.º 3
0
/*==========================================================================

  FUNCTION    WLANBAP_StartConnectionAcceptTimer

  DESCRIPTION
    Start the Connection Accept Timer.

  DEPENDENCIES

  PARAMETERS

    IN
    pBtampCtx:   pointer to the BAP control block
    interval:    time interval.

  RETURN VALUE
    The result code associated with performing the operation

    VOS_STATUS_E_FAULT:  access would cause a page fault
    VOS_STATUS_SUCCESS:  Everything is good :)

  SIDE EFFECTS

============================================================================*/
VOS_STATUS
WLANBAP_StartConnectionAcceptTimer
(
  ptBtampContext  pBtampCtx,
  v_U32_t interval
)
{
  /*------------------------------------------------------------------------
    Sanity check BAP control block
   ------------------------------------------------------------------------*/

  if ( NULL == pBtampCtx )
  {
    VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
                 "Invalid BAP pointer in %s", __func__);
    return VOS_STATUS_E_FAULT;
  }

  /*Start the connection accept timer*/
  vos_timer_start(
          &pBtampCtx->bapConnectionAcceptTimer,
          interval);

  return VOS_STATUS_SUCCESS;
}/* WLANBAP_StartConnectionAcceptTimer */
eHalStatus palTimerStart(tHddHandle hHdd, tPalTimerHandle hPalTimer, tANI_U32 uExpireTime, tANI_BOOLEAN fRestart)
{
   eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
   VOS_STATUS vosStatus;
   tANI_U32 expireTimeInMS = 0;
   
   tPalTimer *pPalTimer = (tPalTimer *)hPalTimer;
    
   do 
   {
      if ( NULL == pPalTimer ) break;
       
      pPalTimer->fRestart = fRestart;
      pPalTimer->uTimerInterval = uExpireTime;
      
      // vos Timer takes expiration time in milliseconds.  palTimerStart and 
      // the uTimerIntervl in tPalTimer struct have expiration tiem in
      // microseconds.  Make and adjustment from microseconds to milliseconds
      // before calling the vos_timer_start().
      expireTimeInMS = uExpireTime / 1000;
      vosStatus = vos_timer_start( &pPalTimer->vosTimer, expireTimeInMS );
      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) 
      {
         status = eHAL_STATUS_FAILURE;
         break;
      }
      
      status = eHAL_STATUS_SUCCESS;   
      
   } while( 0 );
    
   return( status );
}
void csrLLInsertHead( tDblLinkList *pList, tListElem *pEntry, tANI_BOOLEAN fInterlocked )
{
    
    if( !pList) 
    {
        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,"%s: Error!! pList is Null", __func__);
        return; 
    }

    if ( LIST_FLAG_OPEN == pList->Flag ) 
    {
        if(fInterlocked)
        {
            csrLLLock(pList);
        }
        csrListInsertHead( &pList->ListHead, pEntry );
        pList->Count++;
        if(fInterlocked)
        {
            csrLLUnlock(pList);
        }
        if ( pList->cmdTimeoutTimer && pList->cmdTimeoutDuration )
        {
            /* timer to detect pending command in activelist*/
            vos_timer_start( pList->cmdTimeoutTimer,
                pList->cmdTimeoutDuration);
        }
    }
}
/**---------------------------------------------------------------------
 * tx_timer_activate() 
 *
 * FUNCTION:
 *
 * LOGIC:
 *
 * ASSUMPTIONS:
 *
 * NOTE:
 *
 * @param  
 *
 * @return TX_SUCCESS.
 *
 */
v_UINT_t tx_timer_activate(TX_TIMER *timer_ptr)
{
   VOS_STATUS status;
  
    // Uncomment the asserts, if the intention is to debug the occurence of the
    // following anomalous cnditions.

    // Assert that the timer structure pointer passed, is not NULL
    //dbgAssert(NULL != timer_ptr);

    // If the NIC is halting just spoof a successful timer activation, so that all
    // the timers can be cleaned up.

    if(NULL == timer_ptr)
        return TX_TIMER_ERROR;

    // Put a check for the free builds
    if (TX_AIRGO_TMR_SIGNATURE != timer_ptr->tmrSignature) {
        VOS_ASSERT( timer_ptr->tmrSignature == 0 );

        return TX_TIMER_ERROR;

    }

    // Check for an uninitialized timer
    VOS_ASSERT(0 != strlen(TIMER_NAME));

    VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
            "Timer %s being activated\n", TIMER_NAME);

    status = vos_timer_start( &timer_ptr->vosTimer, 
         timer_ptr->initScheduleTimeInMsecs );

   if (VOS_STATUS_SUCCESS == status)
   {
      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
            "Timer %s now activated\n", TIMER_NAME);
      return TX_SUCCESS;
   }
   else if (VOS_STATUS_E_ALREADY == status)
   {
      // starting timer fails because timer is already started; this is okay
      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
            "Timer %s is already running\n", TIMER_NAME);
      return TX_SUCCESS;
   }
   else
   {
      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR, 
            "Timer %s fails to activate\n", TIMER_NAME);
      return TX_TIMER_ERROR;
   }
} /*** tx_timer_activate() ***/
/*---------------------------------------------------------------------------
    wpalTimerStart - start a wpt_timer object with a timeout value

    \param pTimer - a pointer to caller allocated wpt_timer object
    \param timeout - timeout value of the timer. In unit of milli-seconds

    \return
        eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise.
---------------------------------------------------------------------------*/
wpt_status wpalTimerStart(wpt_timer * pTimer, wpt_uint32 timeout)
{
   /* Sanity Checks */
   if( pTimer == NULL )
   {
      WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d)\n",
         __func__, (wpt_uint32)pTimer );
      return eWLAN_PAL_STATUS_E_INVAL;
   }
   return ( WPAL_VOS_TO_WPAL_STATUS( vos_timer_start( &pTimer->timer.timerObj,
                                                     timeout ) ) );
}/*wpalTimerStart*/
/**---------------------------------------------------------------------
 * tx_main_timer_func() 
 *
 * FUNCTION:
 *
 * LOGIC:
 *
 * ASSUMPTIONS:
 *
 * NOTE:
 *
 * @param  
 *
 * @return None.
 *
 */
static v_VOID_t tx_main_timer_func( v_PVOID_t functionContext )
{
   TX_TIMER *timer_ptr = (TX_TIMER *)functionContext;


   if (NULL == timer_ptr)
   {
       VOS_ASSERT(0);
       return;
   }


   if (NULL == timer_ptr->pExpireFunc)
   {
       VOS_ASSERT(0);
       return;
   }

   VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, 
             "Timer %s triggered", TIMER_NAME);

   // Now call the actual timer function, taking the function pointer,
   // from the timer structure.
   (* timer_ptr->pExpireFunc)( timer_ptr->pMac, timer_ptr->expireInput );

   // check if this needs to be rescheduled
   if (0 != timer_ptr->rescheduleTimeInMsecs)
   {
      VOS_STATUS status;
      status = vos_timer_start( &timer_ptr->vosTimer, 
                                timer_ptr->rescheduleTimeInMsecs );
      timer_ptr->rescheduleTimeInMsecs = 0;

      if (VOS_STATUS_SUCCESS != status)
      {
         VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN, 
             "Unable to reschedule timer %s; status=%d", TIMER_NAME, status);
      }
   }
} /*** tx_timer_change() ***/
Exemplo n.º 9
0
/**============================================================================
  @brief hdd_tx_fetch_packet_cbk() - Callback function invoked by TL to 
  fetch a packet for transmission.

  @param vosContext   : [in] pointer to VOS context  
  @param staId        : [in] Station for which TL is requesting a pkt
  @param ac           : [in] access category requested by TL
  @param pVosPacket   : [out] pointer to VOS packet packet pointer
  @param pPktMetaInfo : [out] pointer to meta info for the pkt 
  
  @return             : VOS_STATUS_E_EMPTY if no packets to transmit
                      : VOS_STATUS_E_FAILURE if any errors encountered 
                      : VOS_STATUS_SUCCESS otherwise
  ===========================================================================*/
VOS_STATUS hdd_tx_fetch_packet_cbk( v_VOID_t *vosContext,
                                    v_U8_t *pStaId,
                                    WLANTL_ACEnumType  ac,
                                    vos_pkt_t **ppVosPacket,
                                    WLANTL_MetaInfoType *pPktMetaInfo )
{
   VOS_STATUS status = VOS_STATUS_E_FAILURE;
   hdd_adapter_t *pAdapter = NULL;
   hdd_context_t *pHddCtx = NULL;
   hdd_list_node_t *anchor = NULL;
   skb_list_node_t *pktNode = NULL;
   struct sk_buff *skb = NULL;
   vos_pkt_t *pVosPacket = NULL;
   v_MACADDR_t* pDestMacAddress = NULL;
   v_TIME_t timestamp;
   WLANTL_ACEnumType newAc;
   v_SIZE_t size = 0;
   tANI_U8   acAdmitted, i;

   //Sanity check on inputs
   if ( ( NULL == vosContext ) || 
        ( NULL == pStaId ) || 
        ( NULL == ppVosPacket ) ||
        ( NULL == pPktMetaInfo ) )
   {
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Null Params being passed", __FUNCTION__);
      return VOS_STATUS_E_FAILURE;
   }

   //Get the HDD context.
   pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, vosContext );
   if(pHddCtx == NULL)
   {
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
      return VOS_STATUS_E_FAILURE;
   }
 
   pAdapter = pHddCtx->sta_to_adapter[*pStaId];
   if( NULL == pAdapter )
   {
      VOS_ASSERT(0);
      return VOS_STATUS_E_FAILURE;
   }

   ++pAdapter->hdd_stats.hddTxRxStats.txFetched;

   *ppVosPacket = NULL;

   //Make sure the AC being asked for is sane
   if( ac >= WLANTL_MAX_AC || ac < 0)
   {
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: Invalid AC %d passed by TL", __FUNCTION__, ac);
      return VOS_STATUS_E_FAILURE;
   }

   ++pAdapter->hdd_stats.hddTxRxStats.txFetchedAC[ac];

#ifdef HDD_WMM_DEBUG
   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"%s: AC %d passed by TL", __FUNCTION__, ac);
#endif // HDD_WMM_DEBUG

   // We find an AC with packets
   // or we determine we have no more packets to send
   // HDD is not allowed to change AC.

   // has this AC been admitted? or 
   // To allow EAPOL packets when not authenticated
   if (unlikely((0==pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessAllowed) &&
                (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.uIsAuthenticated))
   {
      ++pAdapter->hdd_stats.hddTxRxStats.txFetchEmpty;
#ifdef HDD_WMM_DEBUG
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
                 "%s: no packets pending", __FUNCTION__);
#endif // HDD_WMM_DEBUG
      return VOS_STATUS_E_FAILURE;
   }
      
   // do we have any packets pending in this AC?
   hdd_list_size( &pAdapter->wmm_tx_queue[ac], &size ); 
   if( size >  0 )
   {
       // yes, so process it
#ifdef HDD_WMM_DEBUG
       VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
                       "%s: AC %d has packets pending", __FUNCTION__, ac);
#endif // HDD_WMM_DEBUG
   }
   else
   {
      ++pAdapter->hdd_stats.hddTxRxStats.txFetchEmpty;
#ifdef HDD_WMM_DEBUG
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
                   "%s: no packets pending", __FUNCTION__);
#endif // HDD_WMM_DEBUG
      return VOS_STATUS_E_FAILURE;
   }

   //Get the vos packet. I don't want to dequeue and enqueue again if we are out of VOS resources 
   //This simplifies the locking and unlocking of Tx queue
   status = vos_pkt_wrap_data_packet( &pVosPacket, 
                                      VOS_PKT_TYPE_TX_802_3_DATA, 
                                      NULL, //OS Pkt is not being passed
                                      hdd_tx_low_resource_cbk, 
                                      pAdapter );

   if (status == VOS_STATUS_E_ALREADY || status == VOS_STATUS_E_RESOURCES)
   {
      //Remember VOS is in a low resource situation
      pAdapter->isVosOutOfResource = VOS_TRUE;
      ++pAdapter->hdd_stats.hddTxRxStats.txFetchLowResources;
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,"%s: VOSS in Low Resource scenario", __FUNCTION__);
      //TL will now think we have no more packets in this AC
      return VOS_STATUS_E_FAILURE;
   }

   //Remove the packet from the queue
   spin_lock_bh(&pAdapter->wmm_tx_queue[ac].lock);
   status = hdd_list_remove_front( &pAdapter->wmm_tx_queue[ac], &anchor );
   spin_unlock_bh(&pAdapter->wmm_tx_queue[ac].lock);

   if(VOS_STATUS_SUCCESS == status)
   {
      //If success then we got a valid packet from some AC
      pktNode = list_entry(anchor, skb_list_node_t, anchor);
      skb = pktNode->skb;
   }
   else
   {
      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeueError;
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "%s: Error in de-queuing "
         "skb from Tx queue status = %d", __FUNCTION__, status );
      vos_pkt_return_packet(pVosPacket);
      return VOS_STATUS_E_FAILURE;
   }

   //Attach skb to VOS packet.
   status = vos_pkt_set_os_packet( pVosPacket, skb );
   if (status != VOS_STATUS_SUCCESS)
   {
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,"%s: Error attaching skb", __FUNCTION__);
      vos_pkt_return_packet(pVosPacket);
      ++pAdapter->stats.tx_dropped;
      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeueError;
      kfree_skb(skb);
      return VOS_STATUS_E_FAILURE;
   }

   //Just being paranoid. To be removed later
   if(pVosPacket == NULL)
   {
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,"%s: VOS packet returned by VOSS is NULL", __FUNCTION__);
      ++pAdapter->stats.tx_dropped;
      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeueError;
      kfree_skb(skb);
      return VOS_STATUS_E_FAILURE;
   }

   //Return VOS packet to TL;
   *ppVosPacket = pVosPacket;

   //Fill out the meta information needed by TL
   //FIXME This timestamp is really the time stamp of wrap_data_packet
   vos_pkt_get_timestamp( pVosPacket, &timestamp );
   pPktMetaInfo->usTimeStamp = (v_U16_t)timestamp;
   
   if(pAdapter->sessionCtx.station.conn_info.uIsAuthenticated == VOS_TRUE)
      pPktMetaInfo->ucIsEapol = 0;       
   else 
      pPktMetaInfo->ucIsEapol = hdd_IsEAPOLPacket( pVosPacket ) ? 1 : 0;

#ifdef FEATURE_WLAN_WAPI
   // Override usIsEapol value when its zero for WAPI case
      pPktMetaInfo->ucIsWai = hdd_IsWAIPacket( pVosPacket ) ? 1 : 0;
#endif /* FEATURE_WLAN_WAPI */

   if ((HDD_WMM_USER_MODE_NO_QOS == pHddCtx->cfg_ini->WmmMode) ||
       (!pAdapter->hddWmmStatus.wmmQap))
   {
      // either we don't want QoS or the AP doesn't support QoS
      pPktMetaInfo->ucUP = 0;
      pPktMetaInfo->ucTID = 0;
   }
   else
   {
      /* 1. Check if ACM is set for this AC 
       * 2. If set, check if this AC had already admitted 
       * 3. If not already admitted, downgrade the UP to next best UP */
      if(!pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcAccessRequired ||
         pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecValid)
      {
        pPktMetaInfo->ucUP = pktNode->userPriority;
        pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
      }
      else
      {
        //Downgrade the UP
        acAdmitted = pAdapter->hddWmmStatus.wmmAcStatus[ac].wmmAcTspecValid;
        newAc = WLANTL_AC_BK;
        for (i=ac-1; i>0; i--)
        {
            if (pAdapter->hddWmmStatus.wmmAcStatus[i].wmmAcAccessRequired == 0)
            {
                newAc = i;
                break;
            }
        }
        pPktMetaInfo->ucUP = hddWmmAcToHighestUp[newAc];
        pPktMetaInfo->ucTID = pPktMetaInfo->ucUP;
        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW,"Downgrading UP %d to UP %d ", pktNode->userPriority, pPktMetaInfo->ucUP);
      }
   }

   pPktMetaInfo->ucType = 0;          //FIXME Don't know what this is
   pPktMetaInfo->ucDisableFrmXtl = 0; //802.3 frame so we need to xlate
   if ( 1 < size )
   {
       pPktMetaInfo->bMorePackets = 1; //HDD has more packets to send
   }
   else
   {
       pPktMetaInfo->bMorePackets = 0;
   }

   //Extract the destination address from ethernet frame
   pDestMacAddress = (v_MACADDR_t*)skb->data;
   pPktMetaInfo->ucBcast = vos_is_macaddr_broadcast( pDestMacAddress ) ? 1 : 0;
   pPktMetaInfo->ucMcast = vos_is_macaddr_group( pDestMacAddress ) ? 1 : 0;

   

   // if we are in a backpressure situation see if we can turn the hose back on
   if ( (pAdapter->isTxSuspended[ac]) &&
        (size <= HDD_TX_QUEUE_LOW_WATER_MARK) )
   {
      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDePressured;
      ++pAdapter->hdd_stats.hddTxRxStats.txFetchDePressuredAC[ac];
      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
                 "%s: TX queue[%d] re-enabled", __FUNCTION__, ac);
      pAdapter->isTxSuspended[ac] = VOS_FALSE;      
      netif_tx_wake_queue(netdev_get_tx_queue(pAdapter->dev, 
                                        skb_get_queue_mapping(skb) ));
   }


   // We're giving the packet to TL so consider it transmitted from
   // a statistics perspective.  We account for it here instead of
   // when the packet is returned for two reasons.  First, TL will
   // manipulate the skb to the point where the len field is not
   // accurate, leading to inaccurate byte counts if we account for
   // it later.  Second, TL does not provide any feedback as to
   // whether or not the packet was successfully sent over the air,
   // so the packet counts will be the same regardless of where we
   // account for them
   pAdapter->stats.tx_bytes += skb->len;
   ++pAdapter->stats.tx_packets;
   ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeued;
   ++pAdapter->hdd_stats.hddTxRxStats.txFetchDequeuedAC[ac];

   if(pHddCtx->cfg_ini->thermalMitigationEnable)
   {
      if(mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock))
      {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                    "%s: Tm Lock fail", __FUNCTION__);
         return VOS_STATUS_E_FAILURE;
      }
      if(WLAN_HDD_TM_LEVEL_1 < pHddCtx->tmInfo.currentTmLevel)
      {
         if(0 == pHddCtx->tmInfo.txFrameCount)
         {
            /* Just recovered from sleep timeout */
            pHddCtx->tmInfo.lastOpenTs = timestamp;
         }

         if(((timestamp - pHddCtx->tmInfo.lastOpenTs) > (pHddCtx->tmInfo.tmAction.txOperationDuration / 10)) &&
            (pHddCtx->tmInfo.txFrameCount >= pHddCtx->tmInfo.tmAction.txBlockFrameCountThreshold))
         {
            spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
            /* During TX open duration, TX frame count is larger than threshold
             * Block TX during Sleep time */
            netif_tx_stop_all_queues(pAdapter->dev);
            spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);
            pHddCtx->tmInfo.lastblockTs = timestamp;
            if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pHddCtx->tmInfo.txSleepTimer))
            {
               vos_timer_start(&pHddCtx->tmInfo.txSleepTimer, pHddCtx->tmInfo.tmAction.txSleepDuration);
            }
         }
         else if(((timestamp - pHddCtx->tmInfo.lastOpenTs) > (pHddCtx->tmInfo.tmAction.txOperationDuration / 10)) &&
                 (pHddCtx->tmInfo.txFrameCount < pHddCtx->tmInfo.tmAction.txBlockFrameCountThreshold))
         {
            /* During TX open duration, TX frame count is less than threshold
             * Reset count and timestamp to prepare next cycle */
            pHddCtx->tmInfo.lastOpenTs = timestamp;
            pHddCtx->tmInfo.txFrameCount = 0;
         }
         else
         {
            /* Do Nothing */
         }
         pHddCtx->tmInfo.txFrameCount++;
      }
      mutex_unlock(&pHddCtx->tmInfo.tmOperationLock);
   }


#ifdef HDD_WMM_DEBUG
   VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,"%s: Valid VOS PKT returned to TL", __FUNCTION__);
#endif // HDD_WMM_DEBUG

   return status;
}
Exemplo n.º 10
0
/**
 * pe_reset_protection_callback() - resets protection structs so that when an AP
 * causing use of protection goes away, corresponding protection bit can be
 * reset
 * @ptr:        pointer to pSessionEntry
 *
 * This function resets protection structs so that when an AP causing use of
 * protection goes away, corresponding protection bit can be reset. This allowes
 * protection bits to be reset once legacy overlapping APs are gone.
 *
 * Return: void
 */
void pe_reset_protection_callback(void *ptr)
{
    tpPESession pe_session_entry = (tpPESession)ptr;
    tpAniSirGlobal mac_ctx = (tpAniSirGlobal)pe_session_entry->mac_ctx;
    int8_t i = 0;
    tUpdateBeaconParams beacon_params;
    tANI_U16 current_protection_state = 0;
    tpDphHashNode station_hash_node = NULL;

    if (pe_session_entry->valid == false) {
        VOS_TRACE(VOS_MODULE_ID_PE,
                  VOS_TRACE_LEVEL_ERROR,
                  FL("session already deleted. exiting timer callback"));
        return;
    }

    current_protection_state |=
               pe_session_entry->gLimOverlap11gParams.protectionEnabled        |
               pe_session_entry->gLimOverlap11aParams.protectionEnabled   << 1 |
               pe_session_entry->gLimOverlapHt20Params.protectionEnabled  << 2 |
               pe_session_entry->gLimOverlapNonGfParams.protectionEnabled << 3 ;

    VOS_TRACE(VOS_MODULE_ID_PE,
              VOS_TRACE_LEVEL_INFO,
              FL("old protection state: 0x%04X, "
                 "new protection state: 0x%04X\n"),
              pe_session_entry->old_protection_state,
              current_protection_state);

    vos_mem_zero(&pe_session_entry->gLimOverlap11gParams,
                 sizeof(pe_session_entry->gLimOverlap11gParams));
    vos_mem_zero(&pe_session_entry->gLimOverlap11aParams,
                 sizeof(pe_session_entry->gLimOverlap11aParams));
    vos_mem_zero(&pe_session_entry->gLimOverlapHt20Params,
                 sizeof(pe_session_entry->gLimOverlapHt20Params));
    vos_mem_zero(&pe_session_entry->gLimOverlapNonGfParams,
                 sizeof(pe_session_entry->gLimOverlapNonGfParams));

    vos_mem_zero(&pe_session_entry->beaconParams,
                 sizeof(pe_session_entry->beaconParams));

    /* index 0, is self node, peers start from 1 */
    for(i = 1 ; i < mac_ctx->lim.gLimAssocStaLimit ; i++)
    {
        station_hash_node = dphGetHashEntry(mac_ctx, i,
                              &pe_session_entry->dph.dphHashTable);
        if (NULL == station_hash_node)
            continue;
        limDecideApProtection(mac_ctx, station_hash_node->staAddr,
                              &beacon_params, pe_session_entry);
    }

    if ((current_protection_state != pe_session_entry->old_protection_state) &&
        (VOS_FALSE == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running)) {
        VOS_TRACE(VOS_MODULE_ID_PE,
                  VOS_TRACE_LEVEL_INFO,
                  FL("protection changed, update beacon template\n"));
        /* update beacon fix params and send update to FW */
        vos_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams));
        beacon_params.bssIdx = pe_session_entry->bssIdx;
        beacon_params.fShortPreamble =
                    pe_session_entry->beaconParams.fShortPreamble;
        beacon_params.beaconInterval =
                    pe_session_entry->beaconParams.beaconInterval;
        beacon_params.llaCoexist =
                    pe_session_entry->beaconParams.llaCoexist;
        beacon_params.llbCoexist =
                    pe_session_entry->beaconParams.llbCoexist;
        beacon_params.llgCoexist =
                    pe_session_entry->beaconParams.llgCoexist;
        beacon_params.ht20MhzCoexist =
                    pe_session_entry->beaconParams.ht20Coexist;
        beacon_params.llnNonGFCoexist =
                    pe_session_entry->beaconParams.llnNonGFCoexist;
        beacon_params.fLsigTXOPProtectionFullSupport =
                pe_session_entry->beaconParams.fLsigTXOPProtectionFullSupport;
        beacon_params.fRIFSMode =
                    pe_session_entry->beaconParams.fRIFSMode;
        beacon_params.smeSessionId =
                    pe_session_entry->smeSessionId;
        schSetFixedBeaconFields(mac_ctx, pe_session_entry);
        limSendBeaconParams(mac_ctx, &beacon_params, pe_session_entry);
    }
    pe_session_entry->old_protection_state = current_protection_state;
    if (VOS_STATUS_SUCCESS != vos_timer_start(
                             &pe_session_entry->protection_fields_reset_timer,
                             SCH_PROTECTION_RESET_TIME)) {
        VOS_TRACE(VOS_MODULE_ID_PE,
                  VOS_TRACE_LEVEL_ERROR,
                  FL("cannot create or start protectionFieldsResetTimer\n"));
    }
}