wlan: Host changes to support different BI for MCC
When P2P interface is already up, STA is not able to associate to AP MCC
scenario
Change-Id: Idc75f198438b5cf3b96a8a27cbbdcb6121197cf5
CR-Fixed: 412554
diff --git a/CORE/SME/inc/csrApi.h b/CORE/SME/inc/csrApi.h
index 735817f..f6fdf3b 100644
--- a/CORE/SME/inc/csrApi.h
+++ b/CORE/SME/inc/csrApi.h
@@ -418,6 +418,10 @@
#ifdef FEATURE_WLAN_LFR
eCSR_ROAM_PMK_NOTIFY,
#endif
+ eCSR_ROAM_DISCONNECT_ALL_P2P_CLIENTS, //Disaconnect all the clients
+ eCSR_ROAM_SEND_P2P_STOP_BSS, //Stopbss triggered from SME due to different
+ // beacon interval
+
}eRoamCmdStatus;
diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h
index 559318b..e33225b 100644
--- a/CORE/SME/inc/csrInternal.h
+++ b/CORE/SME/inc/csrInternal.h
@@ -345,6 +345,8 @@
tVOS_CON_MODE bssPersona;
tANI_U16 nRSNIELength; //The byte count in the pRSNIE, if 0, pRSNIE is ignored.
tANI_U8 *pRSNIE; //If not null, it has the IE byte stream for RSN
+ tANI_BOOLEAN updatebeaconInterval; //Flag used to indicate update
+ // beaconInterval
}tCsrRoamStartBssParams;
@@ -495,8 +497,8 @@
tANI_BOOLEAN shortSlotTime;
tANI_BOOLEAN ProprietaryRatesEnabled;
tANI_BOOLEAN fenableMCCMode;
- tANI_BOOLEAN fAllowMCCGODiffBI;
tANI_U16 TxRate;
+ tANI_U8 fAllowMCCGODiffBI;
tANI_U8 AdHocChannel24;
tANI_U8 AdHocChannel5G;
tANI_U32 impsSleepTime; //in units of microseconds
diff --git a/CORE/SME/inc/csrSupport.h b/CORE/SME/inc/csrSupport.h
index e4fa512..139e549 100644
--- a/CORE/SME/inc/csrSupport.h
+++ b/CORE/SME/inc/csrSupport.h
@@ -803,8 +803,11 @@
csrIsconcurrentsessionValid(tpAniSirGlobal pMac,tANI_U32 cursessionId,
tVOS_CON_MODE currBssPersona);
-//BeaconInterval valiadation for MCC support
-eHalStatus csrValidateBeaconInterval(tpAniSirGlobal pMac, tANI_U8 channelId,
+//Update beaconInterval for P2P-GO case if it is different
+eHalStatus csrUpdatep2pBeaconInterval(tpAniSirGlobal pMac);
+
+//BeaconInterval validation for MCC support
+eHalStatus csrValidateMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U8 channelId,
tANI_U16 *beaconInterval, tANI_U32 cursessionId,
tVOS_CON_MODE currBssPersona);
diff --git a/CORE/SME/inc/sme_Api.h b/CORE/SME/inc/sme_Api.h
index 4ccd8b5..37f9900 100644
--- a/CORE/SME/inc/sme_Api.h
+++ b/CORE/SME/inc/sme_Api.h
@@ -1595,9 +1595,9 @@
\param pAPWPSIES - pointer to a caller allocated object of tCsrRoamAPWPSIES
- \return eHalStatus SUCCESS Roam callback will be called indicate actually results
+ \return eHalStatus SUCCESS Roam callback will be called indicate actually results
- FAILURE or RESOURCES The API finished and failed.
+ FAILURE or RESOURCES The API finished and failed.
-------------------------------------------------------------------------------*/
@@ -1611,13 +1611,26 @@
\param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
- \return eHalStatus SUCCESS
+ \return eHalStatus SUCCESS
- FAILURE or RESOURCES The API finished and failed.
+ FAILURE or RESOURCES The API finished and failed.
-------------------------------------------------------------------------------*/
eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie);
+/* ---------------------------------------------------------------------------
+
+ sme_ChangeMCCBeaconInterval
+
+ \brief To update P2P-GO's beacon Interval.
+
+ \return eHalStatus SUCCESS
+ FAILURE or RESOURCES
+ The API finished and failed.
+ -------------------------------------------------------------------------------*/
+eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId);
+
+
#endif
/* ---------------------------------------------------------------------------
@@ -1625,9 +1638,8 @@
\brief API to send the btAMPstate to FW
\param hHal - The handle returned by macOpen.
\param btAmpEvent -- btAMP event
- \return eHalStatus SUCCESS
-
- FAILURE or RESOURCES The API finished and failed.
+ \return eHalStatus SUCCESS
+ FAILURE or RESOURCES The API finished and failed.
--------------------------------------------------------------------------- */
diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c
index d8778f2..91f20ef 100644
--- a/CORE/SME/src/csr/csrApiRoam.c
+++ b/CORE/SME/src/csr/csrApiRoam.c
@@ -12073,6 +12073,49 @@
} while( 0 );
return( status );
}
+
+eHalStatus
+csrSendChngMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U32 sessionId)
+{
+ tpSirChangeBIParams pMsg;
+ tANI_U16 len = 0;
+ eHalStatus status = eHAL_STATUS_SUCCESS;
+ tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
+ if(!pSession)
+ {
+ smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
+ return eHAL_STATUS_FAILURE;
+ }
+
+ //NO need to update the Beacon Params if update beacon parameter flag is not set
+ if(!pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval )
+ return eHAL_STATUS_SUCCESS;
+
+ pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE;
+
+ /* Create the message and send to lim */
+ len = sizeof(tSirChangeBIParams);
+ status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len );
+ if(HAL_STATUS_SUCCESS(status))
+ {
+ palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirChangeBIParams) );
+ pMsg->messageType = eWNI_SME_CHNG_MCC_BEACON_INTERVAL;
+ pMsg->length = len;
+
+ // bssId
+ palCopyMemory( pMac->hHdd, (tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, sizeof(tSirMacAddr) );
+ smsLog( pMac, LOG1, FL("CSR Attempting to change BI for Bssid= %02x-%02x-%02x-%02x-%02x-%02x "),
+ pMsg->bssId[ 0 ], pMsg->bssId[ 1 ], pMsg->bssId[ 2 ],
+ pMsg->bssId[ 3 ], pMsg->bssId[ 4 ], pMsg->bssId[ 5 ] );
+ pMsg->sessionId = sessionId;
+ smsLog(pMac, LOG1, FL(" session %d BeaconInterval %d\n"), sessionId, pMac->roam.roamSession[sessionId].bssParams.beaconInterval);
+ pMsg->beaconInterval = pMac->roam.roamSession[sessionId].bssParams.beaconInterval;
+ status = palSendMBMessage(pMac->hHdd, pMsg);
+ }
+ return status;
+}
+
#endif
eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode )
{
@@ -12465,7 +12508,7 @@
pParam->bssPersona)
== eHAL_STATUS_SUCCESS )
{
- csrValidateBeaconInterval(pMac, pParam->operationChn, &wTmp, sessionId,
+ csrValidateMCCBeaconInterval(pMac, pParam->operationChn, &wTmp, sessionId,
pParam->bssPersona);
//Update the beacon Interval
pParam->beaconInterval = wTmp;
diff --git a/CORE/SME/src/csr/csrInsideApi.h b/CORE/SME/src/csr/csrInsideApi.h
index 682c969..5864512 100644
--- a/CORE/SME/src/csr/csrInsideApi.h
+++ b/CORE/SME/src/csr/csrInsideApi.h
@@ -903,7 +903,16 @@
eHalStatus csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId,
tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac);
-
+
+/* ---------------------------------------------------------------------------
+ \fn csrSendChngMCCBeaconInterval
+ \brief csr function that HDD calls to send Update beacon interval
+ \param sessionId - session Id for Soft AP
+ \return eHalStatus
+ ---------------------------------------------------------------------------*/
+eHalStatus
+csrSendChngMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U32 sessionId);
+
#endif
#ifdef FEATURE_WLAN_BTAMP_UT_RF
eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval);
diff --git a/CORE/SME/src/csr/csrUtil.c b/CORE/SME/src/csr/csrUtil.c
index a3365c9..77e468f 100644
--- a/CORE/SME/src/csr/csrUtil.c
+++ b/CORE/SME/src/csr/csrUtil.c
@@ -1712,7 +1712,7 @@
pSession->pCurRoamProfile->csrPersona)
== eHAL_STATUS_SUCCESS )
{
- if(csrValidateBeaconInterval( pMac, pBssDesc->channelId,
+ if(csrValidateMCCBeaconInterval( pMac, pBssDesc->channelId,
&pBssDesc->beaconInterval, sessionId,
pSession->pCurRoamProfile->csrPersona)
!= eHAL_STATUS_SUCCESS)
@@ -2783,14 +2783,86 @@
}
-eHalStatus csrValidateBeaconInterval(tpAniSirGlobal pMac, tANI_U8 channelId,
- tANI_U16 *beaconInterval, tANI_U32 cursessionId,
- tVOS_CON_MODE currBssPersona)
+eHalStatus csrUpdateMCCp2pBeaconInterval(tpAniSirGlobal pMac)
{
tANI_U32 sessionId = 0;
//If MCC is not supported just break and return SUCCESS
- if ( !IS_MCC_SUPPORTED && !pMac->roam.configParam.fenableMCCMode){
+ if ( !pMac->roam.configParam.fenableMCCMode){
+ return eHAL_STATUS_FAILURE;
+ }
+
+ for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
+ {
+ /* If GO in MCC support different beacon interval,
+ * change the BI of the P2P-GO */
+ if((pMac->roam.roamSession[sessionId].bssParams.bssPersona
+ == VOS_P2P_GO_MODE) &&
+ (pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval ))
+ {
+ return csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_DISCONNECT_ALL_P2P_CLIENTS, eCSR_ROAM_RESULT_NONE);
+ }
+ }
+ return eHAL_STATUS_FAILURE;
+}
+
+tANI_U16 csrCalculateMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U16 sta_bi, tANI_U16 go_gbi)
+{
+ tANI_U8 num_beacons = 0;
+ tANI_U8 is_multiple = 0;
+ tANI_U16 go_cbi = 0;
+ tANI_U16 go_fbi = 0;
+ tANI_U16 sta_cbi = 0;
+
+ //If GO's given beacon Interval is less than 100
+ if(go_gbi < 100)
+ go_cbi = 100;
+ //if GO's given beacon Interval is greater than or equal to 100
+ else
+ go_cbi = 100 + (go_gbi % 100);
+
+ // check, if either one is multiple of another
+ if (sta_bi > go_cbi)
+ {
+ is_multiple = !(sta_bi % go_cbi);
+ }
+ else
+ {
+ is_multiple = !(go_cbi % sta_bi);
+ }
+ // if it is multiple, then accept GOs beacon interval range [100,199] as it is
+ if(is_multiple)
+ {
+ return go_cbi;
+ }
+ //else , if it is not multiple, then then check for number of beacons to be
+ //inserted based on sta BI
+ num_beacons = sta_bi / 100;
+ if(num_beacons)
+ {
+ // GOs final beacon interval will be aligned to sta beacon interval, but
+ //in the range of [100, 199].
+ sta_cbi = sta_bi / num_beacons;
+ go_fbi = sta_cbi;
+ }
+ else
+ {
+ // if STA beacon interval is less than 100, use GOs change bacon interval
+ //instead of updating to STAs beacon interval.
+ go_fbi = go_cbi;
+ }
+ return go_fbi;
+}
+
+eHalStatus csrValidateMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U8 channelId,
+ tANI_U16 *beaconInterval, tANI_U32 cursessionId,
+ tVOS_CON_MODE currBssPersona)
+{
+ tANI_U32 sessionId = 0;
+ tANI_U16 new_beaconInterval = 0;
+
+ //If MCC is not supported just break
+ if (!pMac->roam.configParam.fenableMCCMode){
return eHAL_STATUS_FAILURE;
}
@@ -2827,17 +2899,47 @@
else if(pMac->roam.roamSession[sessionId].bssParams.bssPersona
== VOS_P2P_GO_MODE) //Check for P2P go scenario
{
- /* if GO in MCC support different beacon interval, return success */
- if ( pMac->roam.configParam.fAllowMCCGODiffBI == TRUE)
- return eHAL_STATUS_SUCCESS;
-
- if ((pMac->roam.roamSession[sessionId].bssParams.operationChn
+ /* if GO in MCC support different beacon interval,
+ * change the BI of the P2P-GO */
+ if ((pMac->roam.roamSession[sessionId].bssParams.operationChn
!= channelId ) &&
- (pMac->roam.roamSession[sessionId].bssParams.beaconInterval
+ (pMac->roam.roamSession[sessionId].bssParams.beaconInterval
!= *beaconInterval))
- {
- smsLog(pMac, LOGE, FL("BeaconInteval is different cannot connect to prefered AP...\n"));
- return eHAL_STATUS_FAILURE;
+ {
+ /* if GO in MCC support different beacon interval, return success */
+ if ( pMac->roam.configParam.fAllowMCCGODiffBI == 0x01)
+ {
+ return eHAL_STATUS_SUCCESS;
+ }
+ // Send only Broadcast disassoc and update beaconInterval
+ else if(pMac->roam.configParam.fAllowMCCGODiffBI == 0x02)
+ {
+ //Check to pass the right beacon Interval
+ new_beaconInterval = csrCalculateMCCBeaconInterval(pMac, *beaconInterval,
+ pMac->roam.roamSession[sessionId].bssParams.beaconInterval);
+ smsLog(pMac, LOG1, FL(" Peer AP BI : %d, new Beacon Interval: %d\n"),*beaconInterval,new_beaconInterval );
+ //Update the becon Interval
+ if(*beaconInterval != new_beaconInterval )
+ {
+ //Update the beaconInterval now
+ smsLog(pMac, LOG1, FL(" Beacon Interval got changed\n"));
+ pMac->roam.roamSession[sessionId].bssParams.beaconInterval = new_beaconInterval;
+ pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_TRUE;
+ csrUpdateMCCp2pBeaconInterval(pMac);
+ }
+ return eHAL_STATUS_SUCCESS;
+ }
+ //Disconnect the P2P session
+ else if(pMac->roam.configParam.fAllowMCCGODiffBI == 0x03)
+ {
+ pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE;
+ return csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_SEND_P2P_STOP_BSS, eCSR_ROAM_RESULT_NONE);
+ }
+ else
+ {
+ smsLog(pMac, LOGE, FL("BeaconInteval is different cannot connect to prefered AP...\n"));
+ return eHAL_STATUS_FAILURE;
+ }
}
}
break;
@@ -2876,10 +2978,11 @@
break;
case VOS_P2P_GO_MODE :
+ {
if(pMac->roam.roamSession[sessionId].pCurRoamProfile &&
((pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
- == VOS_P2P_CLIENT_MODE)
- || (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
+ == VOS_P2P_CLIENT_MODE) ||
+ (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
== VOS_STA_MODE))) //check for P2P_client scenario
{
if ((pMac->roam.roamSession[sessionId].connectedProfile.operationChannel
@@ -2901,12 +3004,17 @@
* Updated beaconInterval should be used only when we are starting a new BSS
* not incase of client or STA case
*/
- *beaconInterval =
- pMac->roam.roamSession[sessionId].connectedProfile.beaconInterval;
+ //Calculate beacon Interval for P2P-GO incase of MCC
+ new_beaconInterval = csrCalculateMCCBeaconInterval(pMac,
+ pMac->roam.roamSession[sessionId].bssParams.beaconInterval,
+ *beaconInterval );
+ if(*beaconInterval != new_beaconInterval)
+ *beaconInterval = new_beaconInterval;
return eHAL_STATUS_SUCCESS;
}
}
- break;
+ }
+ break;
default :
smsLog(pMac, LOG1, FL(" Persona not supported : %d\n"),currBssPersona);
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index 961189f..16f8aff 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -5049,7 +5049,35 @@
return (status);
}
#endif
+/* ---------------------------------------------------------------------------
+ \fn sme_ChangeMCCBeaconInterval
+
+ \brief To update P2P-GO beaconInterval. This function should be called after
+ disassociating all the station is done
+ This is an asynchronous API.
+
+ \param
+
+ \return eHalStatus SUCCESS
+ FAILURE or RESOURCES
+ The API finished and failed.
+
+ -------------------------------------------------------------------------------*/
+eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
+{
+ eHalStatus status = eHAL_STATUS_FAILURE;
+ tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+ smsLog(pMac, LOG1, FL("Update Beacon PARAMS \n"));
+ status = sme_AcquireGlobalLock( &pMac->sme );
+ if ( HAL_STATUS_SUCCESS( status ) )
+ {
+ status = csrSendChngMCCBeaconInterval( pMac, sessionId);
+ sme_ReleaseGlobalLock( &pMac->sme );
+ }
+ return (status);
+}
/*-------------------------------------------------------------------------------*