Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 1 | /* |
psimha | fc2f91b | 2018-01-10 15:30:03 -0800 | [diff] [blame] | 2 | * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 3 | * |
| 4 | * 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 | |
| 19 | #if defined(CONFIG_HL_SUPPORT) |
| 20 | #include "wlan_tgt_def_config_hl.h" |
| 21 | #else |
| 22 | #include "wlan_tgt_def_config.h" |
| 23 | #endif |
| 24 | |
| 25 | #include "qdf_trace.h" |
| 26 | #include "qdf_mem.h" |
Akshay Kosigi | a4f6e17 | 2018-09-03 21:42:27 +0530 | [diff] [blame] | 27 | #include <cdp_txrx_ops.h> |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 28 | #include "wlan_cfg.h" |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 29 | #include "cfg_ucfg_api.h" |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 30 | |
| 31 | /* |
| 32 | * FIX THIS - |
| 33 | * For now, all these configuration parameters are hardcoded. |
| 34 | * Many of these should actually be coming from dts file/ini file |
| 35 | */ |
Pamidipati, Vijay | 45b1df2 | 2017-06-21 03:20:25 +0530 | [diff] [blame] | 36 | |
Bharat Kumar M | dd67f45 | 2017-07-17 22:37:56 +0530 | [diff] [blame] | 37 | /* |
| 38 | * The max allowed size for tx comp ring is 8191. |
| 39 | * This is limitted by h/w ring max size. |
| 40 | * As this is not a power of 2 it does not work with nss offload so the |
Jeff Johnson | 23dbde8 | 2018-05-05 23:55:52 -0700 | [diff] [blame] | 41 | * nearest available size which is power of 2 is 4096 chosen for nss |
Bharat Kumar M | dd67f45 | 2017-07-17 22:37:56 +0530 | [diff] [blame] | 42 | */ |
Ravi Joshi | fb39e00 | 2017-02-11 21:18:40 -0800 | [diff] [blame] | 43 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 44 | #define WLAN_CFG_TX_RING_MASK_0 0x1 |
| 45 | #define WLAN_CFG_TX_RING_MASK_1 0x2 |
| 46 | #define WLAN_CFG_TX_RING_MASK_2 0x4 |
| 47 | #define WLAN_CFG_TX_RING_MASK_3 0x0 |
| 48 | |
| 49 | #define WLAN_CFG_RX_RING_MASK_0 0x1 |
| 50 | #define WLAN_CFG_RX_RING_MASK_1 0x2 |
| 51 | #define WLAN_CFG_RX_RING_MASK_2 0x4 |
| 52 | #define WLAN_CFG_RX_RING_MASK_3 0x8 |
| 53 | |
| 54 | #define WLAN_CFG_RX_MON_RING_MASK_0 0x1 |
| 55 | #define WLAN_CFG_RX_MON_RING_MASK_1 0x2 |
| 56 | #define WLAN_CFG_RX_MON_RING_MASK_2 0x4 |
| 57 | #define WLAN_CFG_RX_MON_RING_MASK_3 0x0 |
| 58 | |
Nandha Kishore Easwaran | 82ac62e | 2017-06-20 17:55:07 +0530 | [diff] [blame] | 59 | #define WLAN_CFG_RX_ERR_RING_MASK_0 0x1 |
| 60 | #define WLAN_CFG_RX_ERR_RING_MASK_1 0x0 |
| 61 | #define WLAN_CFG_RX_ERR_RING_MASK_2 0x0 |
| 62 | #define WLAN_CFG_RX_ERR_RING_MASK_3 0x0 |
| 63 | |
| 64 | #define WLAN_CFG_RX_WBM_REL_RING_MASK_0 0x1 |
| 65 | #define WLAN_CFG_RX_WBM_REL_RING_MASK_1 0x0 |
| 66 | #define WLAN_CFG_RX_WBM_REL_RING_MASK_2 0x0 |
| 67 | #define WLAN_CFG_RX_WBM_REL_RING_MASK_3 0x0 |
| 68 | |
| 69 | #define WLAN_CFG_REO_STATUS_RING_MASK_0 0x1 |
| 70 | #define WLAN_CFG_REO_STATUS_RING_MASK_1 0x0 |
| 71 | #define WLAN_CFG_REO_STATUS_RING_MASK_2 0x0 |
| 72 | #define WLAN_CFG_REO_STATUS_RING_MASK_3 0x0 |
| 73 | |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 74 | #define WLAN_CFG_RXDMA2HOST_RING_MASK_0 0x1 |
| 75 | #define WLAN_CFG_RXDMA2HOST_RING_MASK_1 0x2 |
| 76 | #define WLAN_CFG_RXDMA2HOST_RING_MASK_2 0x4 |
| 77 | #define WLAN_CFG_RXDMA2HOST_RING_MASK_3 0x0 |
| 78 | |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 79 | #define WLAN_CFG_HOST2RXDMA_RING_MASK_0 0x1 |
| 80 | #define WLAN_CFG_HOST2RXDMA_RING_MASK_1 0x2 |
| 81 | #define WLAN_CFG_HOST2RXDMA_RING_MASK_2 0x4 |
| 82 | #define WLAN_CFG_HOST2RXDMA_RING_MASK_3 0x0 |
| 83 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 84 | #ifdef CONFIG_MCL |
| 85 | static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 86 | 0, |
| 87 | WLAN_CFG_TX_RING_MASK_0, |
| 88 | 0, |
| 89 | 0, |
psimha | f098e73 | 2017-09-06 19:37:06 -0700 | [diff] [blame] | 90 | 0, |
| 91 | 0, |
| 92 | 0}; |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 93 | |
Pramod Simha | b2ef27b | 2018-09-14 14:43:19 -0700 | [diff] [blame] | 94 | #ifndef IPA_OFFLOAD |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 95 | static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 96 | 0, |
| 97 | 0, |
| 98 | WLAN_CFG_RX_RING_MASK_0, |
| 99 | 0, |
| 100 | WLAN_CFG_RX_RING_MASK_1, |
| 101 | WLAN_CFG_RX_RING_MASK_2, |
| 102 | WLAN_CFG_RX_RING_MASK_3}; |
Pramod Simha | b2ef27b | 2018-09-14 14:43:19 -0700 | [diff] [blame] | 103 | #else |
| 104 | static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 105 | 0, |
| 106 | 0, |
| 107 | WLAN_CFG_RX_RING_MASK_0, |
| 108 | 0, |
| 109 | WLAN_CFG_RX_RING_MASK_1, |
| 110 | WLAN_CFG_RX_RING_MASK_2, |
| 111 | 0}; |
| 112 | #endif |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 113 | |
| 114 | static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 115 | 0, |
| 116 | 0, |
| 117 | 0, |
| 118 | WLAN_CFG_RX_MON_RING_MASK_0, |
| 119 | WLAN_CFG_RX_MON_RING_MASK_1, |
| 120 | WLAN_CFG_RX_MON_RING_MASK_2, |
| 121 | WLAN_CFG_RX_MON_RING_MASK_3}; |
Jinwei Chen | 38c92c6 | 2018-09-17 15:24:43 +0800 | [diff] [blame] | 122 | |
| 123 | static const int host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 124 | WLAN_CFG_HOST2RXDMA_RING_MASK_0, |
| 125 | 0, |
| 126 | 0, |
| 127 | 0, |
| 128 | 0, |
| 129 | 0, |
| 130 | 0}; |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 131 | #else |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 132 | static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 133 | WLAN_CFG_TX_RING_MASK_0, |
| 134 | WLAN_CFG_TX_RING_MASK_1, |
| 135 | WLAN_CFG_TX_RING_MASK_2, |
| 136 | WLAN_CFG_TX_RING_MASK_3}; |
| 137 | |
| 138 | static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 139 | WLAN_CFG_RX_RING_MASK_0, |
| 140 | WLAN_CFG_RX_RING_MASK_1, |
| 141 | WLAN_CFG_RX_RING_MASK_2, |
| 142 | WLAN_CFG_RX_RING_MASK_3}; |
| 143 | |
| 144 | static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
Karunakar Dasineni | 860938e | 2018-03-14 17:28:15 -0700 | [diff] [blame] | 145 | 0, |
| 146 | 0, |
| 147 | 0, |
| 148 | 0, |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 149 | WLAN_CFG_RX_MON_RING_MASK_0, |
| 150 | WLAN_CFG_RX_MON_RING_MASK_1, |
Karunakar Dasineni | 860938e | 2018-03-14 17:28:15 -0700 | [diff] [blame] | 151 | WLAN_CFG_RX_MON_RING_MASK_2}; |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 152 | |
Jinwei Chen | 38c92c6 | 2018-09-17 15:24:43 +0800 | [diff] [blame] | 153 | static const int host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 154 | WLAN_CFG_HOST2RXDMA_RING_MASK_0, |
| 155 | WLAN_CFG_HOST2RXDMA_RING_MASK_1, |
| 156 | WLAN_CFG_HOST2RXDMA_RING_MASK_2, |
| 157 | WLAN_CFG_HOST2RXDMA_RING_MASK_3}; |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 158 | #endif |
| 159 | |
Nandha Kishore Easwaran | 82ac62e | 2017-06-20 17:55:07 +0530 | [diff] [blame] | 160 | static const int rx_err_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 161 | WLAN_CFG_RX_ERR_RING_MASK_0, |
| 162 | WLAN_CFG_RX_ERR_RING_MASK_1, |
| 163 | WLAN_CFG_RX_ERR_RING_MASK_2, |
| 164 | WLAN_CFG_RX_ERR_RING_MASK_3}; |
| 165 | |
| 166 | static const int rx_wbm_rel_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 167 | WLAN_CFG_RX_WBM_REL_RING_MASK_0, |
| 168 | WLAN_CFG_RX_WBM_REL_RING_MASK_1, |
| 169 | WLAN_CFG_RX_WBM_REL_RING_MASK_2, |
| 170 | WLAN_CFG_RX_WBM_REL_RING_MASK_3}; |
| 171 | |
| 172 | static const int reo_status_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 173 | WLAN_CFG_REO_STATUS_RING_MASK_0, |
| 174 | WLAN_CFG_REO_STATUS_RING_MASK_1, |
| 175 | WLAN_CFG_REO_STATUS_RING_MASK_2, |
| 176 | WLAN_CFG_REO_STATUS_RING_MASK_3}; |
| 177 | |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 178 | static const int rxdma2host_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 179 | WLAN_CFG_RXDMA2HOST_RING_MASK_0, |
| 180 | WLAN_CFG_RXDMA2HOST_RING_MASK_1, |
| 181 | WLAN_CFG_RXDMA2HOST_RING_MASK_2, |
| 182 | WLAN_CFG_RXDMA2HOST_RING_MASK_3}; |
| 183 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 184 | /** |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 185 | * struct wlan_cfg_dp_pdev_ctxt - Configuration parameters for pdev (radio) |
| 186 | * @rx_dma_buf_ring_size - Size of RxDMA buffer ring |
| 187 | * @dma_mon_buf_ring_size - Size of RxDMA Monitor buffer ring |
| 188 | * @dma_mon_dest_ring_size - Size of RxDMA Monitor Destination ring |
| 189 | * @dma_mon_status_ring_size - Size of RxDMA Monitor Status ring |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 190 | * @rxdma_monitor_desc_ring - rxdma monitor desc ring size |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 191 | */ |
| 192 | struct wlan_cfg_dp_pdev_ctxt { |
| 193 | int rx_dma_buf_ring_size; |
| 194 | int dma_mon_buf_ring_size; |
| 195 | int dma_mon_dest_ring_size; |
| 196 | int dma_mon_status_ring_size; |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 197 | int rxdma_monitor_desc_ring; |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 198 | int num_mac_rings; |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 199 | int nss_enabled; |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 200 | }; |
| 201 | |
| 202 | /** |
| 203 | * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 204 | * @psoc - Object manager psoc |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 205 | * Return: wlan_cfg_ctx - Handle to Configuration context |
| 206 | */ |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 207 | struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach(void *psoc) |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 208 | { |
| 209 | int i = 0; |
Pamidipati, Vijay | 6b0d2a8 | 2017-06-09 04:46:32 +0530 | [diff] [blame] | 210 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 211 | struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx = |
| 212 | qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt)); |
| 213 | |
| 214 | if (wlan_cfg_ctx == NULL) |
| 215 | return NULL; |
| 216 | |
| 217 | wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS; |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 218 | wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS); |
| 219 | wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE); |
| 220 | wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING); |
| 221 | wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS); |
| 222 | wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING); |
| 223 | wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING); |
| 224 | wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS); |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 225 | wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS; |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 226 | wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc, |
| 227 | CFG_DP_TX_EXT_DESC_POOLS); |
| 228 | wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC); |
| 229 | wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC); |
| 230 | wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE); |
| 231 | wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID); |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 232 | |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 233 | wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE); |
| 234 | wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc, |
| 235 | CFG_DP_TX_COMPL_RING_SIZE); |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 236 | |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 237 | wlan_cfg_ctx->tx_comp_ring_size_nss = |
| 238 | cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE); |
| 239 | wlan_cfg_ctx->int_batch_threshold_tx = |
| 240 | cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX); |
| 241 | wlan_cfg_ctx->int_timer_threshold_tx = |
| 242 | cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX); |
| 243 | wlan_cfg_ctx->int_batch_threshold_rx = |
| 244 | cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX); |
| 245 | wlan_cfg_ctx->int_timer_threshold_rx = |
| 246 | cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX); |
Pamidipati, Vijay | 45b1df2 | 2017-06-21 03:20:25 +0530 | [diff] [blame] | 247 | wlan_cfg_ctx->int_batch_threshold_other = |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 248 | cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER); |
Pamidipati, Vijay | 45b1df2 | 2017-06-21 03:20:25 +0530 | [diff] [blame] | 249 | wlan_cfg_ctx->int_timer_threshold_other = |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 250 | cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER); |
Pamidipati, Vijay | 45b1df2 | 2017-06-21 03:20:25 +0530 | [diff] [blame] | 251 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 252 | for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) { |
| 253 | wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask[i]; |
| 254 | wlan_cfg_ctx->int_rx_ring_mask[i] = rx_ring_mask[i]; |
| 255 | wlan_cfg_ctx->int_rx_mon_ring_mask[i] = rx_mon_ring_mask[i]; |
Nandha Kishore Easwaran | 82ac62e | 2017-06-20 17:55:07 +0530 | [diff] [blame] | 256 | wlan_cfg_ctx->int_rx_err_ring_mask[i] = rx_err_ring_mask[i]; |
| 257 | wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] = |
| 258 | rx_wbm_rel_ring_mask[i]; |
| 259 | wlan_cfg_ctx->int_reo_status_ring_mask[i] = |
| 260 | reo_status_ring_mask[i]; |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 261 | wlan_cfg_ctx->int_rxdma2host_ring_mask[i] = |
| 262 | rxdma2host_ring_mask[i]; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 263 | wlan_cfg_ctx->int_host2rxdma_ring_mask[i] = |
| 264 | host2rxdma_ring_mask[i]; |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 265 | } |
| 266 | |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 267 | /* This is default mapping and can be overridden by HW config |
| 268 | * received from FW */ |
| 269 | wlan_cfg_set_hw_macid(wlan_cfg_ctx, 0, 1); |
| 270 | if (MAX_PDEV_CNT > 1) |
| 271 | wlan_cfg_set_hw_macid(wlan_cfg_ctx, 1, 3); |
| 272 | if (MAX_PDEV_CNT > 2) |
| 273 | wlan_cfg_set_hw_macid(wlan_cfg_ctx, 2, 2); |
| 274 | |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 275 | wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID); |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 276 | |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 277 | wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH); |
| 278 | wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO); |
Akshay Kosigi | a4f6e17 | 2018-09-03 21:42:27 +0530 | [diff] [blame] | 279 | wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO); |
| 280 | wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG); |
| 281 | wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO); |
| 282 | wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM); |
| 283 | wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM); |
| 284 | wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE); |
| 285 | wlan_cfg_ctx->peer_flow_ctrl_enabled = |
| 286 | cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL); |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 287 | wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI); |
| 288 | /*Enable checksum offload by default*/ |
| 289 | wlan_cfg_ctx->tcp_udp_checksumoffload = |
| 290 | cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD); |
| 291 | |
| 292 | wlan_cfg_ctx->defrag_timeout_check = |
| 293 | cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK); |
| 294 | wlan_cfg_ctx->rx_defrag_min_timeout = |
| 295 | cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT); |
| 296 | |
| 297 | wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc, |
| 298 | CFG_DP_WBM_RELEASE_RING); |
| 299 | wlan_cfg_ctx->tcl_cmd_ring = cfg_get(psoc, |
| 300 | CFG_DP_TCL_CMD_RING); |
| 301 | wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc, |
| 302 | CFG_DP_TCL_STATUS_RING); |
| 303 | wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc, |
| 304 | CFG_DP_REO_REINJECT_RING); |
| 305 | wlan_cfg_ctx->rx_release_ring = cfg_get(psoc, |
| 306 | CFG_DP_RX_RELEASE_RING); |
| 307 | wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc, |
| 308 | CFG_DP_REO_EXCEPTION_RING); |
| 309 | wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc, |
| 310 | CFG_DP_REO_CMD_RING); |
| 311 | wlan_cfg_ctx->reo_status_ring = cfg_get(psoc, |
| 312 | CFG_DP_REO_STATUS_RING); |
| 313 | |
| 314 | wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc, |
| 315 | CFG_DP_RXDMA_REFILL_RING); |
| 316 | |
| 317 | wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc, |
| 318 | CFG_DP_RXDMA_ERR_DST_RING); |
psimha | fc2f91b | 2018-01-10 15:30:03 -0800 | [diff] [blame] | 319 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 320 | return wlan_cfg_ctx; |
| 321 | } |
| 322 | |
| 323 | void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx) |
| 324 | { |
| 325 | qdf_mem_free(wlan_cfg_ctx); |
| 326 | } |
| 327 | |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 328 | struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_attach(void *psoc) |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 329 | { |
| 330 | struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx = |
| 331 | qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt)); |
| 332 | |
| 333 | if (wlan_cfg_ctx == NULL) |
| 334 | return NULL; |
| 335 | |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 336 | wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc, |
| 337 | CFG_DP_RXDMA_BUF_RING); |
| 338 | wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc, |
| 339 | CFG_DP_RXDMA_MONITOR_BUF_RING); |
| 340 | wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc, |
| 341 | CFG_DP_RXDMA_MONITOR_DST_RING); |
| 342 | wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc, |
| 343 | CFG_DP_RXDMA_MONITOR_STATUS_RING); |
| 344 | wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc, |
| 345 | CFG_DP_RXDMA_MONITOR_DESC_RING); |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 346 | wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV; |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 347 | |
| 348 | return wlan_cfg_ctx; |
| 349 | } |
| 350 | |
| 351 | void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx) |
| 352 | { |
| 353 | qdf_mem_free(wlan_cfg_ctx); |
| 354 | } |
| 355 | |
| 356 | void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num) |
| 357 | { |
| 358 | cfg->num_int_ctxts = num; |
| 359 | } |
| 360 | |
Pamidipati, Vijay | 6b0d2a8 | 2017-06-09 04:46:32 +0530 | [diff] [blame] | 361 | void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val) |
| 362 | { |
| 363 | cfg->max_peer_id = val;; |
| 364 | } |
| 365 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 366 | void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 367 | int context, int mask) |
| 368 | { |
| 369 | cfg->int_tx_ring_mask[context] = mask; |
| 370 | } |
| 371 | |
| 372 | void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 373 | int context, int mask) |
| 374 | { |
| 375 | cfg->int_rx_ring_mask[context] = mask; |
| 376 | } |
| 377 | |
| 378 | void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 379 | int context, int mask) |
| 380 | { |
| 381 | cfg->int_rx_mon_ring_mask[context] = mask; |
| 382 | } |
| 383 | |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 384 | void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 385 | int context, int mask) |
| 386 | { |
| 387 | cfg->int_rxdma2host_ring_mask[context] = mask; |
| 388 | } |
| 389 | |
| 390 | int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 391 | int context) |
| 392 | { |
| 393 | return cfg->int_rxdma2host_ring_mask[context]; |
| 394 | } |
| 395 | |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 396 | void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 397 | int context, int mask) |
| 398 | { |
| 399 | cfg->int_host2rxdma_ring_mask[context] = mask; |
| 400 | } |
| 401 | |
| 402 | int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 403 | int context) |
| 404 | { |
| 405 | return cfg->int_host2rxdma_ring_mask[context]; |
| 406 | } |
| 407 | |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 408 | void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx, |
| 409 | int hw_macid) |
| 410 | { |
| 411 | qdf_assert_always(pdev_idx < MAX_PDEV_CNT); |
| 412 | cfg->hw_macid[pdev_idx] = hw_macid; |
| 413 | } |
| 414 | |
| 415 | int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx) |
| 416 | { |
| 417 | qdf_assert_always(pdev_idx < MAX_PDEV_CNT); |
| 418 | return cfg->hw_macid[pdev_idx]; |
| 419 | } |
| 420 | |
| 421 | int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx) |
| 422 | { |
| 423 | qdf_assert_always(pdev_idx < MAX_PDEV_CNT); |
| 424 | return cfg->hw_macid[pdev_idx] - cfg->base_hw_macid; |
| 425 | } |
| 426 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 427 | void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 428 | int context, int mask) |
| 429 | { |
| 430 | cfg->int_ce_ring_mask[context] = mask; |
| 431 | } |
| 432 | |
| 433 | void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context, |
| 434 | int mask) |
| 435 | { |
| 436 | cfg->int_rx_ring_mask[context] = mask; |
| 437 | } |
| 438 | |
Nandha Kishore Easwaran | 82ac62e | 2017-06-20 17:55:07 +0530 | [diff] [blame] | 439 | int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 440 | int context, int mask) |
| 441 | { |
| 442 | return cfg->int_rx_err_ring_mask[context] = mask; |
| 443 | } |
| 444 | |
| 445 | int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 446 | int context, int mask) |
| 447 | { |
| 448 | return cfg->int_rx_wbm_rel_ring_mask[context] = mask; |
| 449 | } |
| 450 | |
| 451 | int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 452 | int context, int mask) |
| 453 | { |
| 454 | return cfg->int_reo_status_ring_mask[context] = mask; |
| 455 | } |
| 456 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 457 | int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 458 | { |
| 459 | return cfg->num_int_ctxts; |
| 460 | } |
| 461 | |
| 462 | int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) |
| 463 | { |
| 464 | return cfg->int_tx_ring_mask[context]; |
| 465 | } |
| 466 | |
| 467 | int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) |
| 468 | { |
| 469 | return cfg->int_rx_ring_mask[context]; |
| 470 | } |
| 471 | |
Nandha Kishore Easwaran | 82ac62e | 2017-06-20 17:55:07 +0530 | [diff] [blame] | 472 | int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 473 | int context) |
| 474 | { |
| 475 | return cfg->int_rx_err_ring_mask[context]; |
| 476 | } |
| 477 | |
| 478 | int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 479 | int context) |
| 480 | { |
| 481 | return cfg->int_rx_wbm_rel_ring_mask[context]; |
| 482 | } |
| 483 | |
| 484 | int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 485 | int context) |
| 486 | { |
| 487 | return cfg->int_reo_status_ring_mask[context]; |
| 488 | } |
| 489 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 490 | int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) |
| 491 | { |
| 492 | return cfg->int_rx_mon_ring_mask[context]; |
| 493 | } |
| 494 | |
| 495 | int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) |
| 496 | { |
| 497 | return cfg->int_ce_ring_mask[context]; |
| 498 | } |
| 499 | |
| 500 | uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 501 | { |
| 502 | return cfg->max_clients; |
| 503 | } |
| 504 | |
| 505 | uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 506 | { |
| 507 | return cfg->max_alloc_size; |
| 508 | } |
| 509 | |
| 510 | int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 511 | { |
| 512 | return cfg->per_pdev_tx_ring; |
| 513 | } |
| 514 | |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 515 | int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 516 | { |
| 517 | return cfg->per_pdev_lmac_ring; |
| 518 | } |
| 519 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 520 | int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 521 | { |
| 522 | return cfg->num_tcl_data_rings; |
| 523 | } |
| 524 | |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 525 | int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 526 | { |
| 527 | return cfg->tx_ring_size; |
| 528 | } |
| 529 | |
| 530 | int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 531 | { |
| 532 | return cfg->tx_comp_ring_size; |
| 533 | } |
| 534 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 535 | int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 536 | { |
| 537 | return cfg->per_pdev_rx_ring; |
| 538 | } |
| 539 | |
| 540 | int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 541 | { |
| 542 | return cfg->num_reo_dest_rings; |
| 543 | } |
| 544 | |
| 545 | int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 546 | { |
| 547 | return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/ |
| 548 | } |
| 549 | |
| 550 | int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 551 | { |
| 552 | return cfg->num_tx_desc_pool; |
| 553 | } |
| 554 | |
Aniruddha Paul | 9d7dc27 | 2018-02-11 19:40:41 +0530 | [diff] [blame] | 555 | void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool) |
| 556 | { |
| 557 | cfg->num_tx_desc_pool = num_pool; |
| 558 | } |
| 559 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 560 | int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 561 | { |
| 562 | return cfg->num_tx_ext_desc_pool; |
| 563 | } |
| 564 | |
Aniruddha Paul | 9d7dc27 | 2018-02-11 19:40:41 +0530 | [diff] [blame] | 565 | void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool) |
| 566 | { |
| 567 | cfg->num_tx_ext_desc_pool = num_pool; |
| 568 | } |
| 569 | |
Balamurugan Mahalingam | 54d16a9 | 2018-06-25 17:08:08 +0530 | [diff] [blame] | 570 | int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 571 | { |
| 572 | return cfg->reo_dst_ring_size; |
| 573 | } |
| 574 | |
| 575 | void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 576 | int reo_dst_ring_size) |
| 577 | { |
| 578 | cfg->reo_dst_ring_size = reo_dst_ring_size; |
| 579 | } |
| 580 | |
Venkateswara Swamy Bandaru | 6ca4112 | 2018-08-03 16:07:06 +0530 | [diff] [blame] | 581 | void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 582 | bool raw_mode_war) |
| 583 | { |
| 584 | cfg->raw_mode_war = raw_mode_war; |
| 585 | } |
| 586 | |
| 587 | bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 588 | { |
| 589 | return cfg->raw_mode_war; |
| 590 | } |
| 591 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 592 | int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 593 | { |
| 594 | return cfg->num_tx_desc; |
| 595 | } |
| 596 | |
Aniruddha Paul | 9d7dc27 | 2018-02-11 19:40:41 +0530 | [diff] [blame] | 597 | void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc) |
| 598 | { |
| 599 | cfg->num_tx_desc = num_desc; |
| 600 | } |
| 601 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 602 | int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 603 | { |
| 604 | return cfg->num_tx_ext_desc; |
| 605 | } |
| 606 | |
Aniruddha Paul | 9d7dc27 | 2018-02-11 19:40:41 +0530 | [diff] [blame] | 607 | void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc) |
| 608 | { |
| 609 | cfg->num_tx_ext_desc = num_ext_desc; |
| 610 | } |
| 611 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 612 | uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 613 | { |
| 614 | /* TODO: This should be calculated based on target capabilities */ |
| 615 | return cfg->max_peer_id; |
| 616 | } |
| 617 | |
| 618 | int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) |
| 619 | { |
| 620 | return cfg->dma_mon_buf_ring_size; |
| 621 | } |
| 622 | |
| 623 | int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) |
| 624 | { |
| 625 | return cfg->dma_mon_dest_ring_size; |
| 626 | } |
| 627 | |
| 628 | int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) |
| 629 | { |
| 630 | return cfg->dma_mon_status_ring_size; |
| 631 | } |
| 632 | |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 633 | int |
| 634 | wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) |
| 635 | { |
| 636 | return cfg->rxdma_monitor_desc_ring; |
| 637 | } |
| 638 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 639 | int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) |
| 640 | { |
| 641 | return cfg->rx_dma_buf_ring_size; |
| 642 | } |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 643 | |
| 644 | int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg) |
| 645 | { |
| 646 | return cfg->num_mac_rings; |
| 647 | } |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 648 | |
| 649 | bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 650 | { |
| 651 | return cfg->lro_enabled; |
| 652 | } |
| 653 | |
Tallapragada Kalyan | 4c183b8 | 2017-09-13 23:48:14 +0530 | [diff] [blame] | 654 | void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val) |
| 655 | { |
| 656 | cfg->rx_hash = val; |
| 657 | } |
| 658 | |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 659 | bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 660 | { |
| 661 | return cfg->rx_hash; |
| 662 | } |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 663 | |
| 664 | int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg) |
| 665 | { |
| 666 | return cfg->nss_enabled; |
| 667 | } |
| 668 | |
| 669 | void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled) |
| 670 | { |
| 671 | cfg->nss_enabled = nss_enabled; |
| 672 | } |
| 673 | |
| 674 | int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 675 | { |
| 676 | return cfg->nss_cfg; |
| 677 | } |
| 678 | |
| 679 | void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg) |
| 680 | { |
| 681 | cfg->nss_cfg = nss_cfg; |
Bharat Kumar M | dd67f45 | 2017-07-17 22:37:56 +0530 | [diff] [blame] | 682 | if (cfg->nss_cfg) |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 683 | cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss; |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 684 | } |
Pamidipati, Vijay | 45b1df2 | 2017-06-21 03:20:25 +0530 | [diff] [blame] | 685 | |
| 686 | int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 687 | { |
| 688 | return cfg->int_batch_threshold_tx; |
| 689 | } |
| 690 | |
| 691 | int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 692 | { |
| 693 | return cfg->int_timer_threshold_tx; |
| 694 | } |
| 695 | |
| 696 | int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 697 | { |
| 698 | return cfg->int_batch_threshold_rx; |
| 699 | } |
| 700 | |
| 701 | int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 702 | { |
| 703 | return cfg->int_timer_threshold_rx; |
| 704 | } |
| 705 | |
| 706 | int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 707 | { |
| 708 | return cfg->int_batch_threshold_other; |
| 709 | } |
| 710 | |
| 711 | int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 712 | { |
| 713 | return cfg->int_timer_threshold_other; |
| 714 | } |
chenguo | 8d0c219 | 2017-12-01 19:35:53 +0800 | [diff] [blame] | 715 | |
| 716 | int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 717 | { |
| 718 | return cfg->tcp_udp_checksumoffload; |
| 719 | } |
psimha | fc2f91b | 2018-01-10 15:30:03 -0800 | [diff] [blame] | 720 | |
| 721 | int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 722 | { |
| 723 | return cfg->rx_defrag_min_timeout; |
| 724 | } |
| 725 | |
| 726 | int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 727 | { |
| 728 | return cfg->defrag_timeout_check; |
| 729 | } |
| 730 | |
Vivek | 126db5d | 2018-07-25 22:05:04 +0530 | [diff] [blame] | 731 | int |
| 732 | wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 733 | { |
| 734 | return cfg->wbm_release_ring; |
| 735 | } |
| 736 | |
| 737 | int |
| 738 | wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 739 | { |
| 740 | return cfg->tcl_cmd_ring; |
| 741 | } |
| 742 | |
| 743 | int |
| 744 | wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 745 | { |
| 746 | return cfg->tcl_status_ring; |
| 747 | } |
| 748 | |
| 749 | int |
| 750 | wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 751 | { |
| 752 | return cfg->reo_reinject_ring; |
| 753 | } |
| 754 | |
| 755 | int |
| 756 | wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 757 | { |
| 758 | return cfg->rx_release_ring; |
| 759 | } |
| 760 | |
| 761 | int |
| 762 | wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 763 | { |
| 764 | return cfg->reo_exception_ring; |
| 765 | } |
| 766 | |
| 767 | int |
| 768 | wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 769 | { |
| 770 | return cfg->reo_cmd_ring; |
| 771 | } |
| 772 | |
| 773 | int |
| 774 | wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 775 | { |
| 776 | return cfg->reo_status_ring; |
| 777 | } |
| 778 | |
| 779 | int |
| 780 | wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 781 | { |
| 782 | return cfg->rxdma_refill_ring; |
| 783 | } |
| 784 | |
| 785 | int |
| 786 | wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 787 | { |
| 788 | return cfg->rxdma_err_dst_ring; |
| 789 | } |
| 790 | |
Akshay Kosigi | a4f6e17 | 2018-09-03 21:42:27 +0530 | [diff] [blame] | 791 | bool |
| 792 | wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg, |
| 793 | enum cdp_capabilities dp_caps) |
| 794 | { |
| 795 | switch (dp_caps) { |
| 796 | case CDP_CFG_DP_TSO: |
| 797 | return cfg->tso_enabled; |
| 798 | case CDP_CFG_DP_LRO: |
| 799 | return cfg->lro_enabled; |
| 800 | case CDP_CFG_DP_SG: |
| 801 | return cfg->sg_enabled; |
| 802 | case CDP_CFG_DP_GRO: |
| 803 | return cfg->gro_enabled; |
| 804 | case CDP_CFG_DP_OL_TX_CSUM: |
| 805 | return cfg->ol_tx_csum_enabled; |
| 806 | case CDP_CFG_DP_OL_RX_CSUM: |
| 807 | return cfg->ol_rx_csum_enabled; |
| 808 | case CDP_CFG_DP_RAWMODE: |
| 809 | return cfg->rawmode_enabled; |
| 810 | case CDP_CFG_DP_PEER_FLOW_CTRL: |
| 811 | return cfg->peer_flow_ctrl_enabled; |
| 812 | default: |
| 813 | return false; |
| 814 | } |
| 815 | } |
| 816 | |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 817 | #ifdef QCA_LL_TX_FLOW_CONTROL_V2 |
| 818 | /** |
| 819 | * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold |
| 820 | * @cfg: config context |
| 821 | * |
| 822 | * Return: stop threshold |
| 823 | */ |
| 824 | int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 825 | { |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 826 | return cfg->tx_flow_stop_queue_threshold; |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 827 | } |
| 828 | |
| 829 | /** |
| 830 | * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset |
| 831 | * for TX to resume |
| 832 | * @cfg: config context |
| 833 | * |
| 834 | * Return: stop threshold |
| 835 | */ |
| 836 | int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg) |
| 837 | { |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 838 | return cfg->tx_flow_start_queue_offset; |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 839 | } |
| 840 | #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */ |