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