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