xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_raw.h (revision 839714c413056bc9b82af766295b4ffabe28bbbf)
1 /*
2  * Copyright (c) 2016-2017, 2019, 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_raw.h
22  * Define the host data path raw mode API functions
23  * called by the host control SW and the OS interface module
24  */
25 #ifndef _CDP_TXRX_RAW_H_
26 #define _CDP_TXRX_RAW_H_
27 
28 #include "cdp_txrx_handle.h"
29 #include "cdp_txrx_ops.h"
30 #include <cdp_txrx_cmn.h>
31 
32 /**
33  * cdp_rawsim_get_astentry() - finds the ast entry for the packet
34  * @soc: soc handle
35  * @vdev_id: id of the data virtual device object
36  * @pnbuf: pointer to nbuf
37  * @raw_ast: pointer to fill ast information
38  *
39  * Finds the ast entry i.e 4th address for the packet based on the
40  * details in the netbuf.
41  *
42  * Return: 0 on success, -1 on error, 1 if more nbufs need to be consumed.
43  */
44 
45 static inline QDF_STATUS
46 cdp_rawsim_get_astentry(ol_txrx_soc_handle soc, uint8_t vdev_id,
47 			qdf_nbuf_t *pnbuf, struct cdp_raw_ast *raw_ast)
48 {
49 
50 	if (!soc || !soc->ops) {
51 		dp_cdp_debug("Invalid Instance");
52 		QDF_BUG(0);
53 		return QDF_STATUS_E_FAILURE;
54 	}
55 
56 	if (!soc->ops->raw_ops ||
57 	    !soc->ops->raw_ops->rsim_get_astentry)
58 		return QDF_STATUS_E_FAILURE;
59 
60 	return soc->ops->raw_ops->rsim_get_astentry(soc, vdev_id,
61 						    pnbuf, raw_ast);
62 }
63 
64 #endif
65