67 changes: 66 additions & 1 deletion drivers/staging/qcacld-3.0/core/mac/src/pe/lim/lim_api.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -615,6 +615,8 @@ void lim_cleanup(tpAniSirGlobal pMac)
}

if (pMac->lim.gpLimMlmSetKeysReq != NULL) {
qdf_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
sizeof(tLimMlmSetKeysReq));
qdf_mem_free(pMac->lim.gpLimMlmSetKeysReq);
pMac->lim.gpLimMlmSetKeysReq = NULL;
}
Expand Down Expand Up @@ -1799,6 +1801,68 @@ void lim_fill_join_rsp_ht_caps(tpPESession session, tpSirSmeJoinRsp join_rsp)
#endif

#ifdef WLAN_FEATURE_ROAM_OFFLOAD
#ifdef WLAN_FEATURE_11W
static void pe_set_rmf_caps(tpAniSirGlobal mac_ctx,
tpPESession ft_session,
roam_offload_synch_ind *roam_synch)
{
uint8_t *assoc_body;
uint16_t len, ret;
tDot11fReAssocRequest *assoc_req;
uint32_t status;
tSirMacRsnInfo rsn_ie;
tDot11fIERSN parse_rsn = {0};

assoc_body = (uint8_t *)roam_synch + roam_synch->reassoc_req_offset +
sizeof(tSirMacMgmtHdr);
len = roam_synch->reassoc_req_length - sizeof(tSirMacMgmtHdr);

assoc_req = qdf_mem_malloc(sizeof(*assoc_req));
if (!assoc_req)
return;

/* delegate to the framesc-generated code, */
status = dot11f_unpack_re_assoc_request(mac_ctx, assoc_body, len,
assoc_req, false);
if (DOT11F_FAILED(status)) {
pe_err("Failed to parse a Re-association Request (0x%08x, %d bytes):",
status, len);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
assoc_body, len);
qdf_mem_free(assoc_req);
return;
} else if (DOT11F_WARNED(status)) {
pe_debug("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):",
status, len);
}
ft_session->limRmfEnabled = false;
if (!assoc_req->RSNOpaque.present) {
qdf_mem_free(assoc_req);
return;
}
rsn_ie.info[0] = 48;
rsn_ie.info[1] = assoc_req->RSNOpaque.num_data;

rsn_ie.length = assoc_req->RSNOpaque.num_data + 2;
qdf_mem_copy(&rsn_ie.info[2], assoc_req->RSNOpaque.data,
assoc_req->RSNOpaque.num_data);
qdf_mem_free(assoc_req);

ret = dot11f_unpack_ie_rsn(mac_ctx, &rsn_ie.info[2],
rsn_ie.length - 2, &parse_rsn, false);
if (DOT11F_FAILED(ret))
return;

ft_session->limRmfEnabled = parse_rsn.RSN_Cap[0] & 0x80;
}
#else
static inline void pe_set_rmf_caps(tpAniSirGlobal mac_ctx,
tpPESession ft_session,
roam_offload_synch_ind *roam_synch)
{
}
#endif

/**
* sir_parse_bcn_fixed_fields() - Parse fixed fields in Beacon IE's
*
Expand Down Expand Up @@ -2145,6 +2209,7 @@ QDF_STATUS pe_roam_synch_callback(tpAniSirGlobal mac_ctx,
/* Next routine will update nss and vdev_nss with AP's capabilities */
lim_fill_ft_session(mac_ctx, bss_desc, ft_session_ptr, session_ptr);

pe_set_rmf_caps(mac_ctx, ft_session_ptr, roam_sync_ind_ptr);
/* Next routine may update nss based on dot11Mode */
lim_ft_prepare_add_bss_req(mac_ctx, false, ft_session_ptr, bss_desc);
roam_sync_ind_ptr->add_bss_params =
Expand Down
55 changes: 26 additions & 29 deletions drivers/staging/qcacld-3.0/core/mac/src/pe/lim/lim_assoc_utils.c
Expand Up @@ -349,8 +349,8 @@ static inline bool is_non_rsn_cipher(uint8_t cipher_suite)
* frame handling to determine whether received RSN in
* Assoc/Reassoc request frames include supported cipher suites or not.
*
* Return: eSIR_SUCCESS if ALL BSS basic rates are present in the
* received rateset else failure status.
* Return: eSIR_SUCCESS if ALL supported cipher suites are present in the
* received rsn IE else failure status.
*/

