qcacld-3.0: Refactor code to pass large argument by reference

A large function call parameter is passed by value.
Refactor the code to send the large function call parameter by
reference.

Change-Id: I0a29ee9df797e245a4960160c66053df7b834be3
CRs-Fixed: 2232908
This commit is contained in:
Kiran Kumar Lokere 2018-05-03 14:36:32 -07:00 • committed by nshrivas
commit 0927102d08
3 changed files with 27 additions and 20 deletions

View file

@ -332,7 +332,7 @@ static inline bool is_non_rsn_cipher(uint8_t cipher_suite)
* lim_check_rx_rsn_ie_match()- validate received rsn ie with supported cipher
* suites.
* @mac_ctx: pointer to global mac structure
* @rx_rsn_ie: received rsn IE
* @rx_rsn_ie: received rsn IE pointer
* @session_entry: pe session entry
* @sta_is_ht: peer station HT capability
* @pmf_connection: set to true if this is pmf connection
@ -345,10 +345,10 @@ static inline bool is_non_rsn_cipher(uint8_t cipher_suite)
* received rateset else failure status.
*/
uint8_t
lim_check_rx_rsn_ie_match(tpAniSirGlobal mac_ctx, tDot11fIERSN rx_rsn_ie,
tpPESession session_entry, uint8_t sta_is_ht,
bool *pmf_connection)
uint8_t lim_check_rx_rsn_ie_match(tpAniSirGlobal mac_ctx,
tDot11fIERSN * const rx_rsn_ie,
tpPESession session_entry, uint8_t sta_is_ht,
bool *pmf_connection)
{
tDot11fIERSN *rsn_ie;
uint8_t i, j, match, only_non_ht_cipher = 1;
@ -362,10 +362,15 @@ lim_check_rx_rsn_ie_match(tpAniSirGlobal mac_ctx, tDot11fIERSN rx_rsn_ie,
/* RSN IE should be received from PE */
rsn_ie = &session_entry->gStartBssRSNIe;
if (!rx_rsn_ie) {
pe_debug("Rx RSN IE is NULL");
return eSIR_FAILURE;
}
/* Check groupwise cipher suite */
for (i = 0; i < sizeof(rx_rsn_ie.gp_cipher_suite); i++)
for (i = 0; i < sizeof(rx_rsn_ie->gp_cipher_suite); i++)
if (rsn_ie->gp_cipher_suite[i] !=
rx_rsn_ie.gp_cipher_suite[i]) {
rx_rsn_ie->gp_cipher_suite[i]) {
pe_debug("Invalid groupwise cipher suite");
return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS;
}
@ -375,11 +380,11 @@ lim_check_rx_rsn_ie_match(tpAniSirGlobal mac_ctx, tDot11fIERSN rx_rsn_ie,
* received pairwise
*/
match = 0;
for (i = 0; i < rx_rsn_ie.pwise_cipher_suite_count; i++) {
for (i = 0; i < rx_rsn_ie->pwise_cipher_suite_count; i++) {
for (j = 0; j < rsn_ie->pwise_cipher_suite_count; j++) {
if (!qdf_mem_cmp(&rx_rsn_ie.pwise_cipher_suites[i],
&rsn_ie->pwise_cipher_suites[j],
sizeof(rsn_ie->pwise_cipher_suites[j]))) {
if (!qdf_mem_cmp(&rx_rsn_ie->pwise_cipher_suites[i],
&rsn_ie->pwise_cipher_suites[j],
sizeof(rsn_ie->pwise_cipher_suites[j]))) {
match = 1;
break;
}
@ -388,10 +393,10 @@ lim_check_rx_rsn_ie_match(tpAniSirGlobal mac_ctx, tDot11fIERSN rx_rsn_ie,
if (sta_is_ht)
#ifdef ANI_LITTLE_BYTE_ENDIAN
only_non_ht_cipher = is_non_rsn_cipher(
rx_rsn_ie.pwise_cipher_suites[i][3]);
rx_rsn_ie->pwise_cipher_suites[i][3]);
#else
only_non_ht_cipher = is_non_rsn_cipher(
rx_rsn_ie.pwise_cipher_suites[i][0]);
rx_rsn_ie->pwise_cipher_suites[i][0]);
#endif
}
@ -403,7 +408,7 @@ lim_check_rx_rsn_ie_match(tpAniSirGlobal mac_ctx, tDot11fIERSN rx_rsn_ie,
* Check RSN capabilities
* Bit 0 of First Byte - PreAuthentication Capability
*/
if (((rx_rsn_ie.RSN_Cap[0] >> 0) & 0x1) == true) {
if (((rx_rsn_ie->RSN_Cap[0] >> 0) & 0x1) == true) {
/* this is supported by AP only */
pe_debug("Invalid RSN information element capabilities");
return eSIR_MAC_INVALID_RSN_IE_CAPABILITIES_STATUS;
@ -414,8 +419,8 @@ lim_check_rx_rsn_ie_match(tpAniSirGlobal mac_ctx, tDot11fIERSN rx_rsn_ie,
#ifdef WLAN_FEATURE_11W
we_are_pmf_capable = session_entry->pLimStartBssReq->pmfCapable;
we_require_pmf = session_entry->pLimStartBssReq->pmfRequired;
they_are_pmf_capable = (rx_rsn_ie.RSN_Cap[0] >> 7) & 0x1;
they_require_pmf = (rx_rsn_ie.RSN_Cap[0] >> 6) & 0x1;
they_are_pmf_capable = (rx_rsn_ie->RSN_Cap[0] >> 7) & 0x1;
they_require_pmf = (rx_rsn_ie->RSN_Cap[0] >> 6) & 0x1;
if ((they_require_pmf && they_are_pmf_capable && !we_are_pmf_capable) ||
(we_require_pmf && !they_are_pmf_capable)) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2018 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
@ -44,8 +44,10 @@ uint8_t lim_compare_capabilities(tpAniSirGlobal,
tSirAssocReq *,
tSirMacCapabilityInfo *, tpPESession);
uint8_t lim_check_rx_basic_rates(tpAniSirGlobal, tSirMacRateSet, tpPESession);
uint8_t lim_check_rx_rsn_ie_match(tpAniSirGlobal, tDot11fIERSN, tpPESession, uint8_t,
bool *);
uint8_t lim_check_rx_rsn_ie_match(tpAniSirGlobal mac_ctx,
tDot11fIERSN * const rx_rsn_ie,
tpPESession session_entry, uint8_t sta_is_ht,
bool *pmf_connection);
uint8_t lim_check_rx_wpa_ie_match(tpAniSirGlobal, tDot11fIEWPA, tpPESession,
uint8_t);
uint8_t lim_check_mcs_set(tpAniSirGlobal pMac, uint8_t *supportedMCSSet);

View file

@ -874,7 +874,7 @@ static bool lim_chk_n_process_wpa_rsn_ie(tpAniSirGlobal mac_ctx,
*/
status =
lim_check_rx_rsn_ie_match(
mac_ctx, dot11f_ie_rsn,
mac_ctx, &dot11f_ie_rsn,
session,
assoc_req->HTCaps.present,
pmf_connection);