1 /*
2  * Copyright (c) 2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: Declare mgmt txrx APIs which shall be used internally only
22  * in pkt_capture component.
23  * Note: These APIs should be never accessed out of pkt_capture component.
24  */
25 
26 #ifndef _WLAN_PKT_CAPTURE_MGMT_TXRX_H_
27 #define _WLAN_PKT_CAPTURE_MGMT_TXRX_H_
28 
29 #include "wlan_pkt_capture_public_structs.h"
30 
31 #define PKTCAPTURE_PKT_FORMAT_8023	(0)
32 #define PKTCAPTURE_PKT_FORMAT_80211	(1)
33 #define WLAN_INVALID_TID		(31)
34 #define RESERVE_BYTES			(100)
35 #define RATE_LIMIT			(16)
36 #define INVALID_RSSI_FOR_TX		(-128)
37 #define PKTCAPTURE_RATECODE_CCK		(1)
38 
39 /**
40  * pkt_capture_process_mgmt_tx_data() - process management tx packets
41  * @pdev: pointer to pdev object
42  * @params: management offload event params
43  * @nbuf: netbuf
44  * @status: status
45  *
46  * Return: QDF_STATUS
47  */
48 QDF_STATUS
49 pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev,
50 				 struct mgmt_offload_event_params *params,
51 				 qdf_nbuf_t nbuf,
52 				 uint8_t status);
53 /**
54  * pkt_capture_mgmt_tx() - process mgmt tx completion
55  * for pkt capture mode
56  * @pdev: pointer to pdev object
57  * @nbuf: netbuf
58  * @chan_freq: channel freq
59  * @preamble_type: preamble_type
60  *
61  * Return: none
62  */
63 void pkt_capture_mgmt_tx(struct wlan_objmgr_pdev *pdev,
64 			 qdf_nbuf_t nbuf,
65 			 uint16_t chan_freq,
66 			 uint8_t preamble_type);
67 
68 /**
69  * pkt_capture_mgmt_tx_completion() - process mgmt tx completion
70  * for pkt capture mode
71  * @pdev: pointer to pdev object
72  * @desc_id: desc_id
73  * @status: status
74  * @params: management offload event params
75  *
76  * Return: none
77  */
78 void
79 pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev,
80 			       uint32_t desc_id,
81 			       uint32_t status,
82 			       struct mgmt_offload_event_params *params);
83 
84 /**
85  * pkt_capture_mgmt_rx_ops() - Register packet capture mgmt rx ops
86  * @psoc: psoc context
87  * @is_register: register if true, unregister if false
88  *
89  * This function registers or deregisters rx callback
90  * to mgmt txrx component.
91  *
92  * Return: QDF_STATUS
93  */
94 QDF_STATUS pkt_capture_mgmt_rx_ops(struct wlan_objmgr_psoc *psoc,
95 				   bool is_register);
96 
97 /**
98  * pkt_capture_mgmt_status_map() - map Tx status for MGMT packets
99  * with packet capture Tx status
100  * @status: Tx status
101  *
102  * Return: pkt_capture_tx_status enum
103  */
104 enum pkt_capture_tx_status
105 pkt_capture_mgmt_status_map(uint8_t status);
106 #endif
107