diff --git a/components/pmo/core/inc/wlan_pmo_static_config.h b/components/pmo/core/inc/wlan_pmo_static_config.h index ffa2ba4212041..c6895ce653cd8 100644 --- a/components/pmo/core/inc/wlan_pmo_static_config.h +++ b/components/pmo/core/inc/wlan_pmo_static_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-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 @@ -81,8 +81,7 @@ void pmo_update_target_service(struct wlan_objmgr_psoc *psoc, * * Return: none */ -void pmo_update_ra_limit(struct wlan_objmgr_psoc *psoc, - bool bpf_enabled); +void pmo_update_ra_limit(struct wlan_objmgr_psoc *psoc, bool bpf_enabled); /** * pmo_set_wow_event_bitmap() - Assign bitmask with wow event diff --git a/components/pmo/core/src/wlan_pmo_wow.c b/components/pmo/core/src/wlan_pmo_wow.c index c812ebf4f240f..e1d271032871c 100644 --- a/components/pmo/core/src/wlan_pmo_wow.c +++ b/components/pmo/core/src/wlan_pmo_wow.c @@ -63,7 +63,7 @@ QDF_STATUS pmo_core_add_wow_user_pattern(struct wlan_objmgr_vdev *vdev, * function (1 in mask value will become FF and 0 will * become 00), * - * Mask value : FF:00:FF:00:0:00:00:FF + * Mask value : FF:00:FF:00:00:00:00:FF * Pattern value : 12:00:13:00:00:00:00:44 */ qdf_mem_zero(new_mask, sizeof(new_mask)); diff --git a/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h b/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h index 770f39fe65036..9456541feabf4 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_common_public_struct.h @@ -273,7 +273,6 @@ enum pmo_auto_pwr_detect_failure_mode { * @active_mode_offload: true if psoc supports active mode offload else false * @ap_arpns_support: true if psoc supports arp ns for ap mode * @d0_wow_supported: true if psoc supports D0 wow command - * @max_wow_filters: maximum number of wow filter supported * @ra_ratelimit_enable: true when ra filtering ins eanbled else false * @ra_ratelimit_interval: ra packets interval * @magic_ptrn_enable: true when magic pattern is enabled else false @@ -302,7 +301,6 @@ struct pmo_psoc_cfg { bool active_mode_offload; bool ap_arpns_support; bool d0_wow_supported; - uint8_t max_wow_filters; bool ra_ratelimit_enable; uint16_t ra_ratelimit_interval; bool magic_ptrn_enable; diff --git a/components/pmo/dispatcher/inc/wlan_pmo_wow_public_struct.h b/components/pmo/dispatcher/inc/wlan_pmo_wow_public_struct.h index 3dc138ed1ff89..601fae2bf18eb 100644 --- a/components/pmo/dispatcher/inc/wlan_pmo_wow_public_struct.h +++ b/components/pmo/dispatcher/inc/wlan_pmo_wow_public_struct.h @@ -30,7 +30,6 @@ #define PMO_WOWL_PTRN_MAX_SIZE 146 #define PMO_WOWL_PTRN_MASK_MAX_SIZE 19 -#define PMO_WOWL_MAX_PTRNS_ALLOWED CFG_MAX_WOW_FILTERS_MAX #define PMO_WOWL_BCAST_PATTERN_MAX_SIZE 146 #define PMO_WOW_INTER_PTRN_TOKENIZER ';' diff --git a/core/cds/inc/cds_config.h b/core/cds/inc/cds_config.h index d06b3b35b1996..79b8783b1b2a8 100644 --- a/core/cds/inc/cds_config.h +++ b/core/cds/inc/cds_config.h @@ -65,9 +65,7 @@ enum active_bpf_mode { * @sta_mod_dtim: station mode DTIM * @sta_dynamic_dtim: station dynamic DTIM * @driver_type: Enumeration of Driver Type whether FTM or Mission mode - * @max_wow_filters: Max wow filters to be configured to fw * @wow_enable: Indicate whether wow is enabled or not - * @ol_ini_info: Status of offload enabled from ini 1st bit for arm,2nd for NS * currently rest of bits are not used * @ssdp: Indicate ssdp is enabled or not * @enable_mc_list : To Check if Multicast list filtering is enabled in FW @@ -122,9 +120,7 @@ struct cds_config_info { uint8_t sta_mod_dtim; uint8_t sta_dynamic_dtim; enum qdf_driver_type driver_type; - uint8_t max_wow_filters; uint8_t wow_enable; - uint8_t ol_ini_info; bool ssdp; bool enable_mc_list; uint8_t dfs_phyerr_filter_offload; diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index cb477935bb4de..80e1ef1a72431 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -10687,28 +10687,6 @@ enum hdd_wext_control { #define CFG_WOWL_PATTERN_NAME "gWowlPattern" #define CFG_WOWL_PATTERN_DEFAULT "" -/* - * - * gMaxWoWFilters - Maximum WoW patterns that can be configured - * @Min: 0 - * @Max: WOW_MAX_BITMAP_FILTERS(32) - * @Default: WOW_MAX_BITMAP_FILTERS(32) - * - * This ini is used to set the maximum WoW patterns that can be configured - * - * Related: gWowlPattern - * - * Supported Feature: Power Save - * - * Usage: External - * - * - */ -#define CFG_MAX_WOW_FILTERS_NAME "gMaxWoWFilters" -#define CFG_MAX_WOW_FILTERS_MIN (0) -#define CFG_MAX_WOW_FILTERS_MAX (WOW_MAX_BITMAP_FILTERS) -#define CFG_MAX_WOW_FILTERS_DEFAULT (WOW_MAX_BITMAP_FILTERS) - /* * * gper_min_rssi_threshold_for_roam - Minimum roamable AP RSSI for @@ -14867,7 +14845,6 @@ struct hdd_config { #ifdef FEATURE_WLAN_AUTO_SHUTDOWN uint32_t WlanAutoShutdown; #endif - uint8_t maxWoWFilters; uint8_t wowEnable; uint8_t maxNumberOfPeers; uint8_t disableDFSChSwitch; diff --git a/core/hdd/inc/wlan_hdd_wowl.h b/core/hdd/inc/wlan_hdd_wowl.h index a1b30fa652a96..913cbd0a1025f 100644 --- a/core/hdd/inc/wlan_hdd_wowl.h +++ b/core/hdd/inc/wlan_hdd_wowl.h @@ -103,10 +103,11 @@ */ #include +#include "wlan_pmo_wow.h" -#define WOWL_PTRN_MAX_SIZE 146 -#define WOWL_PTRN_MASK_MAX_SIZE 19 -#define WOWL_MAX_PTRNS_ALLOWED CFG_MAX_WOW_FILTERS_MAX +#define WOWL_PTRN_MAX_SIZE 146 +#define WOWL_PTRN_MASK_MAX_SIZE 19 +#define WOWL_MAX_PTRNS_ALLOWED PMO_WOW_FILTERS_MAX /** * hdd_add_wowl_ptrn() - Function which will add the WoWL pattern to be diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index ac8a4c1f55f32..ee7e487e55b4b 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -2823,13 +2823,6 @@ struct reg_table_entry g_registry_table[] = { CFG_VHT_MPDU_LEN_MIN, CFG_VHT_MPDU_LEN_MAX), - REG_VARIABLE(CFG_MAX_WOW_FILTERS_NAME, WLAN_PARAM_Integer, - struct hdd_config, maxWoWFilters, - VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, - CFG_MAX_WOW_FILTERS_DEFAULT, - CFG_MAX_WOW_FILTERS_MIN, - CFG_MAX_WOW_FILTERS_MAX), - REG_VARIABLE(CFG_WOW_STATUS_NAME, WLAN_PARAM_Integer, struct hdd_config, wowEnable, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 0475f677e1dc3..f9a9712faf854 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1998,14 +1998,6 @@ void hdd_update_tgt_cfg(void *context, void *param) */ hdd_update_wiphy_vhtcap(hdd_ctx); - /* - * If BPF is enabled, maxWowFilters set to WMA_STA_WOW_DEFAULT_PTRN_MAX - * because we need atleast WMA_STA_WOW_DEFAULT_PTRN_MAX free slots to - * configure the STA mode wow pattern. - */ - if (hdd_ctx->bpf_enabled) - hdd_ctx->config->maxWoWFilters = WMA_STA_WOW_DEFAULT_PTRN_MAX; - hdd_ctx->wmi_max_len = cfg->wmi_max_len; /* @@ -8842,16 +8834,6 @@ static int hdd_update_cds_config(struct hdd_context *hdd_ctx) cds_cfg->sta_mod_dtim = hdd_ctx->config->enableModulatedDTIM; cds_cfg->sta_maxlimod_dtim = hdd_ctx->config->fMaxLIModulatedDTIM; cds_cfg->wow_enable = hdd_ctx->config->wowEnable; - cds_cfg->max_wow_filters = hdd_ctx->config->maxWoWFilters; - - /* Here ol_ini_info is used to store ini status of arp offload - * ns offload and others. Currently 1st bit is used for arp - * off load and 2nd bit for ns offload currently, rest bits are unused - */ - if (hdd_ctx->config->fhostArpOffload) - cds_cfg->ol_ini_info = cds_cfg->ol_ini_info | 0x1; - if (hdd_ctx->config->fhostNSOffload) - cds_cfg->ol_ini_info = cds_cfg->ol_ini_info | 0x2; /* * Copy the DFS Phyerr Filtering Offload status. @@ -12644,7 +12626,6 @@ static int hdd_update_pmo_config(struct hdd_context *hdd_ctx) psoc_cfg.active_mode_offload = hdd_ctx->config->active_mode_offload; psoc_cfg.ap_arpns_support = hdd_ctx->ap_arpns_support; psoc_cfg.d0_wow_supported = wma_d0_wow_is_supported(); - psoc_cfg.max_wow_filters = hdd_ctx->config->maxWoWFilters; psoc_cfg.sta_dynamic_dtim = hdd_ctx->config->enableDynamicDTIM; psoc_cfg.sta_mod_dtim = hdd_ctx->config->enableModulatedDTIM; psoc_cfg.sta_max_li_mod_dtim = hdd_ctx->config->fMaxLIModulatedDTIM; diff --git a/core/hdd/src/wlan_hdd_wowl.c b/core/hdd/src/wlan_hdd_wowl.c index 2822458d7649b..d76b79577a5ba 100644 --- a/core/hdd/src/wlan_hdd_wowl.c +++ b/core/hdd/src/wlan_hdd_wowl.c @@ -33,6 +33,7 @@ /* Include Files */ +#include "qdf_str.h" #include #include #include @@ -81,6 +82,23 @@ static void dump_hdd_wowl_ptrn(struct pmo_wow_add_pattern *ptrn) hdd_info("%02X", ptrn->pattern_mask[i]); } +static QDF_STATUS +hdd_get_num_wow_filters(struct hdd_context *hdd_ctx, uint8_t *num_filters) +{ + QDF_STATUS status; + struct wlan_objmgr_psoc *psoc = hdd_ctx->hdd_psoc; + + status = wlan_objmgr_psoc_try_get_ref(psoc, WLAN_HDD_ID_OBJ_MGR); + if (QDF_IS_STATUS_ERROR(status)) + return status; + + *num_filters = ucfg_pmo_get_num_wow_filters(hdd_ctx->hdd_psoc); + + wlan_objmgr_psoc_release_ref(psoc, WLAN_HDD_ID_OBJ_MGR); + + return QDF_STATUS_SUCCESS; +} + /** * hdd_add_wowl_ptrn() - Function which will add the WoWL pattern to be * used when PBM filtering is enabled @@ -92,49 +110,46 @@ static void dump_hdd_wowl_ptrn(struct pmo_wow_add_pattern *ptrn) bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn) { struct pmo_wow_add_pattern localPattern; - int i, first_empty_slot, len, offset; - QDF_STATUS qdf_ret_status; + int i, empty_slot, len, offset; + QDF_STATUS status; const char *temp; uint8_t sessionId = adapter->session_id; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + uint8_t num_filters; - len = find_ptrn_len(ptrn); + status = hdd_get_num_wow_filters(hdd_ctx, &num_filters); + if (QDF_IS_STATUS_ERROR(status)) + return false; /* There has to have at least 1 byte for each field (pattern * size, mask size, pattern, mask) e.g. PP:QQ:RR:SS ==> 11 * chars */ + len = find_ptrn_len(ptrn); while (len >= 11) { - /* Detect duplicate pattern */ - for (i = 0; i < hdd_ctx->config->maxWoWFilters; i++) { - if (g_hdd_wowl_ptrns[i] == NULL) + empty_slot = -1; + + /* check if pattern is already configured */ + for (i = num_filters - 1; i >= 0; i--) { + if (g_hdd_wowl_ptrns[i] == NULL) { + empty_slot = i; continue; + } if (!memcmp(ptrn, g_hdd_wowl_ptrns[i], len)) { - /* Pattern Already configured, skip to - * next pattern - */ - hdd_err("Trying to add duplicate WoWL pattern. Skip it!"); + hdd_err("WoWL pattern '%s' already configured", + g_hdd_wowl_ptrns[i]); ptrn += len; goto next_ptrn; } } - first_empty_slot = -1; - - /* Find an empty slot to store the pattern */ - for (i = 0; i < hdd_ctx->config->maxWoWFilters; i++) { - if (g_hdd_wowl_ptrns[i] == NULL) { - first_empty_slot = i; - break; - } - } - /* Maximum number of patterns have been configured already */ - if (first_empty_slot == -1) { - hdd_err("Cannot add anymore patterns. No free slot!"); + if (empty_slot == -1) { + hdd_err("Max WoW patterns (%u) reached", num_filters); return false; } + /* Validate the pattern */ if (ptrn[2] != WOWL_INTRA_PTRN_TOKENIZER || ptrn[5] != WOWL_INTRA_PTRN_TOKENIZER) { @@ -142,15 +157,14 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn) ptrn += len; goto next_ptrn; } + /* Extract the pattern size */ localPattern.pattern_size = - (hex_to_bin(ptrn[0]) * 0x10) + - hex_to_bin(ptrn[1]); + (hex_to_bin(ptrn[0]) * 0x10) + hex_to_bin(ptrn[1]); /* Extract the pattern mask size */ localPattern.pattern_mask_size = - (hex_to_bin(ptrn[3]) * 0x10) + - hex_to_bin(ptrn[4]); + (hex_to_bin(ptrn[3]) * 0x10) + hex_to_bin(ptrn[4]); if (localPattern.pattern_size > PMO_WOWL_BCAST_PATTERN_MAX_SIZE || localPattern.pattern_mask_size > @@ -159,6 +173,7 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn) ptrn += len; goto next_ptrn; } + /* compute the offset of tokenizer after the pattern */ offset = 5 + 2 * localPattern.pattern_size + 1; if ((offset >= len) || @@ -167,6 +182,7 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn) ptrn += len; goto next_ptrn; } + /* compute the end of pattern sring */ offset = offset + 2 * localPattern.pattern_mask_size; if (offset + 1 != len) { @@ -201,28 +217,27 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn) } /* All is good. Store the pattern locally */ - g_hdd_wowl_ptrns[first_empty_slot] = - qdf_mem_malloc(len + 1); - if (g_hdd_wowl_ptrns[first_empty_slot] == NULL) { + g_hdd_wowl_ptrns[empty_slot] = qdf_mem_malloc(len + 1); + if (g_hdd_wowl_ptrns[empty_slot] == NULL) { hdd_err("memory allocation failure"); return false; } - memcpy(g_hdd_wowl_ptrns[first_empty_slot], temp, len); - g_hdd_wowl_ptrns[first_empty_slot][len] = '\0'; - localPattern.pattern_id = first_empty_slot; + memcpy(g_hdd_wowl_ptrns[empty_slot], temp, len); + g_hdd_wowl_ptrns[empty_slot][len] = '\0'; + localPattern.pattern_id = empty_slot; localPattern.pattern_byte_offset = 0; localPattern.session_id = sessionId; /* Register the pattern downstream */ - qdf_ret_status = pmo_ucfg_add_wow_user_pattern( + status = pmo_ucfg_add_wow_user_pattern( adapter->hdd_vdev, &localPattern); - if (!QDF_IS_STATUS_SUCCESS(qdf_ret_status)) { + if (QDF_IS_STATUS_ERROR(status)) { /* Add failed, so invalidate the local storage */ hdd_err("sme_wowl_add_bcast_pattern failed with error code (%d)", - qdf_ret_status); - qdf_mem_free(g_hdd_wowl_ptrns[first_empty_slot]); - g_hdd_wowl_ptrns[first_empty_slot] = NULL; + status); + qdf_mem_free(g_hdd_wowl_ptrns[empty_slot]); + g_hdd_wowl_ptrns[empty_slot] = NULL; } dump_hdd_wowl_ptrn(&localPattern); @@ -233,8 +248,9 @@ next_ptrn: ptrn += 1; len = find_ptrn_len(ptrn); continue; - } else + } else { break; + } } return true; @@ -249,36 +265,42 @@ next_ptrn: */ bool hdd_del_wowl_ptrn(struct hdd_adapter *adapter, const char *ptrn) { - unsigned char id; + uint8_t id; bool patternFound = false; - QDF_STATUS qdf_ret_status; + QDF_STATUS status; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + uint8_t num_filters; - /* Detect pattern */ - for (id = 0; - id < hdd_ctx->config->maxWoWFilters - && g_hdd_wowl_ptrns[id] != NULL; id++) { - if (!strcmp(ptrn, g_hdd_wowl_ptrns[id])) { + status = hdd_get_num_wow_filters(hdd_ctx, &num_filters); + if (QDF_IS_STATUS_ERROR(status)) + return false; + + /* lookup pattern */ + for (id = 0; id < num_filters; id++) { + if (!g_hdd_wowl_ptrns[id]) + continue; + + if (qdf_str_eq(ptrn, g_hdd_wowl_ptrns[id])) { patternFound = true; break; } } /* If pattern present, remove it from downstream */ - if (patternFound) { - qdf_ret_status = pmo_ucfg_del_wow_user_pattern( - adapter->hdd_vdev, id); - if (QDF_IS_STATUS_SUCCESS(qdf_ret_status)) { - /* Remove from local storage as well */ - hdd_err("Deleted pattern with id %d [%s]", id, - g_hdd_wowl_ptrns[id]); + if (!patternFound) + return false; - qdf_mem_free(g_hdd_wowl_ptrns[id]); - g_hdd_wowl_ptrns[id] = NULL; - return true; - } - } - return false; + status = pmo_ucfg_del_wow_user_pattern(adapter->hdd_vdev, id); + if (QDF_IS_STATUS_ERROR(status)) + return false; + + /* Remove from local storage as well */ + hdd_err("Deleted pattern with id %d [%s]", id, g_hdd_wowl_ptrns[id]); + + qdf_mem_free(g_hdd_wowl_ptrns[id]); + g_hdd_wowl_ptrns[id] = NULL; + + return true; } /** diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 52f97d608e853..fe227d6e1fcea 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -270,7 +270,6 @@ enum ds_mode { #define WMA_NUM_BITS_IN_BYTE 8 #define WMA_AP_WOW_DEFAULT_PTRN_MAX 4 -#define WMA_STA_WOW_DEFAULT_PTRN_MAX 5 #define WMA_BSS_STATUS_STARTED 0x1 #define WMA_BSS_STATUS_STOPPED 0x2 @@ -1277,7 +1276,6 @@ struct hw_mode_idx_to_mac_cap_idx { * @pGetRssiReq: get RSSI request * @thermal_mgmt_info: Thermal mitigation related info * @roam_offload_enabled: is roam offload enable/disable - * @ol_ini_info: store ini status of arp offload, ns offload * @ssdp: ssdp flag * @enable_mc_list : To Check if Multicast list filtering is enabled in FW * @ibss_started: is IBSS started or not @@ -1427,13 +1425,6 @@ typedef struct { struct qdf_mac_addr peer_macaddr; t_thermal_mgmt thermal_mgmt_info; bool roam_offload_enabled; - /* Here ol_ini_info is used to store ini - * status of arp offload, ns offload - * and others. Currently 1st bit is used - * for arp off load and 2nd bit for ns - * offload currently, rest bits are unused - */ - uint8_t ol_ini_info; bool ssdp; bool enable_mc_list; uint8_t ibss_started; diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index e0e72c5449a3a..5b0a7a080d4a5 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -2972,7 +2972,6 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, cds_cfg->max_bssid = WMA_MAX_SUPPORTED_BSS; - wlan_res_cfg->num_wow_filters = cds_cfg->max_wow_filters; wlan_res_cfg->num_keep_alive_pattern = WMA_MAXNUM_PERIODIC_TX_PTRNS; /* The current firmware implementation requires the number of @@ -2984,7 +2983,6 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, wlan_res_cfg->num_offload_reorder_buffs = cds_cfg->ap_maxoffload_reorderbuffs + 1; - wma_handle->ol_ini_info = cds_cfg->ol_ini_info; wma_handle->max_station = cds_cfg->max_station; wma_handle->max_bssid = cds_cfg->max_bssid; wma_handle->driver_type = cds_cfg->driver_type;