qcacld-3.0: Detect duplicate session open request

Detect duplicate session request with same mac address
and return failure to requestor.

Change-Id: I0155f29e879e1c2a46a8b9efbcaf160353bf9c05
CRs-Fixed: 1072885
This commit is contained in:
Sandeep Puligilla
2016-10-04 17:36:32 -07:00
committed by qcabuildsw
parent 6485e1a407
commit ba71da4f6c

View File

@@ -15340,59 +15340,67 @@ QDF_STATUS csr_process_add_sta_session_command(tpAniSirGlobal pMac,
return status; return status;
} }
QDF_STATUS csr_roam_open_session(tpAniSirGlobal pMac, QDF_STATUS csr_roam_open_session(tpAniSirGlobal mac_ctx,
csr_roam_completeCallback callback, csr_roam_completeCallback callback,
void *pContext, void *pContext,
uint8_t *pSelfMacAddr, uint8_t *pbSessionId, uint8_t *pSelfMacAddr, uint8_t *pbSessionId,
uint32_t type, uint32_t subType) uint32_t type, uint32_t subType)
{ {
QDF_STATUS status = QDF_STATUS_SUCCESS; QDF_STATUS status = QDF_STATUS_SUCCESS;
uint32_t i, value = 0; uint32_t i, value = 0, session_id;
union { union {
uint16_t nCfgValue16; uint16_t nCfgValue16;
tSirMacHTCapabilityInfo htCapInfo; tSirMacHTCapabilityInfo htCapInfo;
} uHTCapabilityInfo; } uHTCapabilityInfo;
uint32_t nCfgValue = 0; uint32_t nCfgValue = 0;
tCsrRoamSession *pSession; tCsrRoamSession *session;
*pbSessionId = CSR_SESSION_ID_INVALID; *pbSessionId = CSR_SESSION_ID_INVALID;
for (i = 0; i < pMac->sme.max_intf_count; i++) { if (QDF_STATUS_SUCCESS == csr_roam_get_session_id_from_bssid(mac_ctx,
sms_log(pMac, LOG1, FL("session:%d active:%d"), i, (struct qdf_mac_addr *)pSelfMacAddr,
pMac->roam.roamSession[i].sessionActive); &session_id)) {
if (!CSR_IS_SESSION_VALID(pMac, i)) { sms_log(mac_ctx, LOGE,
pSession = CSR_GET_SESSION(pMac, i); FL("Session %d exists with mac address"
if (!pSession) { MAC_ADDRESS_STR),
sms_log(pMac, LOGE, session_id, MAC_ADDR_ARRAY(pSelfMacAddr));
FL return QDF_STATUS_E_FAILURE;
("Session does not exist for interface %d"), }
for (i = 0; i < mac_ctx->sme.max_intf_count; i++) {
sms_log(mac_ctx, LOG1, FL("session:%d active:%d"), i,
mac_ctx->roam.roamSession[i].sessionActive);
if (!CSR_IS_SESSION_VALID(mac_ctx, i)) {
session = CSR_GET_SESSION(mac_ctx, i);
if (!session) {
sms_log(mac_ctx, LOGE,
FL("Session does not exist for interface %d"),
i); i);
break; break;
} }
status = QDF_STATUS_SUCCESS; status = QDF_STATUS_SUCCESS;
pSession->sessionActive = true; session->sessionActive = true;
pSession->sessionId = (uint8_t) i; session->sessionId = (uint8_t) i;
/* Initialize FT related data structures only in STA mode */ /* Initialize FT related data structures only in STA mode */
sme_ft_open(pMac, pSession->sessionId); sme_ft_open(mac_ctx, session->sessionId);
pSession->callback = callback; session->callback = callback;
pSession->pContext = pContext; session->pContext = pContext;
qdf_mem_copy(&pSession->selfMacAddr, pSelfMacAddr, qdf_mem_copy(&session->selfMacAddr, pSelfMacAddr,
sizeof(struct qdf_mac_addr)); sizeof(struct qdf_mac_addr));
*pbSessionId = (uint8_t) i; *pbSessionId = (uint8_t) i;
status = status =
qdf_mc_timer_init(&pSession->hTimerRoaming, qdf_mc_timer_init(&session->hTimerRoaming,
QDF_TIMER_TYPE_SW, QDF_TIMER_TYPE_SW,
csr_roam_roaming_timer_handler, csr_roam_roaming_timer_handler,
&pSession->roamingTimerInfo); &session->roamingTimerInfo);
if (!QDF_IS_STATUS_SUCCESS(status)) { if (!QDF_IS_STATUS_SUCCESS(status)) {
sms_log(pMac, LOGE, sms_log(mac_ctx, LOGE,
FL FL("cannot allocate memory for Roaming timer"));
("cannot allocate memory for Roaming timer"));
break; break;
} }
/* get the HT capability info */ /* get the HT capability info */
if (wlan_cfg_get_int(pMac, WNI_CFG_HT_CAP_INFO, &value) if (wlan_cfg_get_int(mac_ctx, WNI_CFG_HT_CAP_INFO, &value)
!= eSIR_SUCCESS) { != eSIR_SUCCESS) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE(QDF_MODULE_ID_QDF,
QDF_TRACE_LEVEL_ERROR, QDF_TRACE_LEVEL_ERROR,
@@ -15401,134 +15409,137 @@ QDF_STATUS csr_roam_open_session(tpAniSirGlobal pMac,
break; break;
} }
#ifdef FEATURE_WLAN_BTAMP_UT_RF #ifdef FEATURE_WLAN_BTAMP_UT_RF
status = qdf_mc_timer_init(&pSession->hTimerJoinRetry, status = qdf_mc_timer_init(&session->hTimerJoinRetry,
QDF_TIMER_TYPE_SW, QDF_TIMER_TYPE_SW,
csr_roam_join_retry_timer_handler, csr_roam_join_retry_timer_handler,
&pSession-> &session->
joinRetryTimerInfo); joinRetryTimerInfo);
if (!QDF_IS_STATUS_SUCCESS(status)) { if (!QDF_IS_STATUS_SUCCESS(status)) {
sms_log(pMac, LOGE, sms_log(mac_ctx, LOGE,
FL FL
("cannot allocate memory for join retry timer")); ("cannot allocate memory for join retry timer"));
break; break;
} }
#endif #endif
uHTCapabilityInfo.nCfgValue16 = 0xFFFF & value; uHTCapabilityInfo.nCfgValue16 = 0xFFFF & value;
pSession->htConfig.ht_rx_ldpc = session->htConfig.ht_rx_ldpc =
uHTCapabilityInfo.htCapInfo.advCodingCap; uHTCapabilityInfo.htCapInfo.advCodingCap;
pSession->htConfig.ht_tx_stbc = session->htConfig.ht_tx_stbc =
uHTCapabilityInfo.htCapInfo.txSTBC; uHTCapabilityInfo.htCapInfo.txSTBC;
pSession->htConfig.ht_rx_stbc = session->htConfig.ht_rx_stbc =
uHTCapabilityInfo.htCapInfo.rxSTBC; uHTCapabilityInfo.htCapInfo.rxSTBC;
pSession->htConfig.ht_sgi20 = session->htConfig.ht_sgi20 =
uHTCapabilityInfo.htCapInfo.shortGI20MHz; uHTCapabilityInfo.htCapInfo.shortGI20MHz;
pSession->htConfig.ht_sgi40 = session->htConfig.ht_sgi40 =
uHTCapabilityInfo.htCapInfo.shortGI40MHz; uHTCapabilityInfo.htCapInfo.shortGI40MHz;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_MAX_MPDU_LENGTH,
&nCfgValue); &nCfgValue);
pSession->vht_config.max_mpdu_len = nCfgValue; session->vht_config.max_mpdu_len = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, wlan_cfg_get_int(mac_ctx,
WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
&nCfgValue); &nCfgValue);
pSession->vht_config.supported_channel_widthset = session->vht_config.supported_channel_widthset =
nCfgValue; nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_LDPC_CODING_CAP, wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_LDPC_CODING_CAP,
&nCfgValue); &nCfgValue);
pSession->vht_config.ldpc_coding = nCfgValue; session->vht_config.ldpc_coding = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_SHORT_GI_80MHZ,
&nCfgValue); &nCfgValue);
pSession->vht_config.shortgi80 = nCfgValue; session->vht_config.shortgi80 = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, wlan_cfg_get_int(mac_ctx,
WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
&nCfgValue); &nCfgValue);
pSession->vht_config.shortgi160and80plus80 = nCfgValue; session->vht_config.shortgi160and80plus80 = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_TXSTBC, &nCfgValue); wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_TXSTBC,
pSession->vht_config.tx_stbc = nCfgValue; &nCfgValue);
session->vht_config.tx_stbc = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_RXSTBC, &nCfgValue); wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_RXSTBC,
pSession->vht_config.rx_stbc = nCfgValue; &nCfgValue);
session->vht_config.rx_stbc = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_SU_BEAMFORMER_CAP,
&nCfgValue); &nCfgValue);
pSession->vht_config.su_beam_former = nCfgValue; session->vht_config.su_beam_former = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_SU_BEAMFORMEE_CAP,
&nCfgValue); &nCfgValue);
pSession->vht_config.su_beam_formee = nCfgValue; session->vht_config.su_beam_formee = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, wlan_cfg_get_int(mac_ctx,
WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
&nCfgValue); &nCfgValue);
pSession->vht_config.csnof_beamformer_antSup = session->vht_config.csnof_beamformer_antSup =
nCfgValue; nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, wlan_cfg_get_int(mac_ctx,
WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
&nCfgValue); &nCfgValue);
pSession->vht_config.num_soundingdim = nCfgValue; session->vht_config.num_soundingdim = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_MU_BEAMFORMER_CAP,
&nCfgValue); &nCfgValue);
pSession->vht_config.mu_beam_former = nCfgValue; session->vht_config.mu_beam_former = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_MU_BEAMFORMEE_CAP,
&nCfgValue); &nCfgValue);
pSession->vht_config.mu_beam_formee = nCfgValue; session->vht_config.mu_beam_formee = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_TXOP_PS, wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_TXOP_PS,
&nCfgValue); &nCfgValue);
pSession->vht_config.vht_txops = nCfgValue; session->vht_config.vht_txops = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_HTC_VHTC_CAP, wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_HTC_VHTC_CAP,
&nCfgValue); &nCfgValue);
pSession->vht_config.htc_vhtcap = nCfgValue; session->vht_config.htc_vhtcap = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_RX_ANT_PATTERN, wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_RX_ANT_PATTERN,
&nCfgValue); &nCfgValue);
pSession->vht_config.rx_antpattern = nCfgValue; session->vht_config.rx_antpattern = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_TX_ANT_PATTERN, wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_TX_ANT_PATTERN,
&nCfgValue); &nCfgValue);
pSession->vht_config.tx_antpattern = nCfgValue; session->vht_config.tx_antpattern = nCfgValue;
nCfgValue = 0; nCfgValue = 0;
wlan_cfg_get_int(pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, wlan_cfg_get_int(mac_ctx,
WNI_CFG_VHT_AMPDU_LEN_EXPONENT,
&nCfgValue); &nCfgValue);
pSession->vht_config.max_ampdu_lenexp = nCfgValue; session->vht_config.max_ampdu_lenexp = nCfgValue;
status = csr_issue_add_sta_for_session_req(pMac, i, status = csr_issue_add_sta_for_session_req(mac_ctx, i,
pSelfMacAddr, pSelfMacAddr,
type, subType); type, subType);
break; break;
} }
} }
if (pMac->sme.max_intf_count == i) { if (mac_ctx->sme.max_intf_count == i) {
/* No session is available */ /* No session is available */
sms_log(pMac, LOGE, sms_log(mac_ctx, LOGE,
"%s: Reached max interfaces: %d! Session creation will fail", "%s: Reached max interfaces: %d! Session creation will fail",
__func__, pMac->sme.max_intf_count); __func__, mac_ctx->sme.max_intf_count);
status = QDF_STATUS_E_RESOURCES; status = QDF_STATUS_E_RESOURCES;
} }
return status; return status;