diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index c4ac96600e..8db4b79d4f 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -2828,6 +2828,15 @@ typedef enum { #define CFG_ACTIVE_MODE_OFFLOAD_DEFAULT (0) #endif +/* + * 0: Disable BPF packet filter + * 1: Enable BPF packet filter + */ +#define CFG_BPF_PACKET_FILTER_OFFLOAD "gBpfFilterEnable" +#define CFG_BPF_PACKET_FILTER_OFFLOAD_MIN (0) +#define CFG_BPF_PACKET_FILTER_OFFLOAD_MAX (1) +#define CFG_BPF_PACKET_FILTER_OFFLOAD_DEFAULT (1) + /* * 0: disable the cck tx chain mask (default) * 1: enable the cck tx chain mask @@ -4044,6 +4053,7 @@ struct hdd_config { bool tso_enable; bool lro_enable; bool active_mode_offload; + bool bpf_packet_filter_enable; uint32_t fine_time_meas_cap; uint8_t max_scan_count; #ifdef WLAN_FEATURE_FASTPATH diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index c905752b18..6b38770d72 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -3525,6 +3525,13 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_LRO_ENABLED_MIN, CFG_LRO_ENABLED_MAX), + REG_VARIABLE(CFG_BPF_PACKET_FILTER_OFFLOAD, WLAN_PARAM_Integer, + struct hdd_config, bpf_packet_filter_enable, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_BPF_PACKET_FILTER_OFFLOAD_DEFAULT, + CFG_BPF_PACKET_FILTER_OFFLOAD_MIN, + CFG_BPF_PACKET_FILTER_OFFLOAD_MAX), + REG_VARIABLE(CFG_ACTIVE_MODE_OFFLOAD, WLAN_PARAM_Integer, struct hdd_config, active_mode_offload, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, @@ -5668,6 +5675,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx) hdd_info("Name = [%s] Value = [%s]", CFG_RM_CAPABILITY_NAME, pHddCtx->config->rm_capability); + hdd_info("Name = [%s] Value = [%d]", + CFG_BPF_PACKET_FILTER_OFFLOAD, + pHddCtx->config->bpf_packet_filter_enable); } diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 5274ff9cdf..0e3785e9fc 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -6191,7 +6191,7 @@ __wlan_hdd_cfg80211_bpf_offload(struct wiphy *wiphy, } if (!hdd_ctx->bpf_enabled) { - hdd_err("BPF offload is not supported by firmware"); + hdd_err("BPF offload is not supported/enabled"); return -ENOTSUPP; } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 580369068d..60ded03db9 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1492,7 +1492,10 @@ void hdd_update_tgt_cfg(void *context, void *param) hdd_info("Init current antenna mode: %d", hdd_ctx->current_antenna_mode); - hdd_ctx->bpf_enabled = cfg->bpf_enabled; + hdd_info("Target BPF %d Host BPF %d", + cfg->bpf_enabled, hdd_ctx->config->bpf_packet_filter_enable); + hdd_ctx->bpf_enabled = (cfg->bpf_enabled && + hdd_ctx->config->bpf_packet_filter_enable); /* Configure NAN datapath features */ hdd_nan_datapath_target_config(hdd_ctx, cfg); }