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