xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/ssv6xxx/smac/ssv_rc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (c) 2015 South Silicon Valley Microelectronics Inc.
3  * Copyright (c) 2015 iComm Corporation
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * See the GNU General Public License for more details.
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef _SSV_RC_H_
18 #define _SSV_RC_H_
19 #include "ssv_rc_common.h"
20 #define RC_PID_REPORT_INTERVAL 40
21 #define RC_PID_INTERVAL 125
22 #define RC_PID_DO_ARITH_RIGHT_SHIFT(x,y) \
23  ((x) < 0 ? -((-(x)) >> (y)) : (x) >> (y))
24 #define RC_PID_NORM_OFFSET 3
25 #define RC_PID_SMOOTHING_SHIFT 1
26 #define RC_PID_SMOOTHING (1 << RC_PID_SMOOTHING_SHIFT)
27 #define RC_PID_COEFF_P 15
28 #define RC_PID_COEFF_I 15
29 #define RC_PID_COEFF_D 5
30 #define MAXPROBES 3
31 #define SSV_DRATE_IDX (2)
32 #define SSV_CRATE_IDX (3)
33 struct ssv_softc;
34 struct ssv_rc_rate *ssv6xxx_rc_get_rate(int rc_index);
35 void ssv6xxx_rc_hw_rate_idx(struct ssv_softc *sc,
36             struct ieee80211_tx_info *info, struct ssv_rate_info *sr);
37 #ifdef RATE_CONTROL_REALTIME_UPDATA
38 u8 ssv6xxx_rc_hw_rate_update_check(struct sk_buff *skb, struct ssv_softc *sc, u32 do_rts_cts);
39 #endif
40 void ssv6xxx_rc_mac8011_rate_idx(struct ssv_softc *sc, int hw_rate_idx,
41                 struct ieee80211_rx_status *rxs);
42 void ssv6xxx_rc_hw_reset(struct ssv_softc *sc, int rc_idx, int hwidx);
43 void ssv6xxx_rc_update_basic_rate(struct ssv_softc *sc, u32 basic_rates);
44 int ssv6xxx_rate_control_register(void);
45 void ssv6xxx_rate_control_unregister(void);
46 void ssv6xxx_rc_rx_data_handler(struct ieee80211_hw *hw, struct sk_buff *skb, u32 rate_index);
47 int pide_frame_duration(size_t len, int rate, int short_preamble, int flags);
48 #endif
49