144bc17f7SChin-Yen Lee /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
244bc17f7SChin-Yen Lee /* Copyright(c) 2018-2019 Realtek Corporation
344bc17f7SChin-Yen Lee */
444bc17f7SChin-Yen Lee
544bc17f7SChin-Yen Lee #ifndef __RTW_WOW_H__
644bc17f7SChin-Yen Lee #define __RTW_WOW_H__
744bc17f7SChin-Yen Lee
8*b6c12908SChin-Yen Lee #define PNO_CHECK_BYTE 4
9*b6c12908SChin-Yen Lee
10e3e400dfSChin-Yen Lee enum rtw_wow_pattern_type {
11e3e400dfSChin-Yen Lee RTW_PATTERN_BROADCAST = 0,
12e3e400dfSChin-Yen Lee RTW_PATTERN_MULTICAST,
13e3e400dfSChin-Yen Lee RTW_PATTERN_UNICAST,
14e3e400dfSChin-Yen Lee RTW_PATTERN_VALID,
15e3e400dfSChin-Yen Lee RTW_PATTERN_INVALID,
16e3e400dfSChin-Yen Lee };
17e3e400dfSChin-Yen Lee
1844bc17f7SChin-Yen Lee enum rtw_wake_reason {
1944bc17f7SChin-Yen Lee RTW_WOW_RSN_RX_PTK_REKEY = 0x1,
2044bc17f7SChin-Yen Lee RTW_WOW_RSN_RX_GTK_REKEY = 0x2,
2144bc17f7SChin-Yen Lee RTW_WOW_RSN_RX_DEAUTH = 0x8,
2244bc17f7SChin-Yen Lee RTW_WOW_RSN_DISCONNECT = 0x10,
2344bc17f7SChin-Yen Lee RTW_WOW_RSN_RX_MAGIC_PKT = 0x21,
24e3e400dfSChin-Yen Lee RTW_WOW_RSN_RX_PATTERN_MATCH = 0x23,
25*b6c12908SChin-Yen Lee RTW_WOW_RSN_RX_NLO = 0x55,
2644bc17f7SChin-Yen Lee };
2744bc17f7SChin-Yen Lee
2844bc17f7SChin-Yen Lee struct rtw_fw_media_status_iter_data {
2944bc17f7SChin-Yen Lee struct rtw_dev *rtwdev;
3044bc17f7SChin-Yen Lee u8 connect;
3144bc17f7SChin-Yen Lee };
3244bc17f7SChin-Yen Lee
3344bc17f7SChin-Yen Lee struct rtw_fw_key_type_iter_data {
3444bc17f7SChin-Yen Lee struct rtw_dev *rtwdev;
3544bc17f7SChin-Yen Lee u8 group_key_type;
3644bc17f7SChin-Yen Lee u8 pairwise_key_type;
3744bc17f7SChin-Yen Lee };
3844bc17f7SChin-Yen Lee
rtw_wow_mgd_linked(struct rtw_dev * rtwdev)3944bc17f7SChin-Yen Lee static inline bool rtw_wow_mgd_linked(struct rtw_dev *rtwdev)
4044bc17f7SChin-Yen Lee {
4144bc17f7SChin-Yen Lee struct ieee80211_vif *wow_vif = rtwdev->wow.wow_vif;
4244bc17f7SChin-Yen Lee struct rtw_vif *rtwvif = (struct rtw_vif *)wow_vif->drv_priv;
4344bc17f7SChin-Yen Lee
4444bc17f7SChin-Yen Lee return (rtwvif->net_type == RTW_NET_MGD_LINKED);
4544bc17f7SChin-Yen Lee }
4644bc17f7SChin-Yen Lee
rtw_wow_no_link(struct rtw_dev * rtwdev)47*b6c12908SChin-Yen Lee static inline bool rtw_wow_no_link(struct rtw_dev *rtwdev)
48*b6c12908SChin-Yen Lee {
49*b6c12908SChin-Yen Lee struct ieee80211_vif *wow_vif = rtwdev->wow.wow_vif;
50*b6c12908SChin-Yen Lee struct rtw_vif *rtwvif = (struct rtw_vif *)wow_vif->drv_priv;
51*b6c12908SChin-Yen Lee
52*b6c12908SChin-Yen Lee return (rtwvif->net_type == RTW_NET_NO_LINK);
53*b6c12908SChin-Yen Lee }
54*b6c12908SChin-Yen Lee
5544bc17f7SChin-Yen Lee int rtw_wow_suspend(struct rtw_dev *rtwdev, struct cfg80211_wowlan *wowlan);
5644bc17f7SChin-Yen Lee int rtw_wow_resume(struct rtw_dev *rtwdev);
5744bc17f7SChin-Yen Lee
5844bc17f7SChin-Yen Lee #endif
59