xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852bs/include/rtw_p2p.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2019 Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  *****************************************************************************/
15 #ifndef __RTW_P2P_H_
16 #define __RTW_P2P_H_
17 
18 
19 u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 *pssid, u8 ussidlen, u8 *pdev_raddr);
20 #ifdef CONFIG_WFD
21 int rtw_init_wifi_display_info(_adapter *padapter);
22 void rtw_wfd_enable(_adapter *adapter, bool on);
23 void rtw_wfd_set_ctrl_port(_adapter *adapter, u16 port);
24 void rtw_tdls_wfd_enable(_adapter *adapter, bool on);
25 
26 u32 build_probe_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
27 u32 build_probe_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 tunneled);
28 u32 build_beacon_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
29 u32 build_nego_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
30 u32 build_nego_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
31 u32 build_nego_confirm_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
32 u32 build_invitation_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
33 u32 build_invitation_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
34 u32 build_assoc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
35 u32 build_assoc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
36 u32 build_provdisc_req_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
37 u32 build_provdisc_resp_wfd_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
38 
39 u32 rtw_append_beacon_wfd_ie(_adapter *adapter, u8 *pbuf);
40 u32 rtw_append_probe_req_wfd_ie(_adapter *adapter, u8 *pbuf);
41 u32 rtw_append_probe_resp_wfd_ie(_adapter *adapter, u8 *pbuf);
42 u32 rtw_append_assoc_req_wfd_ie(_adapter *adapter, u8 *pbuf);
43 u32 rtw_append_assoc_resp_wfd_ie(_adapter *adapter, u8 *pbuf);
44 #endif /*CONFIG_WFD */
45 
46 void rtw_xframe_chk_wfd_ie(struct xmit_frame *xframe);
47 
48 u32 process_probe_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint len);
49 u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint len, struct sta_info *psta);
50 u8 process_p2p_presence_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint len);
51 int process_p2p_cross_connect_ie(_adapter *padapter, u8 *IEs, u32 IELength);
52 
53 #ifdef CONFIG_P2P_PS
54 void	process_p2p_ps_ie(_adapter *padapter, u8 *IEs, u32 IELength);
55 void	p2p_ps_wk_hdl(_adapter *padapter, u8 p2p_ps_state);
56 u8	p2p_ps_wk_cmd(_adapter *padapter, u8 p2p_ps_state, u8 enqueue);
57 #endif /* CONFIG_P2P_PS */
58 
59 #ifdef CONFIG_IOCTL_CFG80211
60 int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx);
61 #endif /* CONFIG_IOCTL_CFG80211 */
62 
63 void reset_global_wifidirect_info(_adapter *padapter);
64 void init_wifidirect_info(_adapter *padapter, enum P2P_ROLE role);
65 int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role);
66 
67 void _rtw_p2p_set_role(struct wifidirect_info *wdinfo, enum P2P_ROLE role);
68 
_rtw_p2p_role(struct wifidirect_info * wdinfo)69 static inline int _rtw_p2p_role(struct wifidirect_info *wdinfo)
70 {
71 	return wdinfo->role;
72 }
_rtw_p2p_chk_role(struct wifidirect_info * wdinfo,enum P2P_ROLE role)73 static inline bool _rtw_p2p_chk_role(struct wifidirect_info *wdinfo, enum P2P_ROLE role)
74 {
75 	return wdinfo->role == role;
76 }
77 
78 #ifdef CONFIG_DBG_P2P
79 void dbg_rtw_p2p_set_role(struct wifidirect_info *wdinfo, enum P2P_ROLE role, const char *caller, int line);
80 #define rtw_p2p_set_role(wdinfo, role) dbg_rtw_p2p_set_role(wdinfo, role, __FUNCTION__, __LINE__)
81 #else /* CONFIG_DBG_P2P */
82 #define rtw_p2p_set_role(wdinfo, role) _rtw_p2p_set_role(wdinfo, role)
83 #endif /* CONFIG_DBG_P2P */
84 
85 #define rtw_p2p_role(wdinfo) _rtw_p2p_role(wdinfo)
86 #define rtw_p2p_chk_role(wdinfo, role) _rtw_p2p_chk_role(wdinfo, role)
87 
88 #endif
89