1 /*
2  * Copyright (c) 2011, 2014-2019 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _OL_RX__H_
20 #define _OL_RX__H_
21 
22 #include <qdf_nbuf.h>           /* qdf_nbuf_t */
23 #include <ol_htt_api.h>         /* htt_pdev_handle */
24 #include <cdp_txrx_cmn.h>       /* ol_txrx_vdev_t */
25 
26 #ifdef WLAN_PARTIAL_REORDER_OFFLOAD
27 void
28 ol_rx_deliver(struct ol_txrx_vdev_t *vdev,
29 	      struct ol_txrx_peer_t *peer, unsigned int tid,
30 	      qdf_nbuf_t head_msdu);
31 #else
32 static inline void
ol_rx_deliver(struct ol_txrx_vdev_t * vdev,struct ol_txrx_peer_t * peer,unsigned int tid,qdf_nbuf_t head_msdu)33 ol_rx_deliver(struct ol_txrx_vdev_t *vdev,
34 	      struct ol_txrx_peer_t *peer, unsigned int tid,
35 	      qdf_nbuf_t head_msdu)
36 {
37 }
38 #endif
39 
40 void
41 ol_rx_discard(struct ol_txrx_vdev_t *vdev,
42 	      struct ol_txrx_peer_t *peer, unsigned int tid,
43 	      qdf_nbuf_t head_msdu);
44 
45 /**
46  * ol_rx_send_mic_err_ind() - ol rx mic err handler
47  * @pdev: ol pdev
48  * @vdev_id: vdev id
49  * @peer_mac_addr: peer mac address
50  * @tid: TID
51  * @tsf32: TSF
52  * @err_type: error type
53  * @rx_frame: rx frame
54  * @pn: PN Number
55  * @key_id: key id
56  *
57  * This function handles rx error and send MIC error failure to HDD
58  *
59  * Return: none
60  */
61 void
62 ol_rx_send_mic_err_ind(struct ol_txrx_pdev_t *pdev, uint8_t vdev_id,
63 		       uint8_t *peer_mac_addr, int tid, uint32_t tsf32,
64 		       enum ol_rx_err_type err_type, qdf_nbuf_t rx_frame,
65 		       uint64_t *pn, uint8_t key_id);
66 
67 void ol_rx_frames_free(htt_pdev_handle htt_pdev, qdf_nbuf_t frames);
68 
69 void ol_rx_peer_init(struct ol_txrx_pdev_t *pdev, struct ol_txrx_peer_t *peer);
70 
71 void
72 ol_rx_peer_cleanup(struct ol_txrx_vdev_t *vdev, struct ol_txrx_peer_t *peer);
73 
74 #ifdef WDI_EVENT_ENABLE
75 void ol_rx_send_pktlog_event(struct ol_txrx_pdev_t *pdev,
76 			     struct ol_txrx_peer_t *peer, qdf_nbuf_t msdu,
77 			     uint8_t pktlog_bit);
78 #else
79 static inline
ol_rx_send_pktlog_event(struct ol_txrx_pdev_t * pdev,struct ol_txrx_peer_t * peer,qdf_nbuf_t msdu,uint8_t pktlog_bit)80 void ol_rx_send_pktlog_event(struct ol_txrx_pdev_t *pdev,
81 			     struct ol_txrx_peer_t *peer, qdf_nbuf_t msdu,
82 			     uint8_t pktlog_bit)
83 {
84 }
85 #endif
86 
87 #ifdef WLAN_FULL_REORDER_OFFLOAD
88 void
89 ol_rx_in_order_deliver(struct ol_txrx_vdev_t *vdev,
90 		       struct ol_txrx_peer_t *peer,
91 		       unsigned int tid, qdf_nbuf_t head_msdu);
92 #else
93 static inline void
ol_rx_in_order_deliver(struct ol_txrx_vdev_t * vdev,struct ol_txrx_peer_t * peer,unsigned int tid,qdf_nbuf_t head_msdu)94 ol_rx_in_order_deliver(struct ol_txrx_vdev_t *vdev,
95 		       struct ol_txrx_peer_t *peer,
96 		       unsigned int tid, qdf_nbuf_t head_msdu)
97 {
98 }
99 #endif
100 
101 void ol_rx_log_packet(htt_pdev_handle htt_pdev,
102 		 uint8_t peer_id, qdf_nbuf_t msdu);
103 void
104 ol_rx_offload_paddr_deliver_ind_handler(htt_pdev_handle htt_pdev,
105 					uint32_t msdu_count,
106 					uint32_t *msg_word);
107 void ol_rx_update_histogram_stats(uint32_t msdu_count,
108 		uint8_t frag_ind, uint8_t offload_ind);
109 
110 void
111 ol_rx_mic_error_handler(
112 	ol_txrx_pdev_handle pdev,
113 	u_int8_t tid,
114 	u_int16_t peer_id,
115 	void *msdu_desc,
116 	qdf_nbuf_t msdu);
117 
118 void htt_rx_fill_ring_count(htt_pdev_handle pdev);
119 
120 void ol_rx_timestamp(struct cdp_cfg *cfg_pdev, void *rx_desc, qdf_nbuf_t msdu);
121 
122 #endif /* _OL_RX__H_ */
123