WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
wlan_thruput_debug.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2020-2021. All rights reserved.
3 * Description: wlan through put debug.
4 */
5
6#ifndef WLAN_THRUPUT_DEBUG_H
7#define WLAN_THRUPUT_DEBUG_H
8
9#include "oal_skbuff.h"
10
11enum {
31};
32
33enum {
41};
42#define param_unref(P) ((P) = (P))
43
44#ifdef TIMESTAMP_RECORD_DEBUG
45#if (_PRE_OS_VERSION_LINUX != _PRE_OS_VERSION)
46#include "reg_table.h"
47
48#define STAT_TIMER_32M_TICK_REG (TIMER2_REG_BASE + 4) /* 32M时钟定时器用于统计tick的寄存器 */
49#define STAT_TIMER_32M_CTRL_REG (TIMER2_REG_BASE + 8) /* 32M时钟定时器控制寄存器 */
50#define STAT_TIMER_CTRL_EN 0xc0 /* 32M时钟定时器控制寄存器使能配置位 */
51#endif
52
53#define STAT_TIME_REG_MAX (0xFFFFFFFF - 1) /* 32位统计寄存器最大长度 */
54#define stat_time_revert(start, end) (((STAT_TIME_REG_MAX) - (start)) + (end)) /* 时间反转计算 */
55#define stat_get_runtime(start, end) \
56 ((((start) > (end)) ? (stat_time_revert((start), (end))) : ((end) - (start))) / 32)
57
58#define STAT_CNT_TIME 5000000
59
60static inline osal_u32 stat_get_timer_tick(osal_void)
61{
62#if (_PRE_OS_VERSION_LINUX != _PRE_OS_VERSION)
63 return uapi_reg_read_val32(STAT_TIMER_32M_TICK_REG);
64#else
65 return 0;
66#endif
67}
68static inline osal_void stat_timer_enable(osal_void)
69{
70#if (_PRE_OS_VERSION_LINUX != _PRE_OS_VERSION)
71 uapi_reg_write(STAT_TIMER_32M_CTRL_REG, STAT_TIMER_CTRL_EN);
72#endif
73}
74
75static inline osal_void stat_record_timestamp(oal_netbuf_stru *netbuf, osal_u32 index)
76{
77#if (_PRE_OS_VERSION_LINUX != _PRE_OS_VERSION)
78 if (index == 0) {
79 netbuf->resv = 0x5; /* record flag */
80 }
81 netbuf->times[index] = stat_get_timer_tick();
82#else
83 param_unref(netbuf);
84 param_unref(index);
85#endif
86}
87
88static inline osal_void stat_record_tx_timestamp(oal_netbuf_stru *netbuf, osal_u32 index)
89{
90#if (_PRE_OS_VERSION_LINUX != _PRE_OS_VERSION) && defined(TIME_STAMP_TX_DEBUG)
91 stat_record_timestamp(netbuf, index);
92#else
93 param_unref(netbuf);
94 param_unref(index);
95#endif
96}
97
98static inline osal_void stat_record_rx_timestamp(oal_netbuf_stru *netbuf, osal_u32 index)
99{
100#if (_PRE_OS_VERSION_LINUX != _PRE_OS_VERSION) && defined(TIME_STAMP_RX_DEBUG)
101 stat_record_timestamp(netbuf, index);
102#else
103 param_unref(netbuf);
104 param_unref(index);
105#endif
106}
107
108static inline osal_void host_print_timestamp(oal_netbuf_stru *netbuf)
109{
110#if (_PRE_OS_VERSION_LINUX != _PRE_OS_VERSION)
111 osal_u32 curr_time = stat_get_timer_tick();
112
113 if (netbuf->resv == 0x5) { /* flag */
114 wifi_printf("%u-%u-%u-%u %u-%u-%u-%u %u-%u-%u-%u %u-%u-%u-%u %u-%u-%u-TL:%u\r\n",
115 stat_get_runtime(netbuf->times[STAT_T1], netbuf->times[STAT_T0]),
116 stat_get_runtime(netbuf->times[STAT_T2], netbuf->times[STAT_T1]),
117 stat_get_runtime(netbuf->times[STAT_T3], netbuf->times[STAT_T2]),
118 stat_get_runtime(netbuf->times[STAT_T4], netbuf->times[STAT_T3]),
119 stat_get_runtime(netbuf->times[STAT_T5], netbuf->times[STAT_T4]),
120 stat_get_runtime(netbuf->times[STAT_T6], netbuf->times[STAT_T5]),
121 stat_get_runtime(netbuf->times[STAT_T7], netbuf->times[STAT_T6]),
122 stat_get_runtime(netbuf->times[STAT_T8], netbuf->times[STAT_T7]),
123 stat_get_runtime(netbuf->times[STAT_T9], netbuf->times[STAT_T8]),
124 stat_get_runtime(netbuf->times[STAT_T10], netbuf->times[STAT_T9]),
125 stat_get_runtime(netbuf->times[STAT_T11], netbuf->times[STAT_T10]),
126 stat_get_runtime(netbuf->times[STAT_T12], netbuf->times[STAT_T11]),
127 stat_get_runtime(netbuf->times[STAT_T13], netbuf->times[STAT_T12]),
128 stat_get_runtime(netbuf->times[STAT_T14], netbuf->times[STAT_T13]),
129 stat_get_runtime(netbuf->times[STAT_T15], netbuf->times[STAT_T14]),
130 stat_get_runtime(netbuf->times[STAT_T16], netbuf->times[STAT_T15]),
131 stat_get_runtime(netbuf->times[STAT_T17], netbuf->times[STAT_T16]),
132 stat_get_runtime(netbuf->times[STAT_T18], netbuf->times[STAT_T17]),
133 stat_get_runtime(curr_time, netbuf->times[STAT_T18]),
134 stat_get_runtime(curr_time, netbuf->times[STAT_T0]));
135 }
136
137 netbuf->resv = 0;
138#else
139 param_unref(netbuf);
140#endif
141}
142
143static inline osal_void host_print_rx_timestamp(oal_netbuf_stru *netbuf)
144{
145#ifdef TIME_STAMP_RX_DEBUG
146 host_print_timestamp(netbuf);
147#else
148 param_unref(netbuf);
149#endif
150}
151
152static inline osal_void host_print_tx_timestamp(oal_netbuf_stru *netbuf)
153{
154#ifdef TIME_STAMP_TX_DEBUG
155#if (_PRE_OS_VERSION_LINUX != _PRE_OS_VERSION)
156 static osal_u32 host_tx_cnt = 0;
157 static osal_u64 host_tx_time = 0;
158 osal_u64 curr_time = uapi_get_time_us();
159#endif
160 host_print_timestamp(netbuf);
161
162#if (_PRE_OS_VERSION_LINUX != _PRE_OS_VERSION)
163 host_tx_cnt++;
164 if (curr_time - host_tx_time > STAT_CNT_TIME) {
165 osal_printk("host txcnt:%u\r\n", host_tx_cnt);
166 host_tx_time = curr_time;
167 }
168#endif
169#else
170 param_unref(netbuf);
171#endif
172}
173#else
174static inline osal_void stat_timer_enable(osal_void) {}
175static inline osal_void stat_record_tx_timestamp(oal_netbuf_stru *netbuf, osal_u32 index)
176{
177 param_unref(netbuf);
178 param_unref(index);
179}
180static inline osal_void stat_record_rx_timestamp(oal_netbuf_stru *netbuf, osal_u32 index)
181{
182 param_unref(netbuf);
183 param_unref(index);
184}
185static inline osal_void host_print_rx_timestamp(oal_netbuf_stru *netbuf)
186{
187 param_unref(netbuf);
188}
189static inline osal_void host_print_tx_timestamp(oal_netbuf_stru *netbuf)
190{
191 param_unref(netbuf);
192}
193#endif
194#endif
#define uapi_reg_read_val32(addr)
Definition common_def.h:96
#define uapi_reg_write(addr, val)
Definition common_def.h:92
void osal_printk(const char *fmt,...)
Log printing function.
Definition osal_debug.c:28
#define wifi_printf(fmt, arg...)
Definition oal_util_hcm.h:44
unsigned long long osal_u64
Definition osal_types.h:14
void osal_void
Definition osal_types.h:29
unsigned int osal_u32
Definition osal_types.h:13
Definition oal_skbuff.h:82
td_u8 resv
Definition oal_skbuff.h:112
#define param_unref(P)
Definition wlan_thruput_debug.h:42
@ DEV_STAT_T3
Definition wlan_thruput_debug.h:37
@ DEV_STAT_T5
Definition wlan_thruput_debug.h:39
@ DEV_STAT_T2
Definition wlan_thruput_debug.h:36
@ DEV_STAT_T6
Definition wlan_thruput_debug.h:40
@ DEV_STAT_T1
Definition wlan_thruput_debug.h:35
@ DEV_STAT_T0
Definition wlan_thruput_debug.h:34
@ DEV_STAT_T4
Definition wlan_thruput_debug.h:38
@ STAT_T5
Definition wlan_thruput_debug.h:17
@ STAT_T15
Definition wlan_thruput_debug.h:27
@ STAT_T10
Definition wlan_thruput_debug.h:22
@ STAT_T12
Definition wlan_thruput_debug.h:24
@ STAT_T9
Definition wlan_thruput_debug.h:21
@ STAT_T13
Definition wlan_thruput_debug.h:25
@ STAT_T2
Definition wlan_thruput_debug.h:14
@ STAT_T6
Definition wlan_thruput_debug.h:18
@ STAT_T11
Definition wlan_thruput_debug.h:23
@ STAT_T4
Definition wlan_thruput_debug.h:16
@ STAT_T0
Definition wlan_thruput_debug.h:12
@ STAT_T16
Definition wlan_thruput_debug.h:28
@ STAT_T18
Definition wlan_thruput_debug.h:30
@ STAT_T1
Definition wlan_thruput_debug.h:13
@ STAT_T3
Definition wlan_thruput_debug.h:15
@ STAT_T17
Definition wlan_thruput_debug.h:29
@ STAT_T8
Definition wlan_thruput_debug.h:20
@ STAT_T14
Definition wlan_thruput_debug.h:26
@ STAT_T7
Definition wlan_thruput_debug.h:19