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