• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  * Description: Header file of the DMAC external public interface.
15  */
16 
17 #ifndef DMAC_EXT_IF_ROM_H
18 #define DMAC_EXT_IF_ROM_H
19 
20 /*****************************************************************************
21   1 其他头文件包含
22 *****************************************************************************/
23 #include "wlan_types_rom.h"
24 #include "dmac_ext_if_type_rom.h"
25 #include "hal_ext_if_rom.h"
26 #include "wlan_mib_rom.h"
27 #include "oal_ext_if_rom.h"
28 #include "mac_frame_rom.h"
29 #include "dmac_ext_if_device_rom.h"
30 #include "wlan_resource_common_rom.h"
31 
32 #ifdef __cplusplus
33 #if __cplusplus
34 extern "C" {
35 #endif
36 #endif
37 
38 #undef THIS_FILE_ID
39 #define THIS_FILE_ID OAM_FILE_ID_DMAC_EXT_IF_ROM_H
40 
41 /*****************************************************************************
42   2 宏定义
43 *****************************************************************************/
44 #define MAC_INVALID_RX_BA_LUT_INDEX HAL_MAX_RX_BA_LUT_SIZE
45 
46 /* 安全加密 :  bss_info 中记录AP 能力标识, WPA or WPA2 */
47 #define DMAC_WPA_802_11I BIT0
48 #define DMAC_RSNA_802_11I BIT1
49 
50 #ifdef _PRE_PLAT_FEATURE_CUSTOMIZE
51 #define CUSTOM_MSG_DATA_HDR_LEN (sizeof(custom_cfgid_enum_uint32) + sizeof(osal_u32)) /* 抛往dmac侧消息头的长度 */
52 #endif // #ifdef _PRE_PLAT_FEATURE_CUSTOMIZE
53 
54 /* DMAC CB中用于不同算法对帧进行标记 */
55 #define DMAC_SCAN_MAX_AP_NUM_TO_GNSS 32
56 #define GNSS_DMAC_SCAN_RESULTS_VALID_MS 5000
57 #define DMAC_TX_ONE_MPDU_AMSDU_NUM_MAX 4
58 #define DMAC_DEF_AP_TBTT_OFFSET             10000   /* AP的tbtt提前量(单位us) */
59 
60 /*****************************************************************************
61   3 枚举定义
62 *****************************************************************************/
63 
64 /*****************************************************************************
65   7 STRUCT定义
66 *****************************************************************************/
67 /* frame control字段结构体 */
68 typedef struct {
69     osal_s16 signal;            /* 驱动接收包记录的RSSI值 */
70     osal_u8  resv[2];
71 } dmac_vap_query_stats_stru;
72 
73 /* Update join req 需要配置的速率集参数 */
74 typedef struct {
75     union {
76         osal_u8 value;
77         struct {
78             osal_u8 support_11b : 1;  /* 该AP是否支持11b */
79             osal_u8 support_11ag : 1; /* 该AP是否支持11ag */
80             osal_u8 ht_capable : 1;   /* 是否支持ht */
81             osal_u8 vht_capable : 1;  /* 是否支持vht */
82             osal_u8 reserved : 4;
83         } capable; /* 与dmac层wlan_phy_protocol_enum对应 */
84     } capable_flag;
85     osal_u8 min_rate[2]; /* 第1个存储11b协议对应的速率,第2个存储11ag协议对应的速率 */
86     osal_u8 reserved1;
87 } dmac_set_rate_stru;
88 
89 typedef struct {
90     mac_twt_update_source_enum_uint8 update_source;
91     osal_u16 user_idx;
92     osal_u8 resv;
93     mac_cfg_twt_stru twt_cfg;
94 } dmac_ctx_update_twt_stru;
95 
96 #define MAC_VAP_INVAILD (0x0) /* 0为vap无效 */
97 #define MAC_VAP_VAILD (0x2b)
98 
99 #ifdef _PRE_WLAN_FEATURE_BTCOEX
100 typedef struct {
101     /* 字段参考hal_one_packet_cfg_stru 部分字段需要在device侧自行获取 */
102     hal_fcs_protect_type_enum_uint8   protect_type;
103     hal_fcs_protect_cnt_enum_uint8    protect_cnt;
104     osal_u16                          resv : 2;     /* 对应原protect_coex_pri移到device */
105     osal_u16                          cfg_one_pkt_tx_vap_index : 4;
106     osal_u16                          cfg_one_pkt_tx_peer_index : 5;
107     osal_u16                          bit_rsv : 5;
108     osal_u32                          tx_mode;
109     osal_u32                          tx_data_rate;
110 
111     osal_u8                           is_valid;
112     osal_u8                           rsv[3];      /* 字节对齐 */
113 } dmac_vap_btcoex_info_stru;
114 #endif
115 
116 /* dmac vap */
117 typedef struct dmac_vap_tag {
118     /* -->> Public Start */
119     osal_u8 bssid[WLAN_MAC_ADDR_LEN]; /* BSSID,非MAC地址,MAC地址是mib中的auc_dot11StationID  */
120 
121     osal_u8 init_flag; /* vap为静态资源,标记VAP有没有被申请。DMAC OFFLOAD模式VAP被删除后过滤缓冲的帧 */
122     osal_u8 vap_id; /* 即资源池索引值 */
123 
124     wlan_dmac_mib_stru *mib_info; /* mib信息(当时配置vap时,可以直接将指针值为NULL,节省空间) */
125     mac_scanned_all_bss_info all_bss_info;
126     mac_channel_stru channel; /* vap所在的信道 */
127 
128     osal_u16 user_nums; /* VAP下已挂接的用户个数 */
129     osal_u8 protocol             : 5;
130     osal_u8 voice_aggr           : 1; /* 该vap是否针对VO业务支持聚合 */
131     osal_u8 use_rts_threshold    : 1; /* 该vap的RTS策略是否使用协议规定的RTS门限 */
132     osal_u8 hal_cap_11ax         : 1;
133     osal_u8 tim_bitmap_len;
134     osal_u8 *tim_bitmap;
135 
136     /* --------- Public STA成员 Start ----------------- */
137     osal_u32 tb_aggr_bytes;
138     osal_u16 sta_aid; /* VAP为STA模式时保存AP分配给STA的AID(从响应帧获取), 取值范围1~2007;VAP为AP模式时,不用此成员变量 */
139     osal_u16 assoc_vap_id; /* VAP为STA模式时保存user(ap)的资源池索引;VAP为AP模式时,不用此成员变量 */
140 #ifdef _PRE_WLAN_FEATURE_MAC_PARSE_TIM
141     osal_u16 tim_pos;
142 #endif
143     /* --------- Public STA成员 End ------------------- */
144 
145     /* --------- Public AP成员 Start ------------------ */
146     osal_u16 multi_user_idx; /* 组播用户ID */
147     struct osal_list_head mac_user_list_head; /* 关联用户节点双向链表,使用USER结构内的DLIST */
148      /* --------- Public AP成员 End ------------------ */
149 
150     /* -->> Public End */
151 
152     /* -->> Private Start */
153     /* --------- Private STA成员 Start ------------------ */
154     mac_vap_state_enum_uint8 vap_state; /* VAP状态 */
155     osal_u8 beacon_timeout_times : 7; /* sta等待beacon超时计数 */
156     osal_u8 auth_received        : 1; /* 接收了auth */
157     osal_u8 assoc_rsp_received   : 1; /* 接收了assoc */
158     osal_u8 keepalive_en         : 1; /* vap KeepAlive功能开关: 0-关闭, 1-开启 */
159     osal_u8 is_erp               : 1; /* 从hmac同步当前是否处在erp保护模式中 */
160     osal_u8 is_sta_non_erp_num   : 1; /* 从hmac同步是否sta_non_erp_num,1表示大于0 */
161     osal_u8 resv1                : 4;
162     osal_u8 linkloss_rate; /* linkloss比例信息,同步至device侧供算法使用 */
163     osal_u64 sta_tbtt_tsf_time;
164     /* --------- Private STA成员 End ------------------ */
165 
166     /* -->> Private End */
167 
168     /* -->> Features Start */
169     osal_u8 sta_pm_close_status;  /* sta 低功耗状态, 包含多个模块的低功耗控制信息 */
170     osal_u8 bcn_tout_max_cnt; /* beacon连续收不到最大睡眠次数 */
171     osal_u16 er_su_disable            : 1;
172     osal_u16 dcm_constellation_tx     : 2;
173     osal_u16 bandwidth_extended_range : 1;
174     osal_u16 resv4                    : 12;
175     osal_u16 beacon_timeout; /* beacon timeout配置值 */
176     osal_u8 psm_dtim_period; /* 实际采用的dtim period */
177     osal_u16 psm_listen_interval; /* 实际采用的listen_interval */
178     osal_u8 uapsd_cap   : 1; /* 保存与STA关联的AP是否支持uapsd能力信息 */
179     osal_u8 al_tx_flag  : 1; /* 常发标志 */
180     osal_u8 mu_spacing_factor_flag : 1;
181     osal_u8 cfg_pm_mode : 3; /* 手动挡保存的低功耗模式 */
182     osal_u8 erp_mode    : 1; /* 是否处于erp保护模式 */
183     osal_u8 nodata_retransmit_flag : 1; /* null_data报文重传标志位 */
184     osal_u8 resv_feature0;
185     mac_cfg_uapsd_sta_stru sta_uapsd_cfg; /* UAPSD的配置信息 */
186     osal_s16 signal;            /* 驱动接收包记录的RSSI值 */
187     osal_u16 in_tbtt_offset; /* 内部tbtt offset配置值 */
188     mac_cfg_twt_stru twt_cfg;
189 #ifdef _PRE_WLAN_FEATURE_BTCOEX
190     dmac_vap_btcoex_info_stru vap_btcoex;
191 #endif
192     /* -->> Features End */
193 
194     mac_sta_pm_handler_stru sta_pm_handler; /* sta侧pm管理结构定义 */
195 
196     mac_cfg_p2p_noa_param_stru p2p_noa_param;
197 #ifdef _PRE_WLAN_FEATURE_CHBA
198     osal_u8 chba_mode;
199     osal_u8 resv_chba[3];
200 #endif
201     /* -->> HAL Start */
202     hal_tx_txop_alg_stru txop; /* 单播数据帧发送参数 */
203     hal_to_dmac_vap_stru *hal_vap; /* hal vap结构 */
204     hal_to_dmac_device_stru *hal_device; /* hal device结构体以免二次获取 */
205     /* -->> HAL End */
206 
207     /* -->> Forward Start */
208     hal_tx_dscr_queue_header_stru tx_dscr_queue_fake[HAL_TX_QUEUE_BUTT];
209     hal_tx_dscr_queue_header_stru tx_dscr_queue[HAL_TX_QUEUE_BUTT]; /* 发送描述符链表, 不区分用户,只分AC队列 */
210     /* -->> Forward End */
211 
212     uintptr_t *_rom; /* ROM化后资源扩展指针 */
213 } dmac_vap_stru;
214 
215 /* DMAC与HMAC模块共用的WLAN DRX事件结构体 */
216 typedef struct {
217     oal_dmac_netbuf_stru *netbuf; /* netbuf链表一个元素 */
218     osal_u16 netbuf_num;        /* netbuf链表的个数 */
219     osal_u8 resv[2];           /* 2字节对齐 */
220 } dmac_wlan_drx_event_stru;
221 
222 /* DMAC与HMAC模块共用的WLAN CRX事件结构体 */
223 typedef struct {
224     oal_dmac_netbuf_stru *netbuf; /* 指向管理帧对应的netbuf */
225     //    osal_u8              *chtxt;          /* Shared Key认证用的challenge text */
226 } dmac_wlan_crx_event_stru;
227 
228 /*
229     (1)DMAC与HMAC模块共用的CTX子类型ACTION对应的事件的结构体
230     (2)当DMAC自身产生DELBA帧时,使用该结构体向HMAC模块抛事件
231 */
232 
233 /* WUR更新事件参数 */
234 #ifdef _PRE_WLAN_FEATURE_WUR_TX
235 typedef struct {
236     mac_wur_update_source_enum_uint8 update_source;
237     osal_u8 resv;
238     osal_u16 user_idx;
239     mac_wur_param_htd_stru wur_param_htd;
240     mac_user_wur_cap_ie_stru wur_cap_ie;
241 } dmac_ctx_update_wur_stru;
242 #endif
243 
244 /* HMAC到DMAC配置同步操作 */
245 typedef struct {
246     wlan_dmac_cfgid_enum_uint16 cfgid;
247     osal_u8 resv[2];          /* 预留2字节对齐 */
248     osal_u32 (*set_func)(dmac_vap_stru *dmac_vap, osal_u8 len, const osal_u8 *param);
249 } dmac_config_syn_stru;
250 
251 typedef struct {
252     oal_bool_enum_uint8 in_use;          /* 缓存BUF是否被使用 */
253     osal_u8 num_buf;                    /* MPDU对应的描述符的个数 */
254     osal_u16 seq_num;                   /* MPDU对应的序列号 */
255     oal_dmac_netbuf_head_stru netbuf_head; /* MPDU对应的描述符首地址 */
256     osal_u32 rx_time;                   /* 报文被缓存的时间戳 */
257 } dmac_rx_buf_stru;
258 
259 /* 处理MPDU的MSDU的处理状态的结构体的定义 */
260 typedef struct {
261     oal_dmac_netbuf_stru *curr_netbuf; /* 当前处理的netbuf指针 */
262     osal_u8 *curr_netbuf_data;      /* 当前处理的netbuf的data指针 */
263     osal_u16 submsdu_offset;         /* 当前处理的submsdu的偏移量,   */
264     osal_u8 msdu_nums_in_netbuf;     /* 当前netbuf包含的总的msdu数目 */
265     osal_u8 procd_msdu_in_netbuf;    /* 当前netbuf中已处理的msdu数目 */
266     osal_u8 netbuf_nums_in_mpdu;     /* 当前MPDU的中的总的netbuf的数目 */
267     osal_u8 procd_netbuf_nums;       /* 当前MPDU中已处理的netbuf的数目 */
268     osal_u8 procd_msdu_nums_in_mpdu; /* 当前MPDU中已处理的MSDU数目 */
269 
270     osal_u8 flag;
271 } dmac_msdu_proc_state_stru;
272 
273 /* 每一个MSDU包含的内容的结构体的定义 */
274 typedef struct {
275     osal_u8 sa[WLAN_MAC_ADDR_LEN]; /* MSDU发送的源地址 */
276     osal_u8 da[WLAN_MAC_ADDR_LEN]; /* MSDU接收的目的地址 */
277     osal_u8 ta[WLAN_MAC_ADDR_LEN]; /* MSDU接收的发送地址 */
278     osal_u8 priority;
279     osal_u8 resv[1];
280 
281     oal_dmac_netbuf_stru *netbuf; /* MSDU对应的netbuf指针(可以使clone的netbuf) */
282 } dmac_msdu_stru;
283 
284 /*****************************************************************************
285   9 OTHERS定义
286 *****************************************************************************/
287 #define TIME_ONE_SEC_IN_US 1000000
288 
289 /*****************************************************************************
290  函 数 名  : dmac_get_cb_seq_num
291  功能描述  : 根据tx control block获取对应的序列号
292 *****************************************************************************/
dmac_get_cb_seq_num(const mac_tx_ctl_stru * tx_ctl)293 static INLINE__ osal_u16 dmac_get_cb_seq_num(const mac_tx_ctl_stru *tx_ctl)
294 {
295     return ((mac_ieee80211_frame_stru *)((osal_u8 *)tx_ctl + OAL_MAX_CB_LEN))->seq_num;
296 }
297 
298 /*****************************************************************************
299  函 数 名  : dmac_get_cb_wlan_frame_type
300  功能描述  : 根据tx control block获取帧类型
301 *****************************************************************************/
dmac_get_cb_wlan_frame_type(const mac_tx_ctl_stru * tx_ctl)302 static INLINE__ osal_u16 dmac_get_cb_wlan_frame_type(const mac_tx_ctl_stru *tx_ctl)
303 {
304     return ((mac_ieee80211_frame_stru *)((osal_u8 *)tx_ctl + OAL_MAX_CB_LEN))->frame_control.type;
305 }
306 
307 /*****************************************************************************
308  函 数 名  : dmac_get_cb_wlan_frame_subtype
309  功能描述  : 根据tx control block获取帧子类型
310 *****************************************************************************/
dmac_get_cb_wlan_frame_subtype(const mac_tx_ctl_stru * tx_ctl)311 static INLINE__ osal_u16 dmac_get_cb_wlan_frame_subtype(const mac_tx_ctl_stru *tx_ctl)
312 {
313     return ((mac_ieee80211_frame_stru *)((osal_u8 *)tx_ctl + OAL_MAX_CB_LEN))->frame_control.sub_type;
314 }
315 
316 /*****************************************************************************
317  函 数 名  : dmac_get_cb_frame_header_addr
318  功能描述  : 根据tx control block获取对应的帧头地址
319 *****************************************************************************/
dmac_get_cb_frame_header_addr(const mac_tx_ctl_stru * tx_ctl)320 static INLINE__ mac_ieee80211_frame_stru *dmac_get_cb_frame_header_addr(const mac_tx_ctl_stru *tx_ctl)
321 {
322     return (mac_ieee80211_frame_stru *)((osal_u8 *)tx_ctl + OAL_MAX_CB_LEN);
323 }
324 
325 /*****************************************************************************
326  函 数 名  : dmac_get_rx_cb_mac_hdr
327  功能描述  : 获取mac头的值
328 
329 *****************************************************************************/
dmac_get_rx_cb_mac_hdr(mac_rx_ctl_stru * cb_ctrl)330 static INLINE__ osal_u32 *dmac_get_rx_cb_mac_hdr(mac_rx_ctl_stru *cb_ctrl)
331 {
332     return (osal_u32 *)((osal_u8 *)cb_ctrl + OAL_MAX_CB_LEN);
333 }
334 /*****************************************************************************
335  函 数 名  : dmac_ba_seq_add
336  功能描述  : 获取两数之和跟 DMAC_BA_SEQNO_MASK 的逻辑与的结果
337 *****************************************************************************/
dmac_ba_seq_add(osal_u16 seq1,osal_u16 seq2)338 static INLINE__ osal_u16 dmac_ba_seq_add(osal_u16 seq1, osal_u16 seq2)
339 {
340     return ((seq1 + seq2) & DMAC_BA_SEQNO_MASK);
341 }
342 
343 /*****************************************************************************
344  函 数 名  : dmac_ba_seq_sub
345  功能描述  : 获取两数之差跟 DMAC_BA_SEQNO_MASK 的逻辑与的结果
346 *****************************************************************************/
dmac_ba_seq_sub(osal_u16 seq1,osal_u16 seq2)347 static INLINE__ osal_u16 dmac_ba_seq_sub(osal_u16 seq1, osal_u16 seq2)
348 {
349     return ((seq1 - seq2) & DMAC_BA_SEQNO_MASK);
350 }
351 
352 /*****************************************************************************
353  函 数 名  : dmac_get_cb_is_vipframe
354  功能描述  : 判断一个帧是否为数据帧中的VIP帧
355 *****************************************************************************/
dmac_get_cb_is_vipframe(const mac_tx_ctl_stru * tx_ctrl)356 static INLINE__ osal_u8 dmac_get_cb_is_vipframe(const mac_tx_ctl_stru *tx_ctrl)
357 {
358     if ((tx_ctrl->frame_type == WLAN_CB_FRAME_TYPE_DATA) && (tx_ctrl->frame_subtype <= MAC_DATA_VIP_FRAME)) {
359         return OSAL_TRUE;
360     }
361     return OSAL_FALSE;
362 }
363 
364 /*****************************************************************************
365  函 数 名  : dmac_get_cb_is_smps_frame
366  功能描述  : 判断一个帧是否为Action帧中的smps帧
367 *****************************************************************************/
dmac_get_cb_is_smps_frame(const mac_tx_ctl_stru * tx_ctrl)368 static INLINE__ osal_u8 dmac_get_cb_is_smps_frame(const mac_tx_ctl_stru *tx_ctrl)
369 {
370     if ((tx_ctrl->frame_type == WLAN_CB_FRAME_TYPE_ACTION) &&
371         (tx_ctrl->frame_subtype == WLAN_ACTION_SMPS_FRAME_SUBTYPE)) {
372         return OSAL_TRUE;
373     }
374     return OSAL_FALSE;
375 }
376 
377 /*****************************************************************************
378  函 数 名  : dmac_get_cb_is_opmode_frame
379  功能描述  : 判断一个帧是否为Action帧中的opmode帧
380 *****************************************************************************/
dmac_get_cb_is_opmode_frame(const mac_tx_ctl_stru * tx_ctrl)381 static INLINE__ osal_u8 dmac_get_cb_is_opmode_frame(const mac_tx_ctl_stru *tx_ctrl)
382 {
383     if ((tx_ctrl->frame_type == WLAN_CB_FRAME_TYPE_ACTION) &&
384         (tx_ctrl->frame_subtype == WLAN_ACTION_OPMODE_FRAME_SUBTYPE)) {
385         return OSAL_TRUE;
386     }
387     return OSAL_FALSE;
388 }
389 
390 /*****************************************************************************
391  函 数 名  : dmac_get_cb_is_p2pgo_frame
392  功能描述  : 判断一个帧是否为管理帧中的p2pgo帧
393 *****************************************************************************/
dmac_get_cb_is_p2pgo_frame(const mac_tx_ctl_stru * tx_ctrl)394 static INLINE__ osal_u8 dmac_get_cb_is_p2pgo_frame(const mac_tx_ctl_stru *tx_ctrl)
395 {
396     if ((tx_ctrl->frame_type == WLAN_CB_FRAME_TYPE_MGMT) &&
397         (tx_ctrl->frame_subtype == WLAN_ACTION_P2PGO_FRAME_SUBTYPE)) {
398         return OSAL_TRUE;
399     }
400     return OSAL_FALSE;
401 }
402 
403 /*****************************************************************************
404  函 数 名  : dmac_get_cb_is_data_frame
405  功能描述  : 判断一个帧是否为数据帧中的data帧或qos data帧
406 *****************************************************************************/
dmac_get_cb_is_data_frame(const mac_tx_ctl_stru * tx_ctrl)407 static INLINE__ osal_u8 dmac_get_cb_is_data_frame(const mac_tx_ctl_stru *tx_ctrl)
408 {
409     if ((dmac_get_cb_wlan_frame_type(tx_ctrl) == WLAN_DATA_BASICTYPE) &&
410         (dmac_get_cb_wlan_frame_subtype(tx_ctrl) == WLAN_DATA ||
411         dmac_get_cb_wlan_frame_subtype(tx_ctrl) == WLAN_QOS_DATA)) {
412         return OSAL_TRUE;
413     }
414     return OSAL_FALSE;
415 }
416 
417 /*****************************************************************************
418  函 数 名  : mac_get_cb_is_udata_frame
419  功能描述  : 判断一个帧是否为数据帧中单播的data帧或qos data帧
420 *****************************************************************************/
mac_get_cb_is_udata_frame(const mac_tx_ctl_stru * tx_ctrl)421 static INLINE__ osal_u8 mac_get_cb_is_udata_frame(const mac_tx_ctl_stru *tx_ctrl)
422 {
423     if ((dmac_get_cb_is_data_frame(tx_ctrl) == OSAL_TRUE) && (dmac_get_cb_is_vipframe(tx_ctrl) == OSAL_FALSE) &&
424         (tx_ctrl->ismcast == OSAL_FALSE)) {
425         return OSAL_TRUE;
426     }
427     return OSAL_FALSE;
428 }
429 
430 /*****************************************************************************
431  函 数 名  : dmac_get_cb_is_qos_data
432  功能描述  : 判断一个帧是否为数据帧中的qos data帧或qos null data帧
433 *****************************************************************************/
dmac_get_cb_is_qos_data(const mac_tx_ctl_stru * tx_ctrl)434 static INLINE__ osal_u8 dmac_get_cb_is_qos_data(const mac_tx_ctl_stru *tx_ctrl)
435 {
436     if ((dmac_get_cb_wlan_frame_type(tx_ctrl) == WLAN_DATA_BASICTYPE) &&
437         (dmac_get_cb_wlan_frame_subtype(tx_ctrl) == WLAN_QOS_DATA ||
438         dmac_get_cb_wlan_frame_subtype(tx_ctrl) == WLAN_QOS_NULL_FRAME)) {
439         return OSAL_TRUE;
440     }
441     return OSAL_FALSE;
442 }
443 
444 /*****************************************************************************
445  函 数 名  : dmac_get_cb_is_bar
446  功能描述  : 判断一个帧是否为控制帧中的block ack req帧
447 *****************************************************************************/
dmac_get_cb_is_bar(const mac_tx_ctl_stru * tx_ctrl)448 static INLINE__ osal_u8 dmac_get_cb_is_bar(const mac_tx_ctl_stru *tx_ctrl)
449 {
450     if (dmac_get_cb_wlan_frame_type(tx_ctrl) == WLAN_CONTROL &&
451         dmac_get_cb_wlan_frame_subtype(tx_ctrl) == WLAN_BLOCKACK_REQ) {
452         return OSAL_TRUE;
453     }
454     return OSAL_FALSE;
455 }
456 
457 /*****************************************************************************
458  函 数 名  : dmac_mib_set_dot11dtimperiod
459  功能描述  : 设置MIB项 dot11DTIMPeriod 的值
460 
461 *****************************************************************************/
dmac_mib_set_dot11dtimperiod(dmac_vap_stru * dmac_vap,osal_u32 val)462 static INLINE__ osal_void dmac_mib_set_dot11dtimperiod(dmac_vap_stru *dmac_vap, osal_u32 val)
463 {
464     if (val != 0) {
465         dmac_vap->mib_info->dot11_dtim_period = val;
466     }
467 }
468 
469 /*****************************************************************************
470  函 数 名  : mac_mib_get_dot11dtimperiod
471  功能描述  : 获取MIB项 dot11DTIMPeriod 的值
472 
473 *****************************************************************************/
dmac_mib_get_dot11_dtim_period(const dmac_vap_stru * dmac_vap)474 static INLINE__ osal_u32 dmac_mib_get_dot11_dtim_period(const dmac_vap_stru *dmac_vap)
475 {
476     return dmac_vap->mib_info->dot11_dtim_period;
477 }
478 
479 /*****************************************************************************
480  函 数 名  : dmac_mib_set_powermanagementmode
481  功能描述  : 设置MIB项 dot11DTIMPeriod 的值
482 
483 *****************************************************************************/
dmac_mib_set_powermanagementmode(dmac_vap_stru * dmac_vap,osal_u8 val)484 static INLINE__ osal_void dmac_mib_set_powermanagementmode(dmac_vap_stru *dmac_vap, osal_u8 val)
485 {
486     if (val != 0) {
487         dmac_vap->mib_info->dot11_power_management_mode = val;
488     }
489 }
490 
491 /*****************************************************************************
492  函 数 名  : dmac_mib_get_powermanagementmode
493  功能描述  : 获取MIB项 dot11DTIMPeriod 的值
494 
495 *****************************************************************************/
dmac_mib_get_powermanagementmode(const dmac_vap_stru * dmac_vap)496 static INLINE__ osal_u32 dmac_mib_get_powermanagementmode(const dmac_vap_stru *dmac_vap)
497 {
498     return dmac_vap->mib_info->dot11_power_management_mode;
499 }
500 
dmac_mib_set_beacon_period(dmac_vap_stru * dmac_vap,osal_u32 val)501 static INLINE__ osal_void dmac_mib_set_beacon_period(dmac_vap_stru *dmac_vap, osal_u32 val)
502 {
503     if (val != 0) {
504         dmac_vap->mib_info->dot11_beacon_period = val;
505     }
506 }
507 
dmac_mib_get_beacon_period(const dmac_vap_stru * dmac_vap)508 static INLINE__ osal_u32 dmac_mib_get_beacon_period(const dmac_vap_stru *dmac_vap)
509 {
510     return dmac_vap->mib_info->dot11_beacon_period;
511 }
512 
513 /*****************************************************************************
514  功能描述  : 获取MIB项 dot11MgmtOptionMultiBSSIDImplemented 的值
515 *****************************************************************************/
dmac_mib_get_multi_bssid_implement(dmac_vap_stru * dmac_vap)516 static INLINE__ osal_u8 dmac_mib_get_multi_bssid_implement(dmac_vap_stru *dmac_vap)
517 {
518     return dmac_vap->mib_info->dot11_mgmt_option_multi_bssid_implemented;
519 }
520 
521 /*****************************************************************************
522  功能描述  : 设置MIB项 dot11MgmtOptionMultiBSSIDImplemented 的值
523 *****************************************************************************/
dmac_mib_set_multi_bssid_implement(dmac_vap_stru * dmac_vap,osal_u8 val)524 static INLINE__ osal_void dmac_mib_set_multi_bssid_implement(dmac_vap_stru *dmac_vap, osal_u8 val)
525 {
526     dmac_vap->mib_info->dot11_mgmt_option_multi_bssid_implemented = val;
527 }
528 
529 /*****************************************************************************
530  功能描述  : 获取MIB项 dot11_heldpc_coding_in_payload 的值
531 *****************************************************************************/
dmac_mib_get_heldpc_coding_in_payload(const dmac_vap_stru * dmac_vap)532 static INLINE__ osal_u8 dmac_mib_get_heldpc_coding_in_payload(const dmac_vap_stru *dmac_vap)
533 {
534     return dmac_vap->mib_info->dot11_heldpc_coding_in_payload;
535 }
536 
537 /*****************************************************************************
538  功能描述  : 设置MIB项 dot11_heldpc_coding_in_payload 的值
539 *****************************************************************************/
dmac_mib_set_heldpc_coding_in_payload(dmac_vap_stru * dmac_vap,osal_u8 val)540 static INLINE__ osal_void dmac_mib_set_heldpc_coding_in_payload(dmac_vap_stru *dmac_vap, osal_u8 val)
541 {
542     dmac_vap->mib_info->dot11_heldpc_coding_in_payload = val;
543 }
544 
545 /*****************************************************************************
546  功能描述  : 获取MIB项 dot11_ldpc_coding_option_implemented 的值
547 *****************************************************************************/
dmac_mib_get_ldpc_coding_option_implemented(const dmac_vap_stru * dmac_vap)548 static INLINE__ osal_u8 dmac_mib_get_ldpc_coding_option_implemented(const dmac_vap_stru *dmac_vap)
549 {
550     return dmac_vap->mib_info->dot11_ldpc_coding_option_implemented;
551 }
552 
553 /*****************************************************************************
554  功能描述  : 设置MIB项 dot11_ldpc_coding_option_implemented 的值
555 *****************************************************************************/
dmac_mib_set_ldpc_coding_option_implemented(dmac_vap_stru * dmac_vap,osal_u8 val)556 static INLINE__ osal_void dmac_mib_set_ldpc_coding_option_implemented(dmac_vap_stru *dmac_vap, osal_u8 val)
557 {
558     dmac_vap->mib_info->dot11_ldpc_coding_option_implemented = val;
559 }
560 
561 /*****************************************************************************
562  功能描述  : 获取MIB项 dot11_ldpc_coding_option_activated 的值
563 *****************************************************************************/
dmac_mib_get_ldpc_coding_option_activated(const dmac_vap_stru * dmac_vap)564 static INLINE__ osal_u8 dmac_mib_get_ldpc_coding_option_activated(const dmac_vap_stru *dmac_vap)
565 {
566     return dmac_vap->mib_info->dot11_ldpc_coding_option_activated;
567 }
568 
569 /*****************************************************************************
570  功能描述  : 设置MIB项 dot11_ldpc_coding_option_activated 的值
571 *****************************************************************************/
dmac_mib_set_ldpc_coding_option_activated(dmac_vap_stru * dmac_vap,osal_u8 val)572 static INLINE__ osal_void dmac_mib_set_ldpc_coding_option_activated(dmac_vap_stru *dmac_vap, osal_u8 val)
573 {
574     dmac_vap->mib_info->dot11_ldpc_coding_option_activated = val;
575 }
576 
577 /*****************************************************************************
578  功能描述  : 获取MIB项 dot11_vhtldpc_coding_option_implemented 的值
579 *****************************************************************************/
dmac_mib_get_vhtldpc_coding_option_implemented(const dmac_vap_stru * dmac_vap)580 static INLINE__ osal_u8 dmac_mib_get_vhtldpc_coding_option_implemented(const dmac_vap_stru *dmac_vap)
581 {
582     return dmac_vap->mib_info->dot11_vhtldpc_coding_option_implemented;
583 }
584 
585 /*****************************************************************************
586  功能描述  : 设置MIB项 dot11_vhtldpc_coding_option_implemented 的值
587 *****************************************************************************/
dmac_mib_set_vhtldpc_coding_option_implemented(dmac_vap_stru * dmac_vap,osal_u8 val)588 static INLINE__ osal_void dmac_mib_set_vhtldpc_coding_option_implemented(dmac_vap_stru *dmac_vap, osal_u8 val)
589 {
590     dmac_vap->mib_info->dot11_vhtldpc_coding_option_implemented = val;
591 }
592 
593 /*****************************************************************************
594  函 数 名  : dmac_mib_get_station_id
595  功能描述  : 获取MIB项 dot11StationID 的值
596 
597 *****************************************************************************/
dmac_mib_get_station_id(const dmac_vap_stru * dmac_vap)598 static INLINE__ osal_u8 *dmac_mib_get_station_id(const dmac_vap_stru *dmac_vap)
599 {
600     return dmac_vap->mib_info->dot11_station_id;
601 }
602 
dmac_is_p2p_go(const dmac_vap_stru * dmac_vap)603 static INLINE__ osal_u8 dmac_is_p2p_go(const dmac_vap_stru *dmac_vap)
604 {
605     return (dmac_vap->hal_vap->p2p_mode == WLAN_P2P_GO_MODE);
606 }
607 
dmac_is_p2p_noa_enabled(const dmac_vap_stru * dmac_vap)608 static INLINE__ osal_u8 dmac_is_p2p_noa_enabled(const dmac_vap_stru *dmac_vap)
609 {
610     return (dmac_vap->p2p_noa_param.count != 0);
611 }
612 
dmac_is_p2p_cl(const dmac_vap_stru * dmac_vap)613 static INLINE__ osal_u8 dmac_is_p2p_cl(const dmac_vap_stru *dmac_vap)
614 {
615     return (dmac_vap->hal_vap->p2p_mode == WLAN_P2P_CL_MODE);
616 }
617 
dmac_is_p2p_dev(const dmac_vap_stru * dmac_vap)618 static INLINE__ osal_u8 dmac_is_p2p_dev(const dmac_vap_stru *dmac_vap)
619 {
620     return (dmac_vap->hal_vap->p2p_mode == WLAN_P2P_DEV_MODE);
621 }
622 
get_p2p_mode(const dmac_vap_stru * dmac_vap)623 static INLINE__ osal_u8 get_p2p_mode(const dmac_vap_stru *dmac_vap)
624 {
625     return (dmac_vap->hal_vap->p2p_mode);
626 }
627 
dmac_is_legacy_vap(const dmac_vap_stru * dmac_vap)628 static INLINE__ osal_u8 dmac_is_legacy_vap(const dmac_vap_stru *dmac_vap)
629 {
630     return (dmac_vap->hal_vap->p2p_mode == WLAN_LEGACY_VAP_MODE);
631 }
632 
dmac_is_legacy_sta(const dmac_vap_stru * dmac_vap)633 static INLINE__ osal_u8 dmac_is_legacy_sta(const dmac_vap_stru *dmac_vap)
634 {
635     return ((dmac_vap->hal_vap->vap_mode == WLAN_VAP_MODE_BSS_STA) &&
636         (dmac_vap->hal_vap->p2p_mode == WLAN_LEGACY_VAP_MODE));
637 }
638 
dmac_is_legacy_ap(const dmac_vap_stru * dmac_vap)639 static INLINE__ osal_u8 dmac_is_legacy_ap(const dmac_vap_stru *dmac_vap)
640 {
641     return ((dmac_vap->hal_vap->vap_mode == WLAN_VAP_MODE_BSS_AP) &&
642         (dmac_vap->hal_vap->p2p_mode == WLAN_LEGACY_VAP_MODE));
643 }
644 
dmac_is_up_vap(const dmac_vap_stru * dmac_vap)645 static INLINE__ osal_u8 dmac_is_up_vap(const dmac_vap_stru *dmac_vap)
646 {
647     return ((dmac_vap->vap_state == MAC_VAP_STATE_UP) || (dmac_vap->vap_state == MAC_VAP_STATE_PAUSE) ||
648         (dmac_vap->vap_state == MAC_VAP_STATE_ROAMING));
649 }
650 
651 osal_u32 *dmac_get_rx_cb_mac_hdr(mac_rx_ctl_stru *cb_ctrl);
652 osal_u32 mac_vap_set_cb_tx_user_idx(dmac_vap_stru *dmac_vap, mac_tx_ctl_stru *tx_ctl, const osal_u8 *data);
653 
654 #ifdef __cplusplus
655 #if __cplusplus
656 }
657 #endif
658 #endif
659 
660 #endif /* end of dmac_ext_if_rom.h */
661