148 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			148 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| /****************************************************************************
 | |
| 
 | |
| Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
 | |
| 
 | |
| This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
 | |
| be copied by any method or incorporated into another program without
 | |
| the express written consent of Aerospace C.Power. This Information or any portion
 | |
| thereof remains the property of Aerospace C.Power. The Information contained herein
 | |
| is believed to be accurate and Aerospace C.Power assumes no responsibility or
 | |
| liability for its use in any way and conveys no license or title under
 | |
| any patent or copyright and makes no representation or warranty that this
 | |
| Information is free from patent or copyright infringement.
 | |
| 
 | |
| ****************************************************************************/
 | |
| 
 | |
| #ifndef RATE_CONTROL_H
 | |
| #define RATE_CONTROL_H
 | |
| #include "os_types.h"
 | |
| #include "mac_pdev.h"
 | |
| #include "mac_vdev.h"
 | |
| #include "mac_peer.h"
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| /* max time for per msdu send */
 | |
| #if SUPPORT_SOUTHERN_POWER_GRID
 | |
| #define RA_MAX_WAR_MSDU_SEND_FL_MS          50
 | |
| #define RA_MAX_MSDU_SEND_FL_MS              50
 | |
| #else //SUPPORT_SOUTHERN_POWER_GRID
 | |
| #define RA_MAX_WAR_MSDU_SEND_FL_MS          30
 | |
| #define RA_MAX_MSDU_SEND_FL_MS              30
 | |
| #endif
 | |
| 
 | |
| #define RA_CON_NOSACK_PENALTY_CNT_THRE      5
 | |
| #define RA_CON_NOSACK_PENALTY_SNR_STEP      6
 | |
| 
 | |
| #define RA_CON_SACKERR_PENALTY_CNT_THRE     2
 | |
| #define RA_CON_SACKERR_PENALTY_SNR_STEP     6
 | |
| 
 | |
| #define RA_LOW_THRE_SNR_VAL                 -15
 | |
| 
 | |
| typedef struct _rate_control_ctxt {
 | |
|     void *dummy;
 | |
| } rate_control_ctxt_t;
 | |
| 
 | |
| void ra_add_no_sack_cnt(rate_info_t *ra);
 | |
| 
 | |
| void ra_clr_no_sack_cnt(rate_info_t *ra);
 | |
| 
 | |
| void ra_inc_con_sack_err_cnt(rate_info_t *ra);
 | |
| 
 | |
| void ra_clr_con_sack_err_cnt(rate_info_t *ra);
 | |
| 
 | |
| /**
 | |
| *@brief init ra ctxt and install callback
 | |
| *
 | |
| *@param vdev [vdev structure based for rate get]
 | |
| *@param ena_ra [1 - enable: 0 - disable]
 | |
| *@return [0 for success, other for error]
 | |
| */
 | |
| uint32_t ra_init(mac_vdev_t * vdev, uint32_t ena_ra);
 | |
| 
 | |
| /* rate_idx - get rate_idx of tmi or ex_tmi
 | |
| * pb_num_in_mpdu - get pb_num in this mpdu
 | |
| */
 | |
| uint32_t mac_data_get_rate(mac_vdev_t *vdev, mac_peer_t *peer, \
 | |
|     uint32_t proto, uint8_t is_fixed_rate, uint32_t msdu_len, \
 | |
|     uint32_t single_proto_band, uint32_t is_fixed_pbsz, \
 | |
|     uint8_t *rate_idx, \
 | |
|     uint32_t *pb_num_in_each_mpdu, \
 | |
|     uint32_t *mpdu_num_to_send, uint32_t *rate_mode, uint8_t retry_cnt);
 | |
| 
 | |
| /* get rate_idx for vdev
 | |
| return 0 for success
 | |
| */
 | |
| uint32_t mac_bcn_get_rate(mac_vdev_t *vdev, \
 | |
|     uint32_t proto, uint8_t is_fixed_rate, \
 | |
|     uint32_t bcn_len, uint32_t band_id, \
 | |
|     uint8_t *rate_idx, uint32_t *rate_mode);
 | |
| 
 | |
| /**
 | |
| *@brief get bcast rate for sof pkts, no matter dtei
 | |
| * equals 0xfff or not
 | |
| *
 | |
| *@param vdev [vdev structure based for rate get]
 | |
| *@param proto [plc protocol]
 | |
| *@param is_fixed_rate [if fixed rate should be used]
 | |
| *@param pkt_len [pkt len constrain for this rate query]
 | |
| *@param retry_cnt [bcast retry cnt]
 | |
| *@param rate_idx [returned rate index]
 | |
| *@param rate_mode [returned rate mode:SR/QR/XR]
 | |
| *@param pb_num_in_each_mpdu [return pb num in each mpdu]
 | |
| *@param mpdu_num_to_send [return mpdu num to send]
 | |
| *@param is_dbg_pkt [is dbg pkt]
 | |
| *@param is_retry [is retry]
 | |
| *@param rd_retry_cnt [total retry cnt]
 | |
| *@exception [none]
 | |
| *@return [0 for success, other for error]
 | |
| */
 | |
| uint32_t mac_data_get_bcast_rate(mac_vdev_t *vdev,
 | |
|     uint32_t proto, uint8_t is_fixed_rate,
 | |
|     uint32_t pkt_len, uint32_t single_proto_band, uint32_t retry_cnt,
 | |
|     uint8_t *rate_idx, uint32_t *rate_mode ,
 | |
|     uint32_t *pb_num_in_each_mpdu, uint32_t *mpdu_num_to_send,
 | |
|     uint32_t is_dbg_pkt, uint32_t is_retry, uint8_t rd_retry_cnt);
 | |
| 
 | |
| /**
 | |
| *@brief mac_rate_ctxt_init
 | |
| *       init peer's rate context
 | |
| *
 | |
| *@param peer [mac peer]
 | |
| *@exception [none]
 | |
| *@return [0 for success, other for error]
 | |
| */
 | |
| uint32_t mac_rate_ctxt_init(mac_peer_t *peer);
 | |
| 
 | |
| /**
 | |
|  *@brief mac_get_tx_retry_cnt_by_band   get this packet tx retry count
 | |
|  *
 | |
|  *@param vdev                           vdev
 | |
|  *@param proto_band                     current phy protocol band id
 | |
|  *@param tx_cnt                         this packet need tx cnt
 | |
|  *
 | |
|  *@return                               this packet tx retry count
 | |
|  */
 | |
| uint8_t mac_get_tx_retry_cnt_by_band(mac_vdev_t *vdev,
 | |
|     uint32_t proto_band, uint8_t tx_cnt);
 | |
| 
 | |
| /**
 | |
|  *@brief mac_tx_hw_band_id_get          get multi band actul tx hw band
 | |
|  *
 | |
|  *@param vdev                           vdev
 | |
|  *@param proto_band                     current phy protocol band id
 | |
|  *@param tx_cnt                         this packet need tx cnt
 | |
|  *
 | |
|  *@return                               this time tx hw band id
 | |
|  */
 | |
| uint32_t mac_tx_hw_band_id_get(mac_vdev_t *vdev,
 | |
|     uint32_t proto_band, uint32_t tx_cnt);
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| #endif // !RATE_CONTROL_H
 |