OSDN Git Service

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