xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8821cs/include/rtw_mbo.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2017 Realtek Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  *****************************************************************************/
16 
17 #ifndef __RTW_MBO_H_
18 #define __RTW_MBO_H_
19 
20 #define rtw_mbo_wifi_logo_test(a)	((a->registrypriv.wifi_spec) == 1)
21 
22 #define rtw_mbo_set_ext_cap_internw(_pEleStart, _val) \
23 	SET_BITS_TO_LE_1BYTE(((u8 *)(_pEleStart))+3, 7, 1, _val)
24 
25 #define rtw_mbo_wnm_notification_req(c, a) \
26 	(((c) == RTW_WLAN_CATEGORY_WNM) &&	\
27 	(((a) == RTW_WLAN_ACTION_WNM_NOTIF_REQ)))
28 
29 /* IEEE Std 802.11-2016 Table 9-46 - Status codes */
30 #define RTW_ASSOC_DENIED_NO_MORE_STAS	17
31 #define RTW_ASSOC_REFUSED_TEMPORARILY	30
32 
33 /* MBO-OCE Information Element */
34 #define RTW_MBO_EID		WLAN_EID_VENDOR_SPECIFIC
35 #define RTW_MBO_OUI		0x506F9A
36 #define RTW_MBO_OUI_TYPE	0x16
37 
38 /* Non-preferred Channel Report */
39 #define RTW_MBO_ATTR_NPREF_CH_RPT_ID	0x2
40 /* Cellular Data Capabilities */
41 #define RTW_MBO_ATTR_CELL_DATA_CAP_ID	0x3
42 /* Association Disallowed */
43 #define RTW_MBO_ATTR_ASSOC_DISABLED_ID	0x4
44 /* Transition Reason Code */
45 #define RTW_MBO_ATTR_TRANS_RES_ID		0x6
46 /* Transition Rejection Reason Code */
47 #define RTW_MBO_ATTR_TRANS_REJ_ID		0x7
48 /* Association Retry Delay */
49 #define RTW_MBO_ATTR_TASSOC_RETRY_ID	0x8
50 
51 #define RTW_MBO_MAX_CH_LIST_NUM MAX_CHANNEL_NUM
52 
53 #define RTW_MBO_MAX_CH_RPT_NUM 32
54 
55 struct npref_ch {
56 	u8 op_class;
57 	u8 chs[RTW_MBO_MAX_CH_LIST_NUM];
58 	size_t nm_of_ch;
59 	u8 preference;
60 	u8 reason;
61 };
62 
63 struct npref_ch_rtp {
64 	struct npref_ch ch_rpt[RTW_MBO_MAX_CH_RPT_NUM];
65 	size_t nm_of_rpt;
66 };
67 
68 void rtw_mbo_build_cell_data_cap_attr(
69 	_adapter *padapter, u8 **pframe, struct pkt_attrib *pattrib);
70 
71 void rtw_mbo_update_ie_data(
72 	_adapter *padapter, u8 *pie, u32 ie_len);
73 
74 void rtw_mbo_build_supp_op_class_elem(
75 	_adapter *padapter, u8 **pframe, struct pkt_attrib *pattrib);
76 
77 void rtw_mbo_build_npref_ch_rpt_attr(
78 	_adapter *padapter, u8 **pframe, struct pkt_attrib *pattrib);
79 
80 void rtw_mbo_build_trans_reject_reason_attr(
81 	_adapter *padapter, u8 **pframe, struct pkt_attrib *pattrib, u8 *pres);
82 
83 u8 rtw_mbo_disallowed_network(struct wlan_network *pnetwork);
84 
85 void rtw_mbo_build_exented_cap(
86 	_adapter *padapter, u8 **pframe, struct pkt_attrib *pattrib);
87 
88 ssize_t rtw_mbo_proc_non_pref_chans_set(
89 	struct file *pfile, const char __user *buffer,
90 	size_t count, loff_t *pos, void *pdata);
91 
92 int rtw_mbo_proc_non_pref_chans_get(
93 	struct seq_file *m, void *v);
94 
95 ssize_t rtw_mbo_proc_cell_data_set(
96 	struct file *pfile, const char __user *buffer,
97 	size_t count, loff_t *pos, void *pdata);
98 
99 int rtw_mbo_proc_cell_data_get(
100 	struct seq_file *m, void *v);
101 
102 void rtw_mbo_wnm_notification_parsing(
103 	_adapter *padapter, const u8 *pdata, size_t data_len);
104 
105 void rtw_mbo_build_wnm_notification(
106 	_adapter *padapter, u8 **pframe, struct pkt_attrib *pattrib);
107 
108 void rtw_mbo_build_probe_req_ies(
109 	_adapter *padapter, u8 **pframe, struct pkt_attrib *pattrib);
110 
111 void rtw_mbo_build_assoc_req_ies(
112 	_adapter *padapter, u8 **pframe, struct pkt_attrib *pattrib);
113 
114 #endif /* __RTW_MBO_H_ */
115 
116