2022-06-08 23:46:35 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
|
|
|
|
/* Copyright(c) 2007 - 2011 Realtek Corporation. */
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
#ifndef __RTW_P2P_H_
|
|
|
|
#define __RTW_P2P_H_
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
#include "drv_types.h"
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
u32 build_beacon_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
|
|
|
|
u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
|
2013-08-14 02:01:38 +00:00
|
|
|
u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo,
|
|
|
|
u8 *pbuf, u8 *pssid, u8 ussidlen,
|
|
|
|
u8 *pdev_raddr);
|
|
|
|
u32 build_assoc_resp_p2p_ie(struct wifidirect_info *pwdinfo,
|
|
|
|
u8 *pbuf, u8 status_code);
|
|
|
|
u32 process_probe_req_p2p_ie(struct wifidirect_info *pwdinfo,
|
|
|
|
u8 *pframe, uint len);
|
|
|
|
u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo,
|
|
|
|
u8 *pframe, uint len, struct sta_info *psta);
|
|
|
|
u32 process_p2p_devdisc_req(struct wifidirect_info *pwdinfo,
|
|
|
|
u8 *pframe, uint len);
|
|
|
|
u32 process_p2p_devdisc_resp(struct wifidirect_info *pwdinfo,
|
|
|
|
u8 *pframe, uint len);
|
|
|
|
u8 process_p2p_provdisc_req(struct wifidirect_info *pwdinfo,
|
|
|
|
u8 *pframe, uint len);
|
2013-05-08 21:45:39 +00:00
|
|
|
u8 process_p2p_provdisc_resp(struct wifidirect_info *pwdinfo, u8 *pframe);
|
2013-08-14 02:01:38 +00:00
|
|
|
u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo,
|
|
|
|
u8 *pframe, uint len);
|
|
|
|
u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo,
|
|
|
|
u8 *pframe, uint len);
|
|
|
|
u8 process_p2p_group_negotation_confirm(struct wifidirect_info *pwdinfo,
|
2013-08-16 01:04:25 +00:00
|
|
|
u8 *pframe, uint len);
|
2013-08-14 02:01:38 +00:00
|
|
|
u8 process_p2p_presence_req(struct wifidirect_info *pwdinfo, u8 *pframe,
|
|
|
|
uint len);
|
|
|
|
void p2p_protocol_wk_hdl(struct adapter *padapter, int intcmdtype);
|
|
|
|
void process_p2p_ps_ie(struct adapter *padapter, u8 *ies, u32 ielength);
|
|
|
|
void p2p_ps_wk_hdl(struct adapter *padapter, u8 p2p_ps_state);
|
|
|
|
u8 p2p_ps_wk_cmd(struct adapter *padapter, u8 p2p_ps_state, u8 enqueue);
|
|
|
|
void reset_global_wifidirect_info(struct adapter *padapter);
|
|
|
|
int rtw_init_wifi_display_info(struct adapter *padapter);
|
|
|
|
void rtw_init_wifidirect_timers(struct adapter *padapter);
|
|
|
|
void rtw_init_wifidirect_addrs(struct adapter *padapter, u8 *dev_addr,
|
|
|
|
u8 *iface_addr);
|
|
|
|
void init_wifidirect_info(struct adapter *padapter, enum P2P_ROLE role);
|
2013-07-27 01:08:39 +00:00
|
|
|
int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-14 02:01:38 +00:00
|
|
|
static inline void _rtw_p2p_set_state(struct wifidirect_info *wdinfo,
|
|
|
|
enum P2P_STATE state)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-14 02:01:38 +00:00
|
|
|
if (wdinfo->p2p_state != state)
|
2013-05-08 21:45:39 +00:00
|
|
|
wdinfo->p2p_state = state;
|
|
|
|
}
|
2013-05-18 21:16:10 +00:00
|
|
|
|
2013-08-14 02:01:38 +00:00
|
|
|
static inline void _rtw_p2p_set_pre_state(struct wifidirect_info *wdinfo,
|
|
|
|
enum P2P_STATE state)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-14 02:01:38 +00:00
|
|
|
if (wdinfo->pre_p2p_state != state)
|
2013-05-08 21:45:39 +00:00
|
|
|
wdinfo->pre_p2p_state = state;
|
|
|
|
}
|
2013-05-18 21:16:10 +00:00
|
|
|
|
2013-08-14 02:01:38 +00:00
|
|
|
static inline void _rtw_p2p_set_role(struct wifidirect_info *wdinfo,
|
|
|
|
enum P2P_ROLE role)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-14 02:01:38 +00:00
|
|
|
if (wdinfo->role != role)
|
2013-05-08 21:45:39 +00:00
|
|
|
wdinfo->role = role;
|
|
|
|
}
|
2013-08-14 02:01:38 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
static inline int _rtw_p2p_state(struct wifidirect_info *wdinfo)
|
|
|
|
{
|
|
|
|
return wdinfo->p2p_state;
|
|
|
|
}
|
2013-08-14 02:01:38 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
static inline int _rtw_p2p_pre_state(struct wifidirect_info *wdinfo)
|
|
|
|
{
|
|
|
|
return wdinfo->pre_p2p_state;
|
|
|
|
}
|
2013-08-14 02:01:38 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
static inline int _rtw_p2p_role(struct wifidirect_info *wdinfo)
|
|
|
|
{
|
|
|
|
return wdinfo->role;
|
|
|
|
}
|
2013-08-14 02:01:38 +00:00
|
|
|
|
|
|
|
static inline bool _rtw_p2p_chk_state(struct wifidirect_info *wdinfo,
|
|
|
|
enum P2P_STATE state)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
return wdinfo->p2p_state == state;
|
|
|
|
}
|
2013-08-14 02:01:38 +00:00
|
|
|
|
|
|
|
static inline bool _rtw_p2p_chk_role(struct wifidirect_info *wdinfo,
|
|
|
|
enum P2P_ROLE role)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
return wdinfo->role == role;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define rtw_p2p_set_state(wdinfo, state) _rtw_p2p_set_state(wdinfo, state)
|
2013-08-14 02:01:38 +00:00
|
|
|
#define rtw_p2p_set_pre_state(wdinfo, state) \
|
|
|
|
_rtw_p2p_set_pre_state(wdinfo, state)
|
2013-05-08 21:45:39 +00:00
|
|
|
#define rtw_p2p_set_role(wdinfo, role) _rtw_p2p_set_role(wdinfo, role)
|
|
|
|
|
|
|
|
#define rtw_p2p_state(wdinfo) _rtw_p2p_state(wdinfo)
|
|
|
|
#define rtw_p2p_pre_state(wdinfo) _rtw_p2p_pre_state(wdinfo)
|
|
|
|
#define rtw_p2p_role(wdinfo) _rtw_p2p_role(wdinfo)
|
|
|
|
#define rtw_p2p_chk_state(wdinfo, state) _rtw_p2p_chk_state(wdinfo, state)
|
|
|
|
#define rtw_p2p_chk_role(wdinfo, role) _rtw_p2p_chk_role(wdinfo, role)
|
|
|
|
|
|
|
|
#define rtw_p2p_findphase_ex_set(wdinfo, value) \
|
2013-08-14 02:01:38 +00:00
|
|
|
((wdinfo)->find_phase_state_exchange_cnt = (value))
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-12 04:36:23 +00:00
|
|
|
/* is this find phase exchange for social channel scan? */
|
2013-05-08 21:45:39 +00:00
|
|
|
#define rtw_p2p_findphase_ex_is_social(wdinfo) \
|
2013-08-14 02:01:38 +00:00
|
|
|
((wdinfo)->find_phase_state_exchange_cnt >= P2P_FINDPHASE_EX_SOCIAL_FIRST)
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-12 04:36:23 +00:00
|
|
|
/* should we need find phase exchange anymore? */
|
2013-05-08 21:45:39 +00:00
|
|
|
#define rtw_p2p_findphase_ex_is_needed(wdinfo) \
|
|
|
|
((wdinfo)->find_phase_state_exchange_cnt < P2P_FINDPHASE_EX_MAX && \
|
|
|
|
(wdinfo)->find_phase_state_exchange_cnt != P2P_FINDPHASE_EX_NONE)
|
|
|
|
|
|
|
|
#endif
|