GNU Linux-libre 4.19.286-gnu1
[releases.git] / drivers / staging / rtl8723bs / include / ioctl_cfg80211.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5  *
6  ******************************************************************************/
7 #ifndef __IOCTL_CFG80211_H__
8 #define __IOCTL_CFG80211_H__
9
10 #include <linux/version.h>
11
12 struct rtw_wdev_invit_info {
13         u8 state; /* 0: req, 1:rep */
14         u8 peer_mac[ETH_ALEN];
15         u8 active;
16         u8 token;
17         u8 flags;
18         u8 status;
19         u8 req_op_ch;
20         u8 rsp_op_ch;
21 };
22
23 #define rtw_wdev_invit_info_init(invit_info) \
24         do { \
25                 (invit_info)->state = 0xff; \
26                 memset((invit_info)->peer_mac, 0, ETH_ALEN); \
27                 (invit_info)->active = 0xff; \
28                 (invit_info)->token = 0; \
29                 (invit_info)->flags = 0x00; \
30                 (invit_info)->status = 0xff; \
31                 (invit_info)->req_op_ch = 0; \
32                 (invit_info)->rsp_op_ch = 0; \
33         } while (0)
34
35 struct rtw_wdev_nego_info {
36         u8 state; /* 0: req, 1:rep, 2:conf */
37         u8 peer_mac[ETH_ALEN];
38         u8 active;
39         u8 token;
40         u8 status;
41         u8 req_intent;
42         u8 req_op_ch;
43         u8 req_listen_ch;
44         u8 rsp_intent;
45         u8 rsp_op_ch;
46         u8 conf_op_ch;
47 };
48
49 #define rtw_wdev_nego_info_init(nego_info) \
50         do { \
51                 (nego_info)->state = 0xff; \
52                 memset((nego_info)->peer_mac, 0, ETH_ALEN); \
53                 (nego_info)->active = 0xff; \
54                 (nego_info)->token = 0; \
55                 (nego_info)->status = 0xff; \
56                 (nego_info)->req_intent = 0xff; \
57                 (nego_info)->req_op_ch = 0; \
58                 (nego_info)->req_listen_ch = 0; \
59                 (nego_info)->rsp_intent = 0xff; \
60                 (nego_info)->rsp_op_ch = 0; \
61                 (nego_info)->conf_op_ch = 0; \
62         } while (0)
63
64 struct rtw_wdev_priv
65 {
66         struct wireless_dev *rtw_wdev;
67
68         struct adapter *padapter;
69
70         struct cfg80211_scan_request *scan_request;
71         _lock scan_req_lock;
72
73         struct net_device *pmon_ndev;/* for monitor interface */
74         char ifname_mon[IFNAMSIZ + 1]; /* interface name for monitor interface */
75
76         u8 p2p_enabled;
77
78         u8 provdisc_req_issued;
79
80         struct rtw_wdev_invit_info invit_info;
81         struct rtw_wdev_nego_info nego_info;
82
83         u8 bandroid_scan;
84         bool block;
85         bool power_mgmt;
86 };
87
88 #define wiphy_to_adapter(x) (*((struct adapter **)wiphy_priv(x)))
89
90 #define wdev_to_ndev(w) ((w)->netdev)
91
92 int rtw_wdev_alloc(struct adapter *padapter, struct device *dev);
93 void rtw_wdev_free(struct wireless_dev *wdev);
94 void rtw_wdev_unregister(struct wireless_dev *wdev);
95
96 void rtw_cfg80211_init_wiphy(struct adapter *padapter);
97
98 void rtw_cfg80211_unlink_bss(struct adapter *padapter, struct wlan_network *pnetwork);
99 void rtw_cfg80211_surveydone_event_callback(struct adapter *padapter);
100 struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wlan_network *pnetwork);
101 int rtw_cfg80211_check_bss(struct adapter *padapter);
102 void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter);
103 void rtw_cfg80211_indicate_connect(struct adapter *padapter);
104 void rtw_cfg80211_indicate_disconnect(struct adapter *padapter);
105 void rtw_cfg80211_indicate_scan_done(struct adapter *adapter, bool aborted);
106
107 void rtw_cfg80211_indicate_sta_assoc(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len);
108 void rtw_cfg80211_indicate_sta_disassoc(struct adapter *padapter, unsigned char *da, unsigned short reason);
109
110 void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len, const char*msg);
111
112 bool rtw_cfg80211_pwr_mgmt(struct adapter *adapter);
113
114 #define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->rtw_wdev, freq, sig_dbm, buf, len, 0)
115 #define rtw_cfg80211_send_rx_assoc(adapter, bss, buf, len) cfg80211_send_rx_assoc((adapter)->pnetdev, bss, buf, len)
116 #define rtw_cfg80211_mgmt_tx_status(adapter, cookie, buf, len, ack, gfp) cfg80211_mgmt_tx_status((adapter)->rtw_wdev, cookie, buf, len, ack, gfp)
117 #define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp)  cfg80211_ready_on_channel((adapter)->rtw_wdev, cookie, chan, duration, gfp)
118 #define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->rtw_wdev, cookie, chan, gfp)
119
120 #endif /* __IOCTL_CFG80211_H__ */