wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11State.cpp
changeset 39 3d23268b50f6
parent 35 5e6ba967244f
equal deleted inserted replaced
36:1c425781161e 39:3d23268b50f6
    14 * Description:   Implementation of the WlanDot11State class.
    14 * Description:   Implementation of the WlanDot11State class.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 89 %
    19 * %version: 90 %
    20 */
    20 */
    21 
    21 
    22 #include "config.h"
    22 #include "config.h"
    23 #include "UmacDot11State.h"
    23 #include "UmacDot11State.h"
    24 #include "UmacWsaAddKey.h"
    24 #include "UmacWsaAddKey.h"
  3238 
  3238 
  3239 // -----------------------------------------------------------------------------
  3239 // -----------------------------------------------------------------------------
  3240 // 
  3240 // 
  3241 // -----------------------------------------------------------------------------
  3241 // -----------------------------------------------------------------------------
  3242 //
  3242 //
  3243 TBool WlanDot11State::InitNetworkConnect( 
  3243 TInt WlanDot11State::InitNetworkConnect( 
  3244     WlanContextImpl& aCtxImpl,
  3244     WlanContextImpl& aCtxImpl,
  3245     TUint16 aScanResponseFrameBodyLength,
  3245     TUint16 aScanResponseFrameBodyLength,
  3246     const TUint8* aScanResponseFrameBody ) const
  3246     const TUint8* aScanResponseFrameBody ) const
  3247     {
  3247     {
  3248     OsTracePrint( KUmacDetails, 
  3248     OsTracePrint( KUmacDetails, 
  3249         (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect") );
  3249         (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect") );
  3250 
  3250     
  3251     // 1st clear our BSS Membership feature list
  3251     // 1st clear our BSS Membership feature list
  3252     aCtxImpl.ClearBssMembershipFeatureList();
  3252     aCtxImpl.ClearBssMembershipFeatureList();
  3253     
  3253     
  3254     if ( aCtxImpl.WHASettings().iCapability & WHA::SSettings::KHtOperation )
  3254     if ( aCtxImpl.WHASettings().iCapability & WHA::SSettings::KHtOperation )
  3255         {
  3255         {
  3290          !(aCtxImpl.WHASettings().iCapability & WHA::SSettings::KWapi) )
  3290          !(aCtxImpl.WHASettings().iCapability & WHA::SSettings::KWapi) )
  3291         {
  3291         {
  3292         OsTracePrint( KWarningLevel, (TUint8*)
  3292         OsTracePrint( KWarningLevel, (TUint8*)
  3293             ("UMAC: WlanDot11State::InitNetworkConnect: WAPI requested but not supported by wlanpdd -> abort") );
  3293             ("UMAC: WlanDot11State::InitNetworkConnect: WAPI requested but not supported by wlanpdd -> abort") );
  3294         
  3294         
  3295         return EFalse;
  3295         return KErrNotSupported;
  3296         }
  3296         }
  3297         
  3297         
  3298     //=============================================
  3298     //=============================================
  3299     // do we meet network capability requirements
  3299     // do we meet network capability requirements
  3300     //=============================================
  3300     //=============================================
  3304         // requirements not met
  3304         // requirements not met
  3305 
  3305 
  3306         OsTracePrint( KWarningLevel, (TUint8*)
  3306         OsTracePrint( KWarningLevel, (TUint8*)
  3307             ("UMAC: WlanDot11State::InitNetworkConnect: network capabilities not met -> abort") );
  3307             ("UMAC: WlanDot11State::InitNetworkConnect: network capabilities not met -> abort") );
  3308 
  3308 
  3309         return EFalse;
  3309         return KWlanErrUnsupportedNwConf;
  3310         }
  3310         }
  3311 
  3311 
  3312     // initialize element locator for locating IEs from the scan response 
  3312     // initialize element locator for locating IEs from the scan response 
  3313     // frame body
  3313     // frame body
  3314     WlanElementLocator elementLocator( 
  3314     WlanElementLocator elementLocator( 
  3335     else
  3335     else
  3336         {
  3336         {
  3337         OsTracePrint( KWarningLevel, (TUint8*)
  3337         OsTracePrint( KWarningLevel, (TUint8*)
  3338             ("UMAC: WlanDot11State::InitNetworkConnect: 802Dot11DsParameterSetIE not found -> abort") );
  3338             ("UMAC: WlanDot11State::InitNetworkConnect: 802Dot11DsParameterSetIE not found -> abort") );
  3339 
  3339 
  3340         return EFalse;
  3340         return KWlanErrUnsupportedNwConf;
  3341         }
  3341         }
  3342 
  3342 
  3343     //=============================================
  3343     //=============================================
  3344     // determine the beacon interval of the network
  3344     // determine the beacon interval of the network
  3345     //=============================================
  3345     //=============================================
  3354     else
  3354     else
  3355         {
  3355         {
  3356         OsTracePrint( KWarningLevel, 
  3356         OsTracePrint( KWarningLevel, 
  3357             (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: zero beacon interval -> abort") );
  3357             (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: zero beacon interval -> abort") );
  3358 
  3358 
  3359         return EFalse;        
  3359         return KWlanErrUnsupportedNwConf;
  3360         }
  3360         }
  3361 
  3361 
  3362     //=============================================
  3362     //=============================================
  3363     // determine the need to use protection
  3363     // determine the need to use protection
  3364     //=============================================
  3364     //=============================================
  3464             if ( !HandleDot11n( aCtxImpl,elementLocator ) )
  3464             if ( !HandleDot11n( aCtxImpl,elementLocator ) )
  3465                 {
  3465                 {
  3466                 OsTracePrint( KWarningLevel, (TUint8*)
  3466                 OsTracePrint( KWarningLevel, (TUint8*)
  3467                     ("UMAC: WlanDot11State::InitNetworkConnect: Nw's 802.11n requirements not met -> abort") );
  3467                     ("UMAC: WlanDot11State::InitNetworkConnect: Nw's 802.11n requirements not met -> abort") );
  3468         
  3468         
  3469                 return EFalse;
  3469                 return KWlanErrUnsupportedNwConf;
  3470                 }
  3470                 }
  3471             }
  3471             }
  3472         else
  3472         else
  3473             {
  3473             {
  3474             // lower layer doesn't support HT, so we must handle the network
  3474             // lower layer doesn't support HT, so we must handle the network
  3534     else
  3534     else
  3535         {
  3535         {
  3536         OsTracePrint( KWarningLevel, (TUint8*)
  3536         OsTracePrint( KWarningLevel, (TUint8*)
  3537             ("UMAC: WlanDot11State::InitNetworkConnect: supported rates IE not found -> abort") );
  3537             ("UMAC: WlanDot11State::InitNetworkConnect: supported rates IE not found -> abort") );
  3538 
  3538 
  3539         return EFalse;
  3539         return KWlanErrUnsupportedNwConf;
  3540         }
  3540         }
  3541 
  3541 
  3542     // locate extended supported rates information element
  3542     // locate extended supported rates information element
  3543     if ( elementLocator.InformationElement( 
  3543     if ( elementLocator.InformationElement( 
  3544         E802Dot11ExtendedRatesIE,
  3544         E802Dot11ExtendedRatesIE,
  3549             ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE present") );
  3549             ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE present") );
  3550 
  3550 
  3551         // ...and store it to our context
  3551         // ...and store it to our context
  3552         aCtxImpl.GetApExtendedSupportedRatesIE().SetIeData( elementData, elementDatalength );
  3552         aCtxImpl.GetApExtendedSupportedRatesIE().SetIeData( elementData, elementDatalength );
  3553 
  3553 
  3554         // check if we meet mandatory rates; in this case check also extended supported rates
  3554         // check if we meet mandatory rates; in this case check also extended
       
  3555         // supported rates
  3555         if ( !AreSupportedRatesMet( aCtxImpl, ETrue ) )
  3556         if ( !AreSupportedRatesMet( aCtxImpl, ETrue ) )
  3556             {
  3557             {
  3557             OsTracePrint( KWarningLevel, (TUint8*)
  3558             OsTracePrint( KWarningLevel, (TUint8*)
  3558                 ("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
  3559                 ("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
  3559 
  3560 
  3560             return EFalse;
  3561             return KWlanErrUnsupportedNwConf;
  3561             }
  3562             }
  3562         }
  3563         }
  3563     else
  3564     else
  3564         {
  3565         {
  3565         OsTracePrint( KInfoLevel, (TUint8*)
  3566         OsTracePrint( KInfoLevel, (TUint8*)
  3566             ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE not present") );
  3567             ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE not present") );
  3567 
  3568 
  3568         // check if we meet mandatory rates; in this case extended supported rates 
  3569         // check if we meet mandatory rates; in this case extended supported
  3569         // don't need to be checked
  3570         // rates don't need to be checked
  3570         if ( !AreSupportedRatesMet( aCtxImpl, EFalse ) )
  3571         if ( !AreSupportedRatesMet( aCtxImpl, EFalse ) )
  3571             {
  3572             {
  3572             OsTracePrint( KWarningLevel, 
  3573             OsTracePrint( KWarningLevel, 
  3573                 (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
  3574                 (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
  3574 
  3575 
  3575             return EFalse;
  3576             return KWlanErrUnsupportedNwConf;
  3576             }            
  3577             }            
  3577         }
  3578         }
  3578 
  3579 
  3579     //=============================================
  3580     //=============================================
  3580     // determine U-APSD usage for the ACs/Tx queues
  3581     // determine U-APSD usage for the ACs/Tx queues
  3581     //=============================================
  3582     //=============================================
  3582     DetermineAcUapsdUsage( aCtxImpl );
  3583     DetermineAcUapsdUsage( aCtxImpl );
  3583     
  3584     
  3584     return ETrue;
  3585     return KErrNone;
  3585     }
  3586     }
  3586 
  3587 
  3587 // -----------------------------------------------------------------------------
  3588 // -----------------------------------------------------------------------------
  3588 // 
  3589 // 
  3589 // -----------------------------------------------------------------------------
  3590 // -----------------------------------------------------------------------------
  4923 
  4924 
  4924         // this also means that the target nw supports HT
  4925         // this also means that the target nw supports HT
  4925         aCtxImpl.HtSupportedByNw( ETrue ); 
  4926         aCtxImpl.HtSupportedByNw( ETrue ); 
  4926 
  4927 
  4927         OsTracePrint( KInfoLevel, (TUint8*)
  4928         OsTracePrint( KInfoLevel, (TUint8*)
  4928             ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities element present => HT supported by nw") );
  4929             ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities "
       
  4930              "element present") );
  4929         }
  4931         }
  4930     else
  4932     else
  4931         {
  4933         {
  4932         // not found => target nw doesn't support HT
  4934         // not found => target nw doesn't support HT
  4933         aCtxImpl.HtSupportedByNw( EFalse ); 
  4935         aCtxImpl.HtSupportedByNw( EFalse ); 
  4934         
  4936         
  4935         OsTracePrint( KInfoLevel, (TUint8*)
  4937         OsTracePrint( KInfoLevel, (TUint8*)
  4936             ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities element not found") );
  4938             ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities "
       
  4939              "element not found => HT not supported") );
  4937         }
  4940         }
  4938     
  4941     
  4939     return status;
  4942     return status;
  4940     }
  4943     }
  4941 
  4944 
  4961         aCtxImpl.GetNwHtOperationIe().SetIeData( 
  4964         aCtxImpl.GetNwHtOperationIe().SetIeData( 
  4962             elementData, 
  4965             elementData, 
  4963             elementDatalength );
  4966             elementDatalength );
  4964 
  4967 
  4965         OsTracePrint( KInfoLevel, (TUint8*)
  4968         OsTracePrint( KInfoLevel, (TUint8*)
  4966             ("UMAC: WlanDot11State::HandleHtOperation: element present") );
  4969             ("UMAC: WlanDot11State::HandleHtOperation: element present. "
       
  4970              "HT supported") );
  4967         }
  4971         }
  4968     else
  4972     else
  4969         {
  4973         {
  4970         // not found even though HT capabilities element is present => 
  4974         // not found even though HT capabilities element is present. That's a 
  4971         // protocol error
  4975         // protocol error. The only way we can try to cope with that is to 
  4972         status = EFalse;
  4976         // handle the target nw as a non-HT nw
       
  4977         aCtxImpl.HtSupportedByNw( EFalse );
       
  4978         // in this case we need to remove HT also from our BSS membership 
       
  4979         // feature list
       
  4980         aCtxImpl.RemoveBssMembershipFeature( E802Dot11HtPhy );
  4973         
  4981         
  4974         OsTracePrint( KInfoLevel, (TUint8*)
  4982         OsTracePrint( KInfoLevel, (TUint8*)
  4975             ("UMAC: WlanDot11State::HandleHtOperation: element not found => protocol error") );
  4983             ("UMAC: WlanDot11State::HandleHtOperation: element not found; "
       
  4984              "protocol error => HT disabled ") );
  4976         }
  4985         }
  4977     
  4986     
  4978     return status;
  4987     return status;
  4979     }
  4988     }
  4980 
  4989