1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2018-2019  Realtek Corporation
3  */
4 
5 #ifndef __RTW_WOW_H__
6 #define __RTW_WOW_H__
7 
8 #define PNO_CHECK_BYTE 4
9 
10 enum rtw_wow_pattern_type {
11 	RTW_PATTERN_BROADCAST = 0,
12 	RTW_PATTERN_MULTICAST,
13 	RTW_PATTERN_UNICAST,
14 	RTW_PATTERN_VALID,
15 	RTW_PATTERN_INVALID,
16 };
17 
18 enum rtw_wake_reason {
19 	RTW_WOW_RSN_RX_PTK_REKEY = 0x1,
20 	RTW_WOW_RSN_RX_GTK_REKEY = 0x2,
21 	RTW_WOW_RSN_RX_DEAUTH = 0x8,
22 	RTW_WOW_RSN_DISCONNECT = 0x10,
23 	RTW_WOW_RSN_RX_MAGIC_PKT = 0x21,
24 	RTW_WOW_RSN_RX_PATTERN_MATCH = 0x23,
25 	RTW_WOW_RSN_RX_NLO = 0x55,
26 };
27 
28 struct rtw_fw_media_status_iter_data {
29 	struct rtw_dev *rtwdev;
30 	u8 connect;
31 };
32 
33 struct rtw_fw_key_type_iter_data {
34 	struct rtw_dev *rtwdev;
35 	u8 group_key_type;
36 	u8 pairwise_key_type;
37 };
38 
39 static inline bool rtw_wow_mgd_linked(struct rtw_dev *rtwdev)
40 {
41 	struct ieee80211_vif *wow_vif = rtwdev->wow.wow_vif;
42 	struct rtw_vif *rtwvif = (struct rtw_vif *)wow_vif->drv_priv;
43 
44 	return (rtwvif->net_type == RTW_NET_MGD_LINKED);
45 }
46 
47 static inline bool rtw_wow_no_link(struct rtw_dev *rtwdev)
48 {
49 	struct ieee80211_vif *wow_vif = rtwdev->wow.wow_vif;
50 	struct rtw_vif *rtwvif = (struct rtw_vif *)wow_vif->drv_priv;
51 
52 	return (rtwvif->net_type == RTW_NET_NO_LINK);
53 }
54 
55 int rtw_wow_suspend(struct rtw_dev *rtwdev, struct cfg80211_wowlan *wowlan);
56 int rtw_wow_resume(struct rtw_dev *rtwdev);
57 
58 #endif
59