1 /*
2  * Copyright (c) 2011, 2014-2017, 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_REORDER__H_
20 #define _OL_RX_REORDER__H_
21 
22 #include <qdf_nbuf.h>           /* qdf_nbuf_t, etc. */
23 
24 #include <ol_txrx_api.h>        /* ol_txrx_peer_t, etc. */
25 
26 #include <ol_txrx_types.h>      /* ol_rx_reorder_t */
27 
28 void
29 ol_rx_reorder_store(struct ol_txrx_pdev_t *pdev,
30 		    struct ol_txrx_peer_t *peer,
31 		    unsigned int tid,
32 		    unsigned int reorder_array_index,
33 		    qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu);
34 
35 void
36 ol_rx_reorder_release(struct ol_txrx_vdev_t *vdev,
37 		      struct ol_txrx_peer_t *peer,
38 		      unsigned int tid,
39 		      unsigned int seq_num_start, unsigned int seq_num_end);
40 
41 void
42 ol_rx_reorder_flush(struct ol_txrx_vdev_t *vdev,
43 		    struct ol_txrx_peer_t *peer,
44 		    unsigned int tid,
45 		    unsigned int seq_num_start,
46 		    unsigned int seq_num_end, enum htt_rx_flush_action action);
47 
48 /**
49  * @brief - find end of first range of present MPDUs after the initial rx hole
50  * @param[in] peer - which sender's data is being checked
51  * @param[in] tid - which type of data is being checked
52  * @param[out] idx_end - the reorder array index holding the last MPDU in the
53  *      range of in-order MPDUs that following the initial hole.
54  *      Note that this is the index of the last in-order MPDU following the
55  *      first hole, rather than the starting index of the second hole.
56  */
57 void
58 ol_rx_reorder_first_hole(struct ol_txrx_peer_t *peer,
59 			 unsigned int tid, unsigned int *idx_end);
60 
61 void
62 ol_rx_reorder_peer_cleanup(struct ol_txrx_vdev_t *vdev,
63 			   struct ol_txrx_peer_t *peer);
64 
65 void ol_rx_reorder_init(struct ol_rx_reorder_t *rx_reorder, uint8_t tid);
66 
67 enum htt_rx_status
68 ol_rx_seq_num_check(struct ol_txrx_pdev_t *pdev,
69 			    struct ol_txrx_peer_t *peer,
70 			    uint8_t tid, void *rx_mpdu_desc);
71 
72 /*
73  * Peregrine and Rome: do sequence number checking in the host
74  * for peer-TIDs without aggregation enabled
75  */
76 
77 #define OL_RX_SEQ_NUM_CHECK(pdev, peer, tid, rx_mpdu_desc)	\
78 	(pdev->rx.flags.dup_check && peer->tids_rx_reorder[tid].win_sz_mask == \
79 	0) ? ol_rx_seq_num_check(pdev, peer, tid, rx_mpdu_desc) : \
80 	htt_rx_status_ok
81 
82 #endif /* _OL_RX_REORDER__H_ */
83