xref: /wlan-dirver/qca-wifi-host-cmn/qdf/inc/i_qdf_nbuf_api_m.h (revision d0c05845839e5f2ba5a8dcebe0cd3e4cd4e8dfcf)
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_m.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_M_H
30 #define _QDF_NBUF_M_H
31 
32 static inline int qdf_nbuf_ipa_owned_get(qdf_nbuf_t buf)
33 {
34 	return __qdf_nbuf_ipa_owned_get(buf);
35 }
36 
37 static inline void qdf_nbuf_ipa_owned_set(qdf_nbuf_t buf)
38 {
39 	__qdf_nbuf_ipa_owned_set(buf);
40 }
41 
42 static inline void qdf_nbuf_ipa_owned_clear(qdf_nbuf_t buf)
43 {
44 	__qdf_nbuf_ipa_owned_clear(buf);
45 }
46 
47 static inline int qdf_nbuf_ipa_priv_get(qdf_nbuf_t buf)
48 {
49 	return __qdf_nbuf_ipa_priv_get(buf);
50 }
51 
52 static inline void qdf_nbuf_ipa_priv_set(qdf_nbuf_t buf, uint32_t priv)
53 {
54 
55 	QDF_BUG(!(priv & QDF_NBUF_IPA_CHECK_MASK));
56 	__qdf_nbuf_ipa_priv_set(buf, priv);
57 }
58 
59 static inline void qdf_nbuf_tx_notify_comp_set(qdf_nbuf_t buf, uint8_t val)
60 {
61 	QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_NOTIFY_COMP(buf) = val;
62 }
63 
64 static inline uint8_t qdf_nbuf_tx_notify_comp_get(qdf_nbuf_t buf)
65 {
66 	return QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_NOTIFY_COMP(buf);
67 }
68 
69 /**
70  * qdf_nbuf_set_rx_protocol_tag()
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 }
78 
79 /**
80  * qdf_nbuf_get_rx_protocol_tag()
81  * @buf: Network buffer
82  * Return: Value of rx protocol tag, here 0
83  */
84 static inline uint16_t qdf_nbuf_get_rx_protocol_tag(qdf_nbuf_t buf)
85 {
86 	return 0;
87 }
88 
89 /**
90  * qdf_nbuf_set_rx_flow_tag() - set given value in flow tag field
91  * of buf(skb->cb)
92  * @buf: Network buffer
93  * @val: Rx Flow Tag to be set in the nbuf
94  * Return: None
95  */
96 static inline void qdf_nbuf_set_rx_flow_tag(qdf_nbuf_t buf, uint16_t val)
97 {
98 }
99 
100 /**
101  * qdf_nbuf_get_rx_flow_tag() - Get the value of flow_tag
102  * field of buf(skb->cb)
103  * @buf: Network buffer
104  * Return: Value of rx flow tag, here 0
105  */
106 static inline uint16_t qdf_nbuf_get_rx_flow_tag(qdf_nbuf_t buf)
107 {
108 	return 0;
109 }
110 
111 /**
112  * qdf_nbuf_set_exc_frame() - set exception frame flag
113  * @buf: Network buffer whose cb is to set exception frame flag
114  * @value: exception frame flag, value 0 or 1.
115  *
116  * Return: none
117  */
118 static inline void qdf_nbuf_set_exc_frame(qdf_nbuf_t buf, uint8_t value)
119 {
120 	QDF_NBUF_CB_RX_PACKET_EXC_FRAME(buf) = value;
121 }
122 
123 /**
124  * qdf_nbuf_is_exc_frame() - check exception frame flag bit
125  * @buf: Network buffer to get exception flag
126  *
127  * Return: 0 or 1
128  */
129 static inline uint8_t qdf_nbuf_is_exc_frame(qdf_nbuf_t buf)
130 {
131 	return QDF_NBUF_CB_RX_PACKET_EXC_FRAME(buf);
132 }
133 
134 /**
135  * qdf_nbuf_set_lmac_id() - set lmac ID
136  * @buf: Network buffer
137  * @value: lmac ID value
138  *
139  * Return: none
140  */
141 static inline void qdf_nbuf_set_lmac_id(qdf_nbuf_t buf, uint8_t value)
142 {
143 	QDF_NBUF_CB_RX_PACKET_LMAC_ID(buf) = value;
144 }
145 
146 /**
147  * qdf_nbuf_get_lmac_id() - get lmac ID of RX packet
148  * @buf: Network buffer
149  *
150  * Return: lmac ID value
151  */
152 static inline uint8_t qdf_nbuf_get_lmac_id(qdf_nbuf_t buf)
153 {
154 	return QDF_NBUF_CB_RX_PACKET_LMAC_ID(buf);
155 }
156 
157 /**
158  * qdf_nbuf_set_rx_ipa_smmu_map() - set ipa smmu mapped flag
159  * @buf: Network buffer
160  * @value: 1 - ipa smmu mapped, 0 - ipa smmu unmapped
161  *
162  * Return: none
163  */
164 static inline void qdf_nbuf_set_rx_ipa_smmu_map(qdf_nbuf_t buf,
165 						uint8_t value)
166 {
167 	QDF_NBUF_CB_RX_PACKET_IPA_SMMU_MAP(buf) = value;
168 }
169 
170 /**
171  * qdf_nbuf_is_rx_ipa_smmu_map() - check ipa smmu map flag
172  * @buf: Network buffer
173  *
174  * Return 0 or 1
175  */
176 static inline uint8_t qdf_nbuf_is_rx_ipa_smmu_map(qdf_nbuf_t buf)
177 {
178 	return QDF_NBUF_CB_RX_PACKET_IPA_SMMU_MAP(buf);
179 }
180 
181 /**
182  * qdf_nbuf_set_rx_reo_dest_ind_or_sw_excpt() - set reo destination indication
183 						or sw exception flag
184  * @buf: Network buffer
185  * @value: value to set
186  *
187  * Return: none
188  */
189 static inline void qdf_nbuf_set_rx_reo_dest_ind_or_sw_excpt(qdf_nbuf_t buf,
190 							    uint8_t value)
191 {
192 	QDF_NBUF_CB_RX_PACKET_REO_DEST_IND_OR_SW_EXCPT(buf) = value;
193 }
194 
195 /**
196  * qdf_nbuf_get_rx_reo_dest_ind_or_sw_excpt() - get reo destination indication
197 						or sw exception flag
198  * @buf: Network buffer
199  *
200  * Return reo destination indication value (0 ~ 31) or sw exception (0 ~ 1)
201  */
202 static inline uint8_t qdf_nbuf_get_rx_reo_dest_ind_or_sw_excpt(qdf_nbuf_t buf)
203 {
204 	return QDF_NBUF_CB_RX_PACKET_REO_DEST_IND_OR_SW_EXCPT(buf);
205 }
206 
207 /**
208  * qdf_nbuf_get_tx_fctx() - get fctx of nbuf
209  *
210  * @buf: Network buffer
211  * Return: fctx value
212  */
213 static inline void *qdf_nbuf_get_tx_fctx(qdf_nbuf_t buf)
214 {
215 	return NULL;
216 }
217 
218 /**
219  * qdf_nbuf_set_tx_fctx_type() - set ftype and fctx
220  *
221  * @buf: Network buffer
222  * @ctx: address to fctx
223  * @type: ftype
224  *
225  * Return: void
226  */
227 static inline void
228 qdf_nbuf_set_tx_fctx_type(qdf_nbuf_t buf, void *ctx, uint8_t type)
229 {
230 }
231 #endif /* _QDF_NBUF_M_H */
232