• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CFG_H__
20 #define __MAC_CFG_H__
21 
22 /* ****************************************************************************
23   1 其他头文件包含
24 **************************************************************************** */
25 #include "oal_ext_if.h"
26 #include "oam_ext_if.h"
27 
28 #ifdef __cplusplus
29 #if __cplusplus
30 extern "C" {
31 #endif
32 #endif
33 
34 /* ****************************************************************************
35   宏定义
36 *****************************************************************************/
37 #define MAC_NUM_2G_BAND             3           /* 2g band个数 */
38 #define MAC_NUM_2G_CH_NUM           13          /* 2g 信道个数 */
39 /*****************************************************************************
40   枚举定义
41 **************************************************************************** */
42 typedef enum {
43     MAC_CFG_RETRY_DATA      = 0,
44     MAC_CFG_RETRY_MGMT      = 1,
45     MAC_CFG_RETRY_TIMEOUT   = 2,
46     MAC_CFG_RETRY_TYPE_BUTT,
47 } mac_cfg_retry_type_enum;
48 typedef hi_u8 mac_cfg_retry_type_enum_uint8;
49 
50 typedef enum {
51     MAC_PSM_OFFSET_TBTT,
52     MAC_PSM_OFFSET_EXT_TBTT,
53     MAC_PSM_OFFSET_BCN_TIMEOUT,
54 #ifdef _PRE_WLAN_FEATURE_ARP_OFFLOAD
55     MAC_PSM_FREE_ARP_INTERVAL
56 #endif
57 } mac_cfg_psm_offset_type;
58 typedef hi_u8 mac_cfg_psm_offset_type_uint8;
59 
60 typedef enum {
61     MAC_STA_PM_SWITCH_OFF         = 0,        /* 关闭低功耗 */
62     MAC_STA_PM_SWITCH_ON          = 1,        /* 打开低功耗 */
63     MAC_STA_PM_MANUAL_MODE_ON     = 2,        /* 开启手动sta pm mode */
64     MAC_STA_PM_MANUAL_MODE_OFF    = 3,        /* 关闭手动sta pm mode */
65     MAC_STA_PM_SWITCH_BUTT,                   /* 最大类型 */
66 } mac_pm_switch_enum;
67 typedef hi_u8 mac_pm_switch_enum_uint8;
68 
69 typedef enum {
70     MAC_STA_PM_CTRL_TYPE_HOST    = 0,        /* 低功耗控制类型 HOST */
71     MAC_STA_PM_CTRL_TYPE_DBAC    = 1,        /* 低功耗控制类型 DBAC */
72     MAC_STA_PM_CTRL_TYPE_MONITOR = 2,        /* 低功耗控制类型 MONITOR */
73     MAC_STA_PM_CTRL_TYPE_CSI     = 3,        /* 低功耗控制类型 CSI */
74     MAC_STA_PM_CTRL_TYPE_ANY     = 4,        /* 低功耗控制类型 ANY */
75     MAC_STA_PM_CTRL_TYPE_FLOW    = 5,        /* 低功耗控制类型 FLOW */
76     MAC_STA_PM_CTRL_TYPE_BTCOEX  = 6,        /* 低功耗控制类型 BTCOEX */
77     MAC_STA_PM_CTRL_TYPE_BUTT,               /* 最大类型,应小于8 */
78 } mac_pm_ctrl_type_enum;
79 typedef hi_u8 mac_pm_ctrl_type_enum_uint8;
80 
81 /* *
82  * enum nl80211_mfp - Management frame protection state
83  * @NL80211_MFP_NO: Management frame protection not used
84  * @NL80211_MFP_REQUIRED: Management frame protection required
85  */
86 typedef enum {
87     MAC_NL80211_MFP_NO,
88     MAC_NL80211_MFP_REQUIRED,
89 
90     MAC_NL80211_MFP_BUTT
91 } mac_nl80211_mfp_enum;
92 typedef hi_u8 mac_nl80211_mfp_enum_uint8;
93 
94 /* 配置发送描述符内部元素结构体 */
95 typedef enum {
96     RF_PAYLOAD_ALL_ZERO = 0,
97     RF_PAYLOAD_ALL_ONE,
98     RF_PAYLOAD_RAND,
99     RF_PAYLOAD_BUTT
100 } mac_rf_payload_enum;
101 typedef hi_u8 mac_rf_payload_enum_uint8;
102 
103 #ifdef _PRE_WLAN_FEATURE_MESH
104 typedef enum {
105     HISI_PLINK_IDLE = 1,
106     HISI_PLINK_OPN_SNT,
107     HISI_PLINK_OPN_RCVD,
108     HISI_PLINK_CNF_RCVD,
109     HISI_PLINK_ESTAB,
110     HISI_PLINK_HOLDING,
111     HISI_PLINK_BLOCKED,
112 
113     HISI_PLINK_BUTT
114 } mac_mesh_plink_state_enum;
115 typedef hi_u8 mac_mesh_plink_state_enum_uint8;
116 #endif
117 
118 /* 设置发送描述符帧类型枚举 */
119 typedef enum {
120     MAC_SET_DSCR_TYPE_UCAST_DATA  = 0,  /* 单播数据帧 */
121     MAC_SET_DSCR_TYPE_MCAST_DATA,       /* 组播数据帧 */
122     MAC_SET_DSCR_TYPE_BCAST_DATA,       /* 广播数据帧 */
123     MAC_SET_DSCR_TYPE_UCAST_MGMT_2G,    /* 单播管理帧,仅2G */
124     MAC_SET_DSCR_TYPE_MBCAST_MGMT_2G,   /* 组、广播管理帧,仅2G */
125 
126     MAC_SET_DSCR_TYPE_BUTT,
127 } mac_set_dscr_frame_type_enum;
128 typedef hi_u8 mac_set_dscr_frame_type_enum_uint8;
129 
130 #ifdef _PRE_WLAN_FEATURE_MESH
131 /* mesh节点类型枚举 */
132 typedef enum {
133     MAC_HISI_MESH_UNSPEC = 0, /* 未确定mesh节点角色 */
134     MAC_HISI_MESH_STA,        /* Mesh-STA节点角色 */
135     MAC_HISI_MESH_MG,         /* Mesh-MG节点角色 */
136     MAC_HISI_MESH_MBR,        /* Mesh-MBR节点角色 */
137 
138     MAC_HISI_MESH_NODE_BUTT,
139 } mac_hisi_mesh_node_type_enum;
140 typedef hi_u8 mac_hisi_mesh_node_type_enum_uint8;
141 #endif
142 
143 typedef enum {
144     WLAN_11B_PHY_PROTOCOL_MODE              = 0,   /* 11b CCK */
145     WLAN_LEGACY_OFDM_PHY_PROTOCOL_MODE      = 1,   /* 11g/a OFDM */
146     WLAN_HT_PHY_PROTOCOL_MODE               = 2,   /* 11n HT */
147     WLAN_VHT_PHY_PROTOCOL_MODE              = 3,   /* 11ac VHT */
148     WLAN_PHY_PROTOCOL_BUTT
149 } wlan_phy_protocol_enum;
150 typedef hi_u8 wlan_phy_protocol_enum_uint8;
151 
152 /* ****************************************************************************
153   结构体定义
154 **************************************************************************** */
155 typedef struct {
156     hi_u8                            param;      /* 查询或配置信息 */
157     wlan_phy_protocol_enum_uint8     protocol_mode;
158     mac_rf_payload_enum_uint8        payload_flag;
159     wlan_tx_ack_policy_enum_uint8    ack_policy;
160     hi_u32                           payload_len;
161 } mac_cfg_tx_comp_stru;
162 
163 typedef struct {
164     hi_u8  offset_addr_a;
165     hi_u8  offset_addr_b;
166     hi_u16 us_delta_gain;
167 } mac_cfg_dbb_scaling_stru;
168 
169 /* wfa edca参数配置 */
170 typedef struct {
171     hi_u8  switch_code; /* 开关 */
172     hi_u8  ac;          /* AC */
173     hi_u16 us_val;     /* 数据 */
174 } mac_edca_cfg_stru;
175 
176 /* PPM调整命令格式 */
177 typedef struct {
178     hi_s8 ppm_val;    /* PPM差值 */
179     hi_u8 clock_freq; /* 时钟频率 */
180     hi_u8 uc_resv[1];
181 } mac_cfg_adjust_ppm_stru;
182 
183 /* 管制域配置命令结构体 */
184 typedef struct {
185     hi_void *mac_regdom;
186 } mac_cfg_country_stru;
187 
188 /* 管制域最大发送功率配置 */
189 typedef struct {
190     hi_u8 pwr;
191     hi_u8 exceed_reg;
192     hi_u8 auc_resv[2]; /* 2 byte保留字段,保证word对齐 */
193 } mac_cfg_regdomain_max_pwr_stru;
194 
195 /* 获取当前管制域国家码字符配置命令结构体 */
196 typedef struct {
197     hi_char ac_country[WLAN_COUNTRY_STR_LEN];
198     hi_u8   auc_resv[1];
199 } mac_cfg_get_country_stru;
200 
201 /* query消息格式:2字节WID x N */
202 typedef struct {
203     hi_u8 tid;
204     hi_u8 uc_resv[3]; /* 3 byte保留字段,保证word对齐 */
205 } mac_cfg_get_tid_stru;
206 
207 /* 定制化 linkloss门限配置参数 */
208 typedef struct {
209     hi_u8 linkloss_threshold_wlan_near;
210     hi_u8 linkloss_threshold_wlan_far;
211     hi_u8 linkloss_threshold_p2p;
212     hi_u8 auc_resv[1];
213 } mac_cfg_linkloss_threshold;
214 
215 /* 定制化 power ref 2g 5g配置参数 */
216 typedef struct {
217     hi_u32 power_ref_2g;
218 } mac_cfg_power_ref;
219 
220 /* customize rf cfg struct */
221 typedef struct {
222     hi_s8 rf_gain_db_2g_mult4;  /* 外部PA/LNA bypass时的增益(0.25dB) */
223     hi_s8 rf_gain_db_2g_mult10; /* 外部PA/LNA bypass时的增益(0.1dB) */
224 } mac_cfg_gain_db_2g_band;
225 
226 typedef struct {
227     mac_cfg_gain_db_2g_band ac_gain_db_2g[MAC_NUM_2G_BAND];
228 } mac_cfg_customize_rf;
229 
230 #ifdef _PRE_WLAN_FEATURE_MESH
231 typedef struct _mac_cfg_set_mesh_user_param_stru {
232     hi_u8 auc_addr[WLAN_MAC_ADDR_LEN];
233     mac_mesh_plink_state_enum_uint8 plink_sta;
234     hi_u8 set;
235     hi_u8 bcn_prio;
236     hi_u8 is_mbr;
237     hi_u8 mesh_initiative_peering;
238 } mac_cfg_set_mesh_user_param_stru;
239 
240 typedef struct _mac_cfg_set_multi_mac_addr_stru {
241     hi_u8 auc_addr[WLAN_MAC_ADDR_LEN];
242     hi_u8 set; /* 0 - 删除某多播地址、1 - 设置某多播地址 */
243     hi_u8 rsv;
244 } mac_cfg_set_multi_mac_addr_stru;
245 
246 typedef mac_cfg_set_multi_mac_addr_stru mac_cfg_unset_multi_mac_addr_stru;
247 
248 typedef struct _mac_cfg_auto_peer_params_stru {
249     hi_s8 rssi_low;    /* 用户数少的时候用的rssi门限 */
250     hi_s8 rssi_middle; /* 用户数适中的时候用的rssi门限 */
251     hi_s8 rssi_high;   /* 用户数多的时候用的rssi门限 */
252 } mac_cfg_auto_peer_params_stru;
253 
254 typedef struct _mac_cfg_mesh_nodeinfo_stru {
255     mac_hisi_mesh_node_type_enum_uint8 node_type; /* 本节点角色 */
256     hi_u8 mesh_accept_sta;                        /* 是否接受sta关联 */
257     hi_u8 user_num;                               /* 关联用户数 */
258     hi_u8 privacy;                                /* 是否加密 */
259     hi_u8 chan;                                   /* 信道号 */
260     hi_u8 priority;                               /* bcn优先级 */
261     hi_u8 rsv[2];                                 /* 2 byte保留 */
262 } mac_cfg_mesh_nodeinfo_stru;
263 #endif
264 
265 /* 接收帧的FCS统计信息 */
266 typedef struct {
267     hi_u32 data_op; /* 数据操作模式:<0>保留,<1>清除 */
268     hi_u32 print_info; /* 打印数据内容:<0>所有数据 <1>总帧数 <2>self fcs correct, <3>other fcs correct, <4>fcs error */
269 } mac_cfg_rx_fcs_info_stru;
270 
271 /* 剔除用户配置命令参数 */
272 typedef struct {
273     hi_u8  auc_mac_addr[WLAN_MAC_ADDR_LEN]; /* MAC地址 */
274     hi_u16 us_reason_code;                 /* 去关联 reason code */
275 } mac_cfg_kick_user_param_stru;
276 
277 /* 暂停tid配置命令参数 */
278 typedef struct {
279     hi_u8 auc_mac_addr[WLAN_MAC_ADDR_LEN]; /* MAC地址 */
280     hi_u8 tid;
281     hi_u8 is_paused;
282 } mac_cfg_pause_tid_param_stru;
283 
284 /* 配置用户是否为vip */
285 typedef struct {
286     hi_u8 auc_mac_addr[WLAN_MAC_ADDR_LEN]; /* MAC地址 */
287     hi_u8 vip_flag;
288 } mac_cfg_user_vip_param_stru;
289 
290 /* 暂停tid配置命令参数 */
291 typedef struct {
292     hi_u8 aggr_tx_on;
293     hi_u8 tid;
294     hi_u8 max_num;
295     hi_u8 resv;
296 } mac_cfg_ampdu_tx_on_param_stru;
297 
298 #ifdef _PRE_WLAN_FEATURE_OFFLOAD_FLOWCTL
299 /* 设置host某个队列的每次调度报文个数,low_waterline, high_waterline */
300 typedef struct {
301     hi_u8  queue_type;
302     hi_u8  auc_resv[1];
303     hi_u16 us_burst_limit;
304     hi_u16 us_low_waterline;
305     hi_u16 us_high_waterline;
306 } mac_cfg_flowctl_param_stru;
307 #endif
308 
309 /* 使能qempty命令 */
310 typedef struct {
311     hi_u8 is_on;
312     hi_u8 auc_resv[3]; /* 3 byte保留字段,保证word对齐 */
313 } mac_cfg_resume_qempty_stru;
314 
315 /* 发送mpdu/ampdu命令参数  */
316 typedef struct {
317     hi_u8  tid;
318     hi_u8  packet_num;
319     hi_u16 us_packet_len;
320     hi_u8  auc_ra_mac[OAL_MAC_ADDR_LEN];
321 } mac_cfg_mpdu_ampdu_tx_param_stru;
322 /* AMPDU相关的配置命令参数 */
323 typedef struct {
324     hi_u8 auc_mac_addr[WLAN_MAC_ADDR_LEN]; /* 用户的MAC ADDR */
325     hi_u8 tidno;                           /* 对应的tid号 */
326     hi_u8 auc_reserve[1];                  /* 确认策略 */
327 } mac_cfg_ampdu_start_param_stru;
328 
329 typedef mac_cfg_ampdu_start_param_stru mac_cfg_ampdu_end_param_stru;
330 
331 /* BA会话相关的配置命令参数 */
332 typedef struct {
333     hi_u8                       auc_mac_addr[WLAN_MAC_ADDR_LEN];    /* 用户的MAC ADDR */
334     hi_u8                       tidno;                              /* 对应的tid号 */
335     mac_ba_policy_enum_uint8    ba_policy;                          /* BA确认策略 */
336     hi_u16                      us_buff_size;                       /* BA窗口的大小 */
337     hi_u16                      us_timeout;                         /* BA会话的超时时间 */
338 } mac_cfg_addba_req_param_stru;
339 
340 typedef struct {
341     hi_u8                          auc_mac_addr[WLAN_MAC_ADDR_LEN];    /* 用户的MAC ADDR */
342     hi_u8                          tidno;                              /* 对应的tid号 */
343     mac_delba_initiator_enum_uint8 direction;                          /* 删除ba会话的发起端 */
344     hi_u8                          auc_reserve[1];                     /* 删除原因 */
345 } mac_cfg_delba_req_param_stru;
346 
347 typedef struct {
348     hi_u8 auc_mac_addr[WLAN_MAC_ADDR_LEN];
349     hi_u8 amsdu_max_num; /* amsdu最大个数 */
350     hi_u8 auc_reserve;
351 } mac_cfg_amsdu_start_param_stru;
352 
353 /* 设置用户配置参数 */
354 typedef struct {
355     hi_u8                               function_index;
356     hi_u8                               auc_reserve[2]; /* 2 byte保留字段,保证word对齐 */
357     mac_set_dscr_frame_type_enum_uint8  type;           /* 配置的帧类型 */
358     hi_s32                              l_value;
359 } mac_cfg_set_dscr_param_stru;
360 
361 /* non-HT协议模式下速率配置结构体 */
362 typedef struct {
363     wlan_legacy_rate_value_enum_uint8       rate;            /* 速率值 */
364     wlan_phy_protocol_enum_uint8            protocol_mode;   /* 对应的协议 */
365     hi_u8                                   auc_reserve[2];  /* 2 byte保留 */
366 } mac_cfg_non_ht_rate_stru;
367 
368 /* 用户相关的配置命令参数 */
369 typedef struct {
370     hi_u8 auc_mac_addr[WLAN_MAC_ADDR_LEN]; /* MAC地址 */
371     hi_u8 ht_cap;                          /* ht能力 */
372     hi_u8 user_idx;                        /* 用户索引 */
373 } mac_cfg_add_user_param_stru;
374 typedef mac_cfg_add_user_param_stru mac_cfg_del_user_param_stru;
375 
376 /* 定制化 时钟配置参数 */
377 typedef struct {
378     hi_u32 rtc_clk_freq;
379     hi_u8  clk_type;
380     hi_u8  auc_resv[3]; /* 3 byte保留字段,保证word对齐 */
381 } mac_cfg_pm_param;
382 
383 typedef struct {
384     mac_cfg_psm_offset_type_uint8 type;
385     hi_u8  resv;
386     hi_u16 value;
387 } mac_cfg_psm_offset;
388 
389 typedef struct {
390     hi_u16 us_tx_ratio;        /* tx占空比 */
391     hi_u16 us_tx_pwr_comp_val; /* 发射功率补偿值 */
392 } mac_tx_ratio_vs_pwr_stru;
393 
394 /* 定制化TX占空比&温度补偿发射功率的参数 */
395 typedef struct {
396     mac_tx_ratio_vs_pwr_stru ast_txratio2pwr[3]; /* 3档占空比分别对应功率补偿值 */
397     hi_u32 more_pwr;                             /* 根据温度额外补偿的发射功率 */
398 } mac_cfg_customize_tx_pwr_comp_stru;
399 
400 typedef struct {
401     mac_cfg_retry_type_enum_uint8       type;
402     hi_u8                               limit;
403     hi_u8                               auc_rsv[2]; /* 2 byte保留字段,保证word对齐 */
404 } mac_cfg_retry_param_stru;
405 
406 typedef struct {
407     hi_u8 auc_mac_da[WLAN_MAC_ADDR_LEN];
408     hi_u8 category;
409     hi_u8 auc_resv[1];
410 } mac_cfg_send_action_param_stru;
411 
412 typedef struct {
413     hi_s32 l_is_psm; /* 是否进入节能 */
414     hi_s32 l_is_qos; /* 是否发qosnull */
415     hi_s32 l_tidno;  /* tid号 */
416 } mac_cfg_tx_nulldata_stru;
417 
418 /* 获取mpdu数目需要的参数 */
419 typedef struct {
420     hi_u8 auc_user_macaddr[WLAN_MAC_ADDR_LEN];
421     hi_u8 auc_resv[2]; /* 2 byte保留字段,保证word对齐 */
422 } mac_cfg_get_mpdu_num_stru;
423 
424 #ifdef _PRE_DEBUG_MODE
425 typedef struct {
426     hi_u8 auc_user_macaddr[WLAN_MAC_ADDR_LEN];
427     hi_u8 param;
428     hi_u8 tid_no;
429 } mac_cfg_ampdu_stat_stru;
430 #endif
431 
432 typedef struct {
433     hi_u8 aggr_num_switch; /* 控制聚合个数开关 */
434     hi_u8 aggr_num;        /* 聚合个数 */
435     hi_u8 auc_resv[2];     /* 2 byte保留字段,保证word对齐 */
436 } mac_cfg_aggr_num_stru;
437 
438 typedef struct {
439     hi_u32 mib_idx;
440     hi_u32 mib_value;
441 } mac_cfg_set_mib_stru;
442 
443 typedef struct {
444     hi_u8 bypass_type;
445     hi_u8 value;
446     hi_u8 auc_resv[2]; /* 2 byte保留字段,保证word对齐 */
447 } mac_cfg_set_thruput_bypass_stru;
448 
449 typedef struct {
450     hi_u8 performance_log_switch_type;
451     hi_u8 value;
452     hi_u8 auc_resv[2]; /* 2 byte保留字段,保证word对齐 */
453 } mac_cfg_set_performance_log_switch_stru;
454 
455 typedef struct {
456     hi_u32 timeout;
457     hi_u8  is_period;
458     hi_u8  stop_start;
459     hi_u8  auc_resv[2]; /* 2 byte保留字段,保证word对齐 */
460 } mac_cfg_test_timer_stru;
461 
462 typedef struct {
463     hi_u8  user_idx;
464     hi_u8  uc_resv;
465     hi_u16 us_rx_pn;
466 } mac_cfg_set_rx_pn_stru;
467 
468 typedef struct {
469     hi_u32 frag_threshold;
470 } mac_cfg_frag_threshold_stru;
471 
472 typedef struct {
473     hi_u32 rts_threshold;
474 } mac_cfg_rts_threshold_stru;
475 
476 typedef struct {
477     /* software_retry值 */
478     hi_u8 software_retry;
479     /* 是否取test设置的值,为0则为正常流程所设 */
480     hi_u8 retry_test;
481     hi_u8 resv[2]; /* 2 byte保留字段,保证word对齐 */
482 } mac_cfg_set_soft_retry_stru;
483 
484 /* STA PS 发送参数 */
485 #ifdef _PRE_WLAN_FEATURE_STA_PM
486 typedef struct {
487     hi_u8 vap_ps_mode;
488 } mac_cfg_ps_mode_param_stru;
489 
490 typedef struct {
491     hi_u16 beacon_timeout;
492     hi_u16 tbtt_offset;
493     hi_u16 ext_tbtt_offset;
494 } mac_cfg_ps_param_stru;
495 #endif
496 
497 typedef struct {
498     hi_u8 show_ip_addr : 4;         /* show ip addr */
499     hi_u8 show_arpoffload_info : 4; /* show arpoffload 维测 */
500 } mac_cfg_arpoffload_info_stru;
501 
502 typedef struct {
503     hi_u8 in_suspend;        /* 亮暗屏 */
504     hi_u8 arpoffload_switch; /* arpoffload开关 */
505 } mac_cfg_suspend_stru;
506 
507 typedef struct {
508     mac_pm_ctrl_type_enum_uint8 pm_ctrl_type; /* mac_pm_ctrl_type_enum */
509     mac_pm_switch_enum_uint8 pm_enable;       /* mac_pm_switch_enum */
510 } mac_cfg_ps_open_stru;
511 
512 /* ======================== cfg id对应的参数结构体 ==================================== */
513 /* 创建VAP参数结构体, 对应cfgid: WLAN_CFGID_ADD_VAP */
514 typedef struct {
515     wlan_vap_mode_enum_uint8 vap_mode;
516     hi_u8 cfg_vap_indx;
517     hi_u8 muti_user_id; /* 添加vap 对应的muti user index */
518     hi_u8 vap_id;       /* 需要添加的vap id */
519 
520     wlan_p2p_mode_enum_uint8 p2p_mode; /* 0:非P2P设备; 1:P2P_GO; 2:P2P_Device; 3:P2P_CL */
521     hi_u8                 ac2g_enable           :1,
522                           disable_capab_2ght40  :1,
523                           uapsd_enable    :1,
524                           reserve1        :5;
525     hi_u8                 auc_resv[2]; /* 2 byte保留字段,保证word对齐 */
526     oal_net_device_stru      *net_dev;
527 } mac_cfg_add_vap_param_stru;
528 typedef mac_cfg_add_vap_param_stru mac_cfg_del_vap_param_stru;
529 
530 /* 协议参数 对应cfgid: WLAN_CFGID_MODE */
531 typedef struct {
532     wlan_protocol_enum_uint8            protocol;       /* 协议 */
533     wlan_channel_band_enum_uint8        band;           /* 频带 */
534     wlan_channel_bandwidth_enum_uint8   en_bandwidth;   /* 带宽 */
535     hi_u8                               channel_idx;    /* 主20M信道号 */
536 } mac_cfg_mode_param_stru;
537 
538 /* 启用VAP参数结构体 对应cfgid: WLAN_CFGID_START_VAP */
539 typedef struct {
540     hi_u8 mgmt_rate_init_flag; /* start vap时候,管理帧速率是否需要初始化 */
541     hi_u8 protocol;
542     hi_u8 band;
543     hi_u8 uc_bandwidth;
544 #ifdef _PRE_WLAN_FEATURE_P2P_ROM
545     wlan_p2p_mode_enum_uint8 p2p_mode;
546     hi_u8                    auc_resv2[3]; /* 3 byte保留字段,保证word对齐 */
547 #endif
548     oal_net_device_stru *net_dev;
549 } mac_cfg_start_vap_param_stru;
550 typedef mac_cfg_start_vap_param_stru mac_cfg_down_vap_param_stru;
551 
552 /* 设置mac地址参数 对应cfgid: WLAN_CFGID_STATION_ID */
553 typedef struct {
554     hi_u8                   auc_station_id[WLAN_MAC_ADDR_LEN];
555     wlan_p2p_mode_enum_uint8    p2p_mode;
556     hi_u8                   auc_resv[1];
557 } mac_cfg_staion_id_param_stru;
558 
559 /* SSID参数 对应cfgid: WLAN_CFGID_SSID */
560 typedef struct {
561     hi_u8   ssid_len;
562     hi_u8   auc_resv[2]; /* 2 byte保留字段,保证word对齐 */
563     hi_char ac_ssid[WLAN_SSID_MAX_LEN];
564 } mac_cfg_ssid_param_stru;
565 
566 /* HOSTAPD 设置工作频段,信道和带宽参数 */
567 typedef struct {
568     wlan_channel_band_enum_uint8 band;              /* 频带 */
569     wlan_channel_bandwidth_enum_uint8 en_bandwidth; /* 带宽 */
570     hi_u8 channel;                                  /* 信道编号 */
571     hi_u8 rsv;
572 } mac_cfg_channel_param_stru;
573 
574 /* HOSTAPD 设置wiphy 物理设备信息,包括RTS 门限值,分片报文门限值 */
575 typedef struct {
576     hi_u8 frag_threshold_changed;
577     hi_u8 rts_threshold_changed;
578     hi_u8 rsv[2]; /* 2 byte保留字段,保证word对齐 */
579     hi_u32 frag_threshold;
580     hi_u32 rts_threshold;
581 } mac_cfg_wiphy_param_stru;
582 
583 /* P2P OPS 节能配置参数 */
584 typedef struct {
585     hi_s32 ops_ctrl;
586     hi_u8 ct_window;
587     hi_u8 resv[3]; /* reserve 3byte */
588     hi_s32 pause_ops;
589 } mac_cfg_p2p_ops_param_stru;
590 
591 /* P2P NOA节能配置参数 */
592 typedef struct {
593     hi_u32 start_time;
594     hi_u32 duration;
595     hi_u32 interval;
596     hi_u8  count;
597     hi_u8  resv[3]; /* 3 byte保留字段,保证word对齐 */
598 } mac_cfg_p2p_noa_param_stru;
599 
600 /* P2P 节能控制命令 */
601 typedef struct {
602     hi_u8 p2p_statistics_ctrl; /* 0:清除P2P 统计值; 1:打印输出统计值 */
603     hi_u8 auc_rsv[3];          /* 3 byte保留字段,保证word对齐 */
604 } mac_cfg_p2p_stat_param_stru;
605 
606 /* 组播转单播 发送参数 */
607 typedef struct {
608     hi_u8 m2u_mcast_mode;
609     hi_u8 m2u_snoop_on;
610 } mac_cfg_m2u_snoop_on_param_stru;
611 
612 /* =================== 以下为解析内核配置参数转化为驱动内部参数下发的结构体 ======================== */
613 /* 解析内核配置的扫描参数后,下发给驱动的扫描参数 */
614 typedef struct {
615     oal_ssids_stru          ssids[WLAN_SCAN_REQ_MAX_BSS];
616     hi_u32                  l_ssid_num;
617     const hi_u8            *puc_ie;
618     hi_u32                  ie_len;
619     hi_u32                 *pul_channels_2_g;
620     /* WLAN/P2P 特性情况下,p2p0 和p2p-p2p0 cl 扫描时候,需要使用不同设备,增加bit_is_p2p0_scan来区分 */
621     hi_u8                   is_p2p0_scan : 1;       /* 是否为p2p0 发起扫描 */
622     hi_u8                   rsv          : 7;       /* 保留位 */
623     hi_u8                   scan_type;
624     hi_u8                   num_channels_2_g;
625     hi_u8                   auc_arry;
626 } mac_cfg80211_scan_param_stru;
627 
628 typedef struct {
629     mac_cfg80211_scan_param_stru *mac_cfg80211_scan_param;
630 } mac_cfg80211_scan_param_pst_stru;
631 
632 /* 解析内核配置的connect参数后,下发给驱动的connect参数 */
633 typedef struct {
634     hi_u8               wpa_versions;
635     hi_u8               cipher_group;
636     hi_u8               n_ciphers_pairwise;
637     hi_u8               ciphers_pairwise[OAL_NL80211_MAX_NR_CIPHER_SUITES];
638     hi_u8               n_akm_suites;
639     hi_u8               akm_suites[OAL_NL80211_MAX_NR_AKM_SUITES];
640 
641     hi_u8 control_port;
642 } mac_cfg80211_crypto_settings_stru;
643 
644 typedef struct {
645     hi_u8                           channel;              /* ap所在信道编号,eg 1,2,11,36,40... */
646     hi_u8                           ssid_len;             /* SSID 长度 */
647     mac_nl80211_mfp_enum_uint8      mfp;
648     hi_u8                           wapi;
649 
650     hi_u8 *puc_ie;
651     hi_u8 *puc_ssid;  /* 期望关联的AP SSID  */
652     hi_u8 *puc_bssid; /* 期望关联的AP BSSID  */
653 
654     hi_u8 privacy;                              /* 是否加密标志 */
655     oal_nl80211_auth_type_enum_uint8 auth_type; /* 认证类型,OPEN or SHARE-KEY */
656 
657     hi_u8 wep_key_len;        /* WEP KEY长度 */
658     hi_u8 wep_key_index;      /* WEP KEY索引 */
659     const hi_u8 *puc_wep_key; /* WEP KEY密钥 */
660 
661     mac_cfg80211_crypto_settings_stru crypto; /* 密钥套件信息 */
662     hi_u32 ie_len;
663 } mac_cfg80211_connect_param_stru;
664 
665 typedef struct {
666     hi_u8                               privacy;             /* 是否加密标志 */
667     oal_nl80211_auth_type_enum_uint8    auth_type;           /* 认证类型,OPEN or SHARE-KEY */
668     hi_u8                               wep_key_len;         /* WEP KEY长度 */
669     hi_u8                               wep_key_index;       /* WEP KEY索引 */
670     hi_u8                               auc_wep_key[WLAN_WEP104_KEY_LEN];            /* WEP KEY密钥 */
671     mac_nl80211_mfp_enum_uint8          mgmt_proteced;       /* 此条链接pmf是否使能 */
672     wlan_pmf_cap_status_uint8           pmf_cap;             /* 设备pmf能力 */
673     hi_u8                               wps_enable;
674 
675     mac_cfg80211_crypto_settings_stru   crypto;              /* 密钥套件信息 */
676     hi_s8                               rssi;                /* 关联AP的RSSI信息 */
677     hi_u8                               auc_rsv[3]; /* 3 byte保留字段,保证word对齐 */
678 } mac_cfg80211_connect_security_stru;
679 
680 typedef struct {
681     hi_u8 auc_mac_addr[OAL_MAC_ADDR_LEN];
682     hi_u8 auc_rsv[2]; /* 2 byte保留字段,保证word对齐 */
683 } mac_cfg80211_init_port_stru;
684 
685 #ifdef _PRE_WLAN_FEATURE_ARP_OFFLOAD
686 typedef enum {
687     MAC_CONFIG_IPV4 = 0, /* 配置IPv4地址 */
688     MAC_CONFIG_IPV6,     /* 配置IPv6地址 */
689     MAC_CONFIG_BUTT
690 } mac_ip_type;
691 typedef hi_u8 mac_ip_type_enum_uint8;
692 
693 typedef enum {
694     MAC_IP_ADDR_DEL = 0, /* 删除IP地址 */
695     MAC_IP_ADDR_ADD,     /* 增加IP地址 */
696     MAC_IP_OPER_BUTT
697 } mac_ip_oper;
698 typedef hi_u8 mac_ip_oper_enum_uint8;
699 
700 typedef struct {
701     mac_ip_type_enum_uint8 type;
702     mac_ip_oper_enum_uint8 oper;
703     hi_u8 resv[2]; /* 填充2字节 */
704     union {
705         hi_u32 ipv4; /* 注意:网络字节序、大端。 */
706         hi_u8 ipv6[OAL_IP_ADDR_MAX_SIZE];
707     } ip;
708 } mac_ip_addr_config_stru;
709 #endif
710 
711 typedef struct {
712     hi_u8 band_num;
713     hi_u8 resv[3]; /* 3 byte保留字段 */
714     hi_s32 offset;
715 } mac_cfg_cal_bpower;
716 
717 typedef struct {
718     hi_u8 protol;
719     hi_u8 rate;
720     hi_u8 resv[2]; /* 2 byte保留字段 */
721     hi_s32 val;
722 } mac_cfg_cal_rpower;
723 
724 #ifdef __cplusplus
725 #if __cplusplus
726 }
727 #endif
728 #endif
729 #endif /* __MAC_CFG_H__ */
730