+static void wlan_rx_wol(unsigned int rx_filter __unused, struct ieee80211_hdr *hdr __unused, unsigned int len __unused)
+{
+#ifdef CONFIG_CARL9170FW_WOL_NL80211_TRIGGERS
+ /* Disconnect is always enabled */
+ if (fw.wlan.wol.cmd.flags & CARL9170_WOL_DISCONNECT &&
+ rx_filter & CARL9170_RX_FILTER_MGMT)
+ fw.wlan.wol.wake_up |= wlan_rx_wol_disconnect(rx_filter, hdr, len);
+
+ if (fw.wlan.wol.cmd.flags & CARL9170_WOL_MAGIC_PKT &&
+ rx_filter & CARL9170_RX_FILTER_DATA)
+ fw.wlan.wol.wake_up |= wlan_rx_wol_magic_packet(hdr, len);
+#endif /* CONFIG_CARL9170FW_WOL_NL80211_TRIGGERS */
+
+#ifdef CONFIG_CARL9170FW_WOL_PROBE_REQUEST
+ if (rx_filter & CARL9170_RX_FILTER_MGMT)
+ fw.wlan.wol.wake_up |= wlan_rx_wol_probe_ssid(hdr, len);
+#endif /* CONFIG_CARL9170FW_WOL_PROBE_REQUEST */
+}
+
+static void wlan_wol_janitor(void)
+{
+ if (unlikely(fw.suspend_mode == CARL9170_HOST_SUSPENDED)) {
+ if (fw.wlan.wol.cmd.flags & CARL9170_WOL_DISCONNECT) {
+ /*
+ * connection lost after 10sec without receiving
+ * a beacon
+ */
+ if (is_after_msecs(fw.wlan.wol.last_beacon, 10000))
+ fw.wlan.wol.wake_up |= true;
+
+ if (fw.wlan.wol.cmd.null_interval &&
+ is_after_msecs(fw.wlan.wol.last_null, fw.wlan.wol.cmd.null_interval))
+ wlan_wol_connection_monitor();
+
+ if (fw.wlan.wol.lost_null >= 5)
+ fw.wlan.wol.wake_up |= true;
+ }
+
+ if (fw.wlan.wol.wake_up) {
+ fw.suspend_mode = CARL9170_AWAKE_HOST;
+ set(AR9170_USB_REG_WAKE_UP, AR9170_USB_WAKE_UP_WAKE);
+ }
+ }
+}
+#endif /* CONFIG_CARL9170FW_WOL */
+
+static unsigned int wlan_rx_filter(struct dma_desc *desc)
+{
+ struct ieee80211_hdr *hdr;
+ unsigned int data_len;
+ unsigned int rx_filter;
+ unsigned int mac_err;