xref: /wlan-driver/qcacld-3.0/core/dp/txrx/ol_rx_pn.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2011, 2014-2017, 2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name #ifndef _OL_RX_PN_H_
20*5113495bSYour Name #define _OL_RX_PN_H_
21*5113495bSYour Name 
22*5113495bSYour Name #include <qdf_nbuf.h>           /* qdf_nbuf_t, etc. */
23*5113495bSYour Name 
24*5113495bSYour Name #include <ol_txrx_api.h>        /* ol_txrx_peer_t, etc. */
25*5113495bSYour Name 
26*5113495bSYour Name int ol_rx_pn_cmp24(union htt_rx_pn_t *new_pn,
27*5113495bSYour Name 		   union htt_rx_pn_t *old_pn, int is_unicast, int opmode,
28*5113495bSYour Name 		   bool strict_chk);
29*5113495bSYour Name 
30*5113495bSYour Name int ol_rx_pn_cmp48(union htt_rx_pn_t *new_pn,
31*5113495bSYour Name 		   union htt_rx_pn_t *old_pn, int is_unicast, int opmode,
32*5113495bSYour Name 		   bool strict_chk);
33*5113495bSYour Name 
34*5113495bSYour Name int ol_rx_pn_wapi_cmp(union htt_rx_pn_t *new_pn,
35*5113495bSYour Name 		      union htt_rx_pn_t *old_pn, int is_unicast, int opmode,
36*5113495bSYour Name 		      bool strict_chk);
37*5113495bSYour Name 
38*5113495bSYour Name /**
39*5113495bSYour Name  * @brief If applicable, check the Packet Number to detect replays.
40*5113495bSYour Name  * @details
41*5113495bSYour Name  *  Determine whether a PN check is needed, and if so, what the PN size is.
42*5113495bSYour Name  *  (A PN size of 0 is used to indirectly bypass the PN check for security
43*5113495bSYour Name  *  methods that don't involve a PN check.)
44*5113495bSYour Name  *  This function produces event notifications for any PN failures, via the
45*5113495bSYour Name  *  ol_rx_err function.
46*5113495bSYour Name  *  After the PN check, call the next stage of rx processing (rx --> tx
47*5113495bSYour Name  *  forwarding check).
48*5113495bSYour Name  *
49*5113495bSYour Name  * @param vdev - which virtual device the frames were addressed to
50*5113495bSYour Name  * @param peer - which peer the rx frames belong to
51*5113495bSYour Name  * @param tid  - which TID within the peer the rx frames belong to
52*5113495bSYour Name  * @param msdu_list - NULL-terminated list of MSDUs to perform PN check on
53*5113495bSYour Name  *      (if PN check is applicable, i.e. PN length > 0)
54*5113495bSYour Name  */
55*5113495bSYour Name void
56*5113495bSYour Name ol_rx_pn_check(struct ol_txrx_vdev_t *vdev,
57*5113495bSYour Name 	       struct ol_txrx_peer_t *peer, unsigned int tid,
58*5113495bSYour Name 	       qdf_nbuf_t msdu_list);
59*5113495bSYour Name 
60*5113495bSYour Name /**
61*5113495bSYour Name  * @brief If applicable, check the Packet Number to detect replays.
62*5113495bSYour Name  * @details
63*5113495bSYour Name  *  Determine whether a PN check is needed, and if so, what the PN size is.
64*5113495bSYour Name  *  (A PN size of 0 is used to indirectly bypass the PN check for security
65*5113495bSYour Name  *  methods that don't involve a PN check.)
66*5113495bSYour Name  *  This function produces event notifications for any PN failures, via the
67*5113495bSYour Name  *  ol_rx_err function.
68*5113495bSYour Name  *  After the PN check, deliver the valid rx frames to the OS shim.
69*5113495bSYour Name  *  (Don't perform a rx --> tx forwarding check.)
70*5113495bSYour Name  *
71*5113495bSYour Name  * @param vdev - which virtual device the frames were addressed to
72*5113495bSYour Name  * @param peer - which peer the rx frames belong to
73*5113495bSYour Name  * @param tid  - which TID within the peer the rx frames belong to
74*5113495bSYour Name  * @param msdu_list - NULL-terminated list of MSDUs to perform PN check on
75*5113495bSYour Name  *      (if PN check is applicable, i.e. PN length > 0)
76*5113495bSYour Name  */
77*5113495bSYour Name void
78*5113495bSYour Name ol_rx_pn_check_only(struct ol_txrx_vdev_t *vdev,
79*5113495bSYour Name 		    struct ol_txrx_peer_t *peer,
80*5113495bSYour Name 		    unsigned int tid, qdf_nbuf_t msdu_list);
81*5113495bSYour Name 
82*5113495bSYour Name /**
83*5113495bSYour Name  * @brief If applicable, check the Packet Number to detect replays.
84*5113495bSYour Name  * @details
85*5113495bSYour Name  *  Same as ol_rx_pn_check but return valid rx netbufs
86*5113495bSYour Name  *  rather than invoking the rx --> tx forwarding check.
87*5113495bSYour Name  *
88*5113495bSYour Name  * @param vdev - which virtual device the frames were addressed to
89*5113495bSYour Name  * @param peer - which peer the rx frames belong to
90*5113495bSYour Name  * @param tid - which TID within the peer the rx frames belong to
91*5113495bSYour Name  * @param msdu_list - NULL-terminated list of MSDUs to perform PN check on
92*5113495bSYour Name  *      (if PN check is applicable, i.e. PN length > 0)
93*5113495bSYour Name  * @param strick_chk - if PN consecutive stric check is needed or not
94*5113495bSYour Name  * @return list of netbufs that didn't fail the PN check
95*5113495bSYour Name  */
96*5113495bSYour Name qdf_nbuf_t
97*5113495bSYour Name ol_rx_pn_check_base(struct ol_txrx_vdev_t *vdev,
98*5113495bSYour Name 		    struct ol_txrx_peer_t *peer,
99*5113495bSYour Name 		    unsigned int tid, qdf_nbuf_t msdu_list, bool strict_chk);
100*5113495bSYour Name 
101*5113495bSYour Name #endif /* _OL_RX_PN_H_ */
102