blob: f897febe745ee82b71643846f06355d8ec3e058e [file] [log] [blame]
Dhanashri Atrefe5662c2016-03-25 12:57:53 -07001/*
Aditya Sathish8a735752019-01-21 16:56:01 +05302 * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
Dhanashri Atrefe5662c2016-03-25 12:57:53 -07003 *
Dhanashri Atrefe5662c2016-03-25 12:57:53 -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 Park87adad02017-04-03 08:44:15 -070019/**
Dhanashri Atrefe5662c2016-03-25 12:57:53 -070020 * @file cdp_txrx_me.h
21 * @brief Define the host data path mcast enhance API functions
22 * called by the host control SW and the OS interface module
23 */
24#ifndef _CDP_TXRX_ME_H_
25#define _CDP_TXRX_ME_H_
26
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053027#include <cdp_txrx_ops.h>
Dhanashri Atrefe5662c2016-03-25 12:57:53 -070028/* TODO: adf need to be replaced with qdf */
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080029#include "cdp_txrx_handle.h"
Dhanashri Atrefe5662c2016-03-25 12:57:53 -070030
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053031static inline u_int16_t
32cdp_tx_desc_alloc_and_mark_for_mcast_clone(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080033 struct cdp_pdev *pdev, u_int16_t buf_count)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053034{
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -070035 if (!soc || !soc->ops) {
36 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
37 "%s: Invalid Instance", __func__);
38 QDF_BUG(0);
39 return 0;
40 }
41
42 if (!soc->ops->me_ops ||
43 !soc->ops->me_ops->tx_desc_alloc_and_mark_for_mcast_clone)
44 return 0;
45
46 return soc->ops->me_ops->
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053047 tx_desc_alloc_and_mark_for_mcast_clone
48 (pdev, buf_count);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053049}
Dhanashri Atrefe5662c2016-03-25 12:57:53 -070050
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053051static inline u_int16_t
52cdp_tx_desc_free_and_unmark_for_mcast_clone(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080053 struct cdp_pdev *pdev, u_int16_t buf_count)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053054{
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -070055 if (!soc || !soc->ops) {
56 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
57 "%s: Invalid Instance", __func__);
58 QDF_BUG(0);
59 return 0;
60 }
61
62 if (!soc->ops->me_ops ||
63 !soc->ops->me_ops->tx_desc_free_and_unmark_for_mcast_clone)
64 return 0;
65
66 return soc->ops->me_ops->
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053067 tx_desc_free_and_unmark_for_mcast_clone
68 (pdev, buf_count);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053069}
Dhanashri Atrefe5662c2016-03-25 12:57:53 -070070
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053071static inline u_int16_t
72cdp_tx_get_mcast_buf_allocated_marked(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080073 struct cdp_pdev *pdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053074{
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -070075 if (!soc || !soc->ops) {
76 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
77 "%s: Invalid Instance", __func__);
78 QDF_BUG(0);
79 return 0;
80 }
81
82 if (!soc->ops->me_ops ||
83 !soc->ops->me_ops->tx_get_mcast_buf_allocated_marked)
84 return 0;
85
86 return soc->ops->me_ops->tx_get_mcast_buf_allocated_marked
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053087 (pdev);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053088}
Dhanashri Atrefe5662c2016-03-25 12:57:53 -070089
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053090static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080091cdp_tx_me_alloc_descriptor(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053092{
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -070093 if (!soc || !soc->ops) {
94 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
95 "%s: Invalid Instance", __func__);
96 QDF_BUG(0);
97 return;
98 }
99
100 if (!soc->ops->me_ops ||
101 !soc->ops->me_ops->tx_me_alloc_descriptor)
102 return;
103
104 soc->ops->me_ops->tx_me_alloc_descriptor(pdev);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530105}
Dhanashri Atrefe5662c2016-03-25 12:57:53 -0700106
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530107static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800108cdp_tx_me_free_descriptor(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530109{
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -0700110 if (!soc || !soc->ops) {
111 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
112 "%s: Invalid Instance", __func__);
113 QDF_BUG(0);
114 return;
115 }
116
117 if (!soc->ops->me_ops ||
118 !soc->ops->me_ops->tx_me_free_descriptor)
119 return;
120
121 soc->ops->me_ops->tx_me_free_descriptor(pdev);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530122}
123
124static inline uint16_t
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800125cdp_tx_me_convert_ucast(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530126 qdf_nbuf_t wbuf, u_int8_t newmac[][6], uint8_t newmaccnt)
127{
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -0700128 if (!soc || !soc->ops) {
129 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
130 "%s: Invalid Instance", __func__);
131 QDF_BUG(0);
132 return 0;
133 }
134
135 if (!soc->ops->me_ops ||
136 !soc->ops->me_ops->tx_me_convert_ucast)
137 return 0;
138
139 return soc->ops->me_ops->tx_me_convert_ucast
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530140 (vdev, wbuf, newmac, newmaccnt);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530141}
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -0700142
Dhanashri Atrefe5662c2016-03-25 12:57:53 -0700143/* Should be a function pointer in ol_txrx_osif_ops{} */
Dhanashri Atrefe5662c2016-03-25 12:57:53 -0700144/**
145 * @brief notify mcast frame indication from FW.
146 * @details
147 * This notification will be used to convert
148 * multicast frame to unicast.
149 *
150 * @param pdev - handle to the ctrl SW's physical device object
151 * @param vdev_id - ID of the virtual device received the special data
152 * @param msdu - the multicast msdu returned by FW for host inspect
153 */
154
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800155static inline int cdp_mcast_notify(ol_txrx_soc_handle soc,
156 struct cdp_pdev *pdev, u_int8_t vdev_id, qdf_nbuf_t msdu)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530157{
Venkata Sharath Chandra Manchalac4a6b842017-10-25 12:18:08 -0700158 if (!soc || !soc->ops) {
159 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
160 "%s: Invalid Instance", __func__);
161 QDF_BUG(0);
162 return 0;
163 }
164
165 if (!soc->ops->me_ops ||
166 !soc->ops->me_ops->mcast_notify)
167 return 0;
168
169 return soc->ops->me_ops->mcast_notify(pdev, vdev_id, msdu);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530170}
Dhanashri Atrefe5662c2016-03-25 12:57:53 -0700171#endif