summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeepak Dhamdhere <ddhamdhe@qca.qualcomm.com>2016-03-07 16:40:45 -0800
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-03-22 18:26:37 +0530
commitbb4a58df91ffde1094329c647feabaea4834cec7 (patch)
tree87abb8340adeeb38322a887f9a5e322217484fc2
parentce83688b9713decfc9ed05fd729c50cf04b76eef (diff)
qcacld-2.0: Enable Wake On Wireless events for NAN data path
All the wake events for all NAN data path event IDs are sent through the single event WOW_NAN_DATA_EVENT. The handler derives the event ID from the TLV tag and calls individual NDP event handlers. - Enable WOW_NAN_DATA_EVENT. - Translate WOW event TLV tag to NDP event ID. - Call NDP event handlers for WOW_REASON_NAN_DATA. Change-Id: Ia99bb6b0e1637d052945ed6f4878237b3612bb20 CRs-Fixed: 962367
-rw-r--r--CORE/SERVICES/WMA/wma.c39
-rw-r--r--CORE/SERVICES/WMA/wma.h4
-rw-r--r--CORE/SERVICES/WMA/wma_nan_datapath.c143
-rw-r--r--CORE/SERVICES/WMA/wma_nan_datapath.h13
4 files changed, 193 insertions, 6 deletions
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c
index 87c871d71939..e35aa11af9c3 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -20720,6 +20720,23 @@ static int wma_wow_wakeup_host_event(void *handle, u_int8_t *event,
}
break;
#endif
+ case WOW_REASON_NAN_DATA:
+ WMA_LOGD(FL("Host woken up for NAN data path event from FW"));
+ if (param_buf->wow_packet_buffer) {
+ wow_buf_pkt_len =
+ *(uint32_t *)param_buf->wow_packet_buffer;
+ WMA_LOGD(FL("wow_packet_buffer dump"));
+ vos_trace_hex_dump(VOS_MODULE_ID_WDA,
+ VOS_TRACE_LEVEL_DEBUG,
+ param_buf->wow_packet_buffer,
+ wow_buf_pkt_len);
+ wma_ndp_wow_event_callback(handle,
+ (u_int8_t *)(param_buf->wow_packet_buffer + 4),
+ wow_buf_pkt_len);
+ } else {
+ WMA_LOGE(FL("wow_packet_buffer is empty"));
+ }
+ break;
default:
break;
}
@@ -20805,15 +20822,27 @@ static const u8 *wma_wow_wakeup_event_str(WOW_WAKE_EVENT_TYPE event)
return "WOW_IOAC_SOCK_EVENT";
case WOW_NLO_SCAN_COMPLETE_EVENT:
return "WOW_NLO_SCAN_COMPLETE_EVENT";
+ case WOW_NAN_DATA_EVENT:
+ return "WOW_NAN_DATA_EVENT";
default:
return "UNSPECIFIED_EVENT";
}
}
-/* Configures wow wakeup events. */
-static void wma_add_wow_wakeup_event(tp_wma_handle wma,
+/**
+ * wma_add_wow_wakeup_event() - Update WOW wakeup event masks
+ * @wma: WMA context
+ * @event: Event number to add
+ * @enable: 1 to enable and 0 to disable the event
+ *
+ * Sets or clears the bits in enable and disable bitmasks for the
+ * given event number.
+ *
+ * Return: none
+ */
+void wma_add_wow_wakeup_event(tp_wma_handle wma,
WOW_WAKE_EVENT_TYPE event,
- v_BOOL_t enable)
+ bool enable)
{
if (enable) {
wma->wow_wakeup_enable_mask |= 1 << event;
@@ -20823,7 +20852,7 @@ static void wma_add_wow_wakeup_event(tp_wma_handle wma,
wma->wow_wakeup_enable_mask &= ~(1 << event);
}
- WMA_LOGD("%s %s event %s\n", __func__,
+ WMA_LOGD(FL("%s event %s"),
enable ? "enable" : "disable",
wma_wow_wakeup_event_str(event));
}
@@ -21862,6 +21891,8 @@ static VOS_STATUS wma_feed_wow_config_to_fw(tp_wma_handle wma,
wma_add_wow_wakeup_event(wma, WOW_EXTSCAN_EVENT, extscan_in_progress);
#endif
+ wma_ndp_add_wow_wakeup_event(wma, true);
+
/* Enable wow wakeup events in FW */
ret = wma_send_wakeup_mask(wma, TRUE);
if (ret) {
diff --git a/CORE/SERVICES/WMA/wma.h b/CORE/SERVICES/WMA/wma.h
index 649fcf0143e7..3f5329e94d4c 100644
--- a/CORE/SERVICES/WMA/wma.h
+++ b/CORE/SERVICES/WMA/wma.h
@@ -1779,4 +1779,8 @@ struct wma_version_info {
void wma_remove_peer(tp_wma_handle wma, u_int8_t *bssid,
u_int8_t vdev_id, ol_txrx_peer_handle peer,
v_BOOL_t roam_synch_in_progress);
+
+void wma_add_wow_wakeup_event(tp_wma_handle wma, WOW_WAKE_EVENT_TYPE event,
+ bool enable);
+
#endif
diff --git a/CORE/SERVICES/WMA/wma_nan_datapath.c b/CORE/SERVICES/WMA/wma_nan_datapath.c
index 5fb33e71a540..c2cd54c2c268 100644
--- a/CORE/SERVICES/WMA/wma_nan_datapath.c
+++ b/CORE/SERVICES/WMA/wma_nan_datapath.c
@@ -250,6 +250,149 @@ void wma_ndp_unregister_all_event_handlers(tp_wma_handle wma_handle)
}
/**
+ * wma_ndp_add_wow_wakeup_event() - Add Wake on Wireless event for NDP
+ * @wma_handle: WMA context
+ * @enable: dis/enable flag to enable the bit for WOW_NAN_DATA_EVENT
+ *
+ * Enables the firmware to wake up the host on NAN data path event.
+ * All NDP events such as NDP_INDICATION, NDP_CONFIRM, etc. use the
+ * same event. They can be distinguished using their TLV tags.
+ *
+ * Return: none
+ */
+void wma_ndp_add_wow_wakeup_event(tp_wma_handle wma_handle,
+ bool enable)
+{
+ wma_add_wow_wakeup_event(wma_handle, WOW_NAN_DATA_EVENT, enable);
+}
+
+/**
+ * wma_ndp_get_eventid_from_tlvtag() - map tlv tag to event id
+ * @tag: WMI TLV tag
+ *
+ * map the tag to known NDP event fixed_param tags and return the
+ * corresponding NDP event id.
+ *
+ * Return: 0 if TLV tag is invalid
+ * else return corresponding WMI event id
+ */
+static int wma_ndp_get_eventid_from_tlvtag(uint32_t tag)
+{
+ uint32_t event_id;
+
+ switch (tag) {
+ case WMITLV_TAG_STRUC_wmi_ndp_initiator_rsp_event_fixed_param:
+ event_id = WMI_NDP_INITIATOR_RSP_EVENTID;
+ break;
+
+ case WMITLV_TAG_STRUC_wmi_ndp_responder_rsp_event_fixed_param:
+ event_id = WMI_NDP_RESPONDER_RSP_EVENTID;
+ break;
+
+ case WMITLV_TAG_STRUC_wmi_ndp_end_rsp_event_fixed_param:
+ event_id = WMI_NDP_END_RSP_EVENTID;
+ break;
+
+ case WMITLV_TAG_STRUC_wmi_ndp_indication_event_fixed_param:
+ event_id = WMI_NDP_INDICATION_EVENTID;
+ break;
+
+ case WMITLV_TAG_STRUC_wmi_ndp_confirm_event_fixed_param:
+ event_id = WMI_NDP_CONFIRM_EVENTID;
+ break;
+
+ case WMITLV_TAG_STRUC_wmi_ndp_end_indication_event_fixed_param:
+ event_id = WMI_NDP_END_INDICATION_EVENTID;
+ break;
+
+ default:
+ event_id = 0;
+ WMA_LOGE(FL("Unknown tag: %d"), tag);
+ break;
+ }
+
+ WMA_LOGI(FL("For tag %d WMI event 0x%x"), tag, event_id);
+ return event_id;
+}
+
+/**
+ * wma_ndp_wow_event_callback() - NAN data path wow event callback
+ * @handle: WMA handle
+ * @event: event buffer
+ * @len: length of @event buffer
+ *
+ * The wow event WOW_REASON_NAN_DATA is followed by the payload of the event
+ * which generated the wow event.
+ * Payload is 4 bytes of length followed by event buffer. First 4 bytes
+ * of event buffer is common tlv header, which is a combination
+ * of tag (higher 2 bytes) and length (lower 2 bytes). The tag is used to
+ * identify the event which triggered wow event.
+ *
+ * Return: none
+ */
+void wma_ndp_wow_event_callback(void *handle, void *event,
+ uint32_t len)
+{
+ uint32_t id;
+ int tlv_ok_status = 0;
+ void *wmi_cmd_struct_ptr = NULL;
+ uint32_t tag = WMITLV_GET_TLVTAG(WMITLV_GET_HDR(event));
+
+ /* Reverse map fixed params tag to EVENT_ID */
+ id = wma_ndp_get_eventid_from_tlvtag(tag);
+ if (!id) {
+ WMA_LOGE(FL("Invalid Tag: %d"), tag);
+ return;
+ }
+
+ tlv_ok_status = wmitlv_check_and_pad_event_tlvs(handle, event, len,
+ id,
+ &wmi_cmd_struct_ptr);
+ if (tlv_ok_status != 0) {
+ WMA_LOGE(FL("Invalid Tag: %d could not check and pad tlvs"),
+ tag);
+ return;
+ }
+
+ switch (id) {
+ case WMI_NDP_INITIATOR_RSP_EVENTID:
+ wma_ndp_initiator_rsp_event_handler(handle,
+ wmi_cmd_struct_ptr, len);
+ break;
+
+ case WMI_NDP_RESPONDER_RSP_EVENTID:
+ wma_ndp_responder_rsp_event_handler(handle,
+ wmi_cmd_struct_ptr, len);
+ break;
+
+ case WMI_NDP_END_RSP_EVENTID:
+ wma_ndp_end_response_event_handler(handle,
+ wmi_cmd_struct_ptr, len);
+ break;
+
+ case WMI_NDP_INDICATION_EVENTID:
+ wma_ndp_indication_event_handler(handle,
+ wmi_cmd_struct_ptr, len);
+ break;
+
+ case WMI_NDP_CONFIRM_EVENTID:
+ wma_ndp_confirm_event_handler(handle,
+ wmi_cmd_struct_ptr, len);
+ break;
+
+ case WMI_NDP_END_INDICATION_EVENTID:
+ wma_ndp_end_indication_event_handler(handle,
+ wmi_cmd_struct_ptr, len);
+ break;
+
+ default:
+ WMA_LOGE(FL("Unknown tag: %d"), tag);
+ break;
+ }
+ wmitlv_free_allocated_event_tlvs(id, &wmi_cmd_struct_ptr);
+}
+
+/**
* wma_add_bss_ndi_mode() - Process BSS creation request while adding NaN
* Data interface
* @wma: wma handle
diff --git a/CORE/SERVICES/WMA/wma_nan_datapath.h b/CORE/SERVICES/WMA/wma_nan_datapath.h
index 4030f4afc82f..494aaa032a57 100644
--- a/CORE/SERVICES/WMA/wma_nan_datapath.h
+++ b/CORE/SERVICES/WMA/wma_nan_datapath.h
@@ -52,8 +52,14 @@ void wma_delete_all_nan_remote_peers(tp_wma_handle wma,
uint32_t vdev_id);
void wma_ndp_register_all_event_handlers(tp_wma_handle wma_handle);
void wma_ndp_unregister_all_event_handlers(tp_wma_handle wma_handle);
+void wma_ndp_add_wow_wakeup_event(tp_wma_handle wma_handle,
+ bool enable);
+void wma_ndp_wow_event_callback(void *handle, void *event, uint32_t len);
#else
-#define wma_add_bss_ndi_mode(x, y) ((void)0)
+static inline void wma_add_bss_ndi_mode(tp_wma_handle wma,
+ tpAddBssParams add_bss)
+{
+}
static inline void wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,
struct hdd_tgt_cfg *tgt_cfg) {}
static inline void wma_ndp_register_all_event_handlers(
@@ -62,6 +68,9 @@ static inline void wma_ndp_unregister_all_event_handlers(
tp_wma_handle wma_handle) {}
#define WMA_IS_VDEV_IN_NDI_MODE(intf, vdev_id) (false)
#define wma_delete_all_nan_remote_peers(x, y) ((void)0)
-
+static inline void wma_ndp_add_wow_wakeup_event(tp_wma_handle wma_handle,
+ bool enable) {}
+static inline void wma_ndp_wow_event_callback(void *handle, void *event,
+ uint32_t len) {}
#endif /* WLAN_FEATURE_NAN_DATAPATH */
#endif /* __WMA_NAN_DATAPATH_H */