Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41c7c5f8 authored by Srinivas Girigowda's avatar Srinivas Girigowda Committed by Kiet Lam
Browse files

wlan: Prefer 5G AP over 2.4G by Rssi margin

The objective is to prefer connecting to 5G AP even if its RSSI is lower
by gSelect5GHzMargin dBm than 2.4G AP.
For e.g., if gSelect5GHzMargin=30
2.4G AP is -29 dBm and 5G AP is -59 then prefer 5G AP
2.4G AP is -29 dBm and 5G AP is -61 then prefer 2.4G AP

Current behavior:
1. The current behavior was each BSS is assigned as preference value based
on the RSSI bucket; 0-30 dBm is assigned highest preference value (14)
and then each bucket is formed "gRssiCatGap" width.
31-35 has next preference value(13) and so on.
Only if both the 2.4G and 5G AP falls in the same bucket both will have
same preference value; then check is done for BSS capabilities as
tie breaker. Weight-age of +1 is added for every capability support
like QoS/UAPSD, 11n or 5G.
BSS with higher capability value will be selected.
(If capability is also same, then first AP is selected)

Fix Approach:
1. The highest preference value RSSI bucket is extended to
{Best AP Rssi in the scan result to Best AP Rssi + gSelect5GHzMargin}
In the above example,
first category bucket will be from -29 to -59 dBm and from 2nd bucket
onwards it is same behaviour -60 to -64 dBm.
If the Best AP is 2.4G AP with Rssi -29 then this ensures all APs till
-59 dBm are parked in the same bucket, if the 5G AP falls in this bucket;
then it will be selected.
This feature requires the dependent cfg.ini "gRoamPrefer5GHz" set to 1.
and it is enabled by default.
If "gRoamPrefer5GHz" set to 1, then weightage of +1 is added to 5G AP.
if gSelect5GHzMargin set to 0, then this feature is disabled.
if gSelect5GHzMargin set to non-zero then first category bucket is modified
to (best AP rssi) to (best AP rssi + gSelect5GHzMargin) and capability
checking for 11n, QoS are ignored.

2. After each scanning is complete and get scan result is issued,
Go through the scan list and find out the best AP Rssi; based on this
RSSI modify the category bucket.
Update the preference value for each BSS

3. if gSelect5GHzMargin set to non-zero; then gRoamRssiDiff is implicitly
set to 0, so that firmware returns all the APs above look down threshold

Change-Id: I1410a7a8f99f6b5fad421bd13ef169b8560d4492
CRs-Fixed: 549639
parent c8e1eb5c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1920,6 +1920,14 @@ typedef enum
#define CFG_AMSDU_SUPPORT_IN_AMPDU_MAX                 (1)
#define CFG_AMSDU_SUPPORT_IN_AMPDU_DEFAULT             (0) //disabled

/* Prefer connecting to 5G AP even if its RSSI is lower by
 gSelect5GHzMargin dBm than 2.4G AP.
This feature requires the dependent cfg.ini "gRoamPrefer5GHz" set to 1 */
#define CFG_STRICT_5GHZ_PREF_BY_MARGIN                 "gSelect5GHzMargin"
#define CFG_STRICT_5GHZ_PREF_BY_MARGIN_MIN             (0)
#define CFG_STRICT_5GHZ_PREF_BY_MARGIN_MAX             (60)
#define CFG_STRICT_5GHZ_PREF_BY_MARGIN_DEFAULT         (0) //set 0 to disable

/*--------------------------------------------------------------------------- 
  Type declarations
  -------------------------------------------------------------------------*/ 
@@ -2320,6 +2328,7 @@ typedef struct
   v_U32_t                     configPNOScanTimerRepeatValue;
