Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Orhan K AKYILDIZ | 4f20db5 | 2015-12-30 12:35:44 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2016 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 | |
| 28 | /* Include files */ |
| 29 | #include <linux/semaphore.h> |
| 30 | #include <wlan_hdd_tx_rx.h> |
| 31 | #include <wlan_hdd_softap_tx_rx.h> |
| 32 | #include <linux/netdevice.h> |
| 33 | #include <linux/skbuff.h> |
| 34 | #include <linux/etherdevice.h> |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 35 | #include <qdf_types.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 36 | #include <ani_global.h> |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 37 | #include <qdf_types.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 38 | #include <net/ieee80211_radiotap.h> |
| 39 | #include <cds_sched.h> |
| 40 | #include <wlan_hdd_napi.h> |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 41 | #include <ol_txrx.h> |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 42 | #include <cdp_txrx_peer_ops.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 43 | |
| 44 | #ifdef IPA_OFFLOAD |
| 45 | #include <wlan_hdd_ipa.h> |
| 46 | #endif |
| 47 | |
| 48 | /* Preprocessor definitions and constants */ |
| 49 | #undef QCA_HDD_SAP_DUMP_SK_BUFF |
| 50 | |
| 51 | /* Type declarations */ |
| 52 | |
| 53 | /* Function definitions and documenation */ |
| 54 | #ifdef QCA_HDD_SAP_DUMP_SK_BUFF |
| 55 | /** |
| 56 | * hdd_softap_dump_sk_buff() - Dump an skb |
| 57 | * @skb: skb to dump |
| 58 | * |
| 59 | * Return: None |
| 60 | */ |
| 61 | static void hdd_softap_dump_sk_buff(struct sk_buff *skb) |
| 62 | { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 63 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 64 | "%s: head = %p ", __func__, skb->head); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 65 | /* QDF_TRACE( QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR,"%s: data = %p ", __func__, skb->data); */ |
| 66 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 67 | "%s: tail = %p ", __func__, skb->tail); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 68 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 69 | "%s: end = %p ", __func__, skb->end); |
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: len = %d ", __func__, skb->len); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 72 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 73 | "%s: data_len = %d ", __func__, skb->data_len); |
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: mac_len = %d", __func__, skb->mac_len); |
| 76 | |
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 | "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x ", skb->data[0], |
| 79 | skb->data[1], skb->data[2], skb->data[3], skb->data[4], |
| 80 | skb->data[5], skb->data[6], skb->data[7]); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 81 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 82 | "0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", skb->data[8], |
| 83 | skb->data[9], skb->data[10], skb->data[11], skb->data[12], |
| 84 | skb->data[13], skb->data[14], skb->data[15]); |
| 85 | } |
| 86 | #else |
| 87 | static void hdd_softap_dump_sk_buff(struct sk_buff *skb) |
| 88 | { |
| 89 | } |
| 90 | #endif |
| 91 | |
| 92 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 93 | /** |
| 94 | * hdd_softap_tx_resume_timer_expired_handler() - TX Q resume timer handler |
| 95 | * @adapter_context: pointer to vdev adapter |
| 96 | * |
| 97 | * TX Q resume timer handler for SAP and P2P GO interface. If Blocked |
| 98 | * OS Q is not resumed during timeout period, to prevent permanent |
| 99 | * stall, resume OS Q forcefully for SAP and P2P GO interface. |
| 100 | * |
| 101 | * Return: None |
| 102 | */ |
| 103 | void hdd_softap_tx_resume_timer_expired_handler(void *adapter_context) |
| 104 | { |
| 105 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) adapter_context; |
| 106 | |
| 107 | if (!pAdapter) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 108 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 109 | "%s: INV ARG", __func__); |
| 110 | /* INVALID ARG */ |
| 111 | return; |
| 112 | } |
| 113 | |
| 114 | hddLog(LOG1, FL("Enabling queues")); |
| 115 | wlan_hdd_netif_queue_control(pAdapter, WLAN_WAKE_ALL_NETIF_QUEUE, |
| 116 | WLAN_CONTROL_PATH); |
| 117 | return; |
| 118 | } |
| 119 | |
Poddar, Siddarth | b61cf64 | 2016-04-28 16:02:39 +0530 | [diff] [blame] | 120 | #if defined(CONFIG_PER_VDEV_TX_DESC_POOL) |
| 121 | |
| 122 | /** |
| 123 | * hdd_softap_tx_resume_false() - Resume OS TX Q false leads to queue disabling |
| 124 | * @pAdapter: pointer to hdd adapter |
| 125 | * @tx_resume: TX Q resume trigger |
| 126 | * |
| 127 | * |
| 128 | * Return: None |
| 129 | */ |
| 130 | static void |
| 131 | hdd_softap_tx_resume_false(hdd_adapter_t *pAdapter, bool tx_resume) |
| 132 | { |
| 133 | if (true == tx_resume) |
| 134 | return; |
| 135 | |
| 136 | hdd_notice("Disabling queues"); |
| 137 | wlan_hdd_netif_queue_control(pAdapter, WLAN_STOP_ALL_NETIF_QUEUE, |
| 138 | WLAN_DATA_FLOW_CONTROL); |
| 139 | |
| 140 | if (QDF_TIMER_STATE_STOPPED == |
| 141 | qdf_mc_timer_get_current_state(&pAdapter-> |
| 142 | tx_flow_control_timer)) { |
| 143 | QDF_STATUS status; |
| 144 | status = qdf_mc_timer_start(&pAdapter->tx_flow_control_timer, |
| 145 | WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME); |
| 146 | |
| 147 | if (!QDF_IS_STATUS_SUCCESS(status)) |
| 148 | hdd_err("Failed to start tx_flow_control_timer"); |
| 149 | else |
| 150 | pAdapter->hdd_stats.hddTxRxStats.txflow_timer_cnt++; |
| 151 | } |
| 152 | return; |
| 153 | } |
| 154 | #else |
| 155 | |
| 156 | static inline void |
| 157 | hdd_softap_tx_resume_false(hdd_adapter_t *pAdapter, bool tx_resume) |
| 158 | { |
| 159 | return; |
| 160 | } |
| 161 | #endif |
| 162 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 163 | /** |
| 164 | * hdd_softap_tx_resume_cb() - Resume OS TX Q. |
| 165 | * @adapter_context: pointer to vdev apdapter |
| 166 | * @tx_resume: TX Q resume trigger |
| 167 | * |
| 168 | * Q was stopped due to WLAN TX path low resource condition |
| 169 | * |
| 170 | * Return: None |
| 171 | */ |
| 172 | void hdd_softap_tx_resume_cb(void *adapter_context, bool tx_resume) |
| 173 | { |
| 174 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) adapter_context; |
| 175 | |
| 176 | if (!pAdapter) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 177 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 178 | "%s: INV ARG", __func__); |
| 179 | /* INVALID ARG */ |
| 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 | |
| 191 | hddLog(LOG1, FL("Enabling queues")); |
| 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); |
| 197 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 198 | return; |
| 199 | } |
| 200 | #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ |
| 201 | |
| 202 | /** |
| 203 | * hdd_softap_hard_start_xmit() - Transmit a frame |
| 204 | * @skb: pointer to OS packet (sk_buff) |
| 205 | * @dev: pointer to network device |
| 206 | * |
| 207 | * Function registered with the Linux OS for transmitting |
| 208 | * packets. This version of the function directly passes |
| 209 | * the packet to Transport Layer. |
| 210 | * |
| 211 | * Return: Always returns NETDEV_TX_OK |
| 212 | */ |
| 213 | int hdd_softap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
| 214 | { |
| 215 | sme_ac_enum_type ac = SME_AC_BE; |
| 216 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) netdev_priv(dev); |
| 217 | hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 218 | struct qdf_mac_addr *pDestMacAddress; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 219 | uint8_t STAId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 220 | |
| 221 | ++pAdapter->hdd_stats.hddTxRxStats.txXmitCalled; |
| 222 | /* Prevent this function from being called during SSR since TL |
| 223 | * context may not be reinitialized at this time which may |
| 224 | * lead to a crash. |
| 225 | */ |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 226 | if (cds_is_driver_recovering()) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 227 | 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] | 228 | "%s: Recovery in Progress. Ignore!!!", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 229 | goto drop_pkt; |
| 230 | } |
| 231 | |
| 232 | /* |
| 233 | * If the device is operating on a DFS Channel |
| 234 | * then check if SAP is in CAC WAIT state and |
| 235 | * drop the packets. In CAC WAIT state device |
| 236 | * is expected not to transmit any frames. |
| 237 | * SAP starts Tx only after the BSS START is |
| 238 | * done. |
| 239 | */ |
| 240 | if (pHddApCtx->dfs_cac_block_tx) { |
| 241 | goto drop_pkt; |
| 242 | } |
| 243 | |
Dhanashri Atre | 168d2b4 | 2016-02-22 14:43:06 -0800 | [diff] [blame] | 244 | /* |
| 245 | * If a transmit function is not registered, drop packet |
| 246 | */ |
| 247 | if (!pAdapter->tx_fn) { |
| 248 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO_HIGH, |
| 249 | "%s: TX function not registered by the data path", |
| 250 | __func__); |
| 251 | goto drop_pkt; |
| 252 | } |
| 253 | |
Nirav Shah | 5e74bb8 | 2016-07-20 16:01:27 +0530 | [diff] [blame^] | 254 | wlan_hdd_classify_pkt(skb); |
| 255 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 256 | pDestMacAddress = (struct qdf_mac_addr *) skb->data; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 257 | |
Nirav Shah | 5e74bb8 | 2016-07-20 16:01:27 +0530 | [diff] [blame^] | 258 | if (QDF_NBUF_CB_GET_IS_BCAST(skb) || |
| 259 | QDF_NBUF_CB_GET_IS_MCAST(skb)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 260 | /* The BC/MC station ID is assigned during BSS |
| 261 | * starting phase. SAP will return the station ID |
| 262 | * used for BC/MC traffic. |
| 263 | */ |
| 264 | STAId = pHddApCtx->uBCStaId; |
| 265 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 266 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 267 | hdd_softap_get_sta_id(pAdapter, |
| 268 | pDestMacAddress, &STAId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 269 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
| 270 | QDF_TRACE_LEVEL_WARN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 271 | "%s: Failed to find right station", __func__); |
| 272 | goto drop_pkt; |
| 273 | } |
| 274 | |
| 275 | if (STAId == HDD_WLAN_INVALID_STA_ID) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 276 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
| 277 | QDF_TRACE_LEVEL_WARN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 278 | "%s: Failed to find right station", __func__); |
| 279 | goto drop_pkt; |
| 280 | } else if (false == pAdapter->aStaInfo[STAId].isUsed) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 281 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
| 282 | QDF_TRACE_LEVEL_WARN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 283 | "%s: STA %d is unregistered", __func__, |
| 284 | STAId); |
| 285 | goto drop_pkt; |
| 286 | } |
| 287 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 288 | if ((OL_TXRX_PEER_STATE_CONN != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 289 | pAdapter->aStaInfo[STAId].tlSTAState) |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 290 | && (OL_TXRX_PEER_STATE_AUTH != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 291 | pAdapter->aStaInfo[STAId].tlSTAState)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 292 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
| 293 | QDF_TRACE_LEVEL_WARN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 294 | "%s: Station not connected yet", __func__); |
| 295 | goto drop_pkt; |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 296 | } else if (OL_TXRX_PEER_STATE_CONN == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 297 | pAdapter->aStaInfo[STAId].tlSTAState) { |
| 298 | if (ntohs(skb->protocol) != HDD_ETHERTYPE_802_1_X) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 299 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
| 300 | QDF_TRACE_LEVEL_WARN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 301 | "%s: NON-EAPOL packet in non-Authenticated state", |
| 302 | __func__); |
| 303 | goto drop_pkt; |
| 304 | } |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | hdd_get_tx_resource(pAdapter, STAId, |
| 309 | WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME); |
| 310 | |
| 311 | /* Get TL AC corresponding to Qdisc queue index/AC. */ |
| 312 | ac = hdd_qdisc_ac_to_tl_ac[skb->queue_mapping]; |
| 313 | ++pAdapter->hdd_stats.hddTxRxStats.txXmitClassifiedAC[ac]; |
| 314 | |
| 315 | #if defined (IPA_OFFLOAD) |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 316 | if (!qdf_nbuf_ipa_owned_get(skb)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 317 | #endif |
| 318 | /* Check if the buffer has enough header room */ |
| 319 | skb = skb_unshare(skb, GFP_ATOMIC); |
| 320 | if (!skb) |
Jeff Johnson | edeff23 | 2015-11-11 17:19:42 -0800 | [diff] [blame] | 321 | goto drop_pkt_accounting; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 322 | #if defined (IPA_OFFLOAD) |
| 323 | } |
| 324 | #endif |
| 325 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 326 | pAdapter->stats.tx_bytes += skb->len; |
| 327 | ++pAdapter->stats.tx_packets; |
| 328 | |
Nirav Shah | 5e74bb8 | 2016-07-20 16:01:27 +0530 | [diff] [blame^] | 329 | hdd_event_eapol_log(skb, QDF_TX); |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 330 | qdf_dp_trace_log_pkt(pAdapter->sessionId, skb, QDF_TX); |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 331 | QDF_NBUF_CB_TX_PACKET_TRACK(skb) = QDF_NBUF_TX_PKT_DATA_TRACK; |
| 332 | QDF_NBUF_UPDATE_TX_PKT_COUNT(skb, QDF_NBUF_TX_PKT_HDD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 333 | |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 334 | qdf_dp_trace_set_track(skb, QDF_TX); |
| 335 | DPTRACE(qdf_dp_trace(skb, QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD, |
| 336 | (uint8_t *)&skb->data, sizeof(skb->data), QDF_TX)); |
| 337 | DPTRACE(qdf_dp_trace(skb, QDF_DP_TRACE_HDD_TX_PACKET_RECORD, |
| 338 | (uint8_t *)skb->data, qdf_nbuf_len(skb), QDF_TX)); |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 339 | if (qdf_nbuf_len(skb) > QDF_DP_TRACE_RECORD_SIZE) |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 340 | DPTRACE(qdf_dp_trace(skb, QDF_DP_TRACE_HDD_TX_PACKET_RECORD, |
| 341 | (uint8_t *)&skb->data[QDF_DP_TRACE_RECORD_SIZE], |
| 342 | (qdf_nbuf_len(skb)-QDF_DP_TRACE_RECORD_SIZE), QDF_TX)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 343 | |
Dhanashri Atre | 168d2b4 | 2016-02-22 14:43:06 -0800 | [diff] [blame] | 344 | if (pAdapter->tx_fn(ol_txrx_get_vdev_by_sta_id(STAId), |
| 345 | (qdf_nbuf_t) skb) != NULL) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 346 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_WARN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 347 | "%s: Failed to send packet to txrx for staid:%d", |
| 348 | __func__, STAId); |
| 349 | ++pAdapter->hdd_stats.hddTxRxStats.txXmitDroppedAC[ac]; |
| 350 | goto drop_pkt; |
| 351 | } |
| 352 | dev->trans_start = jiffies; |
| 353 | |
| 354 | return NETDEV_TX_OK; |
| 355 | |
| 356 | drop_pkt: |
| 357 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 358 | DPTRACE(qdf_dp_trace(skb, QDF_DP_TRACE_DROP_PACKET_RECORD, |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 359 | (uint8_t *)skb->data, qdf_nbuf_len(skb), QDF_TX)); |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 360 | if (qdf_nbuf_len(skb) > QDF_DP_TRACE_RECORD_SIZE) |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 361 | DPTRACE(qdf_dp_trace(skb, QDF_DP_TRACE_DROP_PACKET_RECORD, |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 362 | (uint8_t *)&skb->data[QDF_DP_TRACE_RECORD_SIZE], |
| 363 | (qdf_nbuf_len(skb)-QDF_DP_TRACE_RECORD_SIZE), QDF_TX)); |
Jeff Johnson | edeff23 | 2015-11-11 17:19:42 -0800 | [diff] [blame] | 364 | kfree_skb(skb); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 365 | |
Jeff Johnson | edeff23 | 2015-11-11 17:19:42 -0800 | [diff] [blame] | 366 | drop_pkt_accounting: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 367 | ++pAdapter->stats.tx_dropped; |
| 368 | ++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 369 | |
| 370 | return NETDEV_TX_OK; |
| 371 | } |
| 372 | |
| 373 | /** |
| 374 | * __hdd_softap_tx_timeout() - TX timeout handler |
| 375 | * @dev: pointer to network device |
| 376 | * |
| 377 | * This function is registered as a netdev ndo_tx_timeout method, and |
| 378 | * is invoked by the kernel if the driver takes too long to transmit a |
| 379 | * frame. |
| 380 | * |
| 381 | * Return: None |
| 382 | */ |
| 383 | static void __hdd_softap_tx_timeout(struct net_device *dev) |
| 384 | { |
| 385 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 386 | hdd_context_t *hdd_ctx; |
Nirav Shah | 89223f7 | 2016-03-01 18:10:38 +0530 | [diff] [blame] | 387 | struct netdev_queue *txq; |
| 388 | int i; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 389 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 390 | DPTRACE(qdf_dp_trace(NULL, QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT, |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 391 | NULL, 0, QDF_TX)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 392 | /* Getting here implies we disabled the TX queues for too |
| 393 | * long. Queues are disabled either because of disassociation |
| 394 | * or low resource scenarios. In case of disassociation it is |
| 395 | * ok to ignore this. But if associated, we have do possible |
| 396 | * recovery here |
| 397 | */ |
| 398 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 399 | if (cds_is_driver_recovering()) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 400 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 401 | "%s: Recovery in Progress. Ignore!!!", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 402 | return; |
| 403 | } |
Nirav Shah | 89223f7 | 2016-03-01 18:10:38 +0530 | [diff] [blame] | 404 | |
| 405 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
| 406 | "%s: Transmission timeout occurred jiffies %lu trans_start %lu" |
| 407 | , __func__, jiffies, dev->trans_start); |
| 408 | |
| 409 | for (i = 0; i < NUM_TX_QUEUES; i++) { |
| 410 | txq = netdev_get_tx_queue(dev, i); |
| 411 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, |
| 412 | QDF_TRACE_LEVEL_ERROR, |
| 413 | "Queue%d status: %d txq->trans_start %lu", |
| 414 | i, netif_tx_queue_stopped(txq), txq->trans_start); |
| 415 | } |
| 416 | |
| 417 | wlan_hdd_display_netif_queue_history(hdd_ctx); |
| 418 | ol_tx_dump_flow_pool_info(); |
| 419 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR, |
| 420 | "carrier state: %d", netif_carrier_ok(dev)); |
| 421 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 422 | } |
| 423 | |
| 424 | /** |
| 425 | * hdd_softap_tx_timeout() - SSR wrapper for __hdd_softap_tx_timeout |
| 426 | * @dev: pointer to net_device |
| 427 | * |
| 428 | * Return: none |
| 429 | */ |
| 430 | void hdd_softap_tx_timeout(struct net_device *dev) |
| 431 | { |
| 432 | cds_ssr_protect(__func__); |
| 433 | __hdd_softap_tx_timeout(dev); |
| 434 | cds_ssr_unprotect(__func__); |
| 435 | } |
| 436 | |
| 437 | /** |
| 438 | * @hdd_softap_init_tx_rx() - Initialize Tx/RX module |
| 439 | * @pAdapter: pointer to adapter context |
| 440 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 441 | * Return: QDF_STATUS_E_FAILURE if any errors encountered, |
| 442 | * QDF_STATUS_SUCCESS otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 443 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 444 | QDF_STATUS hdd_softap_init_tx_rx(hdd_adapter_t *pAdapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 445 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 446 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 447 | |
| 448 | uint8_t STAId = 0; |
| 449 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 450 | qdf_mem_zero(&pAdapter->stats, sizeof(struct net_device_stats)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 451 | |
| 452 | spin_lock_init(&pAdapter->staInfo_lock); |
| 453 | |
| 454 | for (STAId = 0; STAId < WLAN_MAX_STA_COUNT; STAId++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 455 | qdf_mem_zero(&pAdapter->aStaInfo[STAId], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 456 | sizeof(hdd_station_info_t)); |
| 457 | } |
| 458 | |
| 459 | return status; |
| 460 | } |
| 461 | |
| 462 | /** |
| 463 | * @hdd_softap_deinit_tx_rx() - Deinitialize Tx/RX module |
| 464 | * @pAdapter: pointer to adapter context |
| 465 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 466 | * Return: QDF_STATUS_E_FAILURE if any errors encountered, |
| 467 | * QDF_STATUS_SUCCESS otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 468 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 469 | QDF_STATUS hdd_softap_deinit_tx_rx(hdd_adapter_t *pAdapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 470 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 471 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 472 | |
| 473 | return status; |
| 474 | } |
| 475 | |
| 476 | /** |
| 477 | * hdd_softap_init_tx_rx_sta() - Initialize tx/rx for a softap station |
| 478 | * @pAdapter: pointer to adapter context |
| 479 | * @STAId: Station ID to initialize |
| 480 | * @pmacAddrSTA: pointer to the MAC address of the station |
| 481 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 482 | * Return: QDF_STATUS_E_FAILURE if any errors encountered, |
| 483 | * QDF_STATUS_SUCCESS otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 484 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 485 | 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] | 486 | struct qdf_mac_addr *pmacAddrSTA) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 487 | { |
| 488 | spin_lock_bh(&pAdapter->staInfo_lock); |
| 489 | if (pAdapter->aStaInfo[STAId].isUsed) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 490 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 491 | "%s: Reinit station %d", __func__, STAId); |
| 492 | spin_unlock_bh(&pAdapter->staInfo_lock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 493 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 494 | } |
| 495 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 496 | qdf_mem_zero(&pAdapter->aStaInfo[STAId], sizeof(hdd_station_info_t)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 497 | |
| 498 | pAdapter->aStaInfo[STAId].isUsed = true; |
| 499 | pAdapter->aStaInfo[STAId].isDeauthInProgress = false; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 500 | qdf_copy_macaddr(&pAdapter->aStaInfo[STAId].macAddrSTA, pmacAddrSTA); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 501 | |
| 502 | spin_unlock_bh(&pAdapter->staInfo_lock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 503 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 504 | } |
| 505 | |
| 506 | /** |
| 507 | * hdd_softap_deinit_tx_rx_sta() - Deinitialize tx/rx for a softap station |
| 508 | * @pAdapter: pointer to adapter context |
| 509 | * @STAId: Station ID to deinitialize |
| 510 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 511 | * Return: QDF_STATUS_E_FAILURE if any errors encountered, |
| 512 | * QDF_STATUS_SUCCESS otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 513 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 514 | 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] | 515 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 516 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 517 | hdd_hostapd_state_t *pHostapdState; |
| 518 | |
| 519 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 520 | |
| 521 | spin_lock_bh(&pAdapter->staInfo_lock); |
| 522 | |
| 523 | if (false == pAdapter->aStaInfo[STAId].isUsed) { |
| 524 | spin_unlock_bh(&pAdapter->staInfo_lock); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 525 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 526 | "%s: Deinit station not inited %d", __func__, STAId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 527 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 528 | } |
| 529 | |
| 530 | pAdapter->aStaInfo[STAId].isUsed = false; |
| 531 | pAdapter->aStaInfo[STAId].isDeauthInProgress = false; |
| 532 | |
| 533 | spin_unlock_bh(&pAdapter->staInfo_lock); |
| 534 | return status; |
| 535 | } |
| 536 | |
| 537 | /** |
| 538 | * hdd_softap_rx_packet_cbk() - Receive packet handler |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 539 | * @context: pointer to HDD context |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 540 | * @rxBuf: pointer to rx qdf_nbuf |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 541 | * |
| 542 | * Receive callback registered with TL. TL will call this to notify |
| 543 | * the HDD when one or more packets were received for a registered |
| 544 | * STA. |
| 545 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 546 | * Return: QDF_STATUS_E_FAILURE if any errors encountered, |
| 547 | * QDF_STATUS_SUCCESS otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 548 | */ |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 549 | 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] | 550 | { |
| 551 | hdd_adapter_t *pAdapter = NULL; |
| 552 | int rxstat; |
| 553 | unsigned int cpu_index; |
| 554 | struct sk_buff *skb = NULL; |
| 555 | hdd_context_t *pHddCtx = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 556 | |
| 557 | /* Sanity check on inputs */ |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 558 | if (unlikely((NULL == context) || (NULL == rxBuf))) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 559 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 560 | "%s: Null params being passed", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 561 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 562 | } |
| 563 | |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 564 | pAdapter = (hdd_adapter_t *)context; |
| 565 | if (unlikely(WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) { |
| 566 | QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_FATAL, |
| 567 | "Magic cookie(%x) for adapter sanity verification is invalid", |
| 568 | pAdapter->magic); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 569 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 570 | } |
| 571 | |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 572 | pHddCtx = pAdapter->pHddCtx; |
| 573 | if (unlikely(NULL == pHddCtx)) { |
| 574 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
| 575 | "%s: HDD context is Null", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 576 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | /* walk the chain until all are processed */ |
| 580 | skb = (struct sk_buff *)rxBuf; |
| 581 | |
| 582 | hdd_softap_dump_sk_buff(skb); |
| 583 | |
| 584 | skb->dev = pAdapter->dev; |
| 585 | |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 586 | if (unlikely(skb->dev == NULL)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 587 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 588 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 589 | "%s: ERROR!!Invalid netdevice", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 590 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 591 | } |
| 592 | cpu_index = wlan_hdd_get_cpu(); |
| 593 | ++pAdapter->hdd_stats.hddTxRxStats.rxPackets[cpu_index]; |
| 594 | ++pAdapter->stats.rx_packets; |
| 595 | pAdapter->stats.rx_bytes += skb->len; |
| 596 | |
Nirav Shah | 5e74bb8 | 2016-07-20 16:01:27 +0530 | [diff] [blame^] | 597 | hdd_event_eapol_log(skb, QDF_RX); |
Nirav Shah | 0d58a7e | 2016-04-26 22:54:12 +0530 | [diff] [blame] | 598 | DPTRACE(qdf_dp_trace(rxBuf, |
| 599 | QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD, |
| 600 | qdf_nbuf_data_addr(rxBuf), |
| 601 | sizeof(qdf_nbuf_data(rxBuf)), QDF_RX)); |
| 602 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 603 | skb->protocol = eth_type_trans(skb, skb->dev); |
| 604 | #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 605 | qdf_wake_lock_timeout_acquire(&pHddCtx->rx_wake_lock, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 606 | HDD_WAKE_LOCK_DURATION, |
| 607 | WIFI_POWER_EVENT_WAKELOCK_HOLD_RX); |
| 608 | #endif |
| 609 | |
| 610 | /* Remove SKB from internal tracking table before submitting |
| 611 | * it to stack |
| 612 | */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 613 | qdf_net_buf_debug_release_skb(rxBuf); |
Nirav Shah | bd36b06 | 2016-07-18 11:12:59 +0530 | [diff] [blame] | 614 | if (hdd_napi_enabled(HDD_NAPI_ANY) && |
| 615 | !pHddCtx->enableRxThread) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 616 | rxstat = netif_receive_skb(skb); |
| 617 | else |
| 618 | rxstat = netif_rx_ni(skb); |
| 619 | if (NET_RX_SUCCESS == rxstat) { |
| 620 | ++pAdapter->hdd_stats.hddTxRxStats.rxDelivered[cpu_index]; |
| 621 | } else { |
| 622 | ++pAdapter->hdd_stats.hddTxRxStats.rxRefused[cpu_index]; |
| 623 | } |
| 624 | |
| 625 | pAdapter->dev->last_rx = jiffies; |
| 626 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 627 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 628 | } |
| 629 | |
| 630 | /** |
| 631 | * hdd_softap_deregister_sta(hdd_adapter_t *pAdapter, uint8_t staId) |
| 632 | * @pAdapter: pointer to adapter context |
| 633 | * @staId: Station ID to deregister |
| 634 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 635 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 636 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 637 | 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] | 638 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 639 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 640 | hdd_context_t *pHddCtx; |
| 641 | |
| 642 | if (NULL == pAdapter) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 643 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 644 | "%s: pAdapter is NULL", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 645 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 646 | } |
| 647 | |
| 648 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 649 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 650 | "%s: Invalid pAdapter magic", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 651 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 652 | } |
| 653 | |
| 654 | pHddCtx = (hdd_context_t *) (pAdapter->pHddCtx); |
| 655 | /* Clear station in TL and then update HDD data |
| 656 | * structures. This helps to block RX frames from other |
| 657 | * station to this station. |
| 658 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 659 | qdf_status = ol_txrx_clear_peer(staId); |
| 660 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 661 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 662 | "ol_txrx_clear_peer() failed to for staID %d. " |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 663 | "Status= %d [0x%08X]", staId, qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 664 | } |
| 665 | |
| 666 | if (pAdapter->aStaInfo[staId].isUsed) { |
| 667 | spin_lock_bh(&pAdapter->staInfo_lock); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 668 | qdf_mem_zero(&pAdapter->aStaInfo[staId], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 669 | sizeof(hdd_station_info_t)); |
| 670 | spin_unlock_bh(&pAdapter->staInfo_lock); |
| 671 | } |
| 672 | pHddCtx->sta_to_adapter[staId] = NULL; |
| 673 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 674 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 675 | } |
| 676 | |
| 677 | /** |
| 678 | * hdd_softap_register_sta() - Register a SoftAP STA |
| 679 | * @pAdapter: pointer to adapter context |
| 680 | * @fAuthRequired: is additional authentication required? |
| 681 | * @fPrivacyBit: should 802.11 privacy bit be set? |
| 682 | * @staId: station ID assigned to this station |
| 683 | * @ucastSig: unicast security signature |
| 684 | * @bcastSig: broadcast security signature |
| 685 | * @pPeerMacAddress: station MAC address |
| 686 | * @fWmmEnabled: is WMM enabled for this STA? |
| 687 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 688 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 689 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 690 | QDF_STATUS hdd_softap_register_sta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 691 | bool fAuthRequired, |
| 692 | bool fPrivacyBit, |
| 693 | uint8_t staId, |
| 694 | uint8_t ucastSig, |
| 695 | uint8_t bcastSig, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 696 | struct qdf_mac_addr *pPeerMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 697 | bool fWmmEnabled) |
| 698 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 699 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 700 | struct ol_txrx_desc_type staDesc = { 0 }; |
| 701 | hdd_context_t *pHddCtx = pAdapter->pHddCtx; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 702 | struct ol_txrx_ops txrx_ops; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 703 | |
| 704 | /* |
| 705 | * Clean up old entry if it is not cleaned up properly |
| 706 | */ |
| 707 | if (pAdapter->aStaInfo[staId].isUsed) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 708 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 709 | "clean up old entry for STA %d", staId); |
| 710 | hdd_softap_deregister_sta(pAdapter, staId); |
| 711 | } |
| 712 | /* Get the Station ID from the one saved during the assocation. */ |
| 713 | |
| 714 | staDesc.sta_id = staId; |
| 715 | |
| 716 | /*Save the pAdapter Pointer for this staId */ |
| 717 | pHddCtx->sta_to_adapter[staId] = pAdapter; |
| 718 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 719 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 720 | hdd_softap_init_tx_rx_sta(pAdapter, staId, |
| 721 | pPeerMacAddress); |
| 722 | |
| 723 | staDesc.is_qos_enabled = fWmmEnabled; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 724 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 725 | "HDD SOFTAP register TL QoS_enabled=%d", |
| 726 | staDesc.is_qos_enabled); |
| 727 | |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 728 | /* Register the vdev transmit and receive functions */ |
| 729 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 730 | txrx_ops.rx.rx = hdd_softap_rx_packet_cbk; |
| 731 | ol_txrx_vdev_register( |
| 732 | ol_txrx_get_vdev_from_vdev_id(pAdapter->sessionId), |
| 733 | pAdapter, &txrx_ops); |
Dhanashri Atre | 168d2b4 | 2016-02-22 14:43:06 -0800 | [diff] [blame] | 734 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 735 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 736 | qdf_status = ol_txrx_register_peer(&staDesc); |
| 737 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 738 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
| 739 | "SOFTAP ol_txrx_register_peer() failed to register. Status= %d [0x%08X]", |
| 740 | qdf_status, qdf_status); |
| 741 | return qdf_status; |
| 742 | } |
| 743 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 744 | /* if ( WPA ), tell TL to go to 'connected' and after keys come to the |
| 745 | * driver then go to 'authenticated'. For all other authentication |
| 746 | * types (those that do not require upper layer authentication) we can |
| 747 | * put TL directly into 'authenticated' state |
| 748 | */ |
| 749 | |
| 750 | pAdapter->aStaInfo[staId].ucSTAId = staId; |
| 751 | pAdapter->aStaInfo[staId].isQosEnabled = fWmmEnabled; |
| 752 | |
| 753 | if (!fAuthRequired) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 754 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 755 | "open/shared auth StaId= %d. Changing TL state to AUTHENTICATED at Join time", |
| 756 | pAdapter->aStaInfo[staId].ucSTAId); |
| 757 | |
| 758 | /* Connections that do not need Upper layer auth, |
| 759 | * transition TL directly to 'Authenticated' state. |
| 760 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 761 | qdf_status = hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 762 | OL_TXRX_PEER_STATE_AUTH, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 763 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 764 | pAdapter->aStaInfo[staId].tlSTAState = OL_TXRX_PEER_STATE_AUTH; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 765 | pAdapter->sessionCtx.ap.uIsAuthenticated = true; |
| 766 | } else { |
| 767 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 768 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 769 | "ULA auth StaId= %d. Changing TL state to CONNECTED at Join time", |
| 770 | pAdapter->aStaInfo[staId].ucSTAId); |
| 771 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 772 | qdf_status = hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 773 | OL_TXRX_PEER_STATE_CONN, false); |
| 774 | pAdapter->aStaInfo[staId].tlSTAState = OL_TXRX_PEER_STATE_CONN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 775 | |
| 776 | pAdapter->sessionCtx.ap.uIsAuthenticated = false; |
| 777 | |
| 778 | } |
| 779 | |
| 780 | /* Enable Tx queue */ |
| 781 | hddLog(LOG1, FL("Enabling queues")); |
| 782 | wlan_hdd_netif_queue_control(pAdapter, |
| 783 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 784 | WLAN_CONTROL_PATH); |
| 785 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 786 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 787 | } |
| 788 | |
| 789 | /** |
| 790 | * hdd_softap_register_bc_sta() - Register the SoftAP broadcast STA |
| 791 | * @pAdapter: pointer to adapter context |
| 792 | * @fPrivacyBit: should 802.11 privacy bit be set? |
| 793 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 794 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 795 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 796 | QDF_STATUS hdd_softap_register_bc_sta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 797 | bool fPrivacyBit) |
| 798 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 799 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 800 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 801 | struct qdf_mac_addr broadcastMacAddr = |
| 802 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 803 | hdd_ap_ctx_t *pHddApCtx; |
| 804 | |
| 805 | pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 806 | |
| 807 | pHddCtx->sta_to_adapter[WLAN_RX_BCMC_STA_ID] = pAdapter; |
| 808 | #ifdef WLAN_FEATURE_MBSSID |
| 809 | pHddCtx->sta_to_adapter[pHddApCtx->uBCStaId] = pAdapter; |
| 810 | #else |
| 811 | pHddCtx->sta_to_adapter[WLAN_RX_SAP_SELF_STA_ID] = pAdapter; |
| 812 | #endif |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 813 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 814 | hdd_softap_register_sta(pAdapter, false, fPrivacyBit, |
| 815 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))-> |
| 816 | uBCStaId, 0, 1, &broadcastMacAddr, 0); |
| 817 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 818 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 819 | } |
| 820 | |
| 821 | /** |
| 822 | * hdd_softap_deregister_bc_sta() - Deregister the SoftAP broadcast STA |
| 823 | * @pAdapter: pointer to adapter context |
| 824 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 825 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 826 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 827 | QDF_STATUS hdd_softap_deregister_bc_sta(hdd_adapter_t *pAdapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 828 | { |
| 829 | return hdd_softap_deregister_sta(pAdapter, |
| 830 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))-> |
| 831 | uBCStaId); |
| 832 | } |
| 833 | |
| 834 | /** |
| 835 | * hdd_softap_stop_bss() - Stop the BSS |
| 836 | * @pAdapter: pointer to adapter context |
| 837 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 838 | * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 839 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 840 | QDF_STATUS hdd_softap_stop_bss(hdd_adapter_t *pAdapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 841 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 842 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 843 | uint8_t staId = 0; |
| 844 | hdd_context_t *pHddCtx; |
| 845 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 846 | |
| 847 | /* bss deregister is not allowed during wlan driver loading or |
| 848 | * unloading |
| 849 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 850 | if (cds_is_load_or_unload_in_progress()) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 851 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 852 | "%s: Loading_unloading in Progress, state: 0x%x. Ignore!!!", |
| 853 | __func__, cds_get_driver_state()); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 854 | return QDF_STATUS_E_PERM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 855 | } |
| 856 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 857 | qdf_status = hdd_softap_deregister_bc_sta(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 858 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 859 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 860 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 861 | "%s: Failed to deregister BC sta Id %d", __func__, |
| 862 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->uBCStaId); |
| 863 | } |
| 864 | |
| 865 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) { |
| 866 | /* This excludes BC sta as it is already deregistered */ |
| 867 | if (pAdapter->aStaInfo[staId].isUsed) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 868 | qdf_status = hdd_softap_deregister_sta(pAdapter, staId); |
| 869 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 870 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, |
| 871 | QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 872 | "%s: Failed to deregister sta Id %d", |
| 873 | __func__, staId); |
| 874 | } |
| 875 | } |
| 876 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 877 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 878 | } |
| 879 | |
| 880 | /** |
| 881 | * hdd_softap_change_sta_state() - Change the state of a SoftAP station |
| 882 | * @pAdapter: pointer to adapter context |
| 883 | * @pDestMacAddress: MAC address of the station |
| 884 | * @state: new state of the station |
| 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 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 888 | QDF_STATUS hdd_softap_change_sta_state(hdd_adapter_t *pAdapter, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 889 | struct qdf_mac_addr *pDestMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 890 | enum ol_txrx_peer_state state) |
| 891 | { |
| 892 | uint8_t ucSTAId = WLAN_MAX_STA_COUNT; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 893 | QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 894 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 895 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 896 | "%s: enter", __func__); |
| 897 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 898 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 899 | hdd_softap_get_sta_id(pAdapter, |
| 900 | pDestMacAddress, &ucSTAId)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 901 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 902 | "%s: Failed to find right station", __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 903 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 904 | } |
| 905 | |
| 906 | if (false == |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 907 | qdf_is_macaddr_equal(&pAdapter->aStaInfo[ucSTAId].macAddrSTA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 908 | pDestMacAddress)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 909 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 910 | "%s: Station MAC address does not matching", |
| 911 | __func__); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 912 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 913 | } |
| 914 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 915 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 916 | hdd_change_peer_state(pAdapter, ucSTAId, state, false); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 917 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 918 | "%s: change station to state %d succeed", __func__, state); |
| 919 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 920 | if (QDF_STATUS_SUCCESS == qdf_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 921 | pAdapter->aStaInfo[ucSTAId].tlSTAState = |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 922 | OL_TXRX_PEER_STATE_AUTH; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 923 | } |
| 924 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 925 | QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 926 | "%s exit", __func__); |
| 927 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 928 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 929 | } |
| 930 | |
| 931 | /* |
| 932 | * hdd_softap_get_sta_id() - Find station ID from MAC address |
| 933 | * @pAdapter: pointer to adapter context |
| 934 | * @pDestMacAddress: MAC address of the destination |
| 935 | * @staId: Station ID associated with the MAC address |
| 936 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 937 | * Return: QDF_STATUS_SUCCESS if a match was found, in which case |
| 938 | * staId is populated, QDF_STATUS_E_FAILURE if a match is |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 939 | * not found |
| 940 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 941 | QDF_STATUS hdd_softap_get_sta_id(hdd_adapter_t *pAdapter, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 942 | struct qdf_mac_addr *pMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 943 | uint8_t *staId) |
| 944 | { |
| 945 | uint8_t i; |
| 946 | |
| 947 | for (i = 0; i < WLAN_MAX_STA_COUNT; i++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 948 | if (!qdf_mem_cmp |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 949 | (&pAdapter->aStaInfo[i].macAddrSTA, pMacAddress, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 950 | QDF_MAC_ADDR_SIZE) && pAdapter->aStaInfo[i].isUsed) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 951 | *staId = i; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 952 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 953 | } |
| 954 | } |
| 955 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 956 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 957 | } |