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