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_exc_frame() - set exception frame flag 116 * @buf: Network buffer whose cb is to set exception frame flag 117 * @value: exception frame flag, value 0 or 1. 118 * 119 * Return: none 120 */ 121 static inline void qdf_nbuf_set_exc_frame(qdf_nbuf_t buf, uint8_t value) 122 { 123 } 124 125 /** 126 * qdf_nbuf_set_rx_ipa_smmu_map() - set ipa smmu mapped flag 127 * @buf: Network buffer 128 * @value: 1 - ipa smmu mapped, 0 - ipa smmu unmapped 129 * 130 * Return: none 131 */ 132 static inline void qdf_nbuf_set_rx_ipa_smmu_map(qdf_nbuf_t buf, 133 uint8_t value) 134 { 135 QDF_NBUF_CB_RX_PACKET_IPA_SMMU_MAP(buf) = value; 136 } 137 138 /** 139 * qdf_nbuf_is_intra_bss() - get intra bss bit 140 * @buf: Network buffer 141 * 142 * Return: integer value - 0/1 143 */ 144 static inline int qdf_nbuf_is_intra_bss(qdf_nbuf_t buf) 145 { 146 return __qdf_nbuf_is_intra_bss(buf); 147 } 148 149 /** 150 * qdf_nbuf_set_intra_bss() - set intra bss bit 151 * @buf: Network buffer 152 * @val: 0/1 153 * 154 * Return: void 155 */ 156 static inline void qdf_nbuf_set_intra_bss(qdf_nbuf_t buf, uint8_t val) 157 { 158 __qdf_nbuf_set_intra_bss(buf, val); 159 } 160 161 /** 162 * qdf_nbuf_is_rx_ipa_smmu_map() - check ipa smmu map flag 163 * @buf: Network buffer 164 * 165 * Return 0 or 1 166 */ 167 static inline uint8_t qdf_nbuf_is_rx_ipa_smmu_map(qdf_nbuf_t buf) 168 { 169 return QDF_NBUF_CB_RX_PACKET_IPA_SMMU_MAP(buf); 170 } 171 172 static inline int qdf_nbuf_ipa_owned_get(qdf_nbuf_t buf) 173 { 174 return 0; 175 } 176 177 static inline void qdf_nbuf_ipa_owned_set(qdf_nbuf_t buf) 178 { } 179 180 static inline void qdf_nbuf_ipa_owned_clear(qdf_nbuf_t buf) 181 { } 182 183 static inline int qdf_nbuf_ipa_priv_get(qdf_nbuf_t buf) 184 { 185 return 0; 186 } 187 188 static inline void qdf_nbuf_ipa_priv_set(qdf_nbuf_t buf, uint32_t priv) 189 { } 190 191 /** 192 * qdf_nbuf_set_rx_reo_dest_ind_or_sw_excpt() - set reo destination indication 193 or sw exception flag 194 * @buf: Network buffer 195 * @value: value to set 196 * 197 * Return: none 198 */ 199 static inline void qdf_nbuf_set_rx_reo_dest_ind_or_sw_excpt(qdf_nbuf_t buf, 200 uint8_t value) 201 { 202 } 203 204 static inline void qdf_nbuf_tx_notify_comp_set(qdf_nbuf_t buf, uint8_t val) 205 { 206 } 207 208 static inline uint8_t qdf_nbuf_tx_notify_comp_get(qdf_nbuf_t buf) 209 { 210 return 0; 211 } 212 213 static inline void qdf_nbuf_set_lmac_id(qdf_nbuf_t buf, uint8_t value) 214 { 215 } 216 217 static inline uint8_t qdf_nbuf_get_lmac_id(qdf_nbuf_t buf) 218 { 219 return 0; 220 } 221 222 #endif /* _QDF_NBUF_W_H */ 223