Selaa lähdekoodia

qcacld-3.0: Add fw_test command

Add an Iwpriv command to update fw test params.

Change-Id: I7017fedbe8eddfa6b0f93f1d6129b12f22a462bb
CRs-Fixed: 1045265
Anurag Chouhan 8 vuotta sitten
vanhempi
sitoutus
bf5e0e2457

+ 10 - 0
core/hdd/inc/wlan_hdd_wext.h

@@ -291,6 +291,16 @@ typedef struct ccp_freq_chan_map_s {
 	wlan_hdd_get_vendor_oui_ie_ptr(WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE, ie, ie_len)
 #endif
 
+/*
+ * Defines for fw_test command
+ */
+#define HDD_FWTEST_PARAMS 3
+#define HDD_FWTEST_SU_PARAM_ID 53
+#define HDD_FWTEST_MU_PARAM_ID 2
+#define HDD_FWTEST_SU_DEFAULT_VALUE 100
+#define HDD_FWTEST_MU_DEFAULT_VALUE 40
+#define HDD_FWTEST_MAX_VALUE 500
+
 extern int hdd_unregister_wext(struct net_device *dev);
 extern int hdd_register_wext(struct net_device *dev);
 extern int hdd_wlan_get_freq(uint32_t chan, uint32_t *freq);

+ 56 - 1
core/hdd/src/wlan_hdd_wext.c

@@ -299,6 +299,7 @@ static const hdd_freq_chan_map_t freq_chan_map[] = {
 #define WE_SET_WLAN_DBG      1
 #define WE_SET_DP_TRACE      2
 #define WE_SET_SAP_CHANNELS  3
+#define WE_SET_FW_TEST       4
 
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_GET_CHAR_SET_NONE   (SIOCIWFIRSTPRIV + 5)
@@ -7000,6 +7001,47 @@ static int iw_setnone_getint(struct net_device *dev,
 	return ret;
 }
 
+static int hdd_set_fwtest(int argc, int cmd, int value)
+{
+	struct set_fwtest_params *fw_test;
+
+	/* check for max number of arguments */
+	if (argc > (WMA_MAX_NUM_ARGS) ||
+	    argc != HDD_FWTEST_PARAMS) {
+		hdd_err("Too Many args %d", argc);
+		return -EINVAL;
+	}
+	/*
+	 * check if number of arguments are 3 then, check
+	 * then set the default value for sounding interval.
+	 */
+	if (HDD_FWTEST_PARAMS == argc) {
+		if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
+			value = HDD_FWTEST_SU_DEFAULT_VALUE;
+		if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
+			value = HDD_FWTEST_MU_DEFAULT_VALUE;
+	}
+	/* check sounding interval value should not exceed to max */
+	if (value > HDD_FWTEST_MAX_VALUE) {
+		hdd_err("Invalid arguments value should not exceed max: %d",
+			value);
+		return -EINVAL;
+	}
+	fw_test = qdf_mem_malloc(sizeof(*fw_test));
+	if (NULL == fw_test) {
+		hdd_err("qdf_mem_malloc failed for fw_test");
+		return -ENOMEM;
+	}
+	fw_test->arg = cmd;
+	fw_test->value = value;
+	if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
+		qdf_mem_free(fw_test);
+		hdd_err("Not able to post FW_TEST_CMD message to WMA");
+		return -EINVAL;
+	}
+	return 0;
+}
+
 /**
  * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
  * @dev: device upon which the ioctl was received
@@ -7063,6 +7105,15 @@ static int __iw_set_three_ints_getnone(struct net_device *dev,
 		hdd_debug("%d %d %d", value[1], value[2], value[3]);
 		cds_set_dual_mac_scan_config(value[1], value[2], value[3]);
 		break;
+	case WE_SET_FW_TEST:
+	{
+		ret = hdd_set_fwtest(value[1], value[2], value[3]);
+		if (ret) {
+			hdd_err("Not able to set fwtest %d", ret);
+			return ret;
+		}
+	}
+	break;
 	default:
 		hdd_err("Invalid IOCTL command %d", sub_cmd);
 		break;
@@ -8211,7 +8262,6 @@ static int __iw_set_var_ints_getnone(struct net_device *dev,
 		}
 	}
 	break;
-
 	default:
 	{
 		hdd_err("Invalid IOCTL command %d", sub_cmd);
@@ -10703,6 +10753,11 @@ static const struct iw_priv_args we_private_args[] = {
 	IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
 	0,
 	"setsapchannels"},
+
+	{WE_SET_FW_TEST,
+	IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
+	0, "fw_test"},
+
 	/* handlers for main ioctl */
 	{WLAN_PRIV_SET_NONE_GET_THREE_INT,
 	 0,

+ 1 - 0
core/sme/inc/sme_api.h

@@ -1100,6 +1100,7 @@ static inline QDF_STATUS sme_send_egap_conf_params(uint32_t enable,
 
 void sme_update_fine_time_measurement_capab(tHalHandle hal, uint32_t val);
 QDF_STATUS sme_ht40_stop_obss_scan(tHalHandle hHal, uint32_t vdev_id);
+QDF_STATUS sme_set_fw_test(struct set_fwtest_params *fw_test);
 QDF_STATUS sme_set_tsfcb(tHalHandle hHal,
 	int (*cb_fn)(void *cb_ctx, struct stsf *ptsf), void *cb_ctx);
 

+ 20 - 0
core/sme/src/common/sme_api.c

@@ -15623,6 +15623,26 @@ QDF_STATUS sme_send_egap_conf_params(uint32_t enable, uint32_t inactivity_time,
 }
 #endif
 
+/**
+ * sme_set_fw_test() - set fw test
+ * @fw_test: fw test param
+ *
+ * Return: Return QDF_STATUS, otherwise appropriate failure code
+ */
+QDF_STATUS sme_set_fw_test(struct set_fwtest_params *fw_test)
+{
+	void *wma_handle;
+
+	wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
+	if (!wma_handle) {
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
+				"wma handle is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+	wma_process_fw_test_cmd(wma_handle, fw_test);
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * sme_ht40_stop_obss_scan() - ht40 obss stop scan
  * @hal: mac handel

+ 4 - 1
core/wma/inc/wma.h

@@ -283,7 +283,6 @@ enum ds_mode {
 #define WMA_TX_FRAME_BUFFER_NO_FREE    0
 #define WMA_TX_FRAME_BUFFER_FREE       1
 
-
 /* Default InActivity Time is 200 ms */
 #define POWERSAVE_DEFAULT_INACTIVITY_TIME 200
 
@@ -2157,6 +2156,10 @@ wma_indicate_err(enum ol_rx_err_type err_type,
 
 QDF_STATUS wma_ht40_stop_obss_scan(tp_wma_handle wma_handle,
 				int32_t vdev_id);
+
+void wma_process_fw_test_cmd(WMA_HANDLE handle,
+				      struct set_fwtest_params *wma_fwtest);
+
 QDF_STATUS wma_send_ht40_obss_scanind(tp_wma_handle wma,
 	struct obss_ht40_scanind *req);
 

+ 28 - 0
core/wma/src/wma_features.c

@@ -8039,3 +8039,31 @@ QDF_STATUS wma_get_wakelock_stats(struct sir_wake_lock_stats *wake_lock_stats)
 
 	return QDF_STATUS_SUCCESS;
 }
+
+/**
+ * wma_process_fw_test_cmd() - send unit test command to fw.
+ * @handle: wma handle
+ * @wma_fwtest: fw test command
+ *
+ * This function send fw test command to fw.
+ *
+ * Return: none
+ */
+void wma_process_fw_test_cmd(WMA_HANDLE handle,
+			     struct set_fwtest_params *wma_fwtest)
+{
+	tp_wma_handle wma_handle = (tp_wma_handle) handle;
+
+	if (!wma_handle || !wma_handle->wmi_handle) {
+		WMA_LOGE("%s: WMA is closed, can not issue fw test cmd",
+			 __func__);
+		return;
+	}
+
+	if (wmi_unified_fw_test_cmd(wma_handle->wmi_handle,
+				    (struct set_fwtest_params *)wma_fwtest)) {
+		WMA_LOGE("%s: Failed to issue fw test cmd",
+			 __func__);
+		return;
+	}
+}