#endif
   v_U8_t                      isAmsduSupportInAMPDU;
   v_U8_t                      nSelect5GHzMargin;
} hdd_config_t;
/*--------------------------------------------------------------------------- 
  Function declarations and documenation
+32 −0
Original line number Diff line number Diff line
@@ -88,6 +88,25 @@ static void cbNotifySetImmediateRoamRssiDiff(hdd_context_t *pHddCtx, unsigned lo

static void cbNotifySetRoamRssiDiff(hdd_context_t *pHddCtx, unsigned long NotifyId)
{
    if (pHddCtx->cfg_ini->nSelect5GHzMargin)
    {
        /*
           LFR2.0 firmware posts roam candidates whose RSSI is above the
           look down threshold and RoamRssiDiff better than current AP Rssi.
           if gSelect5GHzMargin is non-zero; then the expectation is firmware
           should post all the roam candidates whose RSSI is above lookdown
           threshold and don't ignore the APs in RoamRssiDiff zone.

           For ex: RoamRssiDiff=5, Lookdown threshold=-78 and
           gSelect5GHzMargin=30 then firmware selects APs
           with Rssi -73 or better as roam candidates.
           if the 5G AP Rssi is -75 it will be ignored.
           if 2.4G AP Rssi is -45 and 5G AP with -75 is available,
           STA should connect to 5G AP, hence RoamRssiDiff is set to 0.
        */
        pHddCtx->cfg_ini->RoamRssiDiff = 0;
    }

    sme_UpdateRoamRssiDiff((tHalHandle)(pHddCtx->hHal),
                                    pHddCtx->cfg_ini->RoamRssiDiff);
}
@@ -2757,6 +2776,13 @@ REG_VARIABLE( CFG_TDLS_PUAPSD_RX_FRAME_THRESHOLD, WLAN_PARAM_Integer,
                 CFG_AMSDU_SUPPORT_IN_AMPDU_MIN,
                 CFG_AMSDU_SUPPORT_IN_AMPDU_MAX ),

   REG_VARIABLE( CFG_STRICT_5GHZ_PREF_BY_MARGIN , WLAN_PARAM_Integer,
                 hdd_config_t, nSelect5GHzMargin,
                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
                 CFG_STRICT_5GHZ_PREF_BY_MARGIN_DEFAULT,
                 CFG_STRICT_5GHZ_PREF_BY_MARGIN_MIN,
                 CFG_STRICT_5GHZ_PREF_BY_MARGIN_MAX ),

};

/*
@@ -3147,6 +3173,7 @@ static void print_hdd_cfg(hdd_context_t *pHddCtx)
  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gGoKeepAlivePeriod] Value = [%u]",pHddCtx->cfg_ini->goKeepAlivePeriod);
  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gApKeepAlivePeriod]Value = [%u]",pHddCtx->cfg_ini->apKeepAlivePeriod);
  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gAmsduSupportInAMPDU] Value = [%lu] ",pHddCtx->cfg_ini->isAmsduSupportInAMPDU);
  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [nSelect5GHzMargin] Value = [%lu] ",pHddCtx->cfg_ini->nSelect5GHzMargin);

}

@@ -4494,6 +4521,10 @@ VOS_STATUS hdd_set_sme_config( hdd_context_t *pHddCtx )
#endif
#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
   smeConfig.csrConfig.isFastTransitionEnabled = pConfig->isFastTransitionEnabled;
   if (pConfig->nSelect5GHzMargin)
   {
       pConfig->RoamRssiDiff = 0;
   }
   smeConfig.csrConfig.RoamRssiDiff = pConfig->RoamRssiDiff;
   smeConfig.csrConfig.nImmediateRoamRssiDiff = pConfig->nImmediateRoamRssiDiff;
   smeConfig.csrConfig.isWESModeEnabled = pConfig->isWESModeEnabled;
@@ -4536,6 +4567,7 @@ VOS_STATUS hdd_set_sme_config( hdd_context_t *pHddCtx )
   smeConfig.csrConfig.enableTxLdpc = pConfig->enableTxLdpc;

   smeConfig.csrConfig.isAmsduSupportInAMPDU = pConfig->isAmsduSupportInAMPDU;
   smeConfig.csrConfig.nSelect5GHzMargin = pConfig->nSelect5GHzMargin;

   /* update SSR config */
   sme_UpdateEnableSSR((tHalHandle)(pHddCtx->hHal), pHddCtx->cfg_ini->enableSSR);
