WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
alg_aggr_rom.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2020-2022. All rights reserved.
3 * Description: auto-aggr algorithm rom.
4 */
5
6#ifndef ALG_AGGR_ROM_H
7#define ALG_AGGR_ROM_H
8
9#ifdef _PRE_WLAN_FEATURE_AUTOAGGR
10
11/******************************************************************************
12 1 其他头文件包含
13******************************************************************************/
14#include "hal_device_rom.h"
15#include "dmac_ext_if_rom.h"
16#include "frw_msg_rom.h"
17#include "dmac_alg_if_part_rom.h"
18#include "alg_common_rom.h"
20
21#ifdef __cplusplus
22#if __cplusplus
23extern "C" {
24#endif
25#endif
26
27/******************************************************************************
28 2 宏定义
29******************************************************************************/
30#define ALG_AGGR_4MS_TO_250US_SHIFT 4 /* 基准聚合时间4ms相对于最小聚合时间250us的移位值(2^n) */
31#define ALG_AGGR_SHORT_STAT_SHIFT 3 /* 默认短期统计的除2位移值 */
32#define ALG_AGGR_LONG_STAT_SHIFT 4 /* 默认长期统计的除2位移值 */
33
34#define alg_aggr_stat_smooth_short_per(_avg_per, _instant_per, _scale) \
35 ((((osal_u16)((_avg_per) * ((1ul << (ALG_AGGR_SHORT_STAT_SHIFT + (_scale))) - 1))) >> \
36 (ALG_AGGR_SHORT_STAT_SHIFT + (_scale))) + ((_instant_per) >> (ALG_AGGR_SHORT_STAT_SHIFT + (_scale))))
37
38#define alg_aggr_stat_smooth_long_per(_avg_per, _instant_per, _scale) \
39 ((((osal_u16)((_avg_per) * ((1ul << (ALG_AGGR_LONG_STAT_SHIFT + (_scale))) - 1)))>> \
40 (ALG_AGGR_LONG_STAT_SHIFT + (_scale))) + ((_instant_per) >> (ALG_AGGR_LONG_STAT_SHIFT + (_scale))))
41
42/*
43 通过当前最优速率获取4ms对应的字节数限制:
44 其中aggr_bytes_limit_4ms = (best_rate_kbps * 4ms) / 8bits = best_rate_kbps * 1/2
45*/
46#define alg_aggr_get_best_rate_bytes_limit_4ms(best_rate_kbps) ((best_rate_kbps) >> 1)
47
48#define alg_aggr_param_offset(_elem) (alg_stru_elem_offset(alg_aggr_stru, _elem))
49#define alg_aggr_calc_cfg_id_offest(alg_cfg_id) ((alg_cfg_id) - MAC_ALG_CFG_AGGR_START)
50/******************************************************************************
51 3 枚举定义
52******************************************************************************/
53typedef enum {
54 ALG_AGGR_AUTO_MODE = 0, /* 使用auto模式获取聚合时间 */
55 ALG_AGGR_FIXED_MODE = 1, /* 使用fixed模式配置聚合时间 */
56 ALG_AGGR_MODE_BUTT
57} alg_aggr_mode_enum;
58
59typedef enum {
60 ALG_AGGR_MIN_AGGR_TIME_IDX = 0, /* 聚合自适应最小聚合时间索引 */
61 ALG_AGGR_500US_TIME_IDX = 1, /* 500us对应的聚合传输时间索引 */
62 ALG_AGGR_1MS_TIME_IDX = 2, /* 1ms对应的聚合传输时间索引 */
63 ALG_AGGR_2MS_TIME_IDX = 3, /* 2ms对应的聚合传输时间索引 */
64 ALG_AGGR_4MS_TIME_IDX = 4, /* 4ms对应的聚合传输时间索引 */
65 ALG_AGGR_MAX_AGGR_TIME_IDX = 5, /* 聚合自适应最大聚合时间索引 */
66 ALG_AGGR_TIME_IDX_BUTT
67} alg_aggr_time_index_enum;
68typedef osal_u8 alg_aggr_time_idx_enum_uint8;
69
70/* 算法内部模块使用 */
71extern const osal_u16 g_aggr_time_list[ALG_AGGR_TIME_LIST_NUM];
72extern const osal_u16 g_aggr_scale_list[ALG_AGGR_TIME_LIST_NUM];
73
74/******************************************************************************
75 4 STRUCT定义
76******************************************************************************/
77/* 聚合自适应算法结构体 */
78typedef struct {
79 osal_bool enable; /* 是否使能聚合自适应算法 */
80 osal_bool dbg_aggr_log; /* 使能聚合优化日志 */
81 osal_bool serial_aggr_log; /* 使能聚合优化测试用串口日志 */
82 osal_bool voice_aggr; /* Voice是否支持聚合的标志 */
83
84 /* 聚合优化相关 */
85 osal_u8 aggr_mode; /* 当前聚合自适应的模式(FIXED, AUTO) */
86 osal_u8 fixed_aggr_time_idx; /* 固定档位聚合时间对应的g_aaggr_time_list数组下标 */
87 osal_u8 intf_adjch_status; /* 邻频干扰状态 */
88 osal_u8 aggr_stat_num; /* 聚合时间探测的统计delta PER的包数目 */
89
90 osal_u8 aggr_stat_shift; /* 聚合时间探测的统计delta PER的包数目除2位移值 */
91 osal_u8 max_aggr_num; /* 规格限定最大聚合个数 */
92 osal_u8 max_aggr_time_idx; /* 约束的最大聚合时间对应的g_aggr_time_list数组下标 */
93 osal_u8 min_aggr_time_idx; /* 最小聚合传输时间索引 */
94
95 alg_param_sync_aggr_stru *host_param_sync; /* 从host侧同步的算法阈值参数结构体 */
96
97 osal_u8 *rom;
98} alg_aggr_stru;
99
100/* 聚合优化相关信息 */
101typedef struct {
102 osal_u32 normal_aggr_mpdu_bytes; /* 正常聚合时间对应的聚合MPDU的最大byptes */
103 osal_u8 normal_max_aggr_num; /* 默认聚合时间下最大聚合字节数对应的聚合数目 */
104 osal_u8 aggr_probe_state : 3; /* 聚合探测状态类型alg_aggr_probe_state_enum_uint8 */
105 osal_u8 aggr_probe_direct : 2; /* 聚合探测方向,类型alg_aggr_probe_direct_enum_uint8 */
106 osal_u8 aggr_time_idx : 3; /* 当前最优聚合传输时间数组索引,类型alg_aggr_time_idx_enum_uint8 */
107 osal_u16 aggr_time_us; /* 当前最优聚合传输时间(单位:us) */
108
109 osal_u8 aggr_probe_intvl_cnt; /* 聚合时间尝试对应的包间隔计数 */
110 osal_u8 aggr_up_stat_cnt; /* 向上探测聚合时间传输的统计次数 */
111 osal_u8 aggr_down_stat_cnt; /* 向下探测聚合时间传输的统计次数 */
112 osal_u8 probe_pktno_wait_cnt; /* 探测报文已发送但暂未收到完成中断的等待次数 */
113
114 osal_u16 aggr_probe_pktno : 12; /* 聚合探测报文的编号 */
115 osal_u16 cur_aggr_idx : 4; /* 当前使用的聚合时间索引,正常是最优聚合传输时间数组索引,探测时取探测聚合时间索引 */
116 osal_u16 probe_aggr_idx : 4; /* 探测聚合时间索引类型alg_aggr_time_idx_enum_uint8 */
117 osal_u16 resv : 12;
118
119 // : per的维护考虑增加老化机制,参考autorate
120 osal_u16 short_per[ALG_AGGR_TIME_LIST_NUM]; /* 最优速率短期平均的PER(扩大1024倍) */
121 osal_u16 long_per[ALG_AGGR_TIME_LIST_NUM]; /* 最优速率长期平均的PER(扩大1024倍) */
122 osal_u32 aggr_last_used_time_ms[ALG_AGGR_TIME_LIST_NUM]; /* 各聚合时间档位最后的使用的时间 */
123
124 osal_s32 aggr_up_delta_per; /* 向上聚合探测的PER变化量 = aggr_up_per - aggr_normal_per (扩大2^20) */
125 osal_s32 aggr_down_delta_per; /* 向下聚合探测的PER变化量 = aggr_normal_per - aggr_down_per (扩大2^20) */
126
127 osal_u32 up_aggr_mpdu_bytes; /* 向上聚合探测对应的聚合MPDU的最大byptes */
128
129 osal_u8 *rom;
130} alg_aggr_user_info_stru;
131
132/* 设置配置参数的回调函数指针 */
133typedef osal_void (*aggr_config_param_handle_func)(osal_void);
134
135/* 算法参数配置表结构 */
136typedef struct {
137 osal_u8 cfg_id_offest;
139 osal_u16 param_offset;
140 aggr_config_param_handle_func cfg_param_handle;
141} alg_aggr_cfg_param_table_stru;
142
143/******************************************************************************
144 5 函数声明
145******************************************************************************/
146osal_s32 alg_aggr_init(osal_void);
147osal_void alg_aggr_exit(osal_void);
148osal_void alg_aggr_init_user_info(alg_aggr_user_info_stru *aggr_info, osal_u8 aggr_time_idx, dmac_user_stru *dmac_user);
149alg_aggr_stru *alg_aggr_get_dev_info(osal_void);
150osal_void alg_aggr_update_max_mpdu_bytes(alg_aggr_user_info_stru *aggr_info, hal_tx_dscr_ctrl_one_param *tx_dscr);
151osal_u16 alg_aggr_get_instant_per(hal_tx_dscr_ctrl_one_param *tx_dscr);
152osal_u32 alg_aggr_config_param(const dmac_vap_stru *dmac_vap, const dmac_ioctl_alg_param_stru *alg_param);
153#ifdef _PRE_WLAN_TPC_DO_PROBE
154osal_bool alg_aggr_get_voice_switch(osal_void);
155#endif
156osal_void alg_aggr_config_stat_num(osal_void);
157osal_u32 alg_aggr_param_sync(const alg_param_sync_stru *sync);
158osal_u32 alg_aggr_probe_deadlock(dmac_user_stru *dmac_user, osal_u8 lock_type);
159
160typedef osal_u32 (*alg_aggr_init_cb)(osal_void);
161typedef osal_u32 (*alg_aggr_exit_cb)(osal_void);
162typedef osal_u32 (*alg_aggr_set_cfg_cb)(const dmac_ioctl_alg_param_stru *alg_param, osal_u32 *ret);
163typedef osal_u32 (*alg_aggr_init_user_info_cb)(alg_aggr_user_info_stru *aggr_info, osal_u8 aggr_time_idx,
164 dmac_user_stru *dmac_user);
165typedef osal_u32 (*alg_aggr_normal_proc_cb)(dmac_user_stru *dmac_user, alg_aggr_user_info_stru *aggr_info,
167typedef osal_u32 (*alg_aggr_set_sch_aggr_cb)(dmac_user_stru *dmac_user, osal_u8 aggr_time_idx, osal_u8 tid_id,
168 osal_u32 *ret);
169typedef osal_u32 (*alg_aggr_tx_comp_cb)(dmac_user_stru *dmac_user, oal_dmac_netbuf_stru *buf,
170 hal_tx_dscr_ctrl_one_param *tx_dscr, osal_u32 *ret);
171typedef osal_u32 (*alg_aggr_brate_update_cb)(dmac_user_stru *dmac_user, osal_u32 rate_kbps,
172 alg_autorate_rate_detail_stru *rate_detail, osal_u32 *ret);
173typedef osal_u32 (*alg_aggr_tx_payload_len_chk_cb)(dmac_user_stru *user, hal_tx_txop_alg_stru *txop_param,
174 osal_u32 payload_len, osal_u8 ampdu_enable, osal_u32 *ret);
175typedef osal_u32 (*alg_aggr_adjintf_notify_cb)(hal_to_dmac_device_stru *hal_device,
176 alg_intf_det_notify_info_stru *intf_det_notify, osal_u32 *ret);
177
178#ifdef __cplusplus
179#if __cplusplus
180}
181#endif
182#endif
183#endif /* #ifdef _PRE_WLAN_FEATURE_AUTOAGGR */
184#endif /* end of alg_aggr_rom.h */
osal_u8 alg_cfg_param_type_enum_uint8
Definition alg_common_macros_rom.h:489
#define ALG_AGGR_TIME_LIST_NUM
Definition alg_common_macros_rom.h:41
int osal_s32
Definition osal_types.h:19
unsigned char osal_u8
Definition osal_types.h:11
osal_u8 osal_bool
Definition osal_types.h:27
void osal_void
Definition osal_types.h:29
unsigned int osal_u32
Definition osal_types.h:13
unsigned short osal_u16
Definition osal_types.h:12
Definition alg_common_rom.h:77
Definition alg_common_rom.h:376
Definition alg_common_rom.h:411
Definition dmac_ext_if_rom.h:106
Definition hal_common_ops_rom.h:56
Definition hal_ops_common_rom.h:240
Definition dmac_ext_if_device_rom.h:98
Definition oal_net_pkt_rom.h:83
Definition hal_ops_common_rom.h:529