Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Jeff Johnson | 4fca3b5 | 2017-01-12 08:44:18 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 28 | /* denote that this file does not allow legacy hddLog */ |
| 29 | #define HDD_DISALLOW_LEGACY_HDDLOG 1 |
| 30 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 31 | /* Include files */ |
| 32 | #include <linux/semaphore.h> |
| 33 | #include <wlan_hdd_tx_rx.h> |
| 34 | #include <wlan_hdd_softap_tx_rx.h> |
| 35 | #include <linux/netdevice.h> |
| 36 | #include <linux/skbuff.h> |
| 37 | #include <linux/etherdevice.h> |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 38 | #include <qdf_types.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 39 | #include <ani_global.h> |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 40 | #include <qdf_types.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 41 | #include <net/ieee80211_radiotap.h> |
| 42 | #include <cds_sched.h> |
| 43 | #include <wlan_hdd_napi.h> |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 44 | #include <cdp_txrx_cmn.h> |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 45 | #include <cdp_txrx_peer_ops.h> |
Manjunathappa Prakash | 779e486 | 2016-09-12 17:00:11 -0700 | [diff] [blame] | 46 | #include <cds_utils.h> |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 47 | #include <cdp_txrx_flow_ctrl_v2.h> |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 48 | #include <cdp_txrx_handle.h> |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 49 | #include <wlan_hdd_object_manager.h> |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 50 | #include "wlan_p2p_ucfg_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 51 | #ifdef IPA_OFFLOAD |
| 52 | #include <wlan_hdd_ipa.h> |
| 53 | #endif |
| 54 | |
| 55 | /* Preprocessor definitions and constants */ |
| 56 | #undef QCA_HDD_SAP_DUMP_SK_BUFF |
| 57 | |
| 58 | /* Type declarations */ |
| 59 | |
| 60 | /* Function definitions and documenation */ |
| 61 | #ifdef QCA_HDD_SAP_DUMP_SK_BUFF |
| 62 | /** |
| 63 | * hdd_softap_dump_sk_buff() - Dump an skb |
| 64 | * @skb: skb to dump |
| 65 | * |
| 66 | * Return: None |
| 67 | */ |
| 68 | static void hdd_softap_dump_sk_buff(struct sk_buff *skb) |
| 69 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 70 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 71 | "%s: head = %pK ", __func__, skb->head); |
Srinivas Girigowda | e806a82 | 2017-03-25 11:25:30 -0700 | [diff] [blame] | 72 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO, |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 73 | "%s: tail = %pK ", __func__, skb->tail); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 74 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 75 | "%s: end = %pK ", __func__, skb->end); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 76 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 77 | "%s: len = %d ", __func__, skb->len); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 78 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 79 | "%s: data_len = %d ", __func__, skb->data_len); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 80 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 81 | "%s: mac_len = %d", __func__, skb->mac_len); |
| 82 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 83 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 84 | "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x ", skb->data[0], |
| 85 | skb->data[1], skb->data[2], skb->data[3], skb->data[4], |
| 86 | skb->data[5], skb->data[6], skb->data[7]); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 87 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 88 | "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", skb->data[8], |
| 89 | skb->data[9], skb->data[10], skb->data[11], skb->data[12], |
| 90 | skb->data[13], skb->data[14], skb->data[15]); |
| 91 | } |
| 92 | #else |
| 93 | static void hdd_softap_dump_sk_buff(struct sk_buff *skb) |
| 94 | { |
| 95 | } |
| 96 | #endif |
| 97 | |
| 98 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 99 | /** |
| 100 | * hdd_softap_tx_resume_timer_expired_handler() - TX Q resume timer handler |
| 101 | * @adapter_context: pointer to vdev adapter |
| 102 | * |
| 103 | * TX Q resume timer handler for SAP and P2P GO interface. If Blocked |
| 104 | * OS Q is not resumed during timeout period, to prevent permanent |
| 105 | * stall, resume OS Q forcefully for SAP and P2P GO interface. |
| 106 | * |
| 107 | * Return: None |
| 108 | */ |
| 109 | void hdd_softap_tx_resume_timer_expired_handler(void *adapter_context) |
| 110 | { |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 111 | struct hdd_adapter *adapter = (struct hdd_adapter *) adapter_context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 112 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 113 | if (!adapter) { |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 114 | hdd_err("NULL adapter"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 115 | return; |
| 116 | } |
| 117 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 118 | hdd_debug("Enabling queues"); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 119 | wlan_hdd_netif_queue_control(adapter, WLAN_WAKE_ALL_NETIF_QUEUE, |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 120 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 121 | } |
| 122 | |
Poddar, Siddarth | b61cf64 | 2016-04-28 16:02:39 +0530 | [diff] [blame] | 123 | #if defined(CONFIG_PER_VDEV_TX_DESC_POOL) |
| 124 | |
| 125 | /** |
| 126 | * hdd_softap_tx_resume_false() - Resume OS TX Q false leads to queue disabling |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 127 | * @adapter: pointer to hdd adapter |
Poddar, Siddarth | b61cf64 | 2016-04-28 16:02:39 +0530 | [diff] [blame] | 128 | * @tx_resume: TX Q resume trigger |
| 129 | * |
| 130 | * |
| 131 | * Return: None |
| 132 | */ |
| 133 | static void |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 134 | hdd_softap_tx_resume_false(struct hdd_adapter *adapter, bool tx_resume) |
Poddar, Siddarth | b61cf64 | 2016-04-28 16:02:39 +0530 | [diff] [blame] | 135 | { |
| 136 | if (true == tx_resume) |
| 137 | return; |
| 138 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 139 | hdd_debug("Disabling queues"); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 140 | wlan_hdd_netif_queue_control(adapter, WLAN_STOP_ALL_NETIF_QUEUE, |
Poddar, Siddarth | b61cf64 | 2016-04-28 16:02:39 +0530 | [diff] [blame] | 141 | WLAN_DATA_FLOW_CONTROL); |
| 142 | |
| 143 | if (QDF_TIMER_STATE_STOPPED == |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 144 | qdf_mc_timer_get_current_state(&adapter-> |
Poddar, Siddarth | b61cf64 | 2016-04-28 16:02:39 +0530 | [diff] [blame] | 145 | tx_flow_control_timer)) { |
| 146 | QDF_STATUS status; |
Srinivas Girigowda | e806a82 | 2017-03-25 11:25:30 -0700 | [diff] [blame] | 147 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 148 | status = qdf_mc_timer_start(&adapter->tx_flow_control_timer, |
Poddar, Siddarth | b61cf64 | 2016-04-28 16:02:39 +0530 | [diff] [blame] | 149 | WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME); |
| 150 | |
| 151 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 152 | hdd_err("Failed to start tx_flow_control_timer"); |
| 153 | else |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 154 | adapter->hdd_stats.hddTxRxStats.txflow_timer_cnt++; |
Poddar, Siddarth | b61cf64 | 2016-04-28 16:02:39 +0530 | [diff] [blame] | 155 | } |
Poddar, Siddarth | b61cf64 | 2016-04-28 16:02:39 +0530 | [diff] [blame] | 156 | } |
| 157 | #else |
| 158 | |
| 159 | static inline void |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 160 | hdd_softap_tx_resume_false(struct hdd_adapter *adapter, bool tx_resume) |
Poddar, Siddarth | b61cf64 | 2016-04-28 16:02:39 +0530 | [diff] [blame] | 161 | { |
Poddar, Siddarth | b61cf64 | 2016-04-28 16:02:39 +0530 | [diff] [blame] | 162 | } |
| 163 | #endif |
| 164 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 165 | /** |
| 166 | * hdd_softap_tx_resume_cb() - Resume OS TX Q. |
| 167 | * @adapter_context: pointer to vdev apdapter |
| 168 | * @tx_resume: TX Q resume trigger |
| 169 | * |
| 170 | * Q was stopped due to WLAN TX path low resource condition |
| 171 | * |
| 172 | * Return: None |
| 173 | */ |
| 174 | void hdd_softap_tx_resume_cb(void *adapter_context, bool tx_resume) |
| 175 | { |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 176 | struct hdd_adapter *adapter = (struct hdd_adapter *) adapter_context; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 177 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 178 | if (!adapter) { |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 179 | hdd_err("NULL adapter"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 180 | return; |
| 181 | } |
| 182 | |
| 183 | /* Resume TX */ |
| 184 | if (true == tx_resume) { |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 185 | if (QDF_TIMER_STATE_STOPPED != |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 186 | qdf_mc_timer_get_current_state(&adapter-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 187 | tx_flow_control_timer)) { |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 188 | qdf_mc_timer_stop(&adapter->tx_flow_control_timer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 189 | } |
| 190 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 191 | hdd_debug("Enabling queues"); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 192 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 193 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 194 | WLAN_DATA_FLOW_CONTROL); |
| 195 | } |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 196 | hdd_softap_tx_resume_false(adapter, tx_resume); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 197 | } |
gbian | ec670c59 | 2016-11-24 11:21:30 +0800 | [diff] [blame] | 198 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 199 | static inline struct sk_buff *hdd_skb_orphan(struct hdd_adapter *adapter, |
gbian | ec670c59 | 2016-11-24 11:21:30 +0800 | [diff] [blame] | 200 | struct sk_buff *skb) |
| 201 | { |
tfyu | bdf453e | 2017-09-27 13:34:30 +0800 | [diff] [blame] | 202 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(3, 19, 0)) |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 203 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
tfyu | bdf453e | 2017-09-27 13:34:30 +0800 | [diff] [blame] | 204 | #endif |
| 205 | int need_orphan = 0; |
| 206 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 207 | if (adapter->tx_flow_low_watermark > 0) { |
tfyu | bdf453e | 2017-09-27 13:34:30 +0800 | [diff] [blame] | 208 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 19, 0)) |
| 209 | /* |
| 210 | * The TCP TX throttling logic is changed a little after |
| 211 | * 3.19-rc1 kernel, the TCP sending limit will be smaller, |
| 212 | * which will throttle the TCP packets to the host driver. |
| 213 | * The TCP UP LINK throughput will drop heavily. In order to |
| 214 | * fix this issue, need to orphan the socket buffer asap, which |
| 215 | * will call skb's destructor to notify the TCP stack that the |
| 216 | * SKB buffer is unowned. And then the TCP stack will pump more |
| 217 | * packets to host driver. |
| 218 | * |
| 219 | * The TX packets might be dropped for UDP case in the iperf |
| 220 | * testing. So need to be protected by follow control. |
| 221 | */ |
| 222 | need_orphan = 1; |
| 223 | #else |
| 224 | if (hdd_ctx->config->tx_orphan_enable) |
| 225 | need_orphan = 1; |
| 226 | #endif |
| 227 | } |
| 228 | |
| 229 | if (need_orphan) |
gbian | ec670c59 | 2016-11-24 11:21:30 +0800 | [diff] [blame] | 230 | skb_orphan(skb); |
Srinivas Girigowda | e806a82 | 2017-03-25 11:25:30 -0700 | [diff] [blame] | 231 | else |
gbian | ec670c59 | 2016-11-24 11:21:30 +0800 | [diff] [blame] | 232 | skb = skb_unshare(skb, GFP_ATOMIC); |
gbian | ec670c59 | 2016-11-24 11:21:30 +0800 | [diff] [blame] | 233 | |
| 234 | return skb; |
| 235 | } |
| 236 | |
| 237 | #else |
Mohit Khanna | d0b63f5 | 2017-02-18 18:05:52 -0800 | [diff] [blame] | 238 | /** |
| 239 | * hdd_skb_orphan() - skb_unshare a cloned packed else skb_orphan |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 240 | * @adapter: pointer to HDD adapter |
Mohit Khanna | d0b63f5 | 2017-02-18 18:05:52 -0800 | [diff] [blame] | 241 | * @skb: pointer to skb data packet |
| 242 | * |
| 243 | * Return: pointer to skb structure |
| 244 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 245 | static inline struct sk_buff *hdd_skb_orphan(struct hdd_adapter *adapter, |
Mohit Khanna | d0b63f5 | 2017-02-18 18:05:52 -0800 | [diff] [blame] | 246 | struct sk_buff *skb) { |
gbian | ec670c59 | 2016-11-24 11:21:30 +0800 | [diff] [blame] | 247 | |
Mohit Khanna | d0b63f5 | 2017-02-18 18:05:52 -0800 | [diff] [blame] | 248 | struct sk_buff *nskb; |
tfyu | bdf453e | 2017-09-27 13:34:30 +0800 | [diff] [blame] | 249 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 19, 0)) |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 250 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
tfyu | bdf453e | 2017-09-27 13:34:30 +0800 | [diff] [blame] | 251 | #endif |
Mohit Khanna | d0b63f5 | 2017-02-18 18:05:52 -0800 | [diff] [blame] | 252 | |
Manjunathappa Prakash | dab74fa | 2017-06-19 12:11:03 -0700 | [diff] [blame] | 253 | nskb = skb_unshare(skb, GFP_ATOMIC); |
tfyu | bdf453e | 2017-09-27 13:34:30 +0800 | [diff] [blame] | 254 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 19, 0)) |
Manjunathappa Prakash | dab74fa | 2017-06-19 12:11:03 -0700 | [diff] [blame] | 255 | if (unlikely(hdd_ctx->config->tx_orphan_enable) && (nskb == skb)) { |
Mohit Khanna | d0b63f5 | 2017-02-18 18:05:52 -0800 | [diff] [blame] | 256 | /* |
| 257 | * For UDP packets we want to orphan the packet to allow the app |
| 258 | * to send more packets. The flow would ultimately be controlled |
| 259 | * by the limited number of tx descriptors for the vdev. |
| 260 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 261 | ++adapter->hdd_stats.hddTxRxStats.txXmitOrphaned; |
Mohit Khanna | d0b63f5 | 2017-02-18 18:05:52 -0800 | [diff] [blame] | 262 | skb_orphan(skb); |
| 263 | } |
tfyu | bdf453e | 2017-09-27 13:34:30 +0800 | [diff] [blame] | 264 | #endif |
Mohit Khanna | d0b63f5 | 2017-02-18 18:05:52 -0800 | [diff] [blame] | 265 | return nskb; |
gbian | ec670c59 | 2016-11-24 11:21:30 +0800 | [diff] [blame] | 266 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 267 | #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ |
| 268 | |
| 269 | /** |
Mukul Sharma | c4de4ef | 2016-09-12 15:39:00 +0530 | [diff] [blame] | 270 | * __hdd_softap_hard_start_xmit() - Transmit a frame |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 271 | * @skb: pointer to OS packet (sk_buff) |
| 272 | * @dev: pointer to network device |
| 273 | * |
| 274 | * Function registered with the Linux OS for transmitting |
| 275 | * packets. This version of the function directly passes |
| 276 | * the packet to Transport Layer. |
Poddar, Siddarth | 31b9b8b | 2017-04-07 12:04:55 +0530 | [diff] [blame] | 277 | * In case of any packet drop or error, log the error with |
| 278 | * INFO HIGH/LOW/MEDIUM to avoid excessive logging in kmsg. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 279 | * |
| 280 | * Return: Always returns NETDEV_TX_OK |
| 281 | */ |
Jeff Johnson | 6376abe | 2016-10-05 16:24:56 -0700 | [diff] [blame] | 282 | static int __hdd_softap_hard_start_xmit(struct sk_buff *skb, |
| 283 | struct net_device *dev) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 284 | { |
| 285 | sme_ac_enum_type ac = SME_AC_BE; |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 286 | struct hdd_adapter *adapter = (struct hdd_adapter *) netdev_priv(dev); |
Jeff Johnson | 9bf2497 | 2017-10-04 09:26:58 -0700 | [diff] [blame] | 287 | struct hdd_ap_ctx *ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 288 | struct qdf_mac_addr *pDestMacAddress; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 289 | uint8_t STAId; |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 290 | uint32_t num_seg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 291 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 292 | ++adapter->hdd_stats.hddTxRxStats.txXmitCalled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 293 | /* Prevent this function from being called during SSR since TL |
| 294 | * context may not be reinitialized at this time which may |
| 295 | * lead to a crash. |
| 296 | */ |
Hanumanth Reddy Pothula | 2a8a740 | 2017-07-03 14:06:11 +0530 | [diff] [blame] | 297 | if (cds_is_driver_recovering() || cds_is_driver_in_bad_state()) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 298 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO_HIGH, |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 299 | "%s: Recovery in Progress. Ignore!!!", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 300 | goto drop_pkt; |
| 301 | } |
| 302 | |
| 303 | /* |
| 304 | * If the device is operating on a DFS Channel |
| 305 | * then check if SAP is in CAC WAIT state and |
| 306 | * drop the packets. In CAC WAIT state device |
| 307 | * is expected not to transmit any frames. |
| 308 | * SAP starts Tx only after the BSS START is |
| 309 | * done. |
| 310 | */ |
Jeff Johnson | 9bf2497 | 2017-10-04 09:26:58 -0700 | [diff] [blame] | 311 | if (ap_ctx->dfs_cac_block_tx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 312 | goto drop_pkt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | |
Dhanashri Atre | 168d2b4 | 2016-02-22 14:43:06 -0800 | [diff] [blame] | 314 | /* |
Jeff Johnson | 4fca3b5 | 2017-01-12 08:44:18 -0800 | [diff] [blame] | 315 | * If a transmit function is not registered, drop packet |
| 316 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 317 | if (!adapter->tx_fn) { |
Dhanashri Atre | 168d2b4 | 2016-02-22 14:43:06 -0800 | [diff] [blame] | 318 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO_HIGH, |
| 319 | "%s: TX function not registered by the data path", |
| 320 | __func__); |
| 321 | goto drop_pkt; |
| 322 | } |
| 323 | |
Nirav Shah | 5e74bb8 | 2016-07-20 16:01:27 +0530 | [diff] [blame] | 324 | wlan_hdd_classify_pkt(skb); |
| 325 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 326 | pDestMacAddress = (struct qdf_mac_addr *) skb->data; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 327 | |
Nirav Shah | 5e74bb8 | 2016-07-20 16:01:27 +0530 | [diff] [blame] | 328 | if (QDF_NBUF_CB_GET_IS_BCAST(skb) || |
| 329 | QDF_NBUF_CB_GET_IS_MCAST(skb)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 330 | /* The BC/MC station ID is assigned during BSS |
| 331 | * starting phase. SAP will return the station ID |
| 332 | * used for BC/MC traffic. |
| 333 | */ |
Jeff Johnson | 9bf2497 | 2017-10-04 09:26:58 -0700 | [diff] [blame] | 334 | STAId = ap_ctx->uBCStaId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 335 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 336 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 337 | hdd_softap_get_sta_id(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 338 | pDestMacAddress, &STAId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 339 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
Poddar, Siddarth | 31b9b8b | 2017-04-07 12:04:55 +0530 | [diff] [blame] | 340 | QDF_TRACE_LEVEL_INFO_HIGH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 341 | "%s: Failed to find right station", __func__); |
| 342 | goto drop_pkt; |
| 343 | } |
| 344 | |
Prakash Dhavali | 3107b75 | 2016-11-28 14:35:06 +0530 | [diff] [blame] | 345 | if (STAId >= WLAN_MAX_STA_COUNT) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 346 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
Poddar, Siddarth | 31b9b8b | 2017-04-07 12:04:55 +0530 | [diff] [blame] | 347 | QDF_TRACE_LEVEL_INFO_HIGH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 348 | "%s: Failed to find right station", __func__); |
| 349 | goto drop_pkt; |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 350 | } else if (false == adapter->aStaInfo[STAId].isUsed) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 351 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
Poddar, Siddarth | 31b9b8b | 2017-04-07 12:04:55 +0530 | [diff] [blame] | 352 | QDF_TRACE_LEVEL_INFO_HIGH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 353 | "%s: STA %d is unregistered", __func__, |
| 354 | STAId); |
| 355 | goto drop_pkt; |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 356 | } else if (true == adapter->aStaInfo[STAId]. |
Poddar, Siddarth | a507546 | 2017-03-16 19:20:09 +0530 | [diff] [blame] | 357 | isDeauthInProgress) { |
| 358 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
Poddar, Siddarth | 31b9b8b | 2017-04-07 12:04:55 +0530 | [diff] [blame] | 359 | QDF_TRACE_LEVEL_INFO_HIGH, |
Poddar, Siddarth | a507546 | 2017-03-16 19:20:09 +0530 | [diff] [blame] | 360 | "%s: STA %d deauth in progress", __func__, |
| 361 | STAId); |
| 362 | goto drop_pkt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 363 | } |
| 364 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 365 | if ((OL_TXRX_PEER_STATE_CONN != |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 366 | adapter->aStaInfo[STAId].tlSTAState) |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 367 | && (OL_TXRX_PEER_STATE_AUTH != |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 368 | adapter->aStaInfo[STAId].tlSTAState)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 369 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
Poddar, Siddarth | 31b9b8b | 2017-04-07 12:04:55 +0530 | [diff] [blame] | 370 | QDF_TRACE_LEVEL_INFO_HIGH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 371 | "%s: Station not connected yet", __func__); |
| 372 | goto drop_pkt; |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 373 | } else if (OL_TXRX_PEER_STATE_CONN == |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 374 | adapter->aStaInfo[STAId].tlSTAState) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 375 | if (ntohs(skb->protocol) != HDD_ETHERTYPE_802_1_X) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 376 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
Poddar, Siddarth | 31b9b8b | 2017-04-07 12:04:55 +0530 | [diff] [blame] | 377 | QDF_TRACE_LEVEL_INFO_HIGH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 378 | "%s: NON-EAPOL packet in non-Authenticated state", |
| 379 | __func__); |
| 380 | goto drop_pkt; |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 385 | hdd_get_tx_resource(adapter, STAId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 386 | WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME); |
| 387 | |
| 388 | /* Get TL AC corresponding to Qdisc queue index/AC. */ |
| 389 | ac = hdd_qdisc_ac_to_tl_ac[skb->queue_mapping]; |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 390 | ++adapter->hdd_stats.hddTxRxStats.txXmitClassifiedAC[ac]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 391 | |
Srinivas Girigowda | e806a82 | 2017-03-25 11:25:30 -0700 | [diff] [blame] | 392 | #if defined(IPA_OFFLOAD) |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 393 | if (!qdf_nbuf_ipa_owned_get(skb)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 394 | #endif |
gbian | ec670c59 | 2016-11-24 11:21:30 +0800 | [diff] [blame] | 395 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 396 | skb = hdd_skb_orphan(adapter, skb); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 397 | if (!skb) |
Jeff Johnson | edeff23 | 2015-11-11 17:19:42 -0800 | [diff] [blame] | 398 | goto drop_pkt_accounting; |
gbian | ec670c59 | 2016-11-24 11:21:30 +0800 | [diff] [blame] | 399 | |
Srinivas Girigowda | e806a82 | 2017-03-25 11:25:30 -0700 | [diff] [blame] | 400 | #if defined(IPA_OFFLOAD) |
Yun Park | 01deb2c | 2017-06-14 15:21:44 -0700 | [diff] [blame^] | 401 | } else { |
| 402 | /* |
| 403 | * Clear the IPA ownership after check it to avoid ipa_free_skb |
| 404 | * is called when Tx completed for intra-BSS Tx packets |
| 405 | */ |
| 406 | qdf_nbuf_ipa_owned_clear(skb); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 407 | } |
| 408 | #endif |
| 409 | |
Himanshu Agarwal | 53298d1 | 2017-02-20 19:14:17 +0530 | [diff] [blame] | 410 | /* |
| 411 | * Add SKB to internal tracking table before further processing |
| 412 | * in WLAN driver. |
| 413 | */ |
| 414 | qdf_net_buf_debug_acquire_skb(skb, __FILE__, __LINE__); |
| 415 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 416 | adapter->stats.tx_bytes += skb->len; |
| 417 | adapter->aStaInfo[STAId].tx_bytes += skb->len; |
Mohit Khanna | b1dd1e8 | 2017-02-04 15:14:38 -0800 | [diff] [blame] | 418 | |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 419 | if (qdf_nbuf_is_tso(skb)) { |
| 420 | num_seg = qdf_nbuf_get_tso_num_seg(skb); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 421 | adapter->stats.tx_packets += num_seg; |
| 422 | adapter->aStaInfo[STAId].tx_packets += num_seg; |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 423 | } else { |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 424 | ++adapter->stats.tx_packets; |
| 425 | adapter->aStaInfo[STAId].tx_packets++; |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 426 | } |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 427 | adapter->aStaInfo[STAId].last_tx_rx_ts = qdf_system_ticks(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 428 | |
Nirav Shah | 5e74bb8 | 2016-07-20 16:01:27 +0530 | [diff] [blame] | 429 | hdd_event_eapol_log(skb, QDF_TX); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 430 | qdf_dp_trace_log_pkt(adapter->sessionId, skb, QDF_TX, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 431 | QDF_TRACE_DEFAULT_PDEV_ID); |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 432 | QDF_NBUF_CB_TX_PACKET_TRACK(skb) = QDF_NBUF_TX_PKT_DATA_TRACK; |
| 433 | QDF_NBUF_UPDATE_TX_PKT_COUNT(skb, QDF_NBUF_TX_PKT_HDD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 434 | |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 435 | qdf_dp_trace_set_track(skb, QDF_TX); |
| 436 | DPTRACE(qdf_dp_trace(skb, QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 437 | QDF_TRACE_DEFAULT_PDEV_ID, qdf_nbuf_data_addr(skb), |
| 438 | sizeof(qdf_nbuf_data(skb)), |
Himanshu Agarwal | ee3411a | 2017-01-31 12:56:47 +0530 | [diff] [blame] | 439 | QDF_TX)); |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 440 | DPTRACE(qdf_dp_trace(skb, QDF_DP_TRACE_HDD_TX_PACKET_RECORD, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 441 | QDF_TRACE_DEFAULT_PDEV_ID, (uint8_t *)skb->data, |
| 442 | qdf_nbuf_len(skb), QDF_TX)); |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 443 | if (qdf_nbuf_len(skb) > QDF_DP_TRACE_RECORD_SIZE) |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 444 | DPTRACE(qdf_dp_trace(skb, QDF_DP_TRACE_HDD_TX_PACKET_RECORD, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 445 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 446 | (uint8_t *)&skb->data[QDF_DP_TRACE_RECORD_SIZE], |
| 447 | (qdf_nbuf_len(skb)-QDF_DP_TRACE_RECORD_SIZE), QDF_TX)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 448 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 449 | if (adapter->tx_fn(adapter->txrx_vdev, |
Dhanashri Atre | 168d2b4 | 2016-02-22 14:43:06 -0800 | [diff] [blame] | 450 | (qdf_nbuf_t) skb) != NULL) { |
Poddar, Siddarth | 31b9b8b | 2017-04-07 12:04:55 +0530 | [diff] [blame] | 451 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO_HIGH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 452 | "%s: Failed to send packet to txrx for staid:%d", |
| 453 | __func__, STAId); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 454 | ++adapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac]; |
Himanshu Agarwal | 53298d1 | 2017-02-20 19:14:17 +0530 | [diff] [blame] | 455 | goto drop_pkt_and_release_skb; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 456 | } |
Dustin Brown | e0024fa | 2016-10-14 16:29:21 -0700 | [diff] [blame] | 457 | netif_trans_update(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 458 | |
| 459 | return NETDEV_TX_OK; |
| 460 | |
Himanshu Agarwal | 53298d1 | 2017-02-20 19:14:17 +0530 | [diff] [blame] | 461 | drop_pkt_and_release_skb: |
| 462 | qdf_net_buf_debug_release_skb(skb); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 463 | drop_pkt: |
| 464 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 465 | DPTRACE(qdf_dp_trace(skb, QDF_DP_TRACE_DROP_PACKET_RECORD, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 466 | QDF_TRACE_DEFAULT_PDEV_ID, (uint8_t *)skb->data, |
| 467 | qdf_nbuf_len(skb), QDF_TX)); |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 468 | if (qdf_nbuf_len(skb) > QDF_DP_TRACE_RECORD_SIZE) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 469 | DPTRACE(qdf_dp_trace(skb, QDF_DP_TRACE_DROP_PACKET_RECORD, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 470 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 471 | (uint8_t *)&skb->data[QDF_DP_TRACE_RECORD_SIZE], |
| 472 | (qdf_nbuf_len(skb)-QDF_DP_TRACE_RECORD_SIZE), QDF_TX)); |
Jeff Johnson | edeff23 | 2015-11-11 17:19:42 -0800 | [diff] [blame] | 473 | kfree_skb(skb); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 474 | |
Jeff Johnson | edeff23 | 2015-11-11 17:19:42 -0800 | [diff] [blame] | 475 | drop_pkt_accounting: |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 476 | ++adapter->stats.tx_dropped; |
| 477 | ++adapter->hdd_stats.hddTxRxStats.txXmitDropped; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 478 | |
| 479 | return NETDEV_TX_OK; |
| 480 | } |
| 481 | |
| 482 | /** |
Mukul Sharma | c4de4ef | 2016-09-12 15:39:00 +0530 | [diff] [blame] | 483 | * hdd_softap_hard_start_xmit() - Wrapper function to protect |
| 484 | * __hdd_softap_hard_start_xmit from SSR |
| 485 | * @skb: pointer to OS packet |
| 486 | * @dev: pointer to net_device structure |
| 487 | * |
| 488 | * Function called by OS if any packet needs to transmit. |
| 489 | * |
| 490 | * Return: Always returns NETDEV_TX_OK |
| 491 | */ |
| 492 | int hdd_softap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
| 493 | { |
| 494 | int ret; |
| 495 | |
| 496 | cds_ssr_protect(__func__); |
| 497 | ret = __hdd_softap_hard_start_xmit(skb, dev); |
| 498 | cds_ssr_unprotect(__func__); |
| 499 | |
| 500 | return ret; |
| 501 | } |
| 502 | |
Sen, Devendra | 154b3c4 | 2017-02-13 20:44:15 +0530 | [diff] [blame] | 503 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 504 | /** |
| 505 | * hdd_wlan_datastall_sap_event()- Send SAP datastall information |
| 506 | * |
| 507 | * This Function send send SAP datastall diag event |
| 508 | * |
| 509 | * Return: void. |
| 510 | */ |
| 511 | static void hdd_wlan_datastall_sap_event(void) |
| 512 | { |
| 513 | WLAN_HOST_DIAG_EVENT_DEF(sap_data_stall, |
| 514 | struct host_event_wlan_datastall); |
| 515 | qdf_mem_zero(&sap_data_stall, sizeof(sap_data_stall)); |
| 516 | sap_data_stall.reason = SOFTAP_TX_TIMEOUT; |
| 517 | WLAN_HOST_DIAG_EVENT_REPORT(&sap_data_stall, |
| 518 | EVENT_WLAN_SOFTAP_DATASTALL); |
| 519 | } |
| 520 | #else |
| 521 | static inline void hdd_wlan_datastall_sap_event(void) |
| 522 | { |
| 523 | |
| 524 | } |
| 525 | #endif |
| 526 | |
Mukul Sharma | c4de4ef | 2016-09-12 15:39:00 +0530 | [diff] [blame] | 527 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 528 | * __hdd_softap_tx_timeout() - TX timeout handler |
| 529 | * @dev: pointer to network device |
| 530 | * |
| 531 | * This function is registered as a netdev ndo_tx_timeout method, and |
| 532 | * is invoked by the kernel if the driver takes too long to transmit a |
| 533 | * frame. |
| 534 | * |
| 535 | * Return: None |
| 536 | */ |
| 537 | static void __hdd_softap_tx_timeout(struct net_device *dev) |
| 538 | { |
Jeff Johnson | 18dd7e1 | 2017-08-29 14:22:28 -0700 | [diff] [blame] | 539 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | f772687 | 2017-08-28 11:38:31 -0700 | [diff] [blame] | 540 | struct hdd_context *hdd_ctx; |
Nirav Shah | 89223f7 | 2016-03-01 18:10:38 +0530 | [diff] [blame] | 541 | struct netdev_queue *txq; |
| 542 | int i; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 543 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 544 | DPTRACE(qdf_dp_trace(NULL, QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 545 | QDF_TRACE_DEFAULT_PDEV_ID, |
| 546 | NULL, 0, QDF_TX)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 547 | /* Getting here implies we disabled the TX queues for too |
| 548 | * long. Queues are disabled either because of disassociation |
| 549 | * or low resource scenarios. In case of disassociation it is |
| 550 | * ok to ignore this. But if associated, we have do possible |
| 551 | * recovery here |
| 552 | */ |
| 553 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Hanumanth Reddy Pothula | 2a8a740 | 2017-07-03 14:06:11 +0530 | [diff] [blame] | 554 | if (cds_is_driver_recovering() || cds_is_driver_in_bad_state()) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 555 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 556 | "%s: Recovery in Progress. Ignore!!!", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 557 | return; |
| 558 | } |
Nirav Shah | 89223f7 | 2016-03-01 18:10:38 +0530 | [diff] [blame] | 559 | |
Dustin Brown | e0024fa | 2016-10-14 16:29:21 -0700 | [diff] [blame] | 560 | TX_TIMEOUT_TRACE(dev, QDF_MODULE_ID_HDD_SAP_DATA); |
Nirav Shah | 89223f7 | 2016-03-01 18:10:38 +0530 | [diff] [blame] | 561 | |
| 562 | for (i = 0; i < NUM_TX_QUEUES; i++) { |
| 563 | txq = netdev_get_tx_queue(dev, i); |
| 564 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, |
Srinivas Girigowda | 028c448 | 2017-03-09 18:52:02 -0800 | [diff] [blame] | 565 | QDF_TRACE_LEVEL_DEBUG, |
| 566 | "Queue: %d status: %d txq->trans_start: %lu", |
Nirav Shah | 89223f7 | 2016-03-01 18:10:38 +0530 | [diff] [blame] | 567 | i, netif_tx_queue_stopped(txq), txq->trans_start); |
| 568 | } |
| 569 | |
| 570 | wlan_hdd_display_netif_queue_history(hdd_ctx); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 571 | cdp_dump_flow_pool_info(cds_get_context(QDF_MODULE_ID_SOC)); |
Srinivas Girigowda | 028c448 | 2017-03-09 18:52:02 -0800 | [diff] [blame] | 572 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_DEBUG, |
Nirav Shah | 89223f7 | 2016-03-01 18:10:38 +0530 | [diff] [blame] | 573 | "carrier state: %d", netif_carrier_ok(dev)); |
Sen, Devendra | 154b3c4 | 2017-02-13 20:44:15 +0530 | [diff] [blame] | 574 | hdd_wlan_datastall_sap_event(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 575 | } |
| 576 | |
| 577 | /** |
| 578 | * hdd_softap_tx_timeout() - SSR wrapper for __hdd_softap_tx_timeout |
| 579 | * @dev: pointer to net_device |
| 580 | * |
| 581 | * Return: none |
| 582 | */ |
| 583 | void hdd_softap_tx_timeout(struct net_device *dev) |
| 584 | { |
| 585 | cds_ssr_protect(__func__); |
| 586 | __hdd_softap_tx_timeout(dev); |
| 587 | cds_ssr_unprotect(__func__); |
| 588 | } |
| 589 | |
| 590 | /** |
| 591 | * @hdd_softap_init_tx_rx() - Initialize Tx/RX module |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 592 | * @adapter: pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 593 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 594 | * Return: QDF_STATUS_E_FAILURE if any errors encountered, |
| 595 | * QDF_STATUS_SUCCESS otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 596 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 597 | QDF_STATUS hdd_softap_init_tx_rx(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 598 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 599 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 600 | |
| 601 | uint8_t STAId = 0; |
| 602 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 603 | qdf_mem_zero(&adapter->stats, sizeof(struct net_device_stats)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 604 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 605 | spin_lock_init(&adapter->staInfo_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 606 | |
| 607 | for (STAId = 0; STAId < WLAN_MAX_STA_COUNT; STAId++) { |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 608 | qdf_mem_zero(&adapter->aStaInfo[STAId], |
Jeff Johnson | 8215592 | 2017-09-30 16:54:14 -0700 | [diff] [blame] | 609 | sizeof(struct hdd_station_info)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 610 | } |
| 611 | |
| 612 | return status; |
| 613 | } |
| 614 | |
| 615 | /** |
| 616 | * @hdd_softap_deinit_tx_rx() - Deinitialize Tx/RX module |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 617 | * @adapter: pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 618 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 619 | * Return: QDF_STATUS_E_FAILURE if any errors encountered, |
| 620 | * QDF_STATUS_SUCCESS otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 621 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 622 | QDF_STATUS hdd_softap_deinit_tx_rx(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 623 | { |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 624 | if (adapter == NULL) { |
| 625 | hdd_err("Called with adapter = NULL."); |
Dhanashri Atre | ed3bf51 | 2017-02-21 12:25:53 -0800 | [diff] [blame] | 626 | return QDF_STATUS_E_FAILURE; |
| 627 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 628 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 629 | adapter->txrx_vdev = NULL; |
| 630 | adapter->tx_fn = NULL; |
Dhanashri Atre | ed3bf51 | 2017-02-21 12:25:53 -0800 | [diff] [blame] | 631 | hdd_info("Deregistering TX function hook !"); |
| 632 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 633 | } |
| 634 | |
| 635 | /** |
| 636 | * hdd_softap_init_tx_rx_sta() - Initialize tx/rx for a softap station |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 637 | * @adapter: pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 638 | * @STAId: Station ID to initialize |
| 639 | * @pmacAddrSTA: pointer to the MAC address of the station |
| 640 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 641 | * Return: QDF_STATUS_E_FAILURE if any errors encountered, |
| 642 | * QDF_STATUS_SUCCESS otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 643 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 644 | QDF_STATUS hdd_softap_init_tx_rx_sta(struct hdd_adapter *adapter, |
Jeff Johnson | 18dd7e1 | 2017-08-29 14:22:28 -0700 | [diff] [blame] | 645 | uint8_t STAId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 646 | struct qdf_mac_addr *pmacAddrSTA) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 647 | { |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 648 | spin_lock_bh(&adapter->staInfo_lock); |
| 649 | if (adapter->aStaInfo[STAId].isUsed) { |
| 650 | spin_unlock_bh(&adapter->staInfo_lock); |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 651 | hdd_err("Reinit of in use station %d", STAId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 652 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 653 | } |
| 654 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 655 | qdf_mem_zero(&adapter->aStaInfo[STAId], |
Jeff Johnson | 8215592 | 2017-09-30 16:54:14 -0700 | [diff] [blame] | 656 | sizeof(struct hdd_station_info)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 657 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 658 | adapter->aStaInfo[STAId].isUsed = true; |
| 659 | adapter->aStaInfo[STAId].isDeauthInProgress = false; |
| 660 | qdf_copy_macaddr(&adapter->aStaInfo[STAId].macAddrSTA, pmacAddrSTA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 661 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 662 | spin_unlock_bh(&adapter->staInfo_lock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 663 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 664 | } |
| 665 | |
| 666 | /** |
| 667 | * hdd_softap_deinit_tx_rx_sta() - Deinitialize tx/rx for a softap station |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 668 | * @adapter: pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 669 | * @STAId: Station ID to deinitialize |
| 670 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 671 | * Return: QDF_STATUS_E_FAILURE if any errors encountered, |
| 672 | * QDF_STATUS_SUCCESS otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 673 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 674 | QDF_STATUS hdd_softap_deinit_tx_rx_sta(struct hdd_adapter *adapter, |
Jeff Johnson | 18dd7e1 | 2017-08-29 14:22:28 -0700 | [diff] [blame] | 675 | uint8_t STAId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 676 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 677 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 5c19ade | 2017-10-04 09:52:12 -0700 | [diff] [blame] | 678 | struct hdd_hostapd_state *hostapd_state; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 679 | |
Jeff Johnson | 5c19ade | 2017-10-04 09:52:12 -0700 | [diff] [blame] | 680 | hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 681 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 682 | spin_lock_bh(&adapter->staInfo_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 683 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 684 | if (false == adapter->aStaInfo[STAId].isUsed) { |
| 685 | spin_unlock_bh(&adapter->staInfo_lock); |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 686 | hdd_err("Deinit station not inited %d", STAId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 687 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 688 | } |
| 689 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 690 | adapter->aStaInfo[STAId].isUsed = false; |
| 691 | adapter->aStaInfo[STAId].isDeauthInProgress = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 692 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 693 | spin_unlock_bh(&adapter->staInfo_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 694 | return status; |
| 695 | } |
| 696 | |
| 697 | /** |
| 698 | * hdd_softap_rx_packet_cbk() - Receive packet handler |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 699 | * @context: pointer to HDD context |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 700 | * @rxBuf: pointer to rx qdf_nbuf |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 701 | * |
| 702 | * Receive callback registered with TL. TL will call this to notify |
| 703 | * the HDD when one or more packets were received for a registered |
| 704 | * STA. |
| 705 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 706 | * Return: QDF_STATUS_E_FAILURE if any errors encountered, |
| 707 | * QDF_STATUS_SUCCESS otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 708 | */ |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 709 | QDF_STATUS hdd_softap_rx_packet_cbk(void *context, qdf_nbuf_t rxBuf) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 710 | { |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 711 | struct hdd_adapter *adapter = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 712 | int rxstat; |
| 713 | unsigned int cpu_index; |
| 714 | struct sk_buff *skb = NULL; |
Dhanashri Atre | cefa880 | 2017-02-02 16:17:14 -0800 | [diff] [blame] | 715 | struct sk_buff *next = NULL; |
Jeff Johnson | 9240287 | 2017-09-03 09:25:37 -0700 | [diff] [blame] | 716 | struct hdd_context *hdd_ctx = NULL; |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 717 | struct qdf_mac_addr src_mac; |
| 718 | uint8_t staid; |
Mohit Khanna | f8f9682 | 2017-05-17 17:11:59 -0700 | [diff] [blame] | 719 | bool proto_pkt_logged = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 720 | |
| 721 | /* Sanity check on inputs */ |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 722 | if (unlikely((NULL == context) || (NULL == rxBuf))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 723 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 724 | "%s: Null params being passed", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 725 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 726 | } |
| 727 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 728 | adapter = (struct hdd_adapter *)context; |
| 729 | if (unlikely(WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { |
Srinivas Girigowda | 028c448 | 2017-03-09 18:52:02 -0800 | [diff] [blame] | 730 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR, |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 731 | "Magic cookie(%x) for adapter sanity verification is invalid", |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 732 | adapter->magic); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 733 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 734 | } |
| 735 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 736 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | 9240287 | 2017-09-03 09:25:37 -0700 | [diff] [blame] | 737 | if (unlikely(NULL == hdd_ctx)) { |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 738 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
| 739 | "%s: HDD context is Null", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 740 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 741 | } |
| 742 | |
| 743 | /* walk the chain until all are processed */ |
Dhanashri Atre | cefa880 | 2017-02-02 16:17:14 -0800 | [diff] [blame] | 744 | next = (struct sk_buff *)rxBuf; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 745 | |
Dhanashri Atre | cefa880 | 2017-02-02 16:17:14 -0800 | [diff] [blame] | 746 | while (next) { |
| 747 | skb = next; |
| 748 | next = skb->next; |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 749 | skb->next = NULL; |
Dhanashri Atre | cefa880 | 2017-02-02 16:17:14 -0800 | [diff] [blame] | 750 | |
psimha | 884025c | 2017-08-01 15:07:32 -0700 | [diff] [blame] | 751 | #ifdef QCA_WIFI_QCA6290 /* Debug code, remove later */ |
Venkata Sharath Chandra Manchala | cc78917 | 2017-07-25 23:28:45 -0700 | [diff] [blame] | 752 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_INFO, |
Jeff Johnson | 36e74c4 | 2017-09-18 08:15:42 -0700 | [diff] [blame] | 753 | "%s: skb %pK skb->len %d\n", __func__, skb, skb->len); |
Dhanashri Atre | cefa880 | 2017-02-02 16:17:14 -0800 | [diff] [blame] | 754 | #endif |
| 755 | |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 756 | hdd_softap_dump_sk_buff(skb); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 757 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 758 | skb->dev = adapter->dev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 759 | |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 760 | if (unlikely(skb->dev == NULL)) { |
| 761 | |
| 762 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
| 763 | "%s: ERROR!!Invalid netdevice", __func__); |
Dhanashri Atre | cefa880 | 2017-02-02 16:17:14 -0800 | [diff] [blame] | 764 | continue; |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 765 | } |
| 766 | cpu_index = wlan_hdd_get_cpu(); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 767 | ++adapter->hdd_stats.hddTxRxStats.rxPackets[cpu_index]; |
| 768 | ++adapter->stats.rx_packets; |
| 769 | adapter->stats.rx_bytes += skb->len; |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 770 | |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 771 | qdf_mem_copy(&src_mac, skb->data + QDF_NBUF_SRC_MAC_OFFSET, |
| 772 | sizeof(src_mac)); |
| 773 | if (QDF_STATUS_SUCCESS == |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 774 | hdd_softap_get_sta_id(adapter, &src_mac, &staid)) { |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 775 | if (staid < WLAN_MAX_STA_COUNT) { |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 776 | adapter->aStaInfo[staid].rx_packets++; |
| 777 | adapter->aStaInfo[staid].rx_bytes += skb->len; |
| 778 | adapter->aStaInfo[staid].last_tx_rx_ts = |
Will Huang | 496b36c | 2017-07-11 16:38:50 +0800 | [diff] [blame] | 779 | qdf_system_ticks(); |
| 780 | } |
| 781 | } |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 782 | hdd_event_eapol_log(skb, QDF_RX); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 783 | proto_pkt_logged = qdf_dp_trace_log_pkt(adapter->sessionId, |
Mohit Khanna | f8f9682 | 2017-05-17 17:11:59 -0700 | [diff] [blame] | 784 | skb, QDF_RX, |
| 785 | QDF_TRACE_DEFAULT_PDEV_ID); |
Himanshu Agarwal | ee3411a | 2017-01-31 12:56:47 +0530 | [diff] [blame] | 786 | DPTRACE(qdf_dp_trace(skb, |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 787 | QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 788 | QDF_TRACE_DEFAULT_PDEV_ID, |
Himanshu Agarwal | ee3411a | 2017-01-31 12:56:47 +0530 | [diff] [blame] | 789 | qdf_nbuf_data_addr(skb), |
| 790 | sizeof(qdf_nbuf_data(skb)), QDF_RX)); |
Mohit Khanna | f8f9682 | 2017-05-17 17:11:59 -0700 | [diff] [blame] | 791 | if (!proto_pkt_logged) { |
| 792 | DPTRACE(qdf_dp_trace(skb, |
| 793 | QDF_DP_TRACE_HDD_RX_PACKET_RECORD, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 794 | QDF_TRACE_DEFAULT_PDEV_ID, |
| 795 | (uint8_t *)skb->data, qdf_nbuf_len(skb), |
| 796 | QDF_RX)); |
Mohit Khanna | f8f9682 | 2017-05-17 17:11:59 -0700 | [diff] [blame] | 797 | if (qdf_nbuf_len(skb) > QDF_DP_TRACE_RECORD_SIZE) |
| 798 | DPTRACE(qdf_dp_trace(skb, |
Himanshu Agarwal | ee3411a | 2017-01-31 12:56:47 +0530 | [diff] [blame] | 799 | QDF_DP_TRACE_HDD_RX_PACKET_RECORD, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 800 | QDF_TRACE_DEFAULT_PDEV_ID, |
Himanshu Agarwal | ee3411a | 2017-01-31 12:56:47 +0530 | [diff] [blame] | 801 | (uint8_t *)&skb->data[QDF_DP_TRACE_RECORD_SIZE], |
| 802 | (qdf_nbuf_len(skb)-QDF_DP_TRACE_RECORD_SIZE), |
| 803 | QDF_RX)); |
Mohit Khanna | f8f9682 | 2017-05-17 17:11:59 -0700 | [diff] [blame] | 804 | } |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 805 | |
| 806 | skb->protocol = eth_type_trans(skb, skb->dev); |
| 807 | |
| 808 | /* hold configurable wakelock for unicast traffic */ |
Jeff Johnson | 9240287 | 2017-09-03 09:25:37 -0700 | [diff] [blame] | 809 | if (hdd_ctx->config->rx_wakelock_timeout && |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 810 | skb->pkt_type != PACKET_BROADCAST && |
| 811 | skb->pkt_type != PACKET_MULTICAST) { |
Jeff Johnson | 9240287 | 2017-09-03 09:25:37 -0700 | [diff] [blame] | 812 | cds_host_diag_log_work(&hdd_ctx->rx_wake_lock, |
| 813 | hdd_ctx->config->rx_wakelock_timeout, |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 814 | WIFI_POWER_EVENT_WAKELOCK_HOLD_RX); |
Jeff Johnson | 9240287 | 2017-09-03 09:25:37 -0700 | [diff] [blame] | 815 | qdf_wake_lock_timeout_acquire(&hdd_ctx->rx_wake_lock, |
| 816 | hdd_ctx->config-> |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 817 | rx_wakelock_timeout); |
| 818 | } |
| 819 | |
| 820 | /* Remove SKB from internal tracking table before submitting |
| 821 | * it to stack |
| 822 | */ |
Manjunathappa Prakash | 17c07bd | 2017-04-27 21:24:28 -0700 | [diff] [blame] | 823 | qdf_net_buf_debug_release_skb(skb); |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 824 | if (hdd_napi_enabled(HDD_NAPI_ANY) && |
Jeff Johnson | 9240287 | 2017-09-03 09:25:37 -0700 | [diff] [blame] | 825 | !hdd_ctx->enableRxThread) |
Dhanashri Atre | 63d9802 | 2017-01-24 18:22:09 -0800 | [diff] [blame] | 826 | rxstat = netif_receive_skb(skb); |
| 827 | else |
| 828 | rxstat = netif_rx_ni(skb); |
Srinivas Girigowda | e806a82 | 2017-03-25 11:25:30 -0700 | [diff] [blame] | 829 | if (NET_RX_SUCCESS == rxstat) |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 830 | ++adapter->hdd_stats.hddTxRxStats.rxDelivered[cpu_index]; |
Srinivas Girigowda | e806a82 | 2017-03-25 11:25:30 -0700 | [diff] [blame] | 831 | else |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 832 | ++adapter->hdd_stats.hddTxRxStats.rxRefused[cpu_index]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 833 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 834 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 835 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 836 | } |
| 837 | |
| 838 | /** |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 839 | * hdd_softap_deregister_sta(struct hdd_adapter *adapter, uint8_t staId) |
| 840 | * @adapter: pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 841 | * @staId: Station ID to deregister |
| 842 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 843 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 844 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 845 | QDF_STATUS hdd_softap_deregister_sta(struct hdd_adapter *adapter, |
Jeff Johnson | 18dd7e1 | 2017-08-29 14:22:28 -0700 | [diff] [blame] | 846 | uint8_t staId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 847 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 848 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 9240287 | 2017-09-03 09:25:37 -0700 | [diff] [blame] | 849 | struct hdd_context *hdd_ctx; |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 850 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 851 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 852 | if (NULL == adapter) { |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 853 | hdd_err("NULL adapter"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 854 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 855 | } |
| 856 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 857 | if (WLAN_HDD_ADAPTER_MAGIC != adapter->magic) { |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 858 | hdd_err("Invalid adapter magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 859 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 860 | } |
| 861 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 862 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 863 | /* Clear station in TL and then update HDD data |
| 864 | * structures. This helps to block RX frames from other |
| 865 | * station to this station. |
| 866 | */ |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 867 | qdf_status = cdp_clear_peer(cds_get_context(QDF_MODULE_ID_SOC), |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 868 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
| 869 | staId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 870 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 871 | hdd_err("cdp_clear_peer failed for staID %d, Status=%d [0x%08X]", |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 872 | staId, qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 873 | } |
| 874 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 875 | ret = hdd_objmgr_remove_peer_object(adapter->hdd_vdev, |
| 876 | adapter->aStaInfo[staId]. |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 877 | macAddrSTA.bytes); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 878 | if (ret) |
| 879 | hdd_err("Peer obj %pM delete fails", |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 880 | adapter->aStaInfo[staId].macAddrSTA.bytes); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 881 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 882 | if (adapter->aStaInfo[staId].isUsed) { |
| 883 | spin_lock_bh(&adapter->staInfo_lock); |
| 884 | qdf_mem_zero(&adapter->aStaInfo[staId], |
Jeff Johnson | 8215592 | 2017-09-30 16:54:14 -0700 | [diff] [blame] | 885 | sizeof(struct hdd_station_info)); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 886 | spin_unlock_bh(&adapter->staInfo_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 887 | } |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 888 | |
Jeff Johnson | 9240287 | 2017-09-03 09:25:37 -0700 | [diff] [blame] | 889 | hdd_ctx->sta_to_adapter[staId] = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 890 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 891 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 892 | } |
| 893 | |
| 894 | /** |
| 895 | * hdd_softap_register_sta() - Register a SoftAP STA |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 896 | * @adapter: pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 897 | * @fAuthRequired: is additional authentication required? |
| 898 | * @fPrivacyBit: should 802.11 privacy bit be set? |
| 899 | * @staId: station ID assigned to this station |
| 900 | * @ucastSig: unicast security signature |
| 901 | * @bcastSig: broadcast security signature |
| 902 | * @pPeerMacAddress: station MAC address |
| 903 | * @fWmmEnabled: is WMM enabled for this STA? |
| 904 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 905 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 906 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 907 | QDF_STATUS hdd_softap_register_sta(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 908 | bool fAuthRequired, |
| 909 | bool fPrivacyBit, |
| 910 | uint8_t staId, |
| 911 | uint8_t ucastSig, |
| 912 | uint8_t bcastSig, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 913 | struct qdf_mac_addr *pPeerMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 914 | bool fWmmEnabled) |
| 915 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 916 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 917 | struct ol_txrx_desc_type staDesc = { 0 }; |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 918 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 919 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 920 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 921 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 922 | |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 923 | hdd_info("STA:%u, Auth:%u, Priv:%u, WMM:%u", |
| 924 | staId, fAuthRequired, fPrivacyBit, fWmmEnabled); |
| 925 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 926 | /* |
| 927 | * Clean up old entry if it is not cleaned up properly |
| 928 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 929 | if (adapter->aStaInfo[staId].isUsed) { |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 930 | hdd_info("clean up old entry for STA %d", staId); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 931 | hdd_softap_deregister_sta(adapter, staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 932 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 933 | |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 934 | /* Get the Station ID from the one saved during the assocation. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 935 | staDesc.sta_id = staId; |
| 936 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 937 | /* Save the adapter Pointer for this staId */ |
| 938 | hdd_ctx->sta_to_adapter[staId] = adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 939 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 940 | qdf_status = |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 941 | hdd_softap_init_tx_rx_sta(adapter, staId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 942 | pPeerMacAddress); |
| 943 | |
| 944 | staDesc.is_qos_enabled = fWmmEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 945 | |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 946 | /* Register the vdev transmit and receive functions */ |
| 947 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 948 | txrx_ops.rx.rx = hdd_softap_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 949 | cdp_vdev_register(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 950 | (struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc, |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 951 | (struct cdp_pdev *)pdev, adapter->sessionId), |
| 952 | adapter, &txrx_ops); |
| 953 | adapter->txrx_vdev = (void *)cdp_get_vdev_from_vdev_id(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 954 | (struct cdp_pdev *)pdev, |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 955 | adapter->sessionId); |
| 956 | adapter->tx_fn = txrx_ops.tx.tx; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 957 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 958 | qdf_status = cdp_peer_register(soc, |
| 959 | (struct cdp_pdev *)pdev, &staDesc); |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 960 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 961 | hdd_err("cdp_peer_register() failed to register. Status = %d [0x%08X]", |
| 962 | qdf_status, qdf_status); |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 963 | return qdf_status; |
| 964 | } |
| 965 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 966 | /* if ( WPA ), tell TL to go to 'connected' and after keys come to the |
| 967 | * driver then go to 'authenticated'. For all other authentication |
| 968 | * types (those that do not require upper layer authentication) we can |
| 969 | * put TL directly into 'authenticated' state |
| 970 | */ |
| 971 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 972 | adapter->aStaInfo[staId].ucSTAId = staId; |
| 973 | adapter->aStaInfo[staId].isQosEnabled = fWmmEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 974 | |
| 975 | if (!fAuthRequired) { |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 976 | hdd_info("open/shared auth StaId= %d. Changing TL state to AUTHENTICATED at Join time", |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 977 | adapter->aStaInfo[staId].ucSTAId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 978 | |
| 979 | /* Connections that do not need Upper layer auth, |
| 980 | * transition TL directly to 'Authenticated' state. |
| 981 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 982 | qdf_status = hdd_change_peer_state(adapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 983 | OL_TXRX_PEER_STATE_AUTH, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 984 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 985 | adapter->aStaInfo[staId].tlSTAState = OL_TXRX_PEER_STATE_AUTH; |
| 986 | adapter->sessionCtx.ap.uIsAuthenticated = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 987 | } else { |
| 988 | |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 989 | hdd_info("ULA auth StaId= %d. Changing TL state to CONNECTED at Join time", |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 990 | adapter->aStaInfo[staId].ucSTAId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 991 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 992 | qdf_status = hdd_change_peer_state(adapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 993 | OL_TXRX_PEER_STATE_CONN, false); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 994 | adapter->aStaInfo[staId].tlSTAState = OL_TXRX_PEER_STATE_CONN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 995 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 996 | adapter->sessionCtx.ap.uIsAuthenticated = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 997 | |
| 998 | } |
| 999 | |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1000 | hdd_debug("Enabling queues"); |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1001 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1002 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 1003 | WLAN_CONTROL_PATH); |
| 1004 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1005 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1006 | } |
| 1007 | |
| 1008 | /** |
| 1009 | * hdd_softap_register_bc_sta() - Register the SoftAP broadcast STA |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1010 | * @adapter: pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1011 | * @fPrivacyBit: should 802.11 privacy bit be set? |
| 1012 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1013 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1014 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1015 | QDF_STATUS hdd_softap_register_bc_sta(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1016 | bool fPrivacyBit) |
| 1017 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1018 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1019 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1020 | struct qdf_mac_addr broadcastMacAddr = |
| 1021 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Jeff Johnson | 9bf2497 | 2017-10-04 09:26:58 -0700 | [diff] [blame] | 1022 | struct hdd_ap_ctx *ap_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1023 | |
Jeff Johnson | 9bf2497 | 2017-10-04 09:26:58 -0700 | [diff] [blame] | 1024 | ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1025 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1026 | hdd_ctx->sta_to_adapter[WLAN_RX_BCMC_STA_ID] = adapter; |
Jeff Johnson | 9bf2497 | 2017-10-04 09:26:58 -0700 | [diff] [blame] | 1027 | hdd_ctx->sta_to_adapter[ap_ctx->uBCStaId] = adapter; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1028 | qdf_status = |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1029 | hdd_softap_register_sta(adapter, false, fPrivacyBit, |
| 1030 | (WLAN_HDD_GET_AP_CTX_PTR(adapter))-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1031 | uBCStaId, 0, 1, &broadcastMacAddr, 0); |
| 1032 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1033 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1034 | } |
| 1035 | |
| 1036 | /** |
| 1037 | * hdd_softap_deregister_bc_sta() - Deregister the SoftAP broadcast STA |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1038 | * @adapter: pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1039 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1040 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1041 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1042 | QDF_STATUS hdd_softap_deregister_bc_sta(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1043 | { |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1044 | return hdd_softap_deregister_sta(adapter, |
| 1045 | (WLAN_HDD_GET_AP_CTX_PTR(adapter))-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1046 | uBCStaId); |
| 1047 | } |
| 1048 | |
| 1049 | /** |
| 1050 | * hdd_softap_stop_bss() - Stop the BSS |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1051 | * @adapter: pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1052 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1053 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1054 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1055 | QDF_STATUS hdd_softap_stop_bss(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1056 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1057 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1058 | uint8_t staId = 0; |
Jeff Johnson | 9240287 | 2017-09-03 09:25:37 -0700 | [diff] [blame] | 1059 | struct hdd_context *hdd_ctx; |
Srinivas Girigowda | e806a82 | 2017-03-25 11:25:30 -0700 | [diff] [blame] | 1060 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1061 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1062 | |
| 1063 | /* bss deregister is not allowed during wlan driver loading or |
| 1064 | * unloading |
| 1065 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1066 | if (cds_is_load_or_unload_in_progress()) { |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 1067 | hdd_err("Loading_unloading in Progress, state: 0x%x. Ignore!!!", |
| 1068 | cds_get_driver_state()); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1069 | return QDF_STATUS_E_PERM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1070 | } |
| 1071 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1072 | qdf_status = hdd_softap_deregister_bc_sta(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1073 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1074 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 1075 | hdd_err("Failed to deregister BC sta Id %d", |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1076 | (WLAN_HDD_GET_AP_CTX_PTR(adapter))->uBCStaId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1077 | } |
| 1078 | |
| 1079 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) { |
| 1080 | /* This excludes BC sta as it is already deregistered */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1081 | if (adapter->aStaInfo[staId].isUsed) { |
| 1082 | qdf_status = hdd_softap_deregister_sta(adapter, staId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1083 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 1084 | hdd_err("Failed to deregister sta Id %d", |
| 1085 | staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1086 | } |
| 1087 | } |
| 1088 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1089 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1090 | } |
| 1091 | |
| 1092 | /** |
| 1093 | * hdd_softap_change_sta_state() - Change the state of a SoftAP station |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1094 | * @adapter: pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1095 | * @pDestMacAddress: MAC address of the station |
| 1096 | * @state: new state of the station |
| 1097 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1098 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1099 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1100 | QDF_STATUS hdd_softap_change_sta_state(struct hdd_adapter *adapter, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1101 | struct qdf_mac_addr *pDestMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1102 | enum ol_txrx_peer_state state) |
| 1103 | { |
| 1104 | uint8_t ucSTAId = WLAN_MAX_STA_COUNT; |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 1105 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1106 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1107 | ENTER_DEV(adapter->dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1108 | |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1109 | qdf_status = hdd_softap_get_sta_id(adapter, pDestMacAddress, &ucSTAId); |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 1110 | if (QDF_STATUS_SUCCESS != qdf_status) { |
| 1111 | hdd_err("Failed to find right station"); |
| 1112 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1113 | } |
| 1114 | |
| 1115 | if (false == |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1116 | qdf_is_macaddr_equal(&adapter->aStaInfo[ucSTAId].macAddrSTA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1117 | pDestMacAddress)) { |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 1118 | hdd_err("Station %u MAC address not matching", ucSTAId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1119 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1120 | } |
| 1121 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1122 | qdf_status = |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1123 | hdd_change_peer_state(adapter, ucSTAId, state, false); |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 1124 | hdd_info("Station %u changed to state %d", ucSTAId, state); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1125 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1126 | if (QDF_STATUS_SUCCESS == qdf_status) { |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1127 | adapter->aStaInfo[ucSTAId].tlSTAState = |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1128 | OL_TXRX_PEER_STATE_AUTH; |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1129 | p2p_peer_authorized(adapter->hdd_vdev, pDestMacAddress->bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1130 | } |
| 1131 | |
Jeff Johnson | d5bd6fd | 2016-12-05 12:29:21 -0800 | [diff] [blame] | 1132 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1133 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1134 | } |
| 1135 | |
| 1136 | /* |
| 1137 | * hdd_softap_get_sta_id() - Find station ID from MAC address |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1138 | * @adapter: pointer to adapter context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1139 | * @pDestMacAddress: MAC address of the destination |
| 1140 | * @staId: Station ID associated with the MAC address |
| 1141 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1142 | * Return: QDF_STATUS_SUCCESS if a match was found, in which case |
| 1143 | * staId is populated, QDF_STATUS_E_FAILURE if a match is |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1144 | * not found |
| 1145 | */ |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1146 | QDF_STATUS hdd_softap_get_sta_id(struct hdd_adapter *adapter, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1147 | struct qdf_mac_addr *pMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1148 | uint8_t *staId) |
| 1149 | { |
| 1150 | uint8_t i; |
| 1151 | |
| 1152 | for (i = 0; i < WLAN_MAX_STA_COUNT; i++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1153 | if (!qdf_mem_cmp |
Jeff Johnson | d31ab6a | 2017-10-02 13:23:51 -0700 | [diff] [blame] | 1154 | (&adapter->aStaInfo[i].macAddrSTA, pMacAddress, |
| 1155 | QDF_MAC_ADDR_SIZE) && adapter->aStaInfo[i].isUsed) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1156 | *staId = i; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1157 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1158 | } |
| 1159 | } |
| 1160 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1161 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1162 | } |