Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 1 | /* |
Houston Hoffman | 47e387b | 2015-10-20 17:04:42 -0700 | [diff] [blame] | 2 | * Copyright (c) 2013-2014, 2016 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_API_H_ |
| 29 | #define _HTC_API_H_ |
| 30 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 31 | #include <htc.h> |
| 32 | #include <htc_services.h> |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 33 | #include <qdf_types.h> /* qdf_device_t */ |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 34 | #include "htc_packet.h" |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 35 | |
| 36 | #ifdef __cplusplus |
| 37 | extern "C" { |
| 38 | #endif /* __cplusplus */ |
| 39 | |
| 40 | /* TODO.. for BMI */ |
| 41 | #define ENDPOINT1 0 |
| 42 | /* TODO -remove me, but we have to fix BMI first */ |
| 43 | #define HTC_MAILBOX_NUM_MAX 4 |
| 44 | |
| 45 | /* this is the amount of header room required by users of HTC */ |
| 46 | #define HTC_HEADER_LEN HTC_HDR_LENGTH |
| 47 | |
| 48 | typedef void *HTC_HANDLE; |
| 49 | |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 50 | typedef uint16_t HTC_SERVICE_ID; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 51 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 52 | typedef void (*HTC_TARGET_FAILURE)(void *Instance, QDF_STATUS Status); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 53 | |
| 54 | typedef struct _HTC_INIT_INFO { |
| 55 | void *pContext; /* context for target notifications */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 56 | void (*TargetFailure)(void *Instance, QDF_STATUS Status); |
Houston Hoffman | 61fad9f | 2016-04-14 17:09:37 -0700 | [diff] [blame] | 57 | void (*TargetSendSuspendComplete)(void *ctx, bool is_nack); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 58 | } HTC_INIT_INFO; |
| 59 | |
| 60 | /* Struct for HTC layer packet stats*/ |
| 61 | struct ol_ath_htc_stats { |
| 62 | int htc_get_pkt_q_fail_count; |
| 63 | int htc_pkt_q_empty_count; |
| 64 | int htc_send_q_empty_count; |
| 65 | }; |
| 66 | |
Houston Hoffman | 47e387b | 2015-10-20 17:04:42 -0700 | [diff] [blame] | 67 | /* To resume HTT Tx queue during runtime resume */ |
| 68 | typedef void (*HTC_EP_RESUME_TX_QUEUE)(void *); |
| 69 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 70 | /* per service connection send completion */ |
| 71 | typedef void (*HTC_EP_SEND_PKT_COMPLETE)(void *, HTC_PACKET *); |
| 72 | /* per service connection callback when a plurality of packets have been sent |
| 73 | * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback) |
| 74 | * to hold a list of completed send packets. |
| 75 | * If the handler cannot fully traverse the packet queue before returning, it should |
| 76 | * transfer the items of the queue into the caller's private queue using: |
| 77 | * HTC_PACKET_ENQUEUE() */ |
| 78 | typedef void (*HTC_EP_SEND_PKT_COMP_MULTIPLE)(void *, |
| 79 | HTC_PACKET_QUEUE *); |
| 80 | /* per service connection pkt received */ |
| 81 | typedef void (*HTC_EP_RECV_PKT)(void *, HTC_PACKET *); |
| 82 | /* per service connection callback when a plurality of packets are received |
| 83 | * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback) |
| 84 | * to hold a list of recv packets. |
| 85 | * If the handler cannot fully traverse the packet queue before returning, it should |
| 86 | * transfer the items of the queue into the caller's private queue using: |
| 87 | * HTC_PACKET_ENQUEUE() */ |
| 88 | typedef void (*HTC_EP_RECV_PKT_MULTIPLE)(void *, HTC_PACKET_QUEUE *); |
| 89 | |
| 90 | /* Optional per service connection receive buffer re-fill callback, |
| 91 | * On some OSes (like Linux) packets are allocated from a global pool and indicated up |
| 92 | * to the network stack. The driver never gets the packets back from the OS. For these OSes |
| 93 | * a refill callback can be used to allocate and re-queue buffers into HTC. |
| 94 | * |
| 95 | * On other OSes, the network stack can call into the driver's OS-specifc "return_packet" handler and |
| 96 | * the driver can re-queue these buffers into HTC. In this regard a refill callback is |
| 97 | * unnecessary */ |
| 98 | typedef void (*HTC_EP_RECV_REFILL)(void *, HTC_ENDPOINT_ID Endpoint); |
| 99 | |
| 100 | /* Optional per service connection receive buffer allocation callback. |
| 101 | * On some systems packet buffers are an extremely limited resource. Rather than |
| 102 | * queue largest-possible-sized buffers to HTC, some systems would rather |
| 103 | * allocate a specific size as the packet is received. The trade off is |
| 104 | * slightly more processing (callback invoked for each RX packet) |
| 105 | * for the benefit of committing fewer buffer resources into HTC. |
| 106 | * |
| 107 | * The callback is provided the length of the pending packet to fetch. This includes the |
| 108 | * HTC header length plus the length of payload. The callback can return a pointer to |
| 109 | * the allocated HTC packet for immediate use. |
| 110 | * |
| 111 | * Alternatively a variant of this handler can be used to allocate large receive packets as needed. |
| 112 | * For example an application can use the refill mechanism for normal packets and the recv-alloc mechanism to |
| 113 | * handle the case where a large packet buffer is required. This can significantly reduce the |
| 114 | * amount of "committed" memory used to receive packets. |
| 115 | * |
| 116 | * */ |
| 117 | typedef HTC_PACKET *(*HTC_EP_RECV_ALLOC)(void *, |
| 118 | HTC_ENDPOINT_ID Endpoint, |
| 119 | int Length); |
| 120 | |
| 121 | typedef enum _HTC_SEND_FULL_ACTION { |
| 122 | HTC_SEND_FULL_KEEP = 0, /* packet that overflowed should be kept in the queue */ |
| 123 | HTC_SEND_FULL_DROP = 1, /* packet that overflowed should be dropped */ |
| 124 | } HTC_SEND_FULL_ACTION; |
| 125 | |
| 126 | /* Optional per service connection callback when a send queue is full. This can occur if the |
| 127 | * host continues queueing up TX packets faster than credits can arrive |
| 128 | * To prevent the host (on some Oses like Linux) from continuously queueing packets |
| 129 | * and consuming resources, this callback is provided so that that the host |
| 130 | * can disable TX in the subsystem (i.e. network stack). |
| 131 | * This callback is invoked for each packet that "overflows" the HTC queue. The callback can |
| 132 | * determine whether the new packet that overflowed the queue can be kept (HTC_SEND_FULL_KEEP) or |
| 133 | * dropped (HTC_SEND_FULL_DROP). If a packet is dropped, the EpTxComplete handler will be called |
| 134 | * and the packet's status field will be set to A_NO_RESOURCE. |
| 135 | * Other OSes require a "per-packet" indication for each completed TX packet, this |
| 136 | * closed loop mechanism will prevent the network stack from overunning the NIC |
| 137 | * The packet to keep or drop is passed for inspection to the registered handler the handler |
| 138 | * must ONLY inspect the packet, it may not free or reclaim the packet. */ |
| 139 | typedef HTC_SEND_FULL_ACTION (*HTC_EP_SEND_QUEUE_FULL)(void *, |
| 140 | HTC_PACKET * |
| 141 | pPacket); |
| 142 | |
| 143 | typedef struct _HTC_EP_CALLBACKS { |
| 144 | void *pContext; /* context for each callback */ |
| 145 | HTC_EP_SEND_PKT_COMPLETE EpTxComplete; /* tx completion callback for connected endpoint */ |
| 146 | HTC_EP_RECV_PKT EpRecv; /* receive callback for connected endpoint */ |
| 147 | HTC_EP_RECV_REFILL EpRecvRefill; /* OPTIONAL receive re-fill callback for connected endpoint */ |
| 148 | HTC_EP_SEND_QUEUE_FULL EpSendFull; /* OPTIONAL send full callback */ |
| 149 | HTC_EP_RECV_ALLOC EpRecvAlloc; /* OPTIONAL recv allocation callback */ |
| 150 | HTC_EP_RECV_ALLOC EpRecvAllocThresh; /* OPTIONAL recv allocation callback based on a threshold */ |
| 151 | HTC_EP_SEND_PKT_COMP_MULTIPLE EpTxCompleteMultiple; /* OPTIONAL completion handler for multiple complete |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 152 | indications (EpTxComplete must be NULL) */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 153 | HTC_EP_RECV_PKT_MULTIPLE EpRecvPktMultiple; /* OPTIONAL completion handler for multiple |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 154 | recv packet indications (EpRecv must be NULL) */ |
Houston Hoffman | 47e387b | 2015-10-20 17:04:42 -0700 | [diff] [blame] | 155 | HTC_EP_RESUME_TX_QUEUE ep_resume_tx_queue; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 156 | int RecvAllocThreshold; /* if EpRecvAllocThresh is non-NULL, HTC will compare the |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 157 | threshold value to the current recv packet length and invoke |
| 158 | the EpRecvAllocThresh callback to acquire a packet buffer */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 159 | int RecvRefillWaterMark; /* if a EpRecvRefill handler is provided, this value |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 160 | can be used to set a trigger refill callback |
| 161 | when the recv queue drops below this value |
| 162 | if set to 0, the refill is only called when packets |
| 163 | are empty */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 164 | } HTC_EP_CALLBACKS; |
| 165 | |
| 166 | /* service connection information */ |
| 167 | typedef struct _HTC_SERVICE_CONNECT_REQ { |
Houston Hoffman | 4f2f459 | 2015-10-20 18:00:29 -0700 | [diff] [blame] | 168 | HTC_SERVICE_ID service_id; /* service ID to connect to */ |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 169 | uint16_t ConnectionFlags; /* connection flags, see htc protocol definition */ |
| 170 | uint8_t *pMetaData; /* ptr to optional service-specific meta-data */ |
| 171 | uint8_t MetaDataLength; /* optional meta data length */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 172 | HTC_EP_CALLBACKS EpCallbacks; /* endpoint callbacks */ |
| 173 | int MaxSendQueueDepth; /* maximum depth of any send queue */ |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 174 | uint32_t LocalConnectionFlags; /* HTC flags for the host-side (local) connection */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 175 | unsigned int MaxSendMsgSize; /* override max message size in send direction */ |
| 176 | } HTC_SERVICE_CONNECT_REQ; |
| 177 | |
| 178 | #define HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING (1 << 0) /* enable send bundle padding for this endpoint */ |
| 179 | |
| 180 | /* service connection response information */ |
| 181 | typedef struct _HTC_SERVICE_CONNECT_RESP { |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 182 | uint8_t *pMetaData; /* caller supplied buffer to optional meta-data */ |
| 183 | uint8_t BufferLength; /* length of caller supplied buffer */ |
| 184 | uint8_t ActualLength; /* actual length of meta data */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 185 | HTC_ENDPOINT_ID Endpoint; /* endpoint to communicate over */ |
| 186 | unsigned int MaxMsgLength; /* max length of all messages over this endpoint */ |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 187 | uint8_t ConnectRespCode; /* connect response code from target */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 188 | } HTC_SERVICE_CONNECT_RESP; |
| 189 | |
| 190 | /* endpoint distribution structure */ |
| 191 | typedef struct _HTC_ENDPOINT_CREDIT_DIST { |
| 192 | struct _HTC_ENDPOINT_CREDIT_DIST *pNext; |
| 193 | struct _HTC_ENDPOINT_CREDIT_DIST *pPrev; |
Houston Hoffman | 4f2f459 | 2015-10-20 18:00:29 -0700 | [diff] [blame] | 194 | HTC_SERVICE_ID service_id; /* Service ID (set by HTC) */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 195 | HTC_ENDPOINT_ID Endpoint; /* endpoint for this distribution struct (set by HTC) */ |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 196 | uint32_t DistFlags; /* distribution flags, distribution function can |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 197 | set default activity using SET_EP_ACTIVE() macro */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 198 | int TxCreditsNorm; /* credits for normal operation, anything above this |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 199 | indicates the endpoint is over-subscribed, this field |
| 200 | is only relevant to the credit distribution function */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 201 | int TxCreditsMin; /* floor for credit distribution, this field is |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 202 | only relevant to the credit distribution function */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 203 | int TxCreditsAssigned; /* number of credits assigned to this EP, this field |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 204 | is only relevant to the credit dist function */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 205 | int TxCredits; /* current credits available, this field is used by |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 206 | HTC to determine whether a message can be sent or |
| 207 | must be queued */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 208 | int TxCreditsToDist; /* pending credits to distribute on this endpoint, this |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 209 | is set by HTC when credit reports arrive. |
| 210 | The credit distribution functions sets this to zero |
| 211 | when it distributes the credits */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 212 | int TxCreditsSeek; /* this is the number of credits that the current pending TX |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 213 | packet needs to transmit. This is set by HTC when |
| 214 | and endpoint needs credits in order to transmit */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 215 | int TxCreditSize; /* size in bytes of each credit (set by HTC) */ |
| 216 | int TxCreditsPerMaxMsg; /* credits required for a maximum sized messages (set by HTC) */ |
| 217 | void *pHTCReserved; /* reserved for HTC use */ |
| 218 | int TxQueueDepth; /* current depth of TX queue , i.e. messages waiting for credits |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 219 | This field is valid only when HTC_CREDIT_DIST_ACTIVITY_CHANGE |
| 220 | or HTC_CREDIT_DIST_SEND_COMPLETE is indicated on an endpoint |
| 221 | that has non-zero credits to recover |
| 222 | */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 223 | } HTC_ENDPOINT_CREDIT_DIST; |
| 224 | |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 225 | #define HTC_EP_ACTIVE ((uint32_t) (1u << 31)) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 226 | |
| 227 | /* macro to check if an endpoint has gone active, useful for credit |
| 228 | * distributions */ |
| 229 | #define IS_EP_ACTIVE(epDist) ((epDist)->DistFlags & HTC_EP_ACTIVE) |
| 230 | #define SET_EP_ACTIVE(epDist) (epDist)->DistFlags |= HTC_EP_ACTIVE |
| 231 | |
| 232 | /* credit distibution code that is passed into the distrbution function, |
| 233 | * there are mandatory and optional codes that must be handled */ |
| 234 | typedef enum _HTC_CREDIT_DIST_REASON { |
| 235 | HTC_CREDIT_DIST_SEND_COMPLETE = 0, /* credits available as a result of completed |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 236 | send operations (MANDATORY) resulting in credit reports */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 237 | HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1, /* a change in endpoint activity occured (OPTIONAL) */ |
| 238 | HTC_CREDIT_DIST_SEEK_CREDITS, /* an endpoint needs to "seek" credits (OPTIONAL) */ |
| 239 | HTC_DUMP_CREDIT_STATE /* for debugging, dump any state information that is kept by |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 240 | the distribution function */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 241 | } HTC_CREDIT_DIST_REASON; |
| 242 | |
| 243 | typedef void (*HTC_CREDIT_DIST_CALLBACK)(void *Context, |
| 244 | HTC_ENDPOINT_CREDIT_DIST * |
| 245 | pEPList, |
| 246 | HTC_CREDIT_DIST_REASON |
| 247 | Reason); |
| 248 | |
| 249 | typedef void (*HTC_CREDIT_INIT_CALLBACK)(void *Context, |
| 250 | HTC_ENDPOINT_CREDIT_DIST * |
| 251 | pEPList, int TotalCredits); |
| 252 | |
| 253 | /* endpoint statistics action */ |
| 254 | typedef enum _HTC_ENDPOINT_STAT_ACTION { |
| 255 | HTC_EP_STAT_SAMPLE = 0, /* only read statistics */ |
| 256 | HTC_EP_STAT_SAMPLE_AND_CLEAR = 1, /* sample and immediately clear statistics */ |
| 257 | HTC_EP_STAT_CLEAR /* clear only */ |
| 258 | } HTC_ENDPOINT_STAT_ACTION; |
| 259 | |
| 260 | /* endpoint statistics */ |
| 261 | typedef struct _HTC_ENDPOINT_STATS { |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 262 | uint32_t TxPosted; /* number of TX packets posted to the endpoint */ |
| 263 | uint32_t TxCreditLowIndications; /* number of times the host set the credit-low flag in a send message on |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 264 | this endpoint */ |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 265 | uint32_t TxIssued; /* running count of total TX packets issued */ |
| 266 | uint32_t TxPacketsBundled; /* running count of TX packets that were issued in bundles */ |
| 267 | uint32_t TxBundles; /* running count of TX bundles that were issued */ |
| 268 | uint32_t TxDropped; /* tx packets that were dropped */ |
| 269 | uint32_t TxCreditRpts; /* running count of total credit reports received for this endpoint */ |
| 270 | uint32_t TxCreditRptsFromRx; /* credit reports received from this endpoint's RX packets */ |
| 271 | uint32_t TxCreditRptsFromOther; /* credit reports received from RX packets of other endpoints */ |
| 272 | uint32_t TxCreditRptsFromEp0; /* credit reports received from endpoint 0 RX packets */ |
| 273 | uint32_t TxCreditsFromRx; /* count of credits received via Rx packets on this endpoint */ |
| 274 | uint32_t TxCreditsFromOther; /* count of credits received via another endpoint */ |
| 275 | uint32_t TxCreditsFromEp0; /* count of credits received via another endpoint */ |
| 276 | uint32_t TxCreditsConsummed; /* count of consummed credits */ |
| 277 | uint32_t TxCreditsReturned; /* count of credits returned */ |
| 278 | uint32_t RxReceived; /* count of RX packets received */ |
| 279 | uint32_t RxLookAheads; /* count of lookahead records |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 280 | found in messages received on this endpoint */ |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 281 | uint32_t RxPacketsBundled; /* count of recv packets received in a bundle */ |
| 282 | uint32_t RxBundleLookAheads; /* count of number of bundled lookaheads */ |
| 283 | uint32_t RxBundleIndFromHdr; /* count of the number of bundle indications from the HTC header */ |
| 284 | uint32_t RxAllocThreshHit; /* count of the number of times the recv allocation threshhold was hit */ |
| 285 | uint32_t RxAllocThreshBytes; /* total number of bytes */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 286 | } HTC_ENDPOINT_STATS; |
| 287 | |
| 288 | /* ------ Function Prototypes ------ */ |
| 289 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 290 | @desc: Create an instance of HTC over the underlying HIF device |
| 291 | @function name: htc_create |
Yue Ma | ec9e71c | 2016-02-26 18:52:20 -0800 | [diff] [blame] | 292 | @input: HifDevice - hif device handle, |
| 293 | pInfo - initialization information |
| 294 | osdev - QDF device structure |
| 295 | con_mode - driver connection mode |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 296 | @output: |
| 297 | @return: HTC_HANDLE on success, NULL on failure |
| 298 | @notes: |
| 299 | @example: |
| 300 | @see also: htc_destroy |
| 301 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
Yue Ma | ec9e71c | 2016-02-26 18:52:20 -0800 | [diff] [blame] | 302 | HTC_HANDLE htc_create(void *HifDevice, HTC_INIT_INFO *pInfo, qdf_device_t osdev, |
| 303 | uint32_t con_mode); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 304 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 305 | @desc: Get the underlying HIF device handle |
| 306 | @function name: htc_get_hif_device |
| 307 | @input: HTCHandle - handle passed into the AddInstance callback |
| 308 | @output: |
| 309 | @return: opaque HIF device handle usable in HIF API calls. |
| 310 | @notes: |
| 311 | @example: |
| 312 | @see also: |
| 313 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 314 | void *htc_get_hif_device(HTC_HANDLE HTCHandle); |
| 315 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 316 | @desc: Set credit distribution parameters |
| 317 | @function name: htc_set_credit_distribution |
| 318 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 319 | pCreditDistCont - caller supplied context to pass into distribution functions |
| 320 | CreditDistFunc - Distribution function callback |
| 321 | CreditDistInit - Credit Distribution initialization callback |
| 322 | ServicePriorityOrder - Array containing list of service IDs, lowest index |
| 323 | is highestpriority |
| 324 | ListLength - number of elements in ServicePriorityOrder |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 325 | @output: |
| 326 | @return: |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 327 | @notes : The user can set a custom credit distribution function to handle |
| 328 | special requirementsfor each endpoint. A default credit distribution |
| 329 | routine can be used by setting CreditInitFunc to NULL. The default |
| 330 | credit distribution is only provided for simple "fair" credit distribution |
| 331 | without regard to any prioritization. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 332 | |
| 333 | @example: |
| 334 | @see also: |
| 335 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 336 | void htc_set_credit_distribution(HTC_HANDLE HTCHandle, |
| 337 | void *pCreditDistContext, |
| 338 | HTC_CREDIT_DIST_CALLBACK CreditDistFunc, |
| 339 | HTC_CREDIT_INIT_CALLBACK CreditInitFunc, |
| 340 | HTC_SERVICE_ID ServicePriorityOrder[], |
| 341 | int ListLength); |
| 342 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 343 | @desc: Wait for the target to indicate the HTC layer is ready |
| 344 | @function name: htc_wait_target |
| 345 | @input: HTCHandle - HTC handle |
| 346 | @output: |
| 347 | @return: |
| 348 | @notes: This API blocks until the target responds with an HTC ready message. |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 349 | The caller should not connect services until the target has indicated it is |
| 350 | ready. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 351 | @example: |
| 352 | @see also: htc_connect_service |
| 353 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 354 | A_STATUS htc_wait_target(HTC_HANDLE HTCHandle); |
| 355 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 356 | @desc: Start target service communications |
| 357 | @function name: htc_start |
| 358 | @input: HTCHandle - HTC handle |
| 359 | @output: |
| 360 | @return: |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 361 | @notes: This API indicates to the target that the service connection phase |
| 362 | is completeand the target can freely start all connected services. This |
| 363 | API should only be called AFTER all service connections have been made. |
| 364 | TCStart will issue a SETUP_COMPLETE message to the target to indicate that |
| 365 | all service connections have been made and the target can start |
| 366 | communicating over the endpoints. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 367 | @example: |
| 368 | @see also: htc_connect_service |
| 369 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 370 | A_STATUS htc_start(HTC_HANDLE HTCHandle); |
| 371 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 372 | @desc: Add receive packet to HTC |
| 373 | @function name: htc_add_receive_pkt |
| 374 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 375 | pPacket - HTC receive packet to add |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 376 | @output: |
| 377 | @return: A_OK on success |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 378 | @notes: user must supply HTC packets for capturing incomming HTC frames. |
| 379 | The caller must initialize each HTC packet using the |
| 380 | SET_HTC_PACKET_INFO_RX_REFILL() macro. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 381 | @example: |
| 382 | @see also: |
| 383 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 384 | A_STATUS htc_add_receive_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket); |
| 385 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 386 | @desc: Connect to an HTC service |
| 387 | @function name: htc_connect_service |
| 388 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 389 | pReq - connection details |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 390 | @output: pResp - connection response |
| 391 | @return: |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 392 | @notes: Service connections must be performed before htc_start. |
| 393 | User provides callback handlersfor various endpoint events. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 394 | @example: |
| 395 | @see also: htc_start |
| 396 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 397 | A_STATUS htc_connect_service(HTC_HANDLE HTCHandle, |
| 398 | HTC_SERVICE_CONNECT_REQ *pReq, |
| 399 | HTC_SERVICE_CONNECT_RESP *pResp); |
| 400 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 401 | @desc: HTC register log dump |
| 402 | @function name: htc_dump |
| 403 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 404 | CmdId - Log command |
| 405 | start - start/print logs |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 406 | @output: |
| 407 | @return: |
| 408 | @notes: Register logs will be started/printed. |
| 409 | be flushed. |
| 410 | @example: |
| 411 | @see also: |
| 412 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 413 | |
| 414 | void htc_dump(HTC_HANDLE HTCHandle, uint8_t CmdId, bool start); |
| 415 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 416 | @desc: Send an HTC packet |
| 417 | @function name: htc_send_pkt |
| 418 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 419 | pPacket - packet to send |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 420 | @output: |
| 421 | @return: A_OK |
| 422 | @notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro. |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 423 | This interface is fully asynchronous. On error, HTC SendPkt will |
| 424 | call the registered Endpoint callback to cleanup the packet. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 425 | @example: |
| 426 | @see also: htc_flush_endpoint |
| 427 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 428 | A_STATUS htc_send_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket); |
| 429 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 430 | @desc: Send an HTC packet containing a tx descriptor and data |
| 431 | @function name: htc_send_data_pkt |
| 432 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 433 | pPacket - packet to send |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 434 | @output: |
| 435 | @return: A_OK |
| 436 | @notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro. |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 437 | Caller must provide headroom in an initial fragment added to the |
| 438 | network buffer to store a HTC_FRAME_HDR. |
| 439 | This interface is fully asynchronous. On error, htc_send_data_pkt will |
| 440 | call the registered Endpoint EpDataTxComplete callback to cleanup |
| 441 | the packet. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 442 | @example: |
| 443 | @see also: htc_send_pkt |
| 444 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 445 | #ifdef ATH_11AC_TXCOMPACT |
Vishwajith Upendra | 70f8b6e | 2016-03-01 16:28:23 +0530 | [diff] [blame] | 446 | A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 447 | int Epid, int ActualLength); |
| 448 | #else /*ATH_11AC_TXCOMPACT */ |
| 449 | A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket, |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 450 | uint8_t more_data); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 451 | #endif /*ATH_11AC_TXCOMPACT */ |
| 452 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 453 | @desc: Flush HTC when target is removed surprisely service communications |
| 454 | @function name: htc_flush_surprise_remove |
| 455 | @input: HTCHandle - HTC handle |
| 456 | @output: |
| 457 | @return: |
| 458 | @notes: All receive and pending TX packets will |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 459 | be flushed. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 460 | @example: |
| 461 | @see also: |
| 462 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 463 | void htc_flush_surprise_remove(HTC_HANDLE HTCHandle); |
| 464 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 465 | @desc: Stop HTC service communications |
| 466 | @function name: htc_stop |
| 467 | @input: HTCHandle - HTC handle |
| 468 | @output: |
| 469 | @return: |
| 470 | @notes: HTC communications is halted. All receive and pending TX packets will |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 471 | be flushed. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 472 | @example: |
| 473 | @see also: |
| 474 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 475 | void htc_stop(HTC_HANDLE HTCHandle); |
| 476 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 477 | @desc: Destory HTC service |
| 478 | @function name: htc_destroy |
| 479 | @input: HTCHandle |
| 480 | @output: |
| 481 | @return: |
| 482 | @notes: This cleans up all resources allocated by htc_create(). |
| 483 | @example: |
| 484 | @see also: htc_create |
| 485 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 486 | void htc_destroy(HTC_HANDLE HTCHandle); |
| 487 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 488 | @desc: Flush pending TX packets |
| 489 | @function name: htc_flush_endpoint |
| 490 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 491 | Endpoint - Endpoint to flush |
| 492 | Tag - flush tag |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 493 | @output: |
| 494 | @return: |
| 495 | @notes: The Tag parameter is used to selectively flush packets with matching tags. |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 496 | The value of 0 forces all packets to be flush regardless of tag. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 497 | @example: |
| 498 | @see also: htc_send_pkt |
| 499 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 500 | void htc_flush_endpoint(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint, |
| 501 | HTC_TX_TAG Tag); |
| 502 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 503 | @desc: Dump credit distribution state |
| 504 | @function name: htc_dump_credit_states |
| 505 | @input: HTCHandle - HTC handle |
| 506 | @output: |
| 507 | @return: |
| 508 | @notes: This dumps all credit distribution information to the debugger |
| 509 | @example: |
| 510 | @see also: |
| 511 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 512 | void htc_dump_credit_states(HTC_HANDLE HTCHandle); |
| 513 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 514 | @desc: Indicate a traffic activity change on an endpoint |
| 515 | @function name: htc_indicate_activity_change |
| 516 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 517 | Endpoint - endpoint in which activity has changed |
| 518 | Active - true if active, false if it has become inactive |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 519 | @output: |
| 520 | @return: |
| 521 | @notes: This triggers the registered credit distribution function to |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 522 | re-adjust credits for active/inactive endpoints. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 523 | @example: |
| 524 | @see also: |
| 525 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 526 | void htc_indicate_activity_change(HTC_HANDLE HTCHandle, |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 527 | HTC_ENDPOINT_ID Endpoint, bool Active); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 528 | |
| 529 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 530 | @desc: Get endpoint statistics |
| 531 | @function name: htc_get_endpoint_statistics |
| 532 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 533 | Endpoint - Endpoint identifier |
| 534 | Action - action to take with statistics |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 535 | @output: |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 536 | pStats - statistics that were sampled (can be NULL if Action is HTC_EP_STAT_CLEAR) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 537 | |
| 538 | @return: true if statistics profiling is enabled, otherwise false. |
| 539 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 540 | @notes : Statistics is a compile-time option and this function may return |
| 541 | false if HTC is not compiled with profiling. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 542 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 543 | The caller can specify the statistic "action" to take when sampling |
| 544 | the statistics. This includes : |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 545 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 546 | HTC_EP_STAT_SAMPLE : The pStats structure is filled with the current |
| 547 | values. |
| 548 | HTC_EP_STAT_SAMPLE_AND_CLEAR : The structure is filled and the current |
| 549 | statisticsare cleared. |
| 550 | |
| 551 | HTC_EP_STAT_CLEA : the statistics are cleared, the called can pass a NULL |
| 552 | value forpStats |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 553 | |
| 554 | @example: |
| 555 | @see also: |
| 556 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 557 | bool htc_get_endpoint_statistics(HTC_HANDLE HTCHandle, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 558 | HTC_ENDPOINT_ID Endpoint, |
| 559 | HTC_ENDPOINT_STAT_ACTION Action, |
| 560 | HTC_ENDPOINT_STATS *pStats); |
| 561 | |
| 562 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 563 | @desc: Unblock HTC message reception |
| 564 | @function name: htc_unblock_recv |
| 565 | @input: HTCHandle - HTC handle |
| 566 | @output: |
| 567 | @return: |
| 568 | @notes: |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 569 | HTC will block the receiver if the EpRecvAlloc callback fails to provide a |
| 570 | packet. The caller can use this API to indicate to HTC when resources |
| 571 | (buffers) are available such that the receiver can be unblocked and HTC |
| 572 | may re-attempt fetching the pending message. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 573 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 574 | This API is not required if the user uses the EpRecvRefill callback or uses |
| 575 | the HTCAddReceivePacket()API to recycle or provide receive packets to HTC. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 576 | |
| 577 | @example: |
| 578 | @see also: |
| 579 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 580 | void htc_unblock_recv(HTC_HANDLE HTCHandle); |
| 581 | |
| 582 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 583 | @desc: send a series of HTC packets |
| 584 | @function name: htc_send_pkts_multiple |
| 585 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 586 | pPktQueue - local queue holding packets to send |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 587 | @output: |
| 588 | @return: A_OK |
| 589 | @notes: Caller must initialize each packet using SET_HTC_PACKET_INFO_TX() macro. |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 590 | The queue must only contain packets directed at the same endpoint. |
| 591 | Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the TX packets in FIFO order. |
| 592 | This API will remove the packets from the pkt queue and place them into the HTC Tx Queue |
| 593 | and bundle messages where possible. |
| 594 | The caller may allocate the pkt queue on the stack to hold the packets. |
| 595 | This interface is fully asynchronous. On error, htc_send_pkts will |
| 596 | call the registered Endpoint callback to cleanup the packet. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 597 | @example: |
| 598 | @see also: htc_flush_endpoint |
| 599 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 600 | A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, |
| 601 | HTC_PACKET_QUEUE *pPktQueue); |
| 602 | |
| 603 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 604 | @desc: Add multiple receive packets to HTC |
| 605 | @function name: htc_add_receive_pkt_multiple |
| 606 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 607 | pPktQueue - HTC receive packet queue holding packets to add |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 608 | @output: |
| 609 | @return: A_OK on success |
| 610 | @notes: user must supply HTC packets for capturing incomming HTC frames. The caller |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 611 | must initialize each HTC packet using the SET_HTC_PACKET_INFO_RX_REFILL() |
| 612 | macro. The queue must only contain recv packets for the same endpoint. |
| 613 | Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the recv packet. |
| 614 | This API will remove the packets from the pkt queue and place them into internal |
| 615 | recv packet list. |
| 616 | The caller may allocate the pkt queue on the stack to hold the packets. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 617 | @example: |
| 618 | @see also: |
| 619 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 620 | A_STATUS htc_add_receive_pkt_multiple(HTC_HANDLE HTCHandle, |
| 621 | HTC_PACKET_QUEUE *pPktQueue); |
| 622 | |
| 623 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 624 | @desc: Check if an endpoint is marked active |
| 625 | @function name: htc_is_endpoint_active |
| 626 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 627 | Endpoint - endpoint to check for active state |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 628 | @output: |
| 629 | @return: returns true if Endpoint is Active |
| 630 | @notes: |
| 631 | @example: |
| 632 | @see also: |
| 633 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 634 | bool htc_is_endpoint_active(HTC_HANDLE HTCHandle, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 635 | HTC_ENDPOINT_ID Endpoint); |
| 636 | |
| 637 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 638 | @desc: Get the number of recv buffers currently queued into an HTC endpoint |
| 639 | @function name: htc_get_num_recv_buffers |
| 640 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 641 | Endpoint - endpoint to check |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 642 | @output: |
| 643 | @return: returns number of buffers in queue |
| 644 | @notes: |
| 645 | @example: |
| 646 | @see also: |
| 647 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 648 | int htc_get_num_recv_buffers(HTC_HANDLE HTCHandle, |
| 649 | HTC_ENDPOINT_ID Endpoint); |
| 650 | |
| 651 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 652 | @desc: Set the target failure handling callback in HTC layer |
| 653 | @function name: htc_set_target_failure_callback |
| 654 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 655 | Callback - target failure handling callback |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 656 | @output: |
| 657 | @return: |
| 658 | @notes: |
| 659 | @example: |
| 660 | @see also: |
| 661 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 662 | void htc_set_target_failure_callback(HTC_HANDLE HTCHandle, |
| 663 | HTC_TARGET_FAILURE Callback); |
| 664 | |
| 665 | /* internally used functions for testing... */ |
| 666 | void htc_enable_recv(HTC_HANDLE HTCHandle); |
| 667 | void htc_disable_recv(HTC_HANDLE HTCHandle); |
| 668 | A_STATUS HTCWaitForPendingRecv(HTC_HANDLE HTCHandle, |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 669 | uint32_t TimeoutInMs, |
| 670 | bool *pbIsRecvPending); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 671 | |
| 672 | /* function to fetch stats from htc layer*/ |
| 673 | struct ol_ath_htc_stats *ieee80211_ioctl_get_htc_stats(HTC_HANDLE |
| 674 | HTCHandle); |
| 675 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 676 | #ifdef HIF_USB |
| 677 | #define HTCReturnReceivePkt(target, p, osbuf) \ |
| 678 | do { \ |
| 679 | A_NETBUF_FREE(osbuf); \ |
| 680 | if (p->Status == A_CLONE) { \ |
| 681 | qdf_mem_free(p); \ |
| 682 | } \ |
| 683 | } while (0) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 684 | #else |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 685 | #define HTCReturnReceivePkt(target, p, osbuf) htc_add_receive_pkt(target, p) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 686 | #endif |
| 687 | |
| 688 | #ifdef WLAN_FEATURE_FASTPATH |
| 689 | #define HTC_TX_DESC_FILL(_htc_tx_desc, _download_len, _ep_id, _seq_no) \ |
| 690 | do { \ |
| 691 | HTC_WRITE32((_htc_tx_desc), \ |
| 692 | SM((_download_len), HTC_FRAME_HDR_PAYLOADLEN) | \ |
| 693 | SM((_ep_id), HTC_FRAME_HDR_ENDPOINTID)); \ |
| 694 | \ |
Yue Ma | b16cf30 | 2016-03-08 18:30:25 -0800 | [diff] [blame] | 695 | HTC_WRITE32((uint32_t *)(_htc_tx_desc) + 1, \ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 696 | SM((_seq_no), HTC_FRAME_HDR_CONTROLBYTES1));\ |
| 697 | } while (0) |
| 698 | #endif /* WLAN_FEATURE_FASTPATH */ |
| 699 | |
| 700 | #ifdef __cplusplus |
| 701 | } |
| 702 | #endif |
| 703 | void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle, int *credit); |
| 704 | void htc_dump_counter_info(HTC_HANDLE HTCHandle); |
| 705 | void *htc_get_targetdef(HTC_HANDLE htc_handle); |
Yue Ma | ec9e71c | 2016-02-26 18:52:20 -0800 | [diff] [blame] | 706 | #ifdef FEATURE_RUNTIME_PM |
| 707 | int htc_runtime_suspend(HTC_HANDLE htc_ctx); |
| 708 | int htc_runtime_resume(HTC_HANDLE htc_ctx); |
| 709 | #endif |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 710 | |
| 711 | /* Disable ASPM : Disable PCIe low power */ |
Komal Seelam | f860068 | 2016-02-02 18:17:13 +0530 | [diff] [blame] | 712 | bool htc_can_suspend_link(HTC_HANDLE HTCHandle); |
| 713 | void htc_vote_link_down(HTC_HANDLE HTCHandle); |
| 714 | void htc_vote_link_up(HTC_HANDLE HTCHandle); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 715 | #ifdef IPA_OFFLOAD |
| 716 | void htc_ipa_get_ce_resource(HTC_HANDLE htc_handle, |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 717 | qdf_dma_addr_t *ce_sr_base_paddr, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 718 | uint32_t *ce_sr_ring_size, |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 719 | qdf_dma_addr_t *ce_reg_paddr); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 720 | #else |
| 721 | #define htc_ipa_get_ce_resource(htc_handle, \ |
| 722 | ce_sr_base_paddr, \ |
| 723 | ce_sr_ring_size, \ |
| 724 | ce_reg_paddr) /* NO-OP */ |
| 725 | #endif /* IPA_OFFLOAD */ |
| 726 | #endif /* _HTC_API_H_ */ |