Browse Source

qcacld-3.0: Add ini to configure BLE scan policy

Add gConfigBleScanCoexPolicy which can be used to
control performance of ble scan case.
’0’ to place more emphasis on BLE Scan results
‘1’ to place more emphasis on WLAN performance

Change-Id: I46c735d8695523d14f6372bc5e47d1d1f51589ae
CRs-Fixed: 2935051
Utkarsh Bhatnagar 3 years ago
parent
commit
e649bde5af

+ 4 - 1
components/fw_offload/core/inc/wlan_fw_offload_main.h

@@ -60,7 +60,7 @@ enum wlan_fwol_southbound_event {
 };
 
 /**
- * struct wlan_fwol_three_antenna_btc - Three antenna BTC config items
+ * struct wlan_fwol_coex_config - BTC config items
  * @btc_mode: Config BTC mode
  * @antenna_isolation: Antenna isolation
  * @max_tx_power_for_btc: Max wlan tx power in co-ex scenario
@@ -77,6 +77,8 @@ enum wlan_fwol_southbound_event {
  *                             BT SCO connection is on
  * @btc_three_way_coex_config_legacy_enable: Enable/Disable tri-radio coex
  *                             config legacy feature
+ * @ble_scan_coex_policy: BLE Scan policy, true - better BLE scan result, false
+ *                        better wlan throughput
  */
 struct wlan_fwol_coex_config {
 	uint8_t btc_mode;
@@ -97,6 +99,7 @@ struct wlan_fwol_coex_config {
 #ifdef FEATURE_COEX_CONFIG
 	bool    btc_three_way_coex_config_legacy_enable;
 #endif
+	bool ble_scan_coex_policy;
 };
 
 #define FWOL_THERMAL_LEVEL_MAX 4

+ 2 - 0
components/fw_offload/core/src/wlan_fw_offload_main.c

@@ -107,6 +107,8 @@ fwol_init_coex_config_in_cfg(struct wlan_objmgr_psoc *psoc,
 	coex_config->bt_sco_allow_wlan_2g_scan =
 				cfg_get(psoc, CFG_BT_SCO_ALLOW_WLAN_2G_SCAN);
 	fwol_three_way_coex_config_legacy_config_get(psoc, coex_config);
+	coex_config->ble_scan_coex_policy = cfg_get(psoc,
+						    CFG_BLE_SCAN_COEX_POLICY);
 }
 
 static void

+ 26 - 2
components/fw_offload/dispatcher/inc/cfg_coex.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012 - 2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012 - 2021 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
@@ -282,6 +282,29 @@
 		1, \
 		"Bt Sco Allow Wlan 2G Scan")
 
+/*
+ * <ini>
+ * ble_scan_coex_policy - Ini to configure coex policy
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * 0 - Better BLE Advertiser reception performance
+ * 1 - Better WLAN performance
+ *
+ * This ini is used to control the performance of ble scan case,’0’ to place
+ * more emphasis on BLE Scan results , ‘1’ to place more emphasis on WLAN
+ * performance
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_BLE_SCAN_COEX_POLICY CFG_INI_BOOL( \
+		"ble_scan_coex_policy", \
+		0, \
+		"BLE scan Coex policy")
+
 #ifdef FEATURE_COEX_CONFIG
 /*
  * <ini>
@@ -363,5 +386,6 @@
 	COEX_MPTA_HELPER_CFG \
 	CFG(CFG_BT_SCO_ALLOW_WLAN_2G_SCAN) \
 	THREE_WAY_COEX_CONFIG_LEGACY_CFG \
-	SET_INIT_CHAIN_MODE_FOR_BTC_CFG
+	SET_INIT_CHAIN_MODE_FOR_BTC_CFG \
+	CFG(CFG_BLE_SCAN_COEX_POLICY)
 #endif

+ 10 - 0
core/hdd/src/wlan_hdd_main.c

@@ -6412,6 +6412,16 @@ static int hdd_send_coex_config_params(struct hdd_context *hdd_ctx,
 		goto err;
 	}
 
+	coex_cfg_params.config_type =
+				WMI_COEX_CONFIG_LE_SCAN_POLICY;
+	coex_cfg_params.config_arg1 = config.ble_scan_coex_policy;
+
+	status = sme_send_coex_config_cmd(&coex_cfg_params);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("Failed to send coex BLE scan policy");
+		goto err;
+	}
+
 	return 0;
 err:
 	return -EINVAL;