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