blob: 27b26c41bb43ca7a8ec2dc28e11e79b52c1ae9e7 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Yu Wang053d3e72017-02-08 18:48:24 +08002 * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
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/**
29 * @file ol_txrx_htt_api.h
30 * @brief Define the host data API functions called by the host HTT SW.
31 */
32#ifndef _OL_TXRX_HTT_API__H_
33#define _OL_TXRX_HTT_API__H_
34
35#include <htt.h> /* HTT_TX_COMPL_IND_STAT */
36#include <athdefs.h> /* A_STATUS */
Nirav Shahcbc6d722016-03-01 16:24:53 +053037#include <qdf_nbuf.h> /* qdf_nbuf_t */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080038
Dhanashri Atre12a08392016-02-17 13:10:34 -080039#include <cdp_txrx_cmn.h> /* ol_txrx_pdev_handle */
Leo Chang98726762016-10-28 11:07:18 -070040#include <ol_defines.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080041
Kai Liu0c2b5e52016-10-24 16:25:46 +080042#ifdef CONFIG_HL_SUPPORT
43static inline uint16_t *ol_tx_msdu_id_storage(qdf_nbuf_t msdu)
44{
Yu Wang053d3e72017-02-08 18:48:24 +080045 return (uint16_t *) (&QDF_NBUF_CB_TX_DESC_ID(msdu));
Kai Liu0c2b5e52016-10-24 16:25:46 +080046
47}
48#else
Nirav Shahcbc6d722016-03-01 16:24:53 +053049static inline uint16_t *ol_tx_msdu_id_storage(qdf_nbuf_t msdu)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080050{
Nirav Shahcbc6d722016-03-01 16:24:53 +053051 qdf_assert(qdf_nbuf_headroom(msdu) >= (sizeof(uint16_t) * 2 - 1));
52 return (uint16_t *) (((qdf_size_t) (qdf_nbuf_head(msdu) + 1)) & ~0x1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080053}
Kai Liu0c2b5e52016-10-24 16:25:46 +080054#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080055/**
56 * @brief Tx MSDU download completion for a LL system
57 * @details
58 * Release the reference to the downloaded tx descriptor.
59 * In the unlikely event that the reference count is zero, free
60 * the tx descriptor and tx frame.
61 *
62 * @param pdev - (abstract) pointer to the txrx physical device
63 * @param status - indication of whether the download succeeded
64 * @param msdu - the downloaded tx frame
65 * @param msdu_id - the txrx ID of the tx frame - this is used for
66 * locating the frame's tx descriptor
67 */
68void
69ol_tx_download_done_ll(void *pdev,
Nirav Shahcbc6d722016-03-01 16:24:53 +053070 A_STATUS status, qdf_nbuf_t msdu, uint16_t msdu_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080071
72/**
73 * @brief Tx MSDU download completion for HL system without tx completion msgs
74 * @details
75 * Free the tx descriptor and tx frame.
76 * Invoke the HL tx download scheduler.
77 *
78 * @param pdev - (abstract) pointer to the txrx physical device
79 * @param status - indication of whether the download succeeded
80 * @param msdu - the downloaded tx frame
81 * @param msdu_id - the txrx ID of the tx frame - this is used for
82 * locating the frame's tx descriptor
83 */
84void
85ol_tx_download_done_hl_free(void *pdev,
Nirav Shahcbc6d722016-03-01 16:24:53 +053086 A_STATUS status, qdf_nbuf_t msdu, uint16_t msdu_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080087
88/**
89 * @brief Tx MSDU download completion for HL system with tx completion msgs
90 * @details
91 * Release the reference to the downloaded tx descriptor.
92 * In the unlikely event that the reference count is zero, free
93 * the tx descriptor and tx frame.
94 * Optionally, invoke the HL tx download scheduler. (It is probable that
95 * the HL tx download scheduler would operate in response to tx completion
96 * messages rather than download completion events.)
97 *
98 * @param pdev - (abstract) pointer to the txrx physical device
99 * @param status - indication of whether the download succeeded
100 * @param msdu - the downloaded tx frame
101 * @param msdu_id - the txrx ID of the tx frame - this is used for
102 * locating the frame's tx descriptor
103 */
104void
105ol_tx_download_done_hl_retain(void *pdev,
106 A_STATUS status,
Nirav Shahcbc6d722016-03-01 16:24:53 +0530107 qdf_nbuf_t msdu, uint16_t msdu_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800108
109/*
110 * For now, make the host HTT -> host txrx tx completion status
111 * match the target HTT -> host HTT tx completion status, so no
112 * translation is needed.
113 */
114/*
115 * host-only statuses use a different part of the number space
116 * than host-target statuses
117 */
118#define HTT_HOST_ONLY_STATUS_CODE_START 128
119enum htt_tx_status {
120 /* ok - successfully sent + acked */
121 htt_tx_status_ok = HTT_TX_COMPL_IND_STAT_OK,
122
123 /* discard - not sent (congestion control) */
124 htt_tx_status_discard = HTT_TX_COMPL_IND_STAT_DISCARD,
125
126 /* no_ack - sent, but no ack */
127 htt_tx_status_no_ack = HTT_TX_COMPL_IND_STAT_NO_ACK,
128
129 /* download_fail - host could not deliver the tx frame to target */
130 htt_tx_status_download_fail = HTT_HOST_ONLY_STATUS_CODE_START,
131};
132
133/**
134 * @brief Process a tx completion message sent by the target.
135 * @details
136 * When the target is done transmitting a tx frame (either because
137 * the frame was sent + acknowledged, or because the target gave up)
138 * it sends a tx completion message to the host.
139 * This notification function is used regardless of whether the
140 * transmission succeeded or not; the status argument indicates whether
141 * the transmission succeeded.
142 * This tx completion message indicates via the descriptor ID which
143 * tx frames were completed, and indicates via the status whether the
144 * frames were transmitted successfully.
145 * The host frees the completed descriptors / frames (updating stats
146 * in the process).
147 *
148 * @param pdev - the data physical device that sent the tx frames
149 * (registered with HTT as a context pointer during attach time)
150 * @param num_msdus - how many MSDUs are referenced by the tx completion
151 * message
152 * @param status - whether transmission was successful
153 * @param tx_msdu_id_iterator - abstract method of finding the IDs for the
154 * individual MSDUs referenced by the tx completion message, via the
155 * htt_tx_compl_desc_id API function
156 */
157void
158ol_tx_completion_handler(ol_txrx_pdev_handle pdev,
159 int num_msdus,
160 enum htt_tx_status status, void *tx_msdu_id_iterator);
161
162void ol_tx_credit_completion_handler(ol_txrx_pdev_handle pdev, int credits);
163
Siddarth Poddar1df1cd82016-04-27 17:32:21 +0530164struct rate_report_t {
165 u_int16_t id;
166 u_int16_t phy:4;
167 u_int32_t rate;
168};
169
170#if defined(CONFIG_HL_SUPPORT) && defined(QCA_BAD_PEER_TX_FLOW_CL)
171
172/**
173 * @brief Process a link status report for all peers.
174 * @details
175 * The ol_txrx_peer_link_status_handler function performs basic peer link
176 * status analysis
177 *
178 * According to the design, there are 3 kinds of peers which will be
179 * treated differently:
180 * 1) normal: not do any flow control for the peer
181 * 2) limited: will apply flow control for the peer, but frames are allowed
182 * to send
183 * 3) paused: will apply flow control for the peer, no frame is allowed
184 * to send
185 *
186 * @param pdev - the data physical device that sent the tx frames
187 * @param status - the number of peers need to be handled
188 * @param peer_link_report - the link status dedail message
189 */
190void
191ol_txrx_peer_link_status_handler(
192 ol_txrx_pdev_handle pdev,
193 u_int16_t peer_num,
194 struct rate_report_t *peer_link_status);
195
196
197#else
198static inline void ol_txrx_peer_link_status_handler(
199 ol_txrx_pdev_handle pdev,
200 u_int16_t peer_num,
201 struct rate_report_t *peer_link_status)
202{
203 return;
204}
205#endif
206
207
208#ifdef FEATURE_HL_GROUP_CREDIT_FLOW_CONTROL
209
210/**
211 * ol_txrx_update_tx_queue_groups() - update vdev tx queue group if
212 * vdev id mask and ac mask is not matching
213 * @pdev: the data physical device
214 * @group_id: TXQ group id
215 * @credit: TXQ group credit count
216 * @absolute: TXQ group absolute
217 * @vdev_id_mask: TXQ vdev group id mask
218 * @ac_mask: TQX access category mask
219 *
220 * Return: None
221 */
222void
223ol_txrx_update_tx_queue_groups(
224 ol_txrx_pdev_handle pdev,
225 u_int8_t group_id,
226 int32_t credit,
227 u_int8_t absolute,
228 u_int32_t vdev_id_mask,
229 u_int32_t ac_mask
230);
231
232/**
233 * ol_tx_desc_update_group_credit() - update group credits for txq group
234 * @pdev: the data physical device
235 * @tx_desc_id: desc id of tx completion message
236 * @credit: number of credits to update
237 * @absolute: absolute value
238 * @status: tx completion message status
239 *
240 * Return: None
241 */
242void
243ol_tx_desc_update_group_credit(
244 ol_txrx_pdev_handle pdev,
245 u_int16_t tx_desc_id,
246 int credit, u_int8_t absolute, enum htt_tx_status status);
247
248#ifdef DEBUG_HL_LOGGING
249
250/**
251 * ol_tx_update_group_credit_stats() - update group credits stats for txq groups
252 * @pdev: the data physical device
253 *
254 * Return: None
255 */
256void
257ol_tx_update_group_credit_stats(ol_txrx_pdev_handle pdev);
258
259/**
260 * ol_tx_dump_group_credit_stats() - dump group credits stats for txq groups
261 * @pdev: the data physical device
262 *
263 * Return: None
264 */
265void
266ol_tx_dump_group_credit_stats(ol_txrx_pdev_handle pdev);
267
268/**
269 * ol_tx_clear_group_credit_stats() - clear group credits stats for txq groups
270 * @pdev: the data physical device
271 *
272 * Return: None
273 */
274void
275ol_tx_clear_group_credit_stats(ol_txrx_pdev_handle pdev);
276#else
277
278static inline void ol_tx_update_group_credit_stats(ol_txrx_pdev_handle pdev)
279{
280 return;
281}
282
283static inline void ol_tx_dump_group_credit_stats(ol_txrx_pdev_handle pdev)
284{
285 return;
286}
287
288static inline void ol_tx_clear_group_credit_stats(ol_txrx_pdev_handle pdev)
289{
290 return;
291}
292#endif
293
294#else
295static inline void
296ol_tx_desc_update_group_credit(
297 ol_txrx_pdev_handle pdev,
298 u_int16_t tx_desc_id,
299 int credit, u_int8_t absolute, enum htt_tx_status status)
300{
301 return;
302}
303#endif
304
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800305/**
306 * @brief Init the total amount of target credit.
307 * @details
308 *
309 * @param pdev - the data physical device that sent the tx frames
310 * @param credit_delta - how much to increment the target's tx credit by
311 */
312void ol_tx_target_credit_init(struct ol_txrx_pdev_t *pdev, int credit_delta);
313
314/**
315 * @brief Process a tx completion message for a single MSDU.
316 * @details
317 * The ol_tx_single_completion_handler function performs the same tx
318 * completion processing as the ol_tx_completion_handler, but for a
319 * single frame.
320 * ol_tx_completion_handler is optimized to handle batch completions
321 * as efficiently as possible; in contrast ol_tx_single_completion_handler
322 * handles single frames as simply and generally as possible.
323 * Thus, this ol_tx_single_completion_handler function is suitable for
324 * intermittent usage, such as for tx mgmt frames.
325 *
326 * @param pdev - the data physical device that sent the tx frames
327 * @param status - whether transmission was successful
328 * @param tx_msdu_id - ID of the frame which completed transmission
329 */
330void
331ol_tx_single_completion_handler(ol_txrx_pdev_handle pdev,
332 enum htt_tx_status status, uint16_t tx_desc_id);
333
334/**
335 * @brief Update the amount of target credit.
336 * @details
337 * When the target finishes with an old transmit frame, it can use the
338 * space that was occupied by the old tx frame to store a new tx frame.
339 * This function is used to inform the txrx layer, where the HL tx download
340 * scheduler resides, about such updates to the target's tx credit.
341 * This credit update is done explicitly, rather than having the txrx layer
342 * update the credit count itself inside the ol_tx_completion handler
343 * function. This provides HTT with the flexibility to limit the rate of
344 * downloads from the TXRX layer's download scheduler, by controlling how
345 * much credit the download scheduler gets, and also provides the flexibility
346 * to account for a change in the tx memory pool size within the target.
347 * This function is only used for HL systems; in LL systems, each tx frame
348 * is assumed to use exactly one credit (for its target-side tx descriptor),
349 * and any rate limiting is managed within the target.
350 *
351 * @param pdev - the data physical device that sent the tx frames
352 * @param credit_delta - how much to increment the target's tx credit by
353 */
354void ol_tx_target_credit_update(struct ol_txrx_pdev_t *pdev, int credit_delta);
355
356/**
357 * @brief Process an rx indication message sent by the target.
358 * @details
359 * The target sends a rx indication message to the host as a
360 * notification that there are new rx frames available for the
361 * host to process.
362 * The HTT host layer locates the rx descriptors and rx frames
363 * associated with the indication, and calls this function to
364 * invoke the rx data processing on the new frames.
365 * (For LL, the rx descriptors and frames are delivered directly
366 * to the host via MAC DMA, while for HL the rx descriptor and
367 * frame for individual frames are combined with the rx indication
368 * message.)
369 * All MPDUs referenced by a rx indication message belong to the
370 * same peer-TID.
371 *
372 * @param pdev - the data physical device that received the frames
373 * (registered with HTT as a context pointer during attach time)
374 * @param rx_ind_msg - the network buffer holding the rx indication message
375 * (For HL, this netbuf also holds the rx desc and rx payload, but
376 * the data SW is agnostic to whether the desc and payload are
377 * piggybacked with the rx indication message.)
378 * @param peer_id - which peer sent this rx data
379 * @param tid - what (extended) traffic type the rx data is
380 * @param num_mpdu_ranges - how many ranges of MPDUs does the message describe.
381 * Each MPDU within the range has the same rx status.
382 */
383void
384ol_rx_indication_handler(ol_txrx_pdev_handle pdev,
Nirav Shahcbc6d722016-03-01 16:24:53 +0530385 qdf_nbuf_t rx_ind_msg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800386 uint16_t peer_id, uint8_t tid, int num_mpdu_ranges);
387
388/**
389 * @brief Process an rx fragment indication message sent by the target.
390 * @details
391 * The target sends a rx fragment indication message to the host as a
392 * notification that there are new rx fragment available for the
393 * host to process.
394 * The HTT host layer locates the rx descriptors and rx fragment
395 * associated with the indication, and calls this function to
396 * invoke the rx fragment data processing on the new fragment.
397 *
398 * @param pdev - the data physical device that received the frames
399 * (registered with HTT as a context pointer during attach time)
400 * @param rx_frag_ind_msg - the network buffer holding the rx fragment indication message
401 * @param peer_id - which peer sent this rx data
402 * @param tid - what (extended) traffic type the rx data is
403 */
404void ol_rx_frag_indication_handler(ol_txrx_pdev_handle pdev,
Nirav Shahcbc6d722016-03-01 16:24:53 +0530405 qdf_nbuf_t rx_frag_ind_msg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800406 uint16_t peer_id, uint8_t tid);
407
408/**
409 * @brief Process rx offload deliver indication message sent by the target.
410 * @details
411 * When the target exits offload mode, target delivers packets that it has
412 * held in its memory to the host using this message.
413 * Low latency case:
414 * The message contains the number of MSDUs that are being delivered by the
415 * target to the host. The packet itself resides in host ring along with some
416 * metadata describing the peer id, vdev id, tid, FW desc and length of
417 * the packet being delivered.
418 * Hight letency case:
419 * The message itself contains the payload of the MSDU being delivered by
420 * the target to the host. The message also contains meta data describing
421 * the packet such as peer id, vdev id, tid, FW desc and length of the packet
422 * being delivered. Refer to htt.h for the exact structure of the message.
423 * @param pdev - the data physical device that received the frame.
424 * @param msg - offload deliver indication message
425 * @param msdu_cnt - number of MSDUs being delivred.
426 */
427void
428ol_rx_offload_deliver_ind_handler(ol_txrx_pdev_handle pdev,
Nirav Shahcbc6d722016-03-01 16:24:53 +0530429 qdf_nbuf_t msg, int msdu_cnt);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800430
431/**
432 * @brief Process a peer map message sent by the target.
433 * @details
434 * Each time the target allocates a new peer ID, it will inform the
435 * host via the "peer map" message. This function processes that
436 * message. The host data SW looks for a peer object whose MAC address
437 * matches the MAC address specified in the peer map message, and then
438 * sets up a mapping between the peer ID specified in the message and
439 * the peer object that was found.
440 *
441 * @param pdev - data physical device handle
442 * (registered with HTT as a context pointer during attach time)
443 * @param peer_id - ID generated by the target to refer to the peer in question
444 * The target may create multiple IDs for a single peer.
445 * @param vdev_id - Reference to the virtual device the peer is associated with
446 * @param peer_mac_addr - MAC address of the peer in question
447 * @param tx_ready - whether transmits to this peer can be done already, or
448 * need to wait for a call to peer_tx_ready (only applies to HL systems)
449 */
450void
451ol_rx_peer_map_handler(ol_txrx_pdev_handle pdev,
452 uint16_t peer_id,
453 uint8_t vdev_id, uint8_t *peer_mac_addr, int tx_ready);
454
455/**
456 * @brief notify the host that the target is ready to transmit to a new peer.
457 * @details
458 * Some targets can immediately accept tx frames for a new peer, as soon as
459 * the peer's association completes. Other target need a short setup time
460 * before they are ready to accept tx frames for the new peer.
461 * If the target needs time for setup, it will provide a peer_tx_ready
462 * message when it is done with the setup. This function forwards this
463 * notification from the target to the host's tx queue manager.
464 * This function only applies for HL systems, in which the host determines
465 * which peer a given tx frame is for, and stores the tx frames in queues.
466 *
467 * @param pdev - data physical device handle
468 * (registered with HTT as a context pointer during attach time)
469 * @param peer_id - ID for the new peer which can now accept tx frames
470 */
471void ol_txrx_peer_tx_ready_handler(ol_txrx_pdev_handle pdev, uint16_t peer_id);
472
473/**
474 * @brief Process a peer unmap message sent by the target.
475 * @details
476 * Each time the target frees a peer ID, it will inform the host via the
477 * "peer unmap" message. This function processes that message.
478 * The host data SW uses the peer ID from the message to find the peer
479 * object from peer_map[peer_id], then invalidates peer_map[peer_id]
480 * (by setting it to NULL), and checks whether there are any remaining
481 * references to the peer object. If not, the function deletes the
482 * peer object.
483 *
484 * @param pdev - data physical device handle
485 * (registered with HTT as a context pointer during attach time)
486 * @param peer_id - ID that is being freed.
487 * The target may create multiple IDs for a single peer.
488 */
489void ol_rx_peer_unmap_handler(ol_txrx_pdev_handle pdev, uint16_t peer_id);
490
491/**
492 * @brief Process a security indication message sent by the target.
493 * @details
494 * When a key is assigned to a peer, the target will inform the host
495 * with a security indication message.
496 * The host remembers the security type, and infers whether a rx PN
497 * check is needed.
498 *
499 * @param pdev - data physical device handle
500 * @param peer_id - which peer the security info is for
501 * @param sec_type - which type of security / key the peer is using
502 * @param is_unicast - whether security spec is for a unicast or multicast key
503 * @param michael_key - key used for TKIP MIC (if sec_type == TKIP)
504 * @param rx_pn - RSC used for WAPI PN replay check (if sec_type == WAPI)
505 */
506void
507ol_rx_sec_ind_handler(ol_txrx_pdev_handle pdev,
508 uint16_t peer_id,
509 enum htt_sec_type sec_type,
510 int is_unicast, uint32_t *michael_key, uint32_t *rx_pn);
511
512/**
513 * @brief Process an ADDBA message sent by the target.
514 * @details
515 * When the target notifies the host of an ADDBA event for a specified
516 * peer-TID, the host will set up the rx reordering state for the peer-TID.
517 * Specifically, the host will create a rx reordering array whose length
518 * is based on the window size specified in the ADDBA.
519 *
520 * @param pdev - data physical device handle
521 * (registered with HTT as a context pointer during attach time)
522 * @param peer_id - which peer the ADDBA event is for
523 * @param tid - which traffic ID within the peer the ADDBA event is for
524 * @param win_sz - how many sequence numbers are in the ARQ block ack window
525 * set up by the ADDBA event
526 * @param start_seq_num - the initial value of the sequence number during the
527 * block ack agreement, as specified by the ADDBA request.
528 * @param failed - indicate whether the target's ADDBA setup succeeded:
529 * 0 -> success, 1 -> fail
530 */
531void
532ol_rx_addba_handler(ol_txrx_pdev_handle pdev,
533 uint16_t peer_id,
534 uint8_t tid,
535 uint8_t win_sz, uint16_t start_seq_num, uint8_t failed);
536
537/**
538 * @brief Process a DELBA message sent by the target.
539 * @details
540 * When the target notifies the host of a DELBA event for a specified
541 * peer-TID, the host will clean up the rx reordering state for the peer-TID.
542 * Specifically, the host will remove the rx reordering array, and will
543 * set the reorder window size to be 1 (stop and go ARQ).
544 *
545 * @param pdev - data physical device handle
546 * (registered with HTT as a context pointer during attach time)
547 * @param peer_id - which peer the ADDBA event is for
548 * @param tid - which traffic ID within the peer the ADDBA event is for
549 */
550void
551ol_rx_delba_handler(ol_txrx_pdev_handle pdev, uint16_t peer_id, uint8_t tid);
552
553enum htt_rx_flush_action {
554 htt_rx_flush_release,
555 htt_rx_flush_discard,
556};
557
558/**
559 * @brief Process a rx reorder flush message sent by the target.
560 * @details
561 * The target's rx reorder logic can send a flush indication to the
562 * host's rx reorder buffering either as a flush IE within a rx
563 * indication message, or as a standalone rx reorder flush message.
564 * This ol_rx_flush_handler function processes the standalone rx
565 * reorder flush message from the target.
566 * The flush message specifies a range of sequence numbers whose
567 * rx frames are flushed.
568 * Some sequence numbers within the specified range may not have
569 * rx frames; the host needs to check for each sequence number in
570 * the specified range whether there are rx frames held for that
571 * sequence number.
572 *
573 * @param pdev - data physical device handle
574 * (registered with HTT as a context pointer during attach time)
575 * @param peer_id - which peer's rx data is being flushed
576 * @param tid - which traffic ID within the peer has the rx data being flushed
577 * @param seq_num_start - Which sequence number within the rx reordering
578 * buffer the flushing should start with.
579 * This is the LSBs of the 802.11 sequence number.
580 * This sequence number is masked with the rounded-to-power-of-two
581 * window size to generate a reorder buffer index.
582 * The flush includes this initial sequence number.
583 * @param seq_num_end - Which sequence number within the rx reordering
584 * buffer the flushing should stop at.
585 * This is the LSBs of the 802.11 sequence number.
586 * This sequence number is masked with the rounded-to-power-of-two
587 * window size to generate a reorder buffer index.
588 * The flush excludes this final sequence number.
589 * @param action - whether to release or discard the rx frames
590 */
591void
592ol_rx_flush_handler(ol_txrx_pdev_handle pdev,
593 uint16_t peer_id,
594 uint8_t tid,
595 uint16_t seq_num_start,
596 uint16_t seq_num_end, enum htt_rx_flush_action action);
597
598/**
599 * @brief Process a rx pn indication message
600 * @details
601 * When the peer is configured to get PN checking done in target,
602 * the target instead of sending reorder flush/release messages
603 * sends PN indication messages which contain the start and end
604 * sequence numbers to be flushed/released along with the sequence
605 * numbers of MPDUs that failed the PN check in target.
606 *
607 * @param pdev - data physical device handle
608 * (registered with HTT as a context pointer during attach time)
609 * @param peer_id - which peer's rx data is being flushed
610 * @param tid - which traffic ID within the peer
611 * @param seq_num_start - Which sequence number within the rx reordering
612 * buffer to start with.
613 * This is the LSBs of the 802.11 sequence number.
614 * This sequence number is masked with the rounded-to-power-of-two
615 * window size to generate a reorder buffer index.
616 * This is the initial sequence number.
617 * @param seq_num_end - Which sequence number within the rx reordering
618 * buffer to stop at.
619 * This is the LSBs of the 802.11 sequence number.
620 * This sequence number is masked with the rounded-to-power-of-two
621 * window size to generate a reorder buffer index.
622 * The processing stops right before this sequence number
623 * @param pn_ie_cnt - Indicates the number of PN information elements.
624 * @param pn_ie - Pointer to the array of PN information elements. Each
625 * PN information element contains the LSBs of the 802.11 sequence number
626 * of the MPDU that failed the PN checking in target.
627 */
628void
629ol_rx_pn_ind_handler(ol_txrx_pdev_handle pdev,
630 uint16_t peer_id,
631 uint8_t tid,
632 int seq_num_start,
633 int seq_num_end, uint8_t pn_ie_cnt, uint8_t *pn_ie);
634
635/**
636 * @brief Process a stats message sent by the target.
637 * @details
638 * The host can request target for stats.
639 * The target sends the stats to the host via a confirmation message.
640 * This ol_txrx_fw_stats_handler function processes the confirmation message.
641 * Currently, this processing consists of copying the stats from the message
642 * buffer into the txrx pdev object, and waking the sleeping host context
643 * that requested the stats.
644 *
645 * @param pdev - data physical device handle
646 * (registered with HTT as a context pointer during attach time)
647 * @param cookie - Value echoed from the cookie in the stats request
648 * message. This allows the host SW to find the stats request object.
649 * (Currently, this cookie is unused.)
650 * @param stats_info_list - stats confirmation message contents, containing
651 * a list of the stats requested from the target
652 */
653void
654ol_txrx_fw_stats_handler(ol_txrx_pdev_handle pdev,
655 uint64_t cookie, uint8_t *stats_info_list);
656
657/**
658 * @brief Process a tx inspect message sent by the target.
659 * @details:
660 * TODO: update
661 * This tx inspect message indicates via the descriptor ID
662 * which tx frames are to be inspected by host. The host
663 * re-injects the packet back to the host for a number of
664 * cases.
665 *
666 * @param pdev - the data physical device that sent the tx frames
667 * (registered with HTT as a context pointer during attach time)
668 * @param num_msdus - how many MSDUs are referenced by the tx completion
669 * message
670 * @param tx_msdu_id_iterator - abstract method of finding the IDs for the
671 * individual MSDUs referenced by the tx completion message, via the
672 * htt_tx_compl_desc_id API function
673 */
674void
675ol_tx_inspect_handler(ol_txrx_pdev_handle pdev,
676 int num_msdus, void *tx_desc_id_iterator);
677
678/**
679 * @brief Get the UAPSD mask.
680 * @details
681 * This function will return the UAPSD TID mask.
682 *
683 * @param txrx_pdev - pointer to the txrx pdev object
684 * @param peer_id - PeerID.
685 * @return uapsd mask value
686 */
687uint8_t
688ol_txrx_peer_uapsdmask_get(struct ol_txrx_pdev_t *txrx_pdev, uint16_t peer_id);
689
690/**
691 * @brief Get the Qos Capable.
692 * @details
693 * This function will return the txrx_peer qos_capable.
694 *
695 * @param txrx_pdev - pointer to the txrx pdev object
696 * @param peer_id - PeerID.
697 * @return qos_capable value
698 */
699uint8_t
700ol_txrx_peer_qoscapable_get(struct ol_txrx_pdev_t *txrx_pdev, uint16_t peer_id);
701
702/**
703 * @brief Process an rx indication message sent by the target.
704 * @details
705 * The target sends a rx indication message to the host as a
706 * notification that there are new rx frames available for the
707 * host to process.
708 * The HTT host layer locates the rx descriptors and rx frames
709 * associated with the indication, and calls this function to
710 * invoke the rx data processing on the new frames.
711 * All MPDUs referenced by a rx indication message belong to the
712 * same peer-TID. The frames indicated have been re-ordered by
713 * the target.
714 *
715 * @param pdev - the data physical device that received the frames
716 * (registered with HTT as a context pointer during attach time)
717 * @param rx_ind_msg - the network buffer holding the rx indication message
718 * @param peer_id - which peer sent this rx data
719 * @param tid - what (extended) traffic type the rx data is
720 * @param is_offload - is this an offload indication?
721 */
722void
723ol_rx_in_order_indication_handler(ol_txrx_pdev_handle pdev,
Nirav Shahcbc6d722016-03-01 16:24:53 +0530724 qdf_nbuf_t rx_ind_msg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800725 uint16_t peer_id,
726 uint8_t tid, uint8_t is_offload);
727
Siddarth Poddar1df1cd82016-04-27 17:32:21 +0530728#ifdef FEATURE_HL_GROUP_CREDIT_FLOW_CONTROL
729
730/**
731 * ol_tx_get_max_tx_groups_supported() - get max TCQ groups supported
732 * @pdev: the data physical device that received the frames
733 *
734 * Return: number of max groups supported
735 */
736u_int32_t ol_tx_get_max_tx_groups_supported(struct ol_txrx_pdev_t *pdev);
737#else
738
739static inline u_int32_t
740ol_tx_get_max_tx_groups_supported(struct ol_txrx_pdev_t *pdev)
741{
742 return 0;
743}
744#endif
745
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800746#endif /* _OL_TXRX_HTT_API__H_ */