blob: 090f02936d27deba1ec92b44308b552b8b31bd90 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Venkata Sharath Chandra Manchala29965172018-01-18 14:17:29 -08002 * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019#ifndef _OL_TXRX__H_
20#define _OL_TXRX__H_
21
Nirav Shahcbc6d722016-03-01 16:24:53 +053022#include <qdf_nbuf.h> /* qdf_nbuf_t */
Dhanashri Atre12a08392016-02-17 13:10:34 -080023#include <cdp_txrx_cmn.h> /* ol_txrx_vdev_t, etc. */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080024#include "cds_sched.h"
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -080025#include <cdp_txrx_handle.h>
Poddar, Siddarth8e3ee2d2016-11-29 20:17:01 +053026#include <ol_txrx_types.h>
27/*
28 * Pool of tx descriptors reserved for
29 * high-priority traffic, such as ARP/EAPOL etc
30 * only for forwarding path.
31 */
32#define OL_TX_NON_FWD_RESERVE 100
33
Mohit Khannab7bec722017-11-10 11:43:44 -080034ol_txrx_peer_handle ol_txrx_peer_get_ref_by_addr(ol_txrx_pdev_handle pdev,
35 u8 *peer_addr,
36 u8 *peer_id,
37 enum peer_debug_id_type
38 dbg_id);
Mohit Khannab04dfcd2017-02-13 18:54:35 -080039
Mohit Khannab7bec722017-11-10 11:43:44 -080040int ol_txrx_peer_release_ref(ol_txrx_peer_handle peer,
41 enum peer_debug_id_type dbg_id);
Alok Kumarbda73bb2018-05-17 11:50:03 +053042/* ol_txrx_is_peer_eligible_for_deletion() - check if peer to be deleted
43 * @peer: peer handler
Alok Kumar4d87ff22018-06-01 17:15:57 +053044 * @pdev: pointer to pdev
Alok Kumarbda73bb2018-05-17 11:50:03 +053045 *
46 * Return: true if eligible for deletion else false
47 */
Alok Kumar4d87ff22018-06-01 17:15:57 +053048bool ol_txrx_is_peer_eligible_for_deletion(ol_txrx_peer_handle peer,
49 struct ol_txrx_pdev_t *pdev);
Mohit Khannab7bec722017-11-10 11:43:44 -080050
Siddarth Poddarb2011f62016-04-27 20:45:42 +053051/**
52 * ol_tx_desc_pool_size_hl() - allocate tx descriptor pool size for HL systems
53 * @ctrl_pdev: the control pdev handle
54 *
55 * Return: allocated pool size
56 */
57u_int16_t
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -080058ol_tx_desc_pool_size_hl(struct cdp_cfg *ctrl_pdev);
Siddarth Poddarb2011f62016-04-27 20:45:42 +053059
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080060#ifndef OL_TX_AVG_FRM_BYTES
61#define OL_TX_AVG_FRM_BYTES 1000
62#endif
63
Siddarth Poddarb2011f62016-04-27 20:45:42 +053064#ifndef OL_TX_DESC_POOL_SIZE_MIN_HL
65#define OL_TX_DESC_POOL_SIZE_MIN_HL 500
66#endif
67
68#ifndef OL_TX_DESC_POOL_SIZE_MAX_HL
69#define OL_TX_DESC_POOL_SIZE_MAX_HL 5000
70#endif
71
72
73#ifdef CONFIG_PER_VDEV_TX_DESC_POOL
74#define TXRX_HL_TX_FLOW_CTRL_VDEV_LOW_WATER_MARK 400
75#define TXRX_HL_TX_FLOW_CTRL_MGMT_RESERVED 100
76#endif
77
78#ifdef CONFIG_TX_DESC_HI_PRIO_RESERVE
79#define TXRX_HL_TX_DESC_HI_PRIO_RESERVED 20
80#endif
81
82#if defined(CONFIG_HL_SUPPORT) && defined(FEATURE_WLAN_TDLS)
83
84void
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -080085ol_txrx_hl_tdls_flag_reset(struct cdp_vdev *vdev, bool flag);
Siddarth Poddarb2011f62016-04-27 20:45:42 +053086#else
87
88static inline void
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -080089ol_txrx_hl_tdls_flag_reset(struct cdp_vdev *vdev, bool flag)
Siddarth Poddarb2011f62016-04-27 20:45:42 +053090{
Siddarth Poddarb2011f62016-04-27 20:45:42 +053091}
92#endif
93
Venkata Sharath Chandra Manchala29965172018-01-18 14:17:29 -080094#ifdef WDI_EVENT_ENABLE
95void *ol_get_pldev(struct cdp_pdev *txrx_pdev);
96#else
Nirav Shahbb8e47c2018-05-17 16:56:41 +053097static inline
Venkata Sharath Chandra Manchala29965172018-01-18 14:17:29 -080098void *ol_get_pldev(struct cdp_pdev *txrx_pdev)
99{
100 return NULL;
101}
102#endif
Nirav Shahc4aa1ab2018-04-21 12:38:44 +0530103
104#ifdef QCA_SUPPORT_TXRX_LOCAL_PEER_ID
105ol_txrx_peer_handle
106ol_txrx_peer_find_by_local_id(struct cdp_pdev *pdev,
107 uint8_t local_peer_id);
108ol_txrx_peer_handle
109ol_txrx_peer_get_ref_by_local_id(struct cdp_pdev *ppdev,
110 uint8_t local_peer_id,
111 enum peer_debug_id_type dbg_id);
112#endif /* QCA_SUPPORT_TXRX_LOCAL_PEER_ID */
113
Venkata Sharath Chandra Manchala0d44d452016-11-23 17:48:15 -0800114/*
Poddar, Siddarthbd804202016-11-23 18:19:49 +0530115 * @nbuf: buffer which contains data to be displayed
116 * @nbuf_paddr: physical address of the buffer
117 * @len: defines the size of the data to be displayed
118 *
119 * Return: None
120 */
121void
122ol_txrx_dump_pkt(qdf_nbuf_t nbuf, uint32_t nbuf_paddr, int len);
123
Nirav Shahc4aa1ab2018-04-21 12:38:44 +0530124struct cdp_vdev *ol_txrx_get_vdev_from_vdev_id(uint8_t vdev_id);
125
126void *ol_txrx_find_peer_by_addr(struct cdp_pdev *pdev,
127 uint8_t *peer_addr,
128 uint8_t *peer_id);
129
130void htt_pkt_log_init(struct cdp_pdev *pdev_handle, void *scn);
131void peer_unmap_timer_work_function(void *);
132void peer_unmap_timer_handler(void *data);
133
134#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
135int ol_txrx_register_tx_flow_control(uint8_t vdev_id,
136 ol_txrx_tx_flow_control_fp flow_control,
137 void *osif_fc_ctx,
138 ol_txrx_tx_flow_control_is_pause_fp
139 flow_control_is_pause);
140
141int ol_txrx_deregister_tx_flow_control_cb(uint8_t vdev_id);
142
143bool ol_txrx_get_tx_resource(uint8_t sta_id,
144 unsigned int low_watermark,
145 unsigned int high_watermark_offset);
146
147int ol_txrx_ll_set_tx_pause_q_depth(uint8_t vdev_id, int pause_q_depth);
148#endif
149
150#ifdef QCA_LL_TX_FLOW_CONTROL_V2
151void ol_tx_set_desc_global_pool_size(uint32_t num_msdu_desc);
152uint32_t ol_tx_get_total_free_desc(struct ol_txrx_pdev_t *pdev);
153static inline
154uint32_t ol_tx_get_desc_global_pool_size(struct ol_txrx_pdev_t *pdev)
155{
156 return pdev->num_msdu_desc;
157}
158
159QDF_STATUS ol_txrx_register_pause_cb(struct cdp_soc_t *soc,
160 tx_pause_callback pause_cb);
Poddar, Siddarth8e3ee2d2016-11-29 20:17:01 +0530161/**
162 * ol_txrx_fwd_desc_thresh_check() - check to forward packet to tx path
163 * @vdev: which virtual device the frames were addressed to
164 *
165 * This API is to check whether enough descriptors are available or not
166 * to forward packet to tx path. If not enough descriptors left,
167 * start dropping tx-path packets.
168 * Do not pause netif queues as still a pool of descriptors is reserved
169 * for high-priority traffic such as EAPOL/ARP etc.
170 * In case of intra-bss forwarding, it could be possible that tx-path can
171 * consume all the tx descriptors and pause netif queues. Due to this,
172 * there would be some left for stack triggered packets such as ARP packets
173 * which could lead to disconnection of device. To avoid this, reserved
174 * a pool of descriptors for high-priority packets, i.e., reduce the
175 * threshold of drop in the intra-bss forwarding path.
176 *
177 * Return: true ; forward the packet, i.e., below threshold
178 * false; not enough descriptors, drop the packet
179 */
180bool ol_txrx_fwd_desc_thresh_check(struct ol_txrx_vdev_t *vdev);
Nirav Shahc4aa1ab2018-04-21 12:38:44 +0530181#else
182/**
183 * ol_tx_get_desc_global_pool_size() - get global pool size
184 * @pdev: pdev handle
185 *
186 * Return: global pool size
187 */
188static inline
189uint32_t ol_tx_get_desc_global_pool_size(struct ol_txrx_pdev_t *pdev)
190{
191 return ol_cfg_target_tx_credit(pdev->ctrl_pdev);
192}
Poddar, Siddarthbd804202016-11-23 18:19:49 +0530193
Nirav Shahc4aa1ab2018-04-21 12:38:44 +0530194/**
195 * ol_tx_get_total_free_desc() - get total free descriptors
196 * @pdev: pdev handle
197 *
198 * Return: total free descriptors
199 */
200static inline
201uint32_t ol_tx_get_total_free_desc(struct ol_txrx_pdev_t *pdev)
202{
203 return pdev->tx_desc.num_free;
204}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800205
Nirav Shahc4aa1ab2018-04-21 12:38:44 +0530206static inline
207bool ol_txrx_fwd_desc_thresh_check(struct ol_txrx_vdev_t *vdev)
208{
209 return true;
210}
Jeff Johnson2338e1a2016-12-16 15:59:24 -0800211
Nirav Shahc4aa1ab2018-04-21 12:38:44 +0530212#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800213#endif /* _OL_TXRX__H_ */