1 /*
2  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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 _CDP_TXRX_FSE_H_
20 #define _CDP_TXRX_FSE_H_
21 
22 #include <cdp_txrx_cmn_struct.h>
23 #include <cdp_txrx_cmn.h>
24 
25 #ifdef WLAN_SUPPORT_RX_FLOW_TAG
26 static inline QDF_STATUS
cdp_fse_flow_add(ol_txrx_soc_handle soc,uint32_t * src_ip,uint32_t src_port,uint32_t * dest_ip,uint32_t dest_port,uint8_t protocol,uint8_t version)27 cdp_fse_flow_add(ol_txrx_soc_handle soc,
28 		 uint32_t *src_ip, uint32_t src_port,
29 		 uint32_t *dest_ip, uint32_t dest_port,
30 		 uint8_t protocol, uint8_t version)
31 {
32 	if (!soc || !soc->ops) {
33 		dp_cdp_debug("Invalid Instance");
34 		QDF_BUG(0);
35 		return QDF_STATUS_E_FAILURE;
36 	}
37 
38 	if (!soc->ops->fse_ops ||
39 	    !soc->ops->fse_ops->fse_rule_add) {
40 		return QDF_STATUS_E_FAILURE;
41 	}
42 
43 	return soc->ops->fse_ops->fse_rule_add(soc,
44 					       src_ip, src_port,
45 					       dest_ip, dest_port,
46 					       protocol, version);
47 }
48 
49 static inline QDF_STATUS
cdp_fse_flow_delete(ol_txrx_soc_handle soc,uint32_t * src_ip,uint32_t src_port,uint32_t * dest_ip,uint32_t dest_port,uint8_t protocol,uint8_t version)50 cdp_fse_flow_delete(ol_txrx_soc_handle soc,
51 		    uint32_t *src_ip, uint32_t src_port,
52 		    uint32_t *dest_ip, uint32_t dest_port,
53 		    uint8_t protocol, uint8_t version)
54 {
55 	if (!soc || !soc->ops) {
56 		dp_cdp_debug("Invalid Instance");
57 		QDF_BUG(0);
58 		return QDF_STATUS_E_FAILURE;
59 	}
60 
61 	if (!soc->ops->fse_ops ||
62 	    !soc->ops->fse_ops->fse_rule_delete) {
63 		return QDF_STATUS_E_FAILURE;
64 	}
65 
66 	return soc->ops->fse_ops->fse_rule_delete(soc,
67 						  src_ip, src_port,
68 						  dest_ip, dest_port,
69 						  protocol, version);
70 }
71 
72 #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
73 #endif /* _CDP_TXRX_FSE_H_ */
74