xref: /wlan-dirver/qca-wifi-host-cmn/qdf/inc/i_qdf_nbuf_api_w.h (revision f9c3074fea7ce97ce912d1874e48e202be7f3702)
1 /*
2  * Copyright (c) 2014-2017,2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 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: i_qdf_nbuf_api_w.h
22  *
23  * Platform specific qdf_nbuf_public network buffer API
24  * This file defines the network buffer abstraction.
25  * Included by qdf_nbuf.h and should not be included
26  * directly from other files.
27  */
28 
29 #ifndef _QDF_NBUF_W_H
30 #define _QDF_NBUF_W_H
31 
32 static inline void *qdf_nbuf_get_tx_fctx(qdf_nbuf_t buf)
33 {
34 	return  __qdf_nbuf_get_tx_fctx(buf);
35 }
36 
37 static inline void *qdf_nbuf_get_rx_fctx(qdf_nbuf_t buf)
38 {
39 	return  __qdf_nbuf_get_rx_fctx(buf);
40 }
41 
42 
43 static inline void
44 qdf_nbuf_set_tx_fctx_type(qdf_nbuf_t buf, void *ctx, uint8_t type)
45 {
46 	__qdf_nbuf_set_tx_fctx_type(buf, ctx, type);
47 }
48 
49 static inline void
50 qdf_nbuf_set_rx_fctx_type(qdf_nbuf_t buf, void *ctx, uint8_t type)
51 {
52 	__qdf_nbuf_set_rx_fctx_type(buf, ctx, type);
53 }
54 
55 
56 static inline void *
57 qdf_nbuf_get_ext_cb(qdf_nbuf_t buf)
58 {
59 	return  __qdf_nbuf_get_ext_cb(buf);
60 }
61 
62 static inline void
63 qdf_nbuf_set_ext_cb(qdf_nbuf_t buf, void *ref)
64 {
65 	__qdf_nbuf_set_ext_cb(buf, ref);
66 }
67 
68 /**
69  * qdf_nbuf_set_rx_protocol_tag() - set given value in protocol_tag
70  * field of buf(skb->cb)
71  * @buf: Network buffer
72  * @val: Value to be set in the nbuf
73  * Return: None
74  */
75 static inline void qdf_nbuf_set_rx_protocol_tag(qdf_nbuf_t buf, uint16_t val)
76 {
77 	__qdf_nbuf_set_rx_protocol_tag(buf, val);
78 }
79 
80 /**
81  * qdf_nbuf_get_rx_protocol_tag() - Get the value of protocol_tag
82  * field of buf(skb->cb)
83  * @buf: Network buffer
84  * Return: Value of Rx protocol tag in the nbuf
85  */
86 static inline uint16_t qdf_nbuf_get_rx_protocol_tag(qdf_nbuf_t buf)
87 {
88 	return __qdf_nbuf_get_rx_protocol_tag(buf);
89 }
90 
91 /**
92  * qdf_nbuf_set_rx_flow_tag() - set given value in flow tag field
93  * of buf(skb->cb)
94  * @buf: Network buffer
95  * @val: Value of Rx flow tag to be set in the nbuf
96  * Return: None
97  */
98 static inline void qdf_nbuf_set_rx_flow_tag(qdf_nbuf_t buf, uint16_t val)
99 {
100 	__qdf_nbuf_set_rx_flow_tag(buf, val);
101 }
102 
103 /**
104  * qdf_nbuf_get_rx_flow_tag() - Get the value of flow_tag
105  * field of buf(skb->cb)
106  * @buf: Network buffer
107  * Return: Value of the Rx flow tag in the nbuf
108  */
109 static inline uint16_t qdf_nbuf_get_rx_flow_tag(qdf_nbuf_t buf)
110 {
111 	return __qdf_nbuf_get_rx_flow_tag(buf);
112 }
113 
114 /**
115  * qdf_nbuf_set_rx_flow_idx_invalid() - set given value in flow idx invalid
116  * of buf(skb->cb)
117  * @buf: Network buffer
118  * @val: Value of Rx flow tag to be set in the nbuf
119  * Return: None
120  */
121 static inline void qdf_nbuf_set_rx_flow_idx_invalid(qdf_nbuf_t buf, uint8_t val)
122 {
123 	__qdf_nbuf_set_rx_flow_idx_invalid(buf, val);
124 }
125 
126 /**
127  * qdf_nbuf_get_rx_flow_idx_invalid() - Get the value of flow_idx_invalid
128  * field of buf(skb->cb)
129  * @buf: Network buffer
130  * Return: Value of the Rx flow tag in the nbuf
131  */
132 static inline uint8_t qdf_nbuf_get_rx_flow_idx_invalid(qdf_nbuf_t buf)
133 {
134 	return __qdf_nbuf_get_rx_flow_idx_invalid(buf);
135 }
136 
137 /**
138  * qdf_nbuf_set_rx_flow_idx_timeout() - set given value in flow idx timeout
139  * of buf(skb->cb)
140  * @buf: Network buffer
141  * @val: Value of Rx flow tag to be set in the nbuf
142  * Return: None
143  */
144 static inline void qdf_nbuf_set_rx_flow_idx_timeout(qdf_nbuf_t buf, uint8_t val)
145 {
146 	__qdf_nbuf_set_rx_flow_idx_timeout(buf, val);
147 }
148 
149 /**
150  * qdf_nbuf_get_rx_flow_idx_timeout() - Get the value of flow_idx_timeout
151  * field of buf(skb->cb)
152  * @buf: Network buffer
153  * Return: Value of the Rx flow idx timeout in the nbuf
154  */
155 static inline uint8_t qdf_nbuf_get_rx_flow_idx_timeout(qdf_nbuf_t buf)
156 {
157 	return __qdf_nbuf_get_rx_flow_idx_timeout(buf);
158 }
159 
160 /**
161  * qdf_nbuf_set_exc_frame() - set exception frame flag
162  * @buf: Network buffer whose cb is to set exception frame flag
163  * @value: exception frame flag, value 0 or 1.
164  *
165  * Return: none
166  */
167 static inline void qdf_nbuf_set_exc_frame(qdf_nbuf_t buf, uint8_t value)
168 {
169 }
170 
171 /**
172  * qdf_nbuf_set_rx_ipa_smmu_map() - set ipa smmu mapped flag
173  * @buf: Network buffer
174  * @value: 1 - ipa smmu mapped, 0 - ipa smmu unmapped
175  *
176  * Return: none
177  */
178 static inline void qdf_nbuf_set_rx_ipa_smmu_map(qdf_nbuf_t buf,
179 						uint8_t value)
180 {
181 	QDF_NBUF_CB_RX_PACKET_IPA_SMMU_MAP(buf) = value;
182 }
183 
184 /**
185  * qdf_nbuf_is_intra_bss() - get intra bss bit
186  * @buf: Network buffer
187  *
188  * Return: integer value - 0/1
189  */
190 static inline int qdf_nbuf_is_intra_bss(qdf_nbuf_t buf)
191 {
192 	return __qdf_nbuf_is_intra_bss(buf);
193 }
194 
195 /**
196  * qdf_nbuf_set_intra_bss() - set  intra bss bit
197  * @buf: Network buffer
198  * @val: 0/1
199  *
200  * Return: void
201  */
202 static inline void qdf_nbuf_set_intra_bss(qdf_nbuf_t buf, uint8_t val)
203 {
204 	__qdf_nbuf_set_intra_bss(buf, val);
205 }
206 
207 /**
208  * qdf_nbuf_is_rx_ipa_smmu_map() - check ipa smmu map flag
209  * @buf: Network buffer
210  *
211  * Return 0 or 1
212  */
213 static inline uint8_t qdf_nbuf_is_rx_ipa_smmu_map(qdf_nbuf_t buf)
214 {
215 	return QDF_NBUF_CB_RX_PACKET_IPA_SMMU_MAP(buf);
216 }
217 
218 static inline int qdf_nbuf_ipa_owned_get(qdf_nbuf_t buf)
219 {
220 	return 0;
221 }
222 
223 static inline void qdf_nbuf_ipa_owned_set(qdf_nbuf_t buf)
224 { }
225 
226 static inline void qdf_nbuf_ipa_owned_clear(qdf_nbuf_t buf)
227 { }
228 
229 static inline int qdf_nbuf_ipa_priv_get(qdf_nbuf_t buf)
230 {
231 	return 0;
232 }
233 
234 static inline void qdf_nbuf_ipa_priv_set(qdf_nbuf_t buf, uint32_t priv)
235 { }
236 
237 /**
238  * qdf_nbuf_set_rx_reo_dest_ind_or_sw_excpt() - set reo destination indication
239 						or sw exception flag
240  * @buf: Network buffer
241  * @value: value to set
242  *
243  * Return: none
244  */
245 static inline void qdf_nbuf_set_rx_reo_dest_ind_or_sw_excpt(qdf_nbuf_t buf,
246 							    uint8_t value)
247 {
248 }
249 
250 static inline void qdf_nbuf_tx_notify_comp_set(qdf_nbuf_t buf, uint8_t val)
251 {
252 }
253 
254 static inline uint8_t qdf_nbuf_tx_notify_comp_get(qdf_nbuf_t buf)
255 {
256 	return 0;
257 }
258 
259 static inline void qdf_nbuf_set_lmac_id(qdf_nbuf_t buf, uint8_t value)
260 {
261 }
262 
263 static inline uint8_t qdf_nbuf_get_lmac_id(qdf_nbuf_t buf)
264 {
265 	return 0;
266 }
267 
268 #endif /* _QDF_NBUF_W_H */
269