qcacld-3.0: Relocate gProbeReqOUIs ini to FW offload component

Relocate gProbeReqOUIs ini parameter to FW offload component.

Change-Id: Ie3764cfaf3625911a14cc43fb7eaab415f54ece1
CRs-Fixed: 2324746
This commit is contained in:
Dundi Raviteja 2018-09-28 14:18:28 +05:30
commit 9ab4e7b4f1
8 changed files with 155 additions and 255 deletions

View file

@ -27,6 +27,8 @@
#include <wlan_objmgr_global_obj.h>
#include <wlan_cmn.h>
#include "cfg_ie_whitelist.h"
#define fwol_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_FWOL, params)
#define fwol_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_FWOL, params)
#define fwol_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_FWOL, params)
@ -63,14 +65,14 @@ struct wlan_fwol_coex_config {
/*
* struct wlan_fwol_thermal_temp - Thermal temperature config items
* thermal_temp_min_level0: Thermal temperature minimum level 0
* thermal_temp_max_level0: Thermal temperature maximum level 0
* thermal_temp_min_level1: Thermal temperature minimum level 1
* thermal_temp_max_level1: Thermal temperature maximum level 1
* thermal_temp_min_level2: Thermal temperature minimum level 2
* thermal_temp_max_level2: Thermal temperature maximum level 2
* thermal_temp_min_level3: Thermal temperature minimum level 3
* thermal_temp_max_level3: Thermal temperature maximum level 3
* @thermal_temp_min_level0: Thermal temperature minimum level 0
* @thermal_temp_max_level0: Thermal temperature maximum level 0
* @thermal_temp_min_level1: Thermal temperature minimum level 1
* @thermal_temp_max_level1: Thermal temperature maximum level 1
* @thermal_temp_min_level2: Thermal temperature minimum level 2
* @thermal_temp_max_level2: Thermal temperature maximum level 2
* @thermal_temp_min_level3: Thermal temperature minimum level 3
* @thermal_temp_max_level3: Thermal temperature maximum level 3
*/
struct wlan_fwol_thermal_temp {
uint16_t thermal_temp_min_level0;
@ -85,15 +87,17 @@ struct wlan_fwol_thermal_temp {
/**
* struct wlan_fwol_ie_whitelist - Probe request IE whitelist config items
* ie_whitelist: IE whitelist flag
* ie_bitmap_0: IE bitmap 0
* ie_bitmap_1: IE bitmap 1
* ie_bitmap_2: IE bitmap 2
* ie_bitmap_3: IE bitmap 3
* ie_bitmap_4: IE bitmap 4
* ie_bitmap_5: IE bitmap 5
* ie_bitmap_6: IE bitmap 6
* ie_bitmap_7: IE bitmap 7
* @ie_whitelist: IE whitelist flag
* @ie_bitmap_0: IE bitmap 0
* @ie_bitmap_1: IE bitmap 1
* @ie_bitmap_2: IE bitmap 2
* @ie_bitmap_3: IE bitmap 3
* @ie_bitmap_4: IE bitmap 4
* @ie_bitmap_5: IE bitmap 5
* @ie_bitmap_6: IE bitmap 6
* @ie_bitmap_7: IE bitmap 7
* @no_of_probe_req_ouis: Total number of ouis present in probe req
* @probe_req_voui: Stores oui values after parsing probe req ouis
*/
struct wlan_fwol_ie_whitelist {
bool ie_whitelist;
@ -105,6 +109,8 @@ struct wlan_fwol_ie_whitelist {
uint32_t ie_bitmap_5;
uint32_t ie_bitmap_6;
uint32_t ie_bitmap_7;
uint32_t no_of_probe_req_ouis;
uint32_t probe_req_voui[MAX_PROBE_REQ_OUIS];
};
/**

View file

@ -76,6 +76,99 @@ fwol_init_thermal_temp_in_cfg(struct wlan_objmgr_psoc *psoc,
cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL3);
}
/**
* fwol_parse_probe_req_ouis - form ouis from ini gProbeReqOUIs
* @psoc: Pointer to struct wlan_objmgr_psoc context
* @whitelist: Pointer to struct wlan_fwol_ie_whitelist
*
* This function parses the ini string gProbeReqOUIs which needs be to in the
* following format:
* "<8 characters of [0-9] or [A-F]>space<8 characters from [0-9] etc.,"
* example: "AABBCCDD 1122EEFF"
* and the logic counts the number of OUIS and allocates the memory
* for every valid OUI and is stored in struct hdd_context
*
* Return: None
*/
static void fwol_parse_probe_req_ouis(struct wlan_objmgr_psoc *psoc,
struct wlan_fwol_ie_whitelist *whitelist)
{
uint8_t probe_req_ouis[MAX_PRB_REQ_VENDOR_OUI_INI_LEN] = {0};
uint32_t *voui = whitelist->probe_req_voui;
char *str;
uint8_t *token;
uint32_t oui_indx = 0;
int ret;
uint32_t hex_value;
qdf_str_lcopy(probe_req_ouis, cfg_get(psoc, CFG_PROBE_REQ_OUI),
MAX_PRB_REQ_VENDOR_OUI_INI_LEN);
str = probe_req_ouis;
whitelist->no_of_probe_req_ouis = 0;
if (!qdf_str_len(str)) {
fwol_info("NO OUIs to parse");
return;
}
token = strsep(&str, " ");
while (token) {
if (qdf_str_len(token) != 8)
goto next_token;
ret = qdf_kstrtouint(token, 16, &hex_value);
if (ret)
goto next_token;
voui[oui_indx++] = cpu_to_be32(hex_value);
if (oui_indx >= MAX_PROBE_REQ_OUIS)
break;
next_token:
token = strsep(&str, " ");
}
if (!oui_indx) {
whitelist->ie_whitelist = false;
return;
}
whitelist->no_of_probe_req_ouis = oui_indx;
}
/**
* fwol_validate_ie_bitmaps() - Validate all IE whitelist bitmap param values
* @psoc: Pointer to struct wlan_objmgr_psoc
* @whitelist: Pointer to struct wlan_fwol_ie_whitelist
*
* Return: True if all bitmap values are valid, else false
*/
static bool fwol_validate_ie_bitmaps(struct wlan_objmgr_psoc *psoc,
struct wlan_fwol_ie_whitelist *whitelist)
{
if (!(whitelist->ie_bitmap_0 && whitelist->ie_bitmap_1 &&
whitelist->ie_bitmap_2 && whitelist->ie_bitmap_3 &&
whitelist->ie_bitmap_4 && whitelist->ie_bitmap_5 &&
whitelist->ie_bitmap_6 && whitelist->ie_bitmap_7))
return false;
/*
* check whether vendor oui IE is set and OUIs are present, each OUI
* is entered in the form of string of 8 characters from ini, therefore,
* for atleast one OUI, minimum length is 8 and hence this string length
* is checked for minimum of 8
*/
if ((whitelist->ie_bitmap_6 & VENDOR_SPECIFIC_IE_BITMAP) &&
(qdf_str_len(cfg_get(psoc, CFG_PROBE_REQ_OUI)) < 8))
return false;
/* check whether vendor oui IE is not set but OUIs are present */
if (!(whitelist->ie_bitmap_6 & VENDOR_SPECIFIC_IE_BITMAP) &&
(qdf_str_len(cfg_get(psoc, CFG_PROBE_REQ_OUI)) > 0))
return false;
return true;
}
static void
fwol_init_ie_whiltelist_in_cfg(struct wlan_objmgr_psoc *psoc,
struct wlan_fwol_ie_whitelist *whitelist)
@ -89,6 +182,9 @@ fwol_init_ie_whiltelist_in_cfg(struct wlan_objmgr_psoc *psoc,
whitelist->ie_bitmap_5 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP5);
whitelist->ie_bitmap_6 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP6);
whitelist->ie_bitmap_7 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP7);
if (!fwol_validate_ie_bitmaps(psoc, whitelist))
whitelist->ie_whitelist = false;
fwol_parse_probe_req_ouis(psoc, whitelist);
}
/**

View file

@ -274,6 +274,38 @@
CFG_VALUE_OR_DEFAULT, \
"IE Bitmap 7")
#define MAX_PRB_REQ_VENDOR_OUI_INI_LEN 160
#define VENDOR_SPECIFIC_IE_BITMAP 0x20000000
/*
* For vendor specific IE, Probe Req OUI types and sub types which are
* to be white listed are specified in gProbeReqOUIs in the following
* example format - gProbeReqOUIs=AABBCCDD EEFF1122
*/
/*
* <ini>
* gProbeReqOUIs - Used to specify vendor specific OUIs
* @Default: Empty string
*
* This ini is used to include the specified OUIs in vendor specific IE
* of probe request.
*
* Related: Need to enable g_enable_probereq_whitelist_ies and
* vendor specific IE should be set in g_probe_req_ie_bitmap_6.
*
* Supported Feature: Probe request ie whitelisting
*
* Usage: Internal/External
*
* </ini>
*/
#define CFG_PROBE_REQ_OUI CFG_INI_STRING( \
"gProbeReqOUIs", \
0, \
MAX_PRB_REQ_VENDOR_OUI_INI_LEN, \
"", \
"Probe Req OUIs")
#define CFG_IE_WHITELIST \
CFG(CFG_PROBE_REQ_IE_WHITELIST) \
CFG(CFG_PROBE_REQ_IE_BIT_MAP0) \
@ -283,6 +315,7 @@
CFG(CFG_PROBE_REQ_IE_BIT_MAP4) \
CFG(CFG_PROBE_REQ_IE_BIT_MAP5) \
CFG(CFG_PROBE_REQ_IE_BIT_MAP6) \
CFG(CFG_PROBE_REQ_IE_BIT_MAP7)
CFG(CFG_PROBE_REQ_IE_BIT_MAP7) \
CFG(CFG_PROBE_REQ_OUI)
#endif

