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