• 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 __OAM_EXT_IF_H__
20 #define __OAM_EXT_IF_H__
21 
22 /* ****************************************************************************
23   1 其他头文件包含
24 **************************************************************************** */
25 #include "oal_util.h"
26 #include "oal_ext_if.h"
27 #include "hi_types.h"
28 #include "oam_log.h"
29 
30 #ifdef __cplusplus
31 #if __cplusplus
32 extern "C" {
33 #endif
34 #endif
35 
36 #ifdef _PRE_WIFI_DMT
37 #define OAM_PRINT_FORMAT_LENGTH 1024 /* ????????????:DMT???????????,??????? */
38 #else
39 #define OAM_PRINT_FORMAT_LENGTH 256 /* ???????????? */
40 #endif
41 
42 /* ****************************************************************************
43   2 宏定义
44 **************************************************************************** */
45 #define oam_excp_record(_uc_vap_id, _excp_id) oam_exception_record(_uc_vap_id, _excp_id);
46 
47 #define oam_error_log(vid, eid, fmt, args...) oam_logn(vid, eid, OAM_LOG_LEVEL_ERROR, fmt, ##args)
48 #define oam_error_log0(vid, eid, fmt)                   oam_log(vid, eid, OAM_LOG_LEVEL_ERROR, fmt, 0, 0, 0, 0, 0)
49 #define oam_error_log1(vid, eid, fmt, p1)               oam_log(vid, eid, OAM_LOG_LEVEL_ERROR, fmt, 1, p1,0, 0, 0)
50 #define oam_error_log2(vid, eid, fmt, p1, p2)           oam_log(vid, eid, OAM_LOG_LEVEL_ERROR, fmt, 2, p1, p2, 0, 0)
51 #define oam_error_log3(vid, eid, fmt, p1, p2, p3)       oam_log(vid, eid, OAM_LOG_LEVEL_ERROR, fmt, 3, p1, p2, p3, 0)
52 #define oam_error_log4(vid, eid, fmt, p1, p2, p3, p4)   oam_log(vid, eid, OAM_LOG_LEVEL_ERROR, fmt, 4, p1, p2, p3, p4)
53 #define oam_error_buf(vid, eid, fmt, buff, size)        oam_print_err(fmt, buff, size)
54 
55 #define oam_warning_log0(vid, eid, fmt)                 oam_log(vid, eid, OAM_LOG_LEVEL_WARNING, fmt, 0, 0, 0, 0, 0)
56 #define oam_warning_log1(vid, eid, fmt, p1)             oam_log(vid, eid, OAM_LOG_LEVEL_WARNING, fmt, 1, p1,0, 0, 0)
57 #define oam_warning_log2(vid, eid, fmt, p1, p2)         oam_log(vid, eid, OAM_LOG_LEVEL_WARNING, fmt, 2, p1, p2, 0, 0)
58 #define oam_warning_log3(vid, eid, fmt, p1, p2, p3)     oam_log(vid, eid, OAM_LOG_LEVEL_WARNING, fmt, 3, p1, p2, p3, 0)
59 #define oam_warning_log4(vid, eid, fmt, p1, p2, p3, p4) oam_log(vid, eid, OAM_LOG_LEVEL_WARNING, fmt, 4, p1, p2, p3, p4)
60 #define oam_warning_buf(vid, eid, fmt, buff, size)      oam_print_warn(fmt, buff, size)
61 
62 #define oam_info_log(vid, eid, fmt, args...)                    oam_logn(vid, eid, OAM_LOG_LEVEL_INFO, fmt, ##args)
63 #define oam_info_log0(vid, eid, fmt)                    oam_log(vid, eid, OAM_LOG_LEVEL_INFO, fmt, 0, 0, 0, 0, 0)
64 #define oam_info_log1(vid, eid, fmt, p1)                oam_log(vid, eid, OAM_LOG_LEVEL_INFO, fmt, 1, p1,0, 0, 0)
65 #define oam_info_log2(vid, eid, fmt, p1, p2)            oam_log(vid, eid, OAM_LOG_LEVEL_INFO, fmt, 2, p1, p2, 0, 0)
66 #define oam_info_log3(vid, eid, fmt, p1, p2, p3)        oam_log(vid, eid, OAM_LOG_LEVEL_INFO, fmt, 3, p1, p2, p3, 0)
67 #define oam_info_log4(vid, eid, fmt, p1, p2, p3, p4)    oam_log(vid, eid, OAM_LOG_LEVEL_INFO, fmt, 4, p1, p2, p3, p4)
68 #define oam_info_buf(vid, eid, fmt, buff, size)         oam_print_info(fmt, buff, size)
69 
70 #define oam_debug_log(vid, eid, fmt, args...)                    oam_logn(vid, eid, OAM_LOG_LEVEL_DEBUG, fmt, ##args)
71 #define oam_debug_log0(vid, eid, fmt)                    oam_log(vid, eid, OAM_LOG_LEVEL_DEBUG, fmt, 0, 0, 0, 0, 0)
72 #define oam_debug_log1(vid, eid, fmt, p1)                oam_log(vid, eid, OAM_LOG_LEVEL_DEBUG, fmt, 1, p1,0, 0, 0)
73 #define oam_debug_log2(vid, eid, fmt, p1, p2)            oam_log(vid, eid, OAM_LOG_LEVEL_DEBUG, fmt, 2, p1, p2, 0, 0)
74 #define oam_debug_log3(vid, eid, fmt, p1, p2, p3)        oam_log(vid, eid, OAM_LOG_LEVEL_DEBUG, fmt, 3, p1, p2, p3, 0)
75 #define oam_debug_log4(vid, eid, fmt, p1, p2, p3, p4)    oam_log(vid, eid, OAM_LOG_LEVEL_DEBUG, fmt, 4, p1, p2, p3, p4)
76 
77 #ifdef _PRE_HDF_LINUX
78 #define oam_print(fmt, arg...) printk(fmt, ##arg)
79 
80 #define LOG(fmt, arg...) printk(fmt "\r\n", ##arg)
81 #define LOGE(fmt, arg...) printk("[E/" LOG_TAG "]" fmt "\r\n", ##arg)
82 #define LOGW(fmt, arg...) printk("[W/" LOG_TAG "]" fmt "\r\n", ##arg)
83 #define LOGI(fmt, arg...) printk("[I/" LOG_TAG "]" fmt "\r\n", ##arg)
84 #define LOGD(fmt, arg...) printk("[D/" LOG_TAG "]" fmt "\r\n", ##arg)
85 #define LOGV(fmt, arg...) printk("[V/" LOG_TAG "]" fmt "\r\n", ##arg)
86 #else
87 #define oam_print(fmt, arg...) dprintf(fmt, ##arg)
88 
89 #define LOG(fmt, arg...) dprintf(fmt "\r\n", ##arg)
90 #define LOGE(fmt, arg...) dprintf("[E/" LOG_TAG "]" fmt "\r\n", ##arg)
91 #define LOGW(fmt, arg...) dprintf("[W/" LOG_TAG "]" fmt "\r\n", ##arg)
92 #define LOGI(fmt, arg...) dprintf("[I/" LOG_TAG "]" fmt "\r\n", ##arg)
93 #define LOGD(fmt, arg...) dprintf("[D/" LOG_TAG "]" fmt "\r\n", ##arg)
94 #define LOGV(fmt, arg...) dprintf("[V/" LOG_TAG "]" fmt "\r\n", ##arg)
95 #endif
96 
97 #ifdef _HI113X_PRINTK_STDOUT
98 extern hi_u32 g_level_log;
99 #define oam_print_err(FORMAT, ARGS...)                                                                               \
100     if (g_level_log > 0) {                                                                                           \
101         printk(KERN_ERR "[ERROR]:%s:%s:%d:" FORMAT "\n", hi_strrchr(__FILE__, '/'), __FUNCTION__, __LINE__, ##ARGS); \
102     }
103 #define oam_print_warn(FORMAT, ARGS...)                                                                        \
104     if (g_level_log > 1) {                                                                                     \
105         printk(KERN_WARNING "[WARN]:%s:%s:%d:" FORMAT "\n", hi_strrchr(__FILE__, '/'), __FUNCTION__, __LINE__, \
106             ##ARGS);                                                                                           \
107     }
108 #define oam_print_info(FORMAT, ARGS...)                                                                              \
109     if (g_level_log > 2) {                                                                                           \
110         printk(KERN_INFO "[INFO]:%s:%s:%d:" FORMAT "\n", hi_strrchr(__FILE__, '/'), __FUNCTION__, __LINE__, ##ARGS); \
111     }
112 #else
113 #define OAM_PRINT_ERR(FORMAT, ARGS...)
114 #define OAM_PRINT_WARN(FORMAT, ARGS...)
115 #define OAM_PRINT_INFO(FORMAT, ARGS...)
116 #endif
117 
118 #define HI_DIAG_PRINTF dprintf
119 
120 /* 字符串以0结尾上报,实际字符串内容最大长度 */
121 #define OAM_REPORT_MAX_STRING_LEN (WLAN_MEM_LOCAL_SIZE5 - 1) /* 以\0结束 */
122 
123 /* ****************************************************************************
124   6 ENUM定义
125 **************************************************************************** */
126 
127 typedef hi_u8 oam_log_level_enum_uint8;
128 
129 /* 特性宏的缩写见gst_oam_feature_list */
130 typedef enum {
131     OAM_SF_SCAN                 = 0,
132     OAM_SF_AUTH,
133     OAM_SF_ASSOC,
134     OAM_SF_FRAME_FILTER,
135     OAM_SF_WMM,
136 
137     OAM_SF_DFS                  = 5,
138     OAM_SF_NETWORK_MEASURE,
139     OAM_SF_ENTERPRISE_VO,
140     OAM_SF_HOTSPOTROAM,
141     OAM_SF_NETWROK_ANNOUNCE,
142 
143     OAM_SF_NETWORK_MGMT         = 10,
144     OAM_SF_NETWORK_PWS,
145     OAM_SF_PROXYARP,
146     OAM_SF_TDLS,
147     OAM_SF_CALIBRATE,
148 
149     OAM_SF_EQUIP_TEST           = 15,
150     OAM_SF_CRYPTO,
151     OAM_SF_WPA,
152     OAM_SF_WEP,
153     OAM_SF_WPS,
154 
155     OAM_SF_PMF                  = 20,
156     OAM_SF_WAPI,
157     OAM_SF_BA,
158     OAM_SF_AMPDU,
159     OAM_SF_AMSDU,
160 
161     OAM_SF_STABILITY            = 25,
162     OAM_SF_TCP_OPT,
163     OAM_SF_ACS,
164     OAM_SF_AUTORATE,
165     OAM_SF_TXBF,
166 
167     OAM_SF_DYN_RECV             = 30,       /* dynamin recv */
168     OAM_SF_VIVO,                            /* video_opt voice_opt */
169     OAM_SF_MULTI_USER,
170     OAM_SF_MULTI_TRAFFIC,
171     OAM_SF_ANTI_INTF,
172 
173     OAM_SF_EDCA                 = 35,
174     OAM_SF_SMART_ANTENNA,
175     OAM_SF_TPC,
176     OAM_SF_TX_CHAIN,
177     OAM_SF_RSSI,
178 
179     OAM_SF_WOW                  = 40,
180     OAM_SF_GREEN_AP,
181     OAM_SF_PWR,                             /* psm uapsd fastmode */
182     OAM_SF_SMPS,
183     OAM_SF_TXOP,
184 
185     OAM_SF_WIFI_BEACON          = 45,
186     OAM_SF_KA_AP,                           /* keep alive ap */
187     OAM_SF_MULTI_VAP,
188     OAM_SF_2040,                            /* 20m+40m coex */
189     OAM_SF_DBAC,
190 
191     OAM_SF_PROXYSTA             = 50,
192     OAM_SF_UM,                              /* user management */
193     OAM_SF_P2P,                             /* P2P 特性 */
194     OAM_SF_M2U,
195     OAM_SF_IRQ,                             /* top half */
196 
197     OAM_SF_TX                   = 55,
198     OAM_SF_RX,
199     OAM_SF_DUG_COEX,
200     OAM_SF_CFG,                             /* wal dmac config函数 */
201     OAM_SF_FRW,                             /* frw层 */
202 
203     OAM_SF_KEEPALIVE            = 60,
204     OAM_SF_COEX,
205     OAM_SF_HS20                 = 62,        /* HotSpot 2.0特性 */
206     OAM_SF_MWO_DET,
207     OAM_SF_CCA_OPT,
208 
209     OAM_SF_DFT,
210     OAM_SF_FIRMWARE,
211     OAM_SF_HEARTBEAT,
212     OAM_SF_SDIO,
213     OAM_SF_BACKUP,
214     OAM_SF_ANY, /* rifs protection shortgi frag datarate countrycode
215                     coustom_security startup_time lsig monitor wds
216                     hidessid */
217 #ifdef _PRE_WLAN_FEATURE_CSI
218     OAM_SF_CSI,
219 #endif
220 
221     OAM_SOFTWARE_FEATURE_BUTT
222 } oam_feature_enum;
223 
224 /* ****************************************************************************
225   7 STRUCT定义
226 **************************************************************************** */
227 #ifdef _PRE_DEBUG_MODE
228 typedef struct {
229     /* 接收方向统计 */
230     hi_u32 ba_recipient_tid_recv_pkt; /* 该TID建立BA会话后,接收数据包数目 */
231     hi_u32 ba_recipient_no_ba_session;
232     hi_u32 ba_recipient_recv_ampdu_no_ba;
233     hi_u32 ba_recipient_send_delba_count;
234     hi_u32 ba_recipient_dup_frame_count;
235     hi_u32 ba_recipient_dup_frame_drop_count;
236     hi_u32 ba_recipient_dup_frame_up_count;
237     hi_u32 ba_recipient_direct_up_count;
238     hi_u32 ba_recipient_buffer_frame_count;
239     hi_u32 ba_recipient_buffer_frame_overlap_count;
240     hi_u32 ba_recipient_between_baw_count;
241     hi_u32 ba_recipient_greater_baw_count;
242     hi_u32 ba_recipient_sync_loss_count;
243     hi_u32 ba_recipient_update_hw_baw_count;
244 } oam_stats_ampdu_stat_stru;
245 #endif
246 
247 /* ****************************************************************************
248   10 函数声明    OAM模块对外提供的接口
249 **************************************************************************** */
250 hi_s32 oam_main_init(hi_void);
251 hi_void oam_main_exit(hi_void);
252 
253 #ifdef __cplusplus
254 #if __cplusplus
255 }
256 #endif
257 #endif
258 
259 #endif /* end of oam_ext_if.h */
260