xref: /wlan-driver/qca-wifi-host-cmn/dp/inc/cdp_txrx_me.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: cdp_txrx_me.h
22  * Define the host data path mcast enhance API functions
23  * called by the host control SW and the OS interface module
24  */
25 #ifndef _CDP_TXRX_ME_H_
26 #define _CDP_TXRX_ME_H_
27 
28 #include <cdp_txrx_ops.h>
29 #include "cdp_txrx_handle.h"
30 #include <cdp_txrx_cmn.h>
31 
32 static inline void
cdp_tx_me_alloc_descriptor(ol_txrx_soc_handle soc,uint8_t pdev_id)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
cdp_tx_me_free_descriptor(ol_txrx_soc_handle soc,uint8_t pdev_id)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
cdp_tx_me_convert_ucast(ol_txrx_soc_handle soc,uint8_t vdev_id,qdf_nbuf_t wbuf,u_int8_t newmac[][6],uint8_t newmaccnt,uint8_t tid,bool is_igmp,bool is_dms_pkt)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