xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_me.h (revision 97f44cd39e4ff816eaa1710279d28cf6b9e65ad9)
1 /*
2  * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
3  *
4  * 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 
19 /**
20  * @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 
27 #include <cdp_txrx_ops.h>
28 /* TODO: adf need to be replaced with qdf */
29 #include "cdp_txrx_handle.h"
30 
31 static inline void
32 cdp_tx_me_alloc_descriptor(ol_txrx_soc_handle soc, uint8_t pdev_id)
33 {
34 	if (!soc || !soc->ops) {
35 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
36 				"%s: Invalid Instance", __func__);
37 		QDF_BUG(0);
38 		return;
39 	}
40 
41 	if (!soc->ops->me_ops ||
42 	    !soc->ops->me_ops->tx_me_alloc_descriptor)
43 		return;
44 
45 	soc->ops->me_ops->tx_me_alloc_descriptor(soc, pdev_id);
46 }
47 
48 static inline void
49 cdp_tx_me_free_descriptor(ol_txrx_soc_handle soc, uint8_t pdev_id)
50 {
51 	if (!soc || !soc->ops) {
52 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
53 				"%s: Invalid Instance", __func__);
54 		QDF_BUG(0);
55 		return;
56 	}
57 
58 	if (!soc->ops->me_ops ||
59 	    !soc->ops->me_ops->tx_me_free_descriptor)
60 		return;
61 
62 	soc->ops->me_ops->tx_me_free_descriptor(soc, pdev_id);
63 }
64 
65 static inline uint16_t
66 cdp_tx_me_convert_ucast(ol_txrx_soc_handle soc, uint8_t vdev_id,
67 			qdf_nbuf_t wbuf, u_int8_t newmac[][6],
68 			uint8_t newmaccnt, uint8_t tid, bool is_igmp)
69 {
70 	if (!soc || !soc->ops) {
71 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
72 				"%s: Invalid Instance", __func__);
73 		QDF_BUG(0);
74 		return 0;
75 	}
76 
77 	if (!soc->ops->me_ops ||
78 	    !soc->ops->me_ops->tx_me_convert_ucast)
79 		return 0;
80 
81 	return soc->ops->me_ops->tx_me_convert_ucast
82 			(soc, vdev_id, wbuf, newmac, newmaccnt, tid, is_igmp);
83 }
84 
85 #endif
86