xref: /wlan-driver/qca-wifi-host-cmn/dp/inc/cdp_txrx_fse.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name #ifndef _CDP_TXRX_FSE_H_
20*5113495bSYour Name #define _CDP_TXRX_FSE_H_
21*5113495bSYour Name 
22*5113495bSYour Name #include <cdp_txrx_cmn_struct.h>
23*5113495bSYour Name #include <cdp_txrx_cmn.h>
24*5113495bSYour Name 
25*5113495bSYour Name #ifdef WLAN_SUPPORT_RX_FLOW_TAG
26*5113495bSYour Name 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*5113495bSYour Name cdp_fse_flow_add(ol_txrx_soc_handle soc,
28*5113495bSYour Name 		 uint32_t *src_ip, uint32_t src_port,
29*5113495bSYour Name 		 uint32_t *dest_ip, uint32_t dest_port,
30*5113495bSYour Name 		 uint8_t protocol, uint8_t version)
31*5113495bSYour Name {
32*5113495bSYour Name 	if (!soc || !soc->ops) {
33*5113495bSYour Name 		dp_cdp_debug("Invalid Instance");
34*5113495bSYour Name 		QDF_BUG(0);
35*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
36*5113495bSYour Name 	}
37*5113495bSYour Name 
38*5113495bSYour Name 	if (!soc->ops->fse_ops ||
39*5113495bSYour Name 	    !soc->ops->fse_ops->fse_rule_add) {
40*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
41*5113495bSYour Name 	}
42*5113495bSYour Name 
43*5113495bSYour Name 	return soc->ops->fse_ops->fse_rule_add(soc,
44*5113495bSYour Name 					       src_ip, src_port,
45*5113495bSYour Name 					       dest_ip, dest_port,
46*5113495bSYour Name 					       protocol, version);
47*5113495bSYour Name }
48*5113495bSYour Name 
49*5113495bSYour Name 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*5113495bSYour Name cdp_fse_flow_delete(ol_txrx_soc_handle soc,
51*5113495bSYour Name 		    uint32_t *src_ip, uint32_t src_port,
52*5113495bSYour Name 		    uint32_t *dest_ip, uint32_t dest_port,
53*5113495bSYour Name 		    uint8_t protocol, uint8_t version)
54*5113495bSYour Name {
55*5113495bSYour Name 	if (!soc || !soc->ops) {
56*5113495bSYour Name 		dp_cdp_debug("Invalid Instance");
57*5113495bSYour Name 		QDF_BUG(0);
58*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
59*5113495bSYour Name 	}
60*5113495bSYour Name 
61*5113495bSYour Name 	if (!soc->ops->fse_ops ||
62*5113495bSYour Name 	    !soc->ops->fse_ops->fse_rule_delete) {
63*5113495bSYour Name 		return QDF_STATUS_E_FAILURE;
64*5113495bSYour Name 	}
65*5113495bSYour Name 
66*5113495bSYour Name 	return soc->ops->fse_ops->fse_rule_delete(soc,
67*5113495bSYour Name 						  src_ip, src_port,
68*5113495bSYour Name 						  dest_ip, dest_port,
69*5113495bSYour Name 						  protocol, version);
70*5113495bSYour Name }
71*5113495bSYour Name 
72*5113495bSYour Name #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
73*5113495bSYour Name #endif /* _CDP_TXRX_FSE_H_ */
74