• 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: dfx feature head file.
15  */
16 
17 #ifndef __HMAC_DFX_H__
18 #define __HMAC_DFX_H__
19 
20 #include "oal_types.h"
21 
22 #ifdef _PRE_WLAN_DFT_STAT
23 #include "osal_adapt.h"
24 #include "osal_list.h"
25 #include "wlan_types_common.h"
26 #include "oal_schedule.h"
27 #include "oal_skbuff.h"
28 #include "common_dft.h"
29 #include "hmac_device.h"
30 #endif
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_DFX_H
40 /*****************************************************************************
41   函数声明
42 *****************************************************************************/
43 #define MAX_CONN_INFO_RD_NUM            20
44 #define MAX_DFX_USER_NUM                16
45 #define MAX_DFX_USER_RD_LEN             512
46 
47 #define DFX_SUCCESS         0
48 #define DFX_FAIL            1
49 
50 #define DFX_OFFLINE_PERIOD   50
51 #define DFX_CONN_FAIL_PERIOD 10
52 #define DFX_CONN_FAIL_CNT    3
53 
54 typedef enum {
55     USER_CONN_FAIL = 0,
56     USER_CONN_OFFLINE,
57     USER_CONN_STA_STAT,
58     USER_CONN_AP_STAT,
59 
60     USER_CONN_INFO_BUTT
61 } user_conn_info_enum;
62 typedef osal_u8 user_conn_info_enum_uint8;
63 
64 typedef enum {
65     STA_CONN_CANNT_FIND_AP = 1,
66     STA_CONN_CHECK_BSS_DSCR_ERR,
67     STA_CONN_SET_PARAM_ERR,
68     STA_CONN_SYNC_CFG_ERR,
69     STA_CONN_AUTH_FSM_ERR,
70     STA_CONN_AUTH_RSP_ERR,
71     STA_CONN_AUTH_TIMEOUT_ERR,
72     STA_CONN_ASOC_FSM_ERR,
73     STA_CONN_ASOC_RSP_ERR,
74     STA_CONN_ASOC_TIMEOUT_ERR,
75 
76     AP_AUTH_RSP_ENCAP_ERR,
77     AP_AUTH_FIND_USER_ERR,
78     AP_AUTH_RSP_SEND_ERR,
79     AP_ASOC_WAIT_TIMEOUT_ERR,           /* AP发送auth rsp后等待asoc req超时 */
80     AP_ASOC_NEGO_CAPABILITY_ERR,
81     AP_ASOC_RSP_ENCAP_ERR,
82     AP_ASOC_RSP_SEND_ERR,
83 
84     USER_CONN_FAIL_BUTT
85 } user_conn_fail_reason_enum;
86 typedef osal_u16 user_conn_fail_reason_enum_uint16;
87 
88 typedef enum {
89     STA_RCV_AP_DEAUTH_OR_DISASOC = 1,
90     STA_UP_OTHER_VAP_CLEAN_BSS,
91 
92     AP_RCV_STA_DEAUTH,
93     AP_RCV_STA_DISASOC,
94     AP_BLACKLIST_DEL_STA,
95     AP_DOWN_DEL_STA,
96     AP_AUTH_RSP_DEL_OTHER_STA,
97     AP_CLEAN_BSS,                       /* P2P上线后清空user */
98     AP_STA_NOUP_RCV_DATA,               /* sta未UP时收到数据帧,通知STA下线 */
99 
100     CFG_KICK_USER,
101 
102     PMF_SA_QUERY_TIMEOUT_DEL_USER,      /* 管理帧加密发送SA QUERY报文超时删除用户 */
103     HMAC_DISASOC_NOTICE,                /* dmac去关联时通知hmac,包含dmac_disasoc_misc_reason_enum枚举定义的原因 */
104     ROAM_CONNECTING_FAIL,               /* 漫游尝试连接失败后通知下线处理 */
105     ROAM_HANDSHAKE_FAIL,                /* 漫游HANDSHAKE失败后通知下线处理 */
106 
107     USER_CONN_OFFLINE_BUTT
108 } user_conn_offline_reason_enum;
109 typedef osal_u16 user_conn_offline_reason_enum_uint16;
110 
111 typedef enum {
112     DFX_USER_CONN_INFO_RECORD_CMD_ENABLE,
113     DFX_USER_CONN_INFO_RECORD_CMD_DISABLE,
114     DFX_USER_CONN_INFO_RECORD_CMD_FAIL,
115     DFX_USER_CONN_INFO_RECORD_CMD_OFFLINE,
116     DFX_USER_CONN_INFO_RECORD_CMD_STATISTIC,
117     DFX_USER_CONN_INFO_RECORD_CMD_STATCLR,
118     DFX_USER_CONN_INFO_RECORD_CMD_BUTT
119 } dfx_user_conn_info_record_cmd_enum;
120 typedef osal_u8 dfx_user_conn_info_record_cmd_enum_u8;
121 
122 typedef struct {
123     osal_timeval    fail_time;
124     osal_u16        fail_reason;
125     osal_u16        reserved;
126 } unconn_reason_item;
127 
128 typedef struct {
129     osal_u8             user_rd_ind;
130     osal_u8             user_rd_cnt;
131     osal_u8             rev[2];
132     unconn_reason_item  unconn_rd[MAX_CONN_INFO_RD_NUM];
133 } user_unconn_reason_rd;
134 
135 typedef struct {
136     osal_u32        stat[OAM_OTA_FRAME_DIRECTION_TYPE_BUTT][WLAN_MGMT_SUBTYPE_BUTT];
137 } user_statistic_rd;
138 
139 typedef struct {
140     struct osal_list_head user_list;
141     osal_u8         user_mac[WLAN_MAC_ADDR_LEN];
142     osal_u8         vap_id;
143     osal_u8         rev;
144     osal_u8         user_rd[0];
145 } user_conn_info_rd;
146 
147 typedef struct {
148     struct osal_list_head   user_head;
149     osal_void               *user_cache;
150     osal_u32                user_num;
151     osal_u32                type;
152     osal_mutex              lock;
153 } user_conn_info_head;
154 
155 typedef struct {
156     osal_u8 beacon_switch;
157     osal_u8 vip_frame_switch; /* 关键帧打印开关 */
158     osal_u8 scan_frame_switch;
159     osal_u8 reserved;
160 } special_frame_switch_stru;
161 
162 /*****************************************************************************
163   函数声明
164 *****************************************************************************/
165 #ifdef _PRE_WLAN_DFT_STAT
166 osal_void dfx_set_service_control(osal_u32 value);
167 osal_u32 dfx_get_service_control(osal_void);
168 #endif
169 
170 /*****************************************************************************
171   对外函数声明
172 *****************************************************************************/
173 typedef osal_void (*dfx_user_conn_abnormal_record_cb)(osal_u8 vap_id, osal_u8 *mac, osal_u16 reason, osal_u16 type);
174 typedef osal_void (*dfx_user_conn_statistic_record_cb)(osal_u8 vap_id, osal_u8 *mac, osal_u8 sub_type,
175     osal_u16 mode, osal_u8 direction);
176 typedef osal_void (*dfx_frame_report_hso_cb)(oal_netbuf_stru *netbuf, osal_u8 direction);
177 typedef osal_void (*dfx_user_rate_rx_info_record_cb)(osal_u8 id, dmac_rx_ctl_stru *cb_ctrl);
178 typedef osal_void (*dfx_scan_frame_report_hso_cb)(mac_bss_dscr_stru *bss_dscr);
179 
180 static osal_u32 hmac_dfx_init_weakref(osal_void) __attribute__ ((weakref("hmac_dfx_init"), used));
181 static osal_void hmac_dfx_deinit_weakref(osal_void) __attribute__ ((weakref("hmac_dfx_deinit"), used));
182 
183 #ifdef __cplusplus
184 #if __cplusplus
185 }
186 #endif
187 #endif
188 
189 #endif /* end of hmac_dfx.h */
190