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 * 文 件 名 : hmac_tx_amsdu.h
15 * 生成日期 : 2012年11月12日
16 * 功能描述 : hmac_tx_amsdu.c 的头文件
17 */
18
19
20 #ifndef __HMAC_TX_AMSDU_H__
21 #define __HMAC_TX_AMSDU_H__
22
23 /*****************************************************************************
24 1 其他头文件包含
25 *****************************************************************************/
26 #include "hmac_tx_data.h"
27 #ifdef _PRE_PLAT_FEATURE_CUSTOMIZE
28 #include "soc_customize_wifi.h"
29 #endif
30 #include "hmac_feature_interface.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_HMAC_TX_AMSDU_H
40 /*****************************************************************************
41 2 宏定义
42 *****************************************************************************/
43 /* HT控制信息的amsdu能力位 */
44 #define HT_CAP_AMSDU_LEN 0x0800
45
46 /* amsdu生命周期15ms FPGA 1500 */
47 #define HMAC_AMSDU_LIFE_TIME 5
48
49 /* amsdu聚合最小帧长(对照ack帧长,拍板决定) */
50 #define HMAC_AMSDU_TX_MIN_PKT_LENGTH 14
51 /* 发送方向组masdu帧的netbuf剩余tailroom最小值, LLC+PKT LENTH+PAD */
52 #define HMAC_AMSDU_TX_MIN_LENGTH (SNAP_LLC_FRAME_LEN + HMAC_AMSDU_TX_MIN_PKT_LENGTH + 3)
53
54 /* 短包聚合最大个数 */
55 #define HMAC_AMSDU_SHORT_PACKET_NUM 0x02
56
57 /* 小于500字节的包为短包 */
58 #define HMAC_AMSDU_SHORT_PACKET_LEN 500
59
60 /* 一个amsdu下允许拥有的msdu的最大个数 */
61 #ifdef _PRE_PLAT_FEATURE_CUSTOMIZE
62 #define HMAC_AMSDU_MAX_NUM hwifi_get_amsdu_num()
63 #else
64 #define HMAC_AMSDU_MAX_NUM 4
65 #endif
66
67 /*****************************************************************************
68 3 枚举定义
69 *****************************************************************************/
70
71
72 /*****************************************************************************
73 4 全局变量声明
74 *****************************************************************************/
75
76 /*****************************************************************************
77 5 消息头定义
78 *****************************************************************************/
79
80
81 /*****************************************************************************
82 6 消息定义
83 *****************************************************************************/
84
85
86 /*****************************************************************************
87 7 STRUCT定义
88 *****************************************************************************/
89
90 /*****************************************************************************
91 8 UNION定义
92 *****************************************************************************/
93
94
95 /*****************************************************************************
96 9 OTHERS定义
97 *****************************************************************************/
98
99
100 /*****************************************************************************
101 函 数 名 : hmac_amsdu_set_maxnum
102 功能描述 : 配置amsdu子帧最大个数
103 *****************************************************************************/
hmac_amsdu_set_maxnum(hmac_amsdu_stru * amsdu,osal_u8 max_num)104 OAL_STATIC OAL_INLINE osal_void hmac_amsdu_set_maxnum(hmac_amsdu_stru *amsdu, osal_u8 max_num)
105 {
106 if (max_num > HMAC_AMSDU_MAX_NUM) {
107 amsdu->amsdu_maxnum = HMAC_AMSDU_MAX_NUM;
108 } else {
109 amsdu->amsdu_maxnum = max_num;
110 }
111 }
112
113 /*****************************************************************************
114 函 数 名 : hmac_amsdu_is_short_pkt
115 功能描述 : amsdu判断是否短包
116 输入参数 : osal_u32 frame_len 包长
117 *****************************************************************************/
hmac_amsdu_is_short_pkt(osal_u32 frame_len)118 OAL_STATIC OAL_INLINE oal_bool_enum_uint8 hmac_amsdu_is_short_pkt(osal_u32 frame_len)
119 {
120 if (frame_len < HMAC_AMSDU_SHORT_PACKET_LEN) {
121 return OAL_TRUE;
122 }
123
124 return OAL_FALSE;
125 }
126
127 /*****************************************************************************
128 10 函数声明
129 *****************************************************************************/
130 static osal_u32 hmac_tx_amsdu_init_weakref(osal_void) __attribute__ ((weakref("hmac_tx_amsdu_init"), used));
131 static osal_void hmac_tx_amsdu_deinit_weakref(osal_void)
132 __attribute__ ((weakref("hmac_tx_amsdu_deinit"), used));
133
134 typedef osal_u32 (*hmac_amsdu_notify_etc_cb)(hmac_vap_stru *hmac_vap,
135 hmac_user_stru *hmac_user, oal_netbuf_stru *buf);
136 typedef osal_void (*hmac_amsdu_init_user_etc_cb)(hmac_user_stru *hmac_user);
137 typedef osal_void (*hmac_amsdu_tid_info_clear_cb)(hmac_user_stru *hmac_user);
138 #ifdef _PRE_WLAN_FEATURE_MULTI_NETBUF_AMSDU
139 typedef osal_void (*hmac_tx_encap_large_skb_amsdu_cb)(hmac_vap_stru *hmac_vap, hmac_user_stru *hmac_user,
140 oal_netbuf_stru *buf, mac_tx_ctl_stru *tx_ctl);
141 #endif
142 #ifdef __cplusplus
143 #if __cplusplus
144 }
145 #endif
146 #endif
147
148 #endif /* end of hmac_tx_amsdu.h */
149