1*4882a593Smuzhiyun /****************************************************************************** 2*4882a593Smuzhiyun * 3*4882a593Smuzhiyun * Copyright(c) 2019 Realtek Corporation. 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or modify it 6*4882a593Smuzhiyun * under the terms of version 2 of the GNU General Public License as 7*4882a593Smuzhiyun * published by the Free Software Foundation. 8*4882a593Smuzhiyun * 9*4882a593Smuzhiyun * This program is distributed in the hope that it will be useful, but WITHOUT 10*4882a593Smuzhiyun * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12*4882a593Smuzhiyun * more details. 13*4882a593Smuzhiyun * 14*4882a593Smuzhiyun *****************************************************************************/ 15*4882a593Smuzhiyun #ifndef __PHL_TX_H_ 16*4882a593Smuzhiyun #define __PHL_TX_H_ 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun void phl_datapath_deinit(struct phl_info_t *phl_info); 19*4882a593Smuzhiyun enum rtw_phl_status phl_datapath_init(struct phl_info_t *phl_info); 20*4882a593Smuzhiyun enum rtw_phl_status phl_datapath_start(struct phl_info_t *phl_info); 21*4882a593Smuzhiyun void phl_datapath_stop(struct phl_info_t *phl_info); 22*4882a593Smuzhiyun void phl_trx_free_handler(void *phl); 23*4882a593Smuzhiyun void phl_trx_free_sw_rsc(void *phl); 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun bool phl_datapath_chk_trx_pause(struct phl_info_t *phl_info, u8 type); 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun struct phl_ring_status *phl_alloc_ring_sts(struct phl_info_t *phl_info); 28*4882a593Smuzhiyun void phl_release_ring_sts(struct phl_info_t *phl_info, 29*4882a593Smuzhiyun struct phl_ring_status *ring_sts); 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun u8 phl_check_xmit_ring_resource(struct phl_info_t *phl_info, 32*4882a593Smuzhiyun _os_list *sta_list); 33*4882a593Smuzhiyun void phl_tx_flow_ctrl(struct phl_info_t *phl_info, _os_list *sta_list); 34*4882a593Smuzhiyun enum rtw_phl_status rtw_phl_tx_req_notify(void *phl); 35*4882a593Smuzhiyun enum rtw_phl_status phl_register_handler(struct rtw_phl_com_t *phl_com, 36*4882a593Smuzhiyun struct rtw_phl_handler *handler); 37*4882a593Smuzhiyun enum rtw_phl_status phl_deregister_handler(struct rtw_phl_com_t *phl_com, 38*4882a593Smuzhiyun struct rtw_phl_handler *handler); 39*4882a593Smuzhiyun enum rtw_phl_status phl_schedule_handler(struct rtw_phl_com_t *phl_com, 40*4882a593Smuzhiyun struct rtw_phl_handler *handler); 41*4882a593Smuzhiyun enum rtw_phl_status phl_indic_pkt_complete(void *phl); 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun enum rtw_phl_status phl_register_tx_ring(void *phl, u16 macid, u8 hw_band, u8 hw_wmm, u8 hw_port); 44*4882a593Smuzhiyun enum rtw_phl_status phl_deregister_tx_ring(void *phl, u16 macid); 45*4882a593Smuzhiyun void phl_free_deferred_tx_ring(struct phl_info_t *phl_info); 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun enum rtw_phl_status phl_enqueue_busy_h2c_pkt(struct phl_info_t *phl_info, 48*4882a593Smuzhiyun struct rtw_h2c_pkt *h2c_pkt, u8 pos); 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun enum rtw_phl_status phl_enqueue_idle_h2c_pkt(struct phl_info_t *phl_info, 51*4882a593Smuzhiyun struct rtw_h2c_pkt *h2c_pkt); 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun struct rtw_h2c_pkt *phl_query_busy_h2c_pkt(struct phl_info_t *phl_info); 54*4882a593Smuzhiyun struct rtw_h2c_pkt *phl_query_idle_h2c_pkt(struct phl_info_t *phl_info, u8 type); 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun /** 57*4882a593Smuzhiyun * this function will be used in read / write pointer mechanism and 58*4882a593Smuzhiyun * return the number of available read pointer 59*4882a593Smuzhiyun * @rptr: input, the read pointer 60*4882a593Smuzhiyun * @wptr: input, the write pointer 61*4882a593Smuzhiyun * @bndy: input, the boundary of read / write pointer mechanism 62*4882a593Smuzhiyun */ 63*4882a593Smuzhiyun u16 phl_calc_avail_rptr(u16 rptr, u16 wptr, u16 bndy); 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun /** 66*4882a593Smuzhiyun * this function will be used in read / write pointer mechanism and 67*4882a593Smuzhiyun * return the number of available write pointer 68*4882a593Smuzhiyun * @rptr: input, the read pointer 69*4882a593Smuzhiyun * @wptr: input, the write pointer 70*4882a593Smuzhiyun * @bndy: input, the boundary of read / write pointer mechanism 71*4882a593Smuzhiyun */ 72*4882a593Smuzhiyun u16 phl_calc_avail_wptr(u16 rptr, u16 wptr, u16 bndy); 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun void phl_dump_sorted_ring(_os_list *sorted_ring); 75*4882a593Smuzhiyun void phl_dump_tx_plan(_os_list *sta_list); 76*4882a593Smuzhiyun void phl_dump_t_fctrl_result(_os_list *t_fctrl_result); 77*4882a593Smuzhiyun const char *phl_tfc_lvl_to_str(u8 lvl); 78*4882a593Smuzhiyun void phl_tx_traffic_upd(struct rtw_stats *sts); 79*4882a593Smuzhiyun void phl_tx_watchdog(struct phl_info_t *phl_info); 80*4882a593Smuzhiyun void phl_reset_tx_stats(struct rtw_stats *stats); 81*4882a593Smuzhiyun void phl_dump_h2c_pool_stats(struct phl_h2c_pkt_pool *h2c_pkt_pool); 82*4882a593Smuzhiyun 83*4882a593Smuzhiyun enum rtw_phl_status 84*4882a593Smuzhiyun phl_cmd_cfg_ampdu_hdl(struct phl_info_t *phl_info, u8 *param); 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun enum rtw_phl_status 87*4882a593Smuzhiyun phl_data_ctrler(struct phl_info_t *phl_info, struct phl_data_ctl_t *ctl, 88*4882a593Smuzhiyun struct phl_msg *msg); 89*4882a593Smuzhiyun 90*4882a593Smuzhiyun void rtw_phl_tx_stop(void *phl); 91*4882a593Smuzhiyun void rtw_phl_tx_resume(void *phl); 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun #endif /* __PHL_TX_H_ */ 94