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