1 /*
2  * Copyright (c) 2021, 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 any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /*
19  * DOC: wlan_hdd_connectivity_logging.h
20  *
21  * Implementation for the Common connectivity logging api.
22  */
23 
24 #ifndef __WLAN_HDD_CONNECTIVITY_LOGGING_H__
25 #define __WLAN_HDD_CONNECTIVITY_LOGGING_H__
26 
27 #include <qdf_types.h>
28 #include <wlan_cfg80211.h>
29 #include <wlan_connectivity_logging.h>
30 #include "wlan_hdd_main.h"
31 
32 #if defined(WLAN_FEATURE_CONNECTIVITY_LOGGING)
33 
34 #define FEATURE_CONNECTIVITY_LOGGING_EVENT                  \
35 [QCA_NL80211_VENDOR_SUBCMD_DIAG_EVENT_INDEX] = {            \
36 	.vendor_id = QCA_NL80211_VENDOR_ID,                 \
37 	.subcmd = QCA_NL80211_VENDOR_SUBCMD_DIAG_DATA,      \
38 },
39 
40 /**
41  * wlan_hdd_start_connectivity_logging()  - Initialize logging callbacks
42  * and allocate global buffers
43  * @hdd_ctx: Pointer to hdd context
44  *
45  * Return: None
46  */
47 void wlan_hdd_start_connectivity_logging(struct hdd_context *hdd_ctx);
48 
49 /**
50  * wlan_hdd_connectivity_event_connecting() - Queue the connecting event to
51  * the logging queue
52  * @hdd_ctx: HDD context
53  * @req: Request
54  * @vdev_id: Vdev id
55  */
56 void wlan_hdd_connectivity_event_connecting(struct hdd_context *hdd_ctx,
57 					    struct cfg80211_connect_params *req,
58 					    uint8_t vdev_id);
59 
60 /**
61  * wlan_hdd_connectivity_fail_event()- Connectivity queue logging event
62  * @vdev: VDEV object
63  * @rsp: Connection manager connect response
64  *
65  * Return: None
66  */
67 void wlan_hdd_connectivity_fail_event(struct wlan_objmgr_vdev *vdev,
68 				      struct wlan_cm_connect_resp *rsp);
69 #elif defined(CONNECTIVITY_DIAG_EVENT)
70 /**
71  * wlan_hdd_connectivity_event_connecting() - Queue the connecting event to
72  * the logging queue
73  * @hdd_ctx: HDD context
74  * @req: Request
75  * @vdev_id: Vdev id
76  */
77 void wlan_hdd_connectivity_event_connecting(struct hdd_context *hdd_ctx,
78 					    struct cfg80211_connect_params *req,
79 					    uint8_t vdev_id);
80 
81 /**
82  * wlan_hdd_connectivity_fail_event()- Connectivity queue logging event
83  * @vdev: VDEV object
84  * @rsp: Connection manager connect response
85  *
86  * Return: None
87  */
88 void wlan_hdd_connectivity_fail_event(struct wlan_objmgr_vdev *vdev,
89 				      struct wlan_cm_connect_resp *rsp);
90 
91 static inline
wlan_hdd_start_connectivity_logging(struct hdd_context * hdd_ctx)92 void wlan_hdd_start_connectivity_logging(struct hdd_context *hdd_ctx)
93 {}
94 
95 #else
96 static inline
wlan_hdd_start_connectivity_logging(struct hdd_context * hdd_ctx)97 void wlan_hdd_start_connectivity_logging(struct hdd_context *hdd_ctx)
98 {}
99 
100 static inline
wlan_hdd_connectivity_event_connecting(struct hdd_context * hdd_ctx,struct cfg80211_connect_params * req,uint8_t vdev_id)101 void wlan_hdd_connectivity_event_connecting(struct hdd_context *hdd_ctx,
102 					    struct cfg80211_connect_params *req,
103 					    uint8_t vdev_id)
104 {}
105 
106 static inline
wlan_hdd_connectivity_fail_event(struct wlan_objmgr_vdev * vdev,struct wlan_cm_connect_resp * rsp)107 void wlan_hdd_connectivity_fail_event(struct wlan_objmgr_vdev *vdev,
108 				      struct wlan_cm_connect_resp *rsp)
109 {}
110 #endif
111 #endif /* __WLAN_HDD_CONNECTIVITY_LOGGING_H__ */
112