xref: /wlan-dirver/qca-wifi-host-cmn/target_if/son/src/target_if_son.c (revision 3149adf58a329e17232a4c0e58d460d025edd55a)
1 /*
2  * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
3  *
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 #include <target_if_son.h>
21 #include <target_if.h>
22 #include <wlan_lmac_if_def.h>
23 #include <wmi_unified_api.h>
24 #include <cdp_txrx_ctrl.h>
25 
26 #if QCA_SUPPORT_SON
27 
28 bool son_ol_is_peer_inact(struct wlan_objmgr_peer *peer)
29 {
30 	struct wlan_objmgr_vdev *vdev;
31 	struct wlan_objmgr_psoc *psoc;
32 
33 	vdev = wlan_peer_get_vdev(peer);
34 	if (!vdev)
35 		return false;
36 
37 	psoc = wlan_vdev_get_psoc(vdev);
38 	if (!psoc)
39 		return false;
40 
41 	return cdp_peer_is_inact(wlan_psoc_get_dp_handle(psoc),
42 				 (void *)(wlan_peer_get_dp_handle(peer)));
43 }
44 
45 u_int32_t son_ol_get_peer_rate(struct wlan_objmgr_peer *peer, u_int8_t type)
46 {
47 	return ol_if_peer_get_rate(peer, type);
48 }
49 
50 
51 bool son_ol_enable(struct wlan_objmgr_pdev *pdev, bool enable)
52 {
53 	struct wlan_objmgr_psoc *psoc;
54 
55 	psoc = wlan_pdev_get_psoc(pdev);
56 	if (!psoc)
57 		return false;
58 
59 	return cdp_start_inact_timer(wlan_psoc_get_dp_handle(psoc),
60 				(void *)(wlan_pdev_get_dp_handle(pdev)),
61 				enable);
62 }
63 
64 /* Function pointer to set overload status */
65 void son_ol_set_overload(struct wlan_objmgr_pdev *pdev, bool overload)
66 {
67 	struct wlan_objmgr_psoc *psoc;
68 
69 	psoc = wlan_pdev_get_psoc(pdev);
70 
71 	return cdp_set_overload(wlan_psoc_get_dp_handle(psoc),
72 				(void *)(wlan_pdev_get_dp_handle(pdev)),
73 				overload);
74 }
75 /* Function pointer to set band steering parameters */
76 bool son_ol_set_params(struct wlan_objmgr_pdev *pdev,
77 			    u_int32_t inactivity_check_period,
78 			    u_int32_t inactivity_threshold_normal,
79 			    u_int32_t inactivity_threshold_overload)
80 {
81 	struct wlan_objmgr_psoc *psoc;
82 
83 	psoc = wlan_pdev_get_psoc(pdev);
84 	return cdp_set_inact_params(wlan_psoc_get_dp_handle(psoc),
85 				(void *)wlan_pdev_get_dp_handle(pdev),
86 				inactivity_check_period,
87 				inactivity_threshold_normal,
88 				inactivity_threshold_overload);
89 }
90 
91 int8_t son_ol_sanitize_util_invtl(struct wlan_objmgr_pdev *pdev,
92 				  u_int32_t *sample_period,
93 				  u_int32_t *num_of_sample)
94 {
95 	return EOK;
96 }
97 
98 QDF_STATUS son_ol_send_null(struct wlan_objmgr_pdev *pdev,
99 			 u_int8_t *macaddr,
100 			 struct wlan_objmgr_vdev *vdev)
101 {
102 	struct stats_request_params param = {0};
103 	struct wlan_objmgr_psoc *psoc = NULL;
104 
105 	psoc = wlan_pdev_get_psoc(pdev);
106 
107 	if( !psoc)
108 		return QDF_STATUS_E_FAILURE;
109 
110 	param.vdev_id = wlan_vdev_get_id(vdev);
111 	param.stats_id = WMI_HOST_REQUEST_INST_STAT;
112 
113 	return wmi_unified_stats_request_send(GET_WMI_HDL_FROM_PSOC(psoc),
114 					macaddr, &param);
115 }
116 
117 int son_ol_lmac_create(struct wlan_objmgr_pdev *pdev)
118 {
119 	return EOK;
120 }
121 
122 int son_ol_lmac_destroy(struct wlan_objmgr_pdev *pdev)
123 {
124 	return EOK;
125 
126 }
127 
128 void  son_ol_rx_rssi_update(struct wlan_objmgr_pdev *pdev, u_int8_t *macaddres,
129 			    u_int8_t status, int8_t rssi, u_int8_t subtype)
130 {
131 	return;
132 
133 }
134 
135 void son_ol_rx_rate_update(struct wlan_objmgr_pdev *pdev, u_int8_t *macaddres,
136 			   u_int8_t status, u_int32_t rateKbps)
137 {
138 	return;
139 }
140 
141 void target_if_son_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
142 {
143 	/* wlan son related function handler */
144 	tx_ops->son_tx_ops.son_enable = son_ol_enable;
145 	tx_ops->son_tx_ops.set_overload = son_ol_set_overload;
146 	tx_ops->son_tx_ops.set_params = son_ol_set_params;
147 	tx_ops->son_tx_ops.lmac_create = son_ol_lmac_create;
148 	tx_ops->son_tx_ops.lmac_destroy = son_ol_lmac_destroy;
149 	tx_ops->son_tx_ops.son_send_null = son_ol_send_null;
150 	tx_ops->son_tx_ops.son_rssi_update = son_ol_rx_rssi_update;
151 	tx_ops->son_tx_ops.son_rate_update = son_ol_rx_rate_update;
152 	tx_ops->son_tx_ops.son_sanity_util_intvl = son_ol_sanitize_util_invtl;
153 	tx_ops->son_tx_ops.get_peer_rate = son_ol_get_peer_rate;
154 	tx_ops->son_tx_ops.son_node_isinact = son_ol_is_peer_inact;
155 	return;
156 }
157 #else
158 void target_if_son_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
159 {
160 	return;
161 }
162 int8_t son_ol_sanitize_util_intvl(struct wlan_objmgr_pdev *pdev,
163 				  u_int32_t *sample_period,
164 				  u_int32_t *num_of_sample)
165 {
166 	return -EINVAL;
167 
168 }
169 
170 u_int32_t son_ol_get_peer_rate(struct wlan_objmgr_peer *peer, u_int8_t type)
171 {
172 	return 0;
173 }
174 
175 
176 bool son_ol_enable(struct wlan_objmgr_pdev *pdev, bool enable)
177 {
178 	return -EINVAL;
179 
180 }
181 
182 
183 /* Function pointer to set overload status */
184 
185 void son_ol_set_overload(struct wlan_objmgr_pdev *pdev, bool overload)
186 {
187 	return;
188 }
189 
190 
191 /* Function pointer to set band steering parameters */
192 
193 bool son_ol_set_params(struct wlan_objmgr_pdev *dev,
194 			     u_int32_t inactivity_check_period,
195 			     u_int32_t inactivity_threshold_normal,
196 			     u_int32_t inactivity_threshold_overload)
197 {
198 	return -EINVAL;
199 }
200 
201 
202 
203 QDF_STATUS son_ol_send_null(struct wlan_objmgr_pdev *pdev,
204 			    u_int8_t *macaddr,
205 			    struct wlan_objmgr_vdev *vdev)
206 {
207 	return EOK;
208 }
209 int8_t son_ol_sanitize_util_invtl(struct wlan_objmgr_pdev *pdev,
210 				  u_int32_t *sample_period,
211 				  u_int32_t *num_of_sample)
212 {
213 	return EOK;
214 }
215 
216 int son_ol_lmac_create(struct wlan_objmgr_pdev *pdev)
217 {
218 	return EOK;
219 }
220 
221 
222 int son_ol_lmac_destroy(struct wlan_objmgr_pdev *pdev)
223 {
224 	return EOK;
225 
226 }
227 
228 
229 void  son_ol_rx_rssi_update(struct wlan_objmgr_pdev *pdev, u_int8_t *macaddres,
230 			    u_int8_t status, int8_t rssi, u_int8_t subtype)
231 {
232 	return;
233 
234 }
235 
236 void son_ol_rx_rate_update(struct wlan_objmgr_pdev *pdev, u_int8_t *macaddres,
237 			   u_int8_t status, u_int32_t rateKbps)
238 {
239 	return;
240 }
241 
242 bool son_ol_is_peer_inact(struct wlan_objmgr_peer *peer)
243 {
244 	return false;
245 }
246 #endif
247