1 /*
2  * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 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 private API which shall be used internally only
22  * in pkt_capture component. This file shall include prototypes of
23  * pkt_capture parsing and send logic.
24  *
25  * Note: This API should be never accessed out of pkt_capture component.
26  */
27 
28 #ifndef _WLAN_PKT_CAPTURE_PRIV_STRUCT_H_
29 #define _WLAN_PKT_CAPTURE_PRIV_STRUCT_H_
30 
31 #include "wlan_pkt_capture_objmgr.h"
32 #include "wlan_pkt_capture_public_structs.h"
33 #include "wlan_pkt_capture_mon_thread.h"
34 
35 /**
36  * struct pkt_capture_cfg - struct to store config values
37  * @pkt_capture_mode: packet capture mode
38  * @pkt_capture_config: config for trigger, qos and beacon frames
39  */
40 struct pkt_capture_cfg {
41 	enum pkt_capture_mode pkt_capture_mode;
42 	enum pkt_capture_config pkt_capture_config;
43 };
44 
45 /**
46  * struct pkt_capture_cb_context - packet capture callback context
47  * @mon_cb: monitor callback function pointer
48  * @mon_ctx: monitor callback context
49  */
50 struct pkt_capture_cb_context {
51 	QDF_STATUS (*mon_cb)(void *, qdf_nbuf_t);
52 	void *mon_ctx;
53 };
54 
55 /**
56  * struct pkt_capture_vdev_priv - Private object to be stored in vdev
57  * @vdev: pointer to vdev object
58  * @mon_ctx: pointer to packet capture mon context
59  * @cb_ctx: pointer to packet capture mon callback context
60  * @frame_filter: config filter set by vendor command
61  * @cfg_params: packet capture config params
62  * @ppdu_stats_q: list used for storing smu related ppdu stats
63  * @lock_q: spinlock for ppdu_stats q
64  * @tx_nss: nss of tx data packets received from ppdu stats
65  * @last_freq: Last connected freq
66  * @curr_freq: current connected freq
67  * @rx_vht_sgi: guard interval of vht rx packet
68  * @wake_lock: wake lock for packet capture
69  * @runtime_lock: runtime lock for packet capture
70  */
71 struct pkt_capture_vdev_priv {
72 	struct wlan_objmgr_vdev *vdev;
73 	struct pkt_capture_mon_context *mon_ctx;
74 	struct pkt_capture_cb_context *cb_ctx;
75 	struct pkt_capture_frame_filter frame_filter;
76 	struct pkt_capture_cfg cfg_params;
77 	qdf_list_t ppdu_stats_q;
78 	qdf_spinlock_t lock_q;
79 	uint8_t tx_nss;
80 	qdf_freq_t last_freq;
81 	qdf_freq_t curr_freq;
82 	uint8_t rx_vht_sgi;
83 	qdf_wake_lock_t wake_lock;
84 	qdf_runtime_lock_t runtime_lock;
85 };
86 
87 /**
88  * struct pkt_psoc_priv - Private object to be stored in psoc
89  * @psoc: pointer to psoc object
90  * @cfg_param: INI config params for packet capture
91  * @cb_obj: struct containing callback pointers
92  * @rx_ops: rx ops
93  * @tx_ops: tx ops
94  */
95 struct pkt_psoc_priv {
96 	struct wlan_objmgr_psoc *psoc;
97 	struct pkt_capture_cfg cfg_param;
98 	struct pkt_capture_callbacks cb_obj;
99 	struct wlan_pkt_capture_rx_ops rx_ops;
100 	struct wlan_pkt_capture_tx_ops tx_ops;
101 };
102 #endif /* End  of _WLAN_PKT_CAPTURE_PRIV_STRUCT_H_ */
103