1 /* 2 * Copyright (c) 2011, 2014-2017, 2021 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_PN_H_ 20 #define _OL_RX_PN_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 int ol_rx_pn_cmp24(union htt_rx_pn_t *new_pn, 27 union htt_rx_pn_t *old_pn, int is_unicast, int opmode, 28 bool strict_chk); 29 30 int ol_rx_pn_cmp48(union htt_rx_pn_t *new_pn, 31 union htt_rx_pn_t *old_pn, int is_unicast, int opmode, 32 bool strict_chk); 33 34 int ol_rx_pn_wapi_cmp(union htt_rx_pn_t *new_pn, 35 union htt_rx_pn_t *old_pn, int is_unicast, int opmode, 36 bool strict_chk); 37 38 /** 39 * @brief If applicable, check the Packet Number to detect replays. 40 * @details 41 * Determine whether a PN check is needed, and if so, what the PN size is. 42 * (A PN size of 0 is used to indirectly bypass the PN check for security 43 * methods that don't involve a PN check.) 44 * This function produces event notifications for any PN failures, via the 45 * ol_rx_err function. 46 * After the PN check, call the next stage of rx processing (rx --> tx 47 * forwarding check). 48 * 49 * @param vdev - which virtual device the frames were addressed to 50 * @param peer - which peer the rx frames belong to 51 * @param tid - which TID within the peer the rx frames belong to 52 * @param msdu_list - NULL-terminated list of MSDUs to perform PN check on 53 * (if PN check is applicable, i.e. PN length > 0) 54 */ 55 void 56 ol_rx_pn_check(struct ol_txrx_vdev_t *vdev, 57 struct ol_txrx_peer_t *peer, unsigned int tid, 58 qdf_nbuf_t msdu_list); 59 60 /** 61 * @brief If applicable, check the Packet Number to detect replays. 62 * @details 63 * Determine whether a PN check is needed, and if so, what the PN size is. 64 * (A PN size of 0 is used to indirectly bypass the PN check for security 65 * methods that don't involve a PN check.) 66 * This function produces event notifications for any PN failures, via the 67 * ol_rx_err function. 68 * After the PN check, deliver the valid rx frames to the OS shim. 69 * (Don't perform a rx --> tx forwarding check.) 70 * 71 * @param vdev - which virtual device the frames were addressed to 72 * @param peer - which peer the rx frames belong to 73 * @param tid - which TID within the peer the rx frames belong to 74 * @param msdu_list - NULL-terminated list of MSDUs to perform PN check on 75 * (if PN check is applicable, i.e. PN length > 0) 76 */ 77 void 78 ol_rx_pn_check_only(struct ol_txrx_vdev_t *vdev, 79 struct ol_txrx_peer_t *peer, 80 unsigned int tid, qdf_nbuf_t msdu_list); 81 82 /** 83 * @brief If applicable, check the Packet Number to detect replays. 84 * @details 85 * Same as ol_rx_pn_check but return valid rx netbufs 86 * rather than invoking the rx --> tx forwarding check. 87 * 88 * @param vdev - which virtual device the frames were addressed to 89 * @param peer - which peer the rx frames belong to 90 * @param tid - which TID within the peer the rx frames belong to 91 * @param msdu_list - NULL-terminated list of MSDUs to perform PN check on 92 * (if PN check is applicable, i.e. PN length > 0) 93 * @param strick_chk - if PN consecutive stric check is needed or not 94 * @return list of netbufs that didn't fail the PN check 95 */ 96 qdf_nbuf_t 97 ol_rx_pn_check_base(struct ol_txrx_vdev_t *vdev, 98 struct ol_txrx_peer_t *peer, 99 unsigned int tid, qdf_nbuf_t msdu_list, bool strict_chk); 100 101 #endif /* _OL_RX_PN_H_ */ 102