1 /*
2 * Copyright (c) 2019 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: wlan_vdev_mgr_ucfg_api.c
22 *
23 * This file provides definitions to APIs to get/set mlme fields in
24 * vdev mlme core data structures
25 */
26 #include <wlan_vdev_mgr_tgt_if_tx_api.h>
27 #include "wlan_vdev_mgr_ucfg_api.h"
28 #include "include/wlan_vdev_mlme.h"
29 #include <wlan_mlme_dbg.h>
30 #include <wlan_vdev_mgr_utils_api.h>
31 #include <wlan_vdev_mlme_api.h>
32 #include <qdf_module.h>
33 #include <wlan_vdev_mgr_api.h>
34
ucfg_wlan_vdev_mgr_get_param_bssid(struct wlan_objmgr_vdev * vdev,uint8_t * bssid)35 void ucfg_wlan_vdev_mgr_get_param_bssid(
36 struct wlan_objmgr_vdev *vdev,
37 uint8_t *bssid)
38 {
39 wlan_vdev_mgr_get_param_bssid(vdev, bssid);
40 }
41 qdf_export_symbol(ucfg_wlan_vdev_mgr_get_param_bssid);
42
ucfg_wlan_vdev_mgr_get_param_ssid(struct wlan_objmgr_vdev * vdev,uint8_t * ssid,uint8_t * ssid_len)43 void ucfg_wlan_vdev_mgr_get_param_ssid(
44 struct wlan_objmgr_vdev *vdev,
45 uint8_t *ssid, uint8_t *ssid_len)
46 {
47 struct vdev_mlme_mgmt *mlme_mgmt;
48 struct vdev_mlme_obj *vdev_mlme;
49
50 vdev_mlme = wlan_objmgr_vdev_get_comp_private_obj(
51 vdev, WLAN_UMAC_COMP_MLME);
52
53 if (!vdev_mlme) {
54 QDF_ASSERT(0);
55 return;
56 }
57
58 mlme_mgmt = &vdev_mlme->mgmt;
59
60 *ssid_len = mlme_mgmt->generic.ssid_len;
61 qdf_mem_copy(ssid, mlme_mgmt->generic.ssid,
62 mlme_mgmt->generic.ssid_len);
63 }
64
65 qdf_export_symbol(ucfg_wlan_vdev_mgr_get_param_ssid);
66
ucfg_wlan_vdev_mgr_get_beacon_buffer(struct wlan_objmgr_vdev * vdev,qdf_nbuf_t buf)67 void ucfg_wlan_vdev_mgr_get_beacon_buffer(
68 struct wlan_objmgr_vdev *vdev,
69 qdf_nbuf_t buf)
70 {
71 struct vdev_mlme_obj *vdev_mlme;
72 struct vdev_mlme_mgmt *mlme_mgmt;
73
74 vdev_mlme = wlan_objmgr_vdev_get_comp_private_obj(
75 vdev, WLAN_UMAC_COMP_MLME);
76
77 if (!vdev_mlme) {
78 QDF_ASSERT(0);
79 return;
80 }
81
82 mlme_mgmt = &vdev_mlme->mgmt;
83
84 buf = mlme_mgmt->beacon_info.beacon_buffer;
85 }
86
87 qdf_export_symbol(ucfg_wlan_vdev_mgr_get_beacon_buffer);
88
ucfg_wlan_vdev_mgr_get_trans_bssid(struct wlan_objmgr_vdev * vdev,uint8_t * addr)89 void ucfg_wlan_vdev_mgr_get_trans_bssid(
90 struct wlan_objmgr_vdev *vdev,
91 uint8_t *addr)
92 {
93 struct vdev_mlme_obj *vdev_mlme;
94 struct vdev_mlme_mgmt *mlme_mgmt;
95
96 vdev_mlme = wlan_objmgr_vdev_get_comp_private_obj(
97 vdev, WLAN_UMAC_COMP_MLME);
98
99 if (!vdev_mlme) {
100 QDF_ASSERT(0);
101 return;
102 }
103
104 mlme_mgmt = &vdev_mlme->mgmt;
105
106 qdf_mem_copy(addr, mlme_mgmt->mbss_11ax.trans_bssid, QDF_MAC_ADDR_SIZE);
107 }
108
109 qdf_export_symbol(ucfg_wlan_vdev_mgr_get_trans_bssid);
110
ucfg_wlan_vdev_mgr_get_tsf_adjust(struct wlan_objmgr_vdev * vdev,uint64_t * tsf_adjust)111 void ucfg_wlan_vdev_mgr_get_tsf_adjust(
112 struct wlan_objmgr_vdev *vdev,
113 uint64_t *tsf_adjust)
114 {
115 struct vdev_mlme_obj *vdev_mlme;
116 struct vdev_mlme_proto *mlme_proto;
117
118 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
119
120 if (!vdev_mlme) {
121 mlme_err("VDEV MLME is NULL");
122 return;
123 }
124
125 mlme_proto = &vdev_mlme->proto;
126
127 *tsf_adjust = mlme_proto->generic.tsfadjust;
128 }
129
130 qdf_export_symbol(ucfg_wlan_vdev_mgr_get_tsf_adjust);
131
ucfg_wlan_vdev_mgr_set_param(struct wlan_objmgr_vdev * vdev,enum wlan_mlme_cfg_id param_id,struct wlan_vdev_mgr_cfg mlme_cfg)132 QDF_STATUS ucfg_wlan_vdev_mgr_set_param(
133 struct wlan_objmgr_vdev *vdev,
134 enum wlan_mlme_cfg_id param_id,
135 struct wlan_vdev_mgr_cfg mlme_cfg)
136 {
137 struct vdev_mlme_obj *vdev_mlme;
138
139 vdev_mlme = wlan_objmgr_vdev_get_comp_private_obj(
140 vdev,
141 WLAN_UMAC_COMP_MLME);
142
143 if (!vdev_mlme) {
144 QDF_ASSERT(0);
145 return QDF_STATUS_E_FAILURE;
146 }
147
148 return wlan_util_vdev_mlme_set_param(vdev_mlme, param_id, mlme_cfg);
149 }
150
151 qdf_export_symbol(ucfg_wlan_vdev_mgr_set_param);
152
ucfg_wlan_vdev_mgr_get_param(struct wlan_objmgr_vdev * vdev,enum wlan_mlme_cfg_id param_id,uint32_t * value)153 void ucfg_wlan_vdev_mgr_get_param(
154 struct wlan_objmgr_vdev *vdev,
155 enum wlan_mlme_cfg_id param_id,
156 uint32_t *value)
157 {
158 struct vdev_mlme_obj *vdev_mlme;
159
160 vdev_mlme = wlan_objmgr_vdev_get_comp_private_obj(
161 vdev,
162 WLAN_UMAC_COMP_MLME);
163
164 if (!vdev_mlme) {
165 QDF_ASSERT(0);
166 return;
167 }
168
169 wlan_util_vdev_mlme_get_param(vdev_mlme, param_id, value);
170 }
171
172 qdf_export_symbol(ucfg_wlan_vdev_mgr_get_param);
173
174 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
ucfg_vdev_mgr_cdp_vdev_attach(struct wlan_objmgr_vdev * vdev)175 QDF_STATUS ucfg_vdev_mgr_cdp_vdev_attach(struct wlan_objmgr_vdev *vdev)
176 {
177 struct vdev_mlme_obj *vdev_mlme;
178
179 vdev_mlme = wlan_objmgr_vdev_get_comp_private_obj(
180 vdev,
181 WLAN_UMAC_COMP_MLME);
182
183 if (!vdev_mlme)
184 return QDF_STATUS_E_FAILURE;
185
186 return vdev_mgr_cdp_vdev_attach(vdev_mlme);
187 }
188
189 qdf_export_symbol(ucfg_vdev_mgr_cdp_vdev_attach);
190
ucfg_vdev_mgr_cdp_vdev_detach(struct wlan_objmgr_vdev * vdev)191 QDF_STATUS ucfg_vdev_mgr_cdp_vdev_detach(struct wlan_objmgr_vdev *vdev)
192 {
193 struct vdev_mlme_obj *vdev_mlme;
194
195 vdev_mlme = wlan_objmgr_vdev_get_comp_private_obj(
196 vdev,
197 WLAN_UMAC_COMP_MLME);
198
199 if (!vdev_mlme) {
200 QDF_ASSERT(0);
201 return QDF_STATUS_E_FAILURE;
202 }
203
204 return vdev_mgr_cdp_vdev_detach(vdev_mlme);
205 }
206
207 qdf_export_symbol(ucfg_vdev_mgr_cdp_vdev_detach);
208 #endif
209
210 void
ucfg_util_vdev_mgr_set_acs_mode_for_vdev(struct wlan_objmgr_vdev * vdev,bool is_acs_mode)211 ucfg_util_vdev_mgr_set_acs_mode_for_vdev(struct wlan_objmgr_vdev *vdev,
212 bool is_acs_mode)
213 {
214 wlan_util_vdev_mgr_set_acs_mode_for_vdev(vdev, is_acs_mode);
215 }
216