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