blob: c80c9cbf1ab739246dbdae5390d32191221d7818 [file] [log] [blame]
Dhanashri Atre5b646482016-03-22 12:22:41 -07001/*
Vivek Natarajan95f004f2019-01-10 22:15:46 +05302 * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
Dhanashri Atre5b646482016-03-22 12:22:41 -07003 *
Dhanashri Atre5b646482016-03-22 12:22:41 -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 Park21cd32f2017-04-03 10:38:31 -070019/**
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053020 * @file cdp_txrx_cmn.h
Dhanashri Atre5b646482016-03-22 12:22:41 -070021 * @brief Define the host data path converged API functions
22 * called by the host control SW and the OS interface module
23 */
24#ifndef _CDP_TXRX_CMN_H_
25#define _CDP_TXRX_CMN_H_
26
Dhanashri Atre5b646482016-03-22 12:22:41 -070027#include "qdf_types.h"
28#include "qdf_nbuf.h"
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053029#include "cdp_txrx_ops.h"
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080030#include "cdp_txrx_handle.h"
Venkata Sharath Chandra Manchalaa77da0d2017-02-27 22:44:37 -080031#include "cdp_txrx_cmn_struct.h"
Krunal Soni03ba0f52019-02-12 11:44:46 -080032
33#ifdef ENABLE_VERBOSE_DEBUG
34extern bool is_dp_verbose_debug_enabled;
35#endif
36
Dhanashri Atre5b646482016-03-22 12:22:41 -070037/******************************************************************************
38 *
39 * Common Data Path Header File
40 *
41 *****************************************************************************/
Mohit Khanna7ac554b2018-05-24 11:58:13 -070042#define dp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP, params)
43#define dp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params)
44#define dp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP, params)
Mohit Khanna287adee2018-11-28 17:09:34 -080045#define dp_info(params...) \
46 __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
Mohit Khanna7ac554b2018-05-24 11:58:13 -070047#define dp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
Krunal Soni03ba0f52019-02-12 11:44:46 -080048#ifdef ENABLE_VERBOSE_DEBUG
49/**
50 * @enum verbose_debug_module:
51 * if INI "enable_verbose_debug" has to set following bit positions to enable
52 * respective module's excessive logging,
53 *
54 * @hif_verbose_debug_mask: 1st bit [0th index] is for HIF module
55 * @hal_verbose_debug_mask: 2nd bit [1st index] is for HAL module
56 * @dp_verbose_debug_mask: 3rd bit [2nd index] is for DP module
57 */
58enum verbose_debug_module {
59 hif_vebose_debug_mask = 1 << 0,
60 hal_verbose_debug_mask = 1 << 1,
61 dp_verbose_debug_mask = 1 << 2,
62};
63
64#define dp_verbose_debug(params...) \
65 if (unlikely(is_dp_verbose_debug_enabled)) \
66 do {\
67 QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params); \
68 } while (0)
69#else
70#define dp_verbose_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
71#endif
Dhanashri Atre5b646482016-03-22 12:22:41 -070072
Mohit Khanna287adee2018-11-28 17:09:34 -080073#define dp_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_DP, params)
74#define dp_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DP, params)
75#define dp_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_DP, params)
76#define dp_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_DP, params)
77#define dp_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_DP, params)
78
Venkata Sharath Chandra Manchala87479582018-08-01 12:45:34 -070079static inline QDF_STATUS
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053080cdp_soc_attach_target(ol_txrx_soc_handle soc)
81{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -070082 if (!soc || !soc->ops) {
83 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
84 "%s: Invalid Instance:", __func__);
85 QDF_BUG(0);
Venkata Sharath Chandra Manchala87479582018-08-01 12:45:34 -070086 return QDF_STATUS_E_INVAL;
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -070087 }
88
89 if (!soc->ops->cmn_drv_ops ||
90 !soc->ops->cmn_drv_ops->txrx_soc_attach_target)
Venkata Sharath Chandra Manchala87479582018-08-01 12:45:34 -070091 return QDF_STATUS_SUCCESS;
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -070092
93 return soc->ops->cmn_drv_ops->txrx_soc_attach_target(soc);
94
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053095}
Dhanashri Atre5b646482016-03-22 12:22:41 -070096
Bharat Kumar M9a5d5372017-05-08 17:41:42 +053097static inline int
98cdp_soc_get_nss_cfg(ol_txrx_soc_handle soc)
99{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700100 if (!soc || !soc->ops) {
101 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
102 "%s: Invalid Instance:", __func__);
103 QDF_BUG(0);
104 return 0;
105 }
106
107 if (!soc->ops->cmn_drv_ops ||
108 !soc->ops->cmn_drv_ops->txrx_soc_get_nss_cfg)
109 return 0;
110
111 return soc->ops->cmn_drv_ops->txrx_soc_get_nss_cfg(soc);
Bharat Kumar M9a5d5372017-05-08 17:41:42 +0530112}
113
114static inline void
115cdp_soc_set_nss_cfg(ol_txrx_soc_handle soc, uint32_t config)
116{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700117 if (!soc || !soc->ops) {
118 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
119 "%s: Invalid Instance:", __func__);
120 QDF_BUG(0);
121 return;
122 }
123
124 if (!soc->ops->cmn_drv_ops ||
125 !soc->ops->cmn_drv_ops->txrx_soc_set_nss_cfg)
126 return;
127
128 soc->ops->cmn_drv_ops->txrx_soc_set_nss_cfg(soc, config);
Bharat Kumar M9a5d5372017-05-08 17:41:42 +0530129}
130
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800131static inline struct cdp_vdev *
132cdp_vdev_attach(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530133 uint8_t *vdev_mac_addr, uint8_t vdev_id, enum wlan_op_mode op_mode)
134{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700135 if (!soc || !soc->ops) {
136 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
137 "%s: Invalid Instance:", __func__);
138 QDF_BUG(0);
139 return NULL;
140 }
141
142 if (!soc->ops->cmn_drv_ops ||
143 !soc->ops->cmn_drv_ops->txrx_vdev_attach)
144 return NULL;
145
146 return soc->ops->cmn_drv_ops->txrx_vdev_attach(pdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530147 vdev_mac_addr, vdev_id, op_mode);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530148}
Manjunathappa Prakash38205cc2018-03-06 14:22:44 -0800149#ifndef CONFIG_WIN
150/**
151 * cdp_flow_pool_map() - Create flow pool for vdev
152 * @soc - data path soc handle
153 * @pdev
154 * @vdev_id - vdev_id corresponding to vdev start
155 *
156 * Create per vdev flow pool.
157 *
158 * return none
159 */
160static inline QDF_STATUS cdp_flow_pool_map(ol_txrx_soc_handle soc,
161 struct cdp_pdev *pdev, uint8_t vdev_id)
162{
163 if (!soc || !soc->ops) {
164 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
Chaithanya Garrepalli9cc562c2018-11-16 18:30:41 +0530165 "%s: Invalid Instance:", __func__);
Manjunathappa Prakash38205cc2018-03-06 14:22:44 -0800166 QDF_BUG(0);
167 return QDF_STATUS_E_INVAL;
168 }
169
170 if (!soc->ops->flowctl_ops ||
171 !soc->ops->flowctl_ops->flow_pool_map_handler)
172 return QDF_STATUS_E_INVAL;
173
174 return soc->ops->flowctl_ops->flow_pool_map_handler(soc, pdev, vdev_id);
175}
176
177/**
178 * cdp_flow_pool_unmap() - Delete flow pool
179 * @soc - data path soc handle
180 * @pdev
181 * @vdev_id - vdev_id corresponding to vdev start
182 *
183 * Delete flow pool
184 *
185 * return none
186 */
187static inline void cdp_flow_pool_unmap(ol_txrx_soc_handle soc,
188 struct cdp_pdev *pdev, uint8_t vdev_id)
189{
190 if (!soc || !soc->ops) {
191 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
192 "%s: Invalid Instance:", __func__);
193 QDF_BUG(0);
194 return;
195 }
196
197 if (!soc->ops->flowctl_ops ||
198 !soc->ops->flowctl_ops->flow_pool_unmap_handler)
199 return;
200
201 return soc->ops->flowctl_ops->flow_pool_unmap_handler(soc, pdev,
202 vdev_id);
203}
204#endif
Dhanashri Atre5b646482016-03-22 12:22:41 -0700205
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530206static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800207cdp_vdev_detach(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530208 ol_txrx_vdev_delete_cb callback, void *cb_context)
209{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700210 if (!soc || !soc->ops) {
211 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
212 "%s: Invalid Instance:", __func__);
213 QDF_BUG(0);
214 return;
215 }
216
217 if (!soc->ops->cmn_drv_ops ||
218 !soc->ops->cmn_drv_ops->txrx_vdev_detach)
219 return;
220
221 soc->ops->cmn_drv_ops->txrx_vdev_detach(vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530222 callback, cb_context);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530223}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700224
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530225static inline int
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800226cdp_pdev_attach_target(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530227{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700228 if (!soc || !soc->ops) {
229 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
230 "%s: Invalid Instance:", __func__);
231 QDF_BUG(0);
232 return 0;
233 }
234
235 if (!soc->ops->cmn_drv_ops ||
236 !soc->ops->cmn_drv_ops->txrx_pdev_attach_target)
237 return 0;
238
239 return soc->ops->cmn_drv_ops->txrx_pdev_attach_target(pdev);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530240}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700241
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800242static inline struct cdp_pdev *cdp_pdev_attach
Akshay Kosigi1a9c6d12018-04-26 00:54:23 +0530243 (ol_txrx_soc_handle soc, struct cdp_ctrl_objmgr_pdev *ctrl_pdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530244 HTC_HANDLE htc_pdev, qdf_device_t osdev, uint8_t pdev_id)
245{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700246 if (!soc || !soc->ops) {
247 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
248 "%s: Invalid Instance:", __func__);
249 QDF_BUG(0);
250 return NULL;
251 }
252
253 if (!soc->ops->cmn_drv_ops ||
254 !soc->ops->cmn_drv_ops->txrx_pdev_attach)
255 return NULL;
256
257 return soc->ops->cmn_drv_ops->txrx_pdev_attach(soc, ctrl_pdev,
258 htc_pdev, osdev, pdev_id);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530259}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700260
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800261static inline int cdp_pdev_post_attach(ol_txrx_soc_handle soc,
262 struct cdp_pdev *pdev)
Leo Changdb6358c2016-09-27 17:00:52 -0700263{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700264 if (!soc || !soc->ops) {
265 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
266 "%s: Invalid Instance:", __func__);
267 QDF_BUG(0);
268 return 0;
269 }
270
271 if (!soc->ops->cmn_drv_ops ||
272 !soc->ops->cmn_drv_ops->txrx_pdev_post_attach)
273 return 0;
274
275 return soc->ops->cmn_drv_ops->txrx_pdev_post_attach(pdev);
Leo Changdb6358c2016-09-27 17:00:52 -0700276}
277
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530278static inline void
Himanshu Agarwalb7e3c982017-02-23 16:26:33 +0530279cdp_pdev_pre_detach(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, int force)
280{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700281 if (!soc || !soc->ops) {
282 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
283 "%s: Invalid Instance:", __func__);
284 QDF_BUG(0);
285 return;
286 }
287
288 if (!soc->ops->cmn_drv_ops ||
289 !soc->ops->cmn_drv_ops->txrx_pdev_pre_detach)
290 return;
291
292 soc->ops->cmn_drv_ops->txrx_pdev_pre_detach(pdev, force);
Himanshu Agarwalb7e3c982017-02-23 16:26:33 +0530293}
294
295static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800296cdp_pdev_detach(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, int force)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530297{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700298 if (!soc || !soc->ops) {
299 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
300 "%s: Invalid Instance:", __func__);
301 QDF_BUG(0);
302 return;
303 }
304
305 if (!soc->ops->cmn_drv_ops ||
306 !soc->ops->cmn_drv_ops->txrx_pdev_detach)
307 return;
308
309 soc->ops->cmn_drv_ops->txrx_pdev_detach(pdev, force);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530310}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700311
Anish Nataraje9d4c3b2018-11-24 22:24:56 +0530312static inline void
313cdp_pdev_deinit(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, int force)
314{
315 if (!soc || !soc->ops) {
316 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
317 "%s: Invalid Instance:", __func__);
318 QDF_BUG(0);
319 return;
320 }
321
322 if (!soc->ops->cmn_drv_ops ||
323 !soc->ops->cmn_drv_ops->txrx_pdev_deinit)
324 return;
325
326 soc->ops->cmn_drv_ops->txrx_pdev_deinit(pdev, force);
327}
328
Dhanashri Atre6d90ef32016-11-10 16:27:38 -0800329static inline void *cdp_peer_create
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800330 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
Akshay Kosigi78eced82018-05-14 14:53:48 +0530331 uint8_t *peer_mac_addr, struct cdp_ctrl_objmgr_peer *ctrl_peer)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530332{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700333 if (!soc || !soc->ops) {
334 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
335 "%s: Invalid Instance:", __func__);
336 QDF_BUG(0);
337 return NULL;
338 }
339
340 if (!soc->ops->cmn_drv_ops ||
341 !soc->ops->cmn_drv_ops->txrx_peer_create)
342 return NULL;
343
344 return soc->ops->cmn_drv_ops->txrx_peer_create(vdev,
Akshay Kosigi78eced82018-05-14 14:53:48 +0530345 peer_mac_addr, ctrl_peer);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530346}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700347
Dhanashri Atre6d90ef32016-11-10 16:27:38 -0800348static inline void cdp_peer_setup
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800349 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, void *peer)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530350{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700351 if (!soc || !soc->ops) {
352 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
353 "%s: Invalid Instance:", __func__);
354 QDF_BUG(0);
355 return;
356 }
357
358 if (!soc->ops->cmn_drv_ops ||
359 !soc->ops->cmn_drv_ops->txrx_peer_setup)
360 return;
361
362 soc->ops->cmn_drv_ops->txrx_peer_setup(vdev,
Dhanashri Atre6d90ef32016-11-10 16:27:38 -0800363 peer);
Dhanashri Atre6d90ef32016-11-10 16:27:38 -0800364}
365
Chaithanya Garrepalli9cc562c2018-11-16 18:30:41 +0530366/**
367 * cdp_peer_get_ast_info_by_soc() - search the soc AST hash table
368 * and return ast entry information
369 * of first ast entry found in the
370 * table with given mac address
371 *
372 * @soc - data path soc handle
373 * @ast_mac_addr - AST entry mac address
374 * @ast_entry_info - ast entry information
375 *
376 * return - true if ast entry found with ast_mac_addr
377 * false if ast entry not found
378 */
379static inline bool cdp_peer_get_ast_info_by_soc
380 (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
381 struct cdp_ast_entry_info *ast_entry_info)
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530382{
383 if (!soc || !soc->ops) {
384 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
385 "%s: Invalid Instance:", __func__);
386 QDF_BUG(0);
Chaithanya Garrepalli9cc562c2018-11-16 18:30:41 +0530387 return false;
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530388 }
389
390 if (!soc->ops->cmn_drv_ops ||
Chaithanya Garrepalli9cc562c2018-11-16 18:30:41 +0530391 !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc)
392 return false;
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530393
Chaithanya Garrepalli9cc562c2018-11-16 18:30:41 +0530394 return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc
395 (soc, ast_mac_addr,
396 ast_entry_info);
Chaithanya Garrepallicf347d12018-09-18 14:28:55 +0530397}
398
Chaithanya Garrepalli9cc562c2018-11-16 18:30:41 +0530399/**
400 * cdp_peer_get_ast_info_by_pdev() - search the soc AST hash table
401 * and return ast entry information
402 * if mac address and pdev_id matches
403 *
404 * @soc - data path soc handle
405 * @ast_mac_addr - AST entry mac address
406 * @pdev_id - pdev_id
407 * @ast_entry_info - ast entry information
408 *
409 * return - true if ast entry found with ast_mac_addr
410 * false if ast entry not found
411 */
412static inline bool cdp_peer_get_ast_info_by_pdev
Chaithanya Garrepallicf347d12018-09-18 14:28:55 +0530413 (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
Chaithanya Garrepalli9cc562c2018-11-16 18:30:41 +0530414 uint8_t pdev_id,
415 struct cdp_ast_entry_info *ast_entry_info)
Chaithanya Garrepallicf347d12018-09-18 14:28:55 +0530416{
417 if (!soc || !soc->ops) {
418 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
419 "%s: Invalid Instance:", __func__);
420 QDF_BUG(0);
Chaithanya Garrepalli9cc562c2018-11-16 18:30:41 +0530421 return false;
Chaithanya Garrepallicf347d12018-09-18 14:28:55 +0530422 }
423
424 if (!soc->ops->cmn_drv_ops ||
Chaithanya Garrepalli9cc562c2018-11-16 18:30:41 +0530425 !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev)
426 return false;
Chaithanya Garrepallicf347d12018-09-18 14:28:55 +0530427
Chaithanya Garrepalli9cc562c2018-11-16 18:30:41 +0530428 return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev
Chaithanya Garrepallicf347d12018-09-18 14:28:55 +0530429 (soc,
430 ast_mac_addr,
Chaithanya Garrepalli9cc562c2018-11-16 18:30:41 +0530431 pdev_id,
432 ast_entry_info);
433}
434
435/**
436 * cdp_peer_ast_delete_by_soc() - delete the ast entry from soc AST hash table
437 * with given mac address
438 *
439 * @soc - data path soc handle
440 * @ast_mac_addr - AST entry mac address
441 * @callback - callback function to called on ast delete response from FW
442 * @cookie - argument to be passed to callback
443 *
444 * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete
445 * is sent
446 * QDF_STATUS_E_INVAL false if ast entry not found
447 */
448static inline QDF_STATUS cdp_peer_ast_delete_by_soc
449 (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
450 txrx_ast_free_cb callback,
451 void *cookie)
452{
453 if (!soc || !soc->ops) {
454 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
455 "%s: Invalid Instance:", __func__);
456 QDF_BUG(0);
457 return QDF_STATUS_E_INVAL;
458 }
459
460 if (!soc->ops->cmn_drv_ops ||
461 !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc)
462 return QDF_STATUS_E_INVAL;
463
464 return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc
465 (soc,
466 ast_mac_addr,
467 callback,
468 cookie);
469}
470
471/**
472 * cdp_peer_ast_delete_by_pdev() - delete the ast entry from soc AST hash table
473 * if mac address and pdev_id matches
474 *
475 * @soc - data path soc handle
476 * @ast_mac_addr - AST entry mac address
477 * @pdev_id - pdev id
478 * @callback - callback function to called on ast delete response from FW
479 * @cookie - argument to be passed to callback
480 *
481 * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete
482 * is sent
483 * QDF_STATUS_E_INVAL false if ast entry not found
484 */
485static inline QDF_STATUS cdp_peer_ast_delete_by_pdev
486 (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
487 uint8_t pdev_id, txrx_ast_free_cb callback,
488 void *cookie)
489{
490 if (!soc || !soc->ops) {
491 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
492 "%s: Invalid Instance:", __func__);
493 QDF_BUG(0);
494 return QDF_STATUS_E_INVAL;
495 }
496
497 if (!soc->ops->cmn_drv_ops ||
498 !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev)
499 return QDF_STATUS_E_INVAL;
500
501 return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev
502 (soc,
503 ast_mac_addr,
504 pdev_id,
505 callback,
506 cookie);
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530507}
508
Tallapragada Kalyan57b6bb32018-01-02 12:58:33 +0530509static inline int cdp_peer_add_ast
510 (ol_txrx_soc_handle soc, struct cdp_peer *peer_handle,
511 uint8_t *mac_addr, enum cdp_txrx_ast_entry_type type, uint32_t flags)
512{
513 if (!soc || !soc->ops) {
514 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
515 "%s: Invalid Instance:", __func__);
516 QDF_BUG(0);
517 return 0;
518 }
519
520 if (!soc->ops->cmn_drv_ops ||
521 !soc->ops->cmn_drv_ops->txrx_peer_add_ast)
522 return 0;
523
524 return soc->ops->cmn_drv_ops->txrx_peer_add_ast(soc,
525 peer_handle,
526 mac_addr,
527 type,
528 flags);
529}
530
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530531static inline void cdp_peer_reset_ast
Chaithanya Garrepalli267ae0e2019-02-19 23:45:12 +0530532 (ol_txrx_soc_handle soc, uint8_t *wds_macaddr, uint8_t *peer_macaddr,
533 void *vdev_hdl)
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530534{
535
536 if (!soc || !soc->ops) {
537 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
538 "%s: Invalid Instance:", __func__);
539 QDF_BUG(0);
540 return;
541 }
542 if (!soc->ops->cmn_drv_ops ||
543 !soc->ops->cmn_drv_ops->txrx_peer_reset_ast)
544 return;
545
Chaithanya Garrepalli267ae0e2019-02-19 23:45:12 +0530546 soc->ops->cmn_drv_ops->txrx_peer_reset_ast(soc, wds_macaddr,
547 peer_macaddr, vdev_hdl);
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530548}
549
550static inline void cdp_peer_reset_ast_table
Santosh Anbu76693bc2018-04-23 16:38:54 +0530551 (ol_txrx_soc_handle soc, void *vdev_hdl)
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530552{
553 if (!soc || !soc->ops) {
554 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
555 "%s: Invalid Instance:", __func__);
556 QDF_BUG(0);
557 return;
558 }
559
560 if (!soc->ops->cmn_drv_ops ||
561 !soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table)
562 return;
563
Santosh Anbu76693bc2018-04-23 16:38:54 +0530564 soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table(soc, vdev_hdl);
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530565}
566
567static inline void cdp_peer_flush_ast_table
568 (ol_txrx_soc_handle soc)
569{
570 if (!soc || !soc->ops) {
571 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
572 "%s: Invalid Instance:", __func__);
573 QDF_BUG(0);
574 return;
575 }
576
577 if (!soc->ops->cmn_drv_ops ||
578 !soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table)
579 return;
580
581 soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table(soc);
582}
583
Tallapragada Kalyan57b6bb32018-01-02 12:58:33 +0530584static inline int cdp_peer_update_ast
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530585 (ol_txrx_soc_handle soc, uint8_t *wds_macaddr,
Tallapragada Kalyan57b6bb32018-01-02 12:58:33 +0530586 struct cdp_peer *peer_handle, uint32_t flags)
587{
588 if (!soc || !soc->ops) {
589 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
590 "%s: Invalid Instance:", __func__);
591 QDF_BUG(0);
592 return 0;
593 }
594
595 if (!soc->ops->cmn_drv_ops ||
596 !soc->ops->cmn_drv_ops->txrx_peer_update_ast)
597 return 0;
598
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530599
Tallapragada Kalyan57b6bb32018-01-02 12:58:33 +0530600 return soc->ops->cmn_drv_ops->txrx_peer_update_ast(soc,
601 peer_handle,
Ruchi, Agrawal89219d92018-02-26 16:43:06 +0530602 wds_macaddr,
Tallapragada Kalyan57b6bb32018-01-02 12:58:33 +0530603 flags);
604}
605
Dhanashri Atre6d90ef32016-11-10 16:27:38 -0800606static inline void cdp_peer_teardown
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800607 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, void *peer)
Dhanashri Atre6d90ef32016-11-10 16:27:38 -0800608{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700609 if (!soc || !soc->ops) {
610 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
611 "%s: Invalid Instance:", __func__);
612 QDF_BUG(0);
613 return;
614 }
615
616 if (!soc->ops->cmn_drv_ops ||
617 !soc->ops->cmn_drv_ops->txrx_peer_teardown)
618 return;
619
620 soc->ops->cmn_drv_ops->txrx_peer_teardown(vdev, peer);
Dhanashri Atre6d90ef32016-11-10 16:27:38 -0800621}
622
623static inline void
Pavankumar Nandeshwar753eed32019-01-22 15:40:15 +0530624cdp_vdev_flush_peers(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
625 bool unmap_only)
626{
627 if (!soc || !soc->ops) {
628 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
629 "%s: Invalid Instance:", __func__);
630 QDF_BUG(0);
631 return;
632 }
633
634 if (!soc->ops->cmn_drv_ops ||
635 !soc->ops->cmn_drv_ops->txrx_vdev_flush_peers)
636 return;
637
638 soc->ops->cmn_drv_ops->txrx_vdev_flush_peers(vdev, unmap_only);
639}
640
641static inline void
Naveen Rawat761329b2017-09-19 10:30:11 -0700642cdp_peer_delete(ol_txrx_soc_handle soc, void *peer, uint32_t bitmap)
Dhanashri Atre6d90ef32016-11-10 16:27:38 -0800643{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700644 if (!soc || !soc->ops) {
645 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
646 "%s: Invalid Instance:", __func__);
647 QDF_BUG(0);
648 return;
649 }
650
651 if (!soc->ops->cmn_drv_ops ||
652 !soc->ops->cmn_drv_ops->txrx_peer_delete)
653 return;
654
655 soc->ops->cmn_drv_ops->txrx_peer_delete(peer, bitmap);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530656}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700657
Alok Kumar2e254c52018-11-28 17:26:53 +0530658static inline void
659cdp_peer_delete_sync(ol_txrx_soc_handle soc, void *peer,
660 QDF_STATUS(*delete_cb)(
661 uint8_t vdev_id,
662 uint32_t peerid_cnt,
663 uint16_t *peerid_list),
664 uint32_t bitmap)
665{
666 if (!soc || !soc->ops) {
667 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
668 "%s: Invalid Instance:", __func__);
669 QDF_BUG(0);
670 return;
671 }
672
673 if (!soc->ops->cmn_drv_ops ||
674 !soc->ops->cmn_drv_ops->txrx_peer_delete_sync)
675 return;
676
677 soc->ops->cmn_drv_ops->txrx_peer_delete_sync(peer,
678 delete_cb,
679 bitmap);
680}
681
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530682static inline int
Pratik Gandhi8b8334b2017-03-09 17:41:40 +0530683cdp_set_monitor_mode(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
684 uint8_t smart_monitor)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530685{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700686 if (!soc || !soc->ops) {
687 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
688 "%s: Invalid Instance:", __func__);
689 QDF_BUG(0);
690 return 0;
691 }
692
693 if (!soc->ops->cmn_drv_ops ||
694 !soc->ops->cmn_drv_ops->txrx_set_monitor_mode)
695 return 0;
696
697 return soc->ops->cmn_drv_ops->txrx_set_monitor_mode(vdev,
Pratik Gandhi8b8334b2017-03-09 17:41:40 +0530698 smart_monitor);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530699}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700700
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530701static inline void
702cdp_set_curchan(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800703 struct cdp_pdev *pdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530704 uint32_t chan_mhz)
705{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700706 if (!soc || !soc->ops) {
707 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
708 "%s: Invalid Instance:", __func__);
709 QDF_BUG(0);
710 return;
711 }
712
713 if (!soc->ops->cmn_drv_ops ||
714 !soc->ops->cmn_drv_ops->txrx_set_curchan)
715 return;
716
717 soc->ops->cmn_drv_ops->txrx_set_curchan(pdev, chan_mhz);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530718}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700719
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530720static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800721cdp_set_privacy_filters(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530722 void *filter, uint32_t num)
723{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700724 if (!soc || !soc->ops) {
725 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
726 "%s: Invalid Instance:", __func__);
727 QDF_BUG(0);
728 return;
729 }
730
731 if (!soc->ops->cmn_drv_ops ||
732 !soc->ops->cmn_drv_ops->txrx_set_privacy_filters)
733 return;
734
735 soc->ops->cmn_drv_ops->txrx_set_privacy_filters(vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530736 filter, num);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530737}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700738
nobeljd124b742017-10-16 11:59:12 -0700739static inline int
740cdp_set_monitor_filter(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
741 struct cdp_monitor_filter *filter_val)
742{
743 if (soc->ops->mon_ops->txrx_set_advance_monitor_filter)
744 return soc->ops->mon_ops->txrx_set_advance_monitor_filter(pdev,
745 filter_val);
746 return 0;
747}
748
749
Dhanashri Atre5b646482016-03-22 12:22:41 -0700750/******************************************************************************
751 * Data Interface (B Interface)
752 *****************************************************************************/
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530753static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800754cdp_vdev_register(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
Akshay Kosigidbbaef42018-05-03 23:39:27 +0530755 void *osif_vdev, struct cdp_ctrl_objmgr_vdev *ctrl_vdev,
756 struct ol_txrx_ops *txrx_ops)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530757{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700758 if (!soc || !soc->ops) {
759 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
760 "%s: Invalid Instance:", __func__);
761 QDF_BUG(0);
762 return;
763 }
764
765 if (!soc->ops->cmn_drv_ops ||
766 !soc->ops->cmn_drv_ops->txrx_vdev_register)
767 return;
768
769 soc->ops->cmn_drv_ops->txrx_vdev_register(vdev,
Akshay Kosigidbbaef42018-05-03 23:39:27 +0530770 osif_vdev, ctrl_vdev, txrx_ops);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530771}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700772
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530773static inline int
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800774cdp_mgmt_send(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530775 qdf_nbuf_t tx_mgmt_frm, uint8_t type)
776{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700777 if (!soc || !soc->ops) {
778 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
779 "%s: Invalid Instance:", __func__);
780 QDF_BUG(0);
781 return 0;
782 }
783
784 if (!soc->ops->cmn_drv_ops ||
785 !soc->ops->cmn_drv_ops->txrx_mgmt_send)
786 return 0;
787
788 return soc->ops->cmn_drv_ops->txrx_mgmt_send(vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530789 tx_mgmt_frm, type);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530790}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700791
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530792static inline int
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800793cdp_mgmt_send_ext(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530794 qdf_nbuf_t tx_mgmt_frm, uint8_t type,
795 uint8_t use_6mbps, uint16_t chanfreq)
796{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700797 if (!soc || !soc->ops) {
798 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
799 "%s: Invalid Instance:", __func__);
800 QDF_BUG(0);
801 return 0;
802 }
803
804 if (!soc->ops->cmn_drv_ops ||
805 !soc->ops->cmn_drv_ops->txrx_mgmt_send_ext)
806 return 0;
807
808 return soc->ops->cmn_drv_ops->txrx_mgmt_send_ext
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530809 (vdev, tx_mgmt_frm, type, use_6mbps, chanfreq);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530810}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700811
Dhanashri Atre5b646482016-03-22 12:22:41 -0700812
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530813static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800814cdp_mgmt_tx_cb_set(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
Sravan Kumar Kairam786886b2017-07-19 17:38:20 +0530815 uint8_t type, ol_txrx_mgmt_tx_cb download_cb,
816 ol_txrx_mgmt_tx_cb ota_ack_cb, void *ctxt)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530817{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700818 if (!soc || !soc->ops) {
819 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
820 "%s: Invalid Instance:", __func__);
821 QDF_BUG(0);
822 return;
823 }
824
825 if (!soc->ops->cmn_drv_ops ||
826 !soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set)
827 return;
828
829 soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530830 (pdev, type, download_cb, ota_ack_cb, ctxt);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530831}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700832
Alok Kumar14b3ba02019-02-14 14:37:02 +0530833static inline void
834cdp_peer_unmap_sync_cb_set(ol_txrx_soc_handle soc,
835 struct cdp_pdev *pdev,
836 QDF_STATUS(*unmap_resp_cb)(
837 uint8_t vdev_id,
838 uint32_t peerid_cnt,
839 uint16_t *peerid_list))
840{
841 if (!soc || !soc->ops) {
842 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
843 "%s: Invalid Instance:", __func__);
844 QDF_BUG(0);
845 return;
846 }
847
848 if (!soc->ops->cmn_drv_ops ||
849 !soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set)
850 return;
851
852 soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set(pdev, unmap_resp_cb);
853}
854
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530855static inline int cdp_get_tx_pending(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800856struct cdp_pdev *pdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530857{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700858 if (!soc || !soc->ops) {
859 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
860 "%s: Invalid Instance:", __func__);
861 QDF_BUG(0);
862 return 0;
863 }
864
865 if (!soc->ops->cmn_drv_ops ||
866 !soc->ops->cmn_drv_ops->txrx_get_tx_pending)
867 return 0;
868
869
870 return soc->ops->cmn_drv_ops->txrx_get_tx_pending(pdev);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530871}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700872
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530873static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800874cdp_data_tx_cb_set(ol_txrx_soc_handle soc, struct cdp_vdev *data_vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530875 ol_txrx_data_tx_cb callback, void *ctxt)
876{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700877 if (!soc || !soc->ops) {
878 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
879 "%s: Invalid Instance:", __func__);
880 QDF_BUG(0);
881 return;
882 }
883
884 if (!soc->ops->cmn_drv_ops ||
885 !soc->ops->cmn_drv_ops->txrx_data_tx_cb_set)
886 return;
887
888 soc->ops->cmn_drv_ops->txrx_data_tx_cb_set(data_vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530889 callback, ctxt);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530890}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700891
892/******************************************************************************
Jeff Johnsonff2dfb22018-05-12 10:27:57 -0700893 * Statistics and Debugging Interface (C Interface)
Dhanashri Atre5b646482016-03-22 12:22:41 -0700894 *****************************************************************************/
Orhan K AKYILDIZbcc3c4e2017-01-29 13:12:20 -0800895/**
896 * External Device physical address types
897 *
898 * Currently, both MAC and IPA uController use the same size addresses
899 * and descriptors are exchanged between these two depending on the mode.
900 *
901 * Rationale: qdf_dma_addr_t is the type used internally on the host for DMA
902 * operations. However, external device physical address sizes
903 * may be different from host-specific physical address sizes.
904 * This calls for the following definitions for target devices
905 * (MAC, IPA uc).
906 */
907#if HTT_PADDR64
908typedef uint64_t target_paddr_t;
909#else
910typedef uint32_t target_paddr_t;
911#endif /*HTT_PADDR64 */
Dhanashri Atre5b646482016-03-22 12:22:41 -0700912
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530913static inline int
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800914cdp_aggr_cfg(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
Dhanashri Atre5b646482016-03-22 12:22:41 -0700915 int max_subfrms_ampdu,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530916 int max_subfrms_amsdu)
917{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700918 if (!soc || !soc->ops) {
919 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
920 "%s: Invalid Instance:", __func__);
921 QDF_BUG(0);
922 return 0;
923 }
924
925 if (!soc->ops->cmn_drv_ops ||
926 !soc->ops->cmn_drv_ops->txrx_aggr_cfg)
927 return 0;
928
929 return soc->ops->cmn_drv_ops->txrx_aggr_cfg(vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530930 max_subfrms_ampdu, max_subfrms_amsdu);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530931}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700932
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530933static inline int
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800934cdp_fw_stats_get(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530935 struct ol_txrx_stats_req *req, bool per_vdev,
936 bool response_expected)
937{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700938 if (!soc || !soc->ops) {
939 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
940 "%s: Invalid Instance:", __func__);
941 QDF_BUG(0);
942 return 0;
943 }
944
945 if (!soc->ops->cmn_drv_ops ||
946 !soc->ops->cmn_drv_ops->txrx_fw_stats_get)
947 return 0;
948
949 return soc->ops->cmn_drv_ops->txrx_fw_stats_get(vdev, req,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530950 per_vdev, response_expected);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530951}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700952
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530953static inline int
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800954cdp_debug(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, int debug_specs)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530955{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700956 if (!soc || !soc->ops) {
957 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
958 "%s: Invalid Instance:", __func__);
959 QDF_BUG(0);
960 return 0;
961 }
962
963 if (!soc->ops->cmn_drv_ops ||
964 !soc->ops->cmn_drv_ops->txrx_debug)
965 return 0;
966
967 return soc->ops->cmn_drv_ops->txrx_debug(vdev, debug_specs);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530968}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700969
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530970static inline void cdp_fw_stats_cfg(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800971 struct cdp_vdev *vdev, uint8_t cfg_stats_type, uint32_t cfg_val)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530972{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700973 if (!soc || !soc->ops) {
974 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
975 "%s: Invalid Instance:", __func__);
976 QDF_BUG(0);
977 return;
978 }
979
980 if (!soc->ops->cmn_drv_ops ||
981 !soc->ops->cmn_drv_ops->txrx_fw_stats_cfg)
982 return;
983
984 soc->ops->cmn_drv_ops->txrx_fw_stats_cfg(vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530985 cfg_stats_type, cfg_val);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530986}
Dhanashri Atre5b646482016-03-22 12:22:41 -0700987
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530988static inline void cdp_print_level_set(ol_txrx_soc_handle soc, unsigned level)
989{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700990 if (!soc || !soc->ops) {
991 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
992 "%s: Invalid Instance:", __func__);
993 QDF_BUG(0);
994 return;
995 }
996
997 if (!soc->ops->cmn_drv_ops ||
998 !soc->ops->cmn_drv_ops->txrx_print_level_set)
999 return;
1000
1001 soc->ops->cmn_drv_ops->txrx_print_level_set(level);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301002}
Dhanashri Atre5b646482016-03-22 12:22:41 -07001003
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301004static inline uint8_t *
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -08001005cdp_get_vdev_mac_addr(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301006{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001007 if (!soc || !soc->ops) {
1008 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1009 "%s: Invalid Instance:", __func__);
1010 QDF_BUG(0);
1011 return NULL;
1012 }
1013
1014 if (!soc->ops->cmn_drv_ops ||
1015 !soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr)
1016 return NULL;
1017
1018 return soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr(vdev);
1019
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301020}
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -08001021
1022/**
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301023 * cdp_get_vdev_struct_mac_addr() - Return handle to struct qdf_mac_addr of
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -08001024 * vdev
1025 * @vdev: vdev handle
1026 *
1027 * Return: Handle to struct qdf_mac_addr
1028 */
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301029static inline struct qdf_mac_addr *cdp_get_vdev_struct_mac_addr
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -08001030 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301031{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001032 if (!soc || !soc->ops) {
1033 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1034 "%s: Invalid Instance:", __func__);
1035 QDF_BUG(0);
1036 return NULL;
1037 }
1038
1039 if (!soc->ops->cmn_drv_ops ||
1040 !soc->ops->cmn_drv_ops->txrx_get_vdev_struct_mac_addr)
1041 return NULL;
1042
1043 return soc->ops->cmn_drv_ops->txrx_get_vdev_struct_mac_addr
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301044 (vdev);
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001045
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301046}
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -08001047
1048/**
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301049 * cdp_get_pdev_from_vdev() - Return handle to pdev of vdev
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -08001050 * @vdev: vdev handle
1051 *
1052 * Return: Handle to pdev
1053 */
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -08001054static inline struct cdp_pdev *cdp_get_pdev_from_vdev
1055 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301056{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001057 if (!soc || !soc->ops) {
1058 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1059 "%s: Invalid Instance:", __func__);
1060 QDF_BUG(0);
1061 return NULL;
1062 }
1063
1064 if (!soc->ops->cmn_drv_ops ||
1065 !soc->ops->cmn_drv_ops->txrx_get_pdev_from_vdev)
1066 return NULL;
1067
1068 return soc->ops->cmn_drv_ops->txrx_get_pdev_from_vdev(vdev);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301069}
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -08001070
1071/**
Mohit Khanna7ac554b2018-05-24 11:58:13 -07001072 * cdp_get_os_rx_handles_from_vdev() - Return os rx handles for a vdev
1073 * @soc: ol_txrx_soc_handle handle
1074 * @vdev: vdev for which os rx handles are needed
1075 * @stack_fn_p: pointer to stack function pointer
1076 * @osif_handle_p: pointer to ol_osif_vdev_handle
1077 *
1078 * Return: void
1079 */
1080static inline
1081void cdp_get_os_rx_handles_from_vdev(ol_txrx_soc_handle soc,
1082 struct cdp_vdev *vdev,
1083 ol_txrx_rx_fp *stack_fn_p,
1084 ol_osif_vdev_handle *osif_handle_p)
1085{
1086 if (!soc || !soc->ops) {
1087 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1088 "%s: Invalid Instance:", __func__);
1089 QDF_BUG(0);
1090 return;
1091 }
1092
1093 if (!soc->ops->cmn_drv_ops ||
1094 !soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev)
1095 return;
1096
1097 soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev(vdev,
1098 stack_fn_p,
1099 osif_handle_p);
1100}
1101
1102/**
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301103 * cdp_get_ctrl_pdev_from_vdev() - Return control pdev of vdev
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -08001104 * @vdev: vdev handle
1105 *
1106 * Return: Handle to control pdev
1107 */
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -08001108static inline struct cdp_cfg *
1109cdp_get_ctrl_pdev_from_vdev(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301110{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001111 if (!soc || !soc->ops) {
1112 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1113 "%s: Invalid Instance:", __func__);
1114 QDF_BUG(0);
1115 return NULL;
1116 }
1117
1118 if (!soc->ops->cmn_drv_ops ||
1119 !soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev)
1120 return NULL;
1121
1122 return soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301123 (vdev);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301124}
1125
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -08001126static inline struct cdp_vdev *
1127cdp_get_vdev_from_vdev_id(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
Leo Changdb6358c2016-09-27 17:00:52 -07001128 uint8_t vdev_id)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301129{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001130 if (!soc || !soc->ops) {
1131 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1132 "%s: Invalid Instance:", __func__);
1133 QDF_BUG(0);
1134 return NULL;
1135 }
1136
1137 if (!soc->ops->cmn_drv_ops ||
1138 !soc->ops->cmn_drv_ops->txrx_get_vdev_from_vdev_id)
1139 return NULL;
1140
1141 return soc->ops->cmn_drv_ops->txrx_get_vdev_from_vdev_id
Leo Changdb6358c2016-09-27 17:00:52 -07001142 (pdev, vdev_id);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301143}
1144
chenguo2a733792018-11-01 16:10:38 +08001145static inline struct cdp_vdev *
1146cdp_get_mon_vdev_from_pdev(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
1147{
1148 if (!soc || !soc->ops) {
1149 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1150 "%s: Invalid Instance:", __func__);
1151 QDF_BUG(0);
1152 return NULL;
1153 }
1154
1155 if (!soc->ops->cmn_drv_ops ||
1156 !soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev)
1157 return NULL;
1158
1159 return soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev
1160 (pdev);
1161}
1162
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301163static inline void
1164cdp_soc_detach(ol_txrx_soc_handle soc)
1165{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001166 if (!soc || !soc->ops) {
1167 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1168 "%s: Invalid Instance:", __func__);
1169 QDF_BUG(0);
1170 return;
1171 }
1172
1173 if (!soc->ops->cmn_drv_ops ||
1174 !soc->ops->cmn_drv_ops->txrx_soc_detach)
1175 return;
1176
1177 soc->ops->cmn_drv_ops->txrx_soc_detach((void *)soc);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +05301178}
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -08001179
Sumedh Baikady1c61e062018-02-12 22:25:47 -08001180/**
Anish Nataraje9d4c3b2018-11-24 22:24:56 +05301181 * cdp_soc_init() - Initialize txrx SOC
1182 * @soc: ol_txrx_soc_handle handle
1183 * @devid: Device ID
1184 * @hif_handle: Opaque HIF handle
1185 * @psoc: Opaque Objmgr handle
1186 * @htc_handle: Opaque HTC handle
1187 * @qdf_dev: QDF device
1188 * @dp_ol_if_ops: Offload Operations
1189 *
1190 * Return: DP SOC handle on success, NULL on failure
1191 */
1192static inline ol_txrx_soc_handle
1193cdp_soc_init(ol_txrx_soc_handle soc, u_int16_t devid, void *hif_handle,
1194 void *psoc, void *htc_handle, qdf_device_t qdf_dev,
1195 struct ol_if_ops *dp_ol_if_ops)
1196{
1197 if (!soc || !soc->ops) {
1198 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1199 "%s: Invalid Instance:", __func__);
1200 QDF_BUG(0);
1201 return NULL;
1202 }
1203
1204 if (!soc->ops->cmn_drv_ops ||
1205 !soc->ops->cmn_drv_ops->txrx_soc_init)
1206 return NULL;
1207
1208 return soc->ops->cmn_drv_ops->txrx_soc_init(soc, psoc,
1209 hif_handle,
1210 htc_handle, qdf_dev,
1211 dp_ol_if_ops, devid);
1212}
1213
1214/**
1215 * cdp_soc_deinit() - Deinitialize txrx SOC
1216 * @soc: Opaque DP SOC handle
1217 *
1218 * Return: None
1219 */
1220static inline void
1221cdp_soc_deinit(ol_txrx_soc_handle soc)
1222{
1223 if (!soc || !soc->ops) {
1224 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1225 "%s: Invalid Instance:", __func__);
1226 QDF_BUG(0);
1227 return;
1228 }
1229
1230 if (!soc->ops->cmn_drv_ops ||
1231 !soc->ops->cmn_drv_ops->txrx_soc_deinit)
1232 return;
1233
1234 soc->ops->cmn_drv_ops->txrx_soc_deinit((void *)soc);
1235}
1236
1237/**
1238 * cdp_tso_soc_attach() - TSO attach function
1239 * @soc: ol_txrx_soc_handle handle
1240 *
1241 * Reserve TSO descriptor buffers
1242 *
1243 * Return: QDF_STATUS_SUCCESS on Success or
1244 * QDF_STATUS_E_FAILURE on failure
1245 */
1246static inline QDF_STATUS
1247cdp_tso_soc_attach(ol_txrx_soc_handle soc)
1248{
1249 if (!soc || !soc->ops) {
1250 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1251 "%s: Invalid Instance:", __func__);
1252 QDF_BUG(0);
1253 return 0;
1254 }
1255
1256 if (!soc->ops->cmn_drv_ops ||
1257 !soc->ops->cmn_drv_ops->txrx_tso_soc_attach)
1258 return 0;
1259
1260 return soc->ops->cmn_drv_ops->txrx_tso_soc_attach((void *)soc);
1261}
1262
1263/**
1264 * cdp_tso_soc_detach() - TSO detach function
1265 * @soc: ol_txrx_soc_handle handle
1266 *
1267 * Release TSO descriptor buffers
1268 *
1269 * Return: QDF_STATUS_SUCCESS on Success or
1270 * QDF_STATUS_E_FAILURE on failure
1271 */
1272static inline QDF_STATUS
1273cdp_tso_soc_detach(ol_txrx_soc_handle soc)
1274{
1275 if (!soc || !soc->ops) {
1276 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1277 "%s: Invalid Instance:", __func__);
1278 QDF_BUG(0);
1279 return 0;
1280 }
1281
1282 if (!soc->ops->cmn_drv_ops ||
1283 !soc->ops->cmn_drv_ops->txrx_tso_soc_detach)
1284 return 0;
1285
1286 return soc->ops->cmn_drv_ops->txrx_tso_soc_detach((void *)soc);
1287}
1288
1289/**
Sumedh Baikady1c61e062018-02-12 22:25:47 -08001290 * cdp_addba_resp_tx_completion() - Indicate addba response tx
1291 * completion to dp to change tid state.
1292 * @soc: soc handle
1293 * @peer_handle: peer handle
1294 * @tid: tid
1295 * @status: Tx completion status
1296 *
1297 * Return: success/failure of tid update
1298 */
1299static inline int cdp_addba_resp_tx_completion(ol_txrx_soc_handle soc,
1300 void *peer_handle,
1301 uint8_t tid, int status)
1302{
1303 if (!soc || !soc->ops) {
1304 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1305 "%s: Invalid Instance:", __func__);
1306 QDF_BUG(0);
1307 return 0;
1308 }
1309
1310 if (!soc->ops->cmn_drv_ops ||
1311 !soc->ops->cmn_drv_ops->addba_resp_tx_completion)
1312 return 0;
1313
1314 return soc->ops->cmn_drv_ops->addba_resp_tx_completion(peer_handle, tid,
1315 status);
1316}
1317
Karunakar Dasinenied1de122016-08-02 11:57:59 -07001318static inline int cdp_addba_requestprocess(ol_txrx_soc_handle soc,
1319 void *peer_handle, uint8_t dialogtoken, uint16_t tid,
1320 uint16_t batimeout, uint16_t buffersize, uint16_t startseqnum)
1321{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001322 if (!soc || !soc->ops) {
1323 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1324 "%s: Invalid Instance:", __func__);
1325 QDF_BUG(0);
1326 return 0;
1327 }
1328
1329 if (!soc->ops->cmn_drv_ops ||
1330 !soc->ops->cmn_drv_ops->addba_requestprocess)
1331 return 0;
1332
1333 return soc->ops->cmn_drv_ops->addba_requestprocess(peer_handle,
Karunakar Dasinenied1de122016-08-02 11:57:59 -07001334 dialogtoken, tid, batimeout, buffersize, startseqnum);
Karunakar Dasinenied1de122016-08-02 11:57:59 -07001335}
1336
1337static inline void cdp_addba_responsesetup(ol_txrx_soc_handle soc,
1338 void *peer_handle, uint8_t tid, uint8_t *dialogtoken,
1339 uint16_t *statuscode, uint16_t *buffersize, uint16_t *batimeout)
1340{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001341 if (!soc || !soc->ops) {
1342 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1343 "%s: Invalid Instance:", __func__);
1344 QDF_BUG(0);
1345 return;
1346 }
1347
1348 if (!soc->ops->cmn_drv_ops ||
1349 !soc->ops->cmn_drv_ops->addba_responsesetup)
1350 return;
1351
1352 soc->ops->cmn_drv_ops->addba_responsesetup(peer_handle, tid,
Karunakar Dasinenied1de122016-08-02 11:57:59 -07001353 dialogtoken, statuscode, buffersize, batimeout);
1354}
1355
1356static inline int cdp_delba_process(ol_txrx_soc_handle soc,
1357 void *peer_handle, int tid, uint16_t reasoncode)
1358{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001359 if (!soc || !soc->ops) {
1360 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1361 "%s: Invalid Instance:", __func__);
1362 QDF_BUG(0);
1363 return 0;
1364 }
1365
1366 if (!soc->ops->cmn_drv_ops ||
1367 !soc->ops->cmn_drv_ops->delba_process)
1368 return 0;
1369
1370 return soc->ops->cmn_drv_ops->delba_process(peer_handle,
Karunakar Dasinenied1de122016-08-02 11:57:59 -07001371 tid, reasoncode);
Karunakar Dasinenied1de122016-08-02 11:57:59 -07001372}
1373
sumedh baikadydf4a57c2018-04-08 22:19:22 -07001374/**
1375 * cdp_delba_tx_completion() - Handle delba tx completion
1376 * to update stats and retry transmission if failed.
1377 * @soc: soc handle
1378 * @peer_handle: peer handle
1379 * @tid: Tid number
1380 * @status: Tx completion status
1381 *
1382 * Return: 0 on Success, 1 on failure
1383 */
1384
1385static inline int cdp_delba_tx_completion(ol_txrx_soc_handle soc,
1386 void *peer_handle,
1387 uint8_t tid, int status)
1388{
1389 if (!soc || !soc->ops) {
1390 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1391 "%s: Invalid Instance:", __func__);
1392 QDF_BUG(0);
1393 return 0;
1394 }
1395
1396 if (!soc->ops->cmn_drv_ops ||
1397 !soc->ops->cmn_drv_ops->delba_tx_completion)
1398 return 0;
1399
1400 return soc->ops->cmn_drv_ops->delba_tx_completion(peer_handle,
1401 tid, status);
1402}
1403
Gyanranjan Hazarika99a58d32017-12-22 21:56:17 -08001404static inline void cdp_set_addbaresponse(ol_txrx_soc_handle soc,
1405 void *peer_handle, int tid, uint16_t statuscode)
1406{
1407 if (!soc || !soc->ops) {
1408 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1409 "%s: Invalid Instance:", __func__);
1410 QDF_BUG(0);
1411 return;
1412 }
1413
1414 if (!soc->ops->cmn_drv_ops ||
1415 !soc->ops->cmn_drv_ops->set_addba_response)
1416 return;
1417
1418 soc->ops->cmn_drv_ops->set_addba_response(peer_handle, tid, statuscode);
1419}
1420
Ishank Jain1e7401c2017-02-17 15:38:39 +05301421/**
1422 * cdp_get_peer_mac_addr_frm_id: function to return vdev id and and peer
1423 * mac address
1424 * @soc: SOC handle
1425 * @peer_id: peer id of the peer for which mac_address is required
1426 * @mac_addr: reference to mac address
1427 *
1428 * reutm: vdev_id of the vap
1429 */
1430static inline uint8_t
1431cdp_get_peer_mac_addr_frm_id(ol_txrx_soc_handle soc, uint16_t peer_id,
1432 uint8_t *mac_addr)
1433{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001434 if (!soc || !soc->ops) {
1435 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1436 "%s: Invalid Instance:", __func__);
1437 QDF_BUG(0);
1438 return CDP_INVALID_VDEV_ID;
1439 }
1440
1441 if (!soc->ops->cmn_drv_ops ||
1442 !soc->ops->cmn_drv_ops->get_peer_mac_addr_frm_id)
1443 return CDP_INVALID_VDEV_ID;
1444
1445 return soc->ops->cmn_drv_ops->get_peer_mac_addr_frm_id(soc,
Ishank Jain1e7401c2017-02-17 15:38:39 +05301446 peer_id, mac_addr);
Ishank Jain1e7401c2017-02-17 15:38:39 +05301447}
Ishank Jain949674c2017-02-27 17:09:29 +05301448
1449/**
1450 * cdp_set_vdev_dscp_tid_map(): function to set DSCP-tid map in the vap
1451 * @vdev: vdev handle
1452 * @map_id: id of the tid map
1453 *
1454 * Return: void
1455 */
1456static inline void cdp_set_vdev_dscp_tid_map(ol_txrx_soc_handle soc,
1457 struct cdp_vdev *vdev, uint8_t map_id)
1458{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001459 if (!soc || !soc->ops) {
1460 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1461 "%s: Invalid Instance:", __func__);
1462 QDF_BUG(0);
1463 return;
1464 }
1465
1466 if (!soc->ops->cmn_drv_ops ||
1467 !soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map)
1468 return;
1469
1470 soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map(vdev,
Ishank Jain949674c2017-02-27 17:09:29 +05301471 map_id);
Ishank Jain949674c2017-02-27 17:09:29 +05301472}
1473
1474/**
Pranita Solanke92096e42018-09-11 11:14:51 +05301475 * cdp_ath_get_total_per(): function to get hw retries
1476 * @soc : soc handle
1477 * @pdev: pdev handle
1478 *
1479 * Return: get hw retries
1480 */
1481static inline
1482int cdp_ath_get_total_per(ol_txrx_soc_handle soc,
1483 struct cdp_pdev *pdev)
1484{
1485 if (!soc || !soc->ops) {
1486 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1487 "%s: Invalid Instance:", __func__);
1488 QDF_BUG(0);
1489 return 0;
1490 }
1491
1492 if (!soc->ops->cmn_drv_ops ||
1493 !soc->ops->cmn_drv_ops->txrx_get_total_per)
1494 return 0;
1495
1496 return soc->ops->cmn_drv_ops->txrx_get_total_per(pdev);
1497}
1498
1499/**
Ishank Jain949674c2017-02-27 17:09:29 +05301500 * cdp_set_pdev_dscp_tid_map(): function to change tid values in DSCP-tid map
1501 * @pdev: pdev handle
1502 * @map_id: id of the tid map
1503 * @tos: index value in map that needs to be changed
1504 * @tid: tid value passed by user
1505 *
1506 * Return: void
1507 */
1508static inline void cdp_set_pdev_dscp_tid_map(ol_txrx_soc_handle soc,
1509 struct cdp_pdev *pdev, uint8_t map_id, uint8_t tos, uint8_t tid)
1510{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001511 if (!soc || !soc->ops) {
1512 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1513 "%s: Invalid Instance:", __func__);
1514 QDF_BUG(0);
1515 return;
Ishank Jain949674c2017-02-27 17:09:29 +05301516 }
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001517
1518 if (!soc->ops->cmn_drv_ops ||
1519 !soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map)
1520 return;
1521
1522 soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map(pdev,
1523 map_id, tos, tid);
Ishank Jain949674c2017-02-27 17:09:29 +05301524}
Venkata Sharath Chandra Manchalaa77da0d2017-02-27 22:44:37 -08001525
1526/**
Shashikala Prabhu8f6703b2018-10-31 09:43:00 +05301527 * cdp_hmmc_tid_override_en(): Function to enable hmmc tid override.
1528 * @soc : soc handle
1529 * @pdev: pdev handle
1530 * @val: hmmc-dscp flag value
1531 *
1532 * Return: void
1533 */
1534static inline void cdp_hmmc_tid_override_en(ol_txrx_soc_handle soc,
1535 struct cdp_pdev *pdev, bool val)
1536{
1537 if (!soc || !soc->ops) {
1538 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1539 "%s: Invalid Instance:", __func__);
1540 QDF_BUG(0);
1541 return;
1542 }
1543
1544 if (!soc->ops->cmn_drv_ops ||
1545 !soc->ops->cmn_drv_ops->hmmc_tid_override_en)
1546 return;
1547
1548 soc->ops->cmn_drv_ops->hmmc_tid_override_en(pdev, val);
1549}
1550
1551/**
1552 * cdp_set_hmmc_tid_val(): Function to set hmmc tid value.
1553 * @soc : soc handle
1554 * @pdev: pdev handle
1555 * @tid: tid value
1556 *
1557 * Return: void
1558 */
1559static inline void cdp_set_hmmc_tid_val(ol_txrx_soc_handle soc,
1560 struct cdp_pdev *pdev, uint8_t tid)
1561{
1562 if (!soc || !soc->ops) {
1563 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1564 "%s: Invalid Instance:", __func__);
1565 QDF_BUG(0);
1566 return;
1567 }
1568
1569 if (!soc->ops->cmn_drv_ops ||
1570 !soc->ops->cmn_drv_ops->set_hmmc_tid_val)
1571 return;
1572
1573 soc->ops->cmn_drv_ops->set_hmmc_tid_val(pdev, tid);
1574}
1575
1576/**
Manikandan Mohane2fa8b72017-03-22 11:18:26 -07001577 * cdp_flush_cache_rx_queue() - flush cache rx queue frame
1578 *
1579 * Return: None
1580 */
1581static inline void cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc)
1582{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001583 if (!soc || !soc->ops) {
1584 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1585 "%s: Invalid Instance:", __func__);
1586 QDF_BUG(0);
1587 return;
1588 }
1589
1590 if (!soc->ops->cmn_drv_ops ||
1591 !soc->ops->cmn_drv_ops->flush_cache_rx_queue)
1592 return;
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001593 soc->ops->cmn_drv_ops->flush_cache_rx_queue();
Manikandan Mohane2fa8b72017-03-22 11:18:26 -07001594}
1595
1596/**
Om Prakash Tripathi03efb6a2017-08-23 22:51:28 +05301597 * cdp_txrx_stats_request(): function to map to host and firmware statistics
1598 * @soc: soc handle
1599 * @vdev: virtual device
1600 * @req: stats request container
1601 *
1602 * return: status
1603 */
1604static inline
1605int cdp_txrx_stats_request(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
1606 struct cdp_txrx_stats_req *req)
1607{
1608 if (!soc || !soc->ops || !soc->ops->cmn_drv_ops || !req) {
1609 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1610 "%s: Invalid Instance:", __func__);
1611 QDF_ASSERT(0);
1612 return 0;
1613 }
1614
1615 if (soc->ops->cmn_drv_ops->txrx_stats_request)
1616 return soc->ops->cmn_drv_ops->txrx_stats_request(vdev, req);
1617
1618 return 0;
1619}
1620
1621/**
Yun Park21cd32f2017-04-03 10:38:31 -07001622 * cdp_txrx_intr_attach(): function to attach and configure interrupt
1623 * @soc: soc handle
1624 */
Venkateswara Swamy Bandarua95b3242017-05-19 20:20:30 +05301625static inline QDF_STATUS cdp_txrx_intr_attach(ol_txrx_soc_handle soc)
1626{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001627 if (!soc || !soc->ops) {
1628 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1629 "%s: Invalid Instance:", __func__);
1630 QDF_BUG(0);
1631 return 0;
1632 }
Venkateswara Swamy Bandarua95b3242017-05-19 20:20:30 +05301633
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001634 if (!soc->ops->cmn_drv_ops ||
1635 !soc->ops->cmn_drv_ops->txrx_intr_attach)
1636 return 0;
1637
1638 return soc->ops->cmn_drv_ops->txrx_intr_attach(soc);
Venkateswara Swamy Bandarua95b3242017-05-19 20:20:30 +05301639}
1640
1641/**
Yun Park21cd32f2017-04-03 10:38:31 -07001642 * cdp_txrx_intr_detach(): function to detach interrupt
1643 * @soc: soc handle
1644 */
Venkateswara Swamy Bandarua95b3242017-05-19 20:20:30 +05301645static inline void cdp_txrx_intr_detach(ol_txrx_soc_handle soc)
1646{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001647 if (!soc || !soc->ops) {
1648 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1649 "%s: Invalid Instance:", __func__);
1650 QDF_BUG(0);
1651 return;
1652 }
1653
1654 if (!soc->ops->cmn_drv_ops ||
1655 !soc->ops->cmn_drv_ops->txrx_intr_detach)
1656 return;
1657
1658 soc->ops->cmn_drv_ops->txrx_intr_detach(soc);
Venkateswara Swamy Bandarua95b3242017-05-19 20:20:30 +05301659}
1660
1661/**
Yun Park21cd32f2017-04-03 10:38:31 -07001662 * cdp_display_stats(): function to map to dump stats
1663 * @soc: soc handle
1664 * @value: statistics option
1665 */
Venkata Sharath Chandra Manchalaa405eb72017-03-06 14:35:00 -08001666static inline QDF_STATUS
Mohit Khanna90d7ebd2017-09-12 21:54:21 -07001667cdp_display_stats(ol_txrx_soc_handle soc, uint16_t value,
1668 enum qdf_stats_verbosity_level level)
Venkata Sharath Chandra Manchalaa405eb72017-03-06 14:35:00 -08001669{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001670 if (!soc || !soc->ops) {
1671 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1672 "%s: Invalid Instance:", __func__);
1673 QDF_BUG(0);
1674 return 0;
1675 }
Venkata Sharath Chandra Manchalaa405eb72017-03-06 14:35:00 -08001676
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001677 if (!soc->ops->cmn_drv_ops ||
1678 !soc->ops->cmn_drv_ops->display_stats)
1679 return 0;
1680
Mohit Khanna90d7ebd2017-09-12 21:54:21 -07001681 return soc->ops->cmn_drv_ops->display_stats(soc, value, level);
Venkata Sharath Chandra Manchalaa405eb72017-03-06 14:35:00 -08001682}
Gurumoorthi Gnanasambandhaned4bcf82017-05-24 00:10:59 +05301683
1684
1685/**
1686 * cdp_set_pn_check(): function to set pn check
1687 * @soc: soc handle
1688 * @sec_type: security type
1689 * #rx_pn: receive pn
1690 */
1691static inline int cdp_set_pn_check(ol_txrx_soc_handle soc,
1692 struct cdp_vdev *vdev, struct cdp_peer *peer_handle, enum cdp_sec_type sec_type, uint32_t *rx_pn)
1693{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001694 if (!soc || !soc->ops) {
1695 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1696 "%s: Invalid Instance:", __func__);
1697 QDF_BUG(0);
1698 return 0;
1699 }
1700
1701 if (!soc->ops->cmn_drv_ops ||
1702 !soc->ops->cmn_drv_ops->set_pn_check)
1703 return 0;
1704
1705 soc->ops->cmn_drv_ops->set_pn_check(vdev, peer_handle,
Gurumoorthi Gnanasambandhaned4bcf82017-05-24 00:10:59 +05301706 sec_type, rx_pn);
1707 return 0;
1708}
1709
Pramod Simha6e10cb22018-06-20 12:05:44 -07001710static inline int cdp_set_key(ol_txrx_soc_handle soc,
1711 struct cdp_peer *peer_handle,
1712 bool is_unicast, uint32_t *key)
1713{
1714 if (!soc || !soc->ops) {
1715 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1716 "%s: Invalid Instance:", __func__);
1717 QDF_BUG(0);
1718 return 0;
1719 }
1720
1721 if (!soc->ops->ctrl_ops ||
1722 !soc->ops->ctrl_ops->set_key)
1723 return 0;
1724
1725 soc->ops->ctrl_ops->set_key(peer_handle,
1726 is_unicast, key);
1727 return 0;
1728}
1729
Venkata Sharath Chandra Manchala3e8add82017-07-10 11:59:54 -07001730/**
1731 * cdp_update_config_parameters(): function to propagate configuration
1732 * parameters to datapath
1733 * @soc: opaque soc handle
1734 * @cfg: configuration handle
1735 *
1736 * Return: status: 0 - Success, non-zero: Failure
1737 */
1738static inline
1739QDF_STATUS cdp_update_config_parameters(ol_txrx_soc_handle soc,
1740 struct cdp_config_params *cfg)
1741{
1742 struct cdp_soc *psoc = (struct cdp_soc *)soc;
1743
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001744 if (!soc || !soc->ops) {
1745 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1746 "%s: Invalid Instance:", __func__);
1747 QDF_BUG(0);
1748 return 0;
1749 }
Venkata Sharath Chandra Manchala3e8add82017-07-10 11:59:54 -07001750
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -07001751 if (!soc->ops->cmn_drv_ops ||
1752 !soc->ops->cmn_drv_ops->update_config_parameters)
1753 return QDF_STATUS_SUCCESS;
1754
1755 return soc->ops->cmn_drv_ops->update_config_parameters(psoc,
1756 cfg);
Venkata Sharath Chandra Manchala3e8add82017-07-10 11:59:54 -07001757}
Santosh Anbu2280e862018-01-03 22:25:53 +05301758
1759/**
1760 * cdp_pdev_get_dp_txrx_handle() - get advanced dp handle from pdev
1761 * @soc: opaque soc handle
1762 * @pdev: data path pdev handle
1763 *
1764 * Return: opaque dp handle
1765 */
1766static inline void *
1767cdp_pdev_get_dp_txrx_handle(ol_txrx_soc_handle soc, void *pdev)
1768{
1769 if (!soc || !soc->ops) {
1770 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1771 "%s: Invalid Instance:", __func__);
1772 QDF_BUG(0);
1773 return 0;
1774 }
1775
1776 if (soc->ops->cmn_drv_ops->get_dp_txrx_handle)
1777 return soc->ops->cmn_drv_ops->get_dp_txrx_handle(pdev);
1778
1779 return 0;
1780}
1781
1782/**
1783 * cdp_pdev_set_dp_txrx_handle() - set advanced dp handle in pdev
1784 * @soc: opaque soc handle
1785 * @pdev: data path pdev handle
1786 * @dp_hdl: opaque pointer for dp_txrx_handle
1787 *
1788 * Return: void
1789 */
1790static inline void
1791cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *pdev, void *dp_hdl)
1792{
1793 if (!soc || !soc->ops) {
1794 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1795 "%s: Invalid Instance:", __func__);
1796 QDF_BUG(0);
1797 return;
1798 }
1799
1800 if (!soc->ops->cmn_drv_ops ||
1801 !soc->ops->cmn_drv_ops->set_dp_txrx_handle)
1802 return;
1803
1804 soc->ops->cmn_drv_ops->set_dp_txrx_handle(pdev, dp_hdl);
1805}
Pamidipati, Vijayd3478ef2018-02-06 23:52:29 +05301806
phadiman7821bf82018-02-06 16:03:54 +05301807/*
Pamidipati, Vijayd3478ef2018-02-06 23:52:29 +05301808 * cdp_soc_get_dp_txrx_handle() - get extended dp handle from soc
1809 * @soc: opaque soc handle
1810 *
1811 * Return: opaque extended dp handle
1812 */
1813static inline void *
1814cdp_soc_get_dp_txrx_handle(ol_txrx_soc_handle soc)
1815{
1816 if (!soc || !soc->ops) {
1817 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1818 "%s: Invalid Instance:", __func__);
1819 QDF_BUG(0);
1820 return NULL;
1821 }
1822
1823 if (soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle)
1824 return soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle(
1825 (struct cdp_soc *) soc);
1826
1827 return NULL;
1828}
1829
1830/**
1831 * cdp_soc_set_dp_txrx_handle() - set advanced dp handle in soc
1832 * @soc: opaque soc handle
1833 * @dp_hdl: opaque pointer for dp_txrx_handle
1834 *
1835 * Return: void
1836 */
1837static inline void
1838cdp_soc_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *dp_handle)
1839{
1840 if (!soc || !soc->ops) {
1841 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1842 "%s: Invalid Instance:", __func__);
1843 QDF_BUG(0);
1844 return;
1845 }
1846
1847 if (!soc->ops->cmn_drv_ops ||
1848 !soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle)
1849 return;
1850
1851 soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle((struct cdp_soc *)soc,
1852 dp_handle);
1853}
1854
1855/**
1856 * cdp_tx_send() - enqueue frame for transmission
1857 * @soc: soc opaque handle
1858 * @vdev: VAP device
1859 * @nbuf: nbuf to be enqueued
1860 *
1861 * This API is used by Extended Datapath modules to enqueue frame for
1862 * transmission
1863 *
1864 * Return: void
1865 */
1866static inline void
1867cdp_tx_send(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, qdf_nbuf_t nbuf)
1868{
1869 if (!soc || !soc->ops) {
1870 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1871 "%s: Invalid Instance:", __func__);
1872 QDF_BUG(0);
1873 return;
1874 }
1875
1876 if (!soc->ops->cmn_drv_ops ||
1877 !soc->ops->cmn_drv_ops->tx_send)
1878 return;
1879
1880 soc->ops->cmn_drv_ops->tx_send(vdev, nbuf);
1881}
phadiman7821bf82018-02-06 16:03:54 +05301882
1883/*
1884 * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev
1885 * @soc: opaque soc handle
1886 * @pdev: data path pdev handle
1887 *
1888 * Return: pdev_id
1889 */
1890static inline
1891uint8_t cdp_get_pdev_id_frm_pdev(ol_txrx_soc_handle soc,
1892 struct cdp_pdev *pdev)
1893{
1894 if (soc->ops->cmn_drv_ops->txrx_get_pdev_id_frm_pdev)
1895 return soc->ops->cmn_drv_ops->txrx_get_pdev_id_frm_pdev(pdev);
1896 return 0;
1897}
1898
Vivek Natarajan95f004f2019-01-10 22:15:46 +05301899/*
1900 * cdp_get_vow_config_frm_pdev() - return carrier_vow_config from pdev
1901 * @soc: opaque soc handle
1902 * @pdev: data path pdev handle
1903 *
1904 * Return: carrier_vow_config
1905 */
1906static inline
1907bool cdp_get_vow_config_frm_pdev(ol_txrx_soc_handle soc,
1908 struct cdp_pdev *pdev)
1909{
1910 if (soc->ops->cmn_drv_ops->txrx_get_vow_config_frm_pdev)
1911 return soc->ops->cmn_drv_ops->txrx_get_vow_config_frm_pdev(
1912 pdev);
1913 return 0;
1914}
1915
phadiman7821bf82018-02-06 16:03:54 +05301916/**
Adil Saeed Musthafa61a21692018-07-17 20:49:31 -07001917 * cdp_pdev_set_chan_noise_floor() - Set channel noise floor to DP layer
1918 * @soc: opaque soc handle
1919 * @pdev: data path pdev handle
1920 * @chan_noise_floor: Channel Noise Floor (in dbM) obtained from control path
1921 *
1922 * Return: None
1923 */
1924static inline
1925void cdp_pdev_set_chan_noise_floor(ol_txrx_soc_handle soc,
1926 struct cdp_pdev *pdev,
1927 int16_t chan_noise_floor)
1928{
1929 if (soc->ops->cmn_drv_ops->txrx_pdev_set_chan_noise_floor)
1930 return soc->ops->cmn_drv_ops->txrx_pdev_set_chan_noise_floor(
1931 pdev, chan_noise_floor);
1932}
1933
1934/**
phadiman7821bf82018-02-06 16:03:54 +05301935 * cdp_set_nac() - set nac
1936 * @soc: opaque soc handle
1937 * @peer: data path peer handle
1938 *
1939 */
1940static inline
1941void cdp_set_nac(ol_txrx_soc_handle soc,
1942 struct cdp_peer *peer)
1943{
1944 if (soc->ops->cmn_drv_ops->txrx_set_nac)
1945 soc->ops->cmn_drv_ops->txrx_set_nac(peer);
1946}
1947
1948/**
1949 * cdp_set_pdev_tx_capture() - set pdev tx_capture
1950 * @soc: opaque soc handle
1951 * @pdev: data path pdev handle
1952 * @val: value of pdev_tx_capture
1953 *
Chaithanya Garrepalli7ab76ae2018-07-05 14:53:50 +05301954 * Return: status: 0 - Success, non-zero: Failure
phadiman7821bf82018-02-06 16:03:54 +05301955 */
1956static inline
Chaithanya Garrepalli7ab76ae2018-07-05 14:53:50 +05301957QDF_STATUS cdp_set_pdev_tx_capture(ol_txrx_soc_handle soc,
1958 struct cdp_pdev *pdev, int val)
phadiman7821bf82018-02-06 16:03:54 +05301959{
1960 if (soc->ops->cmn_drv_ops->txrx_set_pdev_tx_capture)
1961 return soc->ops->cmn_drv_ops->txrx_set_pdev_tx_capture(pdev,
1962 val);
Chaithanya Garrepalli7ab76ae2018-07-05 14:53:50 +05301963 return QDF_STATUS_SUCCESS;
phadiman7821bf82018-02-06 16:03:54 +05301964}
1965
1966/**
Debasis Dasa3249bd2019-03-01 11:58:22 +05301967 * cdp_set_pdev_pcp_tid_map() - set pdev pcp-tid-map
1968 * @soc: opaque soc handle
1969 * @pdev: data path pdev handle
1970 * @pcp: pcp value
1971 * @tid: tid value
1972 *
1973 * This API is used to configure the pcp-to-tid mapping for a pdev.
1974 *
1975 * Return: QDF_STATUS_SUCCESS if value set successfully
1976 * QDF_STATUS_E_INVAL false if error
1977 */
1978static inline
1979QDF_STATUS cdp_set_pdev_pcp_tid_map(ol_txrx_soc_handle soc,
1980 struct cdp_pdev *pdev,
1981 uint32_t pcp, uint32_t tid)
1982{
1983 if (!soc || !soc->ops) {
1984 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1985 "%s: Invalid Instance", __func__);
1986 return QDF_STATUS_E_INVAL;
1987 }
1988
1989 if (!soc->ops->cmn_drv_ops ||
1990 !soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map)
1991 return QDF_STATUS_E_INVAL;
1992
1993 return soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map(pdev, pcp, tid);
1994}
1995
1996/**
1997 * cdp_set_pdev_pcp_tidmap_prty() - set pdev tidmap priority
1998 * @soc: opaque soc handle
1999 * @pdev: data path pdev handle
2000 * @val: priority value
2001 *
2002 * This API is used to configure the tidmap priority for a pdev.
2003 * The tidmap priority decides which mapping, namely DSCP-TID, SVLAN_PCP-TID,
2004 * CVLAN_PCP-TID will be used.
2005 *
2006 * Return: QDF_STATUS_SUCCESS if value set successfully
2007 * QDF_STATUS_E_INVAL false if error
2008 */
2009static inline
2010QDF_STATUS cdp_set_pdev_tidmap_prty(ol_txrx_soc_handle soc,
2011 struct cdp_pdev *pdev_handle,
2012 uint32_t val)
2013{
2014 if (!soc || !soc->ops) {
2015 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2016 "%s: Invalid Instance", __func__);
2017 return QDF_STATUS_E_INVAL;
2018 }
2019
2020 if (!soc->ops->cmn_drv_ops ||
2021 !soc->ops->cmn_drv_ops->set_pdev_tidmap_prty)
2022 return QDF_STATUS_E_INVAL;
2023
2024 return soc->ops->cmn_drv_ops->set_pdev_tidmap_prty(pdev_handle, val);
2025}
2026
2027/**
phadiman7821bf82018-02-06 16:03:54 +05302028 * cdp_get_peer_mac_from_peer_id() - get peer mac addr from peer id
2029 * @soc: opaque soc handle
2030 * @pdev: data path pdev handle
2031 * @peer_id: data path peer id
2032 * @peer_mac: peer_mac
2033 *
2034 * Return: void
2035 */
2036static inline
2037void cdp_get_peer_mac_from_peer_id(ol_txrx_soc_handle soc,
2038 struct cdp_pdev *pdev_handle,
2039 uint32_t peer_id, uint8_t *peer_mac)
2040{
2041 if (soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id)
2042 soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id(
2043 pdev_handle, peer_id, peer_mac);
2044}
2045
2046/**
2047 * cdp_vdev_tx_lock() - acquire lock
2048 * @soc: opaque soc handle
2049 * @vdev: data path vdev handle
2050 *
2051 * Return: void
2052 */
2053static inline
2054void cdp_vdev_tx_lock(ol_txrx_soc_handle soc,
2055 struct cdp_vdev *vdev)
2056{
2057 if (soc->ops->cmn_drv_ops->txrx_vdev_tx_lock)
2058 soc->ops->cmn_drv_ops->txrx_vdev_tx_lock(vdev);
2059}
2060
2061/**
2062 * cdp_vdev_tx_unlock() - release lock
2063 * @soc: opaque soc handle
2064 * @vdev: data path vdev handle
2065 *
2066 * Return: void
2067 */
2068static inline
2069void cdp_vdev_tx_unlock(ol_txrx_soc_handle soc,
2070 struct cdp_vdev *vdev)
2071{
2072 if (soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock)
2073 soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock(vdev);
2074}
2075
2076/**
2077 * cdp_ath_getstats() - get updated athstats
2078 * @soc: opaque soc handle
Chaithanya Garrepalli2faa46f2018-04-09 12:34:20 +05302079 * @dev: dp interface handle
2080 * @stats: cdp network device stats structure
2081 * @type: device type pdev/vdev
phadiman7821bf82018-02-06 16:03:54 +05302082 *
2083 * Return: void
2084 */
phadiman7821bf82018-02-06 16:03:54 +05302085static inline void cdp_ath_getstats(ol_txrx_soc_handle soc,
Chaithanya Garrepalli2faa46f2018-04-09 12:34:20 +05302086 void *dev, struct cdp_dev_stats *stats,
2087 uint8_t type)
phadiman7821bf82018-02-06 16:03:54 +05302088{
2089 if (soc && soc->ops && soc->ops->cmn_drv_ops->txrx_ath_getstats)
Chaithanya Garrepalli2faa46f2018-04-09 12:34:20 +05302090 soc->ops->cmn_drv_ops->txrx_ath_getstats(dev, stats, type);
phadiman7821bf82018-02-06 16:03:54 +05302091}
2092
2093/**
2094 * cdp_set_gid_flag() - set groupid flag
2095 * @soc: opaque soc handle
2096 * @pdev: data path pdev handle
2097 * @mem_status: member status from grp management frame
2098 * @user_position: user position from grp management frame
2099 *
2100 * Return: void
2101 */
2102static inline
2103void cdp_set_gid_flag(ol_txrx_soc_handle soc,
2104 struct cdp_pdev *pdev, u_int8_t *mem_status,
2105 u_int8_t *user_position)
2106{
2107 if (soc->ops->cmn_drv_ops->txrx_set_gid_flag)
2108 soc->ops->cmn_drv_ops->txrx_set_gid_flag(pdev, mem_status, user_position);
2109}
2110
2111/**
2112 * cdp_fw_supported_enh_stats_version() - returns the fw enhanced stats version
2113 * @soc: opaque soc handle
2114 * @pdev: data path pdev handle
2115 *
2116 */
2117static inline
2118uint32_t cdp_fw_supported_enh_stats_version(ol_txrx_soc_handle soc,
2119 struct cdp_pdev *pdev)
2120{
2121 if (soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version)
2122 return soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version(pdev);
2123 return 0;
2124}
2125
2126/**
2127 * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev
2128 * @soc: opaque soc handle
2129 * @ni: associated node
2130 * @force: number of frame in SW queue
2131 * Return: void
2132 */
2133static inline
2134void cdp_if_mgmt_drain(ol_txrx_soc_handle soc,
2135 void *ni, int force)
2136{
2137 if (soc->ops->cmn_drv_ops->txrx_if_mgmt_drain)
2138 soc->ops->cmn_drv_ops->txrx_if_mgmt_drain(ni, force);
2139}
Chaithanya Garrepalli2f572792018-04-11 17:49:28 +05302140
Chaithanya Garrepalli3e93e5f2018-09-12 17:02:31 +05302141/* cdp_peer_map_attach() - CDP API to allocate PEER map memory
2142 * @soc: opaque soc handle
2143 * @max_peers: number of peers created in FW
Tallapragada Kalyana7023622018-12-03 19:29:52 +05302144 * @max_ast_index: max number of AST index supported in FW
Chaithanya Garrepalli3e93e5f2018-09-12 17:02:31 +05302145 * @peer_map_unmap_v2: flag indicates HTT peer map v2 is enabled in FW
2146 *
2147 *
Chaithanya Garrepalli0e2d7fc2019-02-15 20:33:10 +05302148 * Return: QDF_STATUS
Chaithanya Garrepalli3e93e5f2018-09-12 17:02:31 +05302149 */
Chaithanya Garrepalli0e2d7fc2019-02-15 20:33:10 +05302150static inline QDF_STATUS
Chaithanya Garrepalli3e93e5f2018-09-12 17:02:31 +05302151cdp_peer_map_attach(ol_txrx_soc_handle soc, uint32_t max_peers,
Tallapragada Kalyana7023622018-12-03 19:29:52 +05302152 uint32_t max_ast_index, bool peer_map_unmap_v2)
Chaithanya Garrepalli2f572792018-04-11 17:49:28 +05302153{
2154 if (soc && soc->ops && soc->ops->cmn_drv_ops &&
2155 soc->ops->cmn_drv_ops->txrx_peer_map_attach)
Chaithanya Garrepalli0e2d7fc2019-02-15 20:33:10 +05302156 return soc->ops->cmn_drv_ops->txrx_peer_map_attach(soc,
2157 max_peers,
2158 max_ast_index,
2159 peer_map_unmap_v2);
2160
2161 return QDF_STATUS_SUCCESS;
Chaithanya Garrepalli2f572792018-04-11 17:49:28 +05302162}
Manjunathappa Prakash56023f52018-03-28 20:05:56 -07002163
Sravan Kumar Kairam5a6f5902018-07-04 17:32:24 +05302164/**
2165
2166 * cdp_pdev_set_ctrl_pdev() - set UMAC ctrl pdev to dp pdev
2167 * @soc: opaque soc handle
2168 * @pdev: opaque dp pdev handle
2169 * @ctrl_pdev: opaque ctrl pdev handle
2170 *
2171 * Return: void
2172 */
2173static inline void
2174cdp_pdev_set_ctrl_pdev(ol_txrx_soc_handle soc, struct cdp_pdev *dp_pdev,
2175 struct cdp_ctrl_objmgr_pdev *ctrl_pdev)
2176{
2177 if (soc && soc->ops && soc->ops->cmn_drv_ops &&
2178 soc->ops->cmn_drv_ops->txrx_pdev_set_ctrl_pdev)
2179 soc->ops->cmn_drv_ops->txrx_pdev_set_ctrl_pdev(dp_pdev,
2180 ctrl_pdev);
2181}
2182
Pranita Solankeafcd0f12018-08-29 22:49:23 +05302183/* cdp_txrx_classify_and_update() - To classify the packet and update stats
2184 * @soc: opaque soc handle
2185 * @vdev: opaque dp vdev handle
2186 * @skb: data
2187 * @dir: rx or tx packet
2188 * @nbuf_classify: packet classification object
2189 *
2190 * Return: 1 on success else return 0
2191 */
2192static inline int
2193cdp_txrx_classify_and_update(ol_txrx_soc_handle soc,
2194 struct cdp_vdev *vdev, qdf_nbuf_t skb,
2195 enum txrx_direction dir,
2196 struct ol_txrx_nbuf_classify *nbuf_class)
2197{
2198 if (!soc || !soc->ops) {
2199 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2200 "%s: Invalid Instance", __func__);
2201 QDF_BUG(0);
2202 return 0;
2203 }
2204
2205 if (!soc->ops->cmn_drv_ops ||
2206 !soc->ops->cmn_drv_ops->txrx_classify_update)
2207 return 0;
2208
2209 return soc->ops->cmn_drv_ops->txrx_classify_update(vdev,
2210 skb,
2211 dir, nbuf_class);
2212}
2213
Akshay Kosigia4f6e172018-09-03 21:42:27 +05302214/**
2215 * cdp_get_dp_capabilities() - get DP capabilities
2216 * @soc: opaque soc handle
2217 * @dp_cap: enum of DP capabilities
2218 *
2219 * Return: bool
2220 */
2221static inline bool
2222cdp_get_dp_capabilities(struct cdp_soc_t *soc, enum cdp_capabilities dp_caps)
2223{
2224 if (soc && soc->ops && soc->ops->cmn_drv_ops &&
2225 soc->ops->cmn_drv_ops->get_dp_capabilities)
2226 return soc->ops->cmn_drv_ops->get_dp_capabilities(soc, dp_caps);
2227 return false;
2228}
2229
Manjunathappa Prakash56023f52018-03-28 20:05:56 -07002230#ifdef RECEIVE_OFFLOAD
2231/**
2232 * cdp_register_rx_offld_flush_cb() - register LRO/GRO flush cb function pointer
2233 * @soc - data path soc handle
2234 * @pdev - device instance pointer
2235 *
2236 * register rx offload flush callback function pointer
2237 *
2238 * return none
2239 */
2240static inline void cdp_register_rx_offld_flush_cb(ol_txrx_soc_handle soc,
2241 void (rx_ol_flush_cb)(void *))
2242{
2243 if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
2244 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
2245 "%s invalid instance", __func__);
2246 return;
2247 }
2248
2249 if (soc->ops->rx_offld_ops->register_rx_offld_flush_cb)
2250 return soc->ops->rx_offld_ops->register_rx_offld_flush_cb(
2251 rx_ol_flush_cb);
2252}
2253
2254/**
2255 * cdp_deregister_rx_offld_flush_cb() - deregister Rx offld flush cb function
2256 * @soc - data path soc handle
2257 *
2258 * deregister rx offload flush callback function pointer
2259 *
2260 * return none
2261 */
2262static inline void cdp_deregister_rx_offld_flush_cb(ol_txrx_soc_handle soc)
2263{
2264 if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
2265 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
2266 "%s invalid instance", __func__);
2267 return;
2268 }
2269
2270 if (soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb)
2271 return soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb();
2272}
2273#endif /* RECEIVE_OFFLOAD */
sumedh baikady1f8f3192018-02-20 17:30:32 -08002274
2275/**
2276 * @cdp_set_ba_timeout() - set ba aging timeout per AC
2277 *
2278 * @soc - pointer to the soc
2279 * @value - timeout value in millisec
2280 * @ac - Access category
2281 *
2282 * @return - void
2283 */
2284static inline void cdp_set_ba_timeout(ol_txrx_soc_handle soc,
2285 uint8_t ac, uint32_t value)
2286{
2287 if (!soc || !soc->ops) {
2288 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2289 "%s: Invalid Instance", __func__);
2290 QDF_BUG(0);
2291 return;
2292 }
2293
2294 if (!soc->ops->cmn_drv_ops ||
2295 !soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout)
2296 return;
2297
2298 soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout(soc, ac, value);
2299}
2300
2301/**
2302 * @cdp_get_ba_timeout() - return ba aging timeout per AC
2303 *
2304 * @soc - pointer to the soc
2305 * @ac - access category
2306 * @value - timeout value in millisec
2307 *
2308 * @return - void
2309 */
2310static inline void cdp_get_ba_timeout(ol_txrx_soc_handle soc,
2311 uint8_t ac, uint32_t *value)
2312{
2313 if (!soc || !soc->ops) {
2314 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2315 "%s: Invalid Instance", __func__);
2316 QDF_BUG(0);
2317 return;
2318 }
2319
2320 if (!soc->ops->cmn_drv_ops ||
2321 !soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout)
2322 return;
2323
2324 soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout(soc, ac, value);
2325}
jitiphil60ac9aa2018-10-05 19:54:04 +05302326
2327/**
2328 * cdp_cfg_get() - get cfg for dp enum
2329 *
2330 * @soc: pointer to the soc
2331 * @cfg: cfg enum
2332 *
2333 * Return - cfg value
2334 */
2335static inline uint32_t cdp_cfg_get(ol_txrx_soc_handle soc, enum cdp_dp_cfg cfg)
2336{
2337 if (!soc || !soc->ops) {
2338 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2339 "%s: Invalid Instance", __func__);
2340 return 0;
2341 }
2342
2343 if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->txrx_get_cfg)
2344 return 0;
2345
2346 return soc->ops->cmn_drv_ops->txrx_get_cfg(soc, cfg);
2347}
Amir Patel256dcbe2019-02-26 21:49:24 +05302348
2349/**
2350 * cdp_soc_set_rate_stats_ctx() - set rate stats context in soc
2351 * @soc: opaque soc handle
2352 * @ctx: rate stats context
2353 *
2354 * Return: void
2355 */
2356static inline void
2357cdp_soc_set_rate_stats_ctx(ol_txrx_soc_handle soc, void *ctx)
2358{
2359 if (!soc || !soc->ops) {
2360 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2361 "%s: Invalid Instance:", __func__);
2362 QDF_BUG(0);
2363 return;
2364 }
2365
2366 if (!soc->ops->cmn_drv_ops ||
2367 !soc->ops->cmn_drv_ops->set_rate_stats_ctx)
2368 return;
2369
2370 soc->ops->cmn_drv_ops->set_rate_stats_ctx((struct cdp_soc_t *)soc,
2371 ctx);
2372}
2373
2374/**
2375 * cdp_soc_get_rate_stats_ctx() - get rate stats context in soc
2376 * @soc: opaque soc handle
2377 *
2378 * Return: void
2379 */
2380static inline void*
2381cdp_soc_get_rate_stats_ctx(ol_txrx_soc_handle soc)
2382{
2383 if (!soc || !soc->ops) {
2384 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2385 "%s: Invalid Instance:", __func__);
2386 QDF_BUG(0);
2387 return NULL;
2388 }
2389
2390 if (!soc->ops->cmn_drv_ops ||
2391 !soc->ops->cmn_drv_ops->get_rate_stats_ctx)
2392 return NULL;
2393
2394 return soc->ops->cmn_drv_ops->get_rate_stats_ctx(soc);
2395}
2396
2397/**
2398 * cdp_peer_flush_rate_stats() - flush peer rate statistics
2399 * @soc: opaque soc handle
2400 * @pdev: pdev handle
2401 * @buf: stats buffer
2402 */
2403static inline void
2404cdp_peer_flush_rate_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
2405 void *buf)
2406{
2407 if (!soc || !soc->ops) {
2408 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2409 "%s: Invalid Instance:", __func__);
2410 QDF_BUG(0);
2411 return;
2412 }
2413
2414 if (!soc->ops->cmn_drv_ops ||
2415 !soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats)
2416 return;
2417
2418 soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats(soc, pdev, buf);
2419}
2420
2421/**
2422 * cdp_flush_rate_stats_request() - request flush rate statistics
2423 * @soc: opaque soc handle
2424 * @pdev: pdev handle
2425 */
2426static inline void
2427cdp_flush_rate_stats_request(struct cdp_soc_t *soc, struct cdp_pdev *pdev)
2428{
2429 if (!soc || !soc->ops) {
2430 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2431 "%s: Invalid Instance:", __func__);
2432 QDF_BUG(0);
2433 return;
2434 }
2435
2436 if (!soc->ops->cmn_drv_ops ||
2437 !soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request)
2438 return;
2439
2440 soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request(soc, pdev);
2441}
Debasis Dasa3249bd2019-03-01 11:58:22 +05302442
2443/**
2444 * cdp_set_vdev_pcp_tid_map() - set vdev pcp-tid-map
2445 * @soc: opaque soc handle
2446 * @vdev: data path vdev handle
2447 * @pcp: pcp value
2448 * @tid: tid value
2449 *
2450 * This API is used to configure the pcp-to-tid mapping for a pdev.
2451 *
2452 * Return: QDF_STATUS_SUCCESS if value set successfully
2453 * QDF_STATUS_E_INVAL false if error
2454 */
2455static inline
2456QDF_STATUS cdp_set_vdev_pcp_tid_map(ol_txrx_soc_handle soc,
2457 struct cdp_vdev *vdev_handle,
2458 uint8_t pcp, uint8_t tid)
2459{
2460 if (!soc || !soc->ops) {
2461 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2462 "%s: Invalid Instance", __func__);
2463 return QDF_STATUS_E_INVAL;
2464 }
2465
2466 if (!soc->ops->cmn_drv_ops ||
2467 !soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map)
2468 return QDF_STATUS_E_INVAL;
2469
2470 return soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map(vdev_handle,
2471 pcp, tid);
2472}
2473
2474/**
2475 * cdp_set_vdev_tidmap_tbl_id() - set vdev tidmap table id
2476 *
2477 * @soc: opaque soc handle
2478 * @vdev: data path vdev handle
2479 * @mapid: value of mapid
2480 *
2481 * This API is used to configure the table-id of the tid-mapping for a vdev.
2482 * Table '0' is for using the pdev's pcp-tid mapping and '1' is for using
2483 * the vdev's pcp-tid mapping.
2484 *
2485 * Return: QDF_STATUS_SUCCESS if value set successfully
2486 * QDF_STATUS_E_INVAL false if error
2487 */
2488static inline
2489QDF_STATUS cdp_set_vdev_tidmap_tbl_id(ol_txrx_soc_handle soc,
2490 struct cdp_vdev *vdev_handle,
2491 uint8_t mapid)
2492{
2493 if (!soc || !soc->ops) {
2494 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2495 "%s: Invalid Instance", __func__);
2496 return QDF_STATUS_E_INVAL;
2497 }
2498
2499 if (!soc->ops->cmn_drv_ops ||
2500 !soc->ops->cmn_drv_ops->set_vdev_tidmap_tbl_id)
2501 return QDF_STATUS_E_INVAL;
2502
2503 return soc->ops->cmn_drv_ops->set_vdev_tidmap_tbl_id(vdev_handle,
2504 mapid);
2505}
2506
2507/**
2508 * cdp_set_vdev_tidmap_prty() - set vdev tidmap priority
2509 * @soc: opaque soc handle
2510 * @vdev: data path vdev handle
2511 * @prio: tidmap priority value
2512 *
2513 * This API is used to configure the tidmap priority for a vdev.
2514 * The tidmap priority decides which mapping, namely DSCP-TID, SVLAN_PCP-TID,
2515 * CVLAN_PCP-TID will be used.
2516 * The vdev tidmap priority will be used only when the tidmap_tbl_id is '1'.
2517 *
2518 * Return: QDF_STATUS_SUCCESS if value set successfully
2519 * QDF_STATUS_E_INVAL false if error
2520 */
2521static inline
2522QDF_STATUS cdp_set_vdev_tidmap_prty(ol_txrx_soc_handle soc,
2523 struct cdp_vdev *vdev_handle, uint8_t prio)
2524{
2525 if (!soc || !soc->ops) {
2526 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2527 "%s: Invalid Instance", __func__);
2528 return QDF_STATUS_E_INVAL;
2529 }
2530
2531 if (!soc->ops->cmn_drv_ops ||
2532 !soc->ops->cmn_drv_ops->set_vdev_tidmap_prty)
2533 return QDF_STATUS_E_INVAL;
2534
2535 return soc->ops->cmn_drv_ops->set_vdev_tidmap_prty(vdev_handle, prio);
2536}
Dhanashri Atre5b646482016-03-22 12:22:41 -07002537#endif /* _CDP_TXRX_CMN_H_ */