summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CORE/HDD/src/wlan_hdd_assoc.c1
-rw-r--r--CORE/HDD/src/wlan_hdd_hostapd.c22
-rwxr-xr-xCORE/HDD/src/wlan_hdd_main.c69
-rw-r--r--CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c3
-rw-r--r--CORE/SAP/inc/sapApi.h5
-rw-r--r--CORE/SAP/src/sapApiLinkCntl.c22
-rw-r--r--CORE/SAP/src/sapFsm.c150
-rw-r--r--CORE/SAP/src/sapInternal.h9
-rw-r--r--CORE/SAP/src/sapModule.c147
9 files changed, 201 insertions, 227 deletions
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c
index cbef5df7accd..65ec664f2edb 100644
--- a/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/CORE/HDD/src/wlan_hdd_assoc.c
@@ -3832,6 +3832,7 @@ hdd_smeRoamCallback(void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId,
case eCSR_ROAM_SESSION_OPENED:
set_bit(SME_SESSION_OPENED, &pAdapter->event_flags);
complete(&pAdapter->session_open_comp_var);
+ hddLog(LOG1, FL("session %d opened"), pAdapter->sessionId);
break;
#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
index 480aafb07d5b..042ecda1c346 100644
--- a/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -6579,6 +6579,8 @@ VOS_STATUS hdd_init_ap_mode( hdd_adapter_t *pAdapter )
v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
v_CONTEXT_t sapContext=NULL;
enum dfs_mode mode;
+ tVOS_CON_MODE device_mode;
+ uint32_t session_id = CSR_SESSION_ID_INVALID;
#endif
int ret;
@@ -6608,13 +6610,27 @@ VOS_STATUS hdd_init_ap_mode( hdd_adapter_t *pAdapter )
wlan_hdd_get_dfs_mode(mode);
- status = WLANSAP_Start(sapContext);
+ if (pAdapter->device_mode == WLAN_HDD_P2P_GO) {
+ device_mode = VOS_P2P_GO_MODE;
+ } else if (pAdapter->device_mode == WLAN_HDD_SOFTAP) {
+ device_mode = VOS_STA_SAP_MODE;
+ } else {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ FL("Invalid device_mode for AP: %d"), pAdapter->device_mode);
+ return VOS_STATUS_E_FAILURE;
+ }
+
+ status = WLANSAP_Start(sapContext, device_mode,
+ pAdapter->macAddressCurrent.bytes,
+ &session_id);
if ( ! VOS_IS_STATUS_SUCCESS( status ) )
{
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: WLANSAP_Start failed!!"));
WLANSAP_Close(sapContext);
+ pAdapter->sessionCtx.ap.sapContext = NULL;
return status;
}
+ pAdapter->sessionId = session_id;
#endif
// Allocate the Wireless Extensions state structure
@@ -6632,6 +6648,7 @@ VOS_STATUS hdd_init_ap_mode( hdd_adapter_t *pAdapter )
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,("ERROR: hdd_set_hostapd failed!!"));
#ifdef WLAN_FEATURE_MBSSID
WLANSAP_Close(sapContext);
+ pAdapter->sessionCtx.ap.sapContext = NULL;
#endif
return status;
}
@@ -6642,6 +6659,7 @@ VOS_STATUS hdd_init_ap_mode( hdd_adapter_t *pAdapter )
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: Hostapd HDD vos event init failed!!"));
#ifdef WLAN_FEATURE_MBSSID
WLANSAP_Close(sapContext);
+ pAdapter->sessionCtx.ap.sapContext = NULL;
#endif
return status;
}
@@ -6654,6 +6672,7 @@ VOS_STATUS hdd_init_ap_mode( hdd_adapter_t *pAdapter )
"ERROR: Hostapd HDD stop bss event init failed!!");
#ifdef WLAN_FEATURE_MBSSID
WLANSAP_Close(sapContext);
+ pAdapter->sessionCtx.ap.sapContext = NULL;
#endif
return status;
}
@@ -6705,6 +6724,7 @@ error_wmm_init:
hdd_softap_deinit_tx_rx( pAdapter );
#ifdef WLAN_FEATURE_MBSSID
WLANSAP_Close(sapContext);
+ pAdapter->sessionCtx.ap.sapContext = NULL;
#endif
EXIT();
return status;
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index d30ed2fbd7a0..f6bfb51c6ce0 100755
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -11412,6 +11412,43 @@ void wlan_hdd_reset_prob_rspies(hdd_adapter_t* pHostapdAdapter)
}
}
+/**
+ * hdd_wait_for_sme_close_sesion() - Close and wait for SME session close
+ * @hdd_ctx: HDD context which is already NULL validated
+ * @adapter: HDD adapter which is already NULL validated
+ *
+ * Close the SME session and wait for its completion, if needed.
+ *
+ * Return: None
+ */
+static void hdd_wait_for_sme_close_sesion(hdd_context_t *hdd_ctx,
+ hdd_adapter_t *adapter)
+{
+ unsigned long rc;
+
+ if (!test_bit(SME_SESSION_OPENED, &adapter->event_flags)) {
+ hddLog(LOGE, FL("session is not opened:%d"), adapter->sessionId);
+ return;
+ }
+
+ INIT_COMPLETION(adapter->session_close_comp_var);
+ if (eHAL_STATUS_SUCCESS ==
+ sme_CloseSession(hdd_ctx->hHal, adapter->sessionId,
+ hdd_smeCloseSessionCallback,
+ adapter)) {
+ /*
+ * Block on a completion variable. Can't wait
+ * forever though.
+ */
+ rc = wait_for_completion_timeout(
+ &adapter->session_close_comp_var,
+ msecs_to_jiffies
+ (WLAN_WAIT_TIME_SESSIONOPENCLOSE));
+ if (!rc)
+ hddLog(LOGE, FL("failure waiting for session_close_comp_var"));
+ }
+}
+
VOS_STATUS hdd_stop_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
const v_BOOL_t bCloseSession)
{
@@ -11469,11 +11506,11 @@ VOS_STATUS hdd_stop_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
{
hddLog(LOGE, "%s: failed to post disconnect event to SME",
__func__);
- }
- memset(&wrqu, '\0', sizeof(wrqu));
- wrqu.ap_addr.sa_family = ARPHRD_ETHER;
- memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN);
- wireless_send_event(pAdapter->dev, SIOCGIWAP, &wrqu, NULL);
+ }
+ memset(&wrqu, '\0', sizeof(wrqu));
+ wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+ memset(wrqu.ap_addr.sa_data,'\0',ETH_ALEN);
+ wireless_send_event(pAdapter->dev, SIOCGIWAP, &wrqu, NULL);
}
else
{
@@ -11499,24 +11536,8 @@ VOS_STATUS hdd_stop_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
/* It is possible that the caller of this function does not
* wish to close the session
*/
- if (VOS_TRUE == bCloseSession &&
- test_bit(SME_SESSION_OPENED, &pAdapter->event_flags))
- {
- INIT_COMPLETION(pAdapter->session_close_comp_var);
- if (eHAL_STATUS_SUCCESS ==
- sme_CloseSession(pHddCtx->hHal, pAdapter->sessionId,
- hdd_smeCloseSessionCallback, pAdapter))
- {
- //Block on a completion variable. Can't wait forever though.
- rc = wait_for_completion_timeout(
- &pAdapter->session_close_comp_var,
- msecs_to_jiffies(WLAN_WAIT_TIME_SESSIONOPENCLOSE));
- if (!rc) {
- hddLog(LOGE, "%s: failure waiting for session_close_comp_var",
- __func__);
- }
- }
- }
+ if (bCloseSession)
+ hdd_wait_for_sme_close_sesion(pHddCtx, pAdapter);
break;
case WLAN_HDD_SOFTAP:
@@ -11602,6 +11623,8 @@ VOS_STATUS hdd_stop_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
pAdapter->sessionCtx.ap.beacon = NULL;
}
mutex_unlock(&pHddCtx->sap_lock);
+ if (bCloseSession)
+ hdd_wait_for_sme_close_sesion(pHddCtx, pAdapter);
break;
case WLAN_HDD_OCB:
diff --git a/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
index 64939fe8a436..9df20b3955f1 100644
--- a/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
+++ b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
@@ -2342,7 +2342,8 @@ void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
if(NULL == pDeleteStaParams ||
NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
{
- limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
+ limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message: %d"),
+ pDeleteStaParams->sessionId);
if(pDeleteStaParams != NULL)
{
vos_mem_free(pDeleteStaParams);
diff --git a/CORE/SAP/inc/sapApi.h b/CORE/SAP/inc/sapApi.h
index 9a8f915f8725..a3cbbd68d7ba 100644
--- a/CORE/SAP/inc/sapApi.h
+++ b/CORE/SAP/inc/sapApi.h
@@ -992,7 +992,10 @@ v_PVOID_t WLANSAP_Open(v_PVOID_t pvosGCtx);
VOS_STATUS
WLANSAP_Start
(
- v_PVOID_t pvosGCtx
+ v_PVOID_t pvosGCtx,
+ tVOS_CON_MODE mode,
+ uint8_t *addr,
+ uint32_t *session_id
);
/*==========================================================================
diff --git a/CORE/SAP/src/sapApiLinkCntl.c b/CORE/SAP/src/sapApiLinkCntl.c
index 1fe613868e1f..92d0e8f16ce3 100644
--- a/CORE/SAP/src/sapApiLinkCntl.c
+++ b/CORE/SAP/src/sapApiLinkCntl.c
@@ -533,20 +533,6 @@ WLANSAP_PreStartBssAcsScanCallback
eSAP_ACS_CHANNEL_SELECTED,
(v_PVOID_t) eSAP_STATUS_SUCCESS);
}
-
- if (psapContext->isScanSessionOpen)
- {
- 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;
}
@@ -615,12 +601,10 @@ WLANSAP_RoamCallback
case eCSR_ROAM_SESSION_OPENED:
{
VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
- FL("Before switch on roamStatus = %d"),
- roamStatus);
+ FL("Session %d opened successfully"),
+ sapContext->sessionId);
sapContext->isSapSessionOpen = eSAP_TRUE;
- halStatus = sme_RoamConnect(hHal, sapContext->sessionId,
- &sapContext->csrRoamProfile,
- &sapContext->csrRoamId);
+ vos_event_set(&sapContext->sap_session_opened_evt);
break;
}
diff --git a/CORE/SAP/src/sapFsm.c b/CORE/SAP/src/sapFsm.c
index 7d5d2390cc99..5f55eb805e2e 100644
--- a/CORE/SAP/src/sapFsm.c
+++ b/CORE/SAP/src/sapFsm.c
@@ -2423,31 +2423,22 @@ sapGotoChannelSel
return VOS_STATUS_SUCCESS;
}// sapGotoChannelSel
+#define SAP_OPEN_SESSION_TIMEOUT 500
-/*==========================================================================
- FUNCTION sap_OpenSession
-
- DESCRIPTION
- Function for opening SME and SAP sessions when system is in SoftAP role
-
- DEPENDENCIES
- NA.
-
- PARAMETERS
-
- IN
- hHal : Hal handle
- sapContext : Sap Context value
-
- RETURN VALUE
- The VOS_STATUS code associated with performing the operation
-
- VOS_STATUS_SUCCESS: Success
+/**
+ * sap_OpenSession() - Opens a SAP session
+ * @hHal: Hal handle
+ * @sapContext: Sap Context value
+ * @session_id: Pointer to the session id
+ *
+ * Function for opening SME and SAP sessions when system is in SoftAP role
+ *
+ * Return: eHalStatus
+ */
- SIDE EFFECTS
-============================================================================*/
-VOS_STATUS
-sap_OpenSession (tHalHandle hHal, ptSapContext sapContext)
+eHalStatus
+sap_OpenSession (tHalHandle hHal, ptSapContext sapContext,
+ uint32_t *session_id)
{
tANI_U32 type, subType;
eHalStatus halStatus;
@@ -2464,6 +2455,7 @@ sap_OpenSession (tHalHandle hHal, ptSapContext sapContext)
VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL, "failed to get vdev type");
return VOS_STATUS_E_FAILURE;
}
+ vos_event_reset(&sapContext->sap_session_opened_evt);
/* Open SME Session for Softap */
halStatus = sme_OpenSession(hHal,
&WLANSAP_RoamCallback,
@@ -2482,12 +2474,22 @@ sap_OpenSession (tHalHandle hHal, ptSapContext sapContext)
}
sme_set_allowed_action_frames(hHal, ALLOWED_ACTION_FRAMES_BITMAP0_SAP);
+ status = vos_wait_single_event(
+ &sapContext->sap_session_opened_evt,
+ SAP_OPEN_SESSION_TIMEOUT);
+ if (!VOS_IS_STATUS_SUCCESS(status)) {
+ VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ "wait for sap open session event timed out");
+ return VOS_STATUS_E_FAILURE;
+ }
pMac->sap.sapCtxList [ sapContext->sessionId ].sessionID =
sapContext->sessionId;
pMac->sap.sapCtxList [ sapContext->sessionId ].pSapContext = sapContext;
pMac->sap.sapCtxList [ sapContext->sessionId ].sapPersona=
sapContext->csrRoamProfile.csrPersona;
+ *session_id = sapContext->sessionId;
+ sapContext->isSapSessionOpen = eSAP_TRUE;
return VOS_STATUS_SUCCESS;
}
@@ -2555,17 +2557,17 @@ sapGotoStarting
eSME_REASON_OTHER);
}
- halStatus = sap_OpenSession(hHal, sapContext);
+ VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+ "%s: session: %d", __func__, sapContext->sessionId);
- if(eHAL_STATUS_SUCCESS != halStatus )
- {
+ halStatus = sme_RoamConnect(hHal, sapContext->sessionId,
+ &sapContext->csrRoamProfile,
+ &sapContext->csrRoamId);
+ if (eHAL_STATUS_SUCCESS != halStatus)
VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
- "Error: In %s calling sap_OpenSession status = %d",
- __func__, halStatus);
- return VOS_STATUS_E_FAILURE;
- }
+ "%s: Failed to issue sme_RoamConnect", __func__);
+ return halStatus;
- return VOS_STATUS_SUCCESS;
}// sapGotoStarting
/*==========================================================================
@@ -3145,6 +3147,7 @@ eHalStatus sap_CloseSession(tHalHandle hHal,
sapContext->isCacStartNotified = VOS_FALSE;
sapContext->isCacEndNotified = VOS_FALSE;
pMac->sap.sapCtxList[sapContext->sessionId].pSapContext = NULL;
+ sapContext->isSapSessionOpen = false;
if (NULL == sap_find_valid_concurrent_session(hHal))
{
@@ -3417,44 +3420,37 @@ sapFsm
if ((msg == eSAP_HDD_START_INFRA_BSS))
{
/* Transition from eSAP_DISCONNECTED to eSAP_CH_SELECT (both without substates) */
- VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, new from state %s => %s",
- __func__, "eSAP_DISCONNECTED", "eSAP_CH_SELECT");
-
- /* There can be one SAP Session for softap */
- 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;
-
- if ((sapContext->channel == AUTO_CHANNEL_SELECT) &&
- (sapContext->isScanSessionOpen == eSAP_FALSE))
- {
- tANI_U32 type, subType;
- tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
- if (NULL == hHal)
- {
- VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
- "In %s, NULL hHal in state %s, msg %d",
- __func__, "eSAP_DISCONNECTED", msg);
+ VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "In %s, new from state %s => %s, session id %d",
+ __func__, "eSAP_DISCONNECTED", "eSAP_CH_SELECT", sapContext->sessionId);
+
+ if (sapContext->isSapSessionOpen == eSAP_FALSE) {
+ uint32_t type, subtype;
+ if (sapContext->csrRoamProfile.csrPersona ==
+ VOS_P2P_GO_MODE)
+ vosStatus = vos_get_vdev_types(VOS_P2P_GO_MODE,
+ &type, &subtype);
+ else
+ vosStatus = vos_get_vdev_types(VOS_STA_SAP_MODE,
+ &type, &subtype);
+ if (VOS_STATUS_SUCCESS != vosStatus) {
+ VOS_TRACE(VOS_MODULE_ID_SAP,
+ VOS_TRACE_LEVEL_FATAL,
+ "failed to get vdev type");
+ return VOS_STATUS_E_FAILURE;
}
- else 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__);
- } else {
- sapContext->isScanSessionOpen = eSAP_TRUE;
- }
+ /* Open SME Session for scan */
+ vosStatus = sme_OpenSession(hHal, NULL,
+ sapContext, sapContext->self_mac_addr,
+ &sapContext->sessionId, type, subtype);
+ if (VOS_STATUS_SUCCESS != vosStatus) {
+ VOS_TRACE(VOS_MODULE_ID_SAP,
+ VOS_TRACE_LEVEL_ERROR,
+ FL("Error: calling sme_OpenSession"));
+ return VOS_STATUS_E_FAILURE;
}
+ sapContext->isSapSessionOpen = eSAP_TRUE;
}
+
/* init dfs channel nol */
sapInitDfsChannelNolList(sapContext);
@@ -3512,26 +3508,6 @@ sapFsm
break;
case eSAP_CH_SELECT:
- if (sapContext->isScanSessionOpen == eSAP_TRUE)
- {
- /* scan completed, so close the session */
- tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
- if (NULL == hHal)
- {
- VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s, NULL hHal in state %s, msg %d",
- __func__, "eSAP_CH_SELECT", msg);
- } else {
- if(eHAL_STATUS_SUCCESS != sme_CloseSession(hHal,
- sapContext->sessionId, NULL, NULL))
- {
- VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "In %s CloseSession error event msg %d",
- __func__, msg);
- } else {
- sapContext->isScanSessionOpen = eSAP_FALSE;
- }
- }
- sapContext->sessionId = 0xff;
- }
if (msg == eSAP_MAC_SCAN_COMPLETE)
{
@@ -3924,7 +3900,7 @@ sapFsm
else
{
sapContext->isSapSessionOpen = eSAP_FALSE;
- if (!HAL_STATUS_SUCCESS(
+ if (!(eHAL_STATUS_SUCCESS ==
sap_CloseSession(hHal,
sapContext,
sapRoamSessionCloseCallback, TRUE)))
diff --git a/CORE/SAP/src/sapInternal.h b/CORE/SAP/src/sapInternal.h
index b90046f583ef..e4054623b289 100644
--- a/CORE/SAP/src/sapInternal.h
+++ b/CORE/SAP/src/sapInternal.h
@@ -299,7 +299,7 @@ typedef struct sSapContext {
uint16_t beacon_tx_rate;
tSirMacRateSet supp_rate_set;
tSirMacRateSet extended_rate_set;
-
+ vos_event_t sap_session_opened_evt;
} *ptSapContext;
@@ -1086,6 +1086,13 @@ void sap_config_acs_result(tHalHandle hal, ptSapContext sap_ctx,
*/
bool sap_check_in_avoid_ch_list(ptSapContext sap_ctx, uint8_t channel);
#endif
+
+eHalStatus sap_OpenSession(tHalHandle hHal, ptSapContext sapContext,
+ uint32_t *session_id);
+eHalStatus sap_CloseSession(tHalHandle hHal,
+ ptSapContext sapContext,
+ csrRoamSessionCloseCallback callback,
+ v_BOOL_t valid);
#ifdef __cplusplus
}
#endif
diff --git a/CORE/SAP/src/sapModule.c b/CORE/SAP/src/sapModule.c
index ec75cbf419fe..cf04ef96e5b6 100644
--- a/CORE/SAP/src/sapModule.c
+++ b/CORE/SAP/src/sapModule.c
@@ -146,68 +146,63 @@ v_PVOID_t WLANSAP_Open(v_PVOID_t pvosGCtx)
return pSapCtx;
}// WLANSAP_Open
-/*==========================================================================
- FUNCTION WLANSAP_Start
-
- DESCRIPTION
- Called as part of the overall start procedure (vos_start). SAP will
- use this call to register with TL as the SAP entity for
- SAP RSN frames.
-
- DEPENDENCIES
-
- PARAMETERS
-
- IN
- pCtx : Pointer to the global vos context; a handle to SAP's
- control block can be extracted from its context
- When MBSSID feature is enabled, SAP context is directly
- passed to SAP APIs
-
- 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
-============================================================================*/
-
+/**
+ * WLANSAP_Start() - wlan start SAP.
+ * @pCtx: Pointer to the global cds context; a handle to SAP's
+ * control block can be extracted from its context
+ * When MBSSID feature is enabled, SAP context is directly
+ * passed to SAP APIs
+ * @mode: Device mode
+ * @addr: MAC address of the SAP
+ * @session_id: Pointer to the session id
+ *
+ * Called as part of the overall start procedure (cds_enable). SAP will
+ * use this call to register with TL as the SAP entity for SAP RSN frames.
+ *
+ * Return: 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
+ */
VOS_STATUS
WLANSAP_Start
(
- v_PVOID_t pCtx
+ v_PVOID_t pCtx,
+ tVOS_CON_MODE mode,
+ uint8_t *addr,
+ uint32_t *session_id
)
{
ptSapContext pSapCtx = NULL;
+ VOS_STATUS vos_status;
+ tHalHandle hal;
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
- "WLANSAP_Start invoked successfully");
+ "WLANSAP_Start invoked successfully");
/*------------------------------------------------------------------------
- Sanity check
- Extract SAP control block
- ------------------------------------------------------------------------*/
+ Sanity check
+ Extract SAP control block
+ ------------------------------------------------------------------------*/
pSapCtx = VOS_GET_SAP_CB(pCtx);
if ( NULL == pSapCtx )
{
VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
- "%s: Invalid SAP pointer from pCtx", __func__);
+ "%s: Invalid SAP pointer from pCtx", __func__);
return VOS_STATUS_E_FAULT;
}
/*------------------------------------------------------------------------
- For now, presume security is not enabled.
- -----------------------------------------------------------------------*/
+ For now, presume security is not enabled.
+ -----------------------------------------------------------------------*/
pSapCtx->ucSecEnabled = WLANSAP_SECURITY_ENABLED_STATE;
/*------------------------------------------------------------------------
- Now configure the roaming profile links. To SSID and bssid.
- ------------------------------------------------------------------------*/
+ Now configure the roaming profile links. To SSID and bssid.
+ ------------------------------------------------------------------------*/
// We have room for two SSIDs.
pSapCtx->csrRoamProfile.SSIDs.numOfSSIDs = 1; // This is true for now.
pSapCtx->csrRoamProfile.SSIDs.SSIDList = pSapCtx->SSIDList; //Array of two
@@ -217,6 +212,9 @@ WLANSAP_Start
pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1; // This is true for now.
pSapCtx->csrRoamProfile.BSSIDs.bssid = &pSapCtx->bssid;
+ pSapCtx->csrRoamProfile.csrPersona = mode;
+ vos_mem_copy(pSapCtx->self_mac_addr, addr, VOS_MAC_ADDR_SIZE);
+ vos_event_init(&pSapCtx->sap_session_opened_evt);
// Now configure the auth type in the roaming profile. To open.
pSapCtx->csrRoamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; // open is the default
@@ -224,10 +222,17 @@ WLANSAP_Start
if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pSapCtx->SapGlobalLock)))
{
VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
- "WLANSAP_Start failed init lock");
+ "WLANSAP_Start failed init lock");
return VOS_STATUS_E_FAULT;
}
-
+ hal = (tHalHandle) VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+ vos_status = sap_OpenSession(hal, pSapCtx, session_id);
+ if (VOS_STATUS_SUCCESS != vos_status) {
+ VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
+ "Error: In %s calling sap_OpenSession status = %d",
+ __func__, vos_status);
+ return VOS_STATUS_E_FAILURE;
+ }
return VOS_STATUS_SUCCESS;
}/* WLANSAP_Start */
@@ -383,6 +388,7 @@ WLANSAP_CleanCB
v_U32_t freeFlag // 0 /*do not empty*/);
)
{
+ tHalHandle hal;
/*------------------------------------------------------------------------
Sanity check SAP control block
------------------------------------------------------------------------*/
@@ -399,6 +405,13 @@ WLANSAP_CleanCB
------------------------------------------------------------------------*/
VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "WLANSAP_CleanCB");
+ hal = (tHalHandle) VOS_GET_HAL_CB(pSapCtx->pvosGCtx);
+ if (eSAP_TRUE == pSapCtx->isSapSessionOpen && hal) {
+ VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
+ "close existing SAP session");
+ sap_CloseSession(hal, pSapCtx, NULL, false);
+ }
+
vos_mem_zero( pSapCtx, sizeof(tSapContext));
pSapCtx->pvosGCtx = NULL;
@@ -409,7 +422,6 @@ WLANSAP_CleanCB
__func__, pSapCtx->sapsMachine, pSapCtx);
pSapCtx->sessionId = 0;
pSapCtx->channel = 0;
- pSapCtx->isSapSessionOpen = eSAP_FALSE;
return VOS_STATUS_SUCCESS;
}// WLANSAP_CleanCB
@@ -3770,44 +3782,11 @@ WLANSAP_ACS_CHSelect(v_PVOID_t pvosGCtx,
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 );
sapContext->acs_cfg = &pConfig->acs_cfg;
sapContext->csrRoamProfile.phyMode = sapContext->acs_cfg->hw_mode;
- if (sapContext->isScanSessionOpen == eSAP_FALSE) {
- tANI_U32 type, subType;
-
-#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
- if((sapContext->acs_cfg->skip_scan_status != eSAP_SKIP_ACS_SCAN) &&
- (VOS_STATUS_SUCCESS ==
- vos_get_vdev_types(VOS_STA_MODE, &type, &subType))) {
-#else
- if(VOS_STATUS_SUCCESS ==
- vos_get_vdev_types(VOS_STA_MODE, &type, &subType)) {
-#endif
- /*
- * 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.
@@ -3855,32 +3834,12 @@ WLANSAP_ACS_CHSelect(v_PVOID_t pvosGCtx,
FL("Scan Req Failed/ACS Overridden, Selected channel = %d"),
sapContext->channel);
- if (sapContext->isScanSessionOpen == eSAP_TRUE) {
- /* acs scan not needed so close the session */
- tHalHandle hHal = VOS_GET_HAL_CB(sapContext->pvosGCtx);
- if (hHal == NULL) {
- VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
- "%s: HAL Handle NULL. ACS Scan session close fail!",
- __func__);
- return VOS_STATUS_E_FAILURE;
- }
- if (eHAL_STATUS_SUCCESS == sme_CloseSession(hHal,
- sapContext->sessionId, NULL, NULL)) {
- sapContext->isScanSessionOpen = eSAP_FALSE;
- } else {
- VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR,
- "%s: ACS Scan session close fail!", __func__);
- }
- sapContext->sessionId = 0xff;
- }
-
return sapSignalHDDevent(sapContext, NULL,
eSAP_ACS_CHANNEL_SELECTED, (v_PVOID_t) eSAP_STATUS_SUCCESS);
}
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;
}
/**