瀏覽代碼

qcacld-3.0: Add unit test framework to validate WLAN suspend/resume features

WLAN suspend/resume feature has tight dependency on APPS platform
suspend/resume support. On new targets APPS suspend/resume is not
supported until target is feature complete. In absence of APPS
suspend/resume support testing WLAN offload features become
difficult. Add unit test framework to test WLAN suspend/resume
features using private IOCTL command by simulating APPS
suspend/resume behaviour.

Trigger WLAN suspend:
iwpriv wlan0 wlan_suspend 0 0

To resume WLAN run a ping test from access point side and very 1st
ping request unicast packet should trigger wake up.

If FW is not waking up APPS then use below command to do a manual
wake up:

Trigger WLAN resume:
iwpriv wlan0 wlan_resume 0 0

This unit test framework is only for SNOC.

Change-Id: I177a0047f460aa2a305a9e4e46fbfaa94a81dced
CRs-Fixed: 1042205
Rajeev Kumar 8 年之前
父節點
當前提交
a78a0a4578
共有 4 個文件被更改,包括 61 次插入2 次删除
  1. 1 0
      Kbuild
  2. 2 1
      core/hdd/inc/wlan_hdd_driver_ops.h
  3. 1 1
      core/hdd/src/wlan_hdd_driver_ops.c
  4. 57 0
      core/hdd/src/wlan_hdd_wext.c

+ 1 - 0
Kbuild

@@ -1252,6 +1252,7 @@ endif
 
 ifeq ($(CONFIG_HIF_SNOC), 1)
 CDEFINES += -DHIF_SNOC
+CDEFINES += -DWLAN_SUSPEND_RESUME_TEST
 endif
 
 #Enable High Latency related Flags

+ 2 - 1
core/hdd/inc/wlan_hdd_driver_ops.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,4 +36,5 @@
 int wlan_hdd_register_driver(void);
 void wlan_hdd_unregister_driver(void);
 int wlan_hdd_bus_suspend(pm_message_t state);
+int wlan_hdd_bus_resume(void);
 #endif /* __WLAN_HDD_DRIVER_OPS_H__ */

+ 1 - 1
core/hdd/src/wlan_hdd_driver_ops.c

@@ -659,7 +659,7 @@ static int __wlan_hdd_bus_resume(void)
  *
  * Return: void
  */
-static int wlan_hdd_bus_resume(void)
+int wlan_hdd_bus_resume(void)
 {
 	int ret;
 

+ 57 - 0
core/hdd/src/wlan_hdd_wext.c

@@ -89,6 +89,10 @@
 #include "cdp_txrx_flow_ctrl_legacy.h"
 #include "wlan_hdd_nan_datapath.h"
 #include "wlan_hdd_stats.h"
+#ifdef WLAN_SUSPEND_RESUME_TEST
+#include "wlan_hdd_driver_ops.h"
+#include "hif.h"
+#endif
 
 #define HDD_FINISH_ULA_TIME_OUT         800
 #define HDD_SET_MCBC_FILTERS_TO_FW      1
@@ -434,6 +438,11 @@ static const hdd_freq_chan_map_t freq_chan_map[] = {
 #define WE_ENABLE_FW_PROFILE    4
 #define WE_SET_FW_PROFILE_HIST_INTVL    5
 
+#ifdef WLAN_SUSPEND_RESUME_TEST
+#define WE_SET_WLAN_SUSPEND    6
+#define WE_SET_WLAN_RESUME    7
+#endif
+
 /* (SIOCIWFIRSTPRIV + 29) is currently unused */
 
 /* 802.11p IOCTL */
@@ -9589,6 +9598,25 @@ static int wlan_hdd_set_mon_chan(hdd_adapter_t *adapter, uint32_t chan,
 	return qdf_status_to_os_return(status);
 }
 
+#ifdef WLAN_SUSPEND_RESUME_TEST
+static void *g_wiphy;
+
+/**
+ * hdd_wlan_trigger_resume() - resume wlan
+ * @val: interrupt val
+ *
+ * Resume wlan after getting very 1st CE interrupt from target
+ *
+ * Return: none
+ */
+static void hdd_wlan_trigger_resume(uint32_t val)
+{
+	hdd_err("Resume WLAN val 0x%x", val);
+	wlan_hdd_bus_resume();
+	wlan_hdd_cfg80211_resume_wlan(g_wiphy);
+}
+#endif
+
 static int __iw_set_two_ints_getnone(struct net_device *dev,
 				     struct iw_request_info *info,
 				     union iwreq_data *wrqu, char *extra)
@@ -9598,6 +9626,10 @@ static int __iw_set_two_ints_getnone(struct net_device *dev,
 	int sub_cmd = value[0];
 	int ret;
 	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
+#ifdef WLAN_SUSPEND_RESUME_TEST
+	pm_message_t state;
+#endif
+
 
 	ENTER_DEV(dev);
 
@@ -9661,6 +9693,21 @@ static int __iw_set_two_ints_getnone(struct net_device *dev,
 	case WE_SET_MON_MODE_CHAN:
 		ret = wlan_hdd_set_mon_chan(pAdapter, value[1], value[2]);
 		break;
+#ifdef WLAN_SUSPEND_RESUME_TEST
+	case WE_SET_WLAN_SUSPEND:
+		hdd_err("Suspend WLAN");
+		g_wiphy = hdd_ctx->wiphy;
+		state.event = PM_EVENT_SUSPEND;
+		ret = wlan_hdd_cfg80211_suspend_wlan(hdd_ctx->wiphy, NULL);
+		wlan_hdd_bus_suspend(state);
+		hif_fake_apps_suspend(hdd_wlan_trigger_resume);
+		break;
+	case WE_SET_WLAN_RESUME:
+		hdd_err("Resume WLAN");
+		wlan_hdd_bus_resume();
+		ret = wlan_hdd_cfg80211_resume_wlan(hdd_ctx->wiphy);
+		break;
+#endif
 	default:
 		hdd_err("Invalid IOCTL command %d", sub_cmd);
 		break;
@@ -10872,6 +10919,16 @@ static const struct iw_priv_args we_private_args[] = {
 	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
 	 0, "crash_inject"}
 	,
+#endif
+#ifdef WLAN_SUSPEND_RESUME_TEST
+	{WE_SET_WLAN_SUSPEND,
+	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
+	 0, "wlan_suspend"}
+	,
+	{WE_SET_WLAN_RESUME,
+	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
+	 0, "wlan_resume"}
+	,
 #endif
 	{WE_ENABLE_FW_PROFILE,
 	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,