xref: /wlan-dirver/qca-wifi-host-cmn/target_if/direct_buf_rx/inc/target_if_direct_buf_rx_api.h (revision 3149adf58a329e17232a4c0e58d460d025edd55a)
1 /*
2  * Copyright (c) 2017-2018 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 #ifndef _TARGET_IF_DIRECT_BUF_RX_API_H_
20 #define _TARGET_IF_DIRECT_BUF_RX_API_H_
21 
22 #include "qdf_nbuf.h"
23 #include "qdf_atomic.h"
24 
25 #define direct_buf_rx_log(level, args...) \
26 		QDF_TRACE(QDF_MODULE_ID_DIRECT_BUF_RX, level, ## args)
27 #define direct_buf_rx_logfl(level, format, args...) \
28 		direct_buf_rx_log(level, FL(format), ## args)
29 #define direct_buf_alert(format, args...) \
30 		direct_buf_rx_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
31 #define direct_buf_rx_err(format, args...) \
32 		direct_buf_rx_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
33 #define direct_buf_rx_warn(format, args...) \
34 		direct_buf_rx_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
35 #define direct_buf_rx_notice(format, args...) \
36 		direct_buf_rx_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
37 #define direct_buf_rx_info(format, args...) \
38 		direct_buf_rx_logfl(QDF_TRACE_LEVEL_INFO_HIGH, format, ## args)
39 #define direct_buf_rx_debug(format, args...) \
40 		direct_buf_rx_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
41 #define direct_buf_rx_enter() \
42 		direct_buf_rx_logfl(QDF_TRACE_LEVEL_DEBUG, "enter")
43 #define direct_buf_rx_exit() \
44 		direct_buf_rx_logfl(QDF_TRACE_LEVEL_DEBUG, "exit")
45 
46 struct wlan_objmgr_psoc;
47 struct wlan_lmac_if_tx_ops;
48 
49 /**
50  * struct direct_buf_rx_data - direct buffer rx data
51  * @dbr_len: Length of the buffer DMAed
52  * @vaddr: Virtual address of the buffer that has DMAed data
53  */
54 struct direct_buf_rx_data {
55 	size_t dbr_len;
56 	void *vaddr;
57 };
58 
59 /**
60  * direct_buf_rx_init() - Function to initialize direct buf rx module
61  *
62  * Return: QDF status of operation
63  */
64 QDF_STATUS direct_buf_rx_init(void);
65 
66 /**
67  * direct_buf_rx_deinit() - Function to deinitialize direct buf rx module
68  *
69  * Return: QDF status of operation
70  */
71 QDF_STATUS direct_buf_rx_deinit(void);
72 
73 /**
74  * direct_buf_rx_target_attach() - Attach hal_soc,osdev in direct buf rx psoc obj
75  * @psoc: pointer to psoc object
76  * @hal_soc: Opaque HAL SOC handle
77  * @osdev: QDF os device handle
78  *
79  * Return: QDF status of operation
80  */
81 QDF_STATUS direct_buf_rx_target_attach(struct wlan_objmgr_psoc *psoc,
82 				void *hal_soc, qdf_device_t osdev);
83 
84 /**
85  * target_if_direct_buf_rx_register_tx_ops() - Register tx ops for direct buffer
86  *                                             rx module
87  * @tx_ops: pointer to lmac interface tx ops
88  *
89  * Return: None
90  */
91 void target_if_direct_buf_rx_register_tx_ops(
92 				struct wlan_lmac_if_tx_ops *tx_ops);
93 
94 #endif /* _TARGET_IF_DIRECT_BUF_RX_API_H_ */
95