mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-15 01:01:56 -04:00
qcacld-3.0: Refactor code use to search vdev using MAC address
In LIM, move functionality to find session for a given MAC address in separate function so that this code can be reused by other functions if needed. In HDD, remove logic added to find adaptor for a given MAC, instead use existing function hdd_get_adapter_by_macaddr. Change-Id: I989f09ffcbee3a717c22c267a01dafd1b404da64 CRs-Fixed: 2004223
This commit is contained in:
parent
45912ad723
commit
7631afa88d
4 changed files with 48 additions and 33 deletions
|
|
@ -14827,8 +14827,6 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy,
|
|||
#else
|
||||
const u8 *bssid_hint = NULL;
|
||||
#endif
|
||||
hdd_adapter_list_node_t *adapter_node = NULL, *next_adapter = NULL;
|
||||
hdd_adapter_t *adapter;
|
||||
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(ndev);
|
||||
hdd_context_t *pHddCtx;
|
||||
|
||||
|
|
@ -14874,21 +14872,10 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy,
|
|||
else if (bssid_hint)
|
||||
bssid = bssid_hint;
|
||||
|
||||
if (bssid) {
|
||||
status = hdd_get_front_adapter(pHddCtx, &adapter_node);
|
||||
while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) {
|
||||
adapter = adapter_node->pAdapter;
|
||||
if (!qdf_mem_cmp(adapter->macAddressCurrent.bytes,
|
||||
bssid, QDF_MAC_ADDR_SIZE)) {
|
||||
hdd_err("Vdev %d exist with same MAC address "
|
||||
MAC_ADDRESS_STR, adapter->sessionId,
|
||||
MAC_ADDR_ARRAY(bssid));
|
||||
return -EINVAL;
|
||||
}
|
||||
status = hdd_get_next_adapter(pHddCtx, adapter_node,
|
||||
&next_adapter);
|
||||
adapter_node = next_adapter;
|
||||
}
|
||||
if (bssid && hdd_get_adapter_by_macaddr(pHddCtx, (uint8_t *)bssid)) {
|
||||
hdd_err("adapter exist with same mac address " MAC_ADDRESS_STR,
|
||||
MAC_ADDR_ARRAY(bssid));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (true == wlan_hdd_reassoc_bssid_hint(pAdapter, req, &status))
|
||||
|
|
|
|||
|
|
@ -428,23 +428,8 @@ static void lim_process_auth_frame_type1(tpAniSirGlobal mac_ctx,
|
|||
if (lim_is_auth_algo_supported(mac_ctx,
|
||||
(tAniAuthType) rx_auth_frm_body->authAlgoNumber,
|
||||
pe_session)) {
|
||||
int i = 0;
|
||||
tCsrRoamSession *session;
|
||||
|
||||
for (i = 0; i < mac_ctx->sme.max_intf_count; i++) {
|
||||
|
||||
if (!CSR_IS_SESSION_VALID(mac_ctx, i))
|
||||
continue;
|
||||
|
||||
session = CSR_GET_SESSION(mac_ctx, i);
|
||||
if (!session || qdf_mem_cmp(&session->selfMacAddr,
|
||||
mac_hdr->sa, sizeof(tSirMacAddr))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pe_debug("vdev with id %d exist with same MAC "
|
||||
MAC_ADDRESS_STR, session->sessionId,
|
||||
MAC_ADDR_ARRAY(mac_hdr->sa));
|
||||
if (lim_get_session_by_macaddr(mac_ctx, mac_hdr->sa)) {
|
||||
|
||||
auth_frame->authAlgoNumber =
|
||||
rx_auth_frm_body->authAlgoNumber;
|
||||
|
|
|
|||
|
|
@ -7778,3 +7778,34 @@ void lim_decrement_pending_mgmt_count(tpAniSirGlobal mac_ctx)
|
|||
mac_ctx->sys.sys_bbt_pending_mgmt_count--;
|
||||
qdf_spin_unlock(&mac_ctx->sys.bbt_mgmt_lock);
|
||||
}
|
||||
|
||||
tCsrRoamSession *lim_get_session_by_macaddr(tpAniSirGlobal mac_ctx,
|
||||
tSirMacAddr self_mac)
|
||||
{
|
||||
int i = 0;
|
||||
tCsrRoamSession *session;
|
||||
|
||||
if (!mac_ctx || !self_mac) {
|
||||
QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
|
||||
FL("Invalid arguments"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < mac_ctx->sme.max_intf_count; i++) {
|
||||
session = CSR_GET_SESSION(mac_ctx, i);
|
||||
if (!session)
|
||||
continue;
|
||||
else if (!qdf_mem_cmp(&session->selfMacAddr,
|
||||
self_mac, sizeof(tSirMacAddr))) {
|
||||
|
||||
QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
|
||||
FL("session %d exists with mac address "
|
||||
MAC_ADDRESS_STR), session->sessionId,
|
||||
MAC_ADDR_ARRAY(self_mac));
|
||||
|
||||
return session;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,6 +261,18 @@ void lim_prepare_for11h_channel_switch(tpAniSirGlobal pMac,
|
|||
void lim_switch_channel_cback(tpAniSirGlobal pMac, QDF_STATUS status,
|
||||
uint32_t *data, tpPESession psessionEntry);
|
||||
|
||||
/**
|
||||
* lim_get_session_by_macaddr() - api to find session based on MAC
|
||||
* @mac_ctx: Pointer to global mac structure.
|
||||
* @self_mac: MAC address.
|
||||
*
|
||||
* This function is used to get session for given MAC address.
|
||||
*
|
||||
* Return: session pointer if exists, NULL otherwise.
|
||||
*/
|
||||
tCsrRoamSession *lim_get_session_by_macaddr(tpAniSirGlobal mac_ctx,
|
||||
tSirMacAddr self_mac);
|
||||
|
||||
static inline tSirRFBand lim_get_rf_band(uint8_t channel)
|
||||
{
|
||||
if ((channel >= SIR_11A_CHANNEL_BEGIN) &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue