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 struct wireless_dev *rtw_wdev; 66 67 struct adapter *padapter; 68 69 struct cfg80211_scan_request *scan_request; 70 _lock scan_req_lock; 71 72 struct net_device *pmon_ndev;/* for monitor interface */ 73 char ifname_mon[IFNAMSIZ + 1]; /* interface name for monitor interface */ 74 75 u8 p2p_enabled; 76 77 u8 provdisc_req_issued; 78 79 struct rtw_wdev_invit_info invit_info; 80 struct rtw_wdev_nego_info nego_info; 81 82 u8 bandroid_scan; 83 bool block; 84 bool power_mgmt; 85 }; 86 87 #define wiphy_to_adapter(x) (*((struct adapter **)wiphy_priv(x))) 88 89 #define wdev_to_ndev(w) ((w)->netdev) 90 91 int rtw_wdev_alloc(struct adapter *padapter, struct device *dev); 92 void rtw_wdev_free(struct wireless_dev *wdev); 93 void rtw_wdev_unregister(struct wireless_dev *wdev); 94 95 void rtw_cfg80211_init_wiphy(struct adapter *padapter); 96 97 void rtw_cfg80211_unlink_bss(struct adapter *padapter, struct wlan_network *pnetwork); 98 void rtw_cfg80211_surveydone_event_callback(struct adapter *padapter); 99 struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wlan_network *pnetwork); 100 int rtw_cfg80211_check_bss(struct adapter *padapter); 101 void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter); 102 void rtw_cfg80211_indicate_connect(struct adapter *padapter); 103 void rtw_cfg80211_indicate_disconnect(struct adapter *padapter); 104 void rtw_cfg80211_indicate_scan_done(struct adapter *adapter, bool aborted); 105 106 void rtw_cfg80211_indicate_sta_assoc(struct adapter *padapter, u8 *pmgmt_frame, uint frame_len); 107 void rtw_cfg80211_indicate_sta_disassoc(struct adapter *padapter, unsigned char *da, unsigned short reason); 108 109 void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len, const char*msg); 110 111 bool rtw_cfg80211_pwr_mgmt(struct adapter *adapter); 112 113 #define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->rtw_wdev, freq, sig_dbm, buf, len, 0) 114 #define rtw_cfg80211_send_rx_assoc(adapter, bss, buf, len) cfg80211_send_rx_assoc((adapter)->pnetdev, bss, buf, len) 115 #define rtw_cfg80211_mgmt_tx_status(adapter, cookie, buf, len, ack, gfp) cfg80211_mgmt_tx_status((adapter)->rtw_wdev, cookie, buf, len, ack, gfp) 116 #define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->rtw_wdev, cookie, chan, duration, gfp) 117 #define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->rtw_wdev, cookie, chan, gfp) 118 119 #endif /* __IOCTL_CFG80211_H__ */ 120