• 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: OAM struct define
15  */
16 
17 #ifndef __OAM_STRUCT_H__
18 #define __OAM_STRUCT_H__
19 
20 #include "wlan_types_common.h"
21 #include "wlan_spec.h"
22 #include "common_dft.h"
23 
24 /* 统计相关宏 */
25 #define OAM_MAC_ERROR_TYPE_CNT 25
26 #define OAM_RX_DSCR_QUEUE_CNT 2
27 #define OAM_IRQ_FREQ_STAT_MEMORY 50
28 
29 #define OAM_TID_TRACK_NUM 4
30 
31 /* 每一个事件队列中事件个数最大值 */
32 #define OAM_MAX_EVENT_NUM_IN_EVENT_QUEUE 8
33 
34 /* 日志结构体相关宏,用于oam_log_info_stru */
35 #define OAM_FUNC_NAME_MAX_LEN 48         /* 函数名的最大长度 */
36 #define OAM_LOG_INFO_MAX_LEN 100         /* 日志信息最大长度 */
37 #define OAM_LOG_INFO_IN_MEM_MAX_NUM 5000 /* oam模块最多保存5000条log信息,超过以后从头自动覆盖 */
38 
39 /* 消息上报给SDT封装的结构体 */
40 /* EVENT消息体最大长度 */
41 #define OAM_EVENT_INFO_MAX_LEN 48
42 
43 /* VAP级别统计信息结构 */
44 typedef struct {
45     /* **************************************************************************
46                                 接收包统计
47     ************************************************************************** */
48 
49     /* 发往lan的数据包统计 */
50     osal_u32 rx_pkt_to_lan;   /* 接收流程发往以太网的数据包数目,MSDU */
51     osal_u32 rx_bytes_to_lan; /* 接收流程发往以太网的字节数 */
52 
53     /* MPDU级别进行处理时发生错误释放MPDU个数统计 */
54     osal_u32 rx_da_check_dropped;        /* 检查目的端地址异常,释放一个MPDU */
55     osal_u32 rx_no_buff_dropped;              /* 组播帧或者wlan_to_wlan流程申请buff失败 */
56     osal_u32 rx_defrag_process_dropped;       /* 去分片处理失败 */
57 
58     /* 接收到组播帧个数 */
59     osal_u32 rx_mcast_cnt;
60 
61     /* **************************************************************************
62                                 发送包统计
63     ************************************************************************** */
64 
65     /* 从lan接收到的数据包统计 */
66     osal_u32 tx_pkt_num_from_lan; /* 从lan过来的包数目,MSDU */
67     osal_u32 tx_bytes_from_lan;   /* 从lan过来的字节数 */
68 
69     /* 发送流程发生异常导致释放的数据包统计,MSDU级别 */
70     osal_u32 tx_abnormal_msdu_dropped; /* 异常情况释放MSDU个数,指vap或者user为空等异常 */
71     osal_u32 tx_security_check_faild;  /* 安全检查失败释放MSDU */
72 
73     /* 组播转单播发送流程统计 */
74     osal_u32 tx_m2u_mcast_cnt;    /* 组播转单播 组播发送成功个数 */
75 } oam_vap_stat_info_stru;
76 
77 #if defined(_PRE_OS_VERSION_LINUX) && defined(_PRE_OS_VERSION) && (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION)
78 /* USER级别统计信息结构 */
79 typedef struct {
80     /* 接收包统计,从某个用户处接收到的包统计(TO DS) */
81     osal_u32 rx_mpdu_num;   /* 从某个用户接收到的MPDU数目 */
82     osal_u32 rx_mpdu_bytes; /* 某个用户接收到的MPDU字节数 */
83 
84     /* 发送包统计,发送给某个用户的包统计(FROM DS),粒度是TID(具体到从VAP的某个TID发出) */
85     osal_u32 tx_mpdu_succ_num[WLAN_TIDNO_BUTT];      /* 发送MPDU总个数 */
86     osal_u32 tx_mpdu_bytes[WLAN_TIDNO_BUTT];         /* 发送MPDU总字节数 */
87     osal_u32 tx_mpdu_fail_num[WLAN_TIDNO_BUTT];      /* 发送MPDU失败个数 */
88     osal_u32 tx_ampdu_bytes[WLAN_TIDNO_BUTT];        /* 发送AMPDU总字节数 */
89     osal_u32 tx_mpdu_in_ampdu[WLAN_TIDNO_BUTT];      /* 属于AMPDU的MPDU发送总个数 */
90     osal_u32 tx_mpdu_fail_in_ampdu[WLAN_TIDNO_BUTT]; /* 属于AMPDU的MPDU发送失败个数 */
91     osal_u32 tx_ppdu_retries;                         /* 空口重传的PPDU计数 */
92 } oam_user_stat_info_stru;
93 
94 /* 统计结构信息,包括设备级别,vap级别,user级别的各种统计信息 */
95 typedef struct {
96     /* VAP级别的统计信息 */
97     oam_vap_stat_info_stru vap_stat_info[WLAN_VAP_SUPPORT_MAX_NUM_LIMIT];
98 
99     /* USER级别的统计信息 */
100     oam_user_stat_info_stru user_stat_info[WLAN_USER_MAX_USER_LIMIT];
101 } oam_stat_info_stru;
102 #else
103 /* 统计结构信息,包括vap级别的统计信息 */
104 typedef struct {
105     /* VAP级别的统计信息 */
106     oam_vap_stat_info_stru vap_stat_info[WLAN_VAP_SUPPORT_MAX_NUM_LIMIT];
107 } oam_stat_info_stru;
108 #endif
109 
110 #define OAM_STAT_VAP_INCR(_uc_vap_id, _member, _num) do { \
111             if ((_uc_vap_id) < WLAN_VAP_SUPPORT_MAX_NUM_LIMIT)          \
112             {                                                   \
113                 g_st_stat_info_etc.vap_stat_info[_uc_vap_id]._member += (_num);   \
114             }                                                                               \
115         } while (0)
116 
117 #define OAM_STAT_GET_STAT_ALL() (&g_st_stat_info_etc)
118 
119 extern oam_stat_info_stru g_st_stat_info_etc;
120 #define OAM_IO_PRINTK(fmt, ...)
121 
122 /* 字符串以0结尾上报,实际字符串内容最大长度 */
123 #define WLAN_SDT_NETBUF_MAX_PAYLOAD         1600
124 #define OAM_REPORT_MAX_STRING_LEN (WLAN_SDT_NETBUF_MAX_PAYLOAD - 1) /* 以\0结束 */
125 
126 #endif
127