xref: /wlan-dirver/qca-wifi-host-cmn/qdf/inc/i_qdf_nbuf_api_m.h (revision 97f44cd39e4ff816eaa1710279d28cf6b9e65ad9)
1 /*
2  * Copyright (c) 2014-2017,2019-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: i_qdf_nbuf_api_m.h
21  *
22  * Platform specific qdf_nbuf_public network buffer API
23  * This file defines the network buffer abstraction.
24  * Included by qdf_nbuf.h and should not be included
25  * directly from other files.
26  */
27 
28 #ifndef _QDF_NBUF_M_H
29 #define _QDF_NBUF_M_H
30 
31 static inline int qdf_nbuf_ipa_owned_get(qdf_nbuf_t buf)
32 {
33 	return __qdf_nbuf_ipa_owned_get(buf);
34 }
35 
36 static inline void qdf_nbuf_ipa_owned_set(qdf_nbuf_t buf)
37 {
38 	__qdf_nbuf_ipa_owned_set(buf);
39 }
40 
41 static inline void qdf_nbuf_ipa_owned_clear(qdf_nbuf_t buf)
42 {
43 	__qdf_nbuf_ipa_owned_clear(buf);
44 }
45 
46 static inline int qdf_nbuf_ipa_priv_get(qdf_nbuf_t buf)
47 {
48 	return __qdf_nbuf_ipa_priv_get(buf);
49 }
50 
51 static inline void qdf_nbuf_ipa_priv_set(qdf_nbuf_t buf, uint32_t priv)
52 {
53 
54 	QDF_BUG(!(priv & QDF_NBUF_IPA_CHECK_MASK));
55 	__qdf_nbuf_ipa_priv_set(buf, priv);
56 }
57 
58 static inline void qdf_nbuf_tx_notify_comp_set(qdf_nbuf_t buf, uint8_t val)
59 {
60 	QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_NOTIFY_COMP(buf) = val;
61 }
62 
63 static inline uint8_t qdf_nbuf_tx_notify_comp_get(qdf_nbuf_t buf)
64 {
65 	return QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_NOTIFY_COMP(buf);
66 }
67 
68 /**
69  * qdf_nbuf_set_rx_protocol_tag()
70  * @buf: Network buffer
71  * @val: Value to be set in the nbuf
72  * Return: None
73  */
74 static inline void qdf_nbuf_set_rx_protocol_tag(qdf_nbuf_t buf, uint16_t val)
75 {
76 }
77 
78 /**
79  * qdf_nbuf_get_rx_protocol_tag()
80  * @buf: Network buffer
81  * Return: Value of rx protocol tag, here 0
82  */
83 static inline uint16_t qdf_nbuf_get_rx_protocol_tag(qdf_nbuf_t buf)
84 {
85 	return 0;
86 }
87 
88 /**
89  * qdf_nbuf_set_rx_flow_tag() - set given value in flow tag field
90  * of buf(skb->cb)
91  * @buf: Network buffer
92  * @val: Rx Flow Tag to be set in the nbuf
93  * Return: None
94  */
95 static inline void qdf_nbuf_set_rx_flow_tag(qdf_nbuf_t buf, uint16_t val)
96 {
97 }
98 
99 /**
100  * qdf_nbuf_get_rx_flow_tag() - Get the value of flow_tag
101  * field of buf(skb->cb)
102  * @buf: Network buffer
103  * Return: Value of rx flow tag, here 0
104  */
105 static inline uint16_t qdf_nbuf_get_rx_flow_tag(qdf_nbuf_t buf)
106 {
107 	return 0;
108 }
109 
110 /**
111  * qdf_nbuf_set_exc_frame() - set exception frame flag
112  * @buf: Network buffer whose cb is to set exception frame flag
113  * @value: exception frame flag, value 0 or 1.
114  *
115  * Return: none
116  */
117 static inline void qdf_nbuf_set_exc_frame(qdf_nbuf_t buf, uint8_t value)
118 {
119 	QDF_NBUF_CB_RX_PACKET_EXC_FRAME(buf) = value;
120 }
121 
122 /**
123  * qdf_nbuf_is_exc_frame() - check exception frame flag bit
124  * @buf: Network buffer to get exception flag
125  *
126  * Return: 0 or 1
127  */
128 static inline uint8_t qdf_nbuf_is_exc_frame(qdf_nbuf_t buf)
129 {
130 	return QDF_NBUF_CB_RX_PACKET_EXC_FRAME(buf);
131 }
132 
133 /**
134  * qdf_nbuf_set_rx_ipa_smmu_map() - set ipa smmu mapped flag
135  * @buf: Network buffer
136  * @value: 1 - ipa smmu mapped, 0 - ipa smmu unmapped
137  *
138  * Return: none
139  */
140 static inline void qdf_nbuf_set_rx_ipa_smmu_map(qdf_nbuf_t buf,
141 						uint8_t value)
142 {
143 	QDF_NBUF_CB_RX_PACKET_IPA_SMMU_MAP(buf) = value;
144 }
145 
146 /**
147  * qdf_nbuf_is_rx_ipa_smmu_map() - check ipa smmu map flag
148  * @buf: Network buffer
149  *
150  * Return 0 or 1
151  */
152 static inline uint8_t qdf_nbuf_is_rx_ipa_smmu_map(qdf_nbuf_t buf)
153 {
154 	return QDF_NBUF_CB_RX_PACKET_IPA_SMMU_MAP(buf);
155 }
156 
157 /**
158  * qdf_nbuf_set_rx_reo_dest_ind() - set reo destination indication
159  * @buf: Network buffer
160  * @value: reo destination indication value to set
161  *
162  * Return: none
163  */
164 static inline void qdf_nbuf_set_rx_reo_dest_ind(qdf_nbuf_t buf,
165 						uint8_t value)
166 {
167 	QDF_NBUF_CB_RX_PACKET_REO_DEST_IND(buf) = value;
168 }
169 
170 /**
171  * qdf_nbuf_get_rx_reo_dest_ind() - get reo destination indication
172  * @buf: Network buffer
173  *
174  * Return reo destination indication value (0 ~ 31)
175  */
176 static inline uint8_t qdf_nbuf_get_rx_reo_dest_ind(qdf_nbuf_t buf)
177 {
178 	return QDF_NBUF_CB_RX_PACKET_REO_DEST_IND(buf);
179 }
180 #endif /* _QDF_NBUF_M_H */
181