diff --git a/core/cds/inc/cds_config.h b/core/cds/inc/cds_config.h index 01f3d2aa2e95..546ba1284ea5 100644 --- a/core/cds/inc/cds_config.h +++ b/core/cds/inc/cds_config.h @@ -54,6 +54,20 @@ enum cfg_sub_20_channel_width { WLAN_SUB_20_CH_WIDTH_10 = 2, }; +/** + * enum active_bpf_mode - the modes active BPF can operate in + * @ACTIVE_BPF_DISABLED: BPF is disabled in active mode + * @ACTIVE_BPF_ENABLED: BPF is enabled for all packets + * @ACTIVE_BPF_ADAPTIVE: BPF is enabled for packets up to some threshold + * @ACTIVE_BPF_MODE_COUNT: The number of active BPF modes + */ +enum active_bpf_mode { + ACTIVE_BPF_DISABLED = 0, + ACTIVE_BPF_ENABLED, + ACTIVE_BPF_ADAPTIVE, + ACTIVE_BPF_MODE_COUNT +}; + /** * struct cds_config_info - Place Holder for cds configuration * @max_station: Max station supported @@ -99,6 +113,7 @@ enum cfg_sub_20_channel_width { * @sub_20_channel_width: Sub 20 MHz ch width, ini intersected with fw cap * @flow_steering_enabled: Receive flow steering. * @is_fw_timeout: Indicate whether crash host when fw timesout or not + * @active_bpf_mode: Setting that determines how BPF is applied in active mode * Structure for holding cds ini parameters. */ @@ -151,7 +166,7 @@ struct cds_config_info { bool flow_steering_enabled; bool self_recovery_enabled; bool fw_timeout_crash; - struct ol_tx_sched_wrr_ac_specs_t ac_specs[TX_WMM_AC_NUM]; + enum active_bpf_mode active_bpf_mode; }; #endif /* !defined( __CDS_CONFIG_H ) */ diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 6aff078e8c59..c44016b962f7 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -9062,6 +9062,30 @@ enum hdd_wext_control { * Type declarations */ +/* + * + * gActiveBpfMode - Control active BPF mode + * @Min: 0 (disabled) + * @Max: 2 (adaptive) + * @Default: 0 (disabled) + * + * This config item is used to control BPF in active mode. There are 3 modes: + * 0) disabled - BPF is disabled in active mode + * 1) enabled - BPF is enabled for all packets in active mode + * 2) adaptive - BPF is enabled for packets up to some throughput threshold + * + * Related: N/A + * + * Supported Feature: Active Mode BPF + * + * Usage: Internal/External + * + */ +#define CFG_ACTIVE_BPF_MODE_NAME "gActiveBpfMode" +#define CFG_ACTIVE_BPF_MODE_MIN (ACTIVE_BPF_DISABLED) +#define CFG_ACTIVE_BPF_MODE_MAX (ACTIVE_BPF_MODE_COUNT - 1) +#define CFG_ACTIVE_BPF_MODE_DEFAULT (ACTIVE_BPF_DISABLED) + struct hdd_config { /* Bitmap to track what is explicitly configured */ DECLARE_BITMAP(bExplicitCfg, MAX_CFG_INI_ITEMS); @@ -9766,6 +9790,7 @@ struct hdd_config { uint32_t per_roam_th_percent; uint32_t per_roam_rest_time; uint32_t per_roam_mon_time; + enum active_bpf_mode active_bpf_mode; }; #define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var)) diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 6e56d8c619d0..2fa75c99c821 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -4251,6 +4251,12 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_PER_ROAM_MONITOR_TIME_MIN, CFG_PER_ROAM_MONITOR_TIME_MAX), + REG_VARIABLE(CFG_ACTIVE_BPF_MODE_NAME, WLAN_PARAM_Integer, + struct hdd_config, active_bpf_mode, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_ACTIVE_BPF_MODE_DEFAULT, + CFG_ACTIVE_BPF_MODE_MIN, + CFG_ACTIVE_BPF_MODE_MAX), }; /** diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index dbe598bcb04b..a1351a17a5f4 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -7604,6 +7604,7 @@ static int hdd_update_cds_config(hdd_context_t *hdd_ctx) cds_cfg->flow_steering_enabled = hdd_ctx->config->flow_steering_enable; cds_cfg->self_recovery_enabled = hdd_ctx->config->enableSelfRecovery; cds_cfg->fw_timeout_crash = hdd_ctx->config->fw_timeout_crash; + cds_cfg->active_bpf_mode = hdd_ctx->config->active_bpf_mode; hdd_ra_populate_cds_config(cds_cfg, hdd_ctx); hdd_txrx_populate_cds_config(cds_cfg, hdd_ctx); diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 1262794d8b3f..feacec7167fc 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -1374,7 +1374,8 @@ struct extended_caps { * It contains global wma module parameters and * handle of other modules. * @saved_wmi_init_cmd: Saved WMI INIT command - * @bool bpf_packet_filter_enable: BPF filter enabled or not + * @bpf_packet_filter_enable: BPF filter enabled or not + * @active_bpf_mode: Setting that determines how BPF is applied in active mode * @service_ready_ext_evt: Wait event for service ready ext * @wmi_cmd_rsp_wake_lock: wmi command response wake lock * @wmi_cmd_rsp_runtime_lock: wmi command response bus lock @@ -1549,6 +1550,7 @@ typedef struct { uint32_t fine_time_measurement_cap; bool bpf_enabled; bool bpf_packet_filter_enable; + enum active_bpf_mode active_bpf_mode; struct wma_ini_config ini_config; struct wma_valid_channels saved_chan; /* NAN datapath support enabled in firmware */ diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index 5c87025923f1..9ea5fafabb64 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -59,7 +59,6 @@ #endif /* REMOVE_PKT_LOG */ #include "dbglog_host.h" -/* FIXME: Inclusion of .c looks odd but this is how it is in internal codebase */ #include "csr_api.h" #include "dfs.h" @@ -1356,6 +1355,44 @@ static int wma_remove_bss_peer(tp_wma_handle wma, void *pdev, return 0; } +/** + * wma_config_active_bpf_mode() - Config active BPF mode in FW + * @wma: the WMA handle + * @vdev_id: the Id of the vdev for which the configuration should be applied + * + * Return: QDF status + */ +static QDF_STATUS wma_config_active_bpf_mode(t_wma_handle *wma, uint8_t vdev_id) +{ + /* for now, hard code mc/bc mode to enabled */ + const enum wmi_host_active_bpf_mode mcbc_mode = + WMI_HOST_ACTIVE_BPF_ENABLED; + enum wmi_host_active_bpf_mode uc_mode; + + WMA_LOGI("Configuring Active BPF Mode %d for vdev %u", + wma->active_bpf_mode, vdev_id); + + switch (wma->active_bpf_mode) { + case ACTIVE_BPF_DISABLED: + uc_mode = FW_ACTIVE_BPF_MODE_DISABLE; + break; + case ACTIVE_BPF_ENABLED: + uc_mode = FW_ACTIVE_BPF_MODE_FORCE_ENABLE; + break; + case ACTIVE_BPF_ADAPTIVE: + uc_mode = FW_ACTIVE_BPF_MODE_ADAPTIVE_ENABLE; + break; + default: + WMA_LOGE("Invalid Active BPF Mode %d; Using 'disabled'", + wma->active_bpf_mode); + uc_mode = FW_ACTIVE_BPF_MODE_DISABLE; + break; + } + + return wmi_unified_set_active_bpf_mode_cmd(wma->wmi_handle, vdev_id, + uc_mode, mcbc_mode); +} + /** * wma_vdev_stop_resp_handler() - vdev stop response handler * @handle: wma handle @@ -1784,6 +1821,14 @@ struct cdp_vdev *wma_vdev_attach(tp_wma_handle wma_handle, } else { WMA_LOGE("Failed to get value for WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED, leaving unchanged"); } + + if (self_sta_req->type == WMI_VDEV_TYPE_STA) { + status = wma_config_active_bpf_mode(wma_handle, + self_sta_req->session_id); + if (QDF_IS_STATUS_ERROR(status)) + WMA_LOGE("Failed to configure active BPF mode"); + } + end: self_sta_req->status = status; diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 10df1060cace..4b2fef81f41c 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -2193,6 +2193,7 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, void *cds_context, wma_handle->enable_mc_list = cds_cfg->enable_mc_list; wma_handle->bpf_packet_filter_enable = cds_cfg->bpf_packet_filter_enable; + wma_handle->active_bpf_mode = cds_cfg->active_bpf_mode; wma_handle->link_stats_results = NULL; #ifdef FEATURE_WLAN_RA_FILTERING wma_handle->IsRArateLimitEnabled = cds_cfg->is_ra_ratelimit_enabled;