summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen Rawat <naveenrawat@codeaurora.org>2017-10-27 10:02:40 -0700
committersnandini <snandini@codeaurora.org>2017-11-22 03:55:10 -0800
commit341856619c124a5f04e449085ee3a07bd7cfc7c5 (patch)
tree4bd5b92c67fc6d2bbd4eecbb61c88b1f8e2255d7
parent64673c02f97510ba61989e9be571a56dcbf6bfe1 (diff)
qcacld-3.0: Send WOW timer pattern to firmware
Send WOW timer pattern to firmware when suspend is requested and INSTALL_KEY is not sent to firmware yet. This will allow firmware to wake host in case Eapol frames are not received and do a graceful disconnect. Change-Id: Ibbcc0af85ee9ddcd7f6559c83c67274508193004 CRs-Fixed: 2127634
-rw-r--r--core/mac/src/include/sir_params.h14
-rw-r--r--core/sme/src/csr/csr_api_roam.c5
-rw-r--r--core/sme/src/csr/csr_inside_api.h3
-rw-r--r--core/wma/inc/wma.h1
-rw-r--r--core/wma/inc/wma_api.h14
-rw-r--r--core/wma/src/wma_dev_if.c2
-rw-r--r--core/wma/src/wma_features.c79
-rw-r--r--core/wma/src/wma_main.c2
-rw-r--r--core/wma/src/wma_mgmt.c4
9 files changed, 117 insertions, 7 deletions
diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h
index 5aa9d6ef5a36..afa21fcd8c3b 100644
--- a/core/mac/src/include/sir_params.h
+++ b/core/mac/src/include/sir_params.h
@@ -45,6 +45,20 @@
#define WAKELOCK_DURATION_RECOMMENDED 1000
#define WAKELOCK_DURATION_MAX 3000
+
+#define SYSTEM_TIME_MSEC_TO_USEC 1000
+#define SYSTEM_TIME_SEC_TO_MSEC 1000
+#define SYSTEM_TIME_NSEC_TO_USEC 1000
+
+/*
+ * Following time is used to program WOW_TIMER_PATTERN to FW so that FW will
+ * wake host up to do graceful disconnect in case PEER remains un-authorized
+ * for this long.
+ */
+#define SIR_INSTALL_KEY_TIMEOUT_SEC 70
+#define SIR_INSTALL_KEY_TIMEOUT_MS \
+ (SIR_INSTALL_KEY_TIMEOUT_SEC * SYSTEM_TIME_SEC_TO_MSEC)
+
/* defines for WPS config states */
#define SAP_WPS_DISABLED 0
#define SAP_WPS_ENABLED_UNCONFIGURED 1
diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c
index f2e564e81407..a80173477bfa 100644
--- a/core/sme/src/csr/csr_api_roam.c
+++ b/core/sme/src/csr/csr_api_roam.c
@@ -62,8 +62,9 @@
#define CSR_NUM_IBSS_START_CHANNELS_50 4
#define CSR_NUM_IBSS_START_CHANNELS_24 3
-/* 75 seconds, for WPA, WPA2, CCKM */
-#define CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD (75 * QDF_MC_TIMER_TO_SEC_UNIT)
+/* 70 seconds, for WPA, WPA2, CCKM */
+#define CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD \
+ (SIR_INSTALL_KEY_TIMEOUT_SEC * QDF_MC_TIMER_TO_SEC_UNIT)
/* 120 seconds, for WPS */
#define CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD (120 * QDF_MC_TIMER_TO_SEC_UNIT)
diff --git a/core/sme/src/csr/csr_inside_api.h b/core/sme/src/csr/csr_inside_api.h
index c0e5ccb76a37..0b2b545d1b7f 100644
--- a/core/sme/src/csr/csr_inside_api.h
+++ b/core/sme/src/csr/csr_inside_api.h
@@ -61,9 +61,6 @@
#define CSR_MAX_2_4_GHZ_SUPPORTED_CHANNELS 14
#define CSR_MAX_BSS_SUPPORT 512
-#define SYSTEM_TIME_MSEC_TO_USEC 1000
-#define SYSTEM_TIME_SEC_TO_MSEC 1000
-#define SYSTEM_TIME_NSEC_TO_USEC 1000
/* This number minus 1 means the number of times a channel is scanned before
* a BSS is remvoed from
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index 9f2594175226..911f9b3ff7aa 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -1159,6 +1159,7 @@ struct wma_txrx_node {
qdf_wake_lock_t vdev_stop_wakelock;
qdf_wake_lock_t vdev_set_key_wakelock;
struct roam_synch_frame_ind roam_synch_frame_ind;
+ bool is_waiting_for_key;
};
#if defined(QCA_WIFI_FTM)
diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h
index 773436946e83..1af03e33be61 100644
--- a/core/wma/inc/wma_api.h
+++ b/core/wma/inc/wma_api.h
@@ -489,4 +489,18 @@ static inline void wma_spectral_scan_config(WMA_HANDLE wma_handle,
QDF_STATUS wma_crash_inject(WMA_HANDLE wma_handle, uint32_t type,
uint32_t delay_time_ms);
+
+/**
+ * wma_wow_set_wake_time() - set timer pattern tlv, so that firmware will wake
+ * up host after specified time is elapsed
+ * @wma_handle: wma handle
+ * @vdev_id: vdev id
+ * @cookie: value to identify reason why host set up wake call.
+ * @time: time in ms
+ *
+ * Return: QDF status
+ */
+QDF_STATUS wma_wow_set_wake_time(WMA_HANDLE wma_handle, uint8_t vdev_id,
+ uint32_t cookie, uint32_t time);
+
#endif
diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c
index 4cd36452825c..f96a540d88b0 100644
--- a/core/wma/src/wma_dev_if.c
+++ b/core/wma/src/wma_dev_if.c
@@ -3962,6 +3962,8 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, tpAddBssParams add_bss)
pps_val, status);
wma_send_peer_assoc(wma, add_bss->nwType,
&add_bss->staContext);
+ /* we just had peer assoc, so install key will be done later */
+ iface->is_waiting_for_key = true;
peer_assoc_sent = true;
if (add_bss->rmfEnabled)
diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c
index 95f138d24910..693cd11b186b 100644
--- a/core/wma/src/wma_features.c
+++ b/core/wma/src/wma_features.c
@@ -1753,6 +1753,33 @@ static QDF_STATUS wma_wow_sta_ra_filter(tp_wma_handle wma, uint8_t vdev_id)
#endif /* FEATURE_WLAN_RA_FILTERING */
/**
+ * wma_wow_set_wake_time() - set timer pattern tlv, so that firmware will wake
+ * up host after specified time is elapsed
+ * @wma_handle: wma handle
+ * @vdev_id: vdev id
+ * @cookie: value to identify reason why host set up wake call.
+ * @time: time in ms
+ *
+ * Return: QDF status
+ */
+QDF_STATUS wma_wow_set_wake_time(WMA_HANDLE wma_handle, uint8_t vdev_id,
+ uint32_t cookie, uint32_t time)
+{
+ int ret;
+ tp_wma_handle wma = (tp_wma_handle)wma_handle;
+
+ WMA_LOGD(FL("send timer patter with time: %d and vdev = %d to fw"),
+ time, vdev_id);
+ ret = wmi_unified_wow_timer_pattern_cmd(wma->wmi_handle, vdev_id,
+ cookie, time);
+ if (ret) {
+ WMA_LOGE(FL("Failed to send timer patter to fw"));
+ return QDF_STATUS_E_FAILURE;
+ }
+
+ return QDF_STATUS_SUCCESS;
+}
+/**
* wmi_unified_nat_keepalive_enable() - enable NAT keepalive filter
* @wma: wma handle
* @vdev_id: vdev id
@@ -4916,6 +4943,23 @@ int wma_wow_wakeup_host_event(void *handle, uint8_t *event,
/* Just update stats and exit */
WMA_LOGD("Host woken up because of chip power save failure");
break;
+ case WOW_REASON_TIMER_INTR_RECV:
+ /*
+ * Right now firmware is not returning any cookie host has
+ * programmed. So do not check for cookie.
+ */
+ WMA_LOGE("WOW_REASON_TIMER_INTR_RECV received, indicating key exchange did not finish. Initiate disconnect");
+ if (param_buf->wow_packet_buffer) {
+ WMA_LOGD("wow_packet_buffer dump");
+ qdf_trace_hex_dump(QDF_MODULE_ID_WMA,
+ QDF_TRACE_LEVEL_DEBUG,
+ param_buf->wow_packet_buffer, wow_buf_pkt_len);
+ wma_peer_sta_kickout_event_handler(handle,
+ wmi_cmd_struct_ptr, wow_buf_pkt_len);
+ } else {
+ WMA_LOGD("No wow_packet_buffer present");
+ }
+ break;
default:
break;
}
@@ -8366,6 +8410,40 @@ failure:
}
/**
+ * wma_check_and_set_wake_timer(): checks all interfaces and if any interface
+ * has install_key pending, sets timer pattern in fw to wake up host after
+ * specified time has elapsed.
+ * @wma: wma handle
+ * @time: time after which host wants to be awaken.
+ *
+ * Return: None
+ */
+static void wma_check_and_set_wake_timer(tp_wma_handle wma, uint32_t time)
+{
+ int i;
+ struct wma_txrx_node *iface;
+
+ if (!WMI_SERVICE_EXT_IS_ENABLED(wma->wmi_service_bitmap,
+ wma->wmi_service_ext_bitmap,
+ WMI_SERVICE_WOW_WAKEUP_BY_TIMER_PATTERN)) {
+ WMA_LOGD("TIME_PATTERN is not enabled");
+ return;
+ }
+
+ for (i = 0; i < wma->max_bssid; i++) {
+ iface = &wma->interfaces[i];
+ if (iface->is_vdev_valid && iface->is_waiting_for_key) {
+ /*
+ * right now cookie is dont care, since FW disregards
+ * that.
+ */
+ wma_wow_set_wake_time((WMA_HANDLE)wma, i, 0, time);
+ break;
+ }
+ }
+}
+
+/**
* __wma_bus_suspend(): handles bus suspend for wma
* @type: is this suspend part of runtime suspend or system suspend?
* @wow_flags: bitmap of WMI WOW flags to pass to FW
@@ -8429,6 +8507,7 @@ static int __wma_bus_suspend(enum qdf_suspend_type type, uint32_t wow_flags)
return qdf_status_to_os_return(status);
}
+ wma_check_and_set_wake_timer(handle, SIR_INSTALL_KEY_TIMEOUT_MS);
status = wma_enable_wow_in_fw(handle, wow_flags);
return qdf_status_to_os_return(status);
diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c
index 4d30dd56b8cc..b7e81fc36870 100644
--- a/core/wma/src/wma_main.c
+++ b/core/wma/src/wma_main.c
@@ -2236,6 +2236,7 @@ void wma_vdev_init(struct wma_txrx_node *vdev)
qdf_wake_lock_create(&vdev->vdev_start_wakelock, "vdev_start");
qdf_wake_lock_create(&vdev->vdev_stop_wakelock, "vdev_stop");
qdf_wake_lock_create(&vdev->vdev_set_key_wakelock, "vdev_set_key");
+ vdev->is_waiting_for_key = false;
}
void wma_vdev_deinit(struct wma_txrx_node *vdev)
@@ -2243,6 +2244,7 @@ void wma_vdev_deinit(struct wma_txrx_node *vdev)
qdf_wake_lock_destroy(&vdev->vdev_start_wakelock);
qdf_wake_lock_destroy(&vdev->vdev_stop_wakelock);
qdf_wake_lock_destroy(&vdev->vdev_set_key_wakelock);
+ vdev->is_waiting_for_key = false;
}
/**
diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c
index 36df4ac96075..150113e75803 100644
--- a/core/wma/src/wma_mgmt.c
+++ b/core/wma/src/wma_mgmt.c
@@ -1739,13 +1739,13 @@ static QDF_STATUS wma_setup_install_key_cmd(tp_wma_handle wma_handle,
status = wmi_unified_setup_install_key_cmd(wma_handle->wmi_handle,
&params);
-
-
if (!key_params->unicast) {
/* Its GTK release the wake lock */
WMA_LOGD("Release set key wake lock");
wma_release_wakelock(&iface->vdev_set_key_wakelock);
}
+ /* install key was requested */
+ iface->is_waiting_for_key = false;
return status;
}