xref: /wlan-driver/qcacld-3.0/core/hdd/src/wlan_hdd_son.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 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 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: contains son hdd API implementation
20  */
21 
22 #ifndef WLAN_HDD_SON_H
23 #define WLAN_HDD_SON_H
24 
25 #include <qdf_types.h>
26 #include <wlan_hdd_main.h>
27 
28 /*
29  * Determines type of event sent for MLME_EVENT_ASSOC_DISASSOC
30  * @ALD_ASSOC_EVENT: event name to send assoc event
31  * @ALD_DISASSOC_EVENT: event name to send disassoc event
32  */
33 enum assoc_disassoc_event {
34 	ALD_ASSOC_EVENT,
35 	ALD_DISASSOC_EVENT,
36 };
37 
38 #ifdef WLAN_FEATURE_SON
39 
40 /**
41  * hdd_son_register_callbacks() - register hdd callback for son
42  * @hdd_ctx: hdd context
43  *
44  * Return: void
45  */
46 void hdd_son_register_callbacks(struct hdd_context *hdd_ctx);
47 
48 /**
49  * hdd_son_deliver_acs_complete_event() - send acs complete event to son
50  * @adapter: adapter object
51  *
52  * Return: 0 if event is sent successfully
53  */
54 int hdd_son_deliver_acs_complete_event(struct hdd_adapter *adapter);
55 
56 /**
57  * hdd_son_deliver_cac_status_event() - send cac status to son
58  * @adapter: adapter object
59  * @freq: the operating frequency when radar is detected
60  * @radar_detected: true if radar is detected else false
61  *
62  * Return: 0 if event is sent successfully
63  */
64 int hdd_son_deliver_cac_status_event(struct hdd_adapter *adapter,
65 				     qdf_freq_t freq, bool radar_detected);
66 
67 /**
68  * hdd_son_deliver_assoc_disassoc_event() - send sta assoc disassoc event
69  *						to son
70  * @adapter: adapter object
71  * @sta_mac: Mac address of the sta
72  * @reason_code: reason code
73  * @flag: determines the type of event sent(Assoc/disassoc)
74  *
75  * Return: 0 if event is sent successfully
76  */
77 int hdd_son_deliver_assoc_disassoc_event(struct hdd_adapter *adapter,
78 					 struct qdf_mac_addr sta_mac,
79 					 uint32_t reason_code,
80 					 enum assoc_disassoc_event flag);
81 /**
82  * hdd_son_deliver_peer_authorize_event() - Deliver peer auth event to SON
83  * @link_info: Link info pointer in HDD adapter
84  * @peer_mac: Peer mac address
85  *
86  * Return: Void
87  */
88 void hdd_son_deliver_peer_authorize_event(struct wlan_hdd_link_info *link_info,
89 					  uint8_t *peer_mac);
90 
91 /**
92  * hdd_son_send_set_wifi_generic_command() - Send Generic SET command to SON
93  * @wiphy: standard kernel wiphy
94  * @wdev: wireless device
95  * @tb: NL attributes
96  *
97  * Return: 0 on success
98  */
99 int hdd_son_send_set_wifi_generic_command(struct wiphy *wiphy,
100 					  struct wireless_dev *wdev,
101 					  struct nlattr **tb);
102 
103 /**
104  * hdd_son_send_get_wifi_generic_command() - Send Generic GET command to SON
105  * @wiphy: standard kernel wiphy
106  * @wdev: wireless device
107  * @tb: NL attributes
108  *
109  * Return: 0 on success
110  */
111 int hdd_son_send_get_wifi_generic_command(struct wiphy *wiphy,
112 					  struct wireless_dev *wdev,
113 					  struct nlattr **tb);
114 
115 /**
116  * hdd_son_get_peer_max_mcs_idx() - Get peer max mcs index
117  * @vdev: vdev object
118  * @peer: peer obj
119  *
120  * Return: number of max mcs on success or 0 on failure
121  */
122 uint32_t hdd_son_get_peer_max_mcs_idx(struct wlan_objmgr_vdev *vdev,
123 				      struct wlan_objmgr_peer *peer);
124 
125 /**
126  * hdd_son_deliver_chan_change_event() - send chan change to SON
127  * @adapter: pointer to adapter
128  * @freq: new operating channel frequency
129  *
130  * Return: 0 on success
131  */
132 int hdd_son_deliver_chan_change_event(struct hdd_adapter *adapter,
133 				      qdf_freq_t freq);
134 #else
135 
hdd_son_register_callbacks(struct hdd_context * hdd_ctx)136 static inline void hdd_son_register_callbacks(struct hdd_context *hdd_ctx)
137 {
138 }
139 
140 static inline int
hdd_son_deliver_acs_complete_event(struct hdd_adapter * adapter)141 	hdd_son_deliver_acs_complete_event(struct hdd_adapter *adapter)
142 {
143 	return 0;
144 }
145 
146 static inline int
hdd_son_deliver_cac_status_event(struct hdd_adapter * adapter,qdf_freq_t freq,bool radar_detected)147 	hdd_son_deliver_cac_status_event(struct hdd_adapter *adapter,
148 					 qdf_freq_t freq, bool radar_detected)
149 {
150 	return 0;
151 }
152 
153 static inline int
hdd_son_deliver_assoc_disassoc_event(struct hdd_adapter * adapter,struct qdf_mac_addr sta_mac,uint32_t reason_code,enum assoc_disassoc_event flag)154 	hdd_son_deliver_assoc_disassoc_event(struct hdd_adapter *adapter,
155 					     struct qdf_mac_addr sta_mac,
156 					     uint32_t reason_code,
157 					     enum assoc_disassoc_event flag)
158 {
159 	return 0;
160 }
161 
162 static inline void
hdd_son_deliver_peer_authorize_event(struct wlan_hdd_link_info * link_info,uint8_t * peer_mac)163 hdd_son_deliver_peer_authorize_event(struct wlan_hdd_link_info *link_info,
164 				     uint8_t *peer_mac)
165 {
166 }
167 
168 static inline
hdd_son_send_set_wifi_generic_command(struct wiphy * wiphy,struct wireless_dev * wdev,struct nlattr ** tb)169 int hdd_son_send_set_wifi_generic_command(struct wiphy *wiphy,
170 					  struct wireless_dev *wdev,
171 					  struct nlattr **tb)
172 {
173 	return -EINVAL;
174 }
175 
176 static inline
hdd_son_send_get_wifi_generic_command(struct wiphy * wiphy,struct wireless_dev * wdev,struct nlattr ** tb)177 int hdd_son_send_get_wifi_generic_command(struct wiphy *wiphy,
178 					  struct wireless_dev *wdev,
179 					  struct nlattr **tb)
180 {
181 	return -EINVAL;
182 }
183 
184 static inline
hdd_son_get_peer_max_mcs_idx(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_peer * peer)185 uint32_t hdd_son_get_peer_max_mcs_idx(struct wlan_objmgr_vdev *vdev,
186 				      struct wlan_objmgr_peer *peer)
187 {
188 	return 0;
189 }
190 
191 static inline
hdd_son_deliver_chan_change_event(struct hdd_adapter * adapter,qdf_freq_t freq)192 int hdd_son_deliver_chan_change_event(struct hdd_adapter *adapter,
193 				      qdf_freq_t freq)
194 {
195 	return 0;
196 }
197 #endif /* WLAN_FEATURE_SON */
198 #endif
199