View file

@ -109,14 +109,6 @@ ucfg_fwol_get_ie_whitelist(struct wlan_objmgr_psoc *psoc, bool *ie_whitelist);
QDF_STATUS
ucfg_fwol_set_ie_whitelist(struct wlan_objmgr_psoc *psoc, bool ie_whitelist);
/**
* ucfg_validate_ie_bitmaps() - Validate all IE whitelist bitmap param values
* @psoc: Pointer to psoc object
*
* Return: True if all bitmap values are valid, else false
*/
bool ucfg_validate_ie_bitmaps(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_fwol_get_all_whitelist_params() - Get all IE whitelist param values
* @psoc: Pointer to psoc object

View file

@ -290,28 +290,6 @@ QDF_STATUS ucfg_get_enable_phy_reg_retention(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_SUCCESS;
}
bool ucfg_validate_ie_bitmaps(struct wlan_objmgr_psoc *psoc)
{
struct wlan_fwol_psoc_obj *fwol_obj;
struct wlan_fwol_ie_whitelist whitelist = {0};
fwol_obj = fwol_get_psoc_obj(psoc);
if (!fwol_obj) {
fwol_err("Failed to get fwol obj");
return false;
}
whitelist = fwol_obj->cfg.ie_whitelist_cfg;
if (whitelist.ie_bitmap_0 && whitelist.ie_bitmap_1 &&
whitelist.ie_bitmap_2 && whitelist.ie_bitmap_3 &&
whitelist.ie_bitmap_4 && whitelist.ie_bitmap_5 &&
whitelist.ie_bitmap_6 && whitelist.ie_bitmap_7)
return true;
return false;
}
QDF_STATUS
ucfg_fwol_get_all_whitelist_params(struct wlan_objmgr_psoc *psoc,
struct wlan_fwol_ie_whitelist *whitelist)

View file

@ -62,9 +62,6 @@ struct hdd_context;
/* Number of items that can be configured */
#define MAX_CFG_INI_ITEMS 1024
#define MAX_PRB_REQ_VENDOR_OUI_INI_LEN 160
#define VENDOR_SPECIFIC_IE_BITMAP 0x20000000
#define CFG_CONCURRENT_IFACE_MAX_LEN 16
#define CFG_TX_AGGREGATION_SIZE_MIN 0
@ -7402,33 +7399,6 @@ enum hdd_link_speed_rpt_type {
#endif /* WLAN_SUPPORT_TWT */
/*
* For vendor specific IE, Probe Req OUI types and sub types which are
* to be white listed are specified in gProbeReqOUIs in the following
* example format - gProbeReqOUIs=AABBCCDD EEFF1122
*/
/*
* <ini>
* gProbeReqOUIs - Used to specify vendor specific OUIs
* @Default: Empty string
*
* This ini is used to include the specified OUIs in vendor specific IE
* of probe request.
*
* Related: Need to enable g_enable_probereq_whitelist_ies and
* vendor specific IE should be set in g_probe_req_ie_bitmap_6.
*
* Supported Feature: Probe request ie whitelisting
*
* Usage: Internal/External
*
* </ini>
*/
#define CFG_PROBE_REQ_OUI_NAME "gProbeReqOUIs"
#define CFG_PROBE_REQ_OUI_DEFAULT ""
/* End of probe request IE whitelisting feature ini params */
/*
* <ini>
* gScanBackoffMultiplier - For NLO/PNO, multiply fast scan period by this every
@ -9121,11 +9091,6 @@ struct hdd_config {
#endif
bool tx_orphan_enable;
/* Probe Request multiple vendor OUIs */
uint8_t probe_req_ouis[MAX_PRB_REQ_VENDOR_OUI_INI_LEN];
uint32_t no_of_probe_req_ouis;
uint32_t probe_req_voui[MAX_PROBE_REQ_OUIS];
uint8_t scan_backoff_multiplier;
bool mawc_nlo_enabled;
uint32_t mawc_nlo_exp_backoff_ratio;
@ -9329,36 +9294,6 @@ eCsrRoamWmmUserModeType hdd_to_csr_wmm_mode(enum hdd_wmm_user_mode mode);
/* Function declarations and documenation */
QDF_STATUS hdd_parse_config_ini(struct hdd_context *hdd_ctx);
/**
* hdd_validate_prb_req_ie_bitmap - validates user input for ie bit map
* @hdd_ctx: the pointer to hdd context
*
* This function checks whether user has entered valid probe request
* ie bitmap and also verifies vendor ouis if vendor specific ie is set
*
* Return: status of verification
* true - valid input
* false - invalid input
*/
bool hdd_validate_prb_req_ie_bitmap(struct hdd_context *hdd_ctx);
/**
* hdd_parse_probe_req_ouis - form ouis from ini gProbeReqOUIs
* @hdd_ctx: the pointer to hdd context
*
* This function parses the ini string gProbeReqOUIs which needs be to in the
* following format:
* "<8 characters of [0-9] or [A-F]>space<8 characters from [0-9] etc.,"
* example: "AABBCCDD 1122EEFF"
* and the logic counts the number of OUIS and allocates the memory
* for every valid OUI and is stored in struct hdd_context
*
* Return: status of parsing
* 0 - success
* negative value - failure
*/
int hdd_parse_probe_req_ouis(struct hdd_context *hdd_ctx);
QDF_STATUS hdd_update_mac_config(struct hdd_context *hdd_ctx);
QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx);
QDF_STATUS hdd_set_policy_mgr_user_cfg(struct hdd_context *hdd_ctx);

View file

@ -2967,11 +2967,6 @@ struct reg_table_entry g_registry_table[] = {
CFG_TWT_CONGESTION_TIMEOUT_MAX),
#endif
REG_VARIABLE_STRING(CFG_PROBE_REQ_OUI_NAME, WLAN_PARAM_String,
struct hdd_config, probe_req_ouis,
VAR_FLAGS_OPTIONAL,
(void *)CFG_PROBE_REQ_OUI_DEFAULT),
REG_VARIABLE(CFG_SCAN_BACKOFF_MULTIPLIER_NAME, WLAN_PARAM_Integer,
struct hdd_config, scan_backoff_multiplier,
VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@ -5389,87 +5384,6 @@ void hdd_get_pmkid_modes(struct hdd_context *hdd_ctx,
CFG_PMKID_MODES_PMKSA_CACHING) ? 1 : 0;
}
bool hdd_validate_prb_req_ie_bitmap(struct hdd_context *hdd_ctx)
{
struct wlan_fwol_ie_whitelist whitelist = {0};
struct wlan_objmgr_psoc *psoc = hdd_ctx->psoc;
QDF_STATUS status;
if (!psoc) {
hdd_err("HDD psoc got NULL");
return false;
}
if (!ucfg_validate_ie_bitmaps(psoc))
return false;
status = ucfg_fwol_get_all_whitelist_params(psoc, &whitelist);
if (QDF_IS_STATUS_ERROR(status)) {
hdd_err("Could not get IE bitmap 6");
return false;
}
/*
* check whether vendor oui IE is set and OUIs are present, each OUI
* is entered in the form of string of 8 characters from ini, therefore,
* for atleast one OUI, minimum length is 8 and hence this string length
* is checked for minimum of 8
*/
if ((whitelist.ie_bitmap_6 & VENDOR_SPECIFIC_IE_BITMAP) &&
(strlen(hdd_ctx->config->probe_req_ouis) < 8))
return false;
/* check whether vendor oui IE is not set but OUIs are present */
if (!(whitelist.ie_bitmap_6 & VENDOR_SPECIFIC_IE_BITMAP) &&
(strlen(hdd_ctx->config->probe_req_ouis) > 0))
return false;
return true;
}
int hdd_parse_probe_req_ouis(struct hdd_context *hdd_ctx)
{
uint32_t *voui = hdd_ctx->config->probe_req_voui;
char *str;
uint8_t *token;
uint32_t oui_indx = 0;
int ret;
uint32_t hex_value;
str = (char *)(hdd_ctx->config->probe_req_ouis);
str[MAX_PRB_REQ_VENDOR_OUI_INI_LEN - 1] = '\0';
hdd_ctx->config->no_of_probe_req_ouis = 0;
if (!strlen(str)) {
hdd_info("NO OUIS to parse");
return 0;
}
token = strsep(&str, " ");
while (token) {
if (strlen(token) != 8)
goto next_token;
ret = kstrtouint(token, 16, &hex_value);
if (ret)
goto next_token;
voui[oui_indx++] = cpu_to_be32(hex_value);
if (oui_indx >= MAX_PROBE_REQ_OUIS)
break;
next_token:
token = strsep(&str, " ");
}
if (!oui_indx)
return -EINVAL;
hdd_ctx->config->no_of_probe_req_ouis = oui_indx;
return 0;
}
/**
* hdd_update_nss() - Update the number of spatial streams supported.
* Ensure that nss is either 1 or 2 before calling this.

View file

@ -9089,57 +9089,6 @@ list_destroy:
return ret;
}
/**
* ie_whitelist_attrs_init() - initialize ie whitelisting attributes
* @hdd_ctx: pointer to hdd context
*
* Return: status of initialization
* 0 - success
* negative value - failure
*/
static int ie_whitelist_attrs_init(struct hdd_context *hdd_ctx)
{
struct wlan_objmgr_psoc *psoc = hdd_ctx->psoc;
int ret;
QDF_STATUS status;
bool is_ie_whitelist_enable = false;
if (!psoc) {
hdd_err("HDD psoc got NULL");
return -EINVAL;
}
status = ucfg_fwol_get_ie_whitelist(psoc, &is_ie_whitelist_enable);
if (QDF_IS_STATUS_ERROR(status))
return qdf_status_to_os_return(status);
if (!is_ie_whitelist_enable)
return 0;
if (!hdd_validate_prb_req_ie_bitmap(hdd_ctx)) {
hdd_err("invalid ie bitmap and ouis: disable ie whitelisting");
status = ucfg_fwol_set_ie_whitelist(psoc, false);
if (QDF_IS_STATUS_ERROR(status)) {
hdd_err("Could not set IE whitelist param");
return qdf_status_to_os_return(status);
}
return -EINVAL;
}
/* parse ini string probe req oui */
ret = hdd_parse_probe_req_ouis(hdd_ctx);
if (ret) {
hdd_err("parsing error: disable ie whitelisting");
status = ucfg_fwol_set_ie_whitelist(psoc, false);
if (QDF_IS_STATUS_ERROR(status)) {
hdd_err("Could not set IE whitelist param");
return qdf_status_to_os_return(status);
}
}
return ret;
}
/**
* hdd_iface_change_callback() - Function invoked when stop modules expires
* @priv: pointer to hdd context
@ -9324,8 +9273,6 @@ static struct hdd_context *hdd_context_create(struct device *dev)
hdd_cfg_params_init(hdd_ctx);
ie_whitelist_attrs_init(hdd_ctx);
hdd_debug("setting timer multiplier: %u",
hdd_ctx->config->timer_multiplier);
qdf_timer_set_multiplier(hdd_ctx->config->timer_multiplier);
@ -14026,7 +13973,6 @@ void hdd_update_ie_whitelist_attr(struct probe_req_whitelist_attr *ie_whitelist,
{
struct wlan_fwol_ie_whitelist whitelist = {0};
struct wlan_objmgr_psoc *psoc = hdd_ctx->psoc;
struct hdd_config *cfg = hdd_ctx->config;
QDF_STATUS status;
bool is_ie_whitelist_enable = false;
uint8_t i = 0;
@ -14056,9 +14002,9 @@ void hdd_update_ie_whitelist_attr(struct probe_req_whitelist_attr *ie_whitelist,
ie_whitelist->ie_bitmap[6] = whitelist.ie_bitmap_6;
ie_whitelist->ie_bitmap[7] = whitelist.ie_bitmap_7;
ie_whitelist->num_vendor_oui = cfg->no_of_probe_req_ouis;
ie_whitelist->num_vendor_oui = whitelist.no_of_probe_req_ouis;
for (i = 0; i < ie_whitelist->num_vendor_oui; i++)
ie_whitelist->voui[i] = cfg->probe_req_voui[i];
ie_whitelist->voui[i] = whitelist.probe_req_voui[i];
}
uint32_t hdd_limit_max_per_index_score(uint32_t per_index_score)