xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_raw.h (revision 4865edfd190c086bbe2c69aae12a8226f877b91e)
1 /*
2  * Copyright (c) 2016-2017 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_raw.h
21  * @brief Define the host data path raw mode API functions
22  * called by the host control SW and the OS interface module
23  */
24 #ifndef _CDP_TXRX_RAW_H_
25 #define _CDP_TXRX_RAW_H_
26 
27 #include "cdp_txrx_handle.h"
28 #include "cdp_txrx_ops.h"
29 /* TODO: adf need to be replaced with qdf */
30 static inline int cdp_get_nwifi_mode(ol_txrx_soc_handle soc,
31 	struct cdp_vdev *vdev)
32 {
33 	if (!soc || !soc->ops) {
34 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
35 				"%s: Invalid Instance", __func__);
36 		QDF_BUG(0);
37 		return 0;
38 	}
39 
40 	if (!soc->ops->raw_ops ||
41 	    !soc->ops->raw_ops->txrx_get_nwifi_mode)
42 		return 0;
43 
44 	return soc->ops->raw_ops->txrx_get_nwifi_mode(vdev);
45 }
46 
47 /**
48  * @brief finds the ast entry for the packet
49  * @details: Finds the ast entry i.e 4th address for the packet based on the
50  *               details in the netbuf.
51  *
52  * @param vdev - the data virtual device object
53  * @param pnbuf - pointer to nbuf
54  * @param raw_ast - pointer to fill ast information
55  *
56  * @return - 0 on success, -1 on error, 1 if more nbufs need to be consumed.
57  */
58 
59 static inline void
60 cdp_rawsim_get_astentry (ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
61 			qdf_nbuf_t *pnbuf, struct cdp_raw_ast *raw_ast)
62 {
63 
64 	if (!soc || !soc->ops) {
65 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
66 				"%s: Invalid Instance", __func__);
67 		QDF_BUG(0);
68 		return;
69 	}
70 
71 	if (!soc->ops->raw_ops ||
72 	    !soc->ops->raw_ops->rsim_get_astentry)
73 		return;
74 
75 	soc->ops->raw_ops->rsim_get_astentry(vdev, pnbuf, raw_ast);
76 }
77 
78 #endif
79