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 interface prototypes for OS_IF layer
20 */
21
22 #include <qdf_trace.h>
23 #include <son_ucfg_api.h>
24 #include <wlan_mlme_main.h>
25 #include <init_deinit_lmac.h>
26
27 qdf_freq_t
ucfg_son_get_operation_chan_freq_vdev_id(struct wlan_objmgr_pdev * pdev,uint8_t vdev_id)28 ucfg_son_get_operation_chan_freq_vdev_id(struct wlan_objmgr_pdev *pdev,
29 uint8_t vdev_id)
30 {
31 return wlan_get_operation_chan_freq_vdev_id(pdev, vdev_id);
32 }
33
ucfg_son_get_min_and_max_power(struct wlan_objmgr_psoc * psoc,int8_t * max_tx_power,int8_t * min_tx_power)34 void ucfg_son_get_min_and_max_power(struct wlan_objmgr_psoc *psoc,
35 int8_t *max_tx_power,
36 int8_t *min_tx_power)
37 {
38 struct wlan_psoc_target_capability_info *target_cap =
39 lmac_get_target_cap(psoc);
40
41 *max_tx_power = 0;
42 *min_tx_power = 0;
43
44 if (target_cap) {
45 *max_tx_power = target_cap->hw_max_tx_power;
46 *min_tx_power = target_cap->hw_min_tx_power;
47 }
48 }
49
ucfg_son_is_cac_in_progress(struct wlan_objmgr_vdev * vdev)50 bool ucfg_son_is_cac_in_progress(struct wlan_objmgr_vdev *vdev)
51 {
52 return QDF_IS_STATUS_SUCCESS(wlan_vdev_is_dfs_cac_wait(vdev));
53 }
54
ucfg_son_get_sta_count(struct wlan_objmgr_vdev * vdev)55 uint32_t ucfg_son_get_sta_count(struct wlan_objmgr_vdev *vdev)
56 {
57 uint32_t sta_count = wlan_vdev_get_peer_count(vdev);
58
59 /* Don't include self peer in the count */
60 if (sta_count > 0)
61 --sta_count;
62
63 return sta_count;
64 }
65
ucfg_son_get_chan_flag(struct wlan_objmgr_pdev * pdev,qdf_freq_t freq,bool flag_160,struct ch_params * chan_params)66 uint32_t ucfg_son_get_chan_flag(struct wlan_objmgr_pdev *pdev,
67 qdf_freq_t freq, bool flag_160,
68 struct ch_params *chan_params)
69 {
70 return wlan_son_get_chan_flag(pdev, freq, flag_160,
71 chan_params);
72 }
73
ucfg_son_set_peer_kickout_allow(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_peer * peer,bool kickout_allow)74 QDF_STATUS ucfg_son_set_peer_kickout_allow(struct wlan_objmgr_vdev *vdev,
75 struct wlan_objmgr_peer *peer,
76 bool kickout_allow)
77 {
78 return wlan_son_peer_set_kickout_allow(vdev, peer, kickout_allow);
79 }
80
ucfg_son_register_deliver_opmode_cb(struct wlan_objmgr_psoc * psoc,mlme_deliver_cb cb)81 QDF_STATUS ucfg_son_register_deliver_opmode_cb(struct wlan_objmgr_psoc *psoc,
82 mlme_deliver_cb cb)
83 {
84 return wlan_son_register_mlme_deliver_cb(psoc, cb,
85 SON_MLME_DELIVER_CB_TYPE_OPMODE);
86 }
87
ucfg_son_register_deliver_smps_cb(struct wlan_objmgr_psoc * psoc,mlme_deliver_cb cb)88 QDF_STATUS ucfg_son_register_deliver_smps_cb(struct wlan_objmgr_psoc *psoc,
89 mlme_deliver_cb cb)
90 {
91 return wlan_son_register_mlme_deliver_cb(psoc, cb,
92 SON_MLME_DELIVER_CB_TYPE_SMPS);
93 }
94
ucfg_son_cbs_init(void)95 int ucfg_son_cbs_init(void)
96 {
97 return wlan_son_cbs_init();
98 }
99
ucfg_son_cbs_deinit(void)100 int ucfg_son_cbs_deinit(void)
101 {
102 return wlan_son_cbs_deinit();
103 }
104
ucfg_son_set_cbs(struct wlan_objmgr_vdev * vdev,bool enable)105 int ucfg_son_set_cbs(struct wlan_objmgr_vdev *vdev,
106 bool enable)
107 {
108 return wlan_son_set_cbs(vdev, enable);
109 }
110
ucfg_son_set_cbs_wait_time(struct wlan_objmgr_vdev * vdev,uint32_t val)111 int ucfg_son_set_cbs_wait_time(struct wlan_objmgr_vdev *vdev,
112 uint32_t val)
113 {
114 return wlan_son_set_cbs_wait_time(vdev, val);
115 }
116
ucfg_son_set_cbs_dwell_split_time(struct wlan_objmgr_vdev * vdev,uint32_t val)117 int ucfg_son_set_cbs_dwell_split_time(struct wlan_objmgr_vdev *vdev,
118 uint32_t val)
119 {
120 return wlan_son_set_cbs_dwell_split_time(vdev, val);
121 }
122
ucfg_son_disable_cbs(struct wlan_objmgr_vdev * vdev)123 int ucfg_son_disable_cbs(struct wlan_objmgr_vdev *vdev)
124 {
125 return wlan_son_cbs_disable(vdev);
126 }
127
ucfg_son_get_tx_power(struct element_info assoc_req_ies)128 uint8_t ucfg_son_get_tx_power(struct element_info assoc_req_ies)
129 {
130 return wlan_son_get_node_tx_power(assoc_req_ies);
131 }
132
ucfg_son_get_peer_rrm_info(struct element_info assoc_req_ies,uint8_t * rrmcaps,bool * is_beacon_meas_supported)133 QDF_STATUS ucfg_son_get_peer_rrm_info(struct element_info assoc_req_ies,
134 uint8_t *rrmcaps,
135 bool *is_beacon_meas_supported)
136 {
137 return wlan_son_get_peer_rrm_info(assoc_req_ies, rrmcaps,
138 is_beacon_meas_supported);
139 }
140
141 QDF_STATUS
ucfg_son_vdev_get_supported_txrx_streams(struct wlan_objmgr_vdev * vdev,uint32_t * num_tx_streams,uint32_t * num_rx_streams)142 ucfg_son_vdev_get_supported_txrx_streams(struct wlan_objmgr_vdev *vdev,
143 uint32_t *num_tx_streams,
144 uint32_t *num_rx_streams)
145 {
146 return wlan_son_vdev_get_supported_txrx_streams(vdev,
147 num_tx_streams,
148 num_rx_streams);
149 }
150
ucfg_son_get_vht_cap(struct wlan_objmgr_psoc * psoc,int32_t * vht_caps)151 QDF_STATUS ucfg_son_get_vht_cap(struct wlan_objmgr_psoc *psoc,
152 int32_t *vht_caps)
153 {
154 struct wlan_psoc_target_capability_info *target_cap =
155 lmac_get_target_cap(psoc);
156
157 if (!target_cap)
158 return QDF_STATUS_E_NULL_VALUE;
159 *vht_caps = target_cap->vht_cap_info;
160 return QDF_STATUS_SUCCESS;
161 }
162