+1 −0
Original line number Diff line number Diff line
@@ -1124,6 +1124,7 @@ typedef struct tagCsrConfigParam
    tANI_U8   enableTxLdpc;

    tANI_U8 isAmsduSupportInAMPDU;
    tANI_U8 nSelect5GHzMargin;

}tCsrConfigParam;

+7 −0
Original line number Diff line number Diff line
@@ -94,6 +94,11 @@
     NULL \
)

#define CSR_IS_SELECT_5GHZ_MARGIN( pMac ) \
( \
   (((pMac)->roam.configParam.nSelect5GHzMargin)?eANI_BOOLEAN_TRUE:eANI_BOOLEAN_FALSE) \
)

#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
#define CSR_IS_ROAM_PREFER_5GHZ( pMac ) \
( \
@@ -660,6 +665,7 @@ typedef struct tagCsrConfig
     */
    tANI_BOOLEAN enableHeartBeatOffload;
    tANI_U8 isAmsduSupportInAMPDU;
    tANI_U8 nSelect5GHzMargin;
}tCsrConfig;

typedef struct tagCsrChannelPowerInfo
@@ -770,6 +776,7 @@ typedef struct tagCsrScanStruct
    tDblLinkList scanCmdPendingList;
#endif
    tCsrChannel occupiedChannels;   //This includes all channels on which candidate APs are found
    tANI_S8     inScanResultBestAPRssi;
}tCsrScanStruct;

#ifdef FEATURE_WLAN_TDLS_INTERNAL
+6 −4
Original line number Diff line number Diff line
@@ -930,7 +930,7 @@ eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamStat
    return( PreviousState );
}
void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_U8 catOffset)
void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_S8 bestApRssi, tANI_U8 catOffset)
{
    int i;
    if(catOffset)
@@ -938,7 +938,7 @@ void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_U8 catOffset)
        pMac->roam.configParam.bCatRssiOffset = catOffset;
        for(i = 0; i < CSR_NUM_RSSI_CAT; i++)
        {
            pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - 1] = (int)CSR_BEST_RSSI_VALUE - (int)(i * catOffset);
            pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - 1] = (int)bestApRssi - pMac->roam.configParam.nSelect5GHzMargin - (int)(i * catOffset);
        }
    }
}
@@ -974,7 +974,7 @@ static void initConfigParam(tpAniSirGlobal pMac)
    {
        pMac->roam.configParam.BssPreferValue[i] = i;
    }
    csrAssignRssiForCategory(pMac, CSR_DEFAULT_RSSI_DB_GAP);
    csrAssignRssiForCategory(pMac, CSR_BEST_RSSI_VALUE, CSR_DEFAULT_RSSI_DB_GAP);
    pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME;
    pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE;
    pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE;
@@ -1607,7 +1607,7 @@ eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pPa
            pMac->roam.configParam.scanAgeTimeCPS = pParam->scanAgeTimeCPS;   
        }
        
        csrAssignRssiForCategory(pMac, pParam->bCatRssiOffset);
        csrAssignRssiForCategory(pMac, CSR_BEST_RSSI_VALUE, pParam->bCatRssiOffset);
        pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime;
        pMac->roam.configParam.fEnforce11dChannels = pParam->fEnforce11dChannels;
        pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority;
@@ -1712,6 +1712,7 @@ eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pPa
        pMac->roam.configParam.txLdpcEnable = pParam->enableTxLdpc;
        pMac->roam.configParam.isAmsduSupportInAMPDU = pParam->isAmsduSupportInAMPDU;
        pMac->roam.configParam.nSelect5GHzMargin = pParam->nSelect5GHzMargin;
    }
    
    return status;
@@ -1842,6 +1843,7 @@ eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam)
        pParam->enableTxLdpc = pMac->roam.configParam.txLdpcEnable;
        pParam->isAmsduSupportInAMPDU = pMac->roam.configParam.isAmsduSupportInAMPDU;
        pParam->nSelect5GHzMargin = pMac->roam.configParam.nSelect5GHzMargin;
        csrSetChannels(pMac, pParam);
Loading