xref: /wlan-dirver/qca-wifi-host-cmn/target_if/direct_buf_rx/inc/target_if_direct_buf_rx_api.h (revision 1397a33f48ea6455be40871470b286e535820eb8)
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 #include "wmi_unified_api.h"
25 
26 #define direct_buf_rx_alert(params...) \
27 	QDF_TRACE_FATAL(QDF_MODULE_ID_DIRECT_BUF_RX, params)
28 #define direct_buf_rx_err(params...) \
29 	QDF_TRACE_ERROR(QDF_MODULE_ID_DIRECT_BUF_RX, params)
30 #define direct_buf_rx_warn(params...) \
31 	QDF_TRACE_WARN(QDF_MODULE_ID_DIRECT_BUF_RX, params)
32 #define direct_buf_rx_notice(params...) \
33 	QDF_TRACE_INFO(QDF_MODULE_ID_DIRECT_BUF_RX, params)
34 #define direct_buf_rx_info(params...) \
35 	QDF_TRACE_INFO(QDF_MODULE_ID_DIRECT_BUF_RX, params)
36 #define direct_buf_rx_debug(params...) \
37 	QDF_TRACE_DEBUG(QDF_MODULE_ID_DIRECT_BUF_RX, params)
38 #define direct_buf_rx_enter() \
39 	QDF_TRACE_ENTER(QDF_MODULE_ID_DIRECT_BUF_RX, "enter")
40 #define direct_buf_rx_exit() \
41 	QDF_TRACE_EXIT(QDF_MODULE_ID_DIRECT_BUF_RX, "exit")
42 
43 #define directbuf_nofl_alert(params...) \
44 	QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_DIRECT_BUF_RX, params)
45 #define directbuf_nofl_err(params...) \
46 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_DIRECT_BUF_RX, params)
47 #define directbuf_nofl_warn(params...) \
48 	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_DIRECT_BUF_RX, params)
49 #define directbuf_nofl_info(params...) \
50 	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_DIRECT_BUF_RX, params)
51 #define directbuf_nofl_debug(params...) \
52 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DIRECT_BUF_RX, params)
53 
54 #define DBR_MAX_CHAINS      (8)
55 
56 struct wlan_objmgr_psoc;
57 struct wlan_lmac_if_tx_ops;
58 
59 /**
60  * struct direct_buf_rx_data - direct buffer rx data
61  * @dbr_len: Length of the buffer DMAed
62  * @vaddr: Virtual address of the buffer that has DMAed data
63  * @meta_data_valid: Indicates that metadata is valid
64  * @meta_data: Meta data
65  */
66 struct direct_buf_rx_data {
67 	size_t dbr_len;
68 	void *vaddr;
69 	bool meta_data_valid;
70 	struct direct_buf_rx_metadata meta_data;
71 };
72 
73 /**
74  * direct_buf_rx_init() - Function to initialize direct buf rx module
75  *
76  * Return: QDF status of operation
77  */
78 QDF_STATUS direct_buf_rx_init(void);
79 
80 /**
81  * direct_buf_rx_deinit() - Function to deinitialize direct buf rx module
82  *
83  * Return: QDF status of operation
84  */
85 QDF_STATUS direct_buf_rx_deinit(void);
86 
87 /**
88  * direct_buf_rx_target_attach() - Attach hal_soc,osdev in direct buf rx psoc obj
89  * @psoc: pointer to psoc object
90  * @hal_soc: Opaque HAL SOC handle
91  * @osdev: QDF os device handle
92  *
93  * Return: QDF status of operation
94  */
95 QDF_STATUS direct_buf_rx_target_attach(struct wlan_objmgr_psoc *psoc,
96 				void *hal_soc, qdf_device_t osdev);
97 
98 /**
99  * target_if_direct_buf_rx_register_tx_ops() - Register tx ops for direct buffer
100  *                                             rx module
101  * @tx_ops: pointer to lmac interface tx ops
102  *
103  * Return: None
104  */
105 void target_if_direct_buf_rx_register_tx_ops(
106 				struct wlan_lmac_if_tx_ops *tx_ops);
107 
108 #endif /* _TARGET_IF_DIRECT_BUF_RX_API_H_ */
109