• 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: hcc dfx completion.
15  * Author:
16  * Create: 2021-05-13
17  */
18 
19 #ifndef HCC_DFX_HEADER
20 #define HCC_DFX_HEADER
21 
22 #include "td_type.h"
23 #include "hcc_comm.h"
24 #include "hcc_cfg_comm.h"
25 #include "hcc_types.h"
26 #include "hcc_cfg_comm.h"
27 #include "soc_osal.h"
28 
29 typedef struct _hcc_service_stat_ {
30     /* 业务申请内存成功、失败的总次数, 业务内存只有RX方向需要hcc申请 */
31     td_u32 alloc_succ_cnt; /* 回调业务alloc返回成功次数 */
32     td_u32 alloc_cb_cnt;   /* 回调业务alloc次数 */
33     td_u32 alloc_fail_cnt; /* 申请内存失败的次数: 其中包含参数错误引起未调用回调场景 */
34 
35     /* 回调业务free的次数 */
36     td_u32 free_cnt;
37 
38 #ifdef CONFIG_HCC_SUPPORT_FLOW_CONTRL
39     /* 回调业务start_subq的次数 */
40     td_u32 start_subq_cnt;
41     /* 回调业务stop_subq的次数 */
42     td_u32 stop_subq_cnt;
43 #endif
44     /* 回调业务 rx_proc 统计 */
45     td_u32 rx_cnt; /* 调用次数 */
46     td_u32 exp_rx_cnt; /* 实际应调用次数 */
47 
48     td_u32 bus_tx_succ; /* 通道发送成功包数量 */
49 
50     td_u32 rx_err_cnt;
51 } hcc_service_stat;
52 
53 typedef struct _hcc_queue_stat_ {
54     /* 队列申请内存成功、失败次数 */
55     /* 释放次数无法记录,数据可能会不准确,暂不记录 */
56     td_u32 alloc_succ_cnt;
57     td_u32 alloc_fail_cnt;
58 
59     td_u32 total_pkts;  // 当前队列处理帧的数量,成功传递给对端 或 成功传递给业务的包数量
60     td_u32 loss_pkts; // 当前队列丢帧数量
61 } hcc_queue_stat;
62 
63 typedef struct _hcc_bus_stat_ {
64     td_u32 total_tx_pkts;  // 发送成功的数量
65     td_u32 loss_tx_pkts; // 发送丢帧数量
66 } hcc_bus_stat;
67 
68 typedef struct _hcc_inner_stat_ {
69     td_u32 unc_alloc_succ[HCC_DIR_COUNT];
70     td_u32 unc_alloc_fail[HCC_DIR_COUNT];
71     td_u32 unc_free_cnt;
72     td_u32 mem_free_cnt;
73     td_u32 srv_rx_cnt;
74     td_u16 tx_fail_exit_cnt;
75     td_u16 proc_packet_overnum_cnt;
76 } hcc_inner_stat;
77 
78 typedef struct _hcc_dfx_ {
79     osal_spinlock hcc_dfx_lock;
80 #ifdef CONFIG_HCC_SUPPORT_DFX_SRV
81     hcc_service_stat *service_stat;
82 #endif
83     hcc_queue_stat *queue_stat[HCC_DIR_COUNT];
84     hcc_inner_stat inner_stat;
85     td_u8 que_max_cnt;
86     td_u8 srv_max_cnt;
87     td_u16 rsv;
88 } hcc_dfx;
89 
90 td_void hcc_proc_overnum_inc(td_void *hcc);
91 td_void hcc_tx_fail_inc(td_void *hcc);
92 td_void hcc_dfx_queue_info_print(td_u8 chl, hcc_queue_dir dir, hcc_queue_type q_id);
93 td_void hcc_dfx_service_info_print(td_u8 chl, hcc_service_type service_type);
94 td_void hcc_bus_dfx_statics_print(td_u8 chl);
95 #endif /* HCC_DFX_HEADER */
96