Эх сурвалжийг харах

qcacld-3.0: Add ini param to control active BPF for MC/BC packets

Add new ini parameter, gActiveMcBcBpfMode, to control active BPF
mode for MC/BC packets. By default its value is set disable.
Also, rename ini param name to gActiveUcBpfMode from gActiveBpfMode
and respective cfg variable name to active_uc_bpf_mode from
active_bpf_mode.

Change-Id: I1a42351585c34e7b6da8c26af9ac7b7abe0c0322
CRs-Fixed: 2032699
Hanumanth Reddy Pothula 8 жил өмнө
parent
commit
e87621b5ab

+ 6 - 2
core/cds/inc/cds_config.h

@@ -113,7 +113,10 @@ enum active_bpf_mode {
  * @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
+ * @active_uc_bpf_mode: Setting that determines how BPF is applied in active
+ *	mode for uc packets
+ * @active_mc_bc_bpf_mode: Setting that determines how BPF is applied in
+ *	active mode for MC/BC packets
  * Structure for holding cds ini parameters.
  */
 
@@ -167,6 +170,7 @@ struct cds_config_info {
 	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;
+	enum active_bpf_mode active_uc_bpf_mode;
+	enum active_bpf_mode active_mc_bc_bpf_mode;
 };
 #endif /* !defined( __CDS_CONFIG_H ) */

+ 33 - 8
core/hdd/inc/wlan_hdd_cfg.h

@@ -9649,27 +9649,51 @@ enum hdd_wext_control {
 
 /*
  * <ini>
- * gActiveBpfMode - Control active BPF mode
+ * gActiveUcBpfMode - Control UC 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:
+ * This config item controls UC 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
+ * Related: gActiveMcBcBpfMode
+ *
+ * Supported Feature: Active Mode BPF
+ *
+ * Usage: Internal/External
+ * </ini>
+ */
+#define CFG_ACTIVE_UC_BPF_MODE_NAME    "gActiveUcBpfMode"
+#define CFG_ACTIVE_UC_BPF_MODE_MIN     (ACTIVE_BPF_DISABLED)
+#define CFG_ACTIVE_UC_BPF_MODE_MAX     (ACTIVE_BPF_MODE_COUNT - 1)
+#define CFG_ACTIVE_UC_BPF_MODE_DEFAULT (ACTIVE_BPF_DISABLED)
+
+/*
+ * <ini>
+ * gActiveMcBcBpfMode - Control MC/BC active BPF mode
+ * @Min: 0 (disabled)
+ * @Max: 2 (adaptive)
+ * @Default: 0 (disabled)
+ *
+ * This config item controls MC/BC 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: gActiveUcBpfMode
  *
  * Supported Feature: Active Mode BPF
  *
  * Usage: Internal/External
  * </ini>
  */
-#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)
+#define CFG_ACTIVE_MC_BC_BPF_MODE_NAME    "gActiveMcBcBpfMode"
+#define CFG_ACTIVE_MC_BC_BPF_MODE_MIN     (ACTIVE_BPF_DISABLED)
+#define CFG_ACTIVE_MC_BC_BPF_MODE_MAX     (ACTIVE_BPF_MODE_COUNT - 1)
+#define CFG_ACTIVE_MC_BC_BPF_MODE_DEFAULT (ACTIVE_BPF_DISABLED)
 
 #ifdef WLAN_FEATURE_11AX
 /* 11AX related INI configuration */
@@ -10556,7 +10580,8 @@ 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;
+	enum active_bpf_mode active_uc_bpf_mode;
+	enum active_bpf_mode active_mc_bc_bpf_mode;
 	bool enable_bcast_probe_rsp;
 #ifdef WLAN_FEATURE_11AX
 	bool enable_ul_mimo;

+ 19 - 5
core/hdd/src/wlan_hdd_cfg.c

@@ -4228,12 +4228,20 @@ struct 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,
+	REG_VARIABLE(CFG_ACTIVE_UC_BPF_MODE_NAME, WLAN_PARAM_Integer,
+		struct hdd_config, active_uc_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),
+		CFG_ACTIVE_UC_BPF_MODE_DEFAULT,
+		CFG_ACTIVE_UC_BPF_MODE_MIN,
+		CFG_ACTIVE_UC_BPF_MODE_MAX),
+
+	REG_VARIABLE(CFG_ACTIVE_MC_BC_BPF_MODE_NAME, WLAN_PARAM_Integer,
+		struct hdd_config, active_mc_bc_bpf_mode,
+		VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		CFG_ACTIVE_MC_BC_BPF_MODE_DEFAULT,
+		CFG_ACTIVE_MC_BC_BPF_MODE_MIN,
+		CFG_ACTIVE_MC_BC_BPF_MODE_MAX),
+
 	REG_VARIABLE(CFG_ENABLE_BCAST_PROBE_RESP_NAME, WLAN_PARAM_Integer,
 		struct hdd_config, enable_bcast_probe_rsp,
 		VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -5772,6 +5780,12 @@ void hdd_cfg_print(hdd_context_t *pHddCtx)
 	hdd_info("Name = [%s] Value = [%u]",
 		CFG_CRASH_FW_TIMEOUT_NAME,
 		pHddCtx->config->fw_timeout_crash);
+	hdd_debug("Name = [%s] Value = [%u]",
+		CFG_ACTIVE_UC_BPF_MODE_NAME,
+		pHddCtx->config->active_uc_bpf_mode);
+	hdd_debug("Name = [%s] Value = [%u]",
+		CFG_ACTIVE_MC_BC_BPF_MODE_NAME,
+		pHddCtx->config->active_mc_bc_bpf_mode);
 	hdd_info("Name = [%s] Value = [%d]",
 		CFG_SAP_INTERNAL_RESTART_NAME,
 		pHddCtx->config->sap_internal_restart);

+ 2 - 1
core/hdd/src/wlan_hdd_main.c

@@ -7883,7 +7883,8 @@ 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;
+	cds_cfg->active_uc_bpf_mode = hdd_ctx->config->active_uc_bpf_mode;
+	cds_cfg->active_mc_bc_bpf_mode = hdd_ctx->config->active_mc_bc_bpf_mode;
 
 	hdd_ra_populate_cds_config(cds_cfg, hdd_ctx);
 	hdd_txrx_populate_cds_config(cds_cfg, hdd_ctx);

+ 6 - 2
core/wma/inc/wma.h

@@ -1325,7 +1325,10 @@ struct hw_mode_idx_to_mac_cap_idx {
  * handle of other modules.
  * @saved_wmi_init_cmd: Saved WMI INIT command
  * @bpf_packet_filter_enable: BPF filter enabled or not
- * @active_bpf_mode: Setting that determines how BPF is applied in active mode
+ * @active_uc_bpf_mode: Setting that determines how BPF is applied in active
+ * mode for uc packets
+ * @active_mc_bc_bpf_mode: Setting that determines how BPF is applied in
+ * active mode for MC/BC packets
  * @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
@@ -1497,7 +1500,8 @@ typedef struct {
 	uint32_t fine_time_measurement_cap;
 	bool bpf_enabled;
 	bool bpf_packet_filter_enable;
-	enum active_bpf_mode active_bpf_mode;
+	enum active_bpf_mode active_uc_bpf_mode;
+	enum active_bpf_mode active_mc_bc_bpf_mode;
 	struct wma_ini_config ini_config;
 	struct wma_valid_channels saved_chan;
 	/* NAN datapath support enabled in firmware */

+ 28 - 22
core/wma/src/wma_dev_if.c

@@ -1373,6 +1373,29 @@ static int wma_remove_bss_peer(tp_wma_handle wma, void *pdev,
 	return 0;
 }
 
+/*
+ * get_fw_active_bpf_mode() - convert HDD BPF mode to FW configurable BPF
+ * mode
+ * @mode: BPF mode maintained in HDD
+ *
+ * Return: FW configurable BP mode
+ */
+static enum wmi_host_active_bpf_mode
+get_fw_active_bpf_mode(enum active_bpf_mode mode)
+{
+	switch (mode) {
+	case ACTIVE_BPF_DISABLED:
+		return WMI_HOST_ACTIVE_BPF_DISABLED;
+	case ACTIVE_BPF_ENABLED:
+		return WMI_HOST_ACTIVE_BPF_ENABLED;
+	case ACTIVE_BPF_ADAPTIVE:
+		return WMI_HOST_ACTIVE_BPF_ADAPTIVE;
+	default:
+		WMA_LOGE("Invalid Active BPF Mode %d; Using 'disabled'", mode);
+		return WMI_HOST_ACTIVE_BPF_DISABLED;
+	}
+}
+
 /**
  * wma_config_active_bpf_mode() - Config active BPF mode in FW
  * @wma: the WMA handle
@@ -1382,30 +1405,13 @@ static int wma_remove_bss_peer(tp_wma_handle wma, void *pdev,
  */
 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;
+	enum wmi_host_active_bpf_mode uc_mode, mcbc_mode;
 
-	WMA_LOGD("Configuring Active BPF Mode %d for vdev %u",
-		 wma->active_bpf_mode, vdev_id);
+	uc_mode = get_fw_active_bpf_mode(wma->active_uc_bpf_mode);
+	mcbc_mode = get_fw_active_bpf_mode(wma->active_mc_bc_bpf_mode);
 
-	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_LOGD("Invalid Active BPF Mode %d; Using 'disabled'",
-			 wma->active_bpf_mode);
-		uc_mode = FW_ACTIVE_BPF_MODE_DISABLE;
-		break;
-	}
+	WMA_LOGD("Configuring Active BPF Mode UC:%d MC/BC:%d for vdev %u",
+		  uc_mode, mcbc_mode, vdev_id);
 
 	return wmi_unified_set_active_bpf_mode_cmd(wma->wmi_handle, vdev_id,
 						   uc_mode, mcbc_mode);

+ 2 - 1
core/wma/src/wma_main.c

@@ -2254,7 +2254,8 @@ 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->active_uc_bpf_mode = cds_cfg->active_uc_bpf_mode;
+	wma_handle->active_mc_bc_bpf_mode = cds_cfg->active_mc_bc_bpf_mode;
 	wma_handle->link_stats_results = NULL;
 #ifdef FEATURE_WLAN_RA_FILTERING
 	wma_handle->IsRArateLimitEnabled = cds_cfg->is_ra_ratelimit_enabled;