blob: 5c209565a4dfd557d89ee3348df3d6e7fbc8df63 [file] [log] [blame]
Dhanashri Atre9c222b12016-03-22 13:26:13 -07001/*
Sravan Goudd207ff22019-12-19 23:58:15 +05302 * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
Dhanashri Atre9c222b12016-03-22 13:26:13 -07003 *
Dhanashri Atre9c222b12016-03-22 13:26:13 -07004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Yun Park0d86d862017-04-02 14:01:43 -070019/**
Dhanashri Atre9c222b12016-03-22 13:26:13 -070020 * @file cdp_txrx_misc.h
Jeff Johnsonff2dfb22018-05-12 10:27:57 -070021 * @brief Define the host data path miscellaneous API functions
Dhanashri Atre9c222b12016-03-22 13:26:13 -070022 * called by the host control SW and the OS interface module
23 */
24#ifndef _CDP_TXRX_MISC_H_
25#define _CDP_TXRX_MISC_H_
26
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080027#include "cdp_txrx_handle.h"
Dhanashri Atre9c222b12016-03-22 13:26:13 -070028/**
Leo Changdb6358c2016-09-27 17:00:52 -070029 * cdp_tx_non_std() - Allow the control-path SW to send data frames
Rakesh Pillaid295d1e2019-09-11 08:00:36 +053030 * @soc: data path soc handle
31 * @vdev_id: id of vdev
32 * @tx_spec: what non-standard handling to apply to the tx data frames
33 * @msdu_list: NULL-terminated list of tx MSDUs
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -080034 *
35 * Generally, all tx data frames come from the OS shim into the txrx layer.
36 * However, there are rare cases such as TDLS messaging where the UMAC
37 * control-path SW creates tx data frames.
38 * This UMAC SW can call this function to provide the tx data frames to
39 * the txrx layer.
40 * The UMAC SW can request a callback for these data frames after their
41 * transmission completes, by using the ol_txrx_data_tx_cb_set function
42 * to register a tx completion callback, and by specifying
43 * ol_tx_spec_no_free as the tx_spec arg when giving the frames to
44 * ol_tx_non_std.
45 * The MSDUs need to have the appropriate L2 header type (802.3 vs. 802.11),
46 * as specified by ol_cfg_frame_type().
47 *
48 * Return: null - success, skb - failure
49 */
Leo Changdb6358c2016-09-27 17:00:52 -070050static inline qdf_nbuf_t
Rakesh Pillaid295d1e2019-09-11 08:00:36 +053051cdp_tx_non_std(ol_txrx_soc_handle soc, uint8_t vdev_id,
52 enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list)
Leo Changdb6358c2016-09-27 17:00:52 -070053{
54 if (!soc || !soc->ops || !soc->ops->misc_ops) {
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -070055 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
Leo Changdb6358c2016-09-27 17:00:52 -070056 "%s invalid instance", __func__);
57 return NULL;
58 }
59
60 if (soc->ops->misc_ops->tx_non_std)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +053061 return soc->ops->misc_ops->tx_non_std(soc, vdev_id, tx_spec,
62 msdu_list);
Leo Changdb6358c2016-09-27 17:00:52 -070063 return NULL;
64}
Dhanashri Atre9c222b12016-03-22 13:26:13 -070065
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -080066/**
Leo Changdb6358c2016-09-27 17:00:52 -070067 * cdp_set_ibss_vdev_heart_beat_timer() - Update ibss vdev heart
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -080068 * beat timer
Rakesh Pillaid295d1e2019-09-11 08:00:36 +053069 * @soc: data path soc handle
70 * @vdev_id: id of vdev
71 * @timer_value_sec: new heart beat timer value
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -080072 *
73 * Return: Old timer value set in vdev.
74 */
Leo Changdb6358c2016-09-27 17:00:52 -070075static inline uint16_t
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080076cdp_set_ibss_vdev_heart_beat_timer(ol_txrx_soc_handle soc,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +053077 uint8_t vdev_id, uint16_t timer_value_sec)
Leo Changdb6358c2016-09-27 17:00:52 -070078{
79 if (!soc || !soc->ops || !soc->ops->misc_ops) {
80 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
81 "%s invalid instance", __func__);
82 return 0;
83 }
84
85 if (soc->ops->misc_ops->set_ibss_vdev_heart_beat_timer)
86 return soc->ops->misc_ops->set_ibss_vdev_heart_beat_timer(
Rakesh Pillaid295d1e2019-09-11 08:00:36 +053087 soc, vdev_id, timer_value_sec);
Leo Changdb6358c2016-09-27 17:00:52 -070088
89 return 0;
90}
91
92/**
93 * cdp_set_wisa_mode() - set wisa mode
Rakesh Pillaid295d1e2019-09-11 08:00:36 +053094 * @soc: data path soc handle
95 * @vdev_id: vdev_id
96 * @enable: enable or disable
Leo Changdb6358c2016-09-27 17:00:52 -070097 *
98 * Return: QDF_STATUS_SUCCESS mode enable success
99 */
100static inline QDF_STATUS
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530101cdp_set_wisa_mode(ol_txrx_soc_handle soc, uint8_t vdev_id, bool enable)
Leo Changdb6358c2016-09-27 17:00:52 -0700102{
103 if (!soc || !soc->ops || !soc->ops->misc_ops) {
104 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
105 "%s invalid instance", __func__);
106 return QDF_STATUS_E_INVAL;
107 }
108
109 if (soc->ops->misc_ops->set_wisa_mode)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530110 return soc->ops->misc_ops->set_wisa_mode(soc, vdev_id, enable);
Leo Changdb6358c2016-09-27 17:00:52 -0700111 return QDF_STATUS_SUCCESS;
112}
113
114/**
Poddar, Siddarth5c57a892017-09-04 12:16:38 +0530115 * cdp_data_stall_cb_register() - register data stall callback
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530116 * @soc: data path soc handle
117 * @pdev_id: id of data path pdev handle
118 * @cb: callback function
Poddar, Siddarth5c57a892017-09-04 12:16:38 +0530119 *
120 * Return: QDF_STATUS_SUCCESS register success
121 */
122static inline QDF_STATUS cdp_data_stall_cb_register(ol_txrx_soc_handle soc,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530123 uint8_t pdev_id,
Poddar, Siddarth5c57a892017-09-04 12:16:38 +0530124 data_stall_detect_cb cb)
125{
126 if (!soc || !soc->ops || !soc->ops->misc_ops) {
127 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
128 "%s invalid instance", __func__);
129 return QDF_STATUS_E_INVAL;
130 }
131
132 if (soc->ops->misc_ops->txrx_data_stall_cb_register)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530133 return soc->ops->misc_ops->txrx_data_stall_cb_register(
134 soc, pdev_id, cb);
Poddar, Siddarth5c57a892017-09-04 12:16:38 +0530135 return QDF_STATUS_SUCCESS;
136}
137
138/**
139 * cdp_data_stall_cb_deregister() - de-register data stall callback
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530140 * @soc: data path soc handle
141 * @pdev_id: id of data path pdev handle
Poddar, Siddarth5c57a892017-09-04 12:16:38 +0530142 * @cb - callback function
143 *
144 * Return: QDF_STATUS_SUCCESS de-register success
145 */
146static inline QDF_STATUS cdp_data_stall_cb_deregister(ol_txrx_soc_handle soc,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530147 uint8_t pdev_id,
Poddar, Siddarth5c57a892017-09-04 12:16:38 +0530148 data_stall_detect_cb cb)
149{
150 if (!soc || !soc->ops || !soc->ops->misc_ops) {
151 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
152 "%s invalid instance", __func__);
153 return QDF_STATUS_E_INVAL;
154 }
155
156 if (soc->ops->misc_ops->txrx_data_stall_cb_deregister)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530157 return soc->ops->misc_ops->txrx_data_stall_cb_deregister(
158 soc, pdev_id, cb);
Poddar, Siddarth5c57a892017-09-04 12:16:38 +0530159 return QDF_STATUS_SUCCESS;
160}
161
162/**
163 * cdp_post_data_stall_event() - post data stall event
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530164 * @soc: data path soc handle
Poddar, Siddarth5c57a892017-09-04 12:16:38 +0530165 * @indicator: Module triggering data stall
166 * @data_stall_type: data stall event type
167 * @pdev_id: pdev id
168 * @vdev_id_bitmap: vdev id bitmap
169 * @recovery_type: data stall recovery type
170 *
171 * Return: None
172 */
173static inline void
174cdp_post_data_stall_event(ol_txrx_soc_handle soc,
175 enum data_stall_log_event_indicator indicator,
176 enum data_stall_log_event_type data_stall_type,
177 uint32_t pdev_id, uint32_t vdev_id_bitmap,
178 enum data_stall_log_recovery_type recovery_type)
179{
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -0700180 if (!soc || !soc->ops) {
Poddar, Siddarth5c57a892017-09-04 12:16:38 +0530181 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
182 "%s invalid instance", __func__);
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -0700183 QDF_BUG(0);
184 return;
185 }
Poddar, Siddarth5c57a892017-09-04 12:16:38 +0530186
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -0700187 if (!soc->ops->misc_ops ||
188 !soc->ops->misc_ops->txrx_post_data_stall_event)
189 return;
190
191 soc->ops->misc_ops->txrx_post_data_stall_event(
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530192 soc, indicator, data_stall_type, pdev_id,
Poddar, Siddarth5c57a892017-09-04 12:16:38 +0530193 vdev_id_bitmap, recovery_type);
194}
195
196/**
Leo Changdb6358c2016-09-27 17:00:52 -0700197 * cdp_set_wmm_param() - set wmm parameter
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530198 * @soc: data path soc handle
199 * @pdev_id: id of data path pdev handle
200 * @wmm_param: wmm parameter
Leo Changdb6358c2016-09-27 17:00:52 -0700201 *
202 * Return: none
203 */
204static inline void
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530205cdp_set_wmm_param(ol_txrx_soc_handle soc, uint8_t pdev_id,
206 struct ol_tx_wmm_param_t wmm_param)
Leo Changdb6358c2016-09-27 17:00:52 -0700207{
208 if (!soc || !soc->ops || !soc->ops->misc_ops) {
209 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
210 "%s invalid instance", __func__);
211 return;
212 }
213
214 if (soc->ops->misc_ops->set_wmm_param)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530215 return soc->ops->misc_ops->set_wmm_param(soc, pdev_id,
216 wmm_param);
Leo Changdb6358c2016-09-27 17:00:52 -0700217
218 return;
219}
220
221/**
222 * cdp_runtime_suspend() - suspend
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530223 * @soc: data path soc handle
224 * @pdev_id: id of data path pdev handle
Leo Changdb6358c2016-09-27 17:00:52 -0700225 *
226 * Return: QDF_STATUS_SUCCESS suspend success
227 */
228static inline QDF_STATUS cdp_runtime_suspend(ol_txrx_soc_handle soc,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530229 uint8_t pdev_id)
Leo Changdb6358c2016-09-27 17:00:52 -0700230{
231 if (!soc || !soc->ops || !soc->ops->misc_ops) {
232 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
233 "%s invalid instance", __func__);
234 return QDF_STATUS_E_INVAL;
235 }
236
237 if (soc->ops->misc_ops->runtime_suspend)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530238 return soc->ops->misc_ops->runtime_suspend(soc, pdev_id);
Leo Changdb6358c2016-09-27 17:00:52 -0700239
240 return QDF_STATUS_SUCCESS;
241}
242
243/**
244 * cdp_runtime_resume() - resume
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530245 * @soc: data path soc handle
246 * @pdev_id: id of data path pdev handle
Leo Changdb6358c2016-09-27 17:00:52 -0700247 *
248 * Return: QDF_STATUS_SUCCESS suspend success
249 */
250static inline QDF_STATUS cdp_runtime_resume(ol_txrx_soc_handle soc,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530251 uint8_t pdev_id)
Leo Changdb6358c2016-09-27 17:00:52 -0700252{
253 if (!soc || !soc->ops || !soc->ops->misc_ops) {
254 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
255 "%s invalid instance", __func__);
256 return QDF_STATUS_E_INVAL;
257 }
258
259 if (soc->ops->misc_ops->runtime_resume)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530260 return soc->ops->misc_ops->runtime_resume(soc, pdev_id);
Leo Changdb6358c2016-09-27 17:00:52 -0700261
262 return QDF_STATUS_SUCCESS;
263}
264
265/**
266 * cdp_hl_tdls_flag_reset() - tdls flag reset
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530267 * @soc: data path soc handle
268 * @vdev_id: id of vdev
269 * @flag: flag indicating to set/reset tdls
Leo Changdb6358c2016-09-27 17:00:52 -0700270 *
271 * Return: none
272 */
273static inline void
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530274cdp_hl_tdls_flag_reset(ol_txrx_soc_handle soc, uint8_t vdev_id, bool flag)
Leo Changdb6358c2016-09-27 17:00:52 -0700275{
276 if (!soc || !soc->ops || !soc->ops->misc_ops) {
277 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
278 "%s invalid instance", __func__);
279 return;
280 }
281
282 if (soc->ops->misc_ops->hl_tdls_flag_reset)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530283 return soc->ops->misc_ops->hl_tdls_flag_reset(soc, vdev_id,
284 flag);
Leo Changdb6358c2016-09-27 17:00:52 -0700285
286 return;
287}
288
289/**
290 * cdp_get_opmode() - get vdev operation mode
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530291 * @soc: data path soc handle
292 * @vdev_id: id of vdev
Leo Changdb6358c2016-09-27 17:00:52 -0700293 *
294 * Return virtual device operational mode
295 * op_mode_ap,
296 * op_mode_ibss,
297 * op_mode_sta,
298 * op_mode_monitor,
299 * op_mode_ocb,
300 *
301 * return interface id
302 * 0 unknown interface
303 */
304static inline int
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530305cdp_get_opmode(ol_txrx_soc_handle soc, uint8_t vdev_id)
Leo Changdb6358c2016-09-27 17:00:52 -0700306{
307 if (!soc || !soc->ops || !soc->ops->misc_ops) {
308 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
309 "%s invalid instance", __func__);
310 return 0;
311 }
312
313 if (soc->ops->misc_ops->get_opmode)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530314 return soc->ops->misc_ops->get_opmode(soc, vdev_id);
315
Leo Changdb6358c2016-09-27 17:00:52 -0700316 return 0;
317}
318
319/**
320 * cdp_get_vdev_id() - get vdev id
321 * @soc - data path soc handle
322 * @vdev - virtual interface instance
323 *
324 * get virtual interface id
325 *
326 * return interface id
327 * 0 unknown interface
328 */
329static inline uint16_t
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800330cdp_get_vdev_id(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Leo Changdb6358c2016-09-27 17:00:52 -0700331{
332 if (!soc || !soc->ops || !soc->ops->misc_ops) {
333 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
334 "%s invalid instance", __func__);
335 return 0;
336 }
337
338 if (soc->ops->misc_ops->get_vdev_id)
339 return soc->ops->misc_ops->get_vdev_id(vdev);
340 return 0;
341}
342
343/**
Alok Kumarf1d9fe22018-03-19 19:30:40 +0530344 * cdp_get_tx_ack_stats() - get tx ack count for vdev
345 * @soc - data path soc handle
346 * @vdev_id - vdev id
347 *
348 * return tx ack count
349 * 0 invalid count
350 */
351static inline uint32_t
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530352cdp_get_tx_ack_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
Alok Kumarf1d9fe22018-03-19 19:30:40 +0530353{
354 if (!soc || !soc->ops || !soc->ops->misc_ops) {
355 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
356 "%s invalid instance", __func__);
357 return 0;
358 }
359
360 if (soc->ops->misc_ops->get_tx_ack_stats)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530361 return soc->ops->misc_ops->get_tx_ack_stats(soc, vdev_id);
Sravan Kumar Kairamc71219e2019-04-19 22:08:16 +0530362
Alok Kumarf1d9fe22018-03-19 19:30:40 +0530363 return 0;
364}
365
366/**
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530367 * cdp_bad_peer_txctl_set_setting() - Set peer timer balance parameters
368 * @soc: data path soc handle
369 * @pdev_id: id of datapath pdev handle
370 * @enable: enable/disable peer balance state
371 * @period: balance timer period for peer
372 * @txq_limit: txp limit for peer
Leo Changdb6358c2016-09-27 17:00:52 -0700373 *
374 * Return: none
375 */
376static inline void
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530377cdp_bad_peer_txctl_set_setting(ol_txrx_soc_handle soc, uint8_t pdev_id,
378 int enable, int period, int txq_limit)
Leo Changdb6358c2016-09-27 17:00:52 -0700379{
380 if (!soc || !soc->ops || !soc->ops->misc_ops) {
381 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
382 "%s invalid instance", __func__);
383 return;
384 }
385
386 if (soc->ops->misc_ops->bad_peer_txctl_set_setting)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530387 return soc->ops->misc_ops->bad_peer_txctl_set_setting(
388 soc, pdev_id, enable, period,
389 txq_limit);
Leo Changdb6358c2016-09-27 17:00:52 -0700390 return;
391}
392
393/**
394 * cdp_bad_peer_txctl_update_threshold() - TBD
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530395 * @soc: data path soc handle
396 * @pdev_id: id of data path pdev handle
397 * @level: index of the threshold configuration
398 * @tput_thresh: peer balance throughput threshold
399 * @tx_limit: peer balance tx limit threshold
Leo Changdb6358c2016-09-27 17:00:52 -0700400 *
401 * TBD
402 *
403 * Return: none
404 */
405static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800406cdp_bad_peer_txctl_update_threshold(ol_txrx_soc_handle soc,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530407 uint8_t pdev_id, int level,
408 int tput_thresh, int tx_limit)
Leo Changdb6358c2016-09-27 17:00:52 -0700409{
410 if (!soc || !soc->ops || !soc->ops->misc_ops) {
411 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
412 "%s invalid instance", __func__);
413 return;
414 }
415
416 if (soc->ops->misc_ops->bad_peer_txctl_update_threshold)
417 return soc->ops->misc_ops->bad_peer_txctl_update_threshold(
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530418 soc, pdev_id, level, tput_thresh, tx_limit);
Leo Changdb6358c2016-09-27 17:00:52 -0700419 return;
420}
421
422/**
423 * cdp_mark_first_wakeup_packet() - set flag to indicate that
424 * fw is compatible for marking first packet after wow wakeup
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530425 * @soc: data path soc handle
426 * @pdev_id: id of data path pdev handle
Leo Changdb6358c2016-09-27 17:00:52 -0700427 * @value: 1 for enabled/ 0 for disabled
428 *
429 * Return: None
430 */
431static inline void cdp_mark_first_wakeup_packet(ol_txrx_soc_handle soc,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530432 uint8_t pdev_id, uint8_t value)
Leo Changdb6358c2016-09-27 17:00:52 -0700433{
434 if (!soc || !soc->ops || !soc->ops->misc_ops) {
435 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
436 "%s invalid instance", __func__);
437 return;
438 }
439
440 if (soc->ops->misc_ops->mark_first_wakeup_packet)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530441 return soc->ops->misc_ops->mark_first_wakeup_packet(
442 soc, pdev_id, value);
Leo Changdb6358c2016-09-27 17:00:52 -0700443 return;
444}
445
446
447/**
448 * cds_update_mac_id() - update mac_id for vdev
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530449 * @psoc: data path soc handle
Leo Changdb6358c2016-09-27 17:00:52 -0700450 * @vdev_id: vdev id
451 * @mac_id: mac id
452 *
453 * Return: none
454 */
455static inline void cdp_update_mac_id(void *psoc, uint8_t vdev_id,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530456 uint8_t mac_id)
Leo Changdb6358c2016-09-27 17:00:52 -0700457{
458 ol_txrx_soc_handle soc = psoc;
459
460 if (!soc || !soc->ops || !soc->ops->misc_ops) {
461 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
462 "%s invalid instance", __func__);
463 return;
464 }
465
466 if (soc->ops->misc_ops->update_mac_id)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530467 return soc->ops->misc_ops->update_mac_id(soc, vdev_id, mac_id);
Leo Changdb6358c2016-09-27 17:00:52 -0700468 return;
469}
470
471/**
472 * cdp_flush_rx_frames() - flush cached rx frames
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530473 * @soc: data path soc handle
474 * @pdev_id: datapath pdev identifier
475 * @peer_mac: peer mac address
Leo Changdb6358c2016-09-27 17:00:52 -0700476 * @drop: set flag to drop frames
477 *
478 * Return: None
479 */
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530480static inline void cdp_flush_rx_frames(ol_txrx_soc_handle soc, uint8_t pdev_id,
481 uint8_t *peer_mac, bool drop)
Leo Changdb6358c2016-09-27 17:00:52 -0700482{
483 if (!soc || !soc->ops || !soc->ops->misc_ops) {
484 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
485 "%s invalid instance", __func__);
486 return;
487 }
488
489 if (soc->ops->misc_ops->flush_rx_frames)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530490 return soc->ops->misc_ops->flush_rx_frames(soc, pdev_id,
491 peer_mac, drop);
Leo Changdb6358c2016-09-27 17:00:52 -0700492 return;
493}
494
495/*
496 * cdp_get_intra_bss_fwd_pkts_count() - to get the total tx and rx packets
497 * that has been forwarded from txrx layer without going to upper layers.
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530498 * @soc: Datapath soc handle
Leo Changdb6358c2016-09-27 17:00:52 -0700499 * @vdev_id: vdev id
500 * @fwd_tx_packets: pointer to forwarded tx packets count parameter
501 * @fwd_rx_packets: pointer to forwarded rx packets count parameter
502 *
503 * Return: status -> A_OK - success, A_ERROR - failure
504 */
505static inline A_STATUS cdp_get_intra_bss_fwd_pkts_count(
506 ol_txrx_soc_handle soc, uint8_t vdev_id,
507 uint64_t *fwd_tx_packets, uint64_t *fwd_rx_packets)
508{
509 if (!soc || !soc->ops || !soc->ops->misc_ops) {
510 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
511 "%s invalid instance", __func__);
512 return 0;
513 }
514
515 if (soc->ops->misc_ops->get_intra_bss_fwd_pkts_count)
516 return soc->ops->misc_ops->get_intra_bss_fwd_pkts_count(
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530517 soc, vdev_id, fwd_tx_packets, fwd_rx_packets);
Leo Changdb6358c2016-09-27 17:00:52 -0700518
519 return 0;
520}
521
522/**
523 * cdp_pkt_log_init() - API to initialize packet log
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530524 * @soc: data path soc handle
525 * @pdev_id: id of data path pdev handle
Leo Changdb6358c2016-09-27 17:00:52 -0700526 * @scn: HIF context
527 *
528 * Return: void
529 */
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800530static inline void cdp_pkt_log_init(ol_txrx_soc_handle soc,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530531 uint8_t pdev_id, void *scn)
Leo Changdb6358c2016-09-27 17:00:52 -0700532{
533 if (!soc || !soc->ops || !soc->ops->misc_ops) {
534 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
535 "%s invalid instance", __func__);
536 return;
537 }
538
539 if (soc->ops->misc_ops->pkt_log_init)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530540 return soc->ops->misc_ops->pkt_log_init(soc, pdev_id, scn);
Leo Changdb6358c2016-09-27 17:00:52 -0700541
542 return;
543}
544
545/**
546 * cdp_pkt_log_con_service() - API to connect packet log service
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530547 * @soc: data path soc handle
548 * @pdev_id: id of data path pdev handle
Leo Changdb6358c2016-09-27 17:00:52 -0700549 * @scn: HIF context
550 *
551 * Return: void
552 */
553static inline void cdp_pkt_log_con_service(ol_txrx_soc_handle soc,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530554 uint8_t pdev_id, void *scn)
Leo Changdb6358c2016-09-27 17:00:52 -0700555{
556 if (!soc || !soc->ops || !soc->ops->misc_ops) {
557 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
558 "%s invalid instance", __func__);
559 return;
560 }
561
562 if (soc->ops->misc_ops->pkt_log_con_service)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530563 return soc->ops->misc_ops->pkt_log_con_service(
564 soc, pdev_id, scn);
Leo Changdb6358c2016-09-27 17:00:52 -0700565
566 return;
567}
Mohit Khanna16816ae2018-10-30 14:12:03 -0700568
569/**
570 * cdp_get_num_rx_contexts() - API to get the number of RX contexts
571 * @soc: soc handle
572 *
573 * Return: number of RX contexts
574 */
575static inline int cdp_get_num_rx_contexts(ol_txrx_soc_handle soc)
576{
577 if (!soc || !soc->ops || !soc->ops->misc_ops) {
578 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
579 "%s invalid instance", __func__);
580 return 0;
581 }
582
583 if (soc->ops->misc_ops->get_num_rx_contexts)
584 return soc->ops->misc_ops->get_num_rx_contexts(soc);
585
586 return 0;
587}
Lin Bai324f4912018-12-13 16:13:24 +0800588
589/**
590 * cdp_register_packetdump_cb() - API to register packetdump callback
591 *
592 * Register TX/RX callback for data packets, during connection. And per packet
593 * stats will be passed to user-space by @tx_cb/@rx_cb.
594 *
595 * @soc: soc handle
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530596 * @pdev_id: id of data path pdev handle
Lin Bai324f4912018-12-13 16:13:24 +0800597 * @tx_cb: tx packet callback
598 * @rx_cb: rx packet callback
599 *
600 * Return: void
601 */
602static inline void cdp_register_packetdump_cb(ol_txrx_soc_handle soc,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530603 uint8_t pdev_id,
Lin Bai324f4912018-12-13 16:13:24 +0800604 ol_txrx_pktdump_cb tx_cb,
605 ol_txrx_pktdump_cb rx_cb)
606{
607 if (!soc || !soc->ops || !soc->ops->misc_ops) {
608 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
609 "%s invalid instance", __func__);
610 return;
611 }
612
613 if (soc->ops->misc_ops->register_pktdump_cb)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530614 return soc->ops->misc_ops->register_pktdump_cb(
615 soc, pdev_id, tx_cb, rx_cb);
Lin Bai324f4912018-12-13 16:13:24 +0800616}
617
618/**
619 * cdp_deregister_packetdump_cb() - API to unregister packetdump callback
620 *
621 * Deregister callback for TX/RX data packets.
622 *
623 * @soc: soc handle
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530624 * @pdev_id: id of data path pdev handle
Lin Bai324f4912018-12-13 16:13:24 +0800625 *
626 * Return: void
627 */
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530628static inline void cdp_deregister_packetdump_cb(ol_txrx_soc_handle soc,
629 uint8_t pdev_id)
Lin Bai324f4912018-12-13 16:13:24 +0800630{
631 if (!soc || !soc->ops || !soc->ops->misc_ops) {
632 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
633 "%s invalid instance", __func__);
634 return;
635 }
636
637 if (soc->ops->misc_ops->unregister_pktdump_cb)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530638 return soc->ops->misc_ops->unregister_pktdump_cb(soc, pdev_id);
Lin Bai324f4912018-12-13 16:13:24 +0800639}
Tiger Yu6f1fc002019-04-25 10:41:30 +0800640
Pavankumar Nandeshwar4c7b81b2019-09-27 11:27:12 +0530641typedef void (*rx_mic_error_callback)(struct cdp_ctrl_objmgr_psoc *psoc,
642 uint8_t pdev_id,
Rakshith Suresh Patkard863f8d2019-07-16 16:30:59 +0530643 struct cdp_rx_mic_err_info *info);
644
645/**
646 * cdp_register_rx_mic_error_ind_handler() - API to register mic error
647 * indication handler
648 *
649 * @soc: soc handle
650 * @rx_mic_cb: rx mic error indication callback
651 *
652 * Return: void
653 */
654static inline void
655cdp_register_rx_mic_error_ind_handler(ol_txrx_soc_handle soc,
656 rx_mic_error_callback rx_mic_cb)
657{
658 if (!soc || !soc->ol_ops) {
659 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
660 "%s invalid instance", __func__);
661 return;
662 }
663
664 soc->ol_ops->rx_mic_error = rx_mic_cb;
665}
666
Tiger Yu6f1fc002019-04-25 10:41:30 +0800667/**
668 * cdp_pdev_reset_driver_del_ack() - reset driver TCP delayed ack flag
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530669 * @soc: data path soc handle
670 * @pdev_id: pdev id
Tiger Yu6f1fc002019-04-25 10:41:30 +0800671 *
672 * Return: none
673 */
674static inline void cdp_pdev_reset_driver_del_ack(void *psoc,
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530675 uint8_t pdev_id)
Tiger Yu6f1fc002019-04-25 10:41:30 +0800676{
677 ol_txrx_soc_handle soc = psoc;
678
679 if (!soc || !soc->ops || !soc->ops->misc_ops) {
680 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
681 "%s invalid instance", __func__);
682 return;
683 }
684
685 if (soc->ops->misc_ops->pdev_reset_driver_del_ack)
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530686 return soc->ops->misc_ops->pdev_reset_driver_del_ack(soc,
687 pdev_id);
Tiger Yu6f1fc002019-04-25 10:41:30 +0800688}
689
690/*
691 * cdp_vdev_set_driver_del_ack_enable() - set driver delayed ack enabled flag
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530692 * @soc: data path soc handle
Tiger Yu6f1fc002019-04-25 10:41:30 +0800693 * @vdev_id: vdev id
694 * @rx_packets: number of rx packets
695 * @time_in_ms: time in ms
696 * @high_th: high threshold
697 * @low_th: low threshold
698 *
699 * Return: none
700 */
701static inline void cdp_vdev_set_driver_del_ack_enable(ol_txrx_soc_handle soc,
702 uint8_t vdev_id,
703 unsigned long rx_packets,
704 uint32_t time_in_ms,
705 uint32_t high_th,
706 uint32_t low_th)
707{
708 if (!soc || !soc->ops || !soc->ops->misc_ops) {
709 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
710 "%s invalid instance", __func__);
711 return;
712 }
713
714 if (soc->ops->misc_ops->vdev_set_driver_del_ack_enable)
715 return soc->ops->misc_ops->vdev_set_driver_del_ack_enable(
Rakesh Pillaid295d1e2019-09-11 08:00:36 +0530716 soc, vdev_id, rx_packets, time_in_ms, high_th, low_th);
Tiger Yu6f1fc002019-04-25 10:41:30 +0800717}
Nirav Shahaa6ca442019-11-13 18:17:05 +0530718
719static inline void cdp_vdev_set_bundle_require_flag(ol_txrx_soc_handle soc,
720 uint8_t vdev_id,
721 unsigned long tx_bytes,
722 uint32_t time_in_ms,
723 uint32_t high_th,
724 uint32_t low_th)
725{
726 if (!soc || !soc->ops || !soc->ops->misc_ops) {
727 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
728 "%s invalid instance", __func__);
729 return;
730 }
731
732 if (soc->ops->misc_ops->vdev_set_bundle_require_flag)
733 return soc->ops->misc_ops->vdev_set_bundle_require_flag(
734 vdev_id, tx_bytes, time_in_ms, high_th, low_th);
735}
736
737static inline void cdp_pdev_reset_bundle_require_flag(ol_txrx_soc_handle soc,
738 uint8_t pdev_id)
739{
740 if (!soc || !soc->ops || !soc->ops->misc_ops) {
741 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
742 "%s invalid instance", __func__);
743 return;
744 }
745
746 if (soc->ops->misc_ops->pdev_reset_bundle_require_flag)
747 return soc->ops->misc_ops->pdev_reset_bundle_require_flag(
748 soc, pdev_id);
749}
Sravan Goudd207ff22019-12-19 23:58:15 +0530750
751/**
752 * cdp_txrx_ext_stats_request(): request dp tx and rx extended stats
753 * @soc: soc handle
754 * @pdev_id: pdev id
755 * @req: stats request structure to fill
756 *
757 * return: status
758 */
759static inline QDF_STATUS
760cdp_txrx_ext_stats_request(ol_txrx_soc_handle soc, uint8_t pdev_id,
761 struct cdp_txrx_ext_stats *req)
762{
763 if (!soc || !soc->ops || !soc->ops->misc_ops || !req) {
764 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
765 "%s: Invalid Instance:", __func__);
766 return QDF_STATUS_E_INVAL;
767 }
768
769 if (soc->ops->misc_ops->txrx_ext_stats_request)
770 return soc->ops->misc_ops->txrx_ext_stats_request(soc, pdev_id,
771 req);
772
773 return QDF_STATUS_SUCCESS;
774}
775
776/**
777 * cdp_request_rx_hw_stats(): request rx hw stats
778 * @soc: soc handle
779 * @vdev_id: vdev id
780 *
781 * return: none
782 */
783static inline void
784cdp_request_rx_hw_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
785{
786 if (!soc || !soc->ops || !soc->ops->misc_ops) {
787 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
788 "%s: Invalid Instance:", __func__);
789 return;
790 }
791
792 if (soc->ops->misc_ops->request_rx_hw_stats)
793 soc->ops->misc_ops->request_rx_hw_stats(soc, vdev_id);
794}
795
796/**
797 * cdp_wait_for_ext_rx_stats(): wait for reo command status for stats
798 * @soc: soc handle
799 *
800 * return: status
801 */
802static inline QDF_STATUS
803cdp_wait_for_ext_rx_stats(ol_txrx_soc_handle soc)
804{
805 if (!soc || !soc->ops || !soc->ops->misc_ops) {
806 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
807 "%s: Invalid Instance:", __func__);
808 return QDF_STATUS_E_INVAL;
809 }
810
811 if (soc->ops->misc_ops->wait_for_ext_rx_stats)
812 return soc->ops->misc_ops->wait_for_ext_rx_stats(soc);
813
814 return QDF_STATUS_SUCCESS;
815}
816
Dhanashri Atre9c222b12016-03-22 13:26:13 -0700817#endif /* _CDP_TXRX_MISC_H_ */