xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_ppe.h (revision 16b41427d48ceff3a0ad8603829df586663c7b7d)
1 /*
2  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef _CDP_TXRX_PPE_H_
18 #define _CDP_TXRX_PPE_H_
19 
20 /**
21  * cdp_ppesds_entry_attach() - attach the ppe vp interface.
22  * @soc: data path soc handle
23  * @vdev_id: vdev id
24  * @vpai: PPE VP opaque
25  * @ppe_vp_num: Allocated VP Port number
26  * @vp_params: VP params
27  *
28  * return: qdf_status where vp entry got allocated or not.
29  */
30 static inline
31 QDF_STATUS cdp_ppesds_entry_attach(struct cdp_soc_t *soc, uint8_t vdev_id,
32 				   void *vpai, int32_t *ppe_vp_num,
33 				   struct cdp_ds_vp_params *vp_params)
34 {
35 	if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
36 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
37 			  "%s invalid instance", __func__);
38 		return QDF_STATUS_E_NOSUPPORT;
39 	}
40 
41 	if (soc->ops->ppeds_ops->ppeds_entry_attach)
42 		return soc->ops->ppeds_ops->ppeds_entry_attach(soc, vdev_id,
43 							       vpai,
44 							       ppe_vp_num,
45 							       vp_params);
46 
47 	return QDF_STATUS_E_INVAL;
48 }
49 
50 /**
51  * cdp_ppesds_entry_detach() - Detach the PPE VP interface.
52  * @soc: data path soc handle
53  * @vdev_id: vdev ID
54  * @vp_params: VP params
55  *
56  * return: void
57  */
58 static inline
59 void cdp_ppesds_entry_detach(struct cdp_soc_t *soc, uint8_t vdev_id,
60 			     struct cdp_ds_vp_params *vp_params)
61 {
62 	if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
63 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
64 			  "%s invalid instance", __func__);
65 		return;
66 	}
67 
68 	if (soc->ops->ppeds_ops->ppeds_entry_detach)
69 		return soc->ops->ppeds_ops->ppeds_entry_detach(soc,
70 							       vdev_id,
71 							       vp_params);
72 }
73 
74 /**
75  * cdp_ppesds_set_int_pri2tid() - Set the INT_PRI to TID
76  * @soc: data path soc handle
77  * @pri2tid: PRI2TID table
78  *
79  * return: void
80  */
81 static inline
82 void cdp_ppesds_set_int_pri2tid(struct cdp_soc_t *soc,
83 				uint8_t *pri2tid)
84 {
85 	if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
86 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
87 			  "%s invalid instance", __func__);
88 		return;
89 	}
90 
91 	if (soc->ops->ppeds_ops->ppeds_set_int_pri2tid)
92 		return soc->ops->ppeds_ops->ppeds_set_int_pri2tid(soc, pri2tid);
93 }
94 
95 /**
96  * cdp_ppesds_update_int_pri2tid() - Update the INT_PRI to TID
97  * @soc: data path soc handle
98  * @pri: Priority index
99  * @tid: TID mapped to the input priority
100  *
101  * return: void
102  */
103 static inline
104 void cdp_ppesds_update_int_pri2tid(struct cdp_soc_t *soc,
105 				   uint8_t pri, uint8_t tid)
106 {
107 	if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
108 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
109 			  "%s invalid instance", __func__);
110 	}
111 
112 	if (soc->ops->ppeds_ops->ppeds_update_int_pri2tid)
113 		return soc->ops->ppeds_ops->ppeds_update_int_pri2tid(soc, pri,
114 								     tid);
115 }
116 
117 /**
118  * cdp_ppesds_entry_dump() - Dump the PPE VP entries
119  * @soc: data path soc handle
120  *
121  * return: void
122  */
123 static inline
124 void cdp_ppesds_entry_dump(struct cdp_soc_t *soc)
125 {
126 	if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
127 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
128 			  "%s invalid instance", __func__);
129 		return;
130 	}
131 
132 	if (soc->ops->ppeds_ops->ppeds_entry_dump)
133 		soc->ops->ppeds_ops->ppeds_entry_dump(soc);
134 }
135 
136 /**
137  * cdp_ppesds_enable_pri2tid() - Enable PPE VP PRI2TID table
138  * @soc: data path soc handle
139  * @vdev_id: vdev id
140  * @val: Boolean value to enable/disable
141  *
142  * return: QDF_STATUS
143  */
144 static inline
145 QDF_STATUS cdp_ppesds_enable_pri2tid(struct cdp_soc_t *soc,
146 				     uint8_t vdev_id, bool val)
147 {
148 	if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
149 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
150 			  "%s invalid instance", __func__);
151 		return QDF_STATUS_E_INVAL;
152 	}
153 
154 	if (soc->ops->ppeds_ops->ppeds_enable_pri2tid)
155 		return soc->ops->ppeds_ops->ppeds_enable_pri2tid(soc, vdev_id,
156 								 val);
157 
158 	return QDF_STATUS_E_NOSUPPORT;
159 }
160 #endif /* _CDP_TXRX_PPE_H_ */
161