• 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 __HMAC_TX_DATA_H__
20 #define __HMAC_TX_DATA_H__
21 
22 /* ****************************************************************************
23   1 其他头文件包含
24 **************************************************************************** */
25 #include "mac_frame.h"
26 #include "dmac_ext_if.h"
27 #include "hmac_ext_if.h"
28 #include "hmac_vap.h"
29 #include "hmac_user.h"
30 #include "hmac_main.h"
31 #include "hmac_mgmt_classifier.h"
32 #include "mac_resource.h"
33 #include "hmac_config.h"
34 
35 #ifdef __cplusplus
36 #if __cplusplus
37 extern "C" {
38 #endif
39 #endif
40 
41 /* ****************************************************************************
42   2 宏定义
43 **************************************************************************** */
44 /* 基本能力信息中关于是否是QOS的能力位 */
45 #define HMAC_CAP_INFO_QOS_MASK 0x0200
46 
47 #define wlan_tos_to_tid(_tos)   \
48     ((((_tos) == 0) || ((_tos) == 3)) ? WLAN_TIDNO_BEST_EFFORT : \
49     (((_tos) == 1) || ((_tos) == 2)) ? WLAN_TIDNO_BACKGROUND : \
50     (((_tos) == 4) || ((_tos) == 5)) ? WLAN_TIDNO_VIDEO : WLAN_TIDNO_VOICE)
51 
52 #define WLAN_BA_CNT_INTERVAL 100
53 
54 /* ****************************************************************************
55   3 枚举定义
56 **************************************************************************** */
57 typedef enum {
58     HMAC_TX_BSS_NOQOS = 0,
59     HMAC_TX_BSS_QOS   = 1,
60 
61     HMAC_TX_BSS_QOS_BUTT
62 } hmac_tx_bss_qos_type_enum;
63 
64 /* ****************************************************************************
65   4 全局变量声明
66 **************************************************************************** */
67 /* ****************************************************************************
68   5 消息头定义
69 **************************************************************************** */
70 /* ****************************************************************************
71   6 消息定义
72 **************************************************************************** */
73 /* ****************************************************************************
74   7 STRUCT定义
75 **************************************************************************** */
76 typedef struct hmac_set_addresses_info_stru {
77     hi_u8 *puc_saddr;
78     hi_u8 *puc_daddr;
79 
80     hi_u16 us_ether_type;
81     hi_u16 us_rsvd;
82 } hmac_set_addresses_info_stru;
83 
84 /* ****************************************************************************
85   8 UNION定义
86 **************************************************************************** */
87 /* ****************************************************************************
88   10 函数声明
89 **************************************************************************** */
90 hi_u32 hmac_tx_wlan_to_wlan_ap(frw_event_mem_stru *event_mem);
91 hi_u32 hmac_tx_lan_to_wlan(mac_vap_stru *mac_vap, oal_netbuf_stru *netbuf);
92 #ifdef _PRE_WLAN_FEATURE_SMP_SUPPORT
93 hi_u32 hmac_tx_post_event(mac_vap_stru *mac_vap);
94 hi_u32 hmac_tx_event_process(oal_mem_stru *event_mem);
95 #endif
96 hi_u16 hmac_free_netbuf_list(oal_netbuf_stru *netbuf);
97 hi_u32 hmac_tx_encap(const hmac_vap_stru *hmac_vap, const hmac_user_stru *hmac_user, oal_netbuf_stru *netbuf);
98 hmac_tx_return_type_enum_uint8 hmac_tx_ucast_process(hmac_vap_stru *hmac_vap, oal_netbuf_stru *netbuf,
99     hmac_user_stru *hmac_user, const hmac_tx_ctl_stru *tx_ctl);
100 hi_void hmac_tx_ba_setup(hmac_vap_stru *hmac_vap, hmac_user_stru *hmac_user, hi_u8 tidno);
101 
102 #ifdef _PRE_WLAN_FEATURE_MESH
103 hi_u32 hmac_unicast_data_tx_event_info(mac_vap_stru *mac_vap, hi_u8 len, const hi_u8 *puc_param);
104 #endif
105 hi_u8 hmac_tx_wmm_acm(hi_u8 wmm, const hmac_vap_stru *hmac_vap, hi_u8 *puc_tid);
106 hi_u8 hmac_tid_need_ba_session(hmac_vap_stru *hmac_vap, hmac_user_stru *hmac_user, hi_u8 tidno,
107     const oal_netbuf_stru *netbuf);
108 
109 /* ****************************************************************************
110   9 OTHERS定义
111 **************************************************************************** */
112 /* ****************************************************************************
113  函 数 名  : hmac_get_frame_header_len
114  功能描述  : 获取帧头长度
115 **************************************************************************** */
hmac_get_frame_header_len(hi_u32 qos,const hmac_tx_ctl_stru * tx_ctl)116 static inline hi_u8 hmac_get_frame_header_len(hi_u32 qos, const hmac_tx_ctl_stru *tx_ctl)
117 {
118     if (qos == HMAC_TX_BSS_QOS) {
119         return (tx_ctl->use_4_addr) ? MAC_80211_QOS_4ADDR_FRAME_LEN : MAC_80211_QOS_FRAME_LEN;
120     } else {
121         return (tx_ctl->use_4_addr) ? MAC_80211_4ADDR_FRAME_LEN : MAC_80211_FRAME_LEN;
122     }
123 }
124 
125 /* ****************************************************************************
126  功能描述  : 判断该用户对应的TID是否已经建立BA会话
127  返 回 值  : HI_TRUE代表已经创建了BA会话
128  修改历史      :
129   1.日    期   : 2013年4月11日
130     作    者   : HiSilicon
131     修改内容   : 新生成函数
132 **************************************************************************** */
hmac_vap_ba_is_setup(const hmac_user_stru * hmac_user,hi_u8 tidno)133 static inline hi_u8 hmac_vap_ba_is_setup(const hmac_user_stru *hmac_user, hi_u8 tidno)
134 {
135     if ((hmac_user->ast_tid_info[tidno].ba_tx_info != HI_NULL) &&
136         (hmac_user->ast_tid_info[tidno].ba_tx_info->ba_status == DMAC_BA_COMPLETE)) {
137         return HI_TRUE;
138     }
139     return HI_FALSE;
140 }
141 
142 #ifdef __cplusplus
143 #if __cplusplus
144 }
145 #endif
146 #endif
147 
148 #endif /* __HMAC_TX_DATA_H__ */
149