summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Xu <pxu@qca.qualcomm.com>2014-11-08 21:11:17 -0800
committerAnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com>2014-12-05 14:56:52 +0530
commit9ef1cf5c8fe3115e9096d7aaf568393f69e356dc (patch)
tree90428768e85537dcfc99c727cad51a66d669cddd
parent217fd78c855503925859f0706deb8af3caac71d4 (diff)
qcacld: Add support for pre start BSS ACS to enable ACS+OBSS coex
Add support for enabling acs+obss co-existence before the start bss is issued. Change-Id: Id4a3519e01319c8066e615d76eb5c14f5988228d CRs-Fixed: 752061
-rw-r--r--CORE/SAP/inc/sapApi.h41
-rw-r--r--CORE/SAP/src/sapApiLinkCntl.c262
-rw-r--r--CORE/SAP/src/sapChSelect.c65
-rw-r--r--CORE/SAP/src/sapFsm.c137
-rw-r--r--CORE/SAP/src/sapInternal.h70
-rw-r--r--CORE/SAP/src/sapModule.c282
-rw-r--r--CORE/SME/src/sme_common/sme_Api.c29
7 files changed, 816 insertions, 70 deletions
diff --git a/CORE/SAP/inc/sapApi.h b/CORE/SAP/inc/sapApi.h
index 48b18536de9d..42e5d3c84b6b 100644
--- a/CORE/SAP/inc/sapApi.h
+++ b/CORE/SAP/inc/sapApi.h
@@ -210,6 +210,7 @@ typedef enum {
#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
eSAP_ACS_SCAN_SUCCESS_EVENT,
#endif
+ eSAP_ACS_CHANNEL_SELECTED,
} eSapHddEvent;
typedef enum {
@@ -407,6 +408,11 @@ typedef struct sap_DfsNolInfo_s {
v_PVOID_t pDfsList; /* pointer to pDfsList buffer */
} tSap_DfsNolInfo;
+typedef struct sap_AcsChSelected_s {
+ v_U8_t pri_channel;
+ v_U8_t sec_channel;
+} tSap_AcsChSelectedEvent;
+
/*
This struct will be filled in and passed to tpWLAN_SAPEventCB that is provided during WLANSAP_StartBss call
The event id corresponding to structure in the union is defined in comment next to the structure
@@ -432,6 +438,8 @@ typedef struct sap_Event_s {
tSap_MaxAssocExceededEvent sapMaxAssocExceeded; /* eSAP_MAX_ASSOC_EXCEEDED */
tSap_OperatingChannelChangeEvent sapChannelChange; /* eSAP_CHANNEL_CHANGE_EVENT */
tSap_DfsNolInfo sapDfsNolInfo; /*eSAP_DFS_NOL_XXX */
+ /*eSAP_ACS_CHANNEL_SELECTED */
+ tSap_AcsChSelectedEvent sapAcsChSelected;
} sapevt;
} tSap_Event, *tpSap_Event;
@@ -2323,6 +2331,39 @@ void WLANSAP_PopulateDelStaParams(const v_U8_t *mac,
v_U16_t reason_code,
v_U8_t subtype,
struct tagCsrDelStaParams *pDelStaParams);
+
+/*==========================================================================
+ FUNCTION WLANSAP_ACS_CHSelect
+
+ DESCRIPTION
+ This api function provides ACS selection for BSS
+
+ DEPENDENCIES
+ NA.
+
+ PARAMETERS
+
+ IN
+ pvosGCtx: Pointer to vos global context structure
+ pConfig: Pointer to configuration structure passed down from HDD
+ pACSEventCallback: Callback function in HDD called by SAP to inform
+ HDD about channel section result
+ usrDataForCallback: Parameter that will be passed back in all the
+ SAP callback events.
+
+ RETURN VALUE
+ The VOS_STATUS code associated with performing the operation
+
+ VOS_STATUS_SUCCESS: Success
+
+ SIDE EFFECTS
+============================================================================*/
+VOS_STATUS
+WLANSAP_ACS_CHSelect(v_PVOID_t pvosGCtx,
+ tpWLAN_SAPEventCB pACSEventCallback,
+ tsap_Config_t *pConfig,
+ v_PVOID_t pUsrContext);
+
#ifdef __cplusplus
}
#endif
diff --git a/CORE/SAP/src/sapApiLinkCntl.c b/CORE/SAP/src/sapApiLinkCntl.c
index a6970407d638..550563061596 100644
--- a/CORE/SAP/src/sapApiLinkCntl.c
+++ b/CORE/SAP/src/sapApiLinkCntl.c
@@ -274,6 +274,268 @@ WLANSAP_ScanCallback
}// WLANSAP_ScanCallback
/*==========================================================================
+
+ FUNCTION WLANSAP_PreStartBssAcsScanCallback()
+
+ DESCRIPTION
+ Callback for Scan (scan results) Events
+
+ DEPENDENCIES
+ NA.
+
+ PARAMETERS
+
+ IN
+ tHalHandle: the tHalHandle passed in with the scan request
+ *p2: the second context pass in for the caller, opaque sap Handle here
+ scanID:
+ sessionId: Session identifier
+ status: Status of scan -success, failure or abort
+
+ RETURN VALUE
+ The eHalStatus code associated with performing the operation
+
+ eHAL_STATUS_SUCCESS: Success
+
+ SIDE EFFECTS
+
+============================================================================*/
+eHalStatus
+WLANSAP_PreStartBssAcsScanCallback
+(
+ tHalHandle halHandle,
+ void *pContext,
+ v_U8_t sessionId,
+ v_U32_t scanID,
+ eCsrScanStatus scanStatus
+)
+{
+ tScanResultHandle pResult = NULL;
+ eHalStatus scanGetResultStatus = eHAL_STATUS_FAILURE;
+ ptSapContext psapContext = (ptSapContext)pContext;
+ v_U8_t operChannel = 0;
+ VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+ eHalStatus halStatus = eHAL_STATUS_FAILURE;
+#ifdef SOFTAP_CHANNEL_RANGE
+ v_U32_t operatingBand;
+#endif
+ v_U32_t vhtChannelWidth;
+ tpAniSirGlobal pMac = PMAC_STRUCT(halHandle);
+
+ if ( eCSR_SCAN_SUCCESS == scanStatus)
+ {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+ FL("CSR scanStatus = %s (%d)"),
+ "eCSR_SCAN_SUCCESS", scanStatus);
+ /*
+ * Now do
+ * 1. Get scan results
+ * 2. Run channel selection algorithm
+ * select channel and store in pSapContext->Channel
+ */
+ scanGetResultStatus = sme_ScanGetResult(halHandle,
+ psapContext->sessionId,
+ NULL, &pResult);
+
+ if ((scanGetResultStatus != eHAL_STATUS_SUCCESS) &&
+ (scanGetResultStatus != eHAL_STATUS_E_NULL_VALUE))
+ {
+ /*
+ * No scan results
+ * So, set the operation channel not selected
+ * to allow the default channel to be set when
+ * reporting to HDD
+ */
+ operChannel = SAP_CHANNEL_NOT_SELECTED;
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ FL("Get scan result failed! ret = %d"),
+ scanGetResultStatus);
+ }
+ else
+ {
+#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
+ if (scanID != 0)
+ {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+ "%s: Sending ACS Scan skip event", __func__);
+ sapSignalHDDevent(psapContext, NULL,
+ eSAP_ACS_SCAN_SUCCESS_EVENT,
+ (v_PVOID_t) eSAP_STATUS_SUCCESS);
+ }
+ else
+ {
+ VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+ "%s: ACS scan id: %d (skipped ACS SCAN)",
+ __func__, scanID);
+ }
+#endif
+ operChannel = sapSelectChannel(halHandle, psapContext, pResult);
+
+ sme_ScanResultPurge(halHandle, pResult);
+ }
+
+ if (operChannel == SAP_CHANNEL_NOT_SELECTED)
+#ifdef SOFTAP_CHANNEL_RANGE
+ {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+ FL("No suitable channel selected"));
+
+ if ( eCSR_BAND_ALL == psapContext->scanBandPreference ||
+ psapContext->allBandScanned == eSAP_TRUE)
+ {
+ halStatus = sapSignalHDDevent(psapContext, NULL,
+ eSAP_ACS_CHANNEL_SELECTED,
+ (v_PVOID_t) eSAP_STATUS_FAILURE);
+ }
+ else
+ {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+ FL("Has scan band preference"));
+ if (eCSR_BAND_24 == psapContext->currentPreferredBand)
+ psapContext->currentPreferredBand = eCSR_BAND_5G;
+ else
+ psapContext->currentPreferredBand = eCSR_BAND_24;
+
+ psapContext->allBandScanned = eSAP_TRUE;
+ /*
+ * Go back to scanning, scan next band
+ *
+ * 1. No need to pass the second parameter
+ * as the SAP state machine is not started yet
+ * and there is no need for any event posting.
+ *
+ * 2. Set third parameter to TRUE to indicate the
+ * channel selection function to register a
+ * different scan callback fucntion to process
+ * the results pre start BSS.
+ */
+ vosStatus = sapGotoChannelSel(psapContext, NULL, VOS_TRUE);
+ if (VOS_STATUS_SUCCESS == vosStatus)
+ {
+ halStatus = eHAL_STATUS_SUCCESS;
+ }
+ return halStatus;
+ }
+ }
+#else
+ psapContext->channel = SAP_DEFAULT_24GHZ_CHANNEL;
+#endif
+ else
+ {
+ /*
+ * Valid Channel Found from scan results.
+ */
+ psapContext->channel = operChannel;
+ }
+
+ if (eHAL_STATUS_SUCCESS != ccmCfgGetInt(halHandle,
+ WNI_CFG_VHT_CHANNEL_WIDTH,
+ &vhtChannelWidth))
+ {
+ VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ FL("Get WNI_CFG_VHT_CHANNEL_WIDTH failed"));
+ /*
+ * In case of failure, take the vht channel width from
+ * original ini value
+ */
+ vhtChannelWidth = pMac->roam.configParam.nVhtChannelWidth;
+ }
+
+ sme_SelectCBMode(halHandle,
+ sapConvertSapPhyModeToCsrPhyMode(psapContext->csrRoamProfile.phyMode),
+ psapContext->channel, vhtChannelWidth);
+
+ /* determine secondary channel for 11n mode */
+ if ((eSAP_DOT11_MODE_11n == psapContext->csrRoamProfile.phyMode) ||
+ (eSAP_DOT11_MODE_11n_ONLY == psapContext->csrRoamProfile.phyMode)) {
+ ePhyChanBondState cbMode;
+
+ if (psapContext->channel > 14)
+ cbMode = pMac->roam.configParam.channelBondingMode5GHz;
+ else
+ cbMode = pMac->roam.configParam.channelBondingMode24GHz;
+
+ switch (cbMode) {
+ case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
+ psapContext->secondary_ch = psapContext->channel + 4;
+ break;
+ case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
+ psapContext->secondary_ch = psapContext->channel - 4;
+ break;
+ case PHY_SINGLE_CHANNEL_CENTERED:
+ default:
+ psapContext->secondary_ch = 0;
+ break;
+ }
+
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+ FL("psapContext->secondary_ch=%d"),
+ psapContext->secondary_ch);
+ }
+
+#ifdef SOFTAP_CHANNEL_RANGE
+ if(psapContext->channelList != NULL)
+ {
+ /*
+ * Always free up the memory for
+ * channel selection whatever
+ * the result
+ */
+ vos_mem_free(psapContext->channelList);
+ psapContext->channelList = NULL;
+ }
+#endif
+
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+ FL("Channel selected = %d"), psapContext->channel);
+
+ /*
+ * By now, Channel should be selected
+ * post a message to HDD to indicate
+ * the ACS channel selection complete.
+ */
+ halStatus = sapSignalHDDevent(psapContext, NULL,
+ eSAP_ACS_CHANNEL_SELECTED,
+ (v_PVOID_t) eSAP_STATUS_SUCCESS);
+ }
+ else
+ {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ FL("CSR scanStatus = %s (%d), choose default channel"),
+ "eCSR_SCAN_ABORT/FAILURE", scanStatus );
+#ifdef SOFTAP_CHANNEL_RANGE
+ /*
+ * if scan failed, select default channel in the
+ * BAND(2.4GHz/5GHZ)
+ */
+ ccmCfgGetInt( halHandle, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND,
+ &operatingBand);
+ if(eSAP_RF_SUBBAND_2_4_GHZ == operatingBand )
+ psapContext->channel = SAP_DEFAULT_24GHZ_CHANNEL;
+ else
+ psapContext->channel = SAP_DEFAULT_5GHZ_CHANNEL;
+#else
+ psapContext->channel = SAP_DEFAULT_24GHZ_CHANNEL;
+#endif
+ halStatus = sapSignalHDDevent(psapContext, NULL,
+ eSAP_ACS_CHANNEL_SELECTED,
+ (v_PVOID_t) eSAP_STATUS_SUCCESS);
+ }
+
+ if(eHAL_STATUS_SUCCESS != sme_CloseSession(halHandle,
+ psapContext->sessionId, NULL, NULL))
+ {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ "In %s CloseSession error", __func__);
+ } else {
+ psapContext->isScanSessionOpen = eSAP_FALSE;
+ }
+ psapContext->sessionId = 0xff;
+
+ return halStatus;
+}
+
+/*==========================================================================
FUNCTION WLANSAP_RoamCallback()
DESCRIPTION
diff --git a/CORE/SAP/src/sapChSelect.c b/CORE/SAP/src/sapChSelect.c
index f093bde15efd..7c3e8b5a0dd2 100644
--- a/CORE/SAP/src/sapChSelect.c
+++ b/CORE/SAP/src/sapChSelect.c
@@ -2334,11 +2334,14 @@ eChannelWidthInfo sapGetChannelWidthInfo(tHalHandle halHandle, ptSapContext pSap
{
v_U32_t cbMode;
eChannelWidthInfo chWidth = CHWIDTH_HT20;
+ tpAniSirGlobal pMac = PMAC_STRUCT(halHandle);
- if (eSAP_RF_SUBBAND_2_4_GHZ == operatingBand)
- cbMode = sme_GetChannelBondingMode24G(halHandle);
- else
- cbMode = sme_GetChannelBondingMode5G(halHandle);
+ /* get cbMode based on if obss is enabled */
+ cbMode = (pMac->roam.configParam.obssEnabled) ? 1:0;
+
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+ "%s: cbMode=%d, phyMode=%d",
+ __func__, cbMode, phyMode);
if (phyMode == eSAP_DOT11_MODE_11n ||
phyMode == eSAP_DOT11_MODE_11n_ONLY)
@@ -2639,34 +2642,44 @@ v_U8_t sapSelectChannel(tHalHandle halHandle, ptSapContext pSapCtx, tScanResult
#endif
/* determine secondary channel for 2.4G channel 5, 6, 7 in HT40 */
- if ((operatingBand == RF_SUBBAND_2_4_GHZ) && (chWidth == CHWIDTH_HT40) &&
- (bestChNum >= 5) && (bestChNum <= 7)) {
- int weight_below, weight_above, i;
+ if ((operatingBand == RF_SUBBAND_2_4_GHZ) && (chWidth == CHWIDTH_HT40)) {
tSmeConfigParams *pSmeConfig;
- tSapSpectChInfo *pSpectInfo;
-
- weight_below = weight_above = ACS_WEIGHT_MAX;
- pSpectInfo = pSpectInfoParams->pSpectCh;
-
- for (i = 0; i < pSpectInfoParams->numSpectChans ; i++) {
- if (pSpectInfo[i].chNum == (bestChNum - 4))
- weight_below = pSpectInfo[i].weight;
-
- if (pSpectInfo[i].chNum == (bestChNum + 4))
- weight_above = pSpectInfo[i].weight;
- }
-
pSmeConfig = vos_mem_malloc(sizeof(*pSmeConfig));
if (NULL != pSmeConfig) {
sme_GetConfigParam(halHandle, pSmeConfig);
- if (weight_below < weight_above)
- pSmeConfig->csrConfig.channelBondingMode24GHz =
- eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
- else
- pSmeConfig->csrConfig.channelBondingMode24GHz =
- eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
+ if ((bestChNum >= 5) && (bestChNum <= 7)) {
+ int weight_below, weight_above, i;
+ tSapSpectChInfo *pSpectInfo;
+
+ weight_below = weight_above = ACS_WEIGHT_MAX;
+ pSpectInfo = pSpectInfoParams->pSpectCh;
+
+ for (i = 0; i < pSpectInfoParams->numSpectChans ; i++) {
+ if (pSpectInfo[i].chNum == (bestChNum - 4))
+ weight_below = pSpectInfo[i].weight;
+ if (pSpectInfo[i].chNum == (bestChNum + 4))
+ weight_above = pSpectInfo[i].weight;
+ }
+
+ if (weight_below < weight_above)
+ pSmeConfig->csrConfig.channelBondingMode24GHz =
+ eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
+ else
+ pSmeConfig->csrConfig.channelBondingMode24GHz =
+ eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
+ } else {
+ if (bestChNum >= 1 && bestChNum <= 5)
+ pSmeConfig->csrConfig.channelBondingMode24GHz =
+ eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
+ else if (bestChNum >= 6 && bestChNum <= 13)
+ pSmeConfig->csrConfig.channelBondingMode24GHz =
+ eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
+ else if (bestChNum ==14)
+ pSmeConfig->csrConfig.channelBondingMode24GHz =
+ eCSR_INI_SINGLE_CHANNEL_CENTERED;
+ }
sme_UpdateConfig(halHandle, pSmeConfig);
vos_mem_free(pSmeConfig);
}
diff --git a/CORE/SAP/src/sapFsm.c b/CORE/SAP/src/sapFsm.c
index 2b5ba202010c..4b53d07082aa 100644
--- a/CORE/SAP/src/sapFsm.c
+++ b/CORE/SAP/src/sapFsm.c
@@ -1986,6 +1986,8 @@ sapDfsIsChannelInNolList(ptSapContext sapContext, v_U8_t channelNumber,
IN
sapContext : Sap Context value
sapEvent : State machine event
+ sapDoAcsPreStartBss: VOS_TRUE, if ACS scan is issued pre start BSS.
+ VOS_FALSE, if ACS scan is issued post start BSS.
RETURN VALUE
The VOS_STATUS code associated with performing the operation
@@ -1998,7 +2000,8 @@ VOS_STATUS
sapGotoChannelSel
(
ptSapContext sapContext,
- ptWLAN_SAPEvent sapEvent
+ ptWLAN_SAPEvent sapEvent,
+ v_BOOL_t sapDoAcsPreStartBss
)
{
/* Initiate a SCAN request */
@@ -2140,17 +2143,38 @@ sapGotoChannelSel
#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
}
#endif
- halStatus = sme_ScanRequest(hHal,
- sapContext->sessionId,
- &scanRequest,
- /*, when ID == 0 11D scan/active scan with callback,
- * min-maxChntime set in csrScanRequest()?
- */
- &scanRequestID,
- /*csrScanCompleteCallback callback,*/
- &WLANSAP_ScanCallback,
- /* pContext scanRequestID filled up*/
- sapContext);
+
+ if (VOS_TRUE == sapDoAcsPreStartBss)
+ {
+ halStatus = sme_ScanRequest(hHal,
+ sapContext->sessionId,
+ &scanRequest,
+ /* when ID == 0 11D scan/active
+ * scan with callback,
+ * min-maxChntime set in csrScanRequest()?
+ */
+ &scanRequestID,
+ /*csrScanCompleteCallback callback,*/
+ &WLANSAP_PreStartBssAcsScanCallback,
+ /* pContext scanRequestID filled up*/
+ sapContext);
+
+ }
+ else
+ {
+ halStatus = sme_ScanRequest(hHal,
+ sapContext->sessionId,
+ &scanRequest,
+ /* when ID == 0 11D scan/active
+ * scan with callback,
+ * min-maxChntime set in csrScanRequest()?
+ */
+ &scanRequestID,
+ /*csrScanCompleteCallback callback,*/
+ &WLANSAP_ScanCallback,
+ /* pContext scanRequestID filled up*/
+ sapContext);
+ }
if (eHAL_STATUS_SUCCESS != halStatus)
{
VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
@@ -2169,10 +2193,22 @@ sapGotoChannelSel
sapContext->channelList = NULL;
}
#endif
- /* Fill in the event structure */
- sapEventInit(sapEvent);
- /* Handle event */
- vosStatus = sapFsm(sapContext, sapEvent);
+ if (VOS_TRUE == sapDoAcsPreStartBss)
+ {
+ /*
+ * In case of ACS req before start Bss,
+ * return failure so that the calling
+ * fucntion can use the default channel.
+ */
+ return VOS_STATUS_E_FAILURE;
+ }
+ else
+ {
+ /* Fill in the event structure */
+ sapEventInit(sapEvent);
+ /* Handle event */
+ vosStatus = sapFsm(sapContext, sapEvent);
+ }
}
else
{
@@ -2188,8 +2224,20 @@ sapGotoChannelSel
if (sapContext->skip_acs_scan_status == eSAP_SKIP_ACS_SCAN) {
VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
"## %s SKIPPED ACS SCAN", __func__);
- WLANSAP_ScanCallback(hHal, sapContext, sapContext->sessionId, 0,
- eCSR_SCAN_SUCCESS);
+ if (VOS_TRUE == sapDoAcsPreStartBss)
+ {
+ WLANSAP_PreStartBssAcsScanCallback(hHal, sapContext,
+ sapContext->sessionId,
+ 0,
+ eCSR_SCAN_SUCCESS);
+ }
+ else
+ {
+ WLANSAP_ScanCallback(hHal, sapContext,
+ sapContext->sessionId,
+ 0,
+ eCSR_SCAN_SUCCESS);
+ }
}
#endif
}
@@ -2198,11 +2246,22 @@ sapGotoChannelSel
VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
"In %s, for configured channel, Ch= %d",
__func__, sapContext->channel);
- /* Fill in the event structure */
- // Eventhough scan was not done, means a user set channel was chosen
- sapEventInit(sapEvent);
- /* Handle event */
- vosStatus = sapFsm(sapContext, sapEvent);
+ if (VOS_TRUE == sapDoAcsPreStartBss)
+ {
+ VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ "In %s, ACS Disabled, Configured Ch= %d",
+ __func__, sapContext->channel);
+
+ return VOS_STATUS_E_FAILURE;
+ }
+ else
+ {
+ /* Fill in the event structure */
+ // Eventhough scan was not done, means a user set channel was chosen
+ sapEventInit(sapEvent);
+ /* Handle event */
+ vosStatus = sapFsm(sapContext, sapEvent);
+ }
}
/* If scan failed, get default channel and advance state machine as success with default channel */
@@ -2567,6 +2626,22 @@ sapSignalHDDevent
(eSapStatus )context;
break;
+ case eSAP_ACS_CHANNEL_SELECTED:
+ sapApAppEvent.sapHddEventCode = sapHddevent;
+ if ( eSAP_STATUS_SUCCESS == (eSapStatus )context)
+ {
+ sapApAppEvent.sapevt.sapAcsChSelected.pri_channel =
+ sapContext->channel;
+ sapApAppEvent.sapevt.sapAcsChSelected.sec_channel =
+ sapContext->secondary_ch;
+ }
+ else if (eSAP_STATUS_FAILURE == (eSapStatus )context)
+ {
+ sapApAppEvent.sapevt.sapAcsChSelected.pri_channel = 0;
+ sapApAppEvent.sapevt.sapAcsChSelected.sec_channel = 0;
+ }
+ break;
+
case eSAP_STOP_BSS_EVENT:
VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, SAP event callback event = %s",
__func__, "eSAP_STOP_BSS_EVENT");
@@ -3198,8 +3273,12 @@ sapFsm
/* Set SAP device role */
sapContext->sapsMachine = eSAP_CH_SELECT;
- /* Perform sme_ScanRequest */
- vosStatus = sapGotoChannelSel(sapContext, sapEvent);
+ /*
+ * Perform sme_ScanRequest
+ * This scan request is post start bss
+ * request so, set the third to false.
+ */
+ vosStatus = sapGotoChannelSel(sapContext, sapEvent, VOS_FALSE);
/* Transition from eSAP_DISCONNECTED to eSAP_CH_SELECT (both without substates) */
VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, from state %s => %s",
@@ -3229,8 +3308,12 @@ sapFsm
/* Set SAP device role */
sapContext->sapsMachine = eSAP_CH_SELECT;
- /* Perform sme_ScanRequest */
- vosStatus = sapGotoChannelSel(sapContext, sapEvent);
+ /*
+ * Perform sme_ScanRequest
+ * This scan request is post start bss
+ * request so, set the third to false.
+ */
+ vosStatus = sapGotoChannelSel(sapContext, sapEvent, VOS_FALSE);
}
else
{
diff --git a/CORE/SAP/src/sapInternal.h b/CORE/SAP/src/sapInternal.h
index 1905f78075d6..ed60927bcaec 100644
--- a/CORE/SAP/src/sapInternal.h
+++ b/CORE/SAP/src/sapInternal.h
@@ -165,6 +165,7 @@ typedef struct sSapContext {
// Include the current channel of AP
v_U32_t channel;
+ v_U32_t secondary_ch;
// Include the SME(CSR) sessionId here
v_U8_t sessionId;
@@ -335,6 +336,43 @@ WLANSAP_ScanCallback
/*==========================================================================
+ FUNCTION WLANSAP_PreStartBssAcsScanCallback()
+
+ DESCRIPTION
+ Callback for Scan (scan results) Events
+
+ DEPENDENCIES
+ NA.
+
+ PARAMETERS
+
+ IN
+ tHalHandle: the tHalHandle passed in with the scan request
+ *p2: the second context pass in for the caller, opaque sap Handle here
+ scanID:
+ sessionId: Session identifier
+ status: Status of scan -success, failure or abort
+
+ RETURN VALUE
+ The eHalStatus code associated with performing the operation
+
+ eHAL_STATUS_SUCCESS: Success
+
+ SIDE EFFECTS
+
+============================================================================*/
+eHalStatus
+WLANSAP_PreStartBssAcsScanCallback
+(
+ tHalHandle halHandle,
+ void *pContext,
+ v_U8_t sessionId,
+ v_U32_t scanID,
+ eCsrScanStatus scanStatus
+);
+
+/*==========================================================================
+
FUNCTION WLANSAP_RoamCallback()
DESCRIPTION
@@ -545,6 +583,38 @@ sapFsm
);
/*==========================================================================
+ FUNCTION sapGotoChannelSel
+
+ DESCRIPTION
+ Function for initiating scan request for SME
+
+ DEPENDENCIES
+ NA.
+
+ PARAMETERS
+
+ IN
+ sapContext : Sap Context value
+ sapEvent : State machine event/ NULL if no FSM event is required.
+ sapDoAcsPreStartBss: VOS_TRUE, if ACS scan is issued pre start BSS.
+ VOS_FALSE, if ACS scan is issued post start BSS.
+
+ RETURN VALUE
+ The VOS_STATUS code associated with performing the operation
+
+ VOS_STATUS_SUCCESS: Success
+
+ SIDE EFFECTS
+============================================================================*/
+VOS_STATUS
+sapGotoChannelSel
+(
+ ptSapContext sapContext,
+ ptWLAN_SAPEvent sapEvent,
+ v_BOOL_t sapDoAcsPreStartBss
+);
+
+/*==========================================================================
FUNCTION sapConvertToCsrProfile
diff --git a/CORE/SAP/src/sapModule.c b/CORE/SAP/src/sapModule.c
index bce11240f346..5ca1f3001403 100644
--- a/CORE/SAP/src/sapModule.c
+++ b/CORE/SAP/src/sapModule.c
@@ -601,6 +601,131 @@ v_U16_t WLANSAP_CheckCCIntf(v_PVOID_t Ctx)
return intf_ch;
}
#endif
+
+/*==========================================================================
+ FUNCTION WLANSAP_SetScanAcsChannelParams
+
+ DESCRIPTION
+ This api function is used to copy Scan and Channel parameters from sap
+ config to sap context.
+
+ DEPENDENCIES
+
+ PARAMETERS
+
+ IN
+ pConfig : Pointer to the SAP config
+ sapContext : Pointer to the SAP Context.
+ pUsrContext: Parameter that will be passed
+ back in all the SAP callback events.
+
+ RETURN VALUE
+ The result code associated with performing the operation
+
+ VOS_STATUS_E_FAULT: Pointer to SAP cb is NULL ; access would cause a page
+ fault
+ VOS_STATUS_SUCCESS: Success
+
+ SIDE EFFECTS
+============================================================================*/
+VOS_STATUS
+WLANSAP_SetScanAcsChannelParams(tsap_Config_t *pConfig,
+ ptSapContext pSapCtx,
+ v_PVOID_t pUsrContext)
+{
+ tHalHandle hHal = NULL;
+ tANI_BOOLEAN restartNeeded;
+ int ret;
+
+ if (NULL == pConfig)
+ {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ "%s: Invalid pConfig passed ", __func__);
+ return VOS_STATUS_E_FAULT;
+ }
+
+ if (NULL == pSapCtx)
+ {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ "%s: Invalid pConfig passed ", __func__);
+ return VOS_STATUS_E_FAULT;
+ }
+
+ /* Channel selection is auto or configured */
+ pSapCtx->channel = pConfig->channel;
+#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
+ pSapCtx->cc_switch_mode = pConfig->cc_switch_mode;
+#endif
+ pSapCtx->scanBandPreference = pConfig->scanBandPreference;
+ pSapCtx->acsBandSwitchThreshold = pConfig->acsBandSwitchThreshold;
+ pSapCtx->pUsrContext = pUsrContext;
+ pSapCtx->apAutoChannelSelection = pConfig->apAutoChannelSelection;
+ pSapCtx->apStartChannelNum = pConfig->apStartChannelNum;
+ pSapCtx->apEndChannelNum = pConfig->apEndChannelNum;
+#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
+ pSapCtx->skip_acs_scan_status = pConfig->skip_acs_scan_status;
+ pSapCtx->skip_acs_scan_range1_endch = pConfig->skip_acs_scan_range1_endch;
+ pSapCtx->skip_acs_scan_range1_stch = pConfig->skip_acs_scan_range1_stch;
+ pSapCtx->skip_acs_scan_range2_endch = pConfig->skip_acs_scan_range2_endch;
+ pSapCtx->skip_acs_scan_range2_stch = pConfig->skip_acs_scan_range2_stch;
+#endif
+ pSapCtx->enableOverLapCh = pConfig->enOverLapCh;
+ if (strlen(pConfig->acsAllowedChnls) > 0)
+ {
+#ifdef WLAN_FEATURE_MBSSID
+ ret = sapSetPreferredChannel(pSapCtx, pConfig->acsAllowedChnls);
+#else
+ ret = sapSetPreferredChannel(pConfig->acsAllowedChnls);
+#endif
+ if (0 != ret)
+ {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+ "%s: ACS set preferred channel failed!", __func__);
+ return VOS_STATUS_E_FAULT;
+ }
+ }
+ /*
+ * Set the BSSID to your "self MAC Addr" read
+ * the mac address from Configuation ITEM received
+ * from HDD
+ */
+ pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1;
+ vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid,
+ pSapCtx->self_mac_addr,
+ sizeof( tCsrBssid ));
+
+ /*
+ * Save a copy to SAP context
+ */
+ vos_mem_copy(pSapCtx->csrRoamProfile.BSSIDs.bssid,
+ pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t));
+ vos_mem_copy(pSapCtx->self_mac_addr,
+ pConfig->self_macaddr.bytes, sizeof(v_MACADDR_t));
+
+ hHal = (tHalHandle)VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+ if (NULL == hHal)
+ {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+ "%s: Invalid MAC context from pvosGCtx", __func__);
+ }
+ else
+ {
+ //If concurrent session is running that is already associated
+ //then we just follow that sessions country info (whether
+ //present or not doesn't maater as we have to follow whatever
+ //STA session does)
+ if ((0 == sme_GetConcurrentOperationChannel(hHal)) &&
+ pConfig->ieee80211d)
+ {
+ /* Setting the region/country information */
+ sme_setRegInfo(hHal, pConfig->countryCode);
+ sme_ResetCountryCodeInformation(hHal, &restartNeeded);
+ }
+ }
+
+ return VOS_STATUS_SUCCESS;
+}
+
/*==========================================================================
FUNCTION WLANSAP_StartBss
@@ -3762,3 +3887,160 @@ void WLANSAP_PopulateDelStaParams(const v_U8_t *mac,
pDelStaParams->reason_code, pDelStaParams->subtype,
MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr));
}
+
+/*==========================================================================
+ FUNCTION WLANSAP_ACS_CHSelect
+
+ DESCRIPTION
+ This api function provides ACS selection for BSS
+
+ DEPENDENCIES
+ NA.
+
+ PARAMETERS
+
+ IN
+ pvosGCtx: Pointer to vos global context structure
+ pConfig: Pointer to configuration structure passed down from HDD
+ pACSEventCallback: Callback function in HDD called by SAP to inform
+ HDD about channel section result
+ usrDataForCallback: Parameter that will be passed back in all the
+ SAP callback events.
+
+ RETURN VALUE
+ The VOS_STATUS code associated with performing the operation
+
+ VOS_STATUS_SUCCESS: Success
+
+ SIDE EFFECTS
+============================================================================*/
+VOS_STATUS
+WLANSAP_ACS_CHSelect(v_PVOID_t pvosGCtx,
+ tpWLAN_SAPEventCB pACSEventCallback,
+ tsap_Config_t *pConfig,
+ v_PVOID_t pUsrContext)
+{
+ ptSapContext sapContext = NULL;
+ tHalHandle hHal = NULL;
+ VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+ eHalStatus halStatus = eHAL_STATUS_FAILURE;
+ tpAniSirGlobal pMac = NULL;
+
+ sapContext = VOS_GET_SAP_CB( pvosGCtx );
+ if (NULL == sapContext) {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ "%s: Invalid SAP pointer from pvosGCtx", __func__);
+
+ return VOS_STATUS_E_FAULT;
+ }
+
+ hHal = (tHalHandle)VOS_GET_HAL_CB(sapContext->pvosGCtx);
+ if (NULL == hHal) {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ "%s: Invalid MAC context from pvosGCtx", __func__);
+ return VOS_STATUS_E_FAULT;
+ }
+
+ if (sapContext->isSapSessionOpen == eSAP_TRUE) {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL,
+ "%s:SME Session is already opened\n",__func__);
+ return VOS_STATUS_E_EXISTS;
+ }
+
+ sapContext->sessionId = 0xff;
+
+ pMac = PMAC_STRUCT( hHal );
+ if ((!pMac->roam.configParam.obssEnabled) &&
+ ((pMac->roam.configParam.phyMode == eCSR_DOT11_MODE_abg) ||
+ (pMac->roam.configParam.phyMode == eCSR_DOT11_MODE_11a) ||
+ (pMac->roam.configParam.phyMode == eCSR_DOT11_MODE_11g)))
+ sapContext->csrRoamProfile.phyMode = eSAP_DOT11_MODE_abg;
+ else
+ sapContext->csrRoamProfile.phyMode = eSAP_DOT11_MODE_11n;
+
+ if ((pConfig->channel == AUTO_CHANNEL_SELECT) &&
+ (sapContext->isScanSessionOpen == eSAP_FALSE)) {
+ tANI_U32 type, subType;
+
+ if(VOS_STATUS_SUCCESS ==
+ vos_get_vdev_types(VOS_STA_MODE, &type, &subType)) {
+ /*
+ * Open SME Session for scan
+ */
+ if(eHAL_STATUS_SUCCESS != sme_OpenSession(hHal, NULL, sapContext,
+ sapContext->self_mac_addr,
+ &sapContext->sessionId,
+ type, subType)) {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ "Error: In %s calling sme_OpenSession", __func__);
+ return VOS_STATUS_E_FAILURE;
+ }
+ else
+ sapContext->isScanSessionOpen = eSAP_TRUE;
+ }
+
+ /*
+ * Copy the HDD callback function to report the
+ * ACS result after scan in SAP context callback function.
+ */
+ sapContext->pfnSapEventCallback = pACSEventCallback;
+ /*
+ * init dfs channel nol
+ */
+ sapInitDfsChannelNolList(sapContext);
+
+ /*
+ * Now, configure the scan and ACS channel params
+ * to issue a scan request.
+ */
+ WLANSAP_SetScanAcsChannelParams(pConfig, sapContext, pUsrContext);
+
+ /*
+ * Issue the scan request. This scan request is
+ * issued before the start BSS is done so
+ *
+ * 1. No need to pass the second parameter
+ * as the SAP state machine is not started yet
+ * and there is no need for any event posting.
+ *
+ * 2. Set third parameter to TRUE to indicate the
+ * channel selection function to register a
+ * different scan callback fucntion to process
+ * the results pre start BSS.
+ */
+ vosStatus = sapGotoChannelSel(sapContext, NULL, VOS_TRUE);
+
+ if (VOS_STATUS_E_ABORTED == vosStatus) {
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ "In %s,DFS not supported in the current operating mode",
+ __func__);
+ return VOS_STATUS_E_FAILURE;
+ }
+ else if (VOS_STATUS_E_CANCELED == vosStatus) {
+ /*
+ * ERROR is returned when either the SME scan request
+ * failed or ACS is not enabled. So, default channel
+ * is selected and this default channel should be sent
+ * to the HDD.
+ */
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ FL("Scan Req Failed/ACS not enabled,default channel = %d"),
+ sapContext->channel);
+ halStatus = sapSignalHDDevent(sapContext, NULL,
+ eSAP_ACS_CHANNEL_SELECTED,
+ (v_PVOID_t) eSAP_STATUS_SUCCESS);
+
+ if (eHAL_STATUS_SUCCESS == halStatus) {
+ vosStatus = VOS_STATUS_SUCCESS;
+ return vosStatus;
+ }
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ FL("Failed to post eSAP_ACS_CHANNEL_SELECTED to HDD"));
+ return VOS_STATUS_E_FAILURE;
+ }
+ else if (VOS_STATUS_SUCCESS == vosStatus)
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
+ FL("Successfully Issued a Pre Start Bss Scan Request"));
+ }
+ return vosStatus;
+}
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index 8f96b1de6939..3d748344dc90 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -11829,23 +11829,18 @@ VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode,
}
}
-#ifdef QCA_HT_2040_COEX
- /* if obss is enabled, the channel bonding mode is coming from hostapd,
- so we don't need to hard code it here */
- if (!pMac->roam.configParam.obssEnabled)
-#endif
- if (pMac->roam.configParam.channelBondingMode24GHz)
- {
- if (channel >= 1 && channel <= 5)
- smeConfig.csrConfig.channelBondingMode24GHz =
- eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
- else if (channel >= 6 && channel <= 13)
- smeConfig.csrConfig.channelBondingMode24GHz =
- eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
- else if (channel ==14)
- smeConfig.csrConfig.channelBondingMode24GHz =
- eCSR_INI_SINGLE_CHANNEL_CENTERED;
- }
+ if (pMac->roam.configParam.channelBondingMode24GHz)
+ {
+ if (channel >= 1 && channel <= 5)
+ smeConfig.csrConfig.channelBondingMode24GHz =
+ eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
+ else if (channel >= 6 && channel <= 13)
+ smeConfig.csrConfig.channelBondingMode24GHz =
+ eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
+ else if (channel ==14)
+ smeConfig.csrConfig.channelBondingMode24GHz =
+ eCSR_INI_SINGLE_CHANNEL_CENTERED;
+ }
}
/*