1 /*
2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 #ifndef __MAC_USER_H__
20 #define __MAC_USER_H__
21
22 /* ****************************************************************************
23 1 其他头文件包含
24 **************************************************************************** */
25 #include "oal_ext_if.h"
26 #include "frw_timer.h"
27 #include "wlan_types.h"
28 #include "wlan_mib.h"
29 #include "mac_frame.h"
30
31 #ifdef __cplusplus
32 #if __cplusplus
33 extern "C" {
34 #endif
35 #endif
36
37 /* ****************************************************************************
38 2 宏定义
39 *****************************************************************************/
40 #define MAC_USER_INIT_STREAM 1
41 #define MAC_INVALID_USER_ID 0xff /* 非法用户ID芯片最大规格,防止不同版本用户数量变更 */
42 #define MAC_INVALID_USER_ID2 0xf
43 #define MAC_USER_FREED 0 /* USER资源未申请 */
44 #define MAC_USER_ALLOCED 1 /* USER已被申请 */
45
46 #ifdef _PRE_WLAN_FEATURE_REKEY_OFFLOAD
47 #define MAC_REKEY_OFFLOAD_KCK_LEN 16
48 #define MAC_REKEY_OFFLOAD_KEK_LEN 16
49 #define MAC_REKEY_OFFLOAD_REPLAY_LEN 8
50 #endif
51
52 /* ****************************************************************************
53 STRUCT定义
54 **************************************************************************** */
55 typedef struct {
56 wlan_security_txop_params_stru security;
57 } mac_user_tx_param_stru;
58
59 typedef struct {
60 hi_u8 rs_nrates; /* 个数 */
61 hi_u8 auc_resv[3]; /* 3 BYTE 保留字段 */
62 hi_u8 auc_rs_rates[WLAN_MAX_SUPP_RATES]; /* 速率 */
63 } mac_rate_stru;
64
65 typedef struct {
66 hi_u32 spectrum_mgmt : 1, /* 频谱管理: 0=不支持, 1=支持 */
67 qos : 1, /* QOS: 0=非QOS站点, 1=QOS站点 */
68 barker_preamble_mode: 1, /* 供STA保存BSS中站点是否都支持short preamble, 0=支持, 1=不支持 */
69 /* 自动节能: 0=不支持, 1=支持 目前bit_apsd只有写没有读,wifi联盟已自己定义了WMM节能IE代替
70 cap apsd功能 ,此处预留为后续可能出的兼容性问题提供接口 */
71 apsd : 1,
72 pmf_active : 1, /* 管理帧加密使能开关 */
73 erp_use_protect : 1, /* 供STA保存AP是否启用了ERP保护 */
74 ntxbf : 1,
75 bit_resv : 25;
76 } mac_user_cap_info_stru;
77
78 /* user下ht相关信息 */
79 typedef struct {
80 hi_u8 ht_capable : 1, /* HT capable */
81 max_rx_ampdu_factor : 2, /* Max AMPDU Rx Factor 2bits */
82 min_mpdu_start_spacing : 3, /* Min AMPDU Start Spacing 3bits */
83 htc_support : 1, /* HTC 域支持 */
84 uc_resv : 1;
85 hi_u8 primary_channel;
86
87 mac_frame_ht_cap_stru ht_capinfo;
88 hi_u8 rx_mcs_bitmask[WLAN_HT_MCS_BITMASK_LEN]; /* Rx MCS bitmask */
89 hi_u8 secondary_chan_offset : 2,
90 sta_chan_width : 1,
91 rifs_mode : 1,
92 ht_protection : 2,
93 nongf_sta_present : 1,
94 obss_nonht_sta_present : 1;
95 hi_u8 dual_beacon : 1,
96 dual_cts_protection : 1,
97 secondary_beacon : 1,
98 lsig_txop_protection_full_support : 1,
99 pco_active : 1,
100 pco_phase : 1,
101 resv6 : 2;
102
103 hi_u32 imbf_receive_cap : 1, /* 隐式TxBf接收能力 */
104 receive_staggered_sounding_cap : 1, /* 接收交错探测帧的能力 */
105 transmit_staggered_sounding_cap : 1, /* 发送交错探测帧的能力 */
106 receive_ndp_cap : 1, /* 接收NDP能力 */
107 transmit_ndp_cap : 1, /* 发送NDP能力 */
108 imbf_cap : 1, /* 隐式TxBf能力 */
109 /* 0=不支持,1=站点可以用CSI报告相应校准请求,但不能发起校准,2=保留,3=站点可以发起,
110 也可以相应校准请求 */
111 calibration : 2,
112 exp_csi_txbf_cap : 1, /* 应用CSI反馈进行TxBf的能力 */
113 exp_noncomp_txbf_cap : 1, /* 应用非压缩矩阵进行TxBf的能力 */
114 exp_comp_txbf_cap : 1, /* 应用压缩矩阵进行TxBf的能力 */
115 exp_csi_feedback : 2, /* 0=不支持,1=延迟反馈,2=立即反馈,3=延迟和立即反馈 */
116 exp_noncomp_feedback : 2, /* 0=不支持,1=延迟反馈,2=立即反馈,3=延迟和立即反馈 */
117 exp_comp_feedback : 2, /* 0=不支持,1=延迟反馈,2=立即反馈,3=延迟和立即反馈 */
118 min_grouping : 2, /* 0=不分组,1=1,2分组,2=1,4分组,3=1,2,4分组 */
119 /* CSI反馈时,bfee最多支持的beamformer天线数,0=1Tx天线探测,1=2Tx天线探测,2=3Tx天线探测,
120 3=4Tx天线探测 */
121 csi_bfer_ant_number : 2,
122 /* 非压缩矩阵反馈时,bfee最多支持的beamformer天线数,0=1Tx天线探测,1=2Tx天线探测,
123 2=3Tx天线探测,3=4Tx天线探测 */
124 noncomp_bfer_ant_number : 2,
125 /* 压缩矩阵反馈时,bfee最多支持的beamformer天线数,0=1Tx天线探测,1=2Tx天线探测,
126 2=3Tx天线探测,3=4Tx天线探测 */
127 comp_bfer_ant_number : 2,
128 csi_bfee_max_rows : 2, /* bfer支持的来自bfee的CSI显示反馈的最大行数 */
129 channel_est_cap : 2, /* 信道估计的能力,0=1空时流,依次递增 */
130 reserved : 3;
131 }mac_user_ht_hdl_stru;
132
133 typedef struct {
134 hi_u16 us_max_mcs_1ss : 2, /* 一个空间流的MCS最大支持MAP */
135 us_max_mcs_2ss : 2, /* 一个空间流的MCS最大支持MAP */
136 us_max_mcs_3ss : 2, /* 一个空间流的MCS最大支持MAP */
137 us_max_mcs_4ss : 2, /* 一个空间流的MCS最大支持MAP */
138 us_max_mcs_5ss : 2, /* 一个空间流的MCS最大支持MAP */
139 us_max_mcs_6ss : 2, /* 一个空间流的MCS最大支持MAP */
140 us_max_mcs_7ss : 2, /* 一个空间流的MCS最大支持MAP */
141 us_max_mcs_8ss : 2; /* 一个空间流的MCS最大支持MAP */
142 } mac_max_mcs_map_stru;
143
144 typedef mac_max_mcs_map_stru mac_tx_max_mcs_map_stru;
145 typedef mac_max_mcs_map_stru mac_rx_max_mcs_map_stru;
146
147 typedef struct {
148 hi_u16 us_max_mpdu_length;
149 hi_u16 us_basic_mcs_set;
150
151 mac_vht_cap_info_stru vht_cap_info;
152
153 mac_tx_max_mcs_map_stru tx_max_mcs_map;
154 mac_rx_max_mcs_map_stru rx_max_mcs_map;
155
156 hi_u16 rx_highest_rate : 13,
157 resv2 : 3;
158 hi_u16 tx_highest_rate : 13,
159 resv3 : 3; /* 解析vht Capabilities IE: VHT Supported MCS Set field */
160
161 hi_u8 vht_capable; /* VHT capable */
162
163 /* vht operation只有是ap的情况下有 */
164 hi_u8 channel_width; /* 解析VHT Operation IE */
165 /* uc_channel_width的取值,0 -- 20/40M, 1 -- 80M, 2 -- 160M */
166 hi_u8 channel_center_freq_seg0;
167 hi_u8 channel_center_freq_seg1;
168 } mac_vht_hdl_stru;
169
170 /* user结构体,对SA Query流程信息的保存结构 */
171 typedef struct {
172 hi_u16 us_sa_query_count; /* number of pending SA Query requests, 0 = no SA Query in progress */
173 hi_u16 us_sa_query_trans_id; /* trans id */
174 hi_u32 sa_query_start_time; /* sa_query 流程开始时间,单位ms */
175 frw_timeout_stru sa_query_interval_timer; /* SA Query 间隔定时器,相关dot11AssociationSAQueryRetryTimeout */
176 } mac_sa_query_stru;
177
178 typedef struct {
179 hi_u8 qos_info; /* 关联请求中的WMM IE的QOS info field */
180 hi_u8 max_sp_len; /* 从qos info字段中提取翻译的最大服务长度 */
181 hi_u8 auc_resv[2]; /* 2 byte 保留字段 */
182 hi_u8 ac_trigger_ena[WLAN_WME_AC_BUTT]; /* 4个AC的trigger能力 */
183 hi_u8 ac_delievy_ena[WLAN_WME_AC_BUTT]; /* 4个AC的delivery能力 */
184 } mac_user_uapsd_status_stru;
185
186 /* 用户与AP的关联状态枚举 */
187 typedef enum {
188 MAC_USER_STATE_AUTH_COMPLETE = 1,
189 MAC_USER_STATE_AUTH_KEY_SEQ1 = 2,
190 MAC_USER_STATE_ASSOC = 3,
191
192 MAC_USER_STATE_BUTT = 4
193 } hmac_user_asoc_state_enum;
194 typedef hi_u8 mac_user_asoc_state_enum_uint8;
195 typedef struct {
196 hi_u8 auc_user_addr[WLAN_MAC_ADDR_LEN]; /* 用户mac地址 */
197 hi_u8 conn_rx_rssi;
198 mac_user_asoc_state_enum_uint8 assoc_state;
199 hi_u8 bcn_prio;
200 hi_u8 is_mesh_user;
201 hi_u8 is_initiative_role;
202 } mac_user_assoc_info_stru;
203
204 /* 802.1X-port 状态结构体 */
205 /* 1X端口状态说明: */
206 /* 1) portvalid && keydone 都是 TRUE: 表示端口处于合法状态 */
207 /* 2) portvalid == TRUE && keydone == FALSE:表示端口处于未知状态 */
208 /* 密钥还未生效 */
209 /* 3) portValid == FALSE && keydone== TRUE:表示端口处于非法状态 */
210 /* 密钥获取失败 */
211 /* 4) portValid && keyDone are FALSE: 表示端口处于合法状态 */
212 /* 密钥还未生效 */
213 typedef struct {
214 hi_u8 keydone; /* 端口合法性是否允许测试 */
215 hi_u8 portvalid; /* 端口合法性标识 */
216 hi_u8 auc_resv0[2]; /* 2 BYTE 保留字段 */
217 } mac_8021x_port_status_stru;
218 /* 供AP查看STA是否被统计到对应项 */
219 typedef struct {
220 /* 指示user是否被统计到no short slot num中, 0表示未被统计, 1表示已被统计 */
221 hi_u8 no_short_slot_stats_flag :1;
222 hi_u8 no_short_preamble_stats_flag :1; /* 指示user是否被统计到no short preamble num中 */
223 hi_u8 no_erp_stats_flag :1; /* 指示user是否被统计到no erp num中 */
224 hi_u8 no_ht_stats_flag :1; /* 指示user是否被统计到no ht num中 */
225 hi_u8 no_gf_stats_flag :1; /* 指示user是否被统计到no gf num中 */
226 hi_u8 m_only_stats_flag :1; /* 指示user是否被统计到no 20M only num中 */
227 hi_u8 no_40dsss_stats_flag :1; /* 指示user是否被统计到no 40dsss num中 */
228 hi_u8 no_lsig_txop_stats_flag :1; /* 指示user是否被统计到no lsig txop num中 */
229 } mac_user_stats_flag_stru;
230 /* AP侧keepalive活动的控制结构体 */
231 typedef struct {
232 hi_u8 keepalive_count_ap; /* AP定时保活检测操作计数器 */
233 /* 复用aging timer/STA省电模式定时清醒策略,定时发送keepalive帧的计数器 */
234 hi_u8 timer_to_keepalive_count;
235 hi_u8 delay_flag; /* 标志用户进入睡眠状态或者其他不能马上收帧反馈的状态 */
236
237 hi_u8 auc_resv[1];
238 } mac_user_keepalive;
239 /* 密钥管理结构体 */
240 typedef struct {
241 wlan_ciper_protocol_type_enum_uint8 cipher_type : 7;
242 hi_u8 gtk : 1; /* 指示RX GTK的槽位,02使用 */
243 hi_u8 default_index; /* 默认索引 */
244 hi_u8 igtk_key_index; /* igtk索引 */
245 hi_u8 last_gtk_key_idx; /* igtk索引 */
246
247 wlan_priv_key_param_stru ast_key[WLAN_NUM_TK + WLAN_NUM_IGTK]; /* key缓存 */
248 } mac_key_mgmt_stru;
249 /* 空间流信息结构体 */
250 typedef struct {
251 hi_u8 user_idx;
252 hi_u8 uc_resv;
253 hi_u8 avail_num_spatial_stream; /* Tx和Rx支持Nss的交集,供算法调用 */
254 hi_u8 num_spatial_stream; /* 用户支持的空间流个数 */
255 } mac_user_nss_stru;
256 /* opmode信息结构体 */
257 typedef struct {
258 hi_u8 user_idx;
259 hi_u8 avail_num_spatial_stream; /* Tx和Rx支持Nss的交集,供算法调用 */
260 hi_u8 avail_bf_num_spatial_stream; /* 用户支持的Beamforming空间流个数 */
261 hi_u8 frame_type;
262
263 wlan_bw_cap_enum_uint8 avail_bandwidth; /* 用户和VAP带宽能力交集,供算法调用 */
264 wlan_bw_cap_enum_uint8 cur_bandwidth; /* 默认值与en_avail_bandwidth相同,供算法调用修改 */
265 hi_u8 auc_resv[2]; /* 2 BYTE 保留字段 */
266 } mac_user_opmode_stru;
267 typedef struct mac_key_params_tag {
268 hi_u8 auc_key[OAL_WPA_KEY_LEN];
269 hi_u8 auc_seq[OAL_WPA_SEQ_LEN];
270 hi_s32 key_len;
271 hi_s32 seq_len;
272 hi_u32 cipher;
273 } mac_key_params_stru;
274 #ifdef _PRE_WLAN_FEATURE_REKEY_OFFLOAD
275 typedef struct _mac_rekey_offload_stru {
276 hi_u8 auc_kck[MAC_REKEY_OFFLOAD_KCK_LEN];
277 hi_u8 auc_kek[MAC_REKEY_OFFLOAD_KEK_LEN];
278 hi_u8 auc_replay_ctr[MAC_REKEY_OFFLOAD_REPLAY_LEN];
279 } mac_rekey_offload_stru;
280 #endif
281 #ifdef _PRE_WLAN_FEATURE_MESH
282 typedef struct _mac_set_mesh_user_gtk_stru {
283 hi_u8 auc_addr[WLAN_MAC_ADDR_LEN];
284 hi_u8 auc_gtk[WLAN_CCMP_KEY_LEN];
285 } mac_set_mesh_user_gtk_stru;
286 #endif
287 /* mac user结构体, hmac_user_stru和dmac_user_stru公共部分 */
288 typedef struct {
289 /* 当前VAP工作在AP或STA模式,以下字段为user是STA或AP时公共字段,新添加字段请注意!!! */
290 hi_list user_dlist; /* 用于hash双向链中的双向链表 */
291 hi_u8 vap_id : 4, /* vap ID 0-7 */
292 is_mesh_user : 1, /* 标志该User用户是否为Mesh骨干网用户 */
293 port_valid : 1, /* 802.1X端口合法性标识 */
294 is_multi_user : 1,
295 is_mesh_mbr : 1; /* 标识关联节点是否为MBR节点 */
296 hi_u8 user_hash_idx; /* 索引值(关联) */
297 hi_u8 user_mac_addr[WLAN_MAC_ADDR_LEN]; /* user对应的MAC地址 */
298
299 hi_u8 is_user_alloced : 1, /* 标志此user资源是否已经被申请 */
300 mesh_user_leave : 1, /* 标志此user离开(收到user的切离保护帧) */
301 mesh_initiative_role: 1, /* Mesh关联发起端 */
302 uc_resv : 5;
303 mac_user_asoc_state_enum_uint8 user_asoc_state; /* 用户关联状态 */
304 /* user对应资源池索引值; user为STA时,表示填在管理帧中的AID,值为用户的资源池索引值1~32(协议规定范围为1~2007) */
305 hi_u8 us_assoc_id;
306 wlan_protocol_enum_uint8 protocol_mode : 4; /* 用户工作协议 */
307 wlan_protocol_enum_uint8 avail_protocol_mode : 4; /* 用户和VAP协议模式交集, 供算法调用 */
308
309 /* 默认值与en_avail_protocol_mode值相同, 供算法调用修改 */
310 wlan_protocol_enum_uint8 cur_protocol_mode : 4;
311 wlan_bw_cap_enum_uint8 bandwidth_cap : 4; /* 用户带宽能力信息 */
312 wlan_bw_cap_enum_uint8 avail_bandwidth : 4; /* 用户和VAP带宽能力交集,供算法调用 */
313 /* 默认值与en_avail_bandwidth相同,供算法调用修改 */
314 wlan_bw_cap_enum_uint8 cur_bandwidth : 4;
315 hi_u8 avail_num_spatial_stream : 4; /* Tx和Rx支持Nss的交集,供算法调用 */
316 hi_u8 num_spatial_stream : 4; /* 用户支持的空间流个数 */
317 /* 表示该mesh用户的节点优先级,beacon和probe rsp中携带,仅mesh用户有效 */
318 hi_u8 bcn_prio;
319 mac_rate_stru avail_op_rates; /* 用户和VAP可用的11a/b/g速率交集,供算法调用 */
320 mac_user_tx_param_stru user_tx_info; /* TX相关参数 */
321 mac_user_cap_info_stru cap_info; /* user基本能力信息位 */
322 mac_user_ht_hdl_stru ht_hdl; /* HT capability IE和 operation IE的解析信息 */
323 mac_key_mgmt_stru key_info;
324
325 hi_s8 rx_conn_rssi; /* 用户关联过程接收管理帧RSSI统计量 MESH */
326 hi_u8 resv[3]; /* reserve 3byte */
327 #ifdef _PRE_WLAN_FEATURE_OPMODE_NOTIFY
328 hi_u8 avail_bf_num_spatial_stream; /* 用户支持的Beamforming空间流个数 */
329 #endif
330 } mac_user_stru;
331
332 #ifdef _PRE_WLAN_FEATURE_UAPSD
333 #define MAC_USR_UAPSD_EN 0x01 /* U-APSD使能 */
334 #define MAC_USR_UAPSD_TRIG 0x02 /* U-APSD可以被trigger */
335 #define MAC_USR_UAPSD_SP 0x04 /* u-APSD在一个Service Period处理中 */
336
337 /* AC是trigge_en的且用户当前处于trigger状态,can be trigger */
338 #define mac_usr_uapsd_ac_can_tigger(_ac, _dmac_usr) \
339 (((_dmac_usr)->uapsd_status.ac_trigger_ena[_ac]) && ((_dmac_usr)->uapsd_flag & MAC_USR_UAPSD_TRIG))
340
341 /* AC是delivery_en的且用户当前处于trigger状态,can be delivery */
342 #define mac_usr_uapsd_ac_can_delivery(_ac, _dmac_usr) \
343 (((_dmac_usr)->uapsd_status.ac_delievy_ena[_ac]) && ((_dmac_usr)->uapsd_flag & MAC_USR_UAPSD_TRIG))
344
345 #define mac_usr_uapsd_use_tim(_dmac_usr) (mac_usr_uapsd_ac_can_delivery(WLAN_WME_AC_BK, _dmac_usr) && \
346 mac_usr_uapsd_ac_can_delivery(WLAN_WME_AC_BE, _dmac_usr) && \
347 mac_usr_uapsd_ac_can_delivery(WLAN_WME_AC_VI, _dmac_usr) && \
348 mac_usr_uapsd_ac_can_delivery(WLAN_WME_AC_VO, _dmac_usr))
349 #endif
350
351 #define mac_11i_is_ptk(macaddr_is_zero, pairwise) ((HI_TRUE != (macaddr_is_zero)) && (HI_TRUE == (pairwise)))
352
353 #ifdef _PRE_WLAN_FEATURE_MESH_ROM
354 #define MAC_USER_STATE_DEL 0
355 #endif
356
357 /* ****************************************************************************
358 inline函数定义
359 **************************************************************************** */
360 /* ****************************************************************************
361 功能描述 : 设置用户的安全信息
362 返 回 值 : 0:成功,其他:失败
363 其 他 : 截止此函数编写时,只有keyid得到使用,multiuser下的安全信息可以优化一下
364 修改历史 :
365 1.日 期 : 2015年03月17日
366 作 者 : HiSilicon
367 修改内容 : 新生成函数
368 **************************************************************************** */
mac_user_set_key(mac_user_stru * multiuser,wlan_cipher_key_type_enum_uint8 keytype,wlan_ciper_protocol_type_enum_uint8 ciphertype,hi_u8 keyid)369 static inline hi_void mac_user_set_key(mac_user_stru *multiuser, wlan_cipher_key_type_enum_uint8 keytype,
370 wlan_ciper_protocol_type_enum_uint8 ciphertype, hi_u8 keyid)
371 {
372 multiuser->user_tx_info.security.cipher_key_type = keytype;
373 multiuser->user_tx_info.security.cipher_protocol_type = ciphertype;
374 multiuser->user_tx_info.security.cipher_key_id = keyid;
375 oam_warning_log4(0, OAM_SF_WPA, "{mac_user_set_key::keytpe==%u, ciphertype==%u, keyid==%u, usridx==%u}", keytype,
376 ciphertype, keyid, multiuser->us_assoc_id);
377 }
378
379 #ifdef _PRE_WLAN_FEATURE_OPMODE_NOTIFY
380 /* ****************************************************************************
381 功能描述 : 设置user公共区域uc_avail_num_spatial_stream Tx和Rx支持Nss的交集,供算法调用的值
382 返 回 值 : hi_void
383 修改历史 :
384 1.日 期 : 2015年4月22日
385 作 者 : HiSilicon
386 修改内容 : 新生成函数
387 **************************************************************************** */
mac_user_avail_bf_num_spatial_stream(mac_user_stru * mac_user,hi_u8 value)388 static inline hi_void mac_user_avail_bf_num_spatial_stream(mac_user_stru *mac_user, hi_u8 value)
389 {
390 mac_user->avail_bf_num_spatial_stream = value;
391 }
392 #endif
393
394 /* ****************************************************************************
395 功能描述 : 设置user公共区域uc_avail_num_spatial_stream Tx和Rx支持Nss的交集,供算法调用的值
396 修改历史 :
397 1.日 期 : 2015年4月22日
398 作 者 : HiSilicon
399 修改内容 : 新生成函数
400 **************************************************************************** */
mac_user_set_avail_num_spatial_stream(mac_user_stru * mac_user,hi_u8 value)401 static inline hi_void mac_user_set_avail_num_spatial_stream(mac_user_stru *mac_user, hi_u8 value)
402 {
403 mac_user->avail_num_spatial_stream = value;
404 }
405
406 /* ****************************************************************************
407 功能描述 : 设置user公共区域uc_num_spatial_stream用户支持空间流个数的值
408 修改历史 :
409 1.日 期 : 2015年4月22日
410 作 者 : HiSilicon
411 修改内容 : 新生成函数
412 **************************************************************************** */
mac_user_set_num_spatial_stream(mac_user_stru * mac_user,hi_u8 value)413 static inline hi_void mac_user_set_num_spatial_stream(mac_user_stru *mac_user, hi_u8 value)
414 {
415 mac_user->num_spatial_stream = value;
416 }
417
418 /* ****************************************************************************
419 功能描述 : 设置用户的bandwidth能力
420 修改历史 :
421 1.日 期 : 2015年4月27日
422 作 者 : HiSilicon
423 修改内容 : 新生成函数
424 **************************************************************************** */
mac_user_set_bandwidth_cap(mac_user_stru * mac_user,wlan_bw_cap_enum_uint8 bandwidth_value)425 static inline hi_void mac_user_set_bandwidth_cap(mac_user_stru *mac_user, wlan_bw_cap_enum_uint8 bandwidth_value)
426 {
427 mac_user->bandwidth_cap = bandwidth_value;
428 }
429
430 /* ****************************************************************************
431 功能描述 : 这只mac user中的user与vap协议模式的交集模式
432 修改历史 :
433 1.日 期 : 2015年4月20日
434 作 者 : HiSilicon
435 修改内容 : 新生成函数
436 **************************************************************************** */
mac_user_set_protocol_mode(mac_user_stru * mac_user,wlan_protocol_enum_uint8 protocol_mode)437 static inline hi_void mac_user_set_protocol_mode(mac_user_stru *mac_user, wlan_protocol_enum_uint8 protocol_mode)
438 {
439 mac_user->protocol_mode = protocol_mode;
440 }
441
442 /* ****************************************************************************
443 功能描述 : 设置user下可用速率集
444 修改历史 :
445 1.日 期 : 2015年5月5日
446 作 者 : HiSilicon
447 修改内容 : 新生成函数
448 **************************************************************************** */
mac_user_set_avail_op_rates(mac_user_stru * mac_user,hi_u8 rs_nrates,const hi_u8 * puc_rs_rates)449 static inline hi_void mac_user_set_avail_op_rates(mac_user_stru *mac_user, hi_u8 rs_nrates, const hi_u8 *puc_rs_rates)
450 {
451 mac_user->avail_op_rates.rs_nrates = rs_nrates;
452 if (memcpy_s(mac_user->avail_op_rates.auc_rs_rates, WLAN_MAX_SUPP_RATES, puc_rs_rates, WLAN_MAX_SUPP_RATES) !=
453 EOK) {
454 mac_user->avail_op_rates.rs_nrates = 0;
455 return;
456 }
457 }
458
459 /* ****************************************************************************
460 功能描述 : 设置与用户pmf能力协商的结果
461 修改历史 :
462 1.日 期 : 2015年5月11日
463 作 者 : HiSilicon
464 修改内容 : 新生成函数
465 **************************************************************************** */
mac_user_set_pmf_active(mac_user_stru * mac_user,hi_u8 pmf_active)466 static inline hi_void mac_user_set_pmf_active(mac_user_stru *mac_user, hi_u8 pmf_active)
467 {
468 mac_user->cap_info.pmf_active = pmf_active;
469 }
470
471 /* ****************************************************************************
472 功能描述 : 设置用户barker_preamble的模式
473 修改历史 :
474 1.日 期 : 2015年5月11日
475 作 者 : HiSilicon
476 修改内容 : 新生成函数
477 **************************************************************************** */
mac_user_set_barker_preamble_mode(mac_user_stru * mac_user,hi_u8 barker_preamble_mode)478 static inline hi_void mac_user_set_barker_preamble_mode(mac_user_stru *mac_user, hi_u8 barker_preamble_mode)
479 {
480 mac_user->cap_info.barker_preamble_mode = barker_preamble_mode;
481 }
482
483 /* ****************************************************************************
484 功能描述 : 设置与用户的qos使能结果‘
485 修改历史 :
486 1.日 期 : 2015年5月11日
487 作 者 : HiSilicon
488 修改内容 : 新生成函数
489 **************************************************************************** */
mac_user_set_qos(mac_user_stru * mac_user,hi_u8 qos_mode)490 static inline hi_void mac_user_set_qos(mac_user_stru *mac_user, hi_u8 qos_mode)
491 {
492 mac_user->cap_info.qos = qos_mode;
493 }
494
495 /* ****************************************************************************
496 函数声明
497 **************************************************************************** */
498 hi_u32 mac_user_res_init(const hi_u8 user_num);
499 hi_void mac_user_res_exit(hi_void);
500 hi_u8 mac_user_get_user_num(hi_void);
501 hi_u8 mac_user_alloc_user_res(hi_void);
502 hi_void mac_user_free_user_res(hi_u8 idx);
503 hi_u8 *mac_user_init_get_user_stru(hi_u8 idx);
504 mac_user_stru *mac_user_get_user_stru(hi_u8 idx);
505 hi_u32 mac_user_add_wep_key(mac_user_stru *mac_user, hi_u8 key_index, const mac_key_params_stru *key);
506 hi_u32 mac_user_add_rsn_key(mac_user_stru *mac_user, hi_u8 key_index, const mac_key_params_stru *key);
507 hi_u32 mac_user_add_bip_key(mac_user_stru *mac_user, hi_u8 key_index, const mac_key_params_stru *key);
508 wlan_priv_key_param_stru *mac_user_get_key(mac_user_stru *mac_user, hi_u8 key_id);
509 hi_void mac_user_init(mac_user_stru *mac_user, hi_u8 user_idx, const hi_u8 *mac_addr, hi_u8 vap_id);
510 hi_void mac_user_set_bandwidth_info(mac_user_stru *mac_user, wlan_bw_cap_enum_uint8 avail_bandwidth,
511 wlan_bw_cap_enum_uint8 cur_bandwidth);
512 hi_void mac_user_get_sta_cap_bandwidth(mac_user_stru *mac_user, wlan_bw_cap_enum_uint8 *pen_bandwidth_cap);
513 hi_void mac_user_get_ap_opern_bandwidth(mac_user_stru *mac_user, wlan_bw_cap_enum_uint8 *pen_bandwidth_cap);
514 hi_u32 mac_user_update_bandwidth(mac_user_stru *mac_user, wlan_bw_cap_enum_uint8 bwcap);
515 hi_void mac_user_set_asoc_state(mac_user_stru *mac_user, mac_user_asoc_state_enum_uint8 value);
516 hi_void mac_user_get_vht_hdl(mac_user_stru *mac_user, mac_vht_hdl_stru *ht_hdl);
517 hi_void mac_user_set_ht_hdl(mac_user_stru *mac_user, const mac_user_ht_hdl_stru *ht_hdl);
518 hi_void mac_user_get_ht_hdl(const mac_user_stru *mac_user, mac_user_ht_hdl_stru *ht_hdl);
519 hi_void mac_user_set_ht_capable(mac_user_stru *mac_user, hi_u8 ht_capable);
520 hi_void mac_user_set_spectrum_mgmt(mac_user_stru *mac_user, hi_u8 spectrum_mgmt);
521 hi_void mac_user_set_apsd(mac_user_stru *mac_user, hi_u8 apsd);
522 hi_void mac_user_init_key(mac_user_stru *mac_user);
523 hi_u32 mac_user_update_wep_key(mac_user_stru *mac_usr, hi_u8 multi_user_idx);
524 hi_u8 mac_addr_is_zero(const hi_u8 *mac_addr);
525 hi_u8 mac_user_is_user_valid(hi_u8 idx);
526 #ifdef __cplusplus
527 #if __cplusplus
528 }
529 #endif
530 #endif
531 #endif /* __MAC_USER_H__ */
532