Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 1 | /* |
Himanshu Agarwal | 974d0a5 | 2017-03-08 21:13:51 +0530 | [diff] [blame] | 2 | * Copyright (c) 2013-2014, 2016-2017 The Linux Foundation. All rights reserved. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | #ifndef HTC_PACKET_H_ |
| 29 | #define HTC_PACKET_H_ |
| 30 | |
| 31 | #include <osdep.h> |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 32 | #include "dl_list.h" |
| 33 | |
| 34 | /* ------ Endpoint IDS ------ */ |
| 35 | typedef enum { |
| 36 | ENDPOINT_UNUSED = -1, |
| 37 | ENDPOINT_0 = 0, |
| 38 | ENDPOINT_1 = 1, |
| 39 | ENDPOINT_2 = 2, |
| 40 | ENDPOINT_3, |
| 41 | ENDPOINT_4, |
| 42 | ENDPOINT_5, |
| 43 | ENDPOINT_6, |
| 44 | ENDPOINT_7, |
| 45 | ENDPOINT_8, |
| 46 | ENDPOINT_MAX, |
| 47 | } HTC_ENDPOINT_ID; |
| 48 | |
| 49 | struct _HTC_PACKET; |
| 50 | |
| 51 | typedef void (*HTC_PACKET_COMPLETION)(void *, struct _HTC_PACKET *); |
| 52 | |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 53 | typedef uint16_t HTC_TX_TAG; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 54 | |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 55 | /** |
| 56 | * struct htc_tx_packet_info - HTC TX packet information |
| 57 | * @Tag: tag used to selective flush packets |
| 58 | * @CreditsUsed: number of credits used for this TX packet (HTC internal) |
| 59 | * @SendFlags: send flags (HTC internal) |
| 60 | * @SeqNo: internal seq no for debugging (HTC internal) |
| 61 | * @Flags: Internal use |
| 62 | */ |
| 63 | struct htc_tx_packet_info { |
| 64 | HTC_TX_TAG Tag; |
| 65 | int CreditsUsed; |
| 66 | uint8_t SendFlags; |
| 67 | int SeqNo; |
| 68 | uint32_t Flags; |
| 69 | }; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 70 | |
Houston Hoffman | c5141b0 | 2015-11-18 02:36:30 -0800 | [diff] [blame] | 71 | /** |
| 72 | * HTC_TX_PACKET_TAG_XXX - #defines for tagging packets for special handling |
| 73 | * HTC_TX_PACKET_TAG_ALL: zero is reserved and used to flush ALL packets |
| 74 | * HTC_TX_PACKET_TAG_INTERNAL: internal tags start here |
| 75 | * HTC_TX_PACKET_TAG_USER_DEFINED: user-defined tags start here |
| 76 | * HTC_TX_PACKET_TAG_BUNDLED: indicate this is a bundled tx packet |
| 77 | * HTC_TX_PACKET_TAG_AUTO_PM: indicate a power management wmi command |
| 78 | */ |
| 79 | #define HTC_TX_PACKET_TAG_ALL 0 |
| 80 | #define HTC_TX_PACKET_TAG_INTERNAL 1 |
| 81 | #define HTC_TX_PACKET_TAG_USER_DEFINED (HTC_TX_PACKET_TAG_INTERNAL + 9) |
| 82 | #define HTC_TX_PACKET_TAG_BUNDLED (HTC_TX_PACKET_TAG_USER_DEFINED + 1) |
| 83 | #define HTC_TX_PACKET_TAG_AUTO_PM (HTC_TX_PACKET_TAG_USER_DEFINED + 2) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 84 | |
Houston Hoffman | 1dd2276 | 2015-11-10 11:35:49 -0800 | [diff] [blame] | 85 | /* Tag packet for runtime put after sending */ |
| 86 | #define HTC_TX_PACKET_TAG_RUNTIME_PUT (HTC_TX_PACKET_TAG_USER_DEFINED + 3) |
| 87 | |
| 88 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 89 | #define HTC_TX_PACKET_FLAG_FIXUP_NETBUF (1 << 0) |
| 90 | |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 91 | /** |
| 92 | * struct htc_rx_packet_info - HTC RX Packet information |
| 93 | * @ExpectedHdr: HTC Internal use |
| 94 | * @HTCRxFlags: HTC Internal use |
| 95 | * @IndicationFlags: indication flags set on each RX packet indication |
| 96 | */ |
| 97 | struct htc_rx_packet_info { |
| 98 | uint32_t ExpectedHdr; |
| 99 | uint32_t HTCRxFlags; |
| 100 | uint32_t IndicationFlags; |
| 101 | }; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 102 | |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 103 | /* more packets on this endpoint are being fetched */ |
| 104 | #define HTC_RX_FLAGS_INDICATE_MORE_PKTS (1 << 0) |
Himanshu Agarwal | 974d0a5 | 2017-03-08 21:13:51 +0530 | [diff] [blame] | 105 | #define HTC_PACKET_MAGIC_COOKIE 0xdeadbeef |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 106 | |
| 107 | /* wrapper around endpoint-specific packets */ |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 108 | /** |
| 109 | * struct _HTC_PACKET - HTC Packet data structure |
| 110 | * @ListLink: double link |
| 111 | * @pPktContext: caller's per packet specific context |
| 112 | * @pBufferStart: The true buffer start, the caller can store the real buffer |
| 113 | * start here. In receive callbacks, the HTC layer sets pBuffer |
| 114 | * to the start of the payload past the header. This field allows |
| 115 | * the caller to reset pBuffer when it recycles receive packets |
| 116 | * back to HTC |
| 117 | * @pBuffer: payload start (RX/TX) |
| 118 | * @BufferLength: length of buffer |
| 119 | * @ActualLength: actual length of payload |
| 120 | * @Endpoint: endpoint that this packet was sent/recv'd from |
| 121 | * @Status: completion status |
| 122 | * @PktInfo: Packet specific info |
| 123 | * @netbufOrigHeadRoom: Original head room of skb |
| 124 | * @Completion: completion |
| 125 | * @pContext: HTC private completion context |
| 126 | * @pNetBufContext: optimization for network-oriented data, the HTC packet can |
| 127 | * pass the network buffer corresponding to the HTC packet |
| 128 | * lower layers may optimized the transfer knowing this is a |
| 129 | * network buffer |
| 130 | * @magic_cookie: HTC Magic cookie |
| 131 | */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 132 | typedef struct _HTC_PACKET { |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 133 | DL_LIST ListLink; |
| 134 | void *pPktContext; |
| 135 | uint8_t *pBufferStart; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 136 | /* |
| 137 | * Pointer to the start of the buffer. In the transmit |
| 138 | * direction this points to the start of the payload. In the |
| 139 | * receive direction, however, the buffer when queued up |
| 140 | * points to the start of the HTC header but when returned |
| 141 | * to the caller points to the start of the payload |
| 142 | */ |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 143 | uint8_t *pBuffer; |
| 144 | uint32_t BufferLength; |
| 145 | uint32_t ActualLength; |
| 146 | HTC_ENDPOINT_ID Endpoint; |
Rakesh Pillai | 1314645 | 2017-06-22 12:52:31 +0530 | [diff] [blame] | 147 | QDF_STATUS Status; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 148 | union { |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 149 | struct htc_tx_packet_info AsTx; |
| 150 | struct htc_rx_packet_info AsRx; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 151 | } PktInfo; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 152 | /* the following fields are for internal HTC use */ |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 153 | uint32_t netbufOrigHeadRoom; |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 154 | HTC_PACKET_COMPLETION Completion; |
| 155 | void *pContext; |
| 156 | void *pNetBufContext; |
Himanshu Agarwal | 974d0a5 | 2017-03-08 21:13:51 +0530 | [diff] [blame] | 157 | uint32_t magic_cookie; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 158 | } HTC_PACKET; |
| 159 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 160 | #define COMPLETE_HTC_PACKET(p, status) \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 161 | { \ |
| 162 | (p)->Status = (status); \ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 163 | (p)->Completion((p)->pContext, (p)); \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 164 | } |
| 165 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 166 | #define INIT_HTC_PACKET_INFO(p, b, len) \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 167 | { \ |
| 168 | (p)->pBufferStart = (b); \ |
| 169 | (p)->BufferLength = (len); \ |
| 170 | } |
| 171 | |
| 172 | /* macro to set an initial RX packet for refilling HTC */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 173 | #define SET_HTC_PACKET_INFO_RX_REFILL(p, c, b, len, ep) \ |
| 174 | do { \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 175 | (p)->pPktContext = (c); \ |
| 176 | (p)->pBuffer = (b); \ |
| 177 | (p)->pBufferStart = (b); \ |
| 178 | (p)->BufferLength = (len); \ |
| 179 | (p)->Endpoint = (ep); \ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 180 | } while (0) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 181 | |
| 182 | /* fast macro to recycle an RX packet that will be re-queued to HTC */ |
| 183 | #define HTC_PACKET_RESET_RX(p) \ |
| 184 | { (p)->pBuffer = (p)->pBufferStart; (p)->ActualLength = 0; } |
| 185 | |
| 186 | /* macro to set packet parameters for TX */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 187 | #define SET_HTC_PACKET_INFO_TX(p, c, b, len, ep, tag) \ |
| 188 | do { \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 189 | (p)->pPktContext = (c); \ |
| 190 | (p)->pBuffer = (b); \ |
| 191 | (p)->ActualLength = (len); \ |
| 192 | (p)->Endpoint = (ep); \ |
| 193 | (p)->PktInfo.AsTx.Tag = (tag); \ |
| 194 | (p)->PktInfo.AsTx.Flags = 0; \ |
DARAM SUDHA | e428c4c | 2015-03-13 19:15:00 +0530 | [diff] [blame] | 195 | (p)->PktInfo.AsTx.SendFlags = 0; \ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 196 | } while (0) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 197 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 198 | #define SET_HTC_PACKET_NET_BUF_CONTEXT(p, nb) \ |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 199 | { \ |
| 200 | (p)->pNetBufContext = (nb); \ |
| 201 | } |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 202 | |
| 203 | #define GET_HTC_PACKET_NET_BUF_CONTEXT(p) (p)->pNetBufContext |
| 204 | |
| 205 | /* HTC Packet Queueing Macros */ |
| 206 | typedef struct _HTC_PACKET_QUEUE { |
| 207 | DL_LIST QueueHead; |
| 208 | int Depth; |
| 209 | } HTC_PACKET_QUEUE; |
| 210 | |
| 211 | /* initialize queue */ |
| 212 | #define INIT_HTC_PACKET_QUEUE(pQ) \ |
| 213 | { \ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 214 | DL_LIST_INIT(&(pQ)->QueueHead); \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 215 | (pQ)->Depth = 0; \ |
| 216 | } |
| 217 | |
| 218 | /* enqueue HTC packet to the tail of the queue */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 219 | #define HTC_PACKET_ENQUEUE(pQ, p) \ |
| 220 | { dl_list_insert_tail(&(pQ)->QueueHead, &(p)->ListLink); \ |
| 221 | (pQ)->Depth++; \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | /* enqueue HTC packet to the tail of the queue */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 225 | #define HTC_PACKET_ENQUEUE_TO_HEAD(pQ, p) \ |
| 226 | { dl_list_insert_head(&(pQ)->QueueHead, &(p)->ListLink); \ |
| 227 | (pQ)->Depth++; \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 228 | } |
| 229 | /* test if a queue is empty */ |
| 230 | #define HTC_QUEUE_EMPTY(pQ) ((pQ)->Depth == 0) |
| 231 | /* get packet at head without removing it */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 232 | static inline HTC_PACKET *htc_get_pkt_at_head(HTC_PACKET_QUEUE *queue) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 233 | { |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 234 | if (queue->Depth == 0) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 235 | return NULL; |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 236 | |
| 237 | return A_CONTAINING_STRUCT((DL_LIST_GET_ITEM_AT_HEAD( |
| 238 | &queue->QueueHead)), |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 239 | HTC_PACKET, ListLink); |
| 240 | } |
| 241 | |
| 242 | /* remove a packet from a queue, where-ever it is in the queue */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 243 | #define HTC_PACKET_REMOVE(pQ, p) \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 244 | { \ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 245 | dl_list_remove(&(p)->ListLink); \ |
| 246 | (pQ)->Depth--; \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | /* dequeue an HTC packet from the head of the queue */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 250 | static inline HTC_PACKET *htc_packet_dequeue(HTC_PACKET_QUEUE *queue) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 251 | { |
| 252 | DL_LIST *pItem = dl_list_remove_item_from_head(&queue->QueueHead); |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 253 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 254 | if (pItem != NULL) { |
| 255 | queue->Depth--; |
| 256 | return A_CONTAINING_STRUCT(pItem, HTC_PACKET, ListLink); |
| 257 | } |
| 258 | return NULL; |
| 259 | } |
| 260 | |
| 261 | /* dequeue an HTC packet from the tail of the queue */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 262 | static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 263 | { |
| 264 | DL_LIST *pItem = dl_list_remove_item_from_tail(&queue->QueueHead); |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 265 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 266 | if (pItem != NULL) { |
| 267 | queue->Depth--; |
| 268 | return A_CONTAINING_STRUCT(pItem, HTC_PACKET, ListLink); |
| 269 | } |
| 270 | return NULL; |
| 271 | } |
| 272 | |
| 273 | #define HTC_PACKET_QUEUE_DEPTH(pQ) (pQ)->Depth |
| 274 | |
| 275 | #define HTC_GET_ENDPOINT_FROM_PKT(p) (p)->Endpoint |
| 276 | #define HTC_GET_TAG_FROM_PKT(p) (p)->PktInfo.AsTx.Tag |
| 277 | |
| 278 | /* transfer the packets from one queue to the tail of another queue */ |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 279 | #define HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(pQDest, pQSrc) \ |
| 280 | { \ |
| 281 | dl_list_transfer_items_to_tail(&(pQDest)->QueueHead, \ |
| 282 | &(pQSrc)->QueueHead); \ |
| 283 | (pQDest)->Depth += (pQSrc)->Depth; \ |
| 284 | (pQSrc)->Depth = 0; \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | /* |
| 288 | * Transfer the packets from one queue to the head of another queue. |
| 289 | * This xfer_to_head(q1,q2) is basically equivalent to xfer_to_tail(q2,q1), |
| 290 | * but it updates the queue descriptor object for the initial queue to refer |
| 291 | * to the concatenated queue. |
| 292 | */ |
| 293 | #define HTC_PACKET_QUEUE_TRANSFER_TO_HEAD(pQDest, pQSrc) \ |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 294 | { \ |
| 295 | dl_list_transfer_items_to_head(&(pQDest)->QueueHead, \ |
| 296 | &(pQSrc)->QueueHead); \ |
| 297 | (pQDest)->Depth += (pQSrc)->Depth; \ |
| 298 | (pQSrc)->Depth = 0; \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | /* fast version to init and add a single packet to a queue */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 302 | #define INIT_HTC_PACKET_QUEUE_AND_ADD(pQ, pP) \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 303 | { \ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 304 | DL_LIST_INIT_AND_ADD(&(pQ)->QueueHead, &(pP)->ListLink) \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 305 | (pQ)->Depth = 1; \ |
| 306 | } |
| 307 | |
| 308 | #define HTC_PACKET_QUEUE_ITERATE_ALLOW_REMOVE(pQ, pPTemp) \ |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 309 | ITERATE_OVER_LIST_ALLOW_REMOVE(&(pQ)->QueueHead, \ |
| 310 | (pPTemp), HTC_PACKET, ListLink) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 311 | |
Manikandan Mohan | e3e209e | 2017-04-13 20:19:26 -0700 | [diff] [blame] | 312 | #define HTC_PACKET_QUEUE_ITERATE_IS_VALID(pQ) ITERATE_IS_VALID(&(pQ)->QueueHead) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 313 | #define HTC_PACKET_QUEUE_ITERATE_RESET(pQ) ITERATE_RESET(&(pQ)->QueueHead) |
| 314 | |
| 315 | #define HTC_PACKET_QUEUE_ITERATE_END ITERATE_END |
| 316 | |
Himanshu Agarwal | 974d0a5 | 2017-03-08 21:13:51 +0530 | [diff] [blame] | 317 | /** |
| 318 | * htc_packet_set_magic_cookie() - set magic cookie in htc packet |
| 319 | * htc_pkt - pointer to htc packet |
| 320 | * value - value to set in magic cookie |
| 321 | * |
| 322 | * This API sets the magic cookie passed in htc packet. |
| 323 | * |
| 324 | * Return : None |
| 325 | */ |
| 326 | static inline void htc_packet_set_magic_cookie(HTC_PACKET *htc_pkt, |
| 327 | uint32_t value) |
| 328 | { |
| 329 | htc_pkt->magic_cookie = value; |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * htc_packet_set_magic_cookie() - get magic cookie in htc packet |
| 334 | * htc_pkt - pointer to htc packet |
| 335 | * |
| 336 | * This API returns the magic cookie in htc packet. |
| 337 | * |
| 338 | * Return : magic cookie |
| 339 | */ |
| 340 | static inline uint32_t htc_packet_get_magic_cookie(HTC_PACKET *htc_pkt) |
| 341 | { |
| 342 | return htc_pkt->magic_cookie; |
| 343 | } |
| 344 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 345 | #endif /*HTC_PACKET_H_ */ |