xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852bs/phl/phl_rx.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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_RX_H_
16*4882a593Smuzhiyun #define _PHL_RX_H_
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun struct phl_rx_pkt_pool {
19*4882a593Smuzhiyun 	struct rtw_phl_rx_pkt phl_rx[MAX_PHL_RING_RX_PKT_NUM];
20*4882a593Smuzhiyun 	_os_list idle;
21*4882a593Smuzhiyun 	_os_list busy;
22*4882a593Smuzhiyun 	_os_lock idle_lock;	/* spinlock */
23*4882a593Smuzhiyun 	_os_lock busy_lock;	/* spinlock */
24*4882a593Smuzhiyun 	u32 idle_cnt;
25*4882a593Smuzhiyun };
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun enum rtw_phl_status phl_rx_init(struct phl_info_t *phl_info);
28*4882a593Smuzhiyun void phl_rx_deinit(struct phl_info_t *phl_info);
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun u8 phl_check_recv_ring_resource(struct phl_info_t *phl_info);
31*4882a593Smuzhiyun struct rtw_phl_rx_pkt *rtw_phl_query_phl_rx(void *phl);
32*4882a593Smuzhiyun u8 rtw_phl_is_phl_rx_idle(struct phl_info_t *phl_info);
33*4882a593Smuzhiyun void phl_release_phl_rx(struct phl_info_t *phl_info,
34*4882a593Smuzhiyun 			struct rtw_phl_rx_pkt *phl_rx);
35*4882a593Smuzhiyun enum rtw_phl_status phl_rx_reorder(struct phl_info_t *phl_info,
36*4882a593Smuzhiyun                                    struct rtw_phl_rx_pkt *phl_rx,
37*4882a593Smuzhiyun                                    _os_list *frames);
38*4882a593Smuzhiyun void phl_rx_deinit(struct phl_info_t *phl_info);
39*4882a593Smuzhiyun void phl_recycle_rx_buf(struct phl_info_t *phl_info,
40*4882a593Smuzhiyun 				struct rtw_phl_rx_pkt *phl_rx);
41*4882a593Smuzhiyun void phl_event_indicator(void *context);
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun enum rtw_phl_status rtw_phl_start_rx_process(void *phl);
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun void _phl_indic_new_rxpkt(struct phl_info_t *phl_info);
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun void
49*4882a593Smuzhiyun phl_handle_rx_frame_list(struct phl_info_t *phl_info,
50*4882a593Smuzhiyun                          _os_list *frames);
51*4882a593Smuzhiyun void phl_sta_rx_reorder_timer_expired(void *t);
52*4882a593Smuzhiyun void phl_rx_traffic_upd(struct rtw_stats *sts);
53*4882a593Smuzhiyun void phl_rx_watchdog(struct phl_info_t *phl_info);
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun #ifdef CONFIG_PHL_RX_PSTS_PER_PKT
56*4882a593Smuzhiyun enum rtw_phl_status
57*4882a593Smuzhiyun phl_rx_proc_phy_sts(struct phl_info_t *phl_info, struct rtw_phl_rx_pkt *ppdu_sts);
58*4882a593Smuzhiyun bool
59*4882a593Smuzhiyun phl_rx_proc_wait_phy_sts(struct phl_info_t *phl_info,
60*4882a593Smuzhiyun 			 struct rtw_phl_rx_pkt *phl_rx);
61*4882a593Smuzhiyun #endif
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun void phl_rx_proc_ppdu_sts(struct phl_info_t *phl_info,
64*4882a593Smuzhiyun 			  struct rtw_phl_rx_pkt *phl_rx);
65*4882a593Smuzhiyun void phl_reset_rx_stats(struct rtw_stats *stats);
66*4882a593Smuzhiyun void phl_dump_all_sta_rx_info(struct phl_info_t *phl_info);
67*4882a593Smuzhiyun u16 rtw_phl_query_new_rx_num(void *phl);
68*4882a593Smuzhiyun void phl_rx_dbg_dump(struct phl_info_t *phl_info, u8 band_idx);
69*4882a593Smuzhiyun 
70*4882a593Smuzhiyun #endif /*_PHL_RX_H_*/
71