xref: /wlan-driver/qca-wifi-host-cmn/qdf/inc/i_qdf_nbuf_api_w.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2014-2017,2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-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: 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 
qdf_nbuf_get_tx_fctx(qdf_nbuf_t buf)32 static inline void *qdf_nbuf_get_tx_fctx(qdf_nbuf_t buf)
33 {
34 	return  __qdf_nbuf_get_tx_fctx(buf);
35 }
36 
qdf_nbuf_get_rx_fctx(qdf_nbuf_t buf)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
qdf_nbuf_set_tx_fctx_type(qdf_nbuf_t buf,void * ctx,uint8_t type)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
qdf_nbuf_set_rx_fctx_type(qdf_nbuf_t buf,void * ctx,uint8_t type)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 *
qdf_nbuf_get_ext_cb(qdf_nbuf_t buf)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
qdf_nbuf_set_ext_cb(qdf_nbuf_t buf,void * ref)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  */
qdf_nbuf_set_rx_protocol_tag(qdf_nbuf_t buf,uint16_t val)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  */
qdf_nbuf_get_rx_protocol_tag(qdf_nbuf_t buf)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  */
qdf_nbuf_set_rx_flow_tag(qdf_nbuf_t buf,uint16_t val)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  */
qdf_nbuf_get_rx_flow_tag(qdf_nbuf_t buf)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_valid() - set given value in flow idx valid
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  */
qdf_nbuf_set_rx_flow_idx_valid(qdf_nbuf_t buf,uint8_t val)121 static inline void qdf_nbuf_set_rx_flow_idx_valid(qdf_nbuf_t buf, uint8_t val)
122 {
123 	__qdf_nbuf_set_rx_flow_idx_valid(buf, val);
124 }
125 
126 /**
127  * qdf_nbuf_get_rx_flow_idx_valid() - Get the value of flow_idx_valid
128  * field of buf(skb->cb)
129  * @buf: Network buffer
130  * Return: Value of the Rx flow tag in the nbuf
131  */
qdf_nbuf_get_rx_flow_idx_valid(qdf_nbuf_t buf)132 static inline uint8_t qdf_nbuf_get_rx_flow_idx_valid(qdf_nbuf_t buf)
133 {
134 	return __qdf_nbuf_get_rx_flow_idx_valid(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  */
qdf_nbuf_set_rx_flow_idx_timeout(qdf_nbuf_t buf,uint8_t val)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  */
qdf_nbuf_get_rx_flow_idx_timeout(qdf_nbuf_t buf)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  */
qdf_nbuf_set_exc_frame(qdf_nbuf_t buf,uint8_t value)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  */
qdf_nbuf_set_rx_ipa_smmu_map(qdf_nbuf_t buf,uint8_t value)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  */
qdf_nbuf_is_intra_bss(qdf_nbuf_t buf)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  */
qdf_nbuf_set_intra_bss(qdf_nbuf_t buf,uint8_t val)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  */
qdf_nbuf_is_rx_ipa_smmu_map(qdf_nbuf_t buf)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 
qdf_nbuf_ipa_owned_get(qdf_nbuf_t buf)218 static inline int qdf_nbuf_ipa_owned_get(qdf_nbuf_t buf)
219 {
220 	return 0;
221 }
222 
qdf_nbuf_ipa_owned_set(qdf_nbuf_t buf)223 static inline void qdf_nbuf_ipa_owned_set(qdf_nbuf_t buf)
224 { }
225 
qdf_nbuf_ipa_owned_clear(qdf_nbuf_t buf)226 static inline void qdf_nbuf_ipa_owned_clear(qdf_nbuf_t buf)
227 { }
228 
qdf_nbuf_ipa_priv_get(qdf_nbuf_t buf)229 static inline int qdf_nbuf_ipa_priv_get(qdf_nbuf_t buf)
230 {
231 	return 0;
232 }
233 
qdf_nbuf_ipa_priv_set(qdf_nbuf_t buf,uint32_t priv)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  */
qdf_nbuf_set_rx_reo_dest_ind_or_sw_excpt(qdf_nbuf_t buf,uint8_t value)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 
qdf_nbuf_tx_notify_comp_set(qdf_nbuf_t buf,uint8_t val)250 static inline void qdf_nbuf_tx_notify_comp_set(qdf_nbuf_t buf, uint8_t val)
251 {
252 }
253 
qdf_nbuf_tx_notify_comp_get(qdf_nbuf_t buf)254 static inline uint8_t qdf_nbuf_tx_notify_comp_get(qdf_nbuf_t buf)
255 {
256 	return 0;
257 }
258 
qdf_nbuf_set_lmac_id(qdf_nbuf_t buf,uint8_t value)259 static inline void qdf_nbuf_set_lmac_id(qdf_nbuf_t buf, uint8_t value)
260 {
261 }
262 
qdf_nbuf_get_lmac_id(qdf_nbuf_t buf)263 static inline uint8_t qdf_nbuf_get_lmac_id(qdf_nbuf_t buf)
264 {
265 	return 0;
266 }
267 
qdf_nbuf_get_mpdu_seq_num(qdf_nbuf_t buf)268 static inline uint16_t qdf_nbuf_get_mpdu_seq_num(qdf_nbuf_t buf)
269 {
270 	return 0;
271 }
272 
273 /**
274  * qdf_nbuf_tx_set_band() - Set band in nbuf cb
275  * @nbuf: nbuf pointer
276  * @band: peer band
277  *
278  * Return: None
279  */
280 static inline void
qdf_nbuf_tx_set_band(qdf_nbuf_t nbuf,uint8_t band)281 qdf_nbuf_tx_set_band(qdf_nbuf_t nbuf, uint8_t band)
282 {
283 }
284 
285 /**
286  * qdf_nbuf_tx_get_band() - Get band from nbuf cb
287  * @nbuf: nbuf pointer
288  *
289  * Return: Band
290  */
291 static inline uint8_t
qdf_nbuf_tx_get_band(qdf_nbuf_t nbuf)292 qdf_nbuf_tx_get_band(qdf_nbuf_t nbuf)
293 {
294 	return 0;
295 }
296 
297 /**
298  * qdf_nbuf_rx_set_band() - Set band in nbuf cb
299  * @nbuf: nbuf pointer
300  * @band: peer band
301  *
302  * Return: None
303  */
304 static inline void
qdf_nbuf_rx_set_band(qdf_nbuf_t nbuf,uint8_t band)305 qdf_nbuf_rx_set_band(qdf_nbuf_t nbuf, uint8_t band)
306 {
307 }
308 
309 /**
310  * qdf_nbuf_rx_get_band() - Get band from nbuf cb
311  * @nbuf: nbuf pointer
312  *
313  * Return: Band
314  */
315 static inline uint8_t
qdf_nbuf_rx_get_band(qdf_nbuf_t nbuf)316 qdf_nbuf_rx_get_band(qdf_nbuf_t nbuf)
317 {
318 	return 0;
319 }
320 #endif /* _QDF_NBUF_W_H */
321