wlan_bearer/wlanldd/wlan_common/umac_common/src/UmacDot11State.cpp
branchRCL_3
changeset 14 13838cf40350
parent 12 af3fb27c7511
child 17 a828660c511c
equal deleted inserted replaced
12:af3fb27c7511 14:13838cf40350
    14 * Description:   Implementation of the WlanDot11State class.
    14 * Description:   Implementation of the WlanDot11State class.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 86.1.1 %
    19 * %version: 86.1.3 %
    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"
  3239 
  3239 
  3240 // -----------------------------------------------------------------------------
  3240 // -----------------------------------------------------------------------------
  3241 // 
  3241 // 
  3242 // -----------------------------------------------------------------------------
  3242 // -----------------------------------------------------------------------------
  3243 //
  3243 //
  3244 TBool WlanDot11State::InitNetworkConnect( 
  3244 TInt WlanDot11State::InitNetworkConnect( 
  3245     WlanContextImpl& aCtxImpl,
  3245     WlanContextImpl& aCtxImpl,
  3246     TUint16 aScanResponseFrameBodyLength,
  3246     TUint16 aScanResponseFrameBodyLength,
  3247     const TUint8* aScanResponseFrameBody ) const
  3247     const TUint8* aScanResponseFrameBody ) const
  3248     {
  3248     {
  3249     OsTracePrint( KUmacDetails, 
  3249     OsTracePrint( KUmacDetails, 
  3250         (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect") );
  3250         (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect") );
  3251 
  3251     
       
  3252     // 1st clear our BSS Membership feature list
       
  3253     aCtxImpl.ClearBssMembershipFeatureList();
       
  3254     
       
  3255     if ( aCtxImpl.WHASettings().iCapability & WHA::SSettings::KHtOperation )
       
  3256         {
       
  3257         // wlanpdd indicates HT support. Record that in our BSS Membership
       
  3258         // features
       
  3259         aCtxImpl.AddBssMembershipFeature( E802Dot11HtPhy );
       
  3260         }
       
  3261     
  3252     const SScanResponseFixedFields* scanResponseFixedFields = 
  3262     const SScanResponseFixedFields* scanResponseFixedFields = 
  3253         reinterpret_cast<const SScanResponseFixedFields*>( 
  3263         reinterpret_cast<const SScanResponseFixedFields*>( 
  3254             aScanResponseFrameBody );
  3264             aScanResponseFrameBody );
  3255 
  3265 
  3256     // store capability info from scan response frame body to our context
  3266     // store capability info from scan response frame body to our context
  3281          !(aCtxImpl.WHASettings().iCapability & WHA::SSettings::KWapi) )
  3291          !(aCtxImpl.WHASettings().iCapability & WHA::SSettings::KWapi) )
  3282         {
  3292         {
  3283         OsTracePrint( KWarningLevel, (TUint8*)
  3293         OsTracePrint( KWarningLevel, (TUint8*)
  3284             ("UMAC: WlanDot11State::InitNetworkConnect: WAPI requested but not supported by wlanpdd -> abort") );
  3294             ("UMAC: WlanDot11State::InitNetworkConnect: WAPI requested but not supported by wlanpdd -> abort") );
  3285         
  3295         
  3286         return EFalse;
  3296         return KErrNotSupported;
  3287         }
  3297         }
  3288         
  3298         
  3289     //=============================================
  3299     //=============================================
  3290     // do we meet network capability requirements
  3300     // do we meet network capability requirements
  3291     //=============================================
  3301     //=============================================
  3295         // requirements not met
  3305         // requirements not met
  3296 
  3306 
  3297         OsTracePrint( KWarningLevel, (TUint8*)
  3307         OsTracePrint( KWarningLevel, (TUint8*)
  3298             ("UMAC: WlanDot11State::InitNetworkConnect: network capabilities not met -> abort") );
  3308             ("UMAC: WlanDot11State::InitNetworkConnect: network capabilities not met -> abort") );
  3299 
  3309 
  3300         return EFalse;
  3310         return KWlanErrUnsupportedNwConf;
  3301         }
  3311         }
  3302 
       
  3303     // network capabilities are met -> proceed
       
  3304 
       
  3305 
  3312 
  3306     // initialize element locator for locating IEs from the scan response 
  3313     // initialize element locator for locating IEs from the scan response 
  3307     // frame body
  3314     // frame body
  3308     WlanElementLocator elementLocator( 
  3315     WlanElementLocator elementLocator( 
  3309         reinterpret_cast<const TUint8*>( scanResponseFixedFields + 1 ), 
  3316         reinterpret_cast<const TUint8*>( scanResponseFixedFields + 1 ), 
  3310         aScanResponseFrameBodyLength - 
  3317         aScanResponseFrameBodyLength - 
  3311         sizeof( SScanResponseFixedFields ) );
  3318         sizeof( SScanResponseFixedFields ) );
  3312 
  3319 
  3313     TUint8 elementDatalength( 0 );
  3320     TUint8 elementDatalength( 0 );
  3314     const TUint8* elementData( NULL );
  3321     const TUint8* elementData( NULL );
  3315     
  3322         
  3316     //=============================================
       
  3317     // do we meet mandatory network rates
       
  3318     //=============================================
       
  3319 
       
  3320     // locate supported rates IE
       
  3321     if ( elementLocator.InformationElement( 
       
  3322         E802Dot11SupportedRatesIE,
       
  3323         elementDatalength, 
       
  3324         &elementData ) == WlanElementLocator::EWlanLocateOk )
       
  3325         {
       
  3326         // ...and store it to our context
       
  3327         aCtxImpl.GetApSupportedRatesIE().SetIeData( 
       
  3328             elementData, 
       
  3329             elementDatalength );        
       
  3330         }
       
  3331     else
       
  3332         {
       
  3333         OsTracePrint( KWarningLevel, (TUint8*)
       
  3334             ("UMAC: WlanDot11State::InitNetworkConnect: supported rates IE not found -> abort") );
       
  3335 
       
  3336         return EFalse;
       
  3337         }
       
  3338 
       
  3339     // locate extended supported rates information element
       
  3340     if ( elementLocator.InformationElement( 
       
  3341         E802Dot11ExtendedRatesIE,
       
  3342         elementDatalength, 
       
  3343         &elementData ) == WlanElementLocator::EWlanLocateOk )
       
  3344         {
       
  3345         OsTracePrint( KInfoLevel, (TUint8*)
       
  3346             ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE present") );
       
  3347 
       
  3348         // ...and store it to our context
       
  3349         aCtxImpl.GetApExtendedSupportedRatesIE().SetIeData( elementData, elementDatalength );
       
  3350 
       
  3351         // check if we meet mandatory rates; in this case check also extended supported rates
       
  3352         if ( !AreSupportedRatesMet( aCtxImpl, ETrue ) )
       
  3353             {
       
  3354             OsTracePrint( KWarningLevel, (TUint8*)
       
  3355                 ("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
       
  3356 
       
  3357             return EFalse;
       
  3358             }
       
  3359         }
       
  3360     else
       
  3361         {
       
  3362         OsTracePrint( KInfoLevel, (TUint8*)
       
  3363             ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE not present") );
       
  3364 
       
  3365         // check if we meet mandatory rates; in this case extended supported rates 
       
  3366         // don't need to be checked
       
  3367         if ( !AreSupportedRatesMet( aCtxImpl, EFalse ) )
       
  3368             {
       
  3369             OsTracePrint( KWarningLevel, 
       
  3370                 (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
       
  3371 
       
  3372             return EFalse;
       
  3373             }            
       
  3374         }
       
  3375 
       
  3376     // mandatory network rates are met -> proceed
       
  3377     
       
  3378     //=============================================
  3323     //=============================================
  3379     // determine the channel of the network
  3324     // determine the channel of the network
  3380     //=============================================
  3325     //=============================================
  3381 
  3326 
  3382     // locate DS parameter set information element
  3327     // locate DS parameter set information element
  3391     else
  3336     else
  3392         {
  3337         {
  3393         OsTracePrint( KWarningLevel, (TUint8*)
  3338         OsTracePrint( KWarningLevel, (TUint8*)
  3394             ("UMAC: WlanDot11State::InitNetworkConnect: 802Dot11DsParameterSetIE not found -> abort") );
  3339             ("UMAC: WlanDot11State::InitNetworkConnect: 802Dot11DsParameterSetIE not found -> abort") );
  3395 
  3340 
  3396         return EFalse;
  3341         return KWlanErrUnsupportedNwConf;
  3397         }
  3342         }
  3398 
  3343 
  3399     //=============================================
  3344     //=============================================
  3400     // determine the beacon interval of the network
  3345     // determine the beacon interval of the network
  3401     //=============================================
  3346     //=============================================
  3410     else
  3355     else
  3411         {
  3356         {
  3412         OsTracePrint( KWarningLevel, 
  3357         OsTracePrint( KWarningLevel, 
  3413             (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: zero beacon interval -> abort") );
  3358             (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: zero beacon interval -> abort") );
  3414 
  3359 
  3415         return EFalse;        
  3360         return KWlanErrUnsupportedNwConf;
  3416         }
  3361         }
  3417 
  3362 
  3418     //=============================================
  3363     //=============================================
  3419     // determine the need to use protection
  3364     // determine the need to use protection
  3420     //=============================================
  3365     //=============================================
  3520             if ( !HandleDot11n( aCtxImpl,elementLocator ) )
  3465             if ( !HandleDot11n( aCtxImpl,elementLocator ) )
  3521                 {
  3466                 {
  3522                 OsTracePrint( KWarningLevel, (TUint8*)
  3467                 OsTracePrint( KWarningLevel, (TUint8*)
  3523                     ("UMAC: WlanDot11State::InitNetworkConnect: Nw's 802.11n requirements not met -> abort") );
  3468                     ("UMAC: WlanDot11State::InitNetworkConnect: Nw's 802.11n requirements not met -> abort") );
  3524         
  3469         
  3525                 return EFalse;
  3470                 return KWlanErrUnsupportedNwConf;
  3526                 }
  3471                 }
  3527             }
  3472             }
  3528         else
  3473         else
  3529             {
  3474             {
  3530             // lower layer doesn't support HT, so we must handle the network
  3475             // lower layer doesn't support HT, so we must handle the network
  3571             aCtxImpl.AtimWindow( 0 );
  3516             aCtxImpl.AtimWindow( 0 );
  3572             }
  3517             }
  3573         }
  3518         }
  3574 
  3519 
  3575     //=============================================
  3520     //=============================================
       
  3521     // do we meet mandatory network rates
       
  3522     //=============================================
       
  3523 
       
  3524     // locate supported rates IE
       
  3525     if ( elementLocator.InformationElement( 
       
  3526         E802Dot11SupportedRatesIE,
       
  3527         elementDatalength, 
       
  3528         &elementData ) == WlanElementLocator::EWlanLocateOk )
       
  3529         {
       
  3530         // ...and store it to our context
       
  3531         aCtxImpl.GetApSupportedRatesIE().SetIeData( 
       
  3532             elementData, 
       
  3533             elementDatalength );        
       
  3534         }
       
  3535     else
       
  3536         {
       
  3537         OsTracePrint( KWarningLevel, (TUint8*)
       
  3538             ("UMAC: WlanDot11State::InitNetworkConnect: supported rates IE not found -> abort") );
       
  3539 
       
  3540         return KWlanErrUnsupportedNwConf;
       
  3541         }
       
  3542 
       
  3543     // locate extended supported rates information element
       
  3544     if ( elementLocator.InformationElement( 
       
  3545         E802Dot11ExtendedRatesIE,
       
  3546         elementDatalength, 
       
  3547         &elementData ) == WlanElementLocator::EWlanLocateOk )
       
  3548         {
       
  3549         OsTracePrint( KInfoLevel, (TUint8*)
       
  3550             ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE present") );
       
  3551 
       
  3552         // ...and store it to our context
       
  3553         aCtxImpl.GetApExtendedSupportedRatesIE().SetIeData( elementData, elementDatalength );
       
  3554 
       
  3555         // check if we meet mandatory rates; in this case check also extended
       
  3556         // supported rates
       
  3557         if ( !AreSupportedRatesMet( aCtxImpl, ETrue ) )
       
  3558             {
       
  3559             OsTracePrint( KWarningLevel, (TUint8*)
       
  3560                 ("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
       
  3561 
       
  3562             return KWlanErrUnsupportedNwConf;
       
  3563             }
       
  3564         }
       
  3565     else
       
  3566         {
       
  3567         OsTracePrint( KInfoLevel, (TUint8*)
       
  3568             ("UMAC: WlanDot11State::InitNetworkConnect: E802Dot11ExtendedRatesIE not present") );
       
  3569 
       
  3570         // check if we meet mandatory rates; in this case extended supported
       
  3571         // rates don't need to be checked
       
  3572         if ( !AreSupportedRatesMet( aCtxImpl, EFalse ) )
       
  3573             {
       
  3574             OsTracePrint( KWarningLevel, 
       
  3575                 (TUint8*)("UMAC: WlanDot11State::InitNetworkConnect: rates not met -> abort") );
       
  3576 
       
  3577             return KWlanErrUnsupportedNwConf;
       
  3578             }            
       
  3579         }
       
  3580 
       
  3581     //=============================================
  3576     // determine U-APSD usage for the ACs/Tx queues
  3582     // determine U-APSD usage for the ACs/Tx queues
  3577     //=============================================
  3583     //=============================================
  3578     DetermineAcUapsdUsage( aCtxImpl );
  3584     DetermineAcUapsdUsage( aCtxImpl );
  3579     
  3585     
  3580     return ETrue;
  3586     return KErrNone;
  3581     }
  3587     }
  3582 
  3588 
  3583 // -----------------------------------------------------------------------------
  3589 // -----------------------------------------------------------------------------
  3584 // 
  3590 // 
  3585 // -----------------------------------------------------------------------------
  3591 // -----------------------------------------------------------------------------
  4919 
  4925 
  4920         // this also means that the target nw supports HT
  4926         // this also means that the target nw supports HT
  4921         aCtxImpl.HtSupportedByNw( ETrue ); 
  4927         aCtxImpl.HtSupportedByNw( ETrue ); 
  4922 
  4928 
  4923         OsTracePrint( KInfoLevel, (TUint8*)
  4929         OsTracePrint( KInfoLevel, (TUint8*)
  4924             ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities element present => HT supported by nw") );
  4930             ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities "
       
  4931              "element present") );
  4925         }
  4932         }
  4926     else
  4933     else
  4927         {
  4934         {
  4928         // not found => target nw doesn't support HT
  4935         // not found => target nw doesn't support HT
  4929         aCtxImpl.HtSupportedByNw( EFalse ); 
  4936         aCtxImpl.HtSupportedByNw( EFalse ); 
  4930         
  4937         
  4931         OsTracePrint( KInfoLevel, (TUint8*)
  4938         OsTracePrint( KInfoLevel, (TUint8*)
  4932             ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities element not found") );
  4939             ("UMAC: WlanDot11State::HandleHtCapabilities: HT capabilities "
       
  4940              "element not found => HT not supported") );
  4933         }
  4941         }
  4934     
  4942     
  4935     return status;
  4943     return status;
  4936     }
  4944     }
  4937 
  4945 
  4957         aCtxImpl.GetNwHtOperationIe().SetIeData( 
  4965         aCtxImpl.GetNwHtOperationIe().SetIeData( 
  4958             elementData, 
  4966             elementData, 
  4959             elementDatalength );
  4967             elementDatalength );
  4960 
  4968 
  4961         OsTracePrint( KInfoLevel, (TUint8*)
  4969         OsTracePrint( KInfoLevel, (TUint8*)
  4962             ("UMAC: WlanDot11State::HandleHtOperation: element present") );
  4970             ("UMAC: WlanDot11State::HandleHtOperation: element present. "
       
  4971              "HT supported") );
  4963         }
  4972         }
  4964     else
  4973     else
  4965         {
  4974         {
  4966         // not found even though HT capabilities element is present => 
  4975         // not found even though HT capabilities element is present. That's a 
  4967         // protocol error
  4976         // protocol error. The only way we can try to cope with that is to 
  4968         status = EFalse;
  4977         // handle the target nw as a non-HT nw
       
  4978         aCtxImpl.HtSupportedByNw( EFalse );
       
  4979         // in this case we need to remove HT also from our BSS membership 
       
  4980         // feature list
       
  4981         aCtxImpl.RemoveBssMembershipFeature( E802Dot11HtPhy );
  4969         
  4982         
  4970         OsTracePrint( KInfoLevel, (TUint8*)
  4983         OsTracePrint( KInfoLevel, (TUint8*)
  4971             ("UMAC: WlanDot11State::HandleHtOperation: element not found => protocol error") );
  4984             ("UMAC: WlanDot11State::HandleHtOperation: element not found; "
       
  4985              "protocol error => HT disabled ") );
  4972         }
  4986         }
  4973     
  4987     
  4974     return status;
  4988     return status;
  4975     }
  4989     }
  4976 
  4990 
  4996         // - HT use has been denied by WLAN Mgmt client
  5010         // - HT use has been denied by WLAN Mgmt client
  4997         // In these cases we must not use HT functionality, even if the target 
  5011         // In these cases we must not use HT functionality, even if the target 
  4998         // nw supported it. We achieve that by handling the target nw as
  5012         // nw supported it. We achieve that by handling the target nw as
  4999         // a non-HT nw
  5013         // a non-HT nw
  5000         aCtxImpl.HtSupportedByNw( EFalse );
  5014         aCtxImpl.HtSupportedByNw( EFalse );
       
  5015         // in this case we need to remove HT also from our BSS membership 
       
  5016         // feature list
       
  5017         aCtxImpl.RemoveBssMembershipFeature( E802Dot11HtPhy );
  5001         
  5018         
  5002         OsTracePrint( KInfoLevel, (TUint8*)
  5019         OsTracePrint( KInfoLevel, (TUint8*)
  5003             ("UMAC: WlanDot11State::HandleDot11n: TKIP as pairwise cipher "
  5020             ("UMAC: WlanDot11State::HandleDot11n: TKIP as pairwise cipher "
  5004              "OR WMM not supported OR HT use denied => HT disabled") );
  5021              "OR WMM not supported OR HT use denied => HT disabled") );
  5005         }
  5022         }