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