Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Vevek Venkatesan | 656edfa | 2020-01-28 13:08:51 +0530 | [diff] [blame^] | 2 | * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | /** |
| 20 | * DOC: HDD WMM |
| 21 | * |
| 22 | * This module (wlan_hdd_wmm.h interface + wlan_hdd_wmm.c implementation) |
| 23 | * houses all the logic for WMM in HDD. |
| 24 | * |
| 25 | * On the control path, it has the logic to setup QoS, modify QoS and delete |
| 26 | * QoS (QoS here refers to a TSPEC). The setup QoS comes in two flavors: an |
| 27 | * explicit application invoked and an internal HDD invoked. The implicit QoS |
| 28 | * is for applications that do NOT call the custom QCT WLAN OIDs for QoS but |
| 29 | * which DO mark their traffic for priortization. It also has logic to start, |
| 30 | * update and stop the U-APSD trigger frame generation. It also has logic to |
| 31 | * read WMM related config parameters from the registry. |
| 32 | * |
| 33 | * On the data path, it has the logic to figure out the WMM AC of an egress |
| 34 | * packet and when to signal TL to serve a particular AC queue. It also has the |
| 35 | * logic to retrieve a packet based on WMM priority in response to a fetch from |
| 36 | * TL. |
| 37 | * |
| 38 | * The remaining functions are utility functions for information hiding. |
| 39 | */ |
| 40 | |
| 41 | /* Include files */ |
| 42 | #include <linux/netdevice.h> |
| 43 | #include <linux/skbuff.h> |
| 44 | #include <linux/etherdevice.h> |
| 45 | #include <linux/if_vlan.h> |
| 46 | #include <linux/ip.h> |
| 47 | #include <linux/semaphore.h> |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 48 | #include <linux/ipv6.h> |
Dustin Brown | 6725e27 | 2019-03-06 12:29:47 -0800 | [diff] [blame] | 49 | #include "osif_sync.h" |
Vevek Venkatesan | 656edfa | 2020-01-28 13:08:51 +0530 | [diff] [blame^] | 50 | #include "os_if_fwol.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 51 | #include <wlan_hdd_tx_rx.h> |
| 52 | #include <wlan_hdd_wmm.h> |
| 53 | #include <wlan_hdd_ether.h> |
| 54 | #include <wlan_hdd_hostapd.h> |
| 55 | #include <wlan_hdd_softap_tx_rx.h> |
| 56 | #include <cds_sched.h> |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 57 | #include "sme_api.h" |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 58 | #include "wlan_mlme_ucfg_api.h" |
Vevek Venkatesan | 656edfa | 2020-01-28 13:08:51 +0530 | [diff] [blame^] | 59 | #include "cfg_ucfg_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 60 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 61 | #define HDD_WMM_UP_TO_AC_MAP_SIZE 8 |
Vevek Venkatesan | 656edfa | 2020-01-28 13:08:51 +0530 | [diff] [blame^] | 62 | #define DSCP(x) x |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 63 | |
| 64 | const uint8_t hdd_wmm_up_to_ac_map[] = { |
| 65 | SME_AC_BE, |
| 66 | SME_AC_BK, |
| 67 | SME_AC_BK, |
| 68 | SME_AC_BE, |
| 69 | SME_AC_VI, |
| 70 | SME_AC_VI, |
| 71 | SME_AC_VO, |
| 72 | SME_AC_VO |
| 73 | }; |
| 74 | |
| 75 | /** |
| 76 | * enum hdd_wmm_linuxac: AC/Queue Index values for Linux Qdisc to |
| 77 | * operate on different traffic. |
| 78 | */ |
| 79 | #ifdef QCA_LL_TX_FLOW_CONTROL_V2 |
Jeff Johnson | 5b8b67d | 2017-08-29 14:16:53 -0700 | [diff] [blame] | 80 | void wlan_hdd_process_peer_unauthorised_pause(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 81 | { |
| 82 | /* Enable HI_PRIO queue */ |
| 83 | netif_stop_subqueue(adapter->dev, HDD_LINUX_AC_VO); |
| 84 | netif_stop_subqueue(adapter->dev, HDD_LINUX_AC_VI); |
| 85 | netif_stop_subqueue(adapter->dev, HDD_LINUX_AC_BE); |
| 86 | netif_stop_subqueue(adapter->dev, HDD_LINUX_AC_BK); |
| 87 | netif_wake_subqueue(adapter->dev, HDD_LINUX_AC_HI_PRIO); |
| 88 | |
| 89 | } |
| 90 | #else |
Jeff Johnson | 5b8b67d | 2017-08-29 14:16:53 -0700 | [diff] [blame] | 91 | void wlan_hdd_process_peer_unauthorised_pause(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 92 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 93 | } |
| 94 | #endif |
| 95 | |
| 96 | /* Linux based UP -> AC Mapping */ |
| 97 | const uint8_t hdd_linux_up_to_ac_map[HDD_WMM_UP_TO_AC_MAP_SIZE] = { |
| 98 | HDD_LINUX_AC_BE, |
| 99 | HDD_LINUX_AC_BK, |
| 100 | HDD_LINUX_AC_BK, |
| 101 | HDD_LINUX_AC_BE, |
| 102 | HDD_LINUX_AC_VI, |
| 103 | HDD_LINUX_AC_VI, |
| 104 | HDD_LINUX_AC_VO, |
| 105 | HDD_LINUX_AC_VO |
| 106 | }; |
| 107 | |
| 108 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 109 | /** |
| 110 | * hdd_wmm_enable_tl_uapsd() - function which decides whether and |
| 111 | * how to update UAPSD parameters in TL |
| 112 | * |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 113 | * @qos_context: [in] the pointer the QoS instance control block |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 114 | * |
| 115 | * Return: None |
| 116 | */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 117 | static void hdd_wmm_enable_tl_uapsd(struct hdd_wmm_qos_context *qos_context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 118 | { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 119 | struct hdd_adapter *adapter = qos_context->adapter; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 120 | sme_ac_enum_type ac_type = qos_context->ac_type; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 121 | struct hdd_wmm_ac_status *ac = &adapter->hdd_wmm_status.ac_status[ac_type]; |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 122 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 123 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 124 | uint32_t service_interval; |
| 125 | uint32_t suspension_interval; |
Abhishek Singh | 12be60f | 2017-08-11 13:52:42 +0530 | [diff] [blame] | 126 | enum sme_qos_wmm_dir_type direction; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 127 | bool psb; |
Abhinav Kumar | c8c2150 | 2018-12-05 15:17:39 +0530 | [diff] [blame] | 128 | uint32_t delayed_trgr_frm_int; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 129 | |
| 130 | /* The TSPEC must be valid */ |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 131 | if (ac->is_tspec_valid == false) { |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 132 | hdd_err("Invoked with invalid TSPEC"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 133 | return; |
| 134 | } |
| 135 | /* determine the service interval */ |
Jeff Johnson | 64d94dd | 2019-03-09 14:31:14 -0800 | [diff] [blame] | 136 | if (ac->tspec.min_service_interval) { |
| 137 | service_interval = ac->tspec.min_service_interval; |
| 138 | } else if (ac->tspec.max_service_interval) { |
| 139 | service_interval = ac->tspec.max_service_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 140 | } else { |
| 141 | /* no service interval is present in the TSPEC */ |
| 142 | /* this is OK, there just won't be U-APSD */ |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 143 | hdd_debug("No service interval supplied"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 144 | service_interval = 0; |
| 145 | } |
| 146 | |
| 147 | /* determine the suspension interval & direction */ |
Jeff Johnson | 64d94dd | 2019-03-09 14:31:14 -0800 | [diff] [blame] | 148 | suspension_interval = ac->tspec.suspension_interval; |
| 149 | direction = ac->tspec.ts_info.direction; |
| 150 | psb = ac->tspec.ts_info.psb; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 151 | |
| 152 | /* if we have previously enabled U-APSD, have any params changed? */ |
Jeff Johnson | fd29709 | 2019-03-09 14:29:20 -0800 | [diff] [blame] | 153 | if ((ac->is_uapsd_info_valid) && |
Jeff Johnson | e8f3a77 | 2019-03-09 14:36:12 -0800 | [diff] [blame] | 154 | (ac->uapsd_service_interval == service_interval) && |
Jeff Johnson | 48fffec | 2019-03-09 14:37:27 -0800 | [diff] [blame] | 155 | (ac->uapsd_suspension_interval == suspension_interval) && |
Jeff Johnson | 68a8a9a | 2019-03-09 14:39:51 -0800 | [diff] [blame] | 156 | (ac->uapsd_direction == direction) && |
Jeff Johnson | a86be85 | 2019-03-09 14:34:25 -0800 | [diff] [blame] | 157 | (ac->is_uapsd_enabled == psb)) { |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 158 | hdd_debug("No change in U-APSD parameters"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 159 | return; |
| 160 | } |
Abhinav Kumar | c8c2150 | 2018-12-05 15:17:39 +0530 | [diff] [blame] | 161 | |
| 162 | ucfg_mlme_get_tl_delayed_trgr_frm_int(hdd_ctx->psoc, |
| 163 | &delayed_trgr_frm_int); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 164 | /* everything is in place to notify TL */ |
| 165 | status = |
Sourav Mohapatra | a3cf12a | 2019-08-19 15:40:49 +0530 | [diff] [blame] | 166 | sme_enable_uapsd_for_ac(ac_type, ac->tspec.ts_info.tid, |
| 167 | ac->tspec.ts_info.up, |
| 168 | service_interval, suspension_interval, |
| 169 | direction, psb, adapter->vdev_id, |
| 170 | delayed_trgr_frm_int); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 171 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 172 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 173 | hdd_err("Failed to enable U-APSD for AC=%d", ac_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 174 | return; |
| 175 | } |
| 176 | /* stash away the parameters that were used */ |
Jeff Johnson | fd29709 | 2019-03-09 14:29:20 -0800 | [diff] [blame] | 177 | ac->is_uapsd_info_valid = true; |
Jeff Johnson | e8f3a77 | 2019-03-09 14:36:12 -0800 | [diff] [blame] | 178 | ac->uapsd_service_interval = service_interval; |
Jeff Johnson | 48fffec | 2019-03-09 14:37:27 -0800 | [diff] [blame] | 179 | ac->uapsd_suspension_interval = suspension_interval; |
Jeff Johnson | 68a8a9a | 2019-03-09 14:39:51 -0800 | [diff] [blame] | 180 | ac->uapsd_direction = direction; |
Jeff Johnson | a86be85 | 2019-03-09 14:34:25 -0800 | [diff] [blame] | 181 | ac->is_uapsd_enabled = psb; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 182 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 183 | hdd_debug("Enabled UAPSD in TL srv_int=%d susp_int=%d dir=%d AC=%d", |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 184 | service_interval, suspension_interval, direction, ac_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 185 | |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * hdd_wmm_disable_tl_uapsd() - function which decides whether |
| 190 | * to disable UAPSD parameters in TL |
| 191 | * |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 192 | * @qos_context: [in] the pointer the QoS instance control block |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 193 | * |
| 194 | * Return: None |
| 195 | */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 196 | static void hdd_wmm_disable_tl_uapsd(struct hdd_wmm_qos_context *qos_context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 197 | { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 198 | struct hdd_adapter *adapter = qos_context->adapter; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 199 | sme_ac_enum_type ac_type = qos_context->ac_type; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 200 | struct hdd_wmm_ac_status *ac = &adapter->hdd_wmm_status.ac_status[ac_type]; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 201 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 202 | |
| 203 | /* have we previously enabled UAPSD? */ |
Jeff Johnson | fd29709 | 2019-03-09 14:29:20 -0800 | [diff] [blame] | 204 | if (ac->is_uapsd_info_valid == true) { |
Sourav Mohapatra | a3cf12a | 2019-08-19 15:40:49 +0530 | [diff] [blame] | 205 | status = sme_disable_uapsd_for_ac(ac_type, adapter->vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 206 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 207 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 208 | hdd_err("Failed to disable U-APSD for AC=%d", ac_type); |
Sreelakshmi Konamki | e1ce562 | 2015-11-23 15:04:05 +0530 | [diff] [blame] | 209 | } else { |
| 210 | /* TL no longer has valid UAPSD info */ |
Jeff Johnson | fd29709 | 2019-03-09 14:29:20 -0800 | [diff] [blame] | 211 | ac->is_uapsd_info_valid = false; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 212 | hdd_debug("Disabled UAPSD in TL for AC=%d", ac_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 213 | } |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | #endif |
| 218 | |
| 219 | /** |
| 220 | * hdd_wmm_free_context() - function which frees a QoS context |
| 221 | * |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 222 | * @qos_context: [in] the pointer the QoS instance control block |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 223 | * |
| 224 | * Return: None |
| 225 | */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 226 | static void hdd_wmm_free_context(struct hdd_wmm_qos_context *qos_context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 227 | { |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 228 | struct hdd_adapter *adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 229 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 230 | hdd_debug("Entered, context %pK", qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 231 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 232 | if (unlikely((!qos_context) || |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 233 | (HDD_WMM_CTX_MAGIC != qos_context->magic))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 234 | /* must have been freed in another thread */ |
| 235 | return; |
| 236 | } |
| 237 | /* get pointer to the adapter context */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 238 | adapter = qos_context->adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 239 | |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 240 | /* take the mutex since we're manipulating the context list */ |
| 241 | mutex_lock(&adapter->hdd_wmm_status.mutex); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 242 | |
| 243 | /* make sure nobody thinks this is a valid context */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 244 | qos_context->magic = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 245 | |
| 246 | /* unlink the context */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 247 | list_del(&qos_context->node); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 248 | |
| 249 | /* done manipulating the list */ |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 250 | mutex_unlock(&adapter->hdd_wmm_status.mutex); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 251 | |
| 252 | /* reclaim memory */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 253 | qdf_mem_free(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 254 | |
| 255 | } |
| 256 | |
| 257 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 258 | /** |
| 259 | * hdd_wmm_notify_app() - function which notifies an application |
| 260 | * of changes in state of it flow |
| 261 | * |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 262 | * @qos_context: [in] the pointer the QoS instance control block |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 263 | * |
| 264 | * Return: None |
| 265 | */ |
| 266 | #define MAX_NOTIFY_LEN 50 |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 267 | static void hdd_wmm_notify_app(struct hdd_wmm_qos_context *qos_context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 268 | { |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 269 | struct hdd_adapter *adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 270 | union iwreq_data wrqu; |
| 271 | char buf[MAX_NOTIFY_LEN + 1]; |
| 272 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 273 | hdd_debug("Entered, context %pK", qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 274 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 275 | if (unlikely((!qos_context) || |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 276 | (HDD_WMM_CTX_MAGIC != qos_context->magic))) { |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 277 | hdd_err("Invalid QoS Context"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 278 | return; |
| 279 | } |
| 280 | |
| 281 | /* create the event */ |
| 282 | memset(&wrqu, 0, sizeof(wrqu)); |
| 283 | memset(buf, 0, sizeof(buf)); |
| 284 | |
| 285 | snprintf(buf, MAX_NOTIFY_LEN, "QCOM: TS change[%u: %u]", |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 286 | (unsigned int)qos_context->handle, |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 287 | (unsigned int)qos_context->status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 288 | |
| 289 | wrqu.data.pointer = buf; |
| 290 | wrqu.data.length = strlen(buf); |
| 291 | |
| 292 | /* get pointer to the adapter */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 293 | adapter = qos_context->adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 294 | |
| 295 | /* send the event */ |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 296 | hdd_debug("Sending [%s]", buf); |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 297 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 298 | } |
| 299 | |
| 300 | #ifdef FEATURE_WLAN_ESE |
| 301 | /** |
| 302 | * hdd_wmm_inactivity_timer_cb() - inactivity timer callback function |
| 303 | * |
| 304 | * @user_data: opaque user data registered with the timer. In the |
| 305 | * case of this timer, the associated wmm QoS context is registered. |
| 306 | * |
| 307 | * This timer handler function is called for every inactivity interval |
| 308 | * per AC. This function gets the current transmitted packets on the |
| 309 | * given AC, and checks if there was any TX activity from the previous |
| 310 | * interval. If there was no traffic then it would delete the TS that |
| 311 | * was negotiated on that AC. |
| 312 | * |
| 313 | * Return: None |
| 314 | */ |
| 315 | static void hdd_wmm_inactivity_timer_cb(void *user_data) |
| 316 | { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 317 | struct hdd_wmm_qos_context *qos_context = user_data; |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 318 | struct hdd_adapter *adapter; |
Jeff Johnson | 4d20900 | 2019-03-08 20:27:25 -0800 | [diff] [blame] | 319 | struct hdd_wmm_ac_status *ac; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 320 | hdd_wlan_wmm_status_e status; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 321 | QDF_STATUS qdf_status; |
Jeff Johnson | 15bf1b1 | 2019-03-09 14:59:58 -0800 | [diff] [blame] | 322 | uint32_t traffic_count = 0; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 323 | sme_ac_enum_type ac_type; |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 324 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 325 | if (!qos_context) { |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 326 | hdd_err("invalid user data"); |
| 327 | return; |
| 328 | } |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 329 | ac_type = qos_context->ac_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 330 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 331 | adapter = qos_context->adapter; |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 332 | if ((!adapter) || |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 333 | (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { |
| 334 | hdd_err("invalid adapter: %pK", adapter); |
c_hpothu | d500924 | 2016-08-18 12:10:36 +0530 | [diff] [blame] | 335 | return; |
| 336 | } |
| 337 | |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 338 | ac = &adapter->hdd_wmm_status.ac_status[ac_type]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 339 | |
| 340 | /* Get the Tx stats for this AC. */ |
Jeff Johnson | 15bf1b1 | 2019-03-09 14:59:58 -0800 | [diff] [blame] | 341 | traffic_count = |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 342 | adapter->hdd_stats.tx_rx_stats.tx_classified_ac[qos_context-> |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 343 | ac_type]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 344 | |
Jeff Johnson | de474b4 | 2019-03-09 14:58:07 -0800 | [diff] [blame] | 345 | hdd_warn("WMM inactivity check for AC=%d, count=%u, last=%u", |
Jeff Johnson | 15bf1b1 | 2019-03-09 14:59:58 -0800 | [diff] [blame] | 346 | ac_type, traffic_count, ac->last_traffic_count); |
| 347 | if (ac->last_traffic_count == traffic_count) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 348 | /* there is no traffic activity, delete the TSPEC for this AC */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 349 | status = hdd_wmm_delts(adapter, qos_context->handle); |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 350 | hdd_warn("Deleted TS on AC %d, due to inactivity with status = %d!!!", |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 351 | ac_type, status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 352 | } else { |
Jeff Johnson | 15bf1b1 | 2019-03-09 14:59:58 -0800 | [diff] [blame] | 353 | ac->last_traffic_count = traffic_count; |
Jeff Johnson | a2b8b47 | 2019-03-09 14:41:59 -0800 | [diff] [blame] | 354 | if (ac->inactivity_timer.state == QDF_TIMER_STATE_STOPPED) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 355 | /* Restart the timer */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 356 | qdf_status = |
Jeff Johnson | a2b8b47 | 2019-03-09 14:41:59 -0800 | [diff] [blame] | 357 | qdf_mc_timer_start(&ac->inactivity_timer, |
Jeff Johnson | 154193b | 2019-03-09 14:42:58 -0800 | [diff] [blame] | 358 | ac->inactivity_time); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 359 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 360 | hdd_err("Restarting inactivity timer failed on AC %d", |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 361 | ac_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 362 | } |
| 363 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 364 | QDF_ASSERT(qdf_mc_timer_get_current_state |
Jeff Johnson | a2b8b47 | 2019-03-09 14:41:59 -0800 | [diff] [blame] | 365 | (&ac->inactivity_timer) == |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 366 | QDF_TIMER_STATE_STOPPED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 367 | } |
| 368 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | /** |
| 372 | * hdd_wmm_enable_inactivity_timer() - |
| 373 | * function to enable the traffic inactivity timer for the given AC |
| 374 | * |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 375 | * @qos_context: [in] pointer to qos_context |
Jeff Johnson | 0a12bbc | 2019-03-09 15:14:30 -0800 | [diff] [blame] | 376 | * @inactivity_time: [in] value of the inactivity interval in millisecs |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 377 | * |
| 378 | * When a QoS-Tspec is successfully setup, if the inactivity interval |
| 379 | * time specified in the AddTS parameters is non-zero, this function |
| 380 | * is invoked to start a traffic inactivity timer for the given AC. |
| 381 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 382 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 383 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 384 | static QDF_STATUS |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 385 | hdd_wmm_enable_inactivity_timer(struct hdd_wmm_qos_context *qos_context, |
Jeff Johnson | 0a12bbc | 2019-03-09 15:14:30 -0800 | [diff] [blame] | 386 | uint32_t inactivity_time) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 387 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 388 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 389 | struct hdd_adapter *adapter = qos_context->adapter; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 390 | sme_ac_enum_type ac_type = qos_context->ac_type; |
Jeff Johnson | 4d20900 | 2019-03-08 20:27:25 -0800 | [diff] [blame] | 391 | struct hdd_wmm_ac_status *ac; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 392 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 393 | adapter = qos_context->adapter; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 394 | ac = &adapter->hdd_wmm_status.ac_status[ac_type]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 395 | |
Jeff Johnson | a2b8b47 | 2019-03-09 14:41:59 -0800 | [diff] [blame] | 396 | qdf_status = qdf_mc_timer_init(&ac->inactivity_timer, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 397 | QDF_TIMER_TYPE_SW, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 398 | hdd_wmm_inactivity_timer_cb, |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 399 | qos_context); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 400 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 401 | hdd_err("Initializing inactivity timer failed on AC %d", |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 402 | ac_type); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 403 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 404 | } |
| 405 | /* Start the inactivity timer */ |
Jeff Johnson | a2b8b47 | 2019-03-09 14:41:59 -0800 | [diff] [blame] | 406 | qdf_status = qdf_mc_timer_start(&ac->inactivity_timer, |
Jeff Johnson | 0a12bbc | 2019-03-09 15:14:30 -0800 | [diff] [blame] | 407 | inactivity_time); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 408 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 409 | hdd_err("Starting inactivity timer failed on AC %d", |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 410 | ac_type); |
Jeff Johnson | a2b8b47 | 2019-03-09 14:41:59 -0800 | [diff] [blame] | 411 | qdf_status = qdf_mc_timer_destroy(&ac->inactivity_timer); |
Srinivas Girigowda | 576b235 | 2017-08-25 14:44:26 -0700 | [diff] [blame] | 412 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 413 | hdd_err("Failed to destroy inactivity timer"); |
Srinivas Girigowda | 576b235 | 2017-08-25 14:44:26 -0700 | [diff] [blame] | 414 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 415 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 416 | } |
Jeff Johnson | 0a12bbc | 2019-03-09 15:14:30 -0800 | [diff] [blame] | 417 | ac->inactivity_time = inactivity_time; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 418 | /* Initialize the current tx traffic count on this AC */ |
Jeff Johnson | de474b4 | 2019-03-09 14:58:07 -0800 | [diff] [blame] | 419 | ac->last_traffic_count = |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 420 | adapter->hdd_stats.tx_rx_stats.tx_classified_ac[qos_context-> |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 421 | ac_type]; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 422 | qos_context->is_inactivity_timer_running = true; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 423 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 424 | } |
| 425 | |
| 426 | /** |
| 427 | * hdd_wmm_disable_inactivity_timer() - |
| 428 | * function to disable the traffic inactivity timer for the given AC. |
| 429 | * |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 430 | * @qos_context: [in] pointer to qos_context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 431 | * |
| 432 | * This function is invoked to disable the traffic inactivity timer |
| 433 | * for the given AC. This is normally done when the TS is deleted. |
| 434 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 435 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 436 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 437 | static QDF_STATUS |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 438 | hdd_wmm_disable_inactivity_timer(struct hdd_wmm_qos_context *qos_context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 439 | { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 440 | struct hdd_adapter *adapter = qos_context->adapter; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 441 | sme_ac_enum_type ac_type = qos_context->ac_type; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 442 | struct hdd_wmm_ac_status *ac = &adapter->hdd_wmm_status.ac_status[ac_type]; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 443 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 444 | |
| 445 | /* Clear the timer and the counter */ |
Jeff Johnson | 154193b | 2019-03-09 14:42:58 -0800 | [diff] [blame] | 446 | ac->inactivity_time = 0; |
Jeff Johnson | de474b4 | 2019-03-09 14:58:07 -0800 | [diff] [blame] | 447 | ac->last_traffic_count = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 448 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 449 | if (qos_context->is_inactivity_timer_running == true) { |
| 450 | qos_context->is_inactivity_timer_running = false; |
Jeff Johnson | a2b8b47 | 2019-03-09 14:41:59 -0800 | [diff] [blame] | 451 | qdf_status = qdf_mc_timer_stop(&ac->inactivity_timer); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 452 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 453 | hdd_err("Failed to stop inactivity timer"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 454 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 455 | } |
Jeff Johnson | a2b8b47 | 2019-03-09 14:41:59 -0800 | [diff] [blame] | 456 | qdf_status = qdf_mc_timer_destroy(&ac->inactivity_timer); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 457 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 458 | hdd_err("Failed to destroy inactivity timer:Timer started"); |
| 459 | } |
| 460 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 461 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 462 | } |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 463 | #else |
| 464 | |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 465 | static QDF_STATUS |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 466 | hdd_wmm_disable_inactivity_timer(struct hdd_wmm_qos_context *qos_context) |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 467 | { |
| 468 | return QDF_STATUS_SUCCESS; |
| 469 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 470 | #endif /* FEATURE_WLAN_ESE */ |
| 471 | |
| 472 | /** |
| 473 | * hdd_wmm_sme_callback() - callback for QoS notifications |
| 474 | * |
Jeff Johnson | cbbc78f | 2018-06-12 16:25:09 -0700 | [diff] [blame] | 475 | * @mac_handle: [in] the MAC handle |
| 476 | * @context : [in] the HDD callback context |
Jeff Johnson | c4adb88 | 2019-03-08 20:17:52 -0800 | [diff] [blame] | 477 | * @tspec_info : [in] the TSPEC params |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 478 | * @sme_status : [in] the QoS related SME status |
Jeff Johnson | 104f70e | 2019-03-08 19:29:33 -0800 | [diff] [blame] | 479 | * @flow_id: [in] the unique identifier of the flow |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 480 | * |
| 481 | * This callback is registered by HDD with SME for receiving QoS |
| 482 | * notifications. Even though this function has a static scope it |
| 483 | * gets called externally through some function pointer magic (so |
| 484 | * there is a need for rigorous parameter checking). |
| 485 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 486 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 487 | */ |
Jeff Johnson | cbbc78f | 2018-06-12 16:25:09 -0700 | [diff] [blame] | 488 | static QDF_STATUS hdd_wmm_sme_callback(mac_handle_t mac_handle, |
| 489 | void *context, |
Jeff Johnson | c4adb88 | 2019-03-08 20:17:52 -0800 | [diff] [blame] | 490 | struct sme_qos_wmmtspecinfo *tspec_info, |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 491 | enum sme_qos_statustype sme_status, |
Jeff Johnson | 104f70e | 2019-03-08 19:29:33 -0800 | [diff] [blame] | 492 | uint32_t flow_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 493 | { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 494 | struct hdd_wmm_qos_context *qos_context = context; |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 495 | struct hdd_adapter *adapter; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 496 | sme_ac_enum_type ac_type; |
Jeff Johnson | 4d20900 | 2019-03-08 20:27:25 -0800 | [diff] [blame] | 497 | struct hdd_wmm_ac_status *ac; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 498 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 499 | hdd_debug("Entered, context %pK", qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 500 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 501 | if (unlikely((!qos_context) || |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 502 | (HDD_WMM_CTX_MAGIC != qos_context->magic))) { |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 503 | hdd_err("Invalid QoS Context"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 504 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 505 | } |
| 506 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 507 | adapter = qos_context->adapter; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 508 | ac_type = qos_context->ac_type; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 509 | ac = &adapter->hdd_wmm_status.ac_status[ac_type]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 510 | |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 511 | hdd_debug("status %d flowid %d info %pK", |
Jeff Johnson | c4adb88 | 2019-03-08 20:17:52 -0800 | [diff] [blame] | 512 | sme_status, flow_id, tspec_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 513 | |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 514 | switch (sme_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 515 | |
| 516 | case SME_QOS_STATUS_SETUP_SUCCESS_IND: |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 517 | hdd_debug("Setup is complete"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 518 | |
| 519 | /* there will always be a TSPEC returned with this |
| 520 | * status, even if a TSPEC is not exchanged OTA |
| 521 | */ |
Jeff Johnson | c4adb88 | 2019-03-08 20:17:52 -0800 | [diff] [blame] | 522 | if (tspec_info) { |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 523 | ac->is_tspec_valid = true; |
Jeff Johnson | 64d94dd | 2019-03-09 14:31:14 -0800 | [diff] [blame] | 524 | memcpy(&ac->tspec, |
| 525 | tspec_info, sizeof(ac->tspec)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 526 | } |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 527 | ac->is_access_allowed = true; |
Jeff Johnson | c77123d | 2019-03-09 14:18:34 -0800 | [diff] [blame] | 528 | ac->was_access_granted = true; |
Jeff Johnson | e5b75be | 2019-03-09 14:07:35 -0800 | [diff] [blame] | 529 | ac->is_access_pending = false; |
Jeff Johnson | 1b48ccb | 2019-03-09 14:15:57 -0800 | [diff] [blame] | 530 | ac->has_access_failed = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 531 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 532 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 533 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 534 | hdd_debug("Explicit Qos, notifying user space"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 535 | |
| 536 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 537 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 538 | HDD_WLAN_WMM_STATUS_SETUP_SUCCESS; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 539 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 540 | } |
| 541 | |
| 542 | #ifdef FEATURE_WLAN_ESE |
| 543 | /* Check if the inactivity interval is specified */ |
Jeff Johnson | c4adb88 | 2019-03-08 20:17:52 -0800 | [diff] [blame] | 544 | if (tspec_info && tspec_info->inactivity_interval) { |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 545 | hdd_debug("Inactivity timer value = %d for AC=%d", |
Jeff Johnson | c4adb88 | 2019-03-08 20:17:52 -0800 | [diff] [blame] | 546 | tspec_info->inactivity_interval, ac_type); |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 547 | hdd_wmm_enable_inactivity_timer(qos_context, |
Jeff Johnson | c4adb88 | 2019-03-08 20:17:52 -0800 | [diff] [blame] | 548 | tspec_info-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 549 | inactivity_interval); |
| 550 | } |
| 551 | #endif /* FEATURE_WLAN_ESE */ |
| 552 | |
| 553 | /* notify TL to enable trigger frames if necessary */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 554 | hdd_wmm_enable_tl_uapsd(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 555 | |
| 556 | break; |
| 557 | |
| 558 | case SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY: |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 559 | hdd_debug("Setup is complete (U-APSD set previously)"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 560 | |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 561 | ac->is_access_allowed = true; |
Jeff Johnson | c77123d | 2019-03-09 14:18:34 -0800 | [diff] [blame] | 562 | ac->was_access_granted = true; |
Jeff Johnson | e5b75be | 2019-03-09 14:07:35 -0800 | [diff] [blame] | 563 | ac->is_access_pending = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 564 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 565 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 566 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 567 | hdd_debug("Explicit Qos, notifying user space"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 568 | |
| 569 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 570 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 571 | HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_UAPSD_EXISTING; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 572 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 573 | } |
| 574 | |
| 575 | break; |
| 576 | |
| 577 | case SME_QOS_STATUS_SETUP_FAILURE_RSP: |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 578 | hdd_err("Setup failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 579 | /* QoS setup failed */ |
| 580 | |
Jeff Johnson | e5b75be | 2019-03-09 14:07:35 -0800 | [diff] [blame] | 581 | ac->is_access_pending = false; |
Jeff Johnson | 1b48ccb | 2019-03-09 14:15:57 -0800 | [diff] [blame] | 582 | ac->has_access_failed = true; |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 583 | ac->is_access_allowed = false; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 584 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 585 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 586 | hdd_debug("Explicit Qos, notifying user space"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 587 | |
| 588 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 589 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 590 | HDD_WLAN_WMM_STATUS_SETUP_FAILED; |
| 591 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 592 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 593 | } |
| 594 | |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 595 | /* disable the inactivity timer */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 596 | hdd_wmm_disable_inactivity_timer(qos_context); |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 597 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 598 | /* Setting up QoS Failed, QoS context can be released. |
| 599 | * SME is releasing this flow information and if HDD |
| 600 | * doesn't release this context, next time if |
| 601 | * application uses the same handle to set-up QoS, HDD |
| 602 | * (as it has QoS context for this handle) will issue |
| 603 | * Modify QoS request to SME but SME will reject as now |
| 604 | * it has no information for this flow. |
| 605 | */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 606 | hdd_wmm_free_context(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 607 | break; |
| 608 | |
| 609 | case SME_QOS_STATUS_SETUP_INVALID_PARAMS_RSP: |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 610 | hdd_err("Setup Invalid Params, notify TL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 611 | /* QoS setup failed */ |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 612 | ac->is_access_allowed = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 613 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 614 | if (HDD_WMM_HANDLE_IMPLICIT == qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 615 | |
| 616 | /* we note the failure, but we also mark |
| 617 | * access as allowed so that the packets will |
| 618 | * flow. Note that the MAC will "do the right |
| 619 | * thing" |
| 620 | */ |
Jeff Johnson | e5b75be | 2019-03-09 14:07:35 -0800 | [diff] [blame] | 621 | ac->is_access_pending = false; |
Jeff Johnson | 1b48ccb | 2019-03-09 14:15:57 -0800 | [diff] [blame] | 622 | ac->has_access_failed = true; |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 623 | ac->is_access_allowed = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 624 | |
| 625 | } else { |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 626 | hdd_debug("Explicit Qos, notifying user space"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 627 | |
| 628 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 629 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 630 | HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 631 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 632 | } |
| 633 | break; |
| 634 | |
| 635 | case SME_QOS_STATUS_SETUP_NOT_QOS_AP_RSP: |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 636 | hdd_err("Setup failed, not a QoS AP"); |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 637 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Dustin Brown | 5e89ef8 | 2018-03-14 11:50:23 -0700 | [diff] [blame] | 638 | hdd_info("Explicit Qos, notifying user space"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 639 | |
| 640 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 641 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 642 | HDD_WLAN_WMM_STATUS_SETUP_FAILED_NO_WMM; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 643 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 644 | } |
| 645 | break; |
| 646 | |
| 647 | case SME_QOS_STATUS_SETUP_REQ_PENDING_RSP: |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 648 | hdd_debug("Setup pending"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 649 | /* not a callback status -- ignore if we get it */ |
| 650 | break; |
| 651 | |
| 652 | case SME_QOS_STATUS_SETUP_MODIFIED_IND: |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 653 | hdd_debug("Setup modified"); |
Jeff Johnson | c4adb88 | 2019-03-08 20:17:52 -0800 | [diff] [blame] | 654 | if (tspec_info) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 655 | /* update the TSPEC */ |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 656 | ac->is_tspec_valid = true; |
Jeff Johnson | 64d94dd | 2019-03-09 14:31:14 -0800 | [diff] [blame] | 657 | memcpy(&ac->tspec, |
| 658 | tspec_info, sizeof(ac->tspec)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 659 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 660 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 661 | hdd_debug("Explicit Qos, notifying user space"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 662 | |
| 663 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 664 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 665 | HDD_WLAN_WMM_STATUS_MODIFIED; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 666 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 667 | } |
| 668 | /* need to tell TL to update its UAPSD handling */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 669 | hdd_wmm_enable_tl_uapsd(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 670 | } |
| 671 | break; |
| 672 | |
| 673 | case SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP: |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 674 | if (HDD_WMM_HANDLE_IMPLICIT == qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 675 | |
| 676 | /* this was triggered by implicit QoS so we |
| 677 | * know packets are pending |
| 678 | */ |
Jeff Johnson | e5b75be | 2019-03-09 14:07:35 -0800 | [diff] [blame] | 679 | ac->is_access_pending = false; |
Jeff Johnson | c77123d | 2019-03-09 14:18:34 -0800 | [diff] [blame] | 680 | ac->was_access_granted = true; |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 681 | ac->is_access_allowed = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 682 | |
| 683 | } else { |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 684 | hdd_debug("Explicit Qos, notifying user space"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 685 | |
| 686 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 687 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 688 | HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_NO_UAPSD; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 689 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 690 | } |
| 691 | break; |
| 692 | |
| 693 | case SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_PENDING: |
| 694 | /* nothing to do for now */ |
| 695 | break; |
| 696 | |
| 697 | case SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_SET_FAILED: |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 698 | hdd_err("Setup successful but U-APSD failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 699 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 700 | if (HDD_WMM_HANDLE_IMPLICIT == qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 701 | |
| 702 | /* QoS setup was successful but setting U=APSD |
| 703 | * failed. Since the OTA part of the request |
| 704 | * was successful, we don't mark this as a |
| 705 | * failure. the packets will flow. Note that |
Jeff Johnson | 1677bbb | 2017-01-12 08:39:19 -0800 | [diff] [blame] | 706 | * the MAC will "do the right thing" |
| 707 | */ |
Jeff Johnson | c77123d | 2019-03-09 14:18:34 -0800 | [diff] [blame] | 708 | ac->was_access_granted = true; |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 709 | ac->is_access_allowed = true; |
Jeff Johnson | 1b48ccb | 2019-03-09 14:15:57 -0800 | [diff] [blame] | 710 | ac->has_access_failed = false; |
Jeff Johnson | e5b75be | 2019-03-09 14:07:35 -0800 | [diff] [blame] | 711 | ac->is_access_pending = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 712 | |
| 713 | } else { |
Dustin Brown | 5e89ef8 | 2018-03-14 11:50:23 -0700 | [diff] [blame] | 714 | hdd_info("Explicit Qos, notifying user space"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 715 | |
| 716 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 717 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 718 | HDD_WLAN_WMM_STATUS_SETUP_UAPSD_SET_FAILED; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 719 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 720 | } |
| 721 | |
| 722 | /* Since U-APSD portion failed disabled trigger frame |
| 723 | * generation |
| 724 | */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 725 | hdd_wmm_disable_tl_uapsd(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 726 | |
| 727 | break; |
| 728 | |
| 729 | case SME_QOS_STATUS_RELEASE_SUCCESS_RSP: |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 730 | hdd_debug("Release is complete"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 731 | |
Jeff Johnson | c4adb88 | 2019-03-08 20:17:52 -0800 | [diff] [blame] | 732 | if (tspec_info) { |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 733 | hdd_debug("flows still active"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 734 | |
| 735 | /* there is still at least one flow active for |
| 736 | * this AC so update the AC state |
| 737 | */ |
Jeff Johnson | 64d94dd | 2019-03-09 14:31:14 -0800 | [diff] [blame] | 738 | memcpy(&ac->tspec, |
| 739 | tspec_info, sizeof(ac->tspec)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 740 | |
| 741 | /* need to tell TL to update its UAPSD handling */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 742 | hdd_wmm_enable_tl_uapsd(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 743 | } else { |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 744 | hdd_debug("last flow"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 745 | |
| 746 | /* this is the last flow active for this AC so |
| 747 | * update the AC state |
| 748 | */ |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 749 | ac->is_tspec_valid = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 750 | |
| 751 | /* DELTS is successful, do not allow */ |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 752 | ac->is_access_allowed = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 753 | |
| 754 | /* need to tell TL to update its UAPSD handling */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 755 | hdd_wmm_disable_tl_uapsd(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 756 | } |
| 757 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 758 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 759 | hdd_debug("Explicit Qos, notifying user space"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 760 | |
| 761 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 762 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 763 | HDD_WLAN_WMM_STATUS_RELEASE_SUCCESS; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 764 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 765 | } |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 766 | /* disable the inactivity timer */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 767 | hdd_wmm_disable_inactivity_timer(qos_context); |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 768 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 769 | /* we are done with this flow */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 770 | hdd_wmm_free_context(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 771 | break; |
| 772 | |
| 773 | case SME_QOS_STATUS_RELEASE_FAILURE_RSP: |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 774 | hdd_debug("Release failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 775 | |
| 776 | /* we don't need to update our state or TL since |
| 777 | * nothing has changed |
| 778 | */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 779 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 780 | hdd_debug("Explicit Qos, notifying user space"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 781 | |
| 782 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 783 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 784 | HDD_WLAN_WMM_STATUS_RELEASE_FAILED; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 785 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 786 | } |
| 787 | |
| 788 | break; |
| 789 | |
| 790 | case SME_QOS_STATUS_RELEASE_QOS_LOST_IND: |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 791 | hdd_debug("QOS Lost indication received"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 792 | |
| 793 | /* current TSPEC is no longer valid */ |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 794 | ac->is_tspec_valid = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 795 | /* AP has sent DELTS, do not allow */ |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 796 | ac->is_access_allowed = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 797 | |
| 798 | /* need to tell TL to update its UAPSD handling */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 799 | hdd_wmm_disable_tl_uapsd(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 800 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 801 | if (HDD_WMM_HANDLE_IMPLICIT == qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 802 | /* we no longer have implicit access granted */ |
Jeff Johnson | c77123d | 2019-03-09 14:18:34 -0800 | [diff] [blame] | 803 | ac->was_access_granted = false; |
Jeff Johnson | 1b48ccb | 2019-03-09 14:15:57 -0800 | [diff] [blame] | 804 | ac->has_access_failed = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 805 | } else { |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 806 | hdd_debug("Explicit Qos, notifying user space"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 807 | |
| 808 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 809 | qos_context->status = HDD_WLAN_WMM_STATUS_LOST; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 810 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 811 | } |
| 812 | |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 813 | /* disable the inactivity timer */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 814 | hdd_wmm_disable_inactivity_timer(qos_context); |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 815 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 816 | /* we are done with this flow */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 817 | hdd_wmm_free_context(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 818 | break; |
| 819 | |
| 820 | case SME_QOS_STATUS_RELEASE_REQ_PENDING_RSP: |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 821 | hdd_debug("Release pending"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 822 | /* not a callback status -- ignore if we get it */ |
| 823 | break; |
| 824 | |
| 825 | case SME_QOS_STATUS_RELEASE_INVALID_PARAMS_RSP: |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 826 | hdd_err("Release Invalid Params"); |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 827 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 828 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 829 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 830 | HDD_WLAN_WMM_STATUS_RELEASE_FAILED_BAD_PARAM; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 831 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 832 | } |
| 833 | break; |
| 834 | |
| 835 | case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND: |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 836 | hdd_debug("Modification is complete, notify TL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 837 | |
| 838 | /* there will always be a TSPEC returned with this |
| 839 | * status, even if a TSPEC is not exchanged OTA |
| 840 | */ |
Jeff Johnson | c4adb88 | 2019-03-08 20:17:52 -0800 | [diff] [blame] | 841 | if (tspec_info) { |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 842 | ac->is_tspec_valid = true; |
Jeff Johnson | 64d94dd | 2019-03-09 14:31:14 -0800 | [diff] [blame] | 843 | memcpy(&ac->tspec, |
| 844 | tspec_info, sizeof(ac->tspec)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 845 | } |
| 846 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 847 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 848 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 849 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 850 | HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 851 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 852 | } |
| 853 | /* notify TL to enable trigger frames if necessary */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 854 | hdd_wmm_enable_tl_uapsd(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 855 | |
| 856 | break; |
| 857 | |
| 858 | case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_APSD_SET_ALREADY: |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 859 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 860 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 861 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 862 | HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_UAPSD_EXISTING; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 863 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 864 | } |
| 865 | break; |
| 866 | |
| 867 | case SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP: |
| 868 | /* the flow modification failed so we'll leave in |
| 869 | * place whatever existed beforehand |
| 870 | */ |
| 871 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 872 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 873 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 874 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 875 | HDD_WLAN_WMM_STATUS_MODIFY_FAILED; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 876 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 877 | } |
| 878 | break; |
| 879 | |
| 880 | case SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP: |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 881 | hdd_debug("modification pending"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 882 | /* not a callback status -- ignore if we get it */ |
| 883 | break; |
| 884 | |
| 885 | case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP: |
| 886 | /* the flow modification was successful but no QoS |
| 887 | * changes required |
| 888 | */ |
| 889 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 890 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 891 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 892 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 893 | HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_NO_UAPSD; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 894 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 895 | } |
| 896 | break; |
| 897 | |
| 898 | case SME_QOS_STATUS_MODIFY_SETUP_INVALID_PARAMS_RSP: |
| 899 | /* invalid params -- notify the application */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 900 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 901 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 902 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 903 | HDD_WLAN_WMM_STATUS_MODIFY_FAILED_BAD_PARAM; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 904 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 905 | } |
| 906 | break; |
| 907 | |
| 908 | case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_PENDING: |
| 909 | /* nothing to do for now. when APSD is established we'll have work to do */ |
| 910 | break; |
| 911 | |
| 912 | case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_IND_APSD_SET_FAILED: |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 913 | hdd_err("Modify successful but U-APSD failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 914 | |
| 915 | /* QoS modification was successful but setting U=APSD |
| 916 | * failed. This will always be an explicit QoS |
| 917 | * instance, so all we can do is notify the |
| 918 | * application and let it clean up. |
| 919 | */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 920 | if (HDD_WMM_HANDLE_IMPLICIT != qos_context->handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 921 | /* this was triggered by an application */ |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 922 | qos_context->status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 923 | HDD_WLAN_WMM_STATUS_MODIFY_UAPSD_SET_FAILED; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 924 | hdd_wmm_notify_app(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 925 | } |
| 926 | /* Since U-APSD portion failed disabled trigger frame |
| 927 | * generation |
| 928 | */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 929 | hdd_wmm_disable_tl_uapsd(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 930 | |
| 931 | break; |
| 932 | |
| 933 | case SME_QOS_STATUS_HANDING_OFF: |
| 934 | /* no roaming so we won't see this */ |
| 935 | break; |
| 936 | |
| 937 | case SME_QOS_STATUS_OUT_OF_APSD_POWER_MODE_IND: |
| 938 | /* need to tell TL to stop trigger frame generation */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 939 | hdd_wmm_disable_tl_uapsd(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 940 | break; |
| 941 | |
| 942 | case SME_QOS_STATUS_INTO_APSD_POWER_MODE_IND: |
| 943 | /* need to tell TL to start sending trigger frames again */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 944 | hdd_wmm_enable_tl_uapsd(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 945 | break; |
| 946 | |
| 947 | default: |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 948 | hdd_err("unexpected SME Status=%d", sme_status); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 949 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 950 | } |
| 951 | |
| 952 | /* if Tspec only allows downstream traffic then access is not |
| 953 | * allowed |
| 954 | */ |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 955 | if (ac->is_tspec_valid && |
Jeff Johnson | 64d94dd | 2019-03-09 14:31:14 -0800 | [diff] [blame] | 956 | (ac->tspec.ts_info.direction == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 957 | SME_QOS_WMM_TS_DIR_DOWNLINK)) { |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 958 | ac->is_access_allowed = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 959 | } |
| 960 | /* if we have valid Tpsec or if ACM bit is not set, allow access */ |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 961 | if ((ac->is_tspec_valid && |
Jeff Johnson | 64d94dd | 2019-03-09 14:31:14 -0800 | [diff] [blame] | 962 | (ac->tspec.ts_info.direction != |
Jeff Johnson | 30ac84f | 2019-03-09 13:57:57 -0800 | [diff] [blame] | 963 | SME_QOS_WMM_TS_DIR_DOWNLINK)) || !ac->is_access_required) { |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 964 | ac->is_access_allowed = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 965 | } |
| 966 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 967 | hdd_debug("complete, access for TL AC %d is%sallowed", |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 968 | ac_type, ac->is_access_allowed ? " " : " not "); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 969 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 970 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 971 | } |
| 972 | #endif |
| 973 | |
| 974 | /** |
| 975 | * hdd_wmmps_helper() - Function to set uapsd psb dynamically |
| 976 | * |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 977 | * @adapter: [in] pointer to adapter structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 978 | * @ptr: [in] pointer to command buffer |
| 979 | * |
| 980 | * Return: Zero on success, appropriate error on failure. |
| 981 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 982 | int hdd_wmmps_helper(struct hdd_adapter *adapter, uint8_t *ptr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 983 | { |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 984 | if (!adapter) { |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 985 | hdd_err("adapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 986 | return -EINVAL; |
| 987 | } |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 988 | if (!ptr) { |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 989 | hdd_err("ptr is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 990 | return -EINVAL; |
| 991 | } |
| 992 | /* convert ASCII to integer */ |
Jeff Johnson | 137c8ee | 2017-10-28 13:06:48 -0700 | [diff] [blame] | 993 | adapter->configured_psb = ptr[9] - '0'; |
| 994 | adapter->psb_changed = HDD_PSB_CHANGED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 995 | |
| 996 | return 0; |
| 997 | } |
| 998 | |
| 999 | /** |
| 1000 | * __hdd_wmm_do_implicit_qos() - Function which will attempt to setup |
Dustin Brown | 6725e27 | 2019-03-06 12:29:47 -0800 | [diff] [blame] | 1001 | * QoS for any AC requiring it. |
| 1002 | * @qos_context: the QoS context to operate against |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | * |
| 1004 | * Return: none |
| 1005 | */ |
Dustin Brown | 6725e27 | 2019-03-06 12:29:47 -0800 | [diff] [blame] | 1006 | static void __hdd_wmm_do_implicit_qos(struct hdd_wmm_qos_context *qos_context) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1007 | { |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1008 | struct hdd_adapter *adapter; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1009 | sme_ac_enum_type ac_type; |
Jeff Johnson | 4d20900 | 2019-03-08 20:27:25 -0800 | [diff] [blame] | 1010 | struct hdd_wmm_ac_status *ac; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1011 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 1012 | enum sme_qos_statustype sme_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1013 | #endif |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1014 | struct sme_qos_wmmtspecinfo tspec; |
Jeff Johnson | 1083b6e | 2017-08-28 11:35:22 -0700 | [diff] [blame] | 1015 | struct hdd_context *hdd_ctx; |
Jeff Johnson | cbbc78f | 2018-06-12 16:25:09 -0700 | [diff] [blame] | 1016 | mac_handle_t mac_handle; |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 1017 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Abhinav Kumar | 7d6f1ac | 2018-09-01 18:33:56 +0530 | [diff] [blame] | 1018 | uint8_t dir_ac, mask = 0; |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 1019 | uint16_t nom_msdu_size_ac = 0; |
| 1020 | uint32_t rate_ac = 0; |
| 1021 | uint16_t sba_ac = 0; |
| 1022 | uint32_t uapsd_value = 0; |
Abhinav Kumar | ab57671 | 2018-11-05 14:32:49 +0530 | [diff] [blame] | 1023 | bool is_ts_burst_enable; |
| 1024 | enum mlme_ts_info_ack_policy ack_policy; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1025 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 1026 | hdd_debug("Entered, context %pK", qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1027 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 1028 | adapter = qos_context->adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1029 | |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1030 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 1031 | if (wlan_hdd_validate_context(hdd_ctx)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1032 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1033 | |
Jeff Johnson | cbbc78f | 2018-06-12 16:25:09 -0700 | [diff] [blame] | 1034 | mac_handle = hdd_ctx->mac_handle; |
| 1035 | |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1036 | ac_type = qos_context->ac_type; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 1037 | ac = &adapter->hdd_wmm_status.ac_status[ac_type]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1038 | |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1039 | hdd_debug("adapter %pK ac_type %d", adapter, ac_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1040 | |
Jeff Johnson | 12ccaf6 | 2019-03-09 13:59:53 -0800 | [diff] [blame] | 1041 | if (!ac->is_access_needed) { |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1042 | hdd_err("AC %d doesn't need service", ac_type); |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 1043 | qos_context->magic = 0; |
| 1044 | qdf_mem_free(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1045 | return; |
| 1046 | } |
| 1047 | |
Jeff Johnson | e5b75be | 2019-03-09 14:07:35 -0800 | [diff] [blame] | 1048 | ac->is_access_pending = true; |
Jeff Johnson | 12ccaf6 | 2019-03-09 13:59:53 -0800 | [diff] [blame] | 1049 | ac->is_access_needed = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1050 | |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1051 | memset(&tspec, 0, sizeof(tspec)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1052 | |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1053 | tspec.ts_info.psb = adapter->configured_psb; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1054 | |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1055 | switch (ac_type) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1056 | case SME_AC_VO: |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1057 | tspec.ts_info.up = SME_QOS_WMM_UP_VO; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1058 | /* Check if there is any valid configuration from framework */ |
Jeff Johnson | 137c8ee | 2017-10-28 13:06:48 -0700 | [diff] [blame] | 1059 | if (HDD_PSB_CFG_INVALID == adapter->configured_psb) { |
Abhinav Kumar | 7d6f1ac | 2018-09-01 18:33:56 +0530 | [diff] [blame] | 1060 | status = ucfg_mlme_get_wmm_uapsd_mask(hdd_ctx->psoc, |
| 1061 | &mask); |
| 1062 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1063 | hdd_err("Get uapsd_mask failed"); |
| 1064 | return; |
| 1065 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1066 | tspec.ts_info.psb = (mask & SME_QOS_UAPSD_VO) ? 1 : 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1067 | } |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 1068 | status = ucfg_mlme_get_wmm_dir_ac_vo(hdd_ctx->psoc, |
| 1069 | &dir_ac); |
| 1070 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1071 | hdd_err("Get infra_dir_ac_vo failed"); |
| 1072 | return; |
| 1073 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1074 | tspec.ts_info.direction = dir_ac; |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 1075 | |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1076 | tspec.ts_info.tid = 255; |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 1077 | |
| 1078 | status = ucfg_mlme_get_wmm_uapsd_vo_srv_intv(hdd_ctx->psoc, |
| 1079 | &uapsd_value); |
| 1080 | if (QDF_IS_STATUS_ERROR(status)) { |
| 1081 | hdd_err("Get uapsd_srv_intv failed"); |
| 1082 | return; |
| 1083 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1084 | tspec.min_service_interval = uapsd_value; |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 1085 | |
| 1086 | status = ucfg_mlme_get_wmm_uapsd_vo_sus_intv(hdd_ctx->psoc, |
| 1087 | &uapsd_value); |
| 1088 | if (QDF_IS_STATUS_ERROR(status)) { |
| 1089 | hdd_err("Get uapsd_vo_sus_intv failed"); |
| 1090 | return; |
| 1091 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1092 | tspec.suspension_interval = uapsd_value; |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 1093 | |
| 1094 | status = ucfg_mlme_get_wmm_mean_data_rate_ac_vo(hdd_ctx->psoc, |
| 1095 | &rate_ac); |
| 1096 | if (QDF_IS_STATUS_ERROR(status)) { |
| 1097 | hdd_err("Get mean_data_rate_ac_vo failed"); |
| 1098 | return; |
| 1099 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1100 | tspec.mean_data_rate = rate_ac; |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 1101 | |
| 1102 | status = ucfg_mlme_get_wmm_min_phy_rate_ac_vo(hdd_ctx->psoc, |
| 1103 | &rate_ac); |
| 1104 | if (QDF_IS_STATUS_ERROR(status)) { |
| 1105 | hdd_err("Get min_phy_rate_ac_vo failed"); |
| 1106 | return; |
| 1107 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1108 | tspec.min_phy_rate = rate_ac; |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 1109 | |
| 1110 | status = ucfg_mlme_get_wmm_nom_msdu_size_ac_vo(hdd_ctx->psoc, |
| 1111 | &nom_msdu_size_ac); |
| 1112 | if (QDF_IS_STATUS_ERROR(status)) { |
| 1113 | hdd_err("Get nom_msdu_size_ac_vo failed"); |
| 1114 | return; |
| 1115 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1116 | tspec.nominal_msdu_size = nom_msdu_size_ac; |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 1117 | |
| 1118 | status = ucfg_mlme_get_wmm_sba_ac_vo(hdd_ctx->psoc, |
| 1119 | &sba_ac); |
| 1120 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1121 | hdd_err("Get sba_ac_vo failed"); |
| 1122 | return; |
| 1123 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1124 | tspec.surplus_bw_allowance = sba_ac; |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 1125 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1126 | break; |
| 1127 | case SME_AC_VI: |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1128 | tspec.ts_info.up = SME_QOS_WMM_UP_VI; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1129 | /* Check if there is any valid configuration from framework */ |
Jeff Johnson | 137c8ee | 2017-10-28 13:06:48 -0700 | [diff] [blame] | 1130 | if (HDD_PSB_CFG_INVALID == adapter->configured_psb) { |
Abhinav Kumar | 7d6f1ac | 2018-09-01 18:33:56 +0530 | [diff] [blame] | 1131 | status = ucfg_mlme_get_wmm_uapsd_mask(hdd_ctx->psoc, |
| 1132 | &mask); |
| 1133 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1134 | hdd_err("Get uapsd_mask failed"); |
| 1135 | return; |
| 1136 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1137 | tspec.ts_info.psb = (mask & SME_QOS_UAPSD_VI) ? 1 : 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1138 | } |
Abhinav Kumar | 4c8e026 | 2018-10-06 16:50:27 +0530 | [diff] [blame] | 1139 | status = ucfg_mlme_get_wmm_dir_ac_vi( |
| 1140 | hdd_ctx->psoc, &dir_ac); |
| 1141 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1142 | hdd_err("Get infra_dir_ac_vi failed"); |
| 1143 | return; |
| 1144 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1145 | tspec.ts_info.direction = dir_ac; |
Abhinav Kumar | 4c8e026 | 2018-10-06 16:50:27 +0530 | [diff] [blame] | 1146 | |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1147 | tspec.ts_info.tid = 255; |
Abhinav Kumar | 4c8e026 | 2018-10-06 16:50:27 +0530 | [diff] [blame] | 1148 | status = ucfg_mlme_get_wmm_uapsd_vi_srv_intv( |
| 1149 | hdd_ctx->psoc, &uapsd_value); |
| 1150 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1151 | hdd_err("Get uapsd_vi_srv_intv failed"); |
| 1152 | return; |
| 1153 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1154 | tspec.min_service_interval = uapsd_value; |
Abhinav Kumar | 4c8e026 | 2018-10-06 16:50:27 +0530 | [diff] [blame] | 1155 | |
| 1156 | status = ucfg_mlme_get_wmm_uapsd_vi_sus_intv( |
| 1157 | hdd_ctx->psoc, &uapsd_value); |
| 1158 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1159 | hdd_err("Get uapsd_vi_sus_intv failed"); |
| 1160 | return; |
| 1161 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1162 | tspec.suspension_interval = uapsd_value; |
Abhinav Kumar | 4c8e026 | 2018-10-06 16:50:27 +0530 | [diff] [blame] | 1163 | |
| 1164 | status = ucfg_mlme_get_wmm_mean_data_rate_ac_vi( |
| 1165 | hdd_ctx->psoc, &rate_ac); |
| 1166 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1167 | hdd_err("Get mean_data_rate_ac_vi failed"); |
| 1168 | return; |
| 1169 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1170 | tspec.mean_data_rate = rate_ac; |
Abhinav Kumar | 4c8e026 | 2018-10-06 16:50:27 +0530 | [diff] [blame] | 1171 | |
| 1172 | status = ucfg_mlme_get_wmm_min_phy_rate_ac_vi( |
| 1173 | hdd_ctx->psoc, &rate_ac); |
| 1174 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1175 | hdd_err("Get min_phy_rate_ac_vi failed"); |
| 1176 | return; |
| 1177 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1178 | tspec.min_phy_rate = rate_ac; |
Abhinav Kumar | 4c8e026 | 2018-10-06 16:50:27 +0530 | [diff] [blame] | 1179 | |
| 1180 | status = ucfg_mlme_get_wmm_nom_msdu_size_ac_vi( |
| 1181 | hdd_ctx->psoc, &nom_msdu_size_ac); |
| 1182 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1183 | hdd_err("Get nom_msdu_size_ac_vi failed"); |
| 1184 | return; |
| 1185 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1186 | tspec.nominal_msdu_size = nom_msdu_size_ac; |
Abhinav Kumar | 4c8e026 | 2018-10-06 16:50:27 +0530 | [diff] [blame] | 1187 | |
| 1188 | status = ucfg_mlme_get_wmm_sba_ac_vi( |
| 1189 | hdd_ctx->psoc, &sba_ac); |
| 1190 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1191 | hdd_err("Get sba_ac_vi failed"); |
| 1192 | return; |
| 1193 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1194 | tspec.surplus_bw_allowance = sba_ac; |
Abhinav Kumar | 4c8e026 | 2018-10-06 16:50:27 +0530 | [diff] [blame] | 1195 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1196 | break; |
| 1197 | default: |
| 1198 | case SME_AC_BE: |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1199 | tspec.ts_info.up = SME_QOS_WMM_UP_BE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1200 | /* Check if there is any valid configuration from framework */ |
Jeff Johnson | 137c8ee | 2017-10-28 13:06:48 -0700 | [diff] [blame] | 1201 | if (HDD_PSB_CFG_INVALID == adapter->configured_psb) { |
Abhinav Kumar | 7d6f1ac | 2018-09-01 18:33:56 +0530 | [diff] [blame] | 1202 | status = ucfg_mlme_get_wmm_uapsd_mask(hdd_ctx->psoc, |
| 1203 | &mask); |
| 1204 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1205 | hdd_err("Get uapsd_mask failed"); |
| 1206 | return; |
| 1207 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1208 | tspec.ts_info.psb = (mask & SME_QOS_UAPSD_BE) ? 1 : 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1209 | } |
Abhinav Kumar | e94f248 | 2018-08-19 12:37:36 +0530 | [diff] [blame] | 1210 | status = ucfg_mlme_get_wmm_dir_ac_be(hdd_ctx->psoc, &dir_ac); |
| 1211 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1212 | hdd_err("Get infra_dir_ac_be failed"); |
| 1213 | return; |
| 1214 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1215 | tspec.ts_info.direction = dir_ac; |
Abhinav Kumar | e94f248 | 2018-08-19 12:37:36 +0530 | [diff] [blame] | 1216 | |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1217 | tspec.ts_info.tid = 255; |
Abhinav Kumar | e94f248 | 2018-08-19 12:37:36 +0530 | [diff] [blame] | 1218 | status = ucfg_mlme_get_wmm_uapsd_be_srv_intv(hdd_ctx->psoc, |
| 1219 | &uapsd_value); |
| 1220 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1221 | hdd_err("Get uapsd_vi_srv_intv failed"); |
| 1222 | return; |
| 1223 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1224 | tspec.min_service_interval = uapsd_value; |
Abhinav Kumar | e94f248 | 2018-08-19 12:37:36 +0530 | [diff] [blame] | 1225 | |
| 1226 | status = ucfg_mlme_get_wmm_uapsd_be_sus_intv(hdd_ctx->psoc, |
| 1227 | &uapsd_value); |
| 1228 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1229 | hdd_err("Get uapsd_vi_sus_intv failed"); |
| 1230 | return; |
| 1231 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1232 | tspec.suspension_interval = uapsd_value; |
Abhinav Kumar | e94f248 | 2018-08-19 12:37:36 +0530 | [diff] [blame] | 1233 | |
| 1234 | status = ucfg_mlme_get_wmm_mean_data_rate_ac_be(hdd_ctx->psoc, |
| 1235 | &rate_ac); |
| 1236 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1237 | hdd_err("Get mean_data_rate_ac_be failed"); |
| 1238 | return; |
| 1239 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1240 | tspec.mean_data_rate = rate_ac; |
Abhinav Kumar | e94f248 | 2018-08-19 12:37:36 +0530 | [diff] [blame] | 1241 | |
| 1242 | status = ucfg_mlme_get_wmm_min_phy_rate_ac_be(hdd_ctx->psoc, |
| 1243 | &rate_ac); |
| 1244 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1245 | hdd_err("Get min_phy_rate_ac_be failed"); |
| 1246 | return; |
| 1247 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1248 | tspec.min_phy_rate = rate_ac; |
Abhinav Kumar | e94f248 | 2018-08-19 12:37:36 +0530 | [diff] [blame] | 1249 | |
| 1250 | status = ucfg_mlme_get_wmm_nom_msdu_size_ac_be(hdd_ctx->psoc, |
| 1251 | &nom_msdu_size_ac); |
| 1252 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1253 | hdd_err("Get nom_msdu_size_ac_be failed"); |
| 1254 | return; |
| 1255 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1256 | tspec.nominal_msdu_size = nom_msdu_size_ac; |
Abhinav Kumar | e94f248 | 2018-08-19 12:37:36 +0530 | [diff] [blame] | 1257 | |
| 1258 | status = ucfg_mlme_get_wmm_sba_ac_be(hdd_ctx->psoc, &sba_ac); |
| 1259 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1260 | hdd_err("Get sba_ac_be failed"); |
| 1261 | return; |
| 1262 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1263 | tspec.surplus_bw_allowance = sba_ac; |
Abhinav Kumar | e94f248 | 2018-08-19 12:37:36 +0530 | [diff] [blame] | 1264 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1265 | break; |
| 1266 | case SME_AC_BK: |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1267 | tspec.ts_info.up = SME_QOS_WMM_UP_BK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1268 | /* Check if there is any valid configuration from framework */ |
Jeff Johnson | 137c8ee | 2017-10-28 13:06:48 -0700 | [diff] [blame] | 1269 | if (HDD_PSB_CFG_INVALID == adapter->configured_psb) { |
Abhinav Kumar | 7d6f1ac | 2018-09-01 18:33:56 +0530 | [diff] [blame] | 1270 | status = ucfg_mlme_get_wmm_uapsd_mask(hdd_ctx->psoc, |
| 1271 | &mask); |
| 1272 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1273 | hdd_err("Get uapsd_mask failed"); |
| 1274 | return; |
| 1275 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1276 | tspec.ts_info.psb = (mask & SME_QOS_UAPSD_BK) ? 1 : 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1277 | } |
Abhinav Kumar | 2af8c12 | 2018-08-19 13:49:52 +0530 | [diff] [blame] | 1278 | |
| 1279 | status = ucfg_mlme_get_wmm_dir_ac_bk(hdd_ctx->psoc, &dir_ac); |
| 1280 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1281 | hdd_err("Get infra_dir_ac_bk failed"); |
| 1282 | return; |
| 1283 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1284 | tspec.ts_info.direction = dir_ac; |
Abhinav Kumar | 2af8c12 | 2018-08-19 13:49:52 +0530 | [diff] [blame] | 1285 | |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1286 | tspec.ts_info.tid = 255; |
Abhinav Kumar | 2af8c12 | 2018-08-19 13:49:52 +0530 | [diff] [blame] | 1287 | status = ucfg_mlme_get_wmm_uapsd_bk_srv_intv(hdd_ctx->psoc, |
| 1288 | &uapsd_value); |
| 1289 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1290 | hdd_err("Get uapsd_bk_srv_intv failed"); |
| 1291 | return; |
| 1292 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1293 | tspec.min_service_interval = uapsd_value; |
Abhinav Kumar | 2af8c12 | 2018-08-19 13:49:52 +0530 | [diff] [blame] | 1294 | |
| 1295 | status = ucfg_mlme_get_wmm_uapsd_bk_sus_intv(hdd_ctx->psoc, |
| 1296 | &uapsd_value); |
| 1297 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1298 | hdd_err("Get uapsd_bk_sus_intv failed"); |
| 1299 | return; |
| 1300 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1301 | tspec.suspension_interval = uapsd_value; |
Abhinav Kumar | 2af8c12 | 2018-08-19 13:49:52 +0530 | [diff] [blame] | 1302 | |
| 1303 | status = ucfg_mlme_get_wmm_mean_data_rate_ac_bk(hdd_ctx->psoc, |
| 1304 | &rate_ac); |
| 1305 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1306 | hdd_err("Get mean_data_rate_ac_bk failed"); |
| 1307 | return; |
| 1308 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1309 | tspec.mean_data_rate = rate_ac; |
Abhinav Kumar | 2af8c12 | 2018-08-19 13:49:52 +0530 | [diff] [blame] | 1310 | |
| 1311 | status = ucfg_mlme_get_wmm_min_phy_rate_ac_bk(hdd_ctx->psoc, |
| 1312 | &rate_ac); |
| 1313 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1314 | hdd_err("Get min_phy_rate_ac_bk failed"); |
| 1315 | return; |
| 1316 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1317 | tspec.min_phy_rate = rate_ac; |
Abhinav Kumar | 2af8c12 | 2018-08-19 13:49:52 +0530 | [diff] [blame] | 1318 | |
| 1319 | status = |
| 1320 | ucfg_mlme_get_wmm_nom_msdu_size_ac_bk(hdd_ctx->psoc, |
| 1321 | &nom_msdu_size_ac); |
| 1322 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1323 | hdd_err("Get nom_msdu_size_ac_bk failed"); |
| 1324 | return; |
| 1325 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1326 | tspec.nominal_msdu_size = nom_msdu_size_ac; |
Abhinav Kumar | 2af8c12 | 2018-08-19 13:49:52 +0530 | [diff] [blame] | 1327 | |
| 1328 | status = ucfg_mlme_get_wmm_sba_ac_bk(hdd_ctx->psoc, &sba_ac); |
| 1329 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1330 | hdd_err("Get sba_ac_bk failed"); |
| 1331 | return; |
| 1332 | } |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1333 | tspec.surplus_bw_allowance = sba_ac; |
Abhinav Kumar | 2af8c12 | 2018-08-19 13:49:52 +0530 | [diff] [blame] | 1334 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1335 | break; |
| 1336 | } |
| 1337 | #ifdef FEATURE_WLAN_ESE |
Abhinav Kumar | ab57671 | 2018-11-05 14:32:49 +0530 | [diff] [blame] | 1338 | ucfg_mlme_get_inactivity_interval(hdd_ctx->psoc, &uapsd_value); |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1339 | tspec.inactivity_interval = uapsd_value; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1340 | #endif |
Abhinav Kumar | ab57671 | 2018-11-05 14:32:49 +0530 | [diff] [blame] | 1341 | ucfg_mlme_get_is_ts_burst_size_enable(hdd_ctx->psoc, |
| 1342 | &is_ts_burst_enable); |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1343 | tspec.ts_info.burst_size_defn = is_ts_burst_enable; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1344 | |
Abhinav Kumar | ab57671 | 2018-11-05 14:32:49 +0530 | [diff] [blame] | 1345 | ucfg_mlme_get_ts_info_ack_policy(hdd_ctx->psoc, &ack_policy); |
| 1346 | switch (ack_policy) { |
| 1347 | case TS_INFO_ACK_POLICY_NORMAL_ACK: |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1348 | tspec.ts_info.ack_policy = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1349 | SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK; |
| 1350 | break; |
| 1351 | |
Abhinav Kumar | ab57671 | 2018-11-05 14:32:49 +0530 | [diff] [blame] | 1352 | case TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK: |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1353 | tspec.ts_info.ack_policy = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1354 | SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK; |
| 1355 | break; |
| 1356 | |
| 1357 | default: |
| 1358 | /* unknown */ |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1359 | tspec.ts_info.ack_policy = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1360 | SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK; |
| 1361 | } |
| 1362 | |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1363 | if (tspec.ts_info.ack_policy == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1364 | SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK) { |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1365 | if (!sme_qos_is_ts_info_ack_policy_valid(mac_handle, &tspec, |
Jeff Johnson | 9597f3b | 2019-02-04 14:27:56 -0800 | [diff] [blame] | 1366 | adapter->vdev_id)) { |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1367 | tspec.ts_info.ack_policy = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1368 | SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK; |
| 1369 | } |
| 1370 | } |
| 1371 | |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 1372 | mutex_lock(&adapter->hdd_wmm_status.mutex); |
Jeff Johnson | 8f656c6 | 2019-03-09 08:48:27 -0800 | [diff] [blame] | 1373 | list_add(&qos_context->node, &adapter->hdd_wmm_status.context_list); |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 1374 | mutex_unlock(&adapter->hdd_wmm_status.mutex); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1375 | |
| 1376 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 1377 | sme_status = sme_qos_setup_req(mac_handle, |
| 1378 | adapter->vdev_id, |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1379 | &tspec, |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 1380 | hdd_wmm_sme_callback, |
| 1381 | qos_context, |
Jeff Johnson | 93ca0cd | 2019-03-09 15:23:10 -0800 | [diff] [blame] | 1382 | tspec.ts_info.up, |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 1383 | &qos_context->flow_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1384 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1385 | hdd_debug("sme_qos_setup_req returned %d flowid %d", |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 1386 | sme_status, qos_context->flow_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1387 | |
| 1388 | /* need to check the return values and act appropriately */ |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 1389 | switch (sme_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1390 | case SME_QOS_STATUS_SETUP_REQ_PENDING_RSP: |
| 1391 | case SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_PENDING: |
| 1392 | /* setup is pending, so no more work to do now. all |
| 1393 | * further work will be done in hdd_wmm_sme_callback() |
| 1394 | */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1395 | hdd_debug("Setup is pending, no further work"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1396 | |
| 1397 | break; |
| 1398 | |
| 1399 | case SME_QOS_STATUS_SETUP_FAILURE_RSP: |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 1400 | /* disable the inactivity timer */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 1401 | hdd_wmm_disable_inactivity_timer(qos_context); |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 1402 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1403 | /* we can't tell the difference between when a request |
| 1404 | * fails because AP rejected it versus when SME |
| 1405 | * encountered an internal error. in either case SME |
| 1406 | * won't ever reference this context so free the |
| 1407 | * record |
| 1408 | */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 1409 | hdd_wmm_free_context(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1410 | |
| 1411 | /* fall through and start packets flowing */ |
| 1412 | case SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP: |
| 1413 | /* no ACM in effect, no need to setup U-APSD */ |
| 1414 | case SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY: |
| 1415 | /* no ACM in effect, U-APSD is desired but was already setup */ |
| 1416 | |
| 1417 | /* for these cases everything is already setup so we |
| 1418 | * can signal TL that it has work to do |
| 1419 | */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1420 | hdd_debug("Setup is complete, notify TL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1421 | |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 1422 | ac->is_access_allowed = true; |
Jeff Johnson | c77123d | 2019-03-09 14:18:34 -0800 | [diff] [blame] | 1423 | ac->was_access_granted = true; |
Jeff Johnson | e5b75be | 2019-03-09 14:07:35 -0800 | [diff] [blame] | 1424 | ac->is_access_pending = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1425 | |
| 1426 | break; |
| 1427 | |
| 1428 | default: |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 1429 | hdd_err("unexpected SME Status=%d", sme_status); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1430 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1431 | } |
| 1432 | #endif |
| 1433 | |
| 1434 | } |
| 1435 | |
| 1436 | /** |
| 1437 | * hdd_wmm_do_implicit_qos() - SSR wraper function for hdd_wmm_do_implicit_qos |
| 1438 | * @work: pointer to work_struct |
| 1439 | * |
| 1440 | * Return: none |
| 1441 | */ |
| 1442 | static void hdd_wmm_do_implicit_qos(struct work_struct *work) |
| 1443 | { |
Dustin Brown | 6725e27 | 2019-03-06 12:29:47 -0800 | [diff] [blame] | 1444 | struct hdd_wmm_qos_context *qos_ctx = |
| 1445 | container_of(work, struct hdd_wmm_qos_context, |
Jeff Johnson | 7d4a0b5 | 2019-03-08 22:06:32 -0800 | [diff] [blame] | 1446 | implicit_qos_work); |
Dustin Brown | 6725e27 | 2019-03-06 12:29:47 -0800 | [diff] [blame] | 1447 | struct osif_vdev_sync *vdev_sync; |
| 1448 | |
| 1449 | if (qos_ctx->magic != HDD_WMM_CTX_MAGIC) { |
| 1450 | hdd_err("Invalid QoS Context"); |
| 1451 | return; |
| 1452 | } |
| 1453 | |
| 1454 | if (osif_vdev_sync_op_start(qos_ctx->adapter->dev, &vdev_sync)) |
| 1455 | return; |
| 1456 | |
| 1457 | __hdd_wmm_do_implicit_qos(qos_ctx); |
| 1458 | |
| 1459 | osif_vdev_sync_op_stop(vdev_sync); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1460 | } |
| 1461 | |
Vevek Venkatesan | 656edfa | 2020-01-28 13:08:51 +0530 | [diff] [blame^] | 1462 | QDF_STATUS hdd_send_dscp_up_map_to_fw(struct hdd_adapter *adapter) |
| 1463 | { |
| 1464 | uint32_t *dscp_to_up_map = adapter->dscp_to_up_map; |
| 1465 | struct wlan_objmgr_vdev *vdev = adapter->vdev; |
| 1466 | int ret; |
| 1467 | |
| 1468 | if (vdev) { |
| 1469 | /* Send DSCP to TID map table to FW */ |
| 1470 | ret = os_if_fwol_send_dscp_up_map_to_fw(vdev, dscp_to_up_map); |
| 1471 | if (ret && ret != -EOPNOTSUPP) |
| 1472 | return QDF_STATUS_E_FAILURE; |
| 1473 | } |
| 1474 | |
| 1475 | return QDF_STATUS_SUCCESS; |
| 1476 | } |
| 1477 | |
| 1478 | /** |
| 1479 | * hdd_fill_dscp_to_up_map() - Fill up dscp_to_up_map table with default values |
| 1480 | * @dscp_to_up_map: Array of DSCP-to-UP map |
| 1481 | * |
| 1482 | * This function will fill up the DSCP-to-UP map table with default values. |
| 1483 | * |
| 1484 | * Return: QDF_STATUS enumeration |
| 1485 | */ |
| 1486 | static inline void hdd_fill_dscp_to_up_map( |
| 1487 | enum sme_qos_wmmuptype *dscp_to_up_map) |
| 1488 | { |
| 1489 | uint8_t dscp; |
| 1490 | |
| 1491 | /* |
| 1492 | * DSCP to User Priority Lookup Table |
| 1493 | * By default use the 3 Precedence bits of DSCP as the User Priority |
| 1494 | * |
| 1495 | * In case of changing the default map values, need to take care of |
| 1496 | * hdd_custom_dscp_up_map as well. |
| 1497 | */ |
| 1498 | for (dscp = 0; dscp <= WLAN_MAX_DSCP; dscp++) |
| 1499 | dscp_to_up_map[dscp] = dscp >> 3; |
| 1500 | |
| 1501 | /* Special case for Expedited Forwarding (DSCP 46) in default mapping */ |
| 1502 | dscp_to_up_map[DSCP(46)] = SME_QOS_WMM_UP_VO; |
| 1503 | } |
| 1504 | |
| 1505 | #ifdef WLAN_CUSTOM_DSCP_UP_MAP |
| 1506 | /** |
| 1507 | * hdd_custom_dscp_up_map() - Customize dscp_to_up_map based on RFC8325 |
| 1508 | * @dscp_to_up_map: Array of DSCP-to-UP map |
| 1509 | * |
| 1510 | * This function will customize the DSCP-to-UP map table based on RFC8325.. |
| 1511 | * |
| 1512 | * Return: QDF_STATUS enumeration |
| 1513 | */ |
| 1514 | static inline QDF_STATUS hdd_custom_dscp_up_map( |
| 1515 | enum sme_qos_wmmuptype *dscp_to_up_map) |
| 1516 | { |
| 1517 | /* |
| 1518 | * Customizing few of DSCP to UP mapping based on RFC8325, |
| 1519 | * those are different from default hdd_fill_dscp_to_up_map values. |
| 1520 | * So, below changes are always relative to hdd_fill_dscp_to_up_map. |
| 1521 | */ |
| 1522 | dscp_to_up_map[DSCP(10)] = SME_QOS_WMM_UP_BE; |
| 1523 | dscp_to_up_map[DSCP(12)] = SME_QOS_WMM_UP_BE; |
| 1524 | dscp_to_up_map[DSCP(14)] = SME_QOS_WMM_UP_BE; |
| 1525 | dscp_to_up_map[DSCP(16)] = SME_QOS_WMM_UP_BE; |
| 1526 | |
| 1527 | dscp_to_up_map[DSCP(18)] = SME_QOS_WMM_UP_EE; |
| 1528 | dscp_to_up_map[DSCP(20)] = SME_QOS_WMM_UP_EE; |
| 1529 | dscp_to_up_map[DSCP(22)] = SME_QOS_WMM_UP_EE; |
| 1530 | |
| 1531 | dscp_to_up_map[DSCP(24)] = SME_QOS_WMM_UP_CL; |
| 1532 | dscp_to_up_map[DSCP(26)] = SME_QOS_WMM_UP_CL; |
| 1533 | dscp_to_up_map[DSCP(28)] = SME_QOS_WMM_UP_CL; |
| 1534 | dscp_to_up_map[DSCP(30)] = SME_QOS_WMM_UP_CL; |
| 1535 | |
| 1536 | dscp_to_up_map[DSCP(44)] = SME_QOS_WMM_UP_VO; |
| 1537 | |
| 1538 | return QDF_STATUS_SUCCESS; |
| 1539 | } |
| 1540 | #else |
| 1541 | static inline QDF_STATUS hdd_custom_dscp_up_map( |
| 1542 | enum sme_qos_wmmuptype *dscp_to_up_map) |
| 1543 | { |
| 1544 | return QDF_STATUS_E_NOSUPPORT; |
| 1545 | } |
| 1546 | #endif /* WLAN_CUSTOM_DSCP_UP_MAP */ |
| 1547 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1548 | /** |
| 1549 | * hdd_wmm_init() - initialize the WMM DSCP configuation |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1550 | * @adapter : [in] pointer to Adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1551 | * |
| 1552 | * This function will initialize the WMM DSCP configuation of an |
| 1553 | * adapter to an initial state. The configuration can later be |
| 1554 | * overwritten via application APIs or via QoS Map sent OTA. |
| 1555 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1556 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1557 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1558 | QDF_STATUS hdd_wmm_init(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1559 | { |
Jeff Johnson | 6b51b6a | 2017-11-02 20:31:25 -0700 | [diff] [blame] | 1560 | enum sme_qos_wmmuptype *dscp_to_up_map = adapter->dscp_to_up_map; |
Vevek Venkatesan | 656edfa | 2020-01-28 13:08:51 +0530 | [diff] [blame^] | 1561 | struct wlan_objmgr_psoc *psoc = adapter->hdd_ctx->psoc; |
| 1562 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1563 | |
Dustin Brown | 491d54b | 2018-03-14 12:39:11 -0700 | [diff] [blame] | 1564 | hdd_enter(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1565 | |
Vevek Venkatesan | 656edfa | 2020-01-28 13:08:51 +0530 | [diff] [blame^] | 1566 | if (!psoc) { |
| 1567 | hdd_err("Invalid psoc handle"); |
| 1568 | return QDF_STATUS_E_FAILURE; |
| 1569 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1570 | |
Vevek Venkatesan | 656edfa | 2020-01-28 13:08:51 +0530 | [diff] [blame^] | 1571 | hdd_fill_dscp_to_up_map(dscp_to_up_map); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1572 | |
Vevek Venkatesan | 656edfa | 2020-01-28 13:08:51 +0530 | [diff] [blame^] | 1573 | if (hdd_custom_dscp_up_map(dscp_to_up_map) == QDF_STATUS_SUCCESS) { |
| 1574 | /* Send DSCP to TID map table to FW */ |
| 1575 | status = hdd_send_dscp_up_map_to_fw(adapter); |
| 1576 | } |
| 1577 | |
| 1578 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1579 | } |
| 1580 | |
| 1581 | /** |
| 1582 | * hdd_wmm_adapter_init() - initialize the WMM configuration of an adapter |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1583 | * @adapter: [in] pointer to Adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1584 | * |
| 1585 | * This function will initialize the WMM configuation and status of an |
| 1586 | * adapter to an initial state. The configuration can later be |
| 1587 | * overwritten via application APIs |
| 1588 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1589 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1590 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1591 | QDF_STATUS hdd_wmm_adapter_init(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1592 | { |
Jeff Johnson | d37476e | 2019-03-08 20:20:30 -0800 | [diff] [blame] | 1593 | struct hdd_wmm_ac_status *ac_status; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1594 | sme_ac_enum_type ac_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1595 | |
Dustin Brown | 491d54b | 2018-03-14 12:39:11 -0700 | [diff] [blame] | 1596 | hdd_enter(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1597 | |
Jeff Johnson | 26ef71e | 2019-03-08 23:24:29 -0800 | [diff] [blame] | 1598 | adapter->hdd_wmm_status.qap = false; |
Jeff Johnson | 8f656c6 | 2019-03-09 08:48:27 -0800 | [diff] [blame] | 1599 | INIT_LIST_HEAD(&adapter->hdd_wmm_status.context_list); |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 1600 | mutex_init(&adapter->hdd_wmm_status.mutex); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1601 | |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1602 | for (ac_type = 0; ac_type < WLAN_MAX_AC; ac_type++) { |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 1603 | ac_status = &adapter->hdd_wmm_status.ac_status[ac_type]; |
Jeff Johnson | 30ac84f | 2019-03-09 13:57:57 -0800 | [diff] [blame] | 1604 | ac_status->is_access_required = false; |
Jeff Johnson | 12ccaf6 | 2019-03-09 13:59:53 -0800 | [diff] [blame] | 1605 | ac_status->is_access_needed = false; |
Jeff Johnson | e5b75be | 2019-03-09 14:07:35 -0800 | [diff] [blame] | 1606 | ac_status->is_access_pending = false; |
Jeff Johnson | 1b48ccb | 2019-03-09 14:15:57 -0800 | [diff] [blame] | 1607 | ac_status->has_access_failed = false; |
Jeff Johnson | c77123d | 2019-03-09 14:18:34 -0800 | [diff] [blame] | 1608 | ac_status->was_access_granted = false; |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 1609 | ac_status->is_access_allowed = false; |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 1610 | ac_status->is_tspec_valid = false; |
Jeff Johnson | fd29709 | 2019-03-09 14:29:20 -0800 | [diff] [blame] | 1611 | ac_status->is_uapsd_info_valid = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1612 | } |
| 1613 | /* Invalid value(0xff) to indicate psb not configured through |
| 1614 | * framework initially. |
| 1615 | */ |
Jeff Johnson | 137c8ee | 2017-10-28 13:06:48 -0700 | [diff] [blame] | 1616 | adapter->configured_psb = HDD_PSB_CFG_INVALID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1617 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1618 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1619 | } |
| 1620 | |
| 1621 | /** |
| 1622 | * hdd_wmm_adapter_clear() - Function which will clear the WMM status |
| 1623 | * for all the ACs |
| 1624 | * |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1625 | * @adapter: [in] pointer to Adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1626 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1627 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1628 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1629 | QDF_STATUS hdd_wmm_adapter_clear(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1630 | { |
Jeff Johnson | d37476e | 2019-03-08 20:20:30 -0800 | [diff] [blame] | 1631 | struct hdd_wmm_ac_status *ac_status; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1632 | sme_ac_enum_type ac_type; |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 1633 | |
Dustin Brown | 491d54b | 2018-03-14 12:39:11 -0700 | [diff] [blame] | 1634 | hdd_enter(); |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1635 | for (ac_type = 0; ac_type < WLAN_MAX_AC; ac_type++) { |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 1636 | ac_status = &adapter->hdd_wmm_status.ac_status[ac_type]; |
Jeff Johnson | 30ac84f | 2019-03-09 13:57:57 -0800 | [diff] [blame] | 1637 | ac_status->is_access_required = false; |
Jeff Johnson | 12ccaf6 | 2019-03-09 13:59:53 -0800 | [diff] [blame] | 1638 | ac_status->is_access_needed = false; |
Jeff Johnson | e5b75be | 2019-03-09 14:07:35 -0800 | [diff] [blame] | 1639 | ac_status->is_access_pending = false; |
Jeff Johnson | 1b48ccb | 2019-03-09 14:15:57 -0800 | [diff] [blame] | 1640 | ac_status->has_access_failed = false; |
Jeff Johnson | c77123d | 2019-03-09 14:18:34 -0800 | [diff] [blame] | 1641 | ac_status->was_access_granted = false; |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 1642 | ac_status->is_access_allowed = false; |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 1643 | ac_status->is_tspec_valid = false; |
Jeff Johnson | fd29709 | 2019-03-09 14:29:20 -0800 | [diff] [blame] | 1644 | ac_status->is_uapsd_info_valid = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1645 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1646 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1647 | } |
| 1648 | |
| 1649 | /** |
| 1650 | * hdd_wmm_close() - WMM close function |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1651 | * @adapter: [in] pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1652 | * |
| 1653 | * Function which will perform any necessary work to to clean up the |
| 1654 | * WMM functionality prior to the kernel module unload. |
| 1655 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1656 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1657 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1658 | QDF_STATUS hdd_wmm_adapter_close(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1659 | { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 1660 | struct hdd_wmm_qos_context *qos_context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1661 | |
Dustin Brown | 491d54b | 2018-03-14 12:39:11 -0700 | [diff] [blame] | 1662 | hdd_enter(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1663 | |
| 1664 | /* free any context records that we still have linked */ |
Jeff Johnson | 8f656c6 | 2019-03-09 08:48:27 -0800 | [diff] [blame] | 1665 | while (!list_empty(&adapter->hdd_wmm_status.context_list)) { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 1666 | qos_context = |
Jeff Johnson | 8f656c6 | 2019-03-09 08:48:27 -0800 | [diff] [blame] | 1667 | list_first_entry(&adapter->hdd_wmm_status.context_list, |
Srinivas Girigowda | ea32d6a | 2017-03-25 00:03:12 -0700 | [diff] [blame] | 1668 | struct hdd_wmm_qos_context, node); |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 1669 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 1670 | hdd_wmm_disable_inactivity_timer(qos_context); |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 1671 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 1672 | if (qos_context->handle == HDD_WMM_HANDLE_IMPLICIT |
| 1673 | && qos_context->magic == HDD_WMM_CTX_MAGIC) |
Jeff Johnson | 7d4a0b5 | 2019-03-08 22:06:32 -0800 | [diff] [blame] | 1674 | cds_flush_work(&qos_context->implicit_qos_work); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1675 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 1676 | hdd_wmm_free_context(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1677 | } |
| 1678 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1679 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1680 | } |
| 1681 | |
| 1682 | /** |
| 1683 | * hdd_wmm_classify_pkt() - Function which will classify an OS packet |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1684 | * into a WMM AC based on DSCP |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1685 | * |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1686 | * @adapter: adapter upon which the packet is being transmitted |
| 1687 | * @skb: pointer to network buffer |
| 1688 | * @user_pri: user priority of the OS packet |
| 1689 | * @is_eapol: eapol packet flag |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1690 | * |
| 1691 | * Return: None |
| 1692 | */ |
| 1693 | static |
Jeff Johnson | 5b8b67d | 2017-08-29 14:16:53 -0700 | [diff] [blame] | 1694 | void hdd_wmm_classify_pkt(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1695 | struct sk_buff *skb, |
Abhishek Singh | 12be60f | 2017-08-11 13:52:42 +0530 | [diff] [blame] | 1696 | enum sme_qos_wmmuptype *user_pri, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1697 | bool *is_eapol) |
| 1698 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1699 | unsigned char dscp; |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1700 | unsigned char tos; |
| 1701 | union generic_ethhdr *eth_hdr; |
| 1702 | struct iphdr *ip_hdr; |
| 1703 | struct ipv6hdr *ipv6hdr; |
| 1704 | unsigned char *pkt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1705 | |
| 1706 | /* this code is executed for every packet therefore |
| 1707 | * all debug code is kept conditional |
| 1708 | */ |
| 1709 | |
| 1710 | #ifdef HDD_WMM_DEBUG |
Dustin Brown | 491d54b | 2018-03-14 12:39:11 -0700 | [diff] [blame] | 1711 | hdd_enter(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1712 | #endif /* HDD_WMM_DEBUG */ |
| 1713 | |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1714 | pkt = skb->data; |
| 1715 | eth_hdr = (union generic_ethhdr *)pkt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1716 | |
| 1717 | #ifdef HDD_WMM_DEBUG |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1718 | hdd_debug("proto is 0x%04x", skb->protocol); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1719 | #endif /* HDD_WMM_DEBUG */ |
| 1720 | |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1721 | if (eth_hdr->eth_II.h_proto == htons(ETH_P_IP)) { |
| 1722 | /* case 1: Ethernet II IP packet */ |
| 1723 | ip_hdr = (struct iphdr *)&pkt[sizeof(eth_hdr->eth_II)]; |
| 1724 | tos = ip_hdr->tos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1725 | #ifdef HDD_WMM_DEBUG |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1726 | hdd_debug("Ethernet II IP Packet, tos is %d", tos); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1727 | #endif /* HDD_WMM_DEBUG */ |
| 1728 | |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1729 | } else if (eth_hdr->eth_II.h_proto == htons(ETH_P_IPV6)) { |
| 1730 | ipv6hdr = ipv6_hdr(skb); |
| 1731 | tos = ntohs(*(const __be16 *)ipv6hdr) >> 4; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1732 | #ifdef HDD_WMM_DEBUG |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1733 | hdd_debug("Ethernet II IPv6 Packet, tos is %d", tos); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1734 | #endif /* HDD_WMM_DEBUG */ |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1735 | } else if ((ntohs(eth_hdr->eth_II.h_proto) < WLAN_MIN_PROTO) && |
| 1736 | (eth_hdr->eth_8023.h_snap.dsap == WLAN_SNAP_DSAP) && |
| 1737 | (eth_hdr->eth_8023.h_snap.ssap == WLAN_SNAP_SSAP) && |
| 1738 | (eth_hdr->eth_8023.h_snap.ctrl == WLAN_SNAP_CTRL) && |
| 1739 | (eth_hdr->eth_8023.h_proto == htons(ETH_P_IP))) { |
| 1740 | /* case 2: 802.3 LLC/SNAP IP packet */ |
| 1741 | ip_hdr = (struct iphdr *)&pkt[sizeof(eth_hdr->eth_8023)]; |
| 1742 | tos = ip_hdr->tos; |
| 1743 | #ifdef HDD_WMM_DEBUG |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1744 | hdd_debug("802.3 LLC/SNAP IP Packet, tos is %d", tos); |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1745 | #endif /* HDD_WMM_DEBUG */ |
| 1746 | } else if (eth_hdr->eth_II.h_proto == htons(ETH_P_8021Q)) { |
| 1747 | /* VLAN tagged */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1748 | |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1749 | if (eth_hdr->eth_IIv.h_vlan_encapsulated_proto == |
| 1750 | htons(ETH_P_IP)) { |
| 1751 | /* case 3: Ethernet II vlan-tagged IP packet */ |
| 1752 | ip_hdr = |
| 1753 | (struct iphdr *) |
| 1754 | &pkt[sizeof(eth_hdr->eth_IIv)]; |
| 1755 | tos = ip_hdr->tos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1756 | #ifdef HDD_WMM_DEBUG |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1757 | hdd_debug("Ether II VLAN tagged IP Packet, tos is %d", |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 1758 | tos); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1759 | #endif /* HDD_WMM_DEBUG */ |
Srinivas Girigowda | 683726a | 2018-09-07 15:10:40 -0700 | [diff] [blame] | 1760 | } else if ((ntohs(eth_hdr->eth_IIv.h_vlan_encapsulated_proto) |
| 1761 | < WLAN_MIN_PROTO) && |
| 1762 | (eth_hdr->eth_8023v.h_snap.dsap == |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1763 | WLAN_SNAP_DSAP) |
| 1764 | && (eth_hdr->eth_8023v.h_snap.ssap == |
| 1765 | WLAN_SNAP_SSAP) |
| 1766 | && (eth_hdr->eth_8023v.h_snap.ctrl == |
| 1767 | WLAN_SNAP_CTRL) |
| 1768 | && (eth_hdr->eth_8023v.h_proto == |
| 1769 | htons(ETH_P_IP))) { |
| 1770 | /* case 4: 802.3 LLC/SNAP vlan-tagged IP packet */ |
| 1771 | ip_hdr = |
| 1772 | (struct iphdr *) |
| 1773 | &pkt[sizeof(eth_hdr->eth_8023v)]; |
| 1774 | tos = ip_hdr->tos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1775 | #ifdef HDD_WMM_DEBUG |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1776 | hdd_debug("802.3 LLC/SNAP VLAN tagged IP Packet, tos is %d", |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 1777 | tos); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1778 | #endif /* HDD_WMM_DEBUG */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1779 | } else { |
| 1780 | /* default */ |
| 1781 | #ifdef HDD_WMM_DEBUG |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 1782 | hdd_warn("VLAN tagged Unhandled Protocol, using default tos"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1783 | #endif /* HDD_WMM_DEBUG */ |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1784 | tos = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1785 | } |
| 1786 | } else { |
| 1787 | /* default */ |
| 1788 | #ifdef HDD_WMM_DEBUG |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 1789 | hdd_warn("Unhandled Protocol, using default tos"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1790 | #endif /* HDD_WMM_DEBUG */ |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1791 | /* Give the highest priority to 802.1x packet */ |
| 1792 | if (eth_hdr->eth_II.h_proto == |
| 1793 | htons(HDD_ETHERTYPE_802_1_X)) { |
| 1794 | tos = 0xC0; |
| 1795 | *is_eapol = true; |
| 1796 | } else |
| 1797 | tos = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1798 | } |
| 1799 | |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1800 | dscp = (tos >> 2) & 0x3f; |
Jeff Johnson | 6b51b6a | 2017-11-02 20:31:25 -0700 | [diff] [blame] | 1801 | *user_pri = adapter->dscp_to_up_map[dscp]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1802 | |
| 1803 | #ifdef HDD_WMM_DEBUG |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1804 | hdd_debug("tos is %d, dscp is %d, up is %d", tos, dscp, *user_pri); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1805 | #endif /* HDD_WMM_DEBUG */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1806 | } |
| 1807 | |
Jeff Johnson | e54e2ae | 2016-07-18 17:56:20 -0700 | [diff] [blame] | 1808 | /** |
| 1809 | * __hdd_get_queue_index() - get queue index |
| 1810 | * @up: user priority |
| 1811 | * |
| 1812 | * Return: queue_index |
| 1813 | */ |
| 1814 | static uint16_t __hdd_get_queue_index(uint16_t up) |
| 1815 | { |
| 1816 | if (qdf_unlikely(up >= ARRAY_SIZE(hdd_linux_up_to_ac_map))) |
| 1817 | return HDD_LINUX_AC_BE; |
| 1818 | return hdd_linux_up_to_ac_map[up]; |
| 1819 | } |
| 1820 | |
hangtian | b9c9136 | 2019-06-07 10:39:38 +0800 | [diff] [blame] | 1821 | #if defined(QCA_LL_TX_FLOW_CONTROL_V2) || \ |
| 1822 | defined(QCA_HL_NETDEV_FLOW_CONTROL) || \ |
| 1823 | defined(QCA_LL_PDEV_TX_FLOW_CONTROL) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1824 | /** |
| 1825 | * hdd_get_queue_index() - get queue index |
| 1826 | * @up: user priority |
| 1827 | * @is_eapol: is_eapol flag |
| 1828 | * |
| 1829 | * Return: queue_index |
| 1830 | */ |
| 1831 | static |
| 1832 | uint16_t hdd_get_queue_index(uint16_t up, bool is_eapol) |
| 1833 | { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1834 | if (qdf_unlikely(is_eapol == true)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1835 | return HDD_LINUX_AC_HI_PRIO; |
Jeff Johnson | e54e2ae | 2016-07-18 17:56:20 -0700 | [diff] [blame] | 1836 | return __hdd_get_queue_index(up); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1837 | } |
| 1838 | #else |
| 1839 | static |
| 1840 | uint16_t hdd_get_queue_index(uint16_t up, bool is_eapol) |
| 1841 | { |
Jeff Johnson | e54e2ae | 2016-07-18 17:56:20 -0700 | [diff] [blame] | 1842 | return __hdd_get_queue_index(up); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1843 | } |
| 1844 | #endif |
| 1845 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1846 | /** |
| 1847 | * hdd_wmm_select_queue() - Function which will classify the packet |
| 1848 | * according to linux qdisc expectation. |
| 1849 | * |
| 1850 | * @dev: [in] pointer to net_device structure |
| 1851 | * @skb: [in] pointer to os packet |
| 1852 | * |
| 1853 | * Return: Qdisc queue index |
| 1854 | */ |
Manjunathappa Prakash | 7114007 | 2019-01-31 09:40:23 -0800 | [diff] [blame] | 1855 | static uint16_t hdd_wmm_select_queue(struct net_device *dev, |
| 1856 | struct sk_buff *skb) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1857 | { |
Abhishek Singh | 12be60f | 2017-08-11 13:52:42 +0530 | [diff] [blame] | 1858 | enum sme_qos_wmmuptype up = SME_QOS_WMM_UP_BE; |
Jeff Johnson | 55c4388 | 2019-03-09 15:59:55 -0800 | [diff] [blame] | 1859 | uint16_t index; |
Rakesh Pillai | 3e534db | 2017-09-26 18:59:43 +0530 | [diff] [blame] | 1860 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1861 | bool is_crtical = false; |
| 1862 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Mukul Sharma | bfd19ba | 2015-10-30 20:35:35 +0530 | [diff] [blame] | 1863 | int status; |
Rakesh Pillai | 3e534db | 2017-09-26 18:59:43 +0530 | [diff] [blame] | 1864 | enum qdf_proto_subtype proto_subtype; |
Mukul Sharma | bfd19ba | 2015-10-30 20:35:35 +0530 | [diff] [blame] | 1865 | |
| 1866 | status = wlan_hdd_validate_context(hdd_ctx); |
| 1867 | if (status != 0) { |
| 1868 | skb->priority = SME_QOS_WMM_UP_BE; |
| 1869 | return HDD_LINUX_AC_BE; |
| 1870 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1871 | |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1872 | /* Get the user priority from IP header */ |
Rakesh Pillai | 3e534db | 2017-09-26 18:59:43 +0530 | [diff] [blame] | 1873 | hdd_wmm_classify_pkt(adapter, skb, &up, &is_crtical); |
| 1874 | spin_lock_bh(&adapter->pause_map_lock); |
| 1875 | if ((adapter->pause_map & (1 << WLAN_DATA_FLOW_CONTROL)) && |
| 1876 | !(adapter->pause_map & (1 << WLAN_DATA_FLOW_CONTROL_PRIORITY))) { |
| 1877 | if (qdf_nbuf_is_ipv4_arp_pkt(skb)) |
| 1878 | is_crtical = true; |
| 1879 | else if (qdf_nbuf_is_icmpv6_pkt(skb)) { |
| 1880 | proto_subtype = qdf_nbuf_get_icmpv6_subtype(skb); |
| 1881 | switch (proto_subtype) { |
| 1882 | case QDF_PROTO_ICMPV6_NA: |
| 1883 | case QDF_PROTO_ICMPV6_NS: |
| 1884 | is_crtical = true; |
| 1885 | break; |
| 1886 | default: |
| 1887 | break; |
| 1888 | } |
| 1889 | } |
| 1890 | } |
| 1891 | spin_unlock_bh(&adapter->pause_map_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1892 | skb->priority = up; |
Jeff Johnson | 55c4388 | 2019-03-09 15:59:55 -0800 | [diff] [blame] | 1893 | index = hdd_get_queue_index(skb->priority, is_crtical); |
Govind Singh | b7ab577 | 2015-10-08 16:38:37 +0530 | [diff] [blame] | 1894 | |
Jeff Johnson | 55c4388 | 2019-03-09 15:59:55 -0800 | [diff] [blame] | 1895 | return index; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1896 | } |
| 1897 | |
Saket Jha | a842ded | 2019-11-22 15:50:11 -0800 | [diff] [blame] | 1898 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) |
| 1899 | uint16_t hdd_select_queue(struct net_device *dev, struct sk_buff *skb, |
| 1900 | struct net_device *sb_dev) |
| 1901 | { |
| 1902 | return hdd_wmm_select_queue(dev, skb); |
| 1903 | } |
| 1904 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) |
Manjunathappa Prakash | 666898e | 2019-01-31 10:01:15 -0800 | [diff] [blame] | 1905 | uint16_t hdd_select_queue(struct net_device *dev, struct sk_buff *skb, |
| 1906 | struct net_device *sb_dev, |
| 1907 | select_queue_fallback_t fallback) |
Manjunathappa Prakash | 7114007 | 2019-01-31 09:40:23 -0800 | [diff] [blame] | 1908 | { |
| 1909 | return hdd_wmm_select_queue(dev, skb); |
| 1910 | } |
Manjunathappa Prakash | 666898e | 2019-01-31 10:01:15 -0800 | [diff] [blame] | 1911 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) |
| 1912 | uint16_t hdd_select_queue(struct net_device *dev, struct sk_buff *skb, |
| 1913 | void *accel_priv, select_queue_fallback_t fallback) |
| 1914 | { |
| 1915 | return hdd_wmm_select_queue(dev, skb); |
| 1916 | } |
| 1917 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)) |
| 1918 | uint16_t hdd_select_queue(struct net_device *dev, struct sk_buff *skb, |
| 1919 | void *accel_priv) |
| 1920 | { |
| 1921 | return hdd_wmm_select_queue(dev, skb); |
| 1922 | } |
| 1923 | #else |
| 1924 | uint16_t hdd_select_queue(struct net_device *dev, struct sk_buff *skb) |
| 1925 | { |
| 1926 | return hdd_wmm_select_queue(dev, skb); |
| 1927 | } |
| 1928 | #endif |
| 1929 | |
Manjunathappa Prakash | 7114007 | 2019-01-31 09:40:23 -0800 | [diff] [blame] | 1930 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1931 | /** |
| 1932 | * hdd_wmm_acquire_access_required() - Function which will determine |
| 1933 | * acquire admittance for a WMM AC is required or not based on psb configuration |
| 1934 | * done in framework |
| 1935 | * |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1936 | * @adapter: [in] pointer to adapter structure |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1937 | * @ac_type: [in] WMM AC type of OS packet |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1938 | * |
| 1939 | * Return: void |
| 1940 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1941 | void hdd_wmm_acquire_access_required(struct hdd_adapter *adapter, |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1942 | sme_ac_enum_type ac_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1943 | { |
| 1944 | /* Each bit in the LSB nibble indicates 1 AC. |
| 1945 | * Clearing the particular bit in LSB nibble to indicate |
| 1946 | * access required |
| 1947 | */ |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1948 | switch (ac_type) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1949 | case SME_AC_BK: |
| 1950 | /* clear first bit */ |
Jeff Johnson | 137c8ee | 2017-10-28 13:06:48 -0700 | [diff] [blame] | 1951 | adapter->psb_changed &= ~SME_QOS_UAPSD_CFG_BK_CHANGED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1952 | break; |
| 1953 | case SME_AC_BE: |
| 1954 | /* clear second bit */ |
Jeff Johnson | 137c8ee | 2017-10-28 13:06:48 -0700 | [diff] [blame] | 1955 | adapter->psb_changed &= ~SME_QOS_UAPSD_CFG_BE_CHANGED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1956 | break; |
| 1957 | case SME_AC_VI: |
| 1958 | /* clear third bit */ |
Jeff Johnson | 137c8ee | 2017-10-28 13:06:48 -0700 | [diff] [blame] | 1959 | adapter->psb_changed &= ~SME_QOS_UAPSD_CFG_VI_CHANGED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1960 | break; |
| 1961 | case SME_AC_VO: |
| 1962 | /* clear fourth bit */ |
Jeff Johnson | 137c8ee | 2017-10-28 13:06:48 -0700 | [diff] [blame] | 1963 | adapter->psb_changed &= ~SME_QOS_UAPSD_CFG_VO_CHANGED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1964 | break; |
| 1965 | default: |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 1966 | hdd_err("Invalid AC Type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1967 | break; |
| 1968 | } |
| 1969 | } |
| 1970 | |
| 1971 | /** |
| 1972 | * hdd_wmm_acquire_access() - Function which will attempt to acquire |
| 1973 | * admittance for a WMM AC |
| 1974 | * |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1975 | * @adapter: [in] pointer to adapter context |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1976 | * @ac_type: [in] WMM AC type of OS packet |
Jeff Johnson | a9f092a | 2019-03-08 19:17:23 -0800 | [diff] [blame] | 1977 | * @granted: [out] pointer to bool flag when indicates if access |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1978 | * has been granted or not |
| 1979 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1980 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1981 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 1982 | QDF_STATUS hdd_wmm_acquire_access(struct hdd_adapter *adapter, |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1983 | sme_ac_enum_type ac_type, bool *granted) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1984 | { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 1985 | struct hdd_wmm_qos_context *qos_context; |
Abhinav Kumar | 7d6f1ac | 2018-09-01 18:33:56 +0530 | [diff] [blame] | 1986 | struct hdd_context *hdd_ctx; |
| 1987 | bool enable; |
| 1988 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1989 | |
| 1990 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1991 | |
Rajeev Kumar | 3d4b1ef | 2016-01-29 15:57:26 -0800 | [diff] [blame] | 1992 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 1993 | "%s: Entered for AC %d", __func__, ac_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1994 | |
Abhinav Kumar | 7d6f1ac | 2018-09-01 18:33:56 +0530 | [diff] [blame] | 1995 | status = ucfg_mlme_get_implicit_qos_is_enabled(hdd_ctx->psoc, &enable); |
| 1996 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 1997 | hdd_err("Get implicit_qos_is_enabled failed"); |
| 1998 | } |
| 1999 | if (!hdd_wmm_is_active(adapter) || !(enable) || |
Jeff Johnson | 30ac84f | 2019-03-09 13:57:57 -0800 | [diff] [blame] | 2000 | !adapter->hdd_wmm_status.ac_status[ac_type].is_access_required) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2001 | /* either we don't want QoS or the AP doesn't support |
| 2002 | * QoS or we don't want to do implicit QoS |
| 2003 | */ |
Rajeev Kumar | 3d4b1ef | 2016-01-29 15:57:26 -0800 | [diff] [blame] | 2004 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2005 | "%s: QoS not configured on both ends ", __func__); |
| 2006 | |
Jeff Johnson | a9f092a | 2019-03-08 19:17:23 -0800 | [diff] [blame] | 2007 | *granted = |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2008 | adapter->hdd_wmm_status.ac_status[ac_type]. |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 2009 | is_access_allowed; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2010 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2011 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2012 | } |
| 2013 | /* do we already have an implicit QoS request pending for this AC? */ |
Jeff Johnson | 12ccaf6 | 2019-03-09 13:59:53 -0800 | [diff] [blame] | 2014 | if ((adapter->hdd_wmm_status.ac_status[ac_type].is_access_needed) || |
Jeff Johnson | e5b75be | 2019-03-09 14:07:35 -0800 | [diff] [blame] | 2015 | (adapter->hdd_wmm_status.ac_status[ac_type].is_access_pending)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2016 | /* request already pending so we need to wait for that |
| 2017 | * response |
| 2018 | */ |
Rajeev Kumar | 3d4b1ef | 2016-01-29 15:57:26 -0800 | [diff] [blame] | 2019 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2020 | "%s: Implicit QoS for TL AC %d already scheduled", |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 2021 | __func__, ac_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2022 | |
Jeff Johnson | a9f092a | 2019-03-08 19:17:23 -0800 | [diff] [blame] | 2023 | *granted = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2024 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2025 | } |
| 2026 | /* did we already fail to establish implicit QoS for this AC? |
| 2027 | * (if so, access should have been granted when the failure |
| 2028 | * was handled) |
| 2029 | */ |
Jeff Johnson | 1b48ccb | 2019-03-09 14:15:57 -0800 | [diff] [blame] | 2030 | if (adapter->hdd_wmm_status.ac_status[ac_type].has_access_failed) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2031 | /* request previously failed |
| 2032 | * allow access, but we'll be downgraded |
| 2033 | */ |
Rajeev Kumar | 3d4b1ef | 2016-01-29 15:57:26 -0800 | [diff] [blame] | 2034 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2035 | "%s: Implicit QoS for TL AC %d previously failed", |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 2036 | __func__, ac_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2037 | |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2038 | if (!adapter->hdd_wmm_status.ac_status[ac_type]. |
Jeff Johnson | 30ac84f | 2019-03-09 13:57:57 -0800 | [diff] [blame] | 2039 | is_access_required) { |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2040 | adapter->hdd_wmm_status.ac_status[ac_type]. |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 2041 | is_access_allowed = true; |
Jeff Johnson | a9f092a | 2019-03-08 19:17:23 -0800 | [diff] [blame] | 2042 | *granted = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2043 | } else { |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2044 | adapter->hdd_wmm_status.ac_status[ac_type]. |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 2045 | is_access_allowed = false; |
Jeff Johnson | a9f092a | 2019-03-08 19:17:23 -0800 | [diff] [blame] | 2046 | *granted = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2047 | } |
| 2048 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2049 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2050 | } |
| 2051 | /* we need to establish implicit QoS */ |
Rajeev Kumar | 3d4b1ef | 2016-01-29 15:57:26 -0800 | [diff] [blame] | 2052 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2053 | "%s: Need to schedule implicit QoS for TL AC %d, adapter is %pK", |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 2054 | __func__, ac_type, adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2055 | |
Jeff Johnson | 12ccaf6 | 2019-03-09 13:59:53 -0800 | [diff] [blame] | 2056 | adapter->hdd_wmm_status.ac_status[ac_type].is_access_needed = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2057 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2058 | qos_context = qdf_mem_malloc(sizeof(*qos_context)); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2059 | if (!qos_context) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2060 | /* no memory for QoS context. Nothing we can do but |
| 2061 | * let data flow |
| 2062 | */ |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 2063 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2064 | "%s: Unable to allocate context", __func__); |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 2065 | adapter->hdd_wmm_status.ac_status[ac_type].is_access_allowed = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2066 | true; |
Jeff Johnson | a9f092a | 2019-03-08 19:17:23 -0800 | [diff] [blame] | 2067 | *granted = true; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2068 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2069 | } |
| 2070 | |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 2071 | qos_context->ac_type = ac_type; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2072 | qos_context->adapter = adapter; |
Jeff Johnson | 104f70e | 2019-03-08 19:29:33 -0800 | [diff] [blame] | 2073 | qos_context->flow_id = 0; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2074 | qos_context->handle = HDD_WMM_HANDLE_IMPLICIT; |
| 2075 | qos_context->magic = HDD_WMM_CTX_MAGIC; |
| 2076 | qos_context->is_inactivity_timer_running = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2077 | |
Jeff Johnson | 7d4a0b5 | 2019-03-08 22:06:32 -0800 | [diff] [blame] | 2078 | INIT_WORK(&qos_context->implicit_qos_work, hdd_wmm_do_implicit_qos); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2079 | |
Rajeev Kumar | 3d4b1ef | 2016-01-29 15:57:26 -0800 | [diff] [blame] | 2080 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 2081 | "%s: Scheduling work for AC %d, context %pK", |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 2082 | __func__, ac_type, qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2083 | |
Jeff Johnson | 7d4a0b5 | 2019-03-08 22:06:32 -0800 | [diff] [blame] | 2084 | schedule_work(&qos_context->implicit_qos_work); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2085 | |
| 2086 | /* caller will need to wait until the work takes place and |
| 2087 | * TSPEC negotiation completes |
| 2088 | */ |
Jeff Johnson | a9f092a | 2019-03-08 19:17:23 -0800 | [diff] [blame] | 2089 | *granted = false; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2090 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2091 | } |
| 2092 | |
| 2093 | /** |
| 2094 | * hdd_wmm_assoc() - Function which will handle the housekeeping |
| 2095 | * required by WMM when association takes place |
| 2096 | * |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2097 | * @adapter: [in] pointer to adapter context |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2098 | * @roam_info: [in] pointer to roam information |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 2099 | * @bss_type: [in] type of BSS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2100 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2101 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2102 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2103 | QDF_STATUS hdd_wmm_assoc(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2104 | struct csr_roam_info *roam_info, |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 2105 | eCsrRoamBssType bss_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2106 | { |
Jeff Johnson | c7776f2 | 2019-03-09 16:09:31 -0800 | [diff] [blame] | 2107 | uint8_t uapsd_mask; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2108 | QDF_STATUS status; |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 2109 | uint32_t srv_value = 0; |
| 2110 | uint32_t sus_value = 0; |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2111 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Abhinav Kumar | c8c2150 | 2018-12-05 15:17:39 +0530 | [diff] [blame] | 2112 | uint32_t delayed_trgr_frm_int; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2113 | |
| 2114 | /* when we associate we need to notify TL if it needs to |
| 2115 | * enable UAPSD for any access categories |
| 2116 | */ |
| 2117 | |
Dustin Brown | 491d54b | 2018-03-14 12:39:11 -0700 | [diff] [blame] | 2118 | hdd_enter(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2119 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2120 | if (roam_info->fReassocReq) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2121 | /* when we reassociate we should continue to use |
| 2122 | * whatever parameters were previously established. |
| 2123 | * if we are reassociating due to a U-APSD change for |
| 2124 | * a particular Access Category, then the change will |
| 2125 | * be communicated to HDD via the QoS callback |
| 2126 | * associated with the given flow, and U-APSD |
| 2127 | * parameters will be updated there |
| 2128 | */ |
| 2129 | |
Varun Reddy Yeturu | dd51e8d | 2017-05-14 14:51:13 -0700 | [diff] [blame] | 2130 | hdd_debug("Reassoc so no work, Exiting"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2131 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2132 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2133 | } |
| 2134 | /* get the negotiated UAPSD Mask */ |
Jeff Johnson | c7776f2 | 2019-03-09 16:09:31 -0800 | [diff] [blame] | 2135 | uapsd_mask = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2136 | roam_info->u.pConnectedProfile->modifyProfileFields.uapsd_mask; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2137 | |
Jeff Johnson | c7776f2 | 2019-03-09 16:09:31 -0800 | [diff] [blame] | 2138 | hdd_debug("U-APSD mask is 0x%02x", (int)uapsd_mask); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2139 | |
Abhinav Kumar | c8c2150 | 2018-12-05 15:17:39 +0530 | [diff] [blame] | 2140 | ucfg_mlme_get_tl_delayed_trgr_frm_int(hdd_ctx->psoc, |
| 2141 | &delayed_trgr_frm_int); |
| 2142 | |
Jeff Johnson | c7776f2 | 2019-03-09 16:09:31 -0800 | [diff] [blame] | 2143 | if (uapsd_mask & HDD_AC_VO) { |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 2144 | status = ucfg_mlme_get_wmm_uapsd_vo_srv_intv(hdd_ctx->psoc, |
| 2145 | &srv_value); |
| 2146 | if (QDF_IS_STATUS_ERROR(status)) { |
| 2147 | hdd_err("Get uapsd_srv_intv failed"); |
| 2148 | return QDF_STATUS_SUCCESS; |
| 2149 | } |
| 2150 | status = ucfg_mlme_get_wmm_uapsd_vo_sus_intv(hdd_ctx->psoc, |
| 2151 | &sus_value); |
| 2152 | if (QDF_IS_STATUS_ERROR(status)) { |
| 2153 | hdd_err("Get uapsd_vo_sus_intv failed"); |
| 2154 | return QDF_STATUS_SUCCESS; |
| 2155 | } |
| 2156 | |
| 2157 | status = sme_enable_uapsd_for_ac( |
Abhinav Kumar | 18b45cd | 2018-09-21 12:35:22 +0530 | [diff] [blame] | 2158 | SME_AC_VO, 7, 7, srv_value, sus_value, |
| 2159 | SME_QOS_WMM_TS_DIR_BOTH, 1, |
Jeff Johnson | 9597f3b | 2019-02-04 14:27:56 -0800 | [diff] [blame] | 2160 | adapter->vdev_id, |
Abhinav Kumar | c8c2150 | 2018-12-05 15:17:39 +0530 | [diff] [blame] | 2161 | delayed_trgr_frm_int); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2162 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2163 | QDF_ASSERT(QDF_IS_STATUS_SUCCESS(status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2164 | } |
| 2165 | |
Jeff Johnson | c7776f2 | 2019-03-09 16:09:31 -0800 | [diff] [blame] | 2166 | if (uapsd_mask & HDD_AC_VI) { |
Abhinav Kumar | 4c8e026 | 2018-10-06 16:50:27 +0530 | [diff] [blame] | 2167 | status = ucfg_mlme_get_wmm_uapsd_vi_srv_intv( |
| 2168 | hdd_ctx->psoc, &srv_value); |
| 2169 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 2170 | hdd_err("Get uapsd_vi_srv_intv failed"); |
| 2171 | return QDF_STATUS_SUCCESS; |
| 2172 | } |
| 2173 | status = ucfg_mlme_get_wmm_uapsd_vi_sus_intv( |
| 2174 | hdd_ctx->psoc, &sus_value); |
| 2175 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 2176 | hdd_err("Get uapsd_vi_sus_intv failed"); |
| 2177 | return QDF_STATUS_SUCCESS; |
| 2178 | } |
| 2179 | |
| 2180 | status = sme_enable_uapsd_for_ac( |
Abhinav Kumar | 4c8e026 | 2018-10-06 16:50:27 +0530 | [diff] [blame] | 2181 | SME_AC_VI, 5, 5, srv_value, sus_value, |
| 2182 | SME_QOS_WMM_TS_DIR_BOTH, 1, |
Jeff Johnson | 9597f3b | 2019-02-04 14:27:56 -0800 | [diff] [blame] | 2183 | adapter->vdev_id, |
Abhinav Kumar | c8c2150 | 2018-12-05 15:17:39 +0530 | [diff] [blame] | 2184 | delayed_trgr_frm_int); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2185 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2186 | QDF_ASSERT(QDF_IS_STATUS_SUCCESS(status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2187 | } |
| 2188 | |
Jeff Johnson | c7776f2 | 2019-03-09 16:09:31 -0800 | [diff] [blame] | 2189 | if (uapsd_mask & HDD_AC_BK) { |
Abhinav Kumar | 2af8c12 | 2018-08-19 13:49:52 +0530 | [diff] [blame] | 2190 | status = ucfg_mlme_get_wmm_uapsd_bk_srv_intv(hdd_ctx->psoc, |
| 2191 | &srv_value); |
| 2192 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 2193 | hdd_err("Get uapsd_bk_srv_intv failed"); |
| 2194 | return QDF_STATUS_SUCCESS; |
| 2195 | } |
| 2196 | status = ucfg_mlme_get_wmm_uapsd_bk_sus_intv(hdd_ctx->psoc, |
| 2197 | &sus_value); |
| 2198 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 2199 | hdd_err("Get uapsd_bk_sus_intv failed"); |
| 2200 | return QDF_STATUS_SUCCESS; |
| 2201 | } |
| 2202 | |
| 2203 | status = sme_enable_uapsd_for_ac( |
Abhinav Kumar | 2af8c12 | 2018-08-19 13:49:52 +0530 | [diff] [blame] | 2204 | SME_AC_BK, 2, 2, srv_value, sus_value, |
| 2205 | SME_QOS_WMM_TS_DIR_BOTH, 1, |
Jeff Johnson | 9597f3b | 2019-02-04 14:27:56 -0800 | [diff] [blame] | 2206 | adapter->vdev_id, |
Abhinav Kumar | c8c2150 | 2018-12-05 15:17:39 +0530 | [diff] [blame] | 2207 | delayed_trgr_frm_int); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2208 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2209 | QDF_ASSERT(QDF_IS_STATUS_SUCCESS(status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2210 | } |
| 2211 | |
Jeff Johnson | c7776f2 | 2019-03-09 16:09:31 -0800 | [diff] [blame] | 2212 | if (uapsd_mask & HDD_AC_BE) { |
Abhinav Kumar | e94f248 | 2018-08-19 12:37:36 +0530 | [diff] [blame] | 2213 | status = ucfg_mlme_get_wmm_uapsd_be_srv_intv(hdd_ctx->psoc, |
| 2214 | &srv_value); |
| 2215 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 2216 | hdd_err("Get uapsd_be_srv_intv failed"); |
| 2217 | return QDF_STATUS_SUCCESS; |
| 2218 | } |
| 2219 | status = ucfg_mlme_get_wmm_uapsd_be_sus_intv(hdd_ctx->psoc, |
| 2220 | &sus_value); |
| 2221 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 2222 | hdd_err("Get uapsd_be_sus_intv failed"); |
| 2223 | return QDF_STATUS_SUCCESS; |
| 2224 | } |
| 2225 | |
| 2226 | status = sme_enable_uapsd_for_ac( |
Abhinav Kumar | e94f248 | 2018-08-19 12:37:36 +0530 | [diff] [blame] | 2227 | SME_AC_BE, 3, 3, srv_value, sus_value, |
| 2228 | SME_QOS_WMM_TS_DIR_BOTH, 1, |
Jeff Johnson | 9597f3b | 2019-02-04 14:27:56 -0800 | [diff] [blame] | 2229 | adapter->vdev_id, |
Abhinav Kumar | c8c2150 | 2018-12-05 15:17:39 +0530 | [diff] [blame] | 2230 | delayed_trgr_frm_int); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2231 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2232 | QDF_ASSERT(QDF_IS_STATUS_SUCCESS(status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2233 | } |
| 2234 | |
Jeff Johnson | cbbc78f | 2018-06-12 16:25:09 -0700 | [diff] [blame] | 2235 | status = sme_update_dsc_pto_up_mapping(hdd_ctx->mac_handle, |
Jeff Johnson | 6b51b6a | 2017-11-02 20:31:25 -0700 | [diff] [blame] | 2236 | adapter->dscp_to_up_map, |
Jeff Johnson | 9597f3b | 2019-02-04 14:27:56 -0800 | [diff] [blame] | 2237 | adapter->vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2238 | |
Srinivas Girigowda | 576b235 | 2017-08-25 14:44:26 -0700 | [diff] [blame] | 2239 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2240 | hdd_wmm_init(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2241 | |
Dustin Brown | e74003f | 2018-03-14 12:51:58 -0700 | [diff] [blame] | 2242 | hdd_exit(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2243 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2244 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2245 | } |
| 2246 | |
| 2247 | static const uint8_t acm_mask_bit[WLAN_MAX_AC] = { |
| 2248 | 0x4, /* SME_AC_BK */ |
| 2249 | 0x8, /* SME_AC_BE */ |
| 2250 | 0x2, /* SME_AC_VI */ |
| 2251 | 0x1 /* SME_AC_VO */ |
| 2252 | }; |
| 2253 | |
| 2254 | /** |
| 2255 | * hdd_wmm_connect() - Function which will handle the housekeeping |
| 2256 | * required by WMM when a connection is established |
| 2257 | * |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2258 | * @adapter : [in] pointer to adapter context |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2259 | * @roam_info: [in] pointer to roam information |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 2260 | * @bss_type : [in] type of BSS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2261 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2262 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2263 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2264 | QDF_STATUS hdd_wmm_connect(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2265 | struct csr_roam_info *roam_info, |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 2266 | eCsrRoamBssType bss_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2267 | { |
| 2268 | int ac; |
| 2269 | bool qap; |
Jeff Johnson | 5b98019 | 2019-03-08 23:01:20 -0800 | [diff] [blame] | 2270 | bool qos_connection; |
Jeff Johnson | c5449d7 | 2019-03-08 22:56:08 -0800 | [diff] [blame] | 2271 | uint8_t acm_mask; |
Jeff Johnson | cbbc78f | 2018-06-12 16:25:09 -0700 | [diff] [blame] | 2272 | mac_handle_t mac_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2273 | |
Dustin Brown | 491d54b | 2018-03-14 12:39:11 -0700 | [diff] [blame] | 2274 | hdd_enter(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2275 | |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 2276 | if ((eCSR_BSS_TYPE_INFRASTRUCTURE == bss_type) && |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2277 | roam_info && roam_info->u.pConnectedProfile) { |
| 2278 | qap = roam_info->u.pConnectedProfile->qap; |
Jeff Johnson | 5b98019 | 2019-03-08 23:01:20 -0800 | [diff] [blame] | 2279 | qos_connection = roam_info->u.pConnectedProfile->qosConnection; |
Jeff Johnson | c5449d7 | 2019-03-08 22:56:08 -0800 | [diff] [blame] | 2280 | acm_mask = roam_info->u.pConnectedProfile->acm_mask; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2281 | } else { |
| 2282 | qap = true; |
Jeff Johnson | 5b98019 | 2019-03-08 23:01:20 -0800 | [diff] [blame] | 2283 | qos_connection = true; |
Jeff Johnson | c5449d7 | 2019-03-08 22:56:08 -0800 | [diff] [blame] | 2284 | acm_mask = 0x0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2285 | } |
| 2286 | |
Jeff Johnson | 5b98019 | 2019-03-08 23:01:20 -0800 | [diff] [blame] | 2287 | hdd_debug("qap is %d, qos_connection is %d, acm_mask is 0x%x", |
| 2288 | qap, qos_connection, acm_mask); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2289 | |
Jeff Johnson | 26ef71e | 2019-03-08 23:24:29 -0800 | [diff] [blame] | 2290 | adapter->hdd_wmm_status.qap = qap; |
Jeff Johnson | 7f63ac9 | 2019-03-08 23:26:37 -0800 | [diff] [blame] | 2291 | adapter->hdd_wmm_status.qos_connection = qos_connection; |
Jeff Johnson | cbbc78f | 2018-06-12 16:25:09 -0700 | [diff] [blame] | 2292 | mac_handle = hdd_adapter_get_mac_handle(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2293 | |
| 2294 | for (ac = 0; ac < WLAN_MAX_AC; ac++) { |
Jeff Johnson | 5b98019 | 2019-03-08 23:01:20 -0800 | [diff] [blame] | 2295 | if (qap && qos_connection && (acm_mask & acm_mask_bit[ac])) { |
Varun Reddy Yeturu | dd51e8d | 2017-05-14 14:51:13 -0700 | [diff] [blame] | 2296 | hdd_debug("ac %d on", ac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2297 | |
| 2298 | /* admission is required */ |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2299 | adapter->hdd_wmm_status.ac_status[ac]. |
Jeff Johnson | 30ac84f | 2019-03-09 13:57:57 -0800 | [diff] [blame] | 2300 | is_access_required = true; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2301 | adapter->hdd_wmm_status.ac_status[ac]. |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 2302 | is_access_allowed = false; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2303 | adapter->hdd_wmm_status.ac_status[ac]. |
Jeff Johnson | c77123d | 2019-03-09 14:18:34 -0800 | [diff] [blame] | 2304 | was_access_granted = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2305 | /* after reassoc if we have valid tspec, allow access */ |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2306 | if (adapter->hdd_wmm_status.ac_status[ac]. |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 2307 | is_tspec_valid |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2308 | && (adapter->hdd_wmm_status.ac_status[ac]. |
Jeff Johnson | 64d94dd | 2019-03-09 14:31:14 -0800 | [diff] [blame] | 2309 | tspec.ts_info.direction != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2310 | SME_QOS_WMM_TS_DIR_DOWNLINK)) { |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2311 | adapter->hdd_wmm_status.ac_status[ac]. |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 2312 | is_access_allowed = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2313 | } |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2314 | if (!roam_info->fReassocReq && |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 2315 | !sme_neighbor_roam_is11r_assoc( |
Jeff Johnson | cbbc78f | 2018-06-12 16:25:09 -0700 | [diff] [blame] | 2316 | mac_handle, |
Jeff Johnson | 9597f3b | 2019-02-04 14:27:56 -0800 | [diff] [blame] | 2317 | adapter->vdev_id) && |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2318 | !sme_roam_is_ese_assoc(roam_info)) { |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2319 | adapter->hdd_wmm_status.ac_status[ac]. |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 2320 | is_tspec_valid = false; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2321 | adapter->hdd_wmm_status.ac_status[ac]. |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 2322 | is_access_allowed = false; |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 2323 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2324 | } else { |
Varun Reddy Yeturu | dd51e8d | 2017-05-14 14:51:13 -0700 | [diff] [blame] | 2325 | hdd_debug("ac %d off", ac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2326 | /* admission is not required so access is allowed */ |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2327 | adapter->hdd_wmm_status.ac_status[ac]. |
Jeff Johnson | 30ac84f | 2019-03-09 13:57:57 -0800 | [diff] [blame] | 2328 | is_access_required = false; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2329 | adapter->hdd_wmm_status.ac_status[ac]. |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 2330 | is_access_allowed = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2331 | } |
| 2332 | |
| 2333 | } |
| 2334 | |
Dustin Brown | e74003f | 2018-03-14 12:51:58 -0700 | [diff] [blame] | 2335 | hdd_exit(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2336 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2337 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2338 | } |
| 2339 | |
| 2340 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2341 | * hdd_wmm_is_active() - Function which will determine if WMM is |
| 2342 | * active on the current connection |
| 2343 | * |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2344 | * @adapter: [in] pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2345 | * |
| 2346 | * Return: true if WMM is enabled, false if WMM is not enabled |
| 2347 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2348 | bool hdd_wmm_is_active(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2349 | { |
Jeff Johnson | 7f63ac9 | 2019-03-08 23:26:37 -0800 | [diff] [blame] | 2350 | if ((!adapter->hdd_wmm_status.qos_connection) || |
Jeff Johnson | 26ef71e | 2019-03-08 23:24:29 -0800 | [diff] [blame] | 2351 | (!adapter->hdd_wmm_status.qap)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2352 | return false; |
| 2353 | } else { |
| 2354 | return true; |
| 2355 | } |
| 2356 | } |
| 2357 | |
Bala Venkatesh | c725a06 | 2018-10-30 15:29:35 +0530 | [diff] [blame] | 2358 | bool hdd_wmm_is_acm_allowed(uint8_t vdev_id) |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2359 | { |
Jeff Johnson | 5b8b67d | 2017-08-29 14:16:53 -0700 | [diff] [blame] | 2360 | struct hdd_adapter *adapter; |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2361 | struct hdd_wmm_ac_status *wmm_ac_status; |
Bala Venkatesh | c725a06 | 2018-10-30 15:29:35 +0530 | [diff] [blame] | 2362 | struct hdd_context *hdd_ctx; |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2363 | |
Bala Venkatesh | c725a06 | 2018-10-30 15:29:35 +0530 | [diff] [blame] | 2364 | hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
| 2365 | if (!hdd_ctx) { |
| 2366 | hdd_err("Unable to fetch the hdd context"); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2367 | return false; |
| 2368 | } |
Bala Venkatesh | c725a06 | 2018-10-30 15:29:35 +0530 | [diff] [blame] | 2369 | |
| 2370 | adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); |
| 2371 | if (hdd_validate_adapter(adapter)) { |
| 2372 | hdd_err("Invalid adapter"); |
| 2373 | return false; |
| 2374 | } |
| 2375 | |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2376 | wmm_ac_status = adapter->hdd_wmm_status.ac_status; |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2377 | |
| 2378 | if (hdd_wmm_is_active(adapter) && |
Srinivas Girigowda | d462f3b | 2019-03-25 14:05:33 -0700 | [diff] [blame] | 2379 | !(wmm_ac_status[QCA_WLAN_AC_VI].is_access_allowed)) |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2380 | return false; |
| 2381 | return true; |
| 2382 | } |
| 2383 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2384 | /** |
| 2385 | * hdd_wmm_addts() - Function which will add a traffic spec at the |
| 2386 | * request of an application |
| 2387 | * |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2388 | * @adapter : [in] pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2389 | * @handle : [in] handle to uniquely identify a TS |
Jeff Johnson | 79d6e5e | 2019-03-07 22:26:19 -0800 | [diff] [blame] | 2390 | * @tspec : [in] pointer to the traffic spec |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2391 | * |
| 2392 | * Return: HDD_WLAN_WMM_STATUS_* |
| 2393 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2394 | hdd_wlan_wmm_status_e hdd_wmm_addts(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2395 | uint32_t handle, |
Jeff Johnson | 79d6e5e | 2019-03-07 22:26:19 -0800 | [diff] [blame] | 2396 | struct sme_qos_wmmtspecinfo *tspec) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2397 | { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2398 | struct hdd_wmm_qos_context *qos_context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2399 | hdd_wlan_wmm_status_e status = HDD_WLAN_WMM_STATUS_SETUP_SUCCESS; |
| 2400 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2401 | enum sme_qos_statustype sme_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2402 | #endif |
| 2403 | bool found = false; |
Jeff Johnson | cbbc78f | 2018-06-12 16:25:09 -0700 | [diff] [blame] | 2404 | mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2405 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 2406 | hdd_debug("Entered with handle 0x%x", handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2407 | |
| 2408 | /* see if a context already exists with the given handle */ |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2409 | mutex_lock(&adapter->hdd_wmm_status.mutex); |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2410 | list_for_each_entry(qos_context, |
Jeff Johnson | 8f656c6 | 2019-03-09 08:48:27 -0800 | [diff] [blame] | 2411 | &adapter->hdd_wmm_status.context_list, node) { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2412 | if (qos_context->handle == handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2413 | found = true; |
| 2414 | break; |
| 2415 | } |
| 2416 | } |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2417 | mutex_unlock(&adapter->hdd_wmm_status.mutex); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2418 | if (found) { |
| 2419 | /* record with that handle already exists */ |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 2420 | hdd_err("Record already exists with handle 0x%x", handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2421 | |
| 2422 | /* Application is trying to modify some of the Tspec |
| 2423 | * params. Allow it |
| 2424 | */ |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2425 | sme_status = sme_qos_modify_req(mac_handle, |
| 2426 | tspec, qos_context->flow_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2427 | |
| 2428 | /* need to check the return value and act appropriately */ |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2429 | switch (sme_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2430 | case SME_QOS_STATUS_MODIFY_SETUP_PENDING_RSP: |
| 2431 | status = HDD_WLAN_WMM_STATUS_MODIFY_PENDING; |
| 2432 | break; |
| 2433 | case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP: |
| 2434 | status = |
| 2435 | HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_NO_UAPSD; |
| 2436 | break; |
| 2437 | case SME_QOS_STATUS_MODIFY_SETUP_SUCCESS_APSD_SET_ALREADY: |
| 2438 | status = |
| 2439 | HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_UAPSD_EXISTING; |
| 2440 | break; |
| 2441 | case SME_QOS_STATUS_MODIFY_SETUP_INVALID_PARAMS_RSP: |
| 2442 | status = HDD_WLAN_WMM_STATUS_MODIFY_FAILED_BAD_PARAM; |
| 2443 | break; |
| 2444 | case SME_QOS_STATUS_MODIFY_SETUP_FAILURE_RSP: |
| 2445 | status = HDD_WLAN_WMM_STATUS_MODIFY_FAILED; |
| 2446 | break; |
| 2447 | case SME_QOS_STATUS_SETUP_NOT_QOS_AP_RSP: |
| 2448 | status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_NO_WMM; |
| 2449 | break; |
| 2450 | default: |
| 2451 | /* we didn't get back one of the |
| 2452 | * SME_QOS_STATUS_MODIFY_* status codes |
| 2453 | */ |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 2454 | hdd_err("unexpected SME Status=%d", |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2455 | sme_status); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2456 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2457 | return HDD_WLAN_WMM_STATUS_MODIFY_FAILED; |
| 2458 | } |
| 2459 | |
| 2460 | /* we were successful, save the status */ |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2461 | mutex_lock(&adapter->hdd_wmm_status.mutex); |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2462 | if (qos_context->magic == HDD_WMM_CTX_MAGIC) |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 2463 | qos_context->status = status; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2464 | mutex_unlock(&adapter->hdd_wmm_status.mutex); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2465 | |
| 2466 | return status; |
| 2467 | } |
| 2468 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2469 | qos_context = qdf_mem_malloc(sizeof(*qos_context)); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2470 | if (!qos_context) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2471 | /* no memory for QoS context. Nothing we can do */ |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 2472 | hdd_err("Unable to allocate QoS context"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2473 | return HDD_WLAN_WMM_STATUS_INTERNAL_FAILURE; |
| 2474 | } |
| 2475 | /* we assume the tspec has already been validated by the caller */ |
| 2476 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2477 | qos_context->handle = handle; |
Jeff Johnson | 79d6e5e | 2019-03-07 22:26:19 -0800 | [diff] [blame] | 2478 | if (tspec->ts_info.up < HDD_WMM_UP_TO_AC_MAP_SIZE) |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 2479 | qos_context->ac_type = hdd_wmm_up_to_ac_map[tspec->ts_info.up]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2480 | else { |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 2481 | hdd_err("ts_info.up (%d) larger than max value (%d), use default ac_type (%d)", |
Jeff Johnson | 79d6e5e | 2019-03-07 22:26:19 -0800 | [diff] [blame] | 2482 | tspec->ts_info.up, |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 2483 | HDD_WMM_UP_TO_AC_MAP_SIZE - 1, hdd_wmm_up_to_ac_map[0]); |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 2484 | qos_context->ac_type = hdd_wmm_up_to_ac_map[0]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2485 | } |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2486 | qos_context->adapter = adapter; |
Jeff Johnson | 104f70e | 2019-03-08 19:29:33 -0800 | [diff] [blame] | 2487 | qos_context->flow_id = 0; |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2488 | qos_context->magic = HDD_WMM_CTX_MAGIC; |
| 2489 | qos_context->is_inactivity_timer_running = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2490 | |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2491 | hdd_debug("Setting up QoS, context %pK", qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2492 | |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2493 | mutex_lock(&adapter->hdd_wmm_status.mutex); |
Jeff Johnson | 8f656c6 | 2019-03-09 08:48:27 -0800 | [diff] [blame] | 2494 | list_add(&qos_context->node, &adapter->hdd_wmm_status.context_list); |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2495 | mutex_unlock(&adapter->hdd_wmm_status.mutex); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2496 | |
| 2497 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2498 | sme_status = sme_qos_setup_req(mac_handle, |
| 2499 | adapter->vdev_id, |
| 2500 | tspec, |
| 2501 | hdd_wmm_sme_callback, |
| 2502 | qos_context, |
| 2503 | tspec->ts_info.up, |
| 2504 | &qos_context->flow_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2505 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 2506 | hdd_debug("sme_qos_setup_req returned %d flowid %d", |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2507 | sme_status, qos_context->flow_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2508 | |
| 2509 | /* need to check the return value and act appropriately */ |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2510 | switch (sme_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2511 | case SME_QOS_STATUS_SETUP_REQ_PENDING_RSP: |
| 2512 | status = HDD_WLAN_WMM_STATUS_SETUP_PENDING; |
| 2513 | break; |
| 2514 | case SME_QOS_STATUS_SETUP_SUCCESS_NO_ACM_NO_APSD_RSP: |
| 2515 | status = HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_NO_UAPSD; |
| 2516 | break; |
| 2517 | case SME_QOS_STATUS_SETUP_SUCCESS_APSD_SET_ALREADY: |
| 2518 | status = |
| 2519 | HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_UAPSD_EXISTING; |
| 2520 | break; |
| 2521 | case SME_QOS_STATUS_SETUP_SUCCESS_IND_APSD_PENDING: |
| 2522 | status = HDD_WLAN_WMM_STATUS_SETUP_PENDING; |
| 2523 | break; |
| 2524 | case SME_QOS_STATUS_SETUP_INVALID_PARAMS_RSP: |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 2525 | /* disable the inactivity timer */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2526 | hdd_wmm_disable_inactivity_timer(qos_context); |
| 2527 | hdd_wmm_free_context(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2528 | return HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 2529 | case SME_QOS_STATUS_SETUP_FAILURE_RSP: |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 2530 | /* disable the inactivity timer */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2531 | hdd_wmm_disable_inactivity_timer(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2532 | /* we can't tell the difference between when a request |
| 2533 | * fails because AP rejected it versus when SME |
| 2534 | * encounterd an internal error |
| 2535 | */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2536 | hdd_wmm_free_context(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2537 | return HDD_WLAN_WMM_STATUS_SETUP_FAILED; |
| 2538 | case SME_QOS_STATUS_SETUP_NOT_QOS_AP_RSP: |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 2539 | /* disable the inactivity timer */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2540 | hdd_wmm_disable_inactivity_timer(qos_context); |
| 2541 | hdd_wmm_free_context(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2542 | return HDD_WLAN_WMM_STATUS_SETUP_FAILED_NO_WMM; |
| 2543 | default: |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 2544 | /* disable the inactivity timer */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2545 | hdd_wmm_disable_inactivity_timer(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2546 | /* we didn't get back one of the |
| 2547 | * SME_QOS_STATUS_SETUP_* status codes |
| 2548 | */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2549 | hdd_wmm_free_context(qos_context); |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2550 | hdd_err("unexpected SME Status=%d", sme_status); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2551 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2552 | return HDD_WLAN_WMM_STATUS_SETUP_FAILED; |
| 2553 | } |
| 2554 | #endif |
| 2555 | |
| 2556 | /* we were successful, save the status */ |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2557 | mutex_lock(&adapter->hdd_wmm_status.mutex); |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2558 | if (qos_context->magic == HDD_WMM_CTX_MAGIC) |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 2559 | qos_context->status = status; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2560 | mutex_unlock(&adapter->hdd_wmm_status.mutex); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2561 | |
| 2562 | return status; |
| 2563 | } |
| 2564 | |
| 2565 | /** |
| 2566 | * hdd_wmm_delts() - Function which will delete a traffic spec at the |
| 2567 | * request of an application |
| 2568 | * |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2569 | * @adapter: [in] pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2570 | * @handle: [in] handle to uniquely identify a TS |
| 2571 | * |
| 2572 | * Return: HDD_WLAN_WMM_STATUS_* |
| 2573 | */ |
Jeff Johnson | de353b8 | 2017-10-03 11:44:52 -0700 | [diff] [blame] | 2574 | hdd_wlan_wmm_status_e hdd_wmm_delts(struct hdd_adapter *adapter, |
| 2575 | uint32_t handle) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2576 | { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2577 | struct hdd_wmm_qos_context *qos_context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2578 | bool found = false; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 2579 | sme_ac_enum_type ac_type = 0; |
Jeff Johnson | 104f70e | 2019-03-08 19:29:33 -0800 | [diff] [blame] | 2580 | uint32_t flow_id = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2581 | hdd_wlan_wmm_status_e status = HDD_WLAN_WMM_STATUS_SETUP_SUCCESS; |
| 2582 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2583 | enum sme_qos_statustype sme_status; |
Jeff Johnson | cbbc78f | 2018-06-12 16:25:09 -0700 | [diff] [blame] | 2584 | mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2585 | #endif |
| 2586 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 2587 | hdd_debug("Entered with handle 0x%x", handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2588 | |
| 2589 | /* locate the context with the given handle */ |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2590 | mutex_lock(&adapter->hdd_wmm_status.mutex); |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2591 | list_for_each_entry(qos_context, |
Jeff Johnson | 8f656c6 | 2019-03-09 08:48:27 -0800 | [diff] [blame] | 2592 | &adapter->hdd_wmm_status.context_list, node) { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2593 | if (qos_context->handle == handle) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2594 | found = true; |
Jeff Johnson | 239ff2e | 2019-03-08 19:26:11 -0800 | [diff] [blame] | 2595 | ac_type = qos_context->ac_type; |
Jeff Johnson | 104f70e | 2019-03-08 19:29:33 -0800 | [diff] [blame] | 2596 | flow_id = qos_context->flow_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2597 | break; |
| 2598 | } |
| 2599 | } |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2600 | mutex_unlock(&adapter->hdd_wmm_status.mutex); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2601 | |
| 2602 | if (false == found) { |
| 2603 | /* we didn't find the handle */ |
Jeff Johnson | 5ae20e9 | 2016-08-19 13:51:48 -0700 | [diff] [blame] | 2604 | hdd_info("handle 0x%x not found", handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2605 | return HDD_WLAN_WMM_STATUS_RELEASE_FAILED_BAD_PARAM; |
| 2606 | } |
| 2607 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 2608 | hdd_debug("found handle 0x%x, flow %d, AC %d, context %pK", |
Jeff Johnson | 104f70e | 2019-03-08 19:29:33 -0800 | [diff] [blame] | 2609 | handle, flow_id, ac_type, qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2610 | |
| 2611 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2612 | sme_status = sme_qos_release_req(mac_handle, adapter->vdev_id, |
| 2613 | flow_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2614 | |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2615 | hdd_debug("SME flow %d released, SME status %d", flow_id, sme_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2616 | |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2617 | switch (sme_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2618 | case SME_QOS_STATUS_RELEASE_SUCCESS_RSP: |
| 2619 | /* this flow is the only one on that AC, so go ahead |
| 2620 | * and update our TSPEC state for the AC |
| 2621 | */ |
Jeff Johnson | 0698e66 | 2019-03-09 14:24:32 -0800 | [diff] [blame] | 2622 | adapter->hdd_wmm_status.ac_status[ac_type].is_tspec_valid = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2623 | false; |
Jeff Johnson | a554897 | 2019-03-09 14:22:18 -0800 | [diff] [blame] | 2624 | adapter->hdd_wmm_status.ac_status[ac_type].is_access_allowed = |
Sreelakshmi Konamki | 9d6b75d | 2016-02-10 12:17:23 +0530 | [diff] [blame] | 2625 | false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2626 | |
| 2627 | /* need to tell TL to stop trigger timer, etc */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2628 | hdd_wmm_disable_tl_uapsd(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2629 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2630 | /* disable the inactivity timer */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2631 | hdd_wmm_disable_inactivity_timer(qos_context); |
Ashish Kumar Dhanotiya | 80b01b5 | 2018-05-01 12:42:46 +0530 | [diff] [blame] | 2632 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2633 | /* we are done with this context */ |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2634 | hdd_wmm_free_context(qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2635 | |
| 2636 | /* SME must not fire any more callbacks for this flow |
| 2637 | * since the context is no longer valid |
| 2638 | */ |
| 2639 | |
| 2640 | return HDD_WLAN_WMM_STATUS_RELEASE_SUCCESS; |
| 2641 | |
| 2642 | case SME_QOS_STATUS_RELEASE_REQ_PENDING_RSP: |
| 2643 | /* do nothing as we will get a response from SME */ |
| 2644 | status = HDD_WLAN_WMM_STATUS_RELEASE_PENDING; |
| 2645 | break; |
| 2646 | |
| 2647 | case SME_QOS_STATUS_RELEASE_INVALID_PARAMS_RSP: |
| 2648 | /* nothing we can do with the existing flow except leave it */ |
| 2649 | status = HDD_WLAN_WMM_STATUS_RELEASE_FAILED_BAD_PARAM; |
| 2650 | break; |
| 2651 | |
| 2652 | case SME_QOS_STATUS_RELEASE_FAILURE_RSP: |
| 2653 | /* nothing we can do with the existing flow except leave it */ |
| 2654 | status = HDD_WLAN_WMM_STATUS_RELEASE_FAILED; |
Yingying Tang | 9fad0ca | 2016-10-20 23:12:36 +0800 | [diff] [blame] | 2655 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2656 | |
| 2657 | default: |
| 2658 | /* we didn't get back one of the |
| 2659 | * SME_QOS_STATUS_RELEASE_* status codes |
| 2660 | */ |
Jeff Johnson | 2059fd7 | 2019-03-08 20:06:59 -0800 | [diff] [blame] | 2661 | hdd_err("unexpected SME Status=%d", sme_status); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2662 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2663 | status = HDD_WLAN_WMM_STATUS_RELEASE_FAILED; |
| 2664 | } |
| 2665 | |
| 2666 | #endif |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2667 | mutex_lock(&adapter->hdd_wmm_status.mutex); |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2668 | if (qos_context->magic == HDD_WMM_CTX_MAGIC) |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 2669 | qos_context->status = status; |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2670 | mutex_unlock(&adapter->hdd_wmm_status.mutex); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2671 | |
| 2672 | return status; |
| 2673 | } |
| 2674 | |
| 2675 | /** |
| 2676 | * hdd_wmm_checkts() - Function which will return the status of a traffic |
| 2677 | * spec at the request of an application |
| 2678 | * |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2679 | * @adapter: [in] pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2680 | * @handle: [in] handle to uniquely identify a TS |
| 2681 | * |
| 2682 | * Return: HDD_WLAN_WMM_STATUS_* |
| 2683 | */ |
Jeff Johnson | a7e2e00 | 2017-10-02 13:19:58 -0700 | [diff] [blame] | 2684 | hdd_wlan_wmm_status_e hdd_wmm_checkts(struct hdd_adapter *adapter, uint32_t handle) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2685 | { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2686 | struct hdd_wmm_qos_context *qos_context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2687 | hdd_wlan_wmm_status_e status = HDD_WLAN_WMM_STATUS_LOST; |
| 2688 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 2689 | hdd_debug("Entered with handle 0x%x", handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2690 | |
| 2691 | /* locate the context with the given handle */ |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2692 | mutex_lock(&adapter->hdd_wmm_status.mutex); |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2693 | list_for_each_entry(qos_context, |
Jeff Johnson | 8f656c6 | 2019-03-09 08:48:27 -0800 | [diff] [blame] | 2694 | &adapter->hdd_wmm_status.context_list, node) { |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2695 | if (qos_context->handle == handle) { |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 2696 | hdd_debug("found handle 0x%x, context %pK", |
Jeff Johnson | d4c0ab5 | 2019-03-03 10:08:33 -0800 | [diff] [blame] | 2697 | handle, qos_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2698 | |
Jeff Johnson | 5b05251 | 2019-03-08 19:32:14 -0800 | [diff] [blame] | 2699 | status = qos_context->status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2700 | break; |
| 2701 | } |
| 2702 | } |
Jeff Johnson | 12e1233 | 2019-03-08 23:29:23 -0800 | [diff] [blame] | 2703 | mutex_unlock(&adapter->hdd_wmm_status.mutex); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2704 | return status; |
| 2705 | } |