uint8_t
Expand Down Expand Up @@ -461,8 +461,8 @@ lim_check_rx_rsn_ie_match(tpAniSirGlobal mac_ctx, tDot11fIERSN rx_rsn_ie,
* frame handling to determine whether received RSN in
* Assoc/Reassoc request frames include supported cipher suites or not.
*
* Return: Success if ALL BSS basic rates are present in the
* received rateset else failure status.
* Return: Success if ALL supported cipher suites are present in the
* received wpa IE else failure status.
*/

uint8_t
Expand Down Expand Up @@ -3758,41 +3758,38 @@ tSirRetStatus lim_sta_send_add_bss(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp,
sta_context->enable_su_tx_bformer = 1;
}

if ((pAssocRsp->HTCaps.supportedChannelWidthSet) &&
(chanWidthSupp)) {
pAddBssParams->staContext.ch_width = (uint8_t)
pAssocRsp->HTInfo.recommendedTxWidthSet;
if (pAssocRsp->VHTCaps.present)
vht_oper = &pAssocRsp->VHTOperation;
else if (pAssocRsp->vendor_vht_ie.VHTCaps.present) {
vht_oper = &pAssocRsp->
vendor_vht_ie.VHTOperation;
pe_debug("VHT Op IE is in vendor Specfic IE");
}
/*
* in limExtractApCapability function intersection of FW
* advertised channel width and AP advertised channel
* width has been taken into account for calculating
* psessionEntry->ch_width
*/
chanWidthSupp = lim_get_ht_capability(pMac,
eHT_SUPPORTED_CHANNEL_WIDTH_SET,
psessionEntry);

/*
* in limExtractApCapability function intersection of FW
* advertised channel width and AP advertised channel
* width has been taken into account for calculating
* psessionEntry->ch_width
*/
if (chanWidthSupp &&
((pAssocRsp->HTCaps.supportedChannelWidthSet) ||
(pBeaconStruct->HTCaps.supportedChannelWidthSet))) {
pAddBssParams->staContext.ch_width =
psessionEntry->ch_width;

pe_debug("StaCtx: vhtCap %d ChBW %d TxBF %d",
pAddBssParams->staContext.vhtCapable,
pAddBssParams->staContext.ch_width,
sta_context->vhtTxBFCapable);
pe_debug("StaContext su_tx_bfer %d",
sta_context->enable_su_tx_bformer);
} else {
sta_context->ch_width = CH_WIDTH_20MHZ;
sta_context->ch_width = CH_WIDTH_20MHZ;
if ((IS_SIR_STATUS_SUCCESS(
wlan_cfg_get_int(pMac,
WNI_CFG_VHT_ENABLE_TXBF_20MHZ,
&enableTxBF20MHz))) &&
(false == enableTxBF20MHz))
sta_context->vhtTxBFCapable = 0;
}

pe_debug("StaCtx: vhtCap %d ChBW %d TxBF %d",
pAddBssParams->staContext.vhtCapable,
pAddBssParams->staContext.ch_width,
sta_context->vhtTxBFCapable);
pe_debug("StaContext su_tx_bfer %d",
sta_context->enable_su_tx_bformer);

pAddBssParams->staContext.mimoPS =
(tSirMacHTMIMOPowerSaveState)
pAssocRsp->HTCaps.mimoPowerSave;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -672,7 +672,8 @@ QDF_STATUS lim_send_preauth_scan_offload(tpAniSirGlobal mac_ctx,
tSirRetStatus rc = eSIR_SUCCESS;
tSirMsgQ msg;

scan_offload_req = qdf_mem_malloc(sizeof(tSirScanOffloadReq));
scan_offload_req = qdf_mem_malloc(sizeof(tSirScanOffloadReq) +
sizeof(uint8_t));
if (NULL == scan_offload_req) {
pe_err("Memory allocation failed for pScanOffloadReq");
return QDF_STATUS_E_NOMEM;
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/qcacld-3.0/core/mac/src/pe/lim/lim_p2p.c
Expand Up @@ -88,7 +88,8 @@ static QDF_STATUS lim_send_hal_req_remain_on_chan_offload(tpAniSirGlobal pMac,
return QDF_STATUS_E_INVAL;
}

pScanOffloadReq = qdf_mem_malloc(sizeof(tSirScanOffloadReq));
pScanOffloadReq = qdf_mem_malloc(sizeof(tSirScanOffloadReq) +
sizeof(uint8_t));
if (NULL == pScanOffloadReq) {
pe_err("Memory allocation failed for pScanOffloadReq");
return QDF_STATUS_E_NOMEM;
Expand Down
Expand Up @@ -1959,6 +1959,7 @@ void lim_process_action_frame(tpAniSirGlobal mac_ctx,
break;
case SIR_MAC_ACTION_PUBLIC_USAGE:
mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
switch (action_hdr->actionID) {
case SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID:
lim_process_ext_channel_switch_action_frame(mac_ctx,
Expand Down
Expand Up @@ -737,7 +737,7 @@ static void lim_print_ht_cap(tpAniSirGlobal mac_ctx, tpPESession session,
*
* wpa ie related checks
*
* Return: true of no error, false otherwise
* Return: true if no error, false otherwise
*/
static bool lim_chk_n_process_wpa_rsn_ie(tpAniSirGlobal mac_ctx,
tpSirMacMgmtHdr hdr,
Expand All @@ -746,6 +746,7 @@ static bool lim_chk_n_process_wpa_rsn_ie(tpAniSirGlobal mac_ctx,
uint8_t sub_type, bool *pmf_connection)
{
uint8_t *wps_ie = NULL;
uint32_t ret;
tDot11fIEWPA dot11f_ie_wpa = {0};
tDot11fIERSN dot11f_ie_rsn = {0};
tSirRetStatus status = eSIR_SUCCESS;
Expand Down Expand Up @@ -776,11 +777,11 @@ static bool lim_chk_n_process_wpa_rsn_ie(tpAniSirGlobal mac_ctx,
if (assoc_req->rsnPresent) {
if (assoc_req->rsn.length) {
/* Unpack the RSN IE */
if (dot11f_unpack_ie_rsn(mac_ctx,
ret = dot11f_unpack_ie_rsn(mac_ctx,
&assoc_req->rsn.info[0],
assoc_req->rsn.length,
&dot11f_ie_rsn, false) !=
DOT11F_PARSE_SUCCESS) {
&dot11f_ie_rsn, false);
if (!DOT11F_SUCCEEDED(ret)) {
pe_err("Invalid RSN ie");
return false;
}
Expand Down Expand Up @@ -852,11 +853,11 @@ static bool lim_chk_n_process_wpa_rsn_ie(tpAniSirGlobal mac_ctx,
/* Unpack the WPA IE */
if (assoc_req->wpa.length) {
/* OUI is not taken care */
if (dot11f_unpack_ie_wpa(mac_ctx,
&assoc_req->wpa.info[4],
assoc_req->wpa.length,
&dot11f_ie_wpa, false) !=
DOT11F_PARSE_SUCCESS) {
ret = dot11f_unpack_ie_wpa(mac_ctx,
&assoc_req->wpa.info[4],
(assoc_req->wpa.length - 4),
&dot11f_ie_wpa, false);
if (!DOT11F_SUCCEEDED(ret)) {
pe_err("Invalid WPA IE");
return false;
}
Expand Down
Expand Up @@ -285,6 +285,45 @@ static void lim_process_auth_open_system_algo(tpAniSirGlobal mac_ctx,
pe_session);
}

#ifdef WLAN_FEATURE_SAE
/**
* lim_process_sae_auth_frame()-Process SAE authentication frame
* @mac_ctx: MAC context
* @rx_pkt_info: Rx packet
* @pe_session: PE session
*
* Return: None
*/
static void lim_process_sae_auth_frame(tpAniSirGlobal mac_ctx,
uint8_t *rx_pkt_info, tpPESession pe_session)
{
tpSirMacMgmtHdr mac_hdr;
uint32_t frame_len;
uint8_t *body_ptr;

mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);

pe_debug("Received SAE Auth frame type %d subtype %d",
mac_hdr->fc.type, mac_hdr->fc.subType);

if (pe_session->limMlmState != eLIM_MLM_WT_SAE_AUTH_STATE)
pe_err("received SAE auth response in unexpected state %x",
pe_session->limMlmState);

lim_send_sme_mgmt_frame_ind(mac_ctx, mac_hdr->fc.subType,
(uint8_t *) mac_hdr,
frame_len + sizeof(tSirMacMgmtHdr), 0,
WMA_GET_RX_CH(rx_pkt_info), pe_session,
WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info));
}
#else
static inline void lim_process_sae_auth_frame(tpAniSirGlobal mac_ctx,
uint8_t *rx_pkt_info, tpPESession pe_session)
{}
#endif

static void lim_process_auth_frame_type1(tpAniSirGlobal mac_ctx,
tpSirMacMgmtHdr mac_hdr,
tSirMacAuthFrameBody *rx_auth_frm_body,
Expand Down Expand Up @@ -611,16 +650,27 @@ static void lim_process_auth_frame_type2(tpAniSirGlobal mac_ctx,
if (rx_auth_frm_body->authAlgoNumber !=
mac_ctx->lim.gpLimMlmAuthReq->authType) {
/*
* Received Authentication frame with an auth
* algorithm other than one requested.
* Wait until Authentication Failure Timeout.
* Auth algo is open in rx auth frame when auth type is SAE and
* PMK is cached as driver sent auth algo as open in tx frame
* as well.
*/
if ((mac_ctx->lim.gpLimMlmAuthReq->authType ==
eSIR_AUTH_TYPE_SAE) && pe_session->sae_pmk_cached) {
pe_debug("rx Auth frame2 auth algo %d in SAE PMK case",
rx_auth_frm_body->authAlgoNumber);
} else {
/*
* Received Authentication frame with an auth
* algorithm other than one requested.
* Wait until Authentication Failure Timeout.
*/

pe_warn("rx Auth frame2 for unexpected auth algo number %d "
MAC_ADDRESS_STR,
rx_auth_frm_body->authAlgoNumber,
MAC_ADDR_ARRAY(mac_hdr->sa));
return;
pe_warn("rx Auth frame2 for unexpected auth algo %d"
MAC_ADDRESS_STR,
rx_auth_frm_body->authAlgoNumber,
MAC_ADDR_ARRAY(mac_hdr->sa));
return;
}
}

if (rx_auth_frm_body->authStatusCode != eSIR_MAC_SUCCESS_STATUS) {
Expand Down Expand Up @@ -1078,7 +1128,7 @@ lim_process_auth_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info,
uint8_t defaultkey[SIR_MAC_KEY_LENGTH];
uint8_t *plainbody = NULL;
uint8_t decrypt_result;
uint16_t frame_len, curr_seq_num = 0;
uint16_t frame_len, curr_seq_num = 0, auth_alg;
uint32_t val, key_length = 8;
tSirMacAuthFrameBody *rx_auth_frm_body, *rx_auth_frame, *auth_frame;
tpSirMacMgmtHdr mac_hdr;
Expand Down Expand Up @@ -1120,17 +1170,23 @@ lim_process_auth_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info,
* auth frame from AP which results in authentication failure.
*/
if (pe_session->prev_auth_seq_num == curr_seq_num &&
!qdf_mem_cmp(pe_session->prev_auth_mac_addr, &mac_hdr->sa,
ETH_ALEN) &&
mac_hdr->fc.retry) {
pe_err("auth frame, seq num: %d is already processed, drop it",
curr_seq_num);
return;
}

/* save seq number in pe_session */
/* save seq number and mac_addr in pe_session */
pe_session->prev_auth_seq_num = curr_seq_num;
qdf_mem_copy(pe_session->prev_auth_mac_addr, mac_hdr->sa, ETH_ALEN);

body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);

auth_alg = *(uint16_t *) body_ptr;
pe_debug("auth_alg %d ", auth_alg);

if (frame_len < 2) {
pe_err("invalid frame len: %d", frame_len);
return;
Expand Down Expand Up @@ -1370,6 +1426,11 @@ lim_process_auth_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info,
pe_err("failed to convert Auth Frame to structure or Auth is not valid");
goto free;
}
} else if ((auth_alg ==
eSIR_AUTH_TYPE_SAE) && (LIM_IS_STA_ROLE(pe_session))) {
lim_process_sae_auth_frame(mac_ctx,
rx_pkt_info, pe_session);
goto free;
} else if ((sir_convert_auth_frame2_struct(mac_ctx, body_ptr,
frame_len, rx_auth_frame) != eSIR_SUCCESS)
|| (!is_auth_valid(mac_ctx, rx_auth_frame,
Expand Down
Expand Up @@ -510,18 +510,20 @@ void lim_perform_deauth(tpAniSirGlobal mac_ctx, tpPESession pe_session,
}

if ((sta_ds->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
(sta_ds->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE)) {
(sta_ds->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE) ||
sta_ds->sta_deletion_in_progress) {
/**
* Already in the process of deleting context for the peer
* and received Deauthentication frame. Log and Ignore.
*/
pe_err("received Deauth frame from peer that is in state %X, addr "
MAC_ADDRESS_STR, sta_ds->mlmStaContext.mlmState,
MAC_ADDR_ARRAY(addr));
pe_debug("Deletion is in progress (%d) for peer:%pM in mlmState %d",
sta_ds->sta_deletion_in_progress, addr,
sta_ds->mlmStaContext.mlmState);
return;
}
sta_ds->mlmStaContext.disassocReason = (tSirMacReasonCodes) rc;
sta_ds->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DEAUTH;
sta_ds->sta_deletion_in_progress = true;

/* / Issue Deauth Indication to SME. */
qdf_mem_copy((uint8_t *) &mlmDeauthInd.peerMacAddr,
Expand Down
Expand Up @@ -290,16 +290,18 @@ lim_process_disassoc_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo,
}

if ((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
(pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE)) {
(pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE) ||
pStaDs->sta_deletion_in_progress) {
/**
* Already in the process of deleting context for the peer
* and received Disassociation frame. Log and Ignore.
*/
pe_err("received Disassoc frame in state: %d from"
MAC_ADDRESS_STR, pStaDs->mlmStaContext.mlmState,
MAC_ADDR_ARRAY(pHdr->sa));
pe_debug("Deletion is in progress (%d) for peer:%pM in mlmState %d",
pStaDs->sta_deletion_in_progress, pHdr->sa,
pStaDs->mlmStaContext.mlmState);
return;
}
pStaDs->sta_deletion_in_progress = true;
lim_disassoc_tdls_peers(pMac, psessionEntry, pHdr->sa);
if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) {
/**
Expand Down
Expand Up @@ -64,11 +64,78 @@
#include "qdf_mem.h"
#include "cds_concurrency.h"
#include "nan_datapath.h"
#include "lim_security_utils.h"
#include "cds_ieee80211_common.h"

void lim_log_session_states(tpAniSirGlobal pMac);
static void lim_process_normal_hdd_msg(tpAniSirGlobal mac_ctx,
struct sSirMsgQ *msg, uint8_t rsp_reqd);

#ifdef WLAN_FEATURE_SAE
/**
* lim_process_sae_msg() - Process SAE message
* @mac: Global MAC pointer
* @body: Buffer pointer
*
* Return: None
*/
static void lim_process_sae_msg(tpAniSirGlobal mac, struct sir_sae_msg *body)
{
struct sir_sae_msg *sae_msg = body;
tpPESession session;

if (!sae_msg) {
pe_err("SAE msg is NULL");
return;
}

session = pe_find_session_by_sme_session_id(mac,
sae_msg->session_id);
if (session == NULL) {
pe_err("SAE:Unable to find session");
return;
}

if (session->pePersona != QDF_STA_MODE) {
pe_err("SAE:Not supported in this mode %d",
session->pePersona);
return;
}

pe_debug("SAE:status %d limMlmState %d pePersona %d",
sae_msg->sae_status, session->limMlmState,
session->pePersona);
switch (session->limMlmState) {
case eLIM_MLM_WT_SAE_AUTH_STATE:
/* SAE authentication is completed. Restore from auth state */
if (tx_timer_running(&mac->lim.limTimers.sae_auth_timer))
lim_deactivate_and_change_timer(mac,
eLIM_AUTH_SAE_TIMER);
/* success */
if (sae_msg->sae_status == IEEE80211_STATUS_SUCCESS)
lim_restore_from_auth_state(mac,
eSIR_SME_SUCCESS,
eSIR_MAC_SUCCESS_STATUS,
session);
else
lim_restore_from_auth_state(mac,
eSIR_SME_AUTH_REFUSED,
eSIR_MAC_UNSPEC_FAILURE_STATUS,
session);
break;
default:
/* SAE msg is received in unexpected state */
pe_err("received SAE msg in state %X",
session->limMlmState);
lim_print_mlm_state(mac, LOGE, session->limMlmState);
break;
}
}
#else
static inline void lim_process_sae_msg(tpAniSirGlobal mac, void *body)
{}
#endif

/**
* lim_process_dual_mac_cfg_resp() - Process set dual mac config response
* @mac: Global MAC pointer
Expand Down Expand Up @@ -1661,6 +1728,7 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
case SIR_LIM_DEAUTH_ACK_TIMEOUT:
case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
case SIR_LIM_AUTH_RETRY_TIMEOUT:
case SIR_LIM_AUTH_SAE_TIMEOUT:
/* These timeout messages are handled by MLM sub module */
lim_process_mlm_req_messages(mac_ctx, msg);
break;
Expand Down Expand Up @@ -1972,6 +2040,16 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
qdf_mem_free((void *)msg->bodyptr);
msg->bodyptr = NULL;
break;
case eWNI_SME_SEND_MGMT_FRAME_TX:
lim_send_mgmt_frame_tx(mac_ctx, msg->bodyptr);
qdf_mem_free(msg->bodyptr);
msg->bodyptr = NULL;
break;
case eWNI_SME_SEND_SAE_MSG:
lim_process_sae_msg(mac_ctx, msg->bodyptr);
qdf_mem_free((void *)msg->bodyptr);
msg->bodyptr = NULL;
break;
case WMA_SEND_BCN_RSP:
lim_send_bcn_rsp(mac_ctx, (tpSendbeaconParams)msg->bodyptr);
qdf_mem_free((void *)msg->bodyptr);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -62,6 +62,48 @@ static void lim_process_auth_rsp_timeout(tpAniSirGlobal, uint32_t);
static void lim_process_periodic_join_probe_req_timer(tpAniSirGlobal);
static void lim_process_auth_retry_timer(tpAniSirGlobal);

/**
* lim_process_sae_auth_timeout() - This function is called to process sae
* auth timeout
* @mac_ctx: Pointer to Global MAC structure
*
* @Return: None
*/
static void lim_process_sae_auth_timeout(tpAniSirGlobal mac_ctx)
{
tpPESession session;

session = pe_find_session_by_session_id(mac_ctx,
mac_ctx->lim.limTimers.sae_auth_timer.sessionId);
if (session == NULL) {
pe_err("Session does not exist for given session id");
return;
}

pe_warn("SAE auth timeout sessionid %d mlmstate %X SmeState %X",
session->peSessionId, session->limMlmState,
session->limSmeState);

switch (session->limMlmState) {
case eLIM_MLM_WT_SAE_AUTH_STATE:
/*
* SAE authentication is not completed. Restore from
* auth state.
*/
if (session->pePersona == QDF_STA_MODE)
lim_restore_from_auth_state(mac_ctx,
eSIR_SME_AUTH_TIMEOUT_RESULT_CODE,
eSIR_MAC_UNSPEC_FAILURE_REASON, session);
break;
default:
/* SAE authentication is timed out in unexpected state */
pe_err("received unexpected SAE auth timeout in state %X",
session->limMlmState);
lim_print_mlm_state(mac_ctx, LOGE, session->limMlmState);
break;
}
}

/**
* lim_process_mlm_req_messages() - process mlm request messages
* @mac_ctx: global MAC context
Expand Down Expand Up @@ -146,6 +188,9 @@ void lim_process_mlm_req_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
case SIR_LIM_AUTH_RETRY_TIMEOUT:
lim_process_auth_retry_timer(mac_ctx);
break;
case SIR_LIM_AUTH_SAE_TIMEOUT:
lim_process_sae_auth_timeout(mac_ctx);
break;
case LIM_MLM_TSPEC_REQ:
default:
break;
Expand Down Expand Up @@ -520,7 +565,7 @@ lim_mlm_add_bss(tpAniSirGlobal mac_ctx,
addbss_param->rateSet.numRates = SIR_MAC_RATESET_EID_MAX;
}
qdf_mem_copy(addbss_param->rateSet.rate, mlm_start_req->rateSet.rate,
addbss_param->rateSet.numRates);
mlm_start_req->rateSet.numRates);

addbss_param->nwType = mlm_start_req->nwType;
addbss_param->htCapable = mlm_start_req->htCapable;
Expand Down Expand Up @@ -1013,6 +1058,85 @@ static bool lim_is_preauth_ctx_exists(tpAniSirGlobal mac_ctx,
return fl;
}

#ifdef WLAN_FEATURE_SAE
/**
* lim_process_mlm_auth_req_sae() - Handle SAE authentication
* @mac_ctx: global MAC context
* @session: PE session entry
*
* This function is called by lim_process_mlm_auth_req to handle SAE
* authentication.
*
* Return: QDF_STATUS
*/
static QDF_STATUS lim_process_mlm_auth_req_sae(tpAniSirGlobal mac_ctx,
tpPESession session)
{
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
struct sir_sae_info *sae_info;
cds_msg_t msg;

sae_info = qdf_mem_malloc(sizeof(*sae_info));
if (sae_info == NULL) {
pe_err("Memory allocation failed");
return QDF_STATUS_E_FAILURE;
}

sae_info->msg_type = eWNI_SME_TRIGGER_SAE;
sae_info->msg_len = sizeof(*sae_info);
sae_info->vdev_id = session->smeSessionId;

qdf_mem_copy(sae_info->peer_mac_addr.bytes,
session->bssId,
QDF_MAC_ADDR_SIZE);

sae_info->ssid.length = session->ssId.length;
qdf_mem_copy(sae_info->ssid.ssId,
session->ssId.ssId,
session->ssId.length);

pe_debug("vdev_id %d ssid %.*s "MAC_ADDRESS_STR"",
sae_info->vdev_id,
sae_info->ssid.length,
sae_info->ssid.ssId,
MAC_ADDR_ARRAY(sae_info->peer_mac_addr.bytes));

msg.type = eWNI_SME_TRIGGER_SAE;
msg.bodyptr = sae_info;
msg.bodyval = 0;

qdf_status = mac_ctx->lim.sme_msg_callback(mac_ctx, &msg);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
pe_err("SAE failed for AUTH frame");
qdf_mem_free(sae_info);
return qdf_status;
}
session->limMlmState = eLIM_MLM_WT_SAE_AUTH_STATE;

MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, session->peSessionId,
session->limMlmState));

mac_ctx->lim.limTimers.sae_auth_timer.sessionId =
session->peSessionId;

/* Activate SAE auth timer */
MTRACE(mac_trace(mac_ctx, TRACE_CODE_TIMER_ACTIVATE,
session->peSessionId, eLIM_AUTH_SAE_TIMER));
if (tx_timer_activate(&mac_ctx->lim.limTimers.sae_auth_timer)
!= TX_SUCCESS) {
pe_err("could not start Auth SAE timer");
}

return qdf_status;
}
#else
static QDF_STATUS lim_process_mlm_auth_req_sae(tpAniSirGlobal mac_ctx,
tpPESession session)
{
return QDF_STATUS_E_NOSUPPORT;
}
#endif

/**
* lim_process_mlm_auth_req() - process lim auth request
*
Expand Down Expand Up @@ -1100,13 +1224,33 @@ static void lim_process_mlm_auth_req(tpAniSirGlobal mac_ctx, uint32_t *msg)
mac_ctx->lim.gpLimMlmAuthReq->peerMacAddr);

session->limPrevMlmState = session->limMlmState;
session->limMlmState = eLIM_MLM_WT_AUTH_FRAME2_STATE;

if ((mac_ctx->lim.gpLimMlmAuthReq->authType == eSIR_AUTH_TYPE_SAE) &&
!session->sae_pmk_cached) {
if (lim_process_mlm_auth_req_sae(mac_ctx, session) !=
QDF_STATUS_SUCCESS) {
mlm_auth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
goto end;
} else {
pe_debug("lim_process_mlm_auth_req_sae is successful");
return;
}
} else
session->limMlmState = eLIM_MLM_WT_AUTH_FRAME2_STATE;

MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, session->peSessionId,
session->limMlmState));

/* Prepare & send Authentication frame */
auth_frame_body.authAlgoNumber =
/* Mark auth algo as open when auth type is SAE and PMK is cached */
if ((mac_ctx->lim.gpLimMlmAuthReq->authType == eSIR_AUTH_TYPE_SAE) &&
session->sae_pmk_cached) {
auth_frame_body.authAlgoNumber = eSIR_OPEN_SYSTEM;
} else {
auth_frame_body.authAlgoNumber =
(uint8_t) mac_ctx->lim.gpLimMlmAuthReq->authType;
}

/* Prepare & send Authentication frame */
auth_frame_body.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
auth_frame_body.authStatusCode = 0;
#ifdef FEATURE_WLAN_DIAG_SUPPORT
Expand Down Expand Up @@ -1938,6 +2082,8 @@ lim_process_mlm_set_keys_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)

mlm_set_keys_req = (tLimMlmSetKeysReq *) msg_buf;
if (mac_ctx->lim.gpLimMlmSetKeysReq != NULL) {
qdf_mem_zero(mac_ctx->lim.gpLimMlmSetKeysReq,
sizeof(tLimMlmSetKeysReq));
qdf_mem_free(mac_ctx->lim.gpLimMlmSetKeysReq);
mac_ctx->lim.gpLimMlmSetKeysReq = NULL;
}
Expand All @@ -1947,6 +2093,7 @@ lim_process_mlm_set_keys_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
mlm_set_keys_req->sessionId);
if (NULL == session) {
pe_err("session does not exist for given sessionId");
qdf_mem_zero(mlm_set_keys_req, sizeof(tLimMlmSetKeysReq));
qdf_mem_free(mlm_set_keys_req);
mac_ctx->lim.gpLimMlmSetKeysReq = NULL;
return;
Expand Down Expand Up @@ -2013,6 +2160,8 @@ lim_process_mlm_set_keys_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
case eSIR_ED_GCMP_256:
#ifdef WLAN_FEATURE_11W
case eSIR_ED_AES_128_CMAC:
case eSIR_ED_AES_GMAC_128:
case eSIR_ED_AES_GMAC_256:
#endif
sta_idx = session->staId;
break;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -2722,6 +2722,7 @@ void lim_process_mlm_set_sta_key_rsp(tpAniSirGlobal mac_ctx,
session_entry = pe_find_session_by_session_id(mac_ctx, session_id);
if (session_entry == NULL) {
pe_err("session does not exist for given session_id");
qdf_mem_zero(msg->bodyptr, sizeof(tSetStaKeyParams));
qdf_mem_free(msg->bodyptr);
msg->bodyptr = NULL;
lim_send_sme_set_context_rsp(mac_ctx,
Expand All @@ -2747,6 +2748,7 @@ void lim_process_mlm_set_sta_key_rsp(tpAniSirGlobal mac_ctx,
else
mlm_set_key_cnf.key_len_nonzero = false;

qdf_mem_zero(msg->bodyptr, sizeof(tSetStaKeyParams));

qdf_mem_free(msg->bodyptr);
msg->bodyptr = NULL;
Expand All @@ -2765,6 +2767,8 @@ void lim_process_mlm_set_sta_key_rsp(tpAniSirGlobal mac_ctx,
* Free the buffer cached for the global
* mac_ctx->lim.gpLimMlmSetKeysReq
*/
qdf_mem_zero(mac_ctx->lim.gpLimMlmSetKeysReq,
sizeof(tLimMlmSetKeysReq));
qdf_mem_free(mac_ctx->lim.gpLimMlmSetKeysReq);
mac_ctx->lim.gpLimMlmSetKeysReq = NULL;
}
Expand Down Expand Up @@ -2808,6 +2812,7 @@ void lim_process_mlm_set_bss_key_rsp(tpAniSirGlobal mac_ctx,
if (session_entry == NULL) {
pe_err("session does not exist for given sessionId [%d]",
session_id);
qdf_mem_zero(msg->bodyptr, sizeof(tSetBssKeyParams));
qdf_mem_free(msg->bodyptr);
msg->bodyptr = NULL;
lim_send_sme_set_context_rsp(mac_ctx, set_key_cnf.peer_macaddr,
Expand Down Expand Up @@ -2844,6 +2849,7 @@ void lim_process_mlm_set_bss_key_rsp(tpAniSirGlobal mac_ctx,
set_key_cnf.resultCode = result_status;
}

qdf_mem_zero(msg->bodyptr, sizeof(tSetBssKeyParams));
qdf_mem_free(msg->bodyptr);
msg->bodyptr = NULL;
/* Restore MLME state */
Expand All @@ -2864,6 +2870,8 @@ void lim_process_mlm_set_bss_key_rsp(tpAniSirGlobal mac_ctx,
* Free the buffer cached for the
* global mac_ctx->lim.gpLimMlmSetKeysReq
*/
qdf_mem_zero(mac_ctx->lim.gpLimMlmSetKeysReq,
sizeof(tLimMlmSetKeysReq));
qdf_mem_free(mac_ctx->lim.gpLimMlmSetKeysReq);
mac_ctx->lim.gpLimMlmSetKeysReq = NULL;
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -1224,12 +1224,8 @@ static QDF_STATUS lim_send_hal_start_scan_offload_req(tpAniSirGlobal pMac,
pe_debug("No IEs in the scan request from supplicant");
}

/**
* The tSirScanOffloadReq will reserve the space for first channel,
* so allocate the memory for (numChannels - 1) and uIEFieldLen
*/
len = sizeof(tSirScanOffloadReq) +
(pScanReq->channelList.numChannels - 1) +
pScanReq->channelList.numChannels +
pScanReq->uIEFieldLen + pScanReq->oui_field_len;

pScanOffloadReq = qdf_mem_malloc(len);
Expand Down Expand Up @@ -1337,7 +1333,7 @@ static QDF_STATUS lim_send_hal_start_scan_offload_req(tpAniSirGlobal pMac,
pScanReq->probe_req_ie_bitmap,
PROBE_REQ_BITMAP_LEN * sizeof(uint32_t));
pScanOffloadReq->oui_field_offset = sizeof(tSirScanOffloadReq) +
(pScanOffloadReq->channelList.numChannels - 1) +
pScanOffloadReq->channelList.numChannels +
pScanOffloadReq->uIEFieldLen;
if (pScanOffloadReq->num_vendor_oui != 0) {
qdf_mem_copy(
Expand Down Expand Up @@ -1490,6 +1486,30 @@ static void __lim_process_clear_dfs_channel_list(tpAniSirGlobal pMac, tpSirMsgQ
qdf_mem_set(&pMac->lim.dfschannelList, sizeof(tSirDFSChannelList), 0);
}

#ifdef WLAN_FEATURE_SAE
/**
* lim_update_sae_config()- This API update SAE session info to csr config
* from join request.
* @session: PE session
* @sme_join_req: pointer to join request
*
* Return: None
*/
static void lim_update_sae_config(tpPESession session,
tpSirSmeJoinReq sme_join_req)
{
session->sae_pmk_cached = sme_join_req->sae_pmk_cached;

pe_debug("pmk_cached %d for BSSID=" MAC_ADDRESS_STR,
session->sae_pmk_cached,
MAC_ADDR_ARRAY(sme_join_req->bssDescription.bssId));
}
#else
static inline void lim_update_sae_config(tpPESession session,
tpSirSmeJoinReq sme_join_req)
{}
#endif

/**
* __lim_process_sme_join_req() - process SME_JOIN_REQ message
* @mac_ctx: Pointer to Global MAC structure
Expand Down Expand Up @@ -1772,7 +1792,13 @@ __lim_process_sme_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)

/* Record if management frames need to be protected */
#ifdef WLAN_FEATURE_11W
if (eSIR_ED_AES_128_CMAC == sme_join_req->MgmtEncryptionType)
if ((eSIR_ED_AES_128_CMAC ==
sme_join_req->MgmtEncryptionType)
#ifdef WLAN_FEATURE_GMAC
|| (eSIR_ED_AES_GMAC_128 == sme_join_req->MgmtEncryptionType)
|| (eSIR_ED_AES_GMAC_256 == sme_join_req->MgmtEncryptionType)
#endif
)
session->limRmfEnabled = 1;
else
session->limRmfEnabled = 0;
Expand Down Expand Up @@ -1805,6 +1831,7 @@ __lim_process_sme_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
sme_join_req->txLdpcIniFeatureEnabled;

lim_update_fils_config(session, sme_join_req);
lim_update_sae_config(session, sme_join_req);
if (session->bssType == eSIR_INFRASTRUCTURE_MODE) {
session->limSystemRole = eLIM_STA_ROLE;
} else {
Expand Down Expand Up @@ -2931,6 +2958,9 @@ __lim_process_sme_set_context_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
}
qdf_mem_copy(set_context_req, msg_buf,
sizeof(struct sSirSmeSetContextReq));

qdf_mem_zero(msg_buf, sizeof(tSirSmeSetContextReq));

sme_session_id = set_context_req->sessionId;
sme_transaction_id = set_context_req->transactionId;

Expand Down Expand Up @@ -3038,6 +3068,7 @@ __lim_process_sme_set_context_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
sme_transaction_id);
}
end:
qdf_mem_zero(set_context_req, sizeof(tSirSmeSetContextReq));
qdf_mem_free(set_context_req);
return;
}
Expand Down Expand Up @@ -4109,6 +4140,7 @@ static void __lim_process_roam_scan_offload_req(tpAniSirGlobal mac_ctx,
local_ie_buf = qdf_mem_malloc(MAX_DEFAULT_SCAN_IE_LEN);
if (!local_ie_buf) {
pe_err("Mem Alloc failed for local_ie_buf");
qdf_mem_zero(req_buffer, sizeof(tSirRoamOffloadScanReq));
qdf_mem_free(req_buffer);
return;
}
Expand Down Expand Up @@ -4136,6 +4168,7 @@ static void __lim_process_roam_scan_offload_req(tpAniSirGlobal mac_ctx,
status = wma_post_ctrl_msg(mac_ctx, &wma_msg);
if (eSIR_SUCCESS != status) {
pe_err("Posting WMA_ROAM_SCAN_OFFLOAD_REQ failed");
qdf_mem_zero(req_buffer, sizeof(tSirRoamOffloadScanReq));
qdf_mem_free(req_buffer);
}
}
Expand Down Expand Up @@ -5976,6 +6009,8 @@ void lim_send_chan_switch_action_frame(tpAniSirGlobal mac_ctx,

}

#define MAX_WAKELOCK_FOR_CSA 5000

/**
* lim_process_sme_dfs_csa_ie_request() - process sme dfs csa ie req
*
Expand Down Expand Up @@ -6100,7 +6135,9 @@ static void lim_process_sme_dfs_csa_ie_request(tpAniSirGlobal mac_ctx,
pe_err("Unable to set CSA IE in beacon");
return;
}

qdf_wake_lock_timeout_acquire(&session_entry->ap_ecsa_wakelock,
MAX_WAKELOCK_FOR_CSA);
qdf_runtime_pm_prevent_suspend(&session_entry->ap_ecsa_runtime_lock);
/*
* First beacon update request is sent here, the remaining updates are
* done when the FW responds back after sending the first beacon after
Expand Down
Expand Up @@ -472,11 +472,17 @@ lim_restore_from_auth_state(tpAniSirGlobal pMac, tSirResultCodes resultCode,
* retry is needed also cancel the auth rety timer
*/
pMac->auth_ack_status = LIM_AUTH_ACK_RCD_SUCCESS;
/* 'Change' timer for future activations */
lim_deactivate_and_change_timer(pMac, eLIM_AUTH_RETRY_TIMER);

/* Auth retry and AUth failure timers are not started for SAE */
/* 'Change' timer for future activations */
if (tx_timer_running(&pMac->lim.limTimers.
g_lim_periodic_auth_retry_timer))
lim_deactivate_and_change_timer(pMac,
eLIM_AUTH_RETRY_TIMER);
/* 'Change' timer for future activations */
lim_deactivate_and_change_timer(pMac, eLIM_AUTH_FAIL_TIMER);
if (tx_timer_running(&pMac->lim.limTimers.gLimAuthFailureTimer))
lim_deactivate_and_change_timer(pMac,
eLIM_AUTH_FAIL_TIMER);

sir_copy_mac_addr(currentBssId, sessionEntry->bssId);

Expand Down Expand Up @@ -752,6 +758,7 @@ void lim_post_sme_set_keys_cnf(tpAniSirGlobal pMac,
&pMlmSetKeysReq->peer_macaddr);

/* Free up buffer allocated for mlmSetKeysReq */
qdf_mem_zero(pMlmSetKeysReq, sizeof(tLimMlmSetKeysReq));
qdf_mem_free(pMlmSetKeysReq);
pMac->lim.gpLimMlmSetKeysReq = NULL;

Expand Down Expand Up @@ -856,6 +863,8 @@ void lim_send_set_bss_key_req(tpAniSirGlobal pMac,

/* Respond to SME with LIM_MLM_SETKEYS_CNF */
mlmSetKeysCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
qdf_mem_zero(pSetBssKeyParams, sizeof(tSetBssKeyParams));
qdf_mem_free(pSetBssKeyParams);
} else
return; /* Continue after WMA_SET_BSSKEY_RSP... */

Expand Down Expand Up @@ -1028,6 +1037,7 @@ void lim_send_set_sta_key_req(tpAniSirGlobal pMac,
return; /* Continue after WMA_SET_STAKEY_RSP... */

free_sta_key:
qdf_mem_zero(pSetStaKeyParams, sizeof(tSetStaKeyParams));
qdf_mem_free(pSetStaKeyParams);
fail:
/* Respond to SME with LIM_MLM_SETKEYS_CNF */
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2018, 2020 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -1639,6 +1639,8 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx,
uint32_t bcn_ie_len = 0;
uint32_t aes_block_size_len = 0;
enum rateid min_rid = RATEID_DEFAULT;
uint8_t *mbo_ie = NULL;
uint8_t mbo_ie_len = 0;

if (NULL == pe_session) {
pe_err("pe_session is NULL");
Expand Down Expand Up @@ -1923,6 +1925,37 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx,
aes_block_size_len = AES_BLOCK_SIZE;
}

/*
* MBO IE needs to be appendded at the end of the assoc request
* frame and is not parsed and unpacked by the frame parser
* as the supplicant can send multiple TLVs with same Attribute
* in the MBO IE and the frame parser does not support multiple
* TLVs with same attribute in a single IE.
* Strip off the MBO IE from add_ie and append it at the end.
*/
if (cfg_get_vendor_ie_ptr_from_oui(mac_ctx, SIR_MAC_MBO_OUI,
SIR_MAC_MBO_OUI_SIZE, add_ie, add_ie_len)) {
mbo_ie = qdf_mem_malloc(DOT11F_IE_MBO_IE_MAX_LEN + 2);
if (!mbo_ie) {
pe_err("Failed to allocate mbo_ie");
goto end;
}

sir_status = lim_strip_ie(mac_ctx, add_ie, &add_ie_len,
SIR_MAC_EID_VENDOR, ONE_BYTE,
SIR_MAC_MBO_OUI,
SIR_MAC_MBO_OUI_SIZE,
mbo_ie, DOT11F_IE_MBO_IE_MAX_LEN);
if (sir_status != eSIR_SUCCESS) {
pe_err("Failed to strip MBO IE");
goto end;
}

/* Include the EID and length fields */
mbo_ie_len = mbo_ie[1] + 2;
pe_debug("Stripped MBO IE of length %d", mbo_ie_len);
}

/*
* Do unpack to populate the add_ie buffer to frm structure
* before packing the frm structure. In this way, the IE ordering
Expand All @@ -1949,7 +1982,7 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx,
}

bytes = payload + sizeof(tSirMacMgmtHdr) +
aes_block_size_len;
aes_block_size_len + mbo_ie_len;

qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame,
(void **)&packet);
Expand Down Expand Up @@ -1989,6 +2022,11 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx,
pe_warn("Assoc request pack warning (0x%08x)", status);
}

/* Copy the MBO IE to the end of the frame */
qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload,
mbo_ie, mbo_ie_len);
payload = payload + mbo_ie_len;

if (pe_session->assocReq != NULL) {
qdf_mem_free(pe_session->assocReq);
pe_session->assocReq = NULL;
Expand Down Expand Up @@ -2060,8 +2098,8 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx,
/* Pkt will be freed up by the callback */
goto end;
}

end:
qdf_mem_free(mbo_ie);
/* Free up buffer allocated for mlm_assoc_req */
qdf_mem_free(mlm_assoc_req);
mlm_assoc_req = NULL;
Expand Down Expand Up @@ -4600,3 +4638,85 @@ tSirRetStatus lim_send_sa_query_response_frame(tpAniSirGlobal pMac,
return nSirStatus;
} /* End lim_send_sa_query_response_frame */
#endif

/**
* lim_tx_mgmt_frame() - Transmits Auth mgmt frame
* @mac_ctx Pointer to Global MAC structure
* @mb_msg: Received message info
* @msg_len: Received message length
* @packet: Packet to be transmitted
* @frame: Received frame
*
* Return: None
*/
static void lim_tx_mgmt_frame(tpAniSirGlobal mac_ctx,
struct sir_mgmt_msg *mb_msg, uint32_t msg_len,
void *packet, uint8_t *frame)
{
tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data;
QDF_STATUS qdf_status;
uint8_t sme_session_id = 0;
tpPESession session;
uint16_t auth_ack_status;
enum rateid min_rid = RATEID_DEFAULT;

sme_session_id = mb_msg->session_id;
session = pe_find_session_by_sme_session_id(mac_ctx, sme_session_id);
if (session == NULL) {
pe_err("session not found for given sme session");
return;
}

MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT,
session->peSessionId, fc->subType));

mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD;
min_rid = lim_get_min_session_txrate(session);

qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet,
(uint16_t)msg_len,
TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
7, lim_tx_complete, frame,
lim_auth_tx_complete_cnf,
0, sme_session_id, false, 0, min_rid);
MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE,
session->peSessionId, qdf_status));
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
pe_err("*** Could not send Auth frame, retCode=%X ***",
qdf_status);
mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE;
auth_ack_status = SENT_FAIL;
lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT,
session, auth_ack_status, eSIR_FAILURE);
/* Pkt will be freed up by the callback */
}
}

void lim_send_mgmt_frame_tx(tpAniSirGlobal mac_ctx,
uint32_t *msg_buf)
{
struct sir_mgmt_msg *mb_msg = (struct sir_mgmt_msg *)msg_buf;
uint32_t msg_len;
tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data;
uint8_t sme_session_id;
QDF_STATUS qdf_status;
uint8_t *frame;
void *packet;

msg_len = mb_msg->msg_len - sizeof(*mb_msg);
pe_debug("sending fc->type: %d fc->subType: %d",
fc->type, fc->subType);

sme_session_id = mb_msg->session_id;

qdf_status = cds_packet_alloc((uint16_t) msg_len, (void **)&frame,
(void **)&packet);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
pe_err("call to bufAlloc failed for AUTH frame");
return;
}

qdf_mem_copy(frame, mb_msg->data, msg_len);

lim_tx_mgmt_frame(mac_ctx, mb_msg, msg_len, packet, frame);
}
Expand Up @@ -2615,6 +2615,9 @@ lim_send_sme_ap_channel_switch_resp(tpAniSirGlobal pMac,
enum phy_ch_width ch_width;
uint8_t ch_center_freq_seg1;

qdf_runtime_pm_allow_suspend(&psessionEntry->ap_ecsa_runtime_lock);
qdf_wake_lock_release(&psessionEntry->ap_ecsa_wakelock, 0);

pSmeSwithChnlParams = (tSwitchChannelParams *)
qdf_mem_malloc(sizeof(tSwitchChannelParams));
if (NULL == pSmeSwithChnlParams) {
Expand Down
10 changes: 9 additions & 1 deletion drivers/staging/qcacld-3.0/core/mac/src/pe/lim/lim_session.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -529,6 +529,9 @@ pe_create_session(tpAniSirGlobal pMac, uint8_t *bssid, uint8_t *sessionId,
&session_ptr->protection_fields_reset_timer,
QDF_TIMER_TYPE_SW, pe_reset_protection_callback,
(void *)&pMac->lim.gpSession[i]);
qdf_wake_lock_create(&session_ptr->ap_ecsa_wakelock,
"ap_ecsa_wakelock");
qdf_runtime_lock_init(&session_ptr->ap_ecsa_runtime_lock);
if (status == QDF_STATUS_SUCCESS) {
status = qdf_mc_timer_start(
&session_ptr->protection_fields_reset_timer,
Expand Down Expand Up @@ -707,6 +710,8 @@ void pe_delete_session(tpAniSirGlobal mac_ctx, tpPESession session)
qdf_mc_timer_stop(&session->protection_fields_reset_timer);
qdf_mc_timer_destroy(&session->protection_fields_reset_timer);
lim_del_pmf_sa_query_timer(mac_ctx, session);
qdf_runtime_lock_deinit(&session->ap_ecsa_runtime_lock);
qdf_wake_lock_destroy(&session->ap_ecsa_wakelock);
}

/* Delete FT related information */
Expand Down Expand Up @@ -839,6 +844,9 @@ void pe_delete_session(tpAniSirGlobal mac_ctx, tpPESession session)
pe_delete_fils_info(session);
session->valid = false;

qdf_mem_zero(session->WEPKeyMaterial,
sizeof(session->WEPKeyMaterial));

if (session->access_policy_vendor_ie)
qdf_mem_free(session->access_policy_vendor_ie);

Expand Down
37 changes: 36 additions & 1 deletion drivers/staging/qcacld-3.0/core/mac/src/pe/lim/lim_timer_utils.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -54,6 +54,11 @@
/* Lim Periodic Auth Retry timer default 60 ms */
#define LIM_AUTH_RETRY_TIMER_MS 60

/*
* SAE auth timer of 5secs. This is required for duration of entire SAE
* authentication.
*/
#define LIM_AUTH_SAE_TIMER_MS 5000

/* This timer is a periodic timer which expires at every 1 sec to
convert ACTIVE DFS channel to DFS channels */
Expand Down Expand Up @@ -193,6 +198,20 @@ static bool lim_create_non_ap_timers(tpAniSirGlobal pMac)
return false;
}

/*
* SAE auth timer of 5secs. This is required for duration of entire SAE
* authentication.
*/
if ((tx_timer_create(pMac,
&pMac->lim.limTimers.sae_auth_timer,
"SAE AUTH Timer",
lim_timer_handler, SIR_LIM_AUTH_SAE_TIMEOUT,
SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS), 0,
TX_NO_ACTIVATE)) != TX_SUCCESS) {
pe_err("could not create SAE AUTH Timer");
return false;
}

return true;
}
/**
Expand Down Expand Up @@ -389,6 +408,7 @@ uint32_t lim_create_timers(tpAniSirGlobal pMac)
tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
tx_timer_delete(&pMac->lim.limTimers.sae_auth_timer);

if (NULL != pMac->lim.gLimPreAuthTimerTable.pTable) {
for (i = 0; i < pMac->lim.gLimPreAuthTimerTable.numEntry; i++)
Expand Down Expand Up @@ -959,6 +979,21 @@ void lim_deactivate_and_change_timer(tpAniSirGlobal pMac, uint32_t timerId)
}
break;

case eLIM_AUTH_SAE_TIMER:
if (tx_timer_deactivate
(&pMac->lim.limTimers.sae_auth_timer)
!= TX_SUCCESS)
pe_err("Unable to deactivate SAE auth timer");

/* Change timer to reactivate it in future */
val = SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS);

if (tx_timer_change(&pMac->lim.limTimers.sae_auth_timer,
val, 0) != TX_SUCCESS)
pe_err("unable to change SAE auth timer");

break;

default:
/* Invalid timerId. Log error */
break;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, 2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2014, 2016, 2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -68,7 +68,8 @@ enum {
eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER,
eLIM_INSERT_SINGLESHOT_NOA_TIMER,
eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE,
eLIM_AUTH_RETRY_TIMER
eLIM_AUTH_RETRY_TIMER,
eLIM_AUTH_SAE_TIMER
};

#define LIM_DISASSOC_DEAUTH_ACK_TIMEOUT 500
Expand Down
10 changes: 10 additions & 0 deletions drivers/staging/qcacld-3.0/core/mac/src/pe/lim/lim_types.h
Expand Up @@ -1012,4 +1012,14 @@ void lim_process_auth_failure_timeout(tpAniSirGlobal mac_ctx);
void lim_process_assoc_failure_timeout(tpAniSirGlobal mac_ctx,
uint32_t msg_type);

/**
* lim_send_mgmt_frame_tx() - Sends mgmt frame
* @mac_ctx Pointer to Global MAC structure
* @msg: Received message info
*
* Return: None
*/
void lim_send_mgmt_frame_tx(tpAniSirGlobal mac_ctx,
uint32_t *msg_buf);

#endif /* __LIM_TYPES_H */
4 changes: 4 additions & 0 deletions drivers/staging/qcacld-3.0/core/mac/src/pe/lim/lim_utils.c
Expand Up @@ -619,6 +619,8 @@ void lim_deactivate_timers(tpAniSirGlobal mac_ctx)

tx_timer_deactivate(&lim_timer->
gLimActiveToPassiveChannelTimer);

tx_timer_deactivate(&lim_timer->sae_auth_timer);
}


Expand Down Expand Up @@ -705,6 +707,8 @@ void lim_cleanup_mlm(tpAniSirGlobal mac_ctx)
tx_timer_delete(&lim_timer->
gLimActiveToPassiveChannelTimer);

tx_timer_delete(&lim_timer->sae_auth_timer);

mac_ctx->lim.gLimTimersCreated = 0;
}
} /*** end lim_cleanup_mlm() ***/
Expand Down
16 changes: 5 additions & 11 deletions drivers/staging/qcacld-3.0/core/mac/src/pe/nan/nan_datapath.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -160,9 +160,8 @@ static QDF_STATUS lim_handle_ndp_indication_event(tpAniSirGlobal mac_ctx,
goto ndp_indication_failed;
}
}
if (NDP_ROLE_RESPONDER == ndp_ind->role)
lim_send_ndp_event_to_sme(mac_ctx, eWNI_SME_NDP_INDICATION,
ndp_ind, sizeof(*ndp_ind), 0);
lim_send_ndp_event_to_sme(mac_ctx, eWNI_SME_NDP_INDICATION,
ndp_ind, sizeof(*ndp_ind), 0);
/*
* With NDP indication if peer does not exists already add_sta is
* executed resulting in new peer else no action is taken. Note that
Expand All @@ -172,13 +171,8 @@ static QDF_STATUS lim_handle_ndp_indication_event(tpAniSirGlobal mac_ctx,
* used by service layer to identify failure.
*/
ndp_indication_failed:
/*
* Free config if failure or for NDP_ROLE_INITIATOR role
* As for success responder case this info is sent till HDD
* and will be freed in sme.
*/
if (status != QDF_STATUS_SUCCESS ||
NDP_ROLE_INITIATOR == ndp_ind->role) {
/* free config and app info if failure */
if (status != QDF_STATUS_SUCCESS) {
qdf_mem_free(ndp_ind->ndp_config.ndp_cfg);
qdf_mem_free(ndp_ind->ndp_info.ndp_app_info);
ndp_ind->ndp_config.ndp_cfg = NULL;
Expand Down
82 changes: 56 additions & 26 deletions drivers/staging/qcacld-3.0/core/mac/src/pe/rrm/rrm_api.c
@@ -1,8 +1,5 @@
/*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
Expand Down Expand Up @@ -234,6 +231,24 @@ tSirRetStatus rrm_set_max_tx_power_rsp(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
return retCode;
}

/**
* rrm_calculate_and_fill_rcpi() - calculates and fills RCPI value
* @rcpi: pointer to hold calculated RCPI value
* @cur_rssi: value of current RSSI
*
* @return None
*/
static void rrm_calculate_and_fill_rcpi(uint8_t *rcpi, int8_t cur_rssi)
{
/* 2008 11k spec reference: 18.4.8.5 RCPI Measurement */
if (cur_rssi <= RCPI_LOW_RSSI_VALUE)
*rcpi = 0;
else if ((cur_rssi > RCPI_LOW_RSSI_VALUE) && (cur_rssi <= 0))
*rcpi = CALCULATE_RCPI(cur_rssi);
else
*rcpi = RCPI_MAX_VALUE;
}

/* -------------------------------------------------------------------- */
/**
* rrm_process_link_measurement_request
Expand Down Expand Up @@ -294,14 +309,7 @@ rrm_process_link_measurement_request(tpAniSirGlobal pMac,

pe_debug("Received Link report frame with %d", currentRSSI);

/* 2008 11k spec reference: 18.4.8.5 RCPI Measurement */
if ((currentRSSI) <= RCPI_LOW_RSSI_VALUE)
LinkReport.rcpi = 0;
else if ((currentRSSI > RCPI_LOW_RSSI_VALUE) && (currentRSSI <= 0))
LinkReport.rcpi = CALCULATE_RCPI(currentRSSI);
else
LinkReport.rcpi = RCPI_MAX_VALUE;

rrm_calculate_and_fill_rcpi(&LinkReport.rcpi, currentRSSI);
LinkReport.rsni = WMA_GET_RX_SNR(pRxPacketInfo);

pe_debug("Sending Link report frame");
Expand Down Expand Up @@ -570,6 +578,11 @@ rrm_process_beacon_report_req(tpAniSirGlobal pMac,
reportingDetail : BEACON_REPORTING_DETAIL_ALL_FF_IE;

if (pBeaconReq->measurement_request.Beacon.RequestedInfo.present) {
if (!pBeaconReq->measurement_request.Beacon.RequestedInfo.
num_requested_eids) {
pe_debug("802.11k BCN RPT: Requested num of EID is 0");
return eRRM_FAILURE;
}
pCurrentReq->request.Beacon.reqIes.pElementIds =
qdf_mem_malloc(sizeof(uint8_t) *
pBeaconReq->measurement_request.Beacon.
Expand All @@ -578,13 +591,19 @@ rrm_process_beacon_report_req(tpAniSirGlobal pMac,
pe_err("Unable to allocate memory for request IEs buffer");
return eRRM_FAILURE;
}

pCurrentReq->request.Beacon.reqIes.num =
pBeaconReq->measurement_request.Beacon.RequestedInfo.
num_requested_eids;
qdf_mem_copy(pCurrentReq->request.Beacon.reqIes.pElementIds,
pBeaconReq->measurement_request.Beacon.
RequestedInfo.requested_eids,
pCurrentReq->request.Beacon.reqIes.num);
pe_debug("802.11k BCN RPT: Requested EIDs: num:[%d]",
pCurrentReq->request.Beacon.reqIes.num);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
pCurrentReq->request.Beacon.reqIes.pElementIds,
pCurrentReq->request.Beacon.reqIes.num);
}

if (pBeaconReq->measurement_request.Beacon.num_APChannelReport) {
Expand Down Expand Up @@ -721,11 +740,18 @@ rrm_fill_beacon_ies(tpAniSirGlobal pMac,
*pNumIes += sizeof(uint16_t);
pIes += sizeof(uint16_t);

while (BcnNumIes > 0) {
len = *(pBcnIes + 1) + 2; /* element id + length. */
while (BcnNumIes >= 2) {
len = *(pBcnIes + 1);
len += 2; /* element id + length. */
pe_debug("EID = %d, len = %d total = %d",
*pBcnIes, *(pBcnIes + 1), len);

if (BcnNumIes < len) {
pe_err("RRM: Invalid IE len:%d exp_len:%d",
len, BcnNumIes);
break;
}

i = 0;
do {
if (((eids == NULL) || (*pBcnIes == eids[i])) &&
Expand Down Expand Up @@ -840,7 +866,9 @@ rrm_process_beacon_report_xmit(tpAniSirGlobal mac_ctx,
beacon_report->phyType = bss_desc->nwType;
beacon_report->bcnProbeRsp = 1;
beacon_report->rsni = bss_desc->sinr;
beacon_report->rcpi = bss_desc->rssi;

rrm_calculate_and_fill_rcpi(&beacon_report->rcpi,
bss_desc->rssi);
beacon_report->antennaId = 0;
beacon_report->parentTSF = bss_desc->parentTSF;
qdf_mem_copy(beacon_report->bssid,
Expand Down Expand Up @@ -1043,28 +1071,30 @@ tSirRetStatus rrm_process_beacon_req(tpAniSirGlobal mac_ctx, tSirMacAddr peer,
*/
static
tSirRetStatus update_rrm_report(tpAniSirGlobal mac_ctx,
tpSirMacRadioMeasureReport report,
tpSirMacRadioMeasureReport *report,
tDot11fRadioMeasurementRequest *rrm_req,
uint8_t *num_report, int index)
{
if (report == NULL) {
tpSirMacRadioMeasureReport rrm_report;

if (!*report) {
/*
* Allocate memory to send reports for
* any subsequent requests.
*/
report = qdf_mem_malloc(sizeof(*report) *
*report = qdf_mem_malloc(sizeof(tSirMacRadioMeasureReport) *
(rrm_req->num_MeasurementRequest - index));
if (NULL == report) {
pe_err("Unable to allocate memory during RRM Req processing");
if (!*report) {
pe_err("Fail to alloc mem during RRM Req processing");
return eSIR_MEM_ALLOC_FAILED;
}
pe_debug("rrm beacon type incapable of %d report",
*num_report);
pe_debug("rrm beacon type incapable of %d report", *num_report);
}
report[*num_report].incapable = 1;
report[*num_report].type =
rrm_report = *report;
rrm_report[*num_report].incapable = 1;
rrm_report[*num_report].type =
rrm_req->MeasurementRequest[index].measurement_type;
report[*num_report].token =
rrm_report[*num_report].token =
rrm_req->MeasurementRequest[index].measurement_token;
(*num_report)++;
return eSIR_SUCCESS;
Expand Down Expand Up @@ -1146,7 +1176,7 @@ rrm_process_radio_measurement_request(tpAniSirGlobal mac_ctx,
break;
default:
/* Send a report with incapabale bit set. */
status = update_rrm_report(mac_ctx, report, rrm_req,
status = update_rrm_report(mac_ctx, &report, rrm_req,
&num_report, i);
if (eSIR_SUCCESS != status)
return status;
Expand Down
24 changes: 11 additions & 13 deletions drivers/staging/qcacld-3.0/core/mac/src/pe/sch/sch_beacon_process.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -555,15 +555,14 @@ sch_bcn_process_sta_ibss(tpAniSirGlobal mac_ctx,
if ((operMode == eHT_CHANNEL_WIDTH_80MHZ) &&
(bcn->OperatingMode.chanWidth > eHT_CHANNEL_WIDTH_80MHZ))
skip_opmode_update = true;

if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE == cb_mode) {
/*
* if channel bonding is disabled from INI and
* receiving beacon which has operating mode IE
* containing channel width change then don't update
* CH_WIDTH
* if channel bonding is disabled from INI don't
* update the CH_WIDTH
*/
pe_err("CB disabled & CH_WIDTH changed old[%d] new[%d]",
operMode, bcn->OperatingMode.chanWidth);
pe_debug_rate_limited(30, "CB disabled skip bw update: old[%d] new[%d]",
operMode, bcn->OperatingMode.chanWidth);
return;
}

Expand Down Expand Up @@ -629,15 +628,14 @@ sch_bcn_process_sta_ibss(tpAniSirGlobal mac_ctx,

if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE == cb_mode) {
/*
* if channel bonding is disabled from INI and
* receiving beacon which has operating mode IE
* containing channel width change then don't update
* the CH_WIDTH
* if channel bonding is disabled from INI don't
* update the CH_WIDTH
*/
pe_err("CB disabled & VHT CH_WIDTH changed old[%d] new[%d]",
operMode, bcn->VHTOperation.chanWidth);
pe_debug_rate_limited(30, "CB disabled, skip ch width update: old[%d] new[%d]",
operMode, bcn->VHTOperation.chanWidth);
return;
}

if (!skip_opmode_update &&
(operMode != bcn->VHTOperation.chanWidth)) {
pe_debug("received VHTOP CHWidth %d staIdx = %d",
Expand Down
Expand Up @@ -33,7 +33,7 @@
*
*
* This file was automatically generated by 'framesc'
* Fri Jun 1 09:46:04 2018 from the following file(s):
* Tue Sep 18 11:47:29 2018 from the following file(s):
*
* dot11f.frms
*
Expand Down Expand Up @@ -8149,6 +8149,29 @@ uint32_t dot11f_unpack_ie_wsc_reassoc_res(tpAniSirGlobal pCtx,
#define SigIeWscReassocRes (0x007c)


uint32_t dot11f_unpack_ie_dh_parameter_element(tpAniSirGlobal pCtx,
uint8_t *pBuf,
uint8_t ielen,
tDot11fIEdh_parameter_element *pDst,
bool append_ie)
{
uint32_t status = DOT11F_PARSE_SUCCESS;
(void) pBuf; (void)ielen; /* Shutup the compiler */
if (pDst->present)
status = DOT11F_DUPLICATE_IE;
pDst->present = 1;
DOT11F_MEMCPY(pCtx, pDst->group, pBuf, 2);
pBuf += 2;
ielen -= (uint8_t)2;
pDst->num_public_key = (uint8_t)(ielen);
DOT11F_MEMCPY(pCtx, pDst->public_key, pBuf, (ielen));
(void)pCtx;
return status;
} /* End dot11f_unpack_ie_dh_parameter_element. */

#define SigIedh_parameter_element (0x007d)


uint32_t dot11f_unpack_ie_ext_chan_switch_ann(tpAniSirGlobal pCtx,
uint8_t *pBuf,
uint8_t ielen,
Expand Down Expand Up @@ -8194,7 +8217,7 @@ uint32_t dot11f_unpack_ie_ext_chan_switch_ann(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_ext_chan_switch_ann. */

#define SigIeext_chan_switch_ann (0x007d)
#define SigIeext_chan_switch_ann (0x007e)


uint32_t dot11f_unpack_ie_fils_assoc_delay_info(tpAniSirGlobal pCtx,
Expand All @@ -8218,7 +8241,7 @@ uint32_t dot11f_unpack_ie_fils_assoc_delay_info(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_fils_assoc_delay_info. */

#define SigIefils_assoc_delay_info (0x007e)
#define SigIefils_assoc_delay_info (0x007f)


uint32_t dot11f_unpack_ie_fils_hlp_container(tpAniSirGlobal pCtx,
Expand Down Expand Up @@ -8254,7 +8277,7 @@ uint32_t dot11f_unpack_ie_fils_hlp_container(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_fils_hlp_container. */

#define SigIefils_hlp_container (0x007f)
#define SigIefils_hlp_container (0x0080)


uint32_t dot11f_unpack_ie_fils_indication(tpAniSirGlobal pCtx,
Expand Down Expand Up @@ -8292,7 +8315,7 @@ uint32_t dot11f_unpack_ie_fils_indication(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_fils_indication. */

#define SigIefils_indication (0x0080)
#define SigIefils_indication (0x0081)


uint32_t dot11f_unpack_ie_fils_kde(tpAniSirGlobal pCtx,
Expand Down Expand Up @@ -8320,7 +8343,7 @@ uint32_t dot11f_unpack_ie_fils_kde(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_fils_kde. */

#define SigIefils_kde (0x0081)
#define SigIefils_kde (0x0082)


uint32_t dot11f_unpack_ie_fils_key_confirmation(tpAniSirGlobal pCtx,
Expand All @@ -8340,7 +8363,7 @@ uint32_t dot11f_unpack_ie_fils_key_confirmation(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_fils_key_confirmation. */

#define SigIefils_key_confirmation (0x0082)
#define SigIefils_key_confirmation (0x0083)


uint32_t dot11f_unpack_ie_fils_nonce(tpAniSirGlobal pCtx,
Expand All @@ -8364,7 +8387,7 @@ uint32_t dot11f_unpack_ie_fils_nonce(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_fils_nonce. */

#define SigIefils_nonce (0x0083)
#define SigIefils_nonce (0x0084)


uint32_t dot11f_unpack_ie_fils_public_key(tpAniSirGlobal pCtx,
Expand Down Expand Up @@ -8392,7 +8415,7 @@ uint32_t dot11f_unpack_ie_fils_public_key(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_fils_public_key. */

#define SigIefils_public_key (0x0084)
#define SigIefils_public_key (0x0085)


uint32_t dot11f_unpack_ie_fils_session(tpAniSirGlobal pCtx,
Expand All @@ -8416,7 +8439,7 @@ uint32_t dot11f_unpack_ie_fils_session(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_fils_session. */

#define SigIefils_session (0x0085)
#define SigIefils_session (0x0086)


uint32_t dot11f_unpack_ie_fils_wrapped_data(tpAniSirGlobal pCtx,
Expand All @@ -8436,7 +8459,7 @@ uint32_t dot11f_unpack_ie_fils_wrapped_data(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_fils_wrapped_data. */

#define SigIefils_wrapped_data (0x0086)
#define SigIefils_wrapped_data (0x0087)


uint32_t dot11f_unpack_ie_fragment_ie(tpAniSirGlobal pCtx,
Expand All @@ -8456,7 +8479,7 @@ uint32_t dot11f_unpack_ie_fragment_ie(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_fragment_ie. */

#define SigIefragment_ie (0x0087)
#define SigIefragment_ie (0x0088)


uint32_t dot11f_unpack_ie_hs20vendor_ie(tpAniSirGlobal pCtx,
Expand Down Expand Up @@ -8513,7 +8536,7 @@ uint32_t dot11f_unpack_ie_hs20vendor_ie(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_hs20vendor_ie. */

#define SigIehs20vendor_ie (0x0088)
#define SigIehs20vendor_ie (0x0089)


uint32_t dot11f_unpack_ie_ht2040_bss_coexistence(tpAniSirGlobal pCtx,
Expand Down Expand Up @@ -8544,7 +8567,7 @@ uint32_t dot11f_unpack_ie_ht2040_bss_coexistence(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_ht2040_bss_coexistence. */

#define SigIeht2040_bss_coexistence (0x0089)
#define SigIeht2040_bss_coexistence (0x008a)


uint32_t dot11f_unpack_ie_ht2040_bss_intolerant_report(tpAniSirGlobal pCtx,
Expand Down Expand Up @@ -8577,7 +8600,7 @@ uint32_t dot11f_unpack_ie_ht2040_bss_intolerant_report(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_ht2040_bss_intolerant_report. */

#define SigIeht2040_bss_intolerant_report (0x008a)
#define SigIeht2040_bss_intolerant_report (0x008b)


uint32_t dot11f_unpack_ie_osen_ie(tpAniSirGlobal pCtx,
Expand All @@ -8597,7 +8620,7 @@ uint32_t dot11f_unpack_ie_osen_ie(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_osen_ie. */

#define SigIeosen_ie (0x008b)
#define SigIeosen_ie (0x008c)


uint32_t dot11f_unpack_ie_sec_chan_offset_ele(tpAniSirGlobal pCtx,
Expand All @@ -8621,7 +8644,7 @@ uint32_t dot11f_unpack_ie_sec_chan_offset_ele(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_sec_chan_offset_ele. */

#define SigIesec_chan_offset_ele (0x008c)
#define SigIesec_chan_offset_ele (0x008d)


static const tFFDefn FFS_vendor_vht_ie[] = {
Expand Down Expand Up @@ -8670,7 +8693,7 @@ uint32_t dot11f_unpack_ie_vendor_vht_ie(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_unpack_ie_vendor_vht_ie. */

#define SigIevendor_vht_ie (0x008d)
#define SigIevendor_vht_ie (0x008e)


static const tFFDefn FFS_AddTSRequest[] = {
Expand Down Expand Up @@ -8818,7 +8841,7 @@ static const tIEDefn IES_AssocRequest[] = {
0, DOT11F_EID_POWERCAPS, 0, 0, },
{ offsetof(tDot11fAssocRequest, SuppChannels),
offsetof(tDot11fIESuppChannels, present), 0, "SuppChannels",
0, 4, 98, SigIeSuppChannels, {0, 0, 0, 0, 0},
0, 2, 98, SigIeSuppChannels, {0, 0, 0, 0, 0},
0, DOT11F_EID_SUPPCHANNELS, 0, 0, },
{ offsetof(tDot11fAssocRequest, HTCaps), offsetof(tDot11fIEHTCaps,
present), 0, "HTCaps", 0, 28, 60, SigIeHTCaps, {0, 0, 0, 0, 0},
Expand Down Expand Up @@ -8882,6 +8905,10 @@ static const tIEDefn IES_AssocRequest[] = {
offsetof(tDot11fIEfragment_ie, present), 0, "fragment_ie",
0, 2, 257, SigIefragment_ie, {0, 0, 0, 0, 0},
0, DOT11F_EID_FRAGMENT_IE, 0, 0, },
{ offsetof(tDot11fAssocRequest, dh_parameter_element),
offsetof(tDot11fIEdh_parameter_element, present), 0,
"dh_parameter_element", 0, 4, 259, SigIedh_parameter_element,
{0, 0, 0, 0, 0}, 0, DOT11F_EID_DH_PARAMETER_ELEMENT, 32, 0, },
{ offsetof(tDot11fAssocRequest, WPAOpaque), offsetof(tDot11fIEWPAOpaque,
present), 0, "WPAOpaque", 0, 8, 255, SigIeWPAOpaque, {0, 80, 242, 1, 0},
4, DOT11F_EID_WPAOPAQUE, 0, 0, },
Expand Down Expand Up @@ -8920,9 +8947,6 @@ static const tIEDefn IES_AssocRequest[] = {
offsetof(tDot11fIEhs20vendor_ie, present), 0, "hs20vendor_ie",
0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 16, 0},
4, DOT11F_EID_HS20VENDOR_IE, 0, 0, },
{ offsetof(tDot11fAssocRequest, MBO_IE), offsetof(tDot11fIEMBO_IE,
present), 0, "MBO_IE", 0, 6, 295, SigIeMBO_IE, {80, 111, 154, 22, 0},
4, DOT11F_EID_MBO_IE, 0, 0, },
{ offsetof(tDot11fAssocRequest, QCN_IE), offsetof(tDot11fIEQCN_IE,
present), 0, "QCN_IE", 0, 10, 10, SigIeQCN_IE, {140, 253, 240, 1, 0},
4, DOT11F_EID_QCN_IE, 0, 0, },
Expand Down Expand Up @@ -10558,7 +10582,7 @@ static const tIEDefn IES_ReAssocRequest[] = {
0, DOT11F_EID_POWERCAPS, 0, 0, },
{ offsetof(tDot11fReAssocRequest, SuppChannels),
offsetof(tDot11fIESuppChannels, present), 0, "SuppChannels",
0, 4, 98, SigIeSuppChannels, {0, 0, 0, 0, 0},
0, 2, 98, SigIeSuppChannels, {0, 0, 0, 0, 0},
0, DOT11F_EID_SUPPCHANNELS, 0, 0, },
{ offsetof(tDot11fReAssocRequest, RSNOpaque),
offsetof(tDot11fIERSNOpaque, present), 0, "RSNOpaque",
Expand Down Expand Up @@ -10950,7 +10974,7 @@ static const tIEDefn IES_TDLSDisRsp[] = {
0, DOT11F_EID_EXTSUPPRATES, 0, 0, },
{ offsetof(tDot11fTDLSDisRsp, SuppChannels),
offsetof(tDot11fIESuppChannels, present), 0, "SuppChannels",
0, 4, 98, SigIeSuppChannels, {0, 0, 0, 0, 0},
0, 2, 98, SigIeSuppChannels, {0, 0, 0, 0, 0},
0, DOT11F_EID_SUPPCHANNELS, 0, 0, },
{ offsetof(tDot11fTDLSDisRsp, SuppOperatingClasses),
offsetof(tDot11fIESuppOperatingClasses, present), 0,
Expand Down Expand Up @@ -11160,7 +11184,7 @@ static const tIEDefn IES_TDLSSetupReq[] = {
0, DOT11F_EID_EXTSUPPRATES, 0, 0, },
{ offsetof(tDot11fTDLSSetupReq, SuppChannels),
offsetof(tDot11fIESuppChannels, present), 0, "SuppChannels",
0, 4, 98, SigIeSuppChannels, {0, 0, 0, 0, 0},
0, 2, 98, SigIeSuppChannels, {0, 0, 0, 0, 0},
0, DOT11F_EID_SUPPCHANNELS, 0, 0, },
{ offsetof(tDot11fTDLSSetupReq, RSN), offsetof(tDot11fIERSN, present), 0,
"RSN", 0, 4, 132, SigIeRSN, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSN, 0, 0, },
Expand Down Expand Up @@ -11249,7 +11273,7 @@ static const tIEDefn IES_TDLSSetupRsp[] = {
0, DOT11F_EID_EXTSUPPRATES, 0, 0, },
{ offsetof(tDot11fTDLSSetupRsp, SuppChannels),
offsetof(tDot11fIESuppChannels, present), 0, "SuppChannels",
0, 4, 98, SigIeSuppChannels, {0, 0, 0, 0, 0},
0, 2, 98, SigIeSuppChannels, {0, 0, 0, 0, 0},
0, DOT11F_EID_SUPPCHANNELS, 0, 0, },
{ offsetof(tDot11fTDLSSetupRsp, RSN), offsetof(tDot11fIERSN, present), 0,
"RSN", 0, 4, 132, SigIeRSN, {0, 0, 0, 0, 0}, 0, DOT11F_EID_RSN, 0, 0, },
Expand Down Expand Up @@ -11993,20 +12017,25 @@ static uint32_t unpack_core(tpAniSirGlobal pCtx,
}

if (pIe) {
if ((nBufRemaining < pIe->minSize - pIe->noui - 2U) ||
(len < pIe->minSize - pIe->noui - 2U)) {
FRAMES_LOG4(pCtx, FRLOGW, FRFL("The IE %s must "
if ((nBufRemaining < pIe->minSize - pIe->noui - 2U)) {
FRAMES_LOG3(pCtx, FRLOGW, FRFL("The IE %s must "
"be at least %d bytes in size, but "
"there are only %d bytes remaining in "
"this frame or the IE reports a size "
"of %d bytes.\n"),
pIe->name, pIe->minSize, nBufRemaining,
(len + pIe->noui + 2U));
"this frame\n"),
pIe->name, pIe->minSize, nBufRemaining);
FRAMES_DUMP(pCtx, FRLOG1, pBuf, nBuf);
status |= DOT11F_INCOMPLETE_IE;
FRAMES_DBG_BREAK();
goto MandatoryCheck;
} else {
if (len < pIe->minSize - pIe->noui - 2U) {
FRAMES_LOG3(pCtx, FRLOGW, FRFL("The IE %s must "
"be at least %d bytes in size, but "
"there are only %d bytes in the IE\n"),
pIe->name, pIe->minSize, (len + pIe->noui + 2U));
goto skip_ie;
}

if (len > pIe->maxSize - pIe->noui - 2U) {
FRAMES_LOG1(pCtx, FRLOGW, FRFL("The IE %s reports "
"an unexpectedly large size; it is presumably "
Expand All @@ -12020,7 +12049,7 @@ static uint32_t unpack_core(tpAniSirGlobal pCtx,
(*(uint16_t *)(pFrm + pIe->countOffset)));
if (0 != pIe->arraybound && countOffset >= pIe->arraybound) {
status |= DOT11F_DUPLICATE_IE;
goto skip_dup_ie;
goto skip_ie;
}
switch (pIe->sig) {
case SigIeGTK:
Expand Down Expand Up @@ -13264,6 +13293,16 @@ static uint32_t unpack_core(tpAniSirGlobal pCtx,
countOffset),
append_ie);
break;
case SigIedh_parameter_element:
status |=
dot11f_unpack_ie_dh_parameter_element(
pCtx, pBufRemaining, len,
(tDot11fIEdh_parameter_element *)
(pFrm + pIe->offset +
sizeof(tDot11fIEdh_parameter_element) *
countOffset),
append_ie);
break;
case SigIeext_chan_switch_ann:
status |=
dot11f_unpack_ie_ext_chan_switch_ann(
Expand Down Expand Up @@ -13452,7 +13491,7 @@ static uint32_t unpack_core(tpAniSirGlobal pCtx,
status |= DOT11F_UNKNOWN_IES;
}

skip_dup_ie:
skip_ie:
pBufRemaining += len;

if (len > nBufRemaining) {
Expand Down Expand Up @@ -16200,6 +16239,15 @@ static uint32_t get_packed_size_core(tpAniSirGlobal pCtx,
(pFrm + pIe->offset + offset * i),
pnNeeded);
break;
case SigIedh_parameter_element:
offset = sizeof(tDot11fIEdh_parameter_element);
byteCount = ((tDot11fIEdh_parameter_element *)
(pFrm + pIe->offset + offset * i))->
num_public_key + 2;
pIePresent = ((tDot11fIEdh_parameter_element *)
(pFrm + pIe->offset + offset * i))->
present;
break;
case SigIeext_chan_switch_ann:
offset = sizeof(tDot11fIEext_chan_switch_ann);
byteCount = 4;
Expand Down Expand Up @@ -24279,6 +24327,40 @@ uint32_t dot11f_pack_ie_wsc_reassoc_res(tpAniSirGlobal pCtx,
return status;
} /* End dot11f_pack_ie_wsc_reassoc_res. */

uint32_t dot11f_pack_ie_dh_parameter_element(tpAniSirGlobal pCtx,
tDot11fIEdh_parameter_element *pSrc,
uint8_t *pBuf,
uint32_t nBuf,
uint32_t *pnConsumed)
{
uint8_t *pIeLen = 0;
uint32_t nConsumedOnEntry = *pnConsumed;
uint32_t nNeeded = 0U;
nNeeded += (pSrc->num_public_key + 2);
while (pSrc->present) {
if (nNeeded > nBuf)
return DOT11F_BUFFER_OVERFLOW;
*pBuf = 255;
++pBuf; ++(*pnConsumed);
pIeLen = pBuf;
++pBuf; ++(*pnConsumed);
*pBuf = 32;
++pBuf; ++(*pnConsumed);
DOT11F_MEMCPY(pCtx, pBuf, pSrc->group, 2);
*pnConsumed += 2;
pBuf += 2;
DOT11F_MEMCPY(pCtx, pBuf, &(pSrc->public_key), pSrc->num_public_key);
*pnConsumed += pSrc->num_public_key;
/* fieldsEndFlag = 1 */
break;
}
(void)pCtx;
if (pIeLen) {
*pIeLen = *pnConsumed - nConsumedOnEntry - 2;
}
return DOT11F_PARSE_SUCCESS;
} /* End dot11f_pack_ie_dh_parameter_element. */

uint32_t dot11f_pack_ie_ext_chan_switch_ann(tpAniSirGlobal pCtx,
tDot11fIEext_chan_switch_ann *pSrc,
uint8_t *pBuf,
Expand Down Expand Up @@ -26847,6 +26929,14 @@ static uint32_t pack_core(tpAniSirGlobal pCtx,
sizeof(tDot11fIEWscReassocRes) * i),
pBufRemaining, nBufRemaining, &len);
break;
case SigIedh_parameter_element:
status |=
dot11f_pack_ie_dh_parameter_element(
pCtx, (tDot11fIEdh_parameter_element *)
(pSrc + pIe->offset +
sizeof(tDot11fIEdh_parameter_element) * i),
pBufRemaining, nBufRemaining, &len);
break;
case SigIeext_chan_switch_ann:
status |=
dot11f_pack_ie_ext_chan_switch_ann(
Expand Down
Expand Up @@ -425,6 +425,9 @@ uint8_t *mac_trace_get_sme_msg_string(uint16_t sme_msg)
CASE_RETURN_STRING(eWNI_SME_GET_PEER_INFO_IND);
CASE_RETURN_STRING(eWNI_SME_GET_PEER_INFO_EXT_IND);
CASE_RETURN_STRING(eWNI_SME_RSO_CMD_STATUS_IND);
CASE_RETURN_STRING(eWNI_SME_TRIGGER_SAE);
CASE_RETURN_STRING(eWNI_SME_SEND_MGMT_FRAME_TX);
CASE_RETURN_STRING(eWNI_SME_SEND_SAE_MSG);
CASE_RETURN_STRING(eWNI_SME_MSG_TYPES_END);
default:
return (uint8_t *) "UNKNOWN";
Expand Down Expand Up @@ -780,6 +783,7 @@ uint8_t *mac_trace_get_lim_msg_string(uint16_t lim_msg)
CASE_RETURN_STRING(SIR_LIM_DEAUTH_ACK_TIMEOUT);
CASE_RETURN_STRING(SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT);
CASE_RETURN_STRING(SIR_LIM_AUTH_RETRY_TIMEOUT);
CASE_RETURN_STRING(SIR_LIM_AUTH_SAE_TIMEOUT);
CASE_RETURN_STRING(SIR_LIM_MSG_TYPES_END);
CASE_RETURN_STRING(LIM_MLM_SCAN_REQ);
CASE_RETURN_STRING(LIM_MLM_SCAN_CNF);
Expand Down
9 changes: 1 addition & 8 deletions drivers/staging/qcacld-3.0/core/sap/inc/sap_api.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -874,13 +874,6 @@ typedef struct sap_SoftapStats_s {
#endif
} tSap_SoftapStats, *tpSap_SoftapStats;

#ifdef FEATURE_WLAN_CH_AVOID
/* Store channel safety information */
typedef struct {
uint16_t channelNumber;
bool isSafe;
} sapSafeChannelType;
#endif /* FEATURE_WLAN_CH_AVOID */
void sap_cleanup_channel_list(void *sapContext);
void sapCleanupAllChannelList(void);

Expand Down
242 changes: 4 additions & 238 deletions drivers/staging/qcacld-3.0/core/sap/src/sap_ch_select.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -128,52 +128,6 @@
#define ACS_WEIGHT_SOFTAP_TX_POWER_THROUGHPUT_CFG(weights) \
(((weights) & 0xf00000) >> 20)

#ifdef FEATURE_WLAN_CH_AVOID
sapSafeChannelType safe_channels[NUM_CHANNELS] = {
{1, true},
{2, true},
{3, true},
{4, true},
{5, true},
{6, true},
{7, true},
{8, true},
{9, true},
{10, true},
{11, true},
{12, true},
{13, true},
{14, true},
{36, true},
{40, true},
{44, true},
{48, true},
{52, true},
{56, true},
{60, true},
{64, true},
{100, true},
{104, true},
{108, true},
{112, true},
{116, true},
{120, true},
{124, true},
{128, true},
{132, true},
{136, true},
{140, true},
{144, true},
{149, true},
{153, true},
{157, true},
{161, true},
{165, true},
{169, true},
{173, true},
};
#endif

typedef struct {
uint16_t chStartNum;
uint32_t weight;
Expand Down Expand Up @@ -401,81 +355,6 @@ static void sap_process_avoid_ie(tHalHandle hal,
}
#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */

#ifdef FEATURE_WLAN_CH_AVOID
/*==========================================================================
FUNCTION sap_update_unsafe_channel_list
DESCRIPTION
Function Undate unsafe channel list table
DEPENDENCIES
NA.
IN
SapContext pointer
RETURN VALUE
NULL
============================================================================*/
void sap_update_unsafe_channel_list(ptSapContext pSapCtx)
{
uint16_t i, j;
uint16_t unsafe_channel_list[NUM_CHANNELS];
uint16_t unsafe_channel_count = 0;
qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);

if (!qdf_ctx) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_FATAL,
"qdf_ctx is NULL");
return;
}

/* Flush, default set all channel safe */
for (i = 0; i < NUM_CHANNELS; i++) {
safe_channels[i].isSafe = true;
}

/* Try to find unsafe channel */
#if defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE)
for (i = 0; i < NUM_CHANNELS; i++) {
if (pSapCtx->dfs_ch_disable == true) {
if (CDS_IS_DFS_CH(safe_channels[i].channelNumber)) {
safe_channels[i].isSafe = false;
QDF_TRACE(QDF_MODULE_ID_SAP,
QDF_TRACE_LEVEL_DEBUG,
"%s: DFS Ch %d is not safe in"
" Concurrent mode",
__func__,
safe_channels[i].channelNumber);
}
}
}
#endif
pld_get_wlan_unsafe_channel(qdf_ctx->dev,
unsafe_channel_list,
&unsafe_channel_count,
sizeof(unsafe_channel_list));

for (i = 0; i < unsafe_channel_count; i++) {
for (j = 0; j < NUM_CHANNELS; j++) {
if (safe_channels[j].channelNumber ==
unsafe_channel_list[i]) {
/* Found unsafe channel, update it */
safe_channels[j].isSafe = false;
QDF_TRACE(QDF_MODULE_ID_SAP,
QDF_TRACE_LEVEL_DEBUG,
FL("CH %d is not safe"),
unsafe_channel_list[i]);
break;
}
}
}

return;
}

#endif /* FEATURE_WLAN_CH_AVOID */

/*==========================================================================
FUNCTION sap_cleanup_channel_list
Expand Down Expand Up @@ -635,9 +514,6 @@ static bool sap_chan_sel_init(tHalHandle halHandle,
uint16_t channelnum = 0;
tpAniSirGlobal pMac = PMAC_STRUCT(halHandle);
bool chSafe = true;
#ifdef FEATURE_WLAN_CH_AVOID
uint16_t i;
#endif
uint32_t dfs_master_cap_enabled;
bool include_dfs_ch = true;
bool sta_sap_scc_on_dfs_chan =
Expand Down Expand Up @@ -714,19 +590,8 @@ static bool sap_chan_sel_init(tHalHandle halHandle,
}
}

#ifdef FEATURE_WLAN_CH_AVOID
for (i = 0; i < NUM_CHANNELS; i++) {
if ((safe_channels[i].channelNumber == *pChans) &&
(false == safe_channels[i].isSafe)) {
QDF_TRACE(QDF_MODULE_ID_SAP,
QDF_TRACE_LEVEL_DEBUG,
"In %s, Ch %d is not safe", __func__,
*pChans);
chSafe = false;
break;
}
}
#endif /* FEATURE_WLAN_CH_AVOID */
if (!cds_is_safe_channel(*pChans))
chSafe = false;

/* OFDM rates are not supported on channel 14 */
if (*pChans == 14 &&
Expand Down Expand Up @@ -2564,101 +2429,6 @@ static bool sap_is_ch_non_overlap(ptSapContext sap_ctx, uint16_t ch)
return false;
}

#ifdef FEATURE_WLAN_CH_AVOID
/**
* sap_select_channel_no_scan_result() - select SAP channel when no scan results
* are available.
* @sap_ctx: Sap context
*
* Returns: channel number if success, 0 otherwise
*/
static uint8_t sap_select_channel_no_scan_result(tHalHandle hal,
ptSapContext sap_ctx)
{
enum channel_state ch_type;
uint8_t i, first_safe_ch_in_range = SAP_CHANNEL_NOT_SELECTED;
uint32_t dfs_master_cap_enabled;
uint32_t start_ch_num = sap_ctx->acs_cfg->start_ch;
uint32_t end_ch_num = sap_ctx->acs_cfg->end_ch;

QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("start - end: %d - %d"), start_ch_num, end_ch_num);

sme_cfg_get_int(hal, WNI_CFG_DFS_MASTER_ENABLED,
&dfs_master_cap_enabled);

QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
"%s: dfs_master %x", __func__, dfs_master_cap_enabled);

/* get a channel in PCL and within the range */
for (i = 0; i < sap_ctx->acs_cfg->pcl_ch_count; i++) {
if ((sap_ctx->acs_cfg->pcl_channels[i] < start_ch_num) ||
(sap_ctx->acs_cfg->pcl_channels[i] > end_ch_num))
continue;

first_safe_ch_in_range = sap_ctx->acs_cfg->pcl_channels[i];
break;
}

if (SAP_CHANNEL_NOT_SELECTED != first_safe_ch_in_range)
return first_safe_ch_in_range;

for (i = 0; i < NUM_CHANNELS; i++) {
if ((safe_channels[i].channelNumber < start_ch_num) ||
(safe_channels[i].channelNumber > end_ch_num))
continue;

ch_type = cds_get_channel_state(safe_channels[i].channelNumber);

if ((ch_type == CHANNEL_STATE_DISABLE) ||
(ch_type == CHANNEL_STATE_INVALID))
continue;
if ((!dfs_master_cap_enabled) &&
(CHANNEL_STATE_DFS == ch_type)) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
"%s: DFS master mode disabled. Skip DFS channel %d",
__func__, safe_channels[i].channelNumber);
continue;
}
if ((sap_ctx->dfs_mode == ACS_DFS_MODE_DISABLE) &&
(CHANNEL_STATE_DFS == ch_type))
continue;

if (safe_channels[i].isSafe == true) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("channel %d in the configuration is safe"),
safe_channels[i].channelNumber);
first_safe_ch_in_range = safe_channels[i].channelNumber;
break;
}

QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("channel %d in the configuration is unsafe"),
safe_channels[i].channelNumber);
}

/* if no channel selected return SAP_CHANNEL_NOT_SELECTED */
return first_safe_ch_in_range;
}
#else
static uint8_t sap_select_channel_no_scan_result(tHalHandle hal,
ptSapContext sap_ctx)
{
uint32_t start_ch_num = sap_ctx->acs_cfg->start_ch;

QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("start - end: %d - %d"),
start_ch_num,
sap_ctx->acs_cfg->end_ch);

sap_ctx->acs_cfg->pri_ch = start_ch_num;
sap_ctx->acs_cfg->ht_sec_ch = 0;

/* pick the first channel in configured range */
return start_ch_num;
}
#endif /* FEATURE_WLAN_CH_AVOID */

/**
* sap_select_channel() - select SAP channel
* @hal: Pointer to HAL handle
Expand All @@ -2685,10 +2455,6 @@ uint8_t sap_select_channel(tHalHandle hal, ptSapContext sap_ctx,
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
"In %s, Running SAP Ch Select", __func__);

#ifdef FEATURE_WLAN_CH_AVOID
sap_update_unsafe_channel_list(sap_ctx);
#endif

/*
* If ACS weight is not enabled on noise_floor/channel_free/tx_power,
* then skip acs process if no bss found.
Expand All @@ -2701,7 +2467,7 @@ uint8_t sap_select_channel(tHalHandle hal, ptSapContext sap_ctx,
#ifndef SOFTAP_CHANNEL_RANGE
return SAP_CHANNEL_NOT_SELECTED;
#else
return sap_select_channel_no_scan_result(hal, sap_ctx);
return sap_select_default_oper_chan(sap_ctx->acs_cfg);
#endif
}

Expand Down
72 changes: 31 additions & 41 deletions drivers/staging/qcacld-3.0/core/sap/src/sap_fsm.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -67,10 +67,6 @@
/*----------------------------------------------------------------------------
* External declarations for global context
* -------------------------------------------------------------------------*/
#ifdef FEATURE_WLAN_CH_AVOID
extern sapSafeChannelType safe_channels[];
#endif /* FEATURE_WLAN_CH_AVOID */

/*----------------------------------------------------------------------------
* Static Variable Definitions
* -------------------------------------------------------------------------*/
Expand Down Expand Up @@ -2242,32 +2238,35 @@ sap_dfs_is_channel_in_nol_list(ptSapContext sap_context,

uint8_t sap_select_default_oper_chan(struct sap_acs_cfg *acs_cfg)
{
uint8_t channel;
uint16_t i;

if (NULL == acs_cfg) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
"ACS config invalid!");
QDF_BUG(0);
if (!acs_cfg || !acs_cfg->ch_list || !acs_cfg->ch_list_count)
return 0;
}

if (acs_cfg->hw_mode == eCSR_DOT11_MODE_11a) {
channel = SAP_DEFAULT_5GHZ_CHANNEL;
} else if ((acs_cfg->hw_mode == eCSR_DOT11_MODE_11n) ||
(acs_cfg->hw_mode == eCSR_DOT11_MODE_11n_ONLY) ||
(acs_cfg->hw_mode == eCSR_DOT11_MODE_11ac) ||
(acs_cfg->hw_mode == eCSR_DOT11_MODE_11ac_ONLY)) {
if (CDS_IS_CHANNEL_5GHZ(acs_cfg->start_ch))
channel = SAP_DEFAULT_5GHZ_CHANNEL;
else
channel = SAP_DEFAULT_24GHZ_CHANNEL;
} else {
channel = SAP_DEFAULT_24GHZ_CHANNEL;
/*
* There could be both 2.4Ghz and 5ghz channels present in the list
* based upon the Hw mode received from hostapd, it is always better
* to chose a default 5ghz operating channel than 2.4ghz, as it can
* provide a better throughput, latency than 2.4ghz. Also 40 Mhz is
* rare in 2.4ghz band, so 5ghz should be preferred. If we get a 5Ghz
* chan in the acs cfg ch list , we should go for that first else the
* default channel can be 2.4ghz.
*/

for (i = 0; i < acs_cfg->ch_list_count; i++) {
if (CDS_IS_CHANNEL_5GHZ(acs_cfg->ch_list[i])) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG,
FL("default 5ghz channel chosen as %d"),
acs_cfg->ch_list[i]);
return acs_cfg->ch_list[i];
}
}

QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
FL("channel selected to start bss %d"), channel);
return channel;
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG,
FL("default channel chosen as %d"),
acs_cfg->ch_list[0]);

return acs_cfg->ch_list[0];
}

/**
Expand Down Expand Up @@ -2364,6 +2363,9 @@ QDF_STATUS sap_goto_channel_sel(ptSapContext sap_context,
"%s: Override ch %d to %d due to CC Intf",
__func__, sap_context->channel, con_ch);
sap_context->channel = con_ch;
if (CDS_IS_CHANNEL_24GHZ(con_ch))
sap_context->ch_params.ch_width =
CH_WIDTH_20MHZ;
cds_set_channel_params(sap_context->channel, 0,
&sap_context->ch_params);
}
Expand Down Expand Up @@ -2425,6 +2427,9 @@ QDF_STATUS sap_goto_channel_sel(ptSapContext sap_context,
__func__, sap_context->channel,
con_ch);
sap_context->channel = con_ch;
if (CDS_IS_CHANNEL_24GHZ(con_ch))
sap_context->ch_params.ch_width =
CH_WIDTH_20MHZ;
cds_set_channel_params(sap_context->channel, 0,
&sap_context->ch_params);
}
Expand Down Expand Up @@ -4872,9 +4877,7 @@ static QDF_STATUS sap_get_channel_list(ptSapContext sap_ctx,
uint8_t end_ch_num, band_end_ch;
uint32_t en_lte_coex;
tHalHandle hal = CDS_GET_HAL_CB(sap_ctx->p_cds_gctx);
#ifdef FEATURE_WLAN_CH_AVOID
uint8_t i;
#endif
tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
tSapChSelSpectInfo spect_info_obj = { NULL, 0 };
uint16_t ch_width;
Expand Down Expand Up @@ -4983,13 +4986,6 @@ static QDF_STATUS sap_get_channel_list(ptSapContext sap_ctx,
continue;
}

#ifdef FEATURE_WLAN_CH_AVOID
for (i = 0; i < NUM_CHANNELS; i++) {
if (safe_channels[i].channelNumber ==
CDS_CHANNEL_NUM(loop_count)) {
/* Check if channel is safe */
if (true == safe_channels[i].isSafe) {
#endif
#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
uint8_t ch;

Expand Down Expand Up @@ -5025,12 +5021,6 @@ static QDF_STATUS sap_get_channel_list(ptSapContext sap_ctx,
#else
list[ch_count] = CDS_CHANNEL_NUM(loop_count);
ch_count++;
#endif
#ifdef FEATURE_WLAN_CH_AVOID
}
break;
}
}
#endif
}

Expand Down
6 changes: 1 addition & 5 deletions drivers/staging/qcacld-3.0/core/sap/src/sap_internal.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -374,10 +374,6 @@ QDF_STATUS sap_acquire_global_lock(ptSapContext pSapCtx);

QDF_STATUS sap_release_global_lock(ptSapContext pSapCtx);

#ifdef FEATURE_WLAN_CH_AVOID
void sap_update_unsafe_channel_list(ptSapContext pSapCtx);
#endif /* FEATURE_WLAN_CH_AVOID */

uint8_t
sap_indicate_radar(ptSapContext sapContext,
tSirSmeDfsEventInd *dfs_event);
Expand Down
35 changes: 31 additions & 4 deletions drivers/staging/qcacld-3.0/core/sme/inc/csr_api.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -47,6 +47,7 @@ typedef enum {
/* MAC layer authentication types */
eCSR_AUTH_TYPE_OPEN_SYSTEM,
eCSR_AUTH_TYPE_SHARED_KEY,
eCSR_AUTH_TYPE_SAE,
eCSR_AUTH_TYPE_AUTOSWITCH,

/* Upper layer authentication types */
Expand All @@ -70,6 +71,10 @@ typedef enum {
eCSR_AUTH_TYPE_FILS_SHA384,
eCSR_AUTH_TYPE_FT_FILS_SHA256,
eCSR_AUTH_TYPE_FT_FILS_SHA384,
eCSR_AUTH_TYPE_OWE,
eCSR_AUTH_TYPE_SUITEB_EAP_SHA256,
eCSR_AUTH_TYPE_SUITEB_EAP_SHA384,
eCSR_AUTH_TYPE_DPP_RSN,
eCSR_NUM_OF_SUPPORT_AUTH_TYPE,
eCSR_AUTH_TYPE_FAILED = 0xff,
eCSR_AUTH_TYPE_UNKNOWN = eCSR_AUTH_TYPE_FAILED,
Expand All @@ -94,10 +99,9 @@ typedef enum {
eCSR_ENCRYPT_TYPE_BTK,
#endif
#endif /* FEATURE_WLAN_ESE */
#ifdef WLAN_FEATURE_11W
/* 11w BIP */
eCSR_ENCRYPT_TYPE_AES_CMAC,
#endif
eCSR_ENCRYPT_TYPE_AES_GMAC_128,
eCSR_ENCRYPT_TYPE_AES_GMAC_256,
eCSR_ENCRYPT_TYPE_AES_GCMP,
eCSR_ENCRYPT_TYPE_AES_GCMP_256,
eCSR_ENCRYPT_TYPE_ANY,
Expand Down Expand Up @@ -227,6 +231,8 @@ typedef enum {
#define CSR_AES_KEY_LEN 16
#define CSR_AES_GCMP_KEY_LEN 16
#define CSR_AES_GCMP_256_KEY_LEN 32
#define CSR_AES_GMAC_128_KEY_LEN 16
#define CSR_AES_GMAC_256_KEY_LEN 32
#define CSR_MAX_TX_POWER (WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX)
#define CSR_MAX_RSC_LEN 16
#ifdef FEATURE_WLAN_WAPI
Expand Down Expand Up @@ -539,6 +545,9 @@ typedef enum {
eCSR_ROAM_START,
eCSR_ROAM_ABORT,
eCSR_ROAM_NAPI_OFF,
eCSR_ROAM_SAE_COMPUTE,
/* LFR3 Roam sync complete */
eCSR_ROAM_SYNCH_COMPLETE,
} eRoamCmdStatus;

/* comment inside indicates what roaming callback gets */
Expand Down Expand Up @@ -937,6 +946,7 @@ typedef struct tagCsrRoamProfile {
uint8_t MFPRequired;
uint8_t MFPCapable;
#endif
tAniEdType mgmt_encryption_type;
tCsrKeys Keys;
tCsrChannelInfo ChannelInfo;
uint8_t operationChannel;
Expand Down Expand Up @@ -1556,6 +1566,9 @@ typedef struct tagCsrRoamInfo {
int rssi;
int tx_rate;
int rx_rate;
#ifdef WLAN_FEATURE_SAE
struct sir_sae_info *sae_info;
#endif
} tCsrRoamInfo;

typedef struct tagCsrFreqScanInfo {
Expand Down Expand Up @@ -1804,6 +1817,20 @@ typedef QDF_STATUS (*csr_roamSessionCloseCallback)(void *pContext);
(eCSR_AUTH_TYPE_FT_FILS_SHA256 == auth_type) || \
(eCSR_AUTH_TYPE_FT_FILS_SHA384 == auth_type))

#ifdef WLAN_FEATURE_OWE
#define CSR_IS_AUTH_TYPE_OWE(auth_type) \
(eCSR_AUTH_TYPE_OWE == auth_type)
#else
#define CSR_IS_AUTH_TYPE_OWE(auth_type) (false)
#endif

#ifdef WLAN_FEATURE_SAE
#define CSR_IS_AUTH_TYPE_SAE(auth_type) \
(eCSR_AUTH_TYPE_SAE == auth_type)
#else
#define CSR_IS_AUTH_TYPE_SAE(auth_type) (false)
#endif

QDF_STATUS csr_set_channels(tHalHandle hHal, tCsrConfigParam *pParam);

QDF_STATUS csr_set_reg_info(tHalHandle hHal, uint8_t *apCntryCode);
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/qcacld-3.0/core/sme/inc/csr_internal.h
Expand Up @@ -1045,6 +1045,7 @@ typedef struct tagCsrRoamSession {
bool ignore_assoc_disallowed;
bool discon_in_progress;
struct csr_disconnect_stats disconnect_stats;
struct rsn_caps rsn_caps;
} tCsrRoamSession;

typedef struct tagCsrRoamStruct {
Expand Down
27 changes: 26 additions & 1 deletion drivers/staging/qcacld-3.0/core/sme/inc/csr_neighbor_roam.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2018, 2020 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -393,13 +393,38 @@ QDF_STATUS csr_roam_read_tsf(tpAniSirGlobal pMac, uint8_t *pTimestamp,
QDF_STATUS csr_roam_synch_callback(tpAniSirGlobal mac,
roam_offload_synch_ind *roam_synch_data,
tpSirBssDescription bss_desc_ptr, enum sir_roam_op_code reason);

/**
* csr_fast_reassoc() - invokes FAST REASSOC command
* @hal: handle returned by mac_open
* @profile: current connected profile
* @bssid: bssid to look for in scan cache
* @ch_freq: channel on which reassoc should be send
* @vdev_id: vdev id
* @connected_bssid: bssid of currently connected profile
*
* Return: QDF_STATUS
*/
QDF_STATUS csr_fast_reassoc(tHalHandle hal, tCsrRoamProfile *profile,
const tSirMacAddr bssid, int channel,
uint8_t vdev_id, const tSirMacAddr connected_bssid);

#else
static inline QDF_STATUS csr_roam_synch_callback(tpAniSirGlobal mac,
roam_offload_synch_ind *roam_synch_data,
tpSirBssDescription bss_desc_ptr, enum sir_roam_op_code reason)
{
return QDF_STATUS_E_NOSUPPORT;
}

static inline
QDF_STATUS csr_fast_reassoc(tHalHandle hal, tCsrRoamProfile *profile,
const tSirMacAddr bssid, int channel,
uint8_t vdev_id, const tSirMacAddr connected_bssid)
{
return QDF_STATUS_SUCCESS;
}

#endif
void csr_neighbor_roam_state_transition(tpAniSirGlobal mac_ctx,
uint8_t newstate, uint8_t session);
Expand Down
10 changes: 0 additions & 10 deletions drivers/staging/qcacld-3.0/core/sme/inc/csr_support.h
Expand Up @@ -175,16 +175,6 @@ typedef struct tagCsrRSNAuthIe {
} qdf_packed AuthOui[1];
} qdf_packed tCsrRSNAuthIe;

typedef struct tagCsrRSNCapabilities {
uint16_t PreAuthSupported:1;
uint16_t NoPairwise:1;
uint16_t PTKSAReplayCounter:2;
uint16_t GTKSAReplayCounter:2;
uint16_t MFPRequired:1;
uint16_t MFPCapable:1;
uint16_t Reserved:8;
} qdf_packed tCsrRSNCapabilities;

typedef struct tagCsrRSNPMKIe {
uint16_t cPMKIDs;
struct {
Expand Down
44 changes: 34 additions & 10 deletions drivers/staging/qcacld-3.0/core/sme/inc/sme_api.h
Expand Up @@ -1056,10 +1056,12 @@ QDF_STATUS sme_ll_stats_clear_req(tHalHandle hHal,
QDF_STATUS sme_ll_stats_set_req(tHalHandle hHal,
tSirLLStatsSetReq *psetStatsReq);
QDF_STATUS sme_ll_stats_get_req(tHalHandle hHal,
tSirLLStatsGetReq *pgetStatsReq);
tSirLLStatsGetReq *pgetStatsReq,
void *context);
QDF_STATUS sme_set_link_layer_stats_ind_cb(tHalHandle hHal,
void (*callbackRoutine)(void *callbackCtx,
int indType, void *pRsp));
int indType, void *pRsp,
void *cookie));
QDF_STATUS sme_set_link_layer_ext_cb(tHalHandle hal,
void (*ll_stats_ext_cb)(tHddHandle callback_ctx,
tSirLLStatsResults * rsp));
Expand Down Expand Up @@ -2246,14 +2248,6 @@ QDF_STATUS
sme_get_roam_scan_stats(tHalHandle hal, roam_scan_stats_cb cb, void *context,
uint32_t vdev_id);

/**
* sme_get_scan_id() - Sme wrapper to get scan ID
* @scan_id: output pointer to hold scan_id
*
* Return: QDF_STATUS
*/
QDF_STATUS sme_get_scan_id(uint32_t *scan_id);

/*
* sme_validate_channel_list() - Validate the given channel list
* @hal: handle to global hal context
Expand All @@ -2267,5 +2261,35 @@ QDF_STATUS sme_get_scan_id(uint32_t *scan_id);
bool sme_validate_channel_list(tHalHandle hal,
uint8_t *chan_list,
uint8_t num_channels);
/**
* sme_send_mgmt_tx() - Sends mgmt frame from CSR to LIM
* @hal: The handle returned by mac_open
* @session_id: session id
* @buf: pointer to frame
* @len: frame length
*
* Return: QDF_STATUS
*/
QDF_STATUS sme_send_mgmt_tx(tHalHandle hal, uint8_t session_id,
const uint8_t *buf, uint32_t len);

#ifdef WLAN_FEATURE_SAE
/**
* sme_handle_sae_msg() - Sends SAE message received from supplicant
* @hal: The handle returned by mac_open
* @session_id: session id
* @sae_status: status of SAE authentication
*
* Return: QDF_STATUS
*/
QDF_STATUS sme_handle_sae_msg(tHalHandle hal, uint8_t session_id,
uint8_t sae_status);
#else
static inline QDF_STATUS sme_handle_sae_msg(tHalHandle hal, uint8_t session_id,
uint8_t sae_status)
{
return QDF_STATUS_SUCCESS;
}
#endif

#endif /* #if !defined( __SME_API_H ) */
11 changes: 10 additions & 1 deletion drivers/staging/qcacld-3.0/core/sme/inc/sme_ft_api.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2016,2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -94,6 +94,15 @@ void sme_get_ft_pre_auth_response(tHalHandle hHal, uint32_t sessionId,
uint16_t *ft_ies_length);
void sme_get_rici_es(tHalHandle hHal, uint32_t sessionId, uint8_t *ric_ies,
uint32_t ric_ies_ip_len, uint32_t *ric_ies_length);
/**
* sme_reset_key() -Reset key information
* @mac_handle: MAC handle
* @vdev_id: vdev identifier
*
* Return: None
*/
void sme_reset_key(tHalHandle mac_handle, uint32_t vdev_id);

void sme_preauth_reassoc_intvl_timer_callback(void *context);
void sme_set_ft_pre_auth_state(tHalHandle hHal, uint32_t sessionId, bool state);
bool sme_get_ft_pre_auth_state(tHalHandle hHal, uint32_t sessionId);
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/qcacld-3.0/core/sme/inc/sme_internal.h
Expand Up @@ -191,8 +191,9 @@ typedef struct tagSmeStruct {
void (*pChAvoidNotificationCb)(void *hdd_context, void *indi_param);
#endif /* FEATURE_WLAN_CH_AVOID */
#ifdef WLAN_FEATURE_LINK_LAYER_STATS
void *ll_stats_context;
void (*pLinkLayerStatsIndCallback)(void *callbackContext,
int indType, void *pRsp);
int indType, void *pRsp, void *context);
void (*link_layer_stats_ext_cb)(tHddHandle callback_ctx,
tSirLLStatsResults *rsp);
#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
Expand Down
4 changes: 3 additions & 1 deletion drivers/staging/qcacld-3.0/core/sme/inc/sme_qos_api.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2017, 2019 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -51,6 +51,8 @@
#define SME_QOS_UAPSD_VI 0x02
#define SME_QOS_UAPSD_BE 0x08
#define SME_QOS_UAPSD_BK 0x04
#define WLAN_MAX_DSCP 0x3f


/*---------------------------------------------------------------------------
Enumeration of the various QoS status types that would be reported to HDD
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/qcacld-3.0/core/sme/inc/sme_rrm_internal.h
Expand Up @@ -93,6 +93,7 @@ typedef struct sRrmSMEContext {
bool eseBcnReqInProgress;
#endif /* FEATURE_WLAN_ESE */
tRrmMsgReqSource msgSource;
qdf_wake_lock_t scan_wake_lock;
} tRrmSMEContext, *tpRrmSMEContext;

typedef struct sRrmNeighborReq {
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/qcacld-3.0/core/sme/inc/sme_trace.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2016, 2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
Expand Down Expand Up @@ -144,6 +144,7 @@ enum {
TRACE_CODE_SME_RX_HDD_LPHB_CONFIG_REQ,
#endif /* FEATURE_WLAN_LPHB */
TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE,
TRACE_CODE_SME_RX_HDD_SEND_MGMT_TX,
/*
* New trace commands to be added before this comment not at the end
* Trace codes for SME commands
Expand Down