xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_me.h (revision 901120c066e139c7f8a2c8e4820561fdd83c67ef)
1 /*
2  * Copyright (c) 2016-2021 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 #include <cdp_txrx_cmn.h>
31 
32 static inline void
33 cdp_tx_me_alloc_descriptor(ol_txrx_soc_handle soc, uint8_t pdev_id)
34 {
35 	if (!soc || !soc->ops) {
36 		dp_cdp_debug("Invalid Instance");
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 		dp_cdp_debug("Invalid Instance");
53 		QDF_BUG(0);
54 		return;
55 	}
56 
57 	if (!soc->ops->me_ops ||
58 	    !soc->ops->me_ops->tx_me_free_descriptor)
59 		return;
60 
61 	soc->ops->me_ops->tx_me_free_descriptor(soc, pdev_id);
62 }
63 
64 static inline uint16_t
65 cdp_tx_me_convert_ucast(ol_txrx_soc_handle soc, uint8_t vdev_id,
66 			qdf_nbuf_t wbuf, u_int8_t newmac[][6],
67 			uint8_t newmaccnt, uint8_t tid, bool is_igmp,
68 			bool is_dms_pkt)
69 {
70 	if (!soc || !soc->ops) {
71 		dp_cdp_debug("Invalid Instance");
72 		QDF_BUG(0);
73 		return 0;
74 	}
75 
76 	if (!soc->ops->me_ops ||
77 	    !soc->ops->me_ops->tx_me_convert_ucast)
78 		return 0;
79 
80 	return soc->ops->me_ops->tx_me_convert_ucast
81 			(soc, vdev_id, wbuf, newmac, newmaccnt, tid, is_igmp,
82 			 is_dms_pkt);
83 }
84 
85 #endif
86