Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | /**========================================================================= |
| 20 | |
| 21 | \file rrm_api.c |
| 22 | |
| 23 | \brief implementation for PE RRM APIs |
| 24 | |
| 25 | ========================================================================*/ |
| 26 | |
| 27 | /* $Header$ */ |
| 28 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 29 | |
| 30 | /*-------------------------------------------------------------------------- |
| 31 | Include Files |
| 32 | ------------------------------------------------------------------------*/ |
| 33 | #include "cds_api.h" |
| 34 | #include "wni_api.h" |
| 35 | #include "sir_api.h" |
| 36 | #include "ani_global.h" |
| 37 | #include "wni_cfg.h" |
| 38 | #include "lim_types.h" |
| 39 | #include "lim_utils.h" |
| 40 | #include "lim_send_sme_rsp_messages.h" |
| 41 | #include "parser_api.h" |
| 42 | #include "lim_send_messages.h" |
| 43 | #include "rrm_global.h" |
| 44 | #include "rrm_api.h" |
| 45 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | /* -------------------------------------------------------------------- */ |
| 47 | /** |
| 48 | * rrm_cache_mgmt_tx_power |
| 49 | ** |
| 50 | * FUNCTION: Store Tx power for management frames. |
| 51 | * |
| 52 | * LOGIC: |
| 53 | * |
| 54 | * ASSUMPTIONS: |
| 55 | * |
| 56 | * NOTE: |
| 57 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 58 | * @param pe_session session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 59 | * @return None |
| 60 | */ |
| 61 | void |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 62 | rrm_cache_mgmt_tx_power(struct mac_context *mac, int8_t txPower, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 63 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 64 | { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 65 | pe_debug("Cache Mgmt Tx Power: %d", txPower); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 66 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 67 | if (!pe_session) |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 68 | mac->rrm.rrmPEContext.txMgmtPower = txPower; |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 69 | else |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 70 | pe_session->txMgmtPower = txPower; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | /* -------------------------------------------------------------------- */ |
| 74 | /** |
| 75 | * rrm_get_mgmt_tx_power |
| 76 | * |
| 77 | * FUNCTION: Get the Tx power for management frames. |
| 78 | * |
| 79 | * LOGIC: |
| 80 | * |
| 81 | * ASSUMPTIONS: |
| 82 | * |
| 83 | * NOTE: |
| 84 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 85 | * @param pe_session session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 86 | * @return txPower |
| 87 | */ |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 88 | int8_t rrm_get_mgmt_tx_power(struct mac_context *mac, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 89 | { |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 90 | if (!pe_session) |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 91 | return mac->rrm.rrmPEContext.txMgmtPower; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 92 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 93 | pe_debug("tx mgmt pwr %d", pe_session->txMgmtPower); |
Padma, Santhosh Kumar | 93ec7d2 | 2016-12-26 15:58:37 +0530 | [diff] [blame] | 94 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 95 | return pe_session->txMgmtPower; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | /* -------------------------------------------------------------------- */ |
| 99 | /** |
| 100 | * rrm_send_set_max_tx_power_req |
| 101 | * |
| 102 | * FUNCTION: Send WMA_SET_MAX_TX_POWER_REQ message to change the max tx power. |
| 103 | * |
| 104 | * LOGIC: |
| 105 | * |
| 106 | * ASSUMPTIONS: |
| 107 | * |
| 108 | * NOTE: |
| 109 | * |
| 110 | * @param txPower txPower to be set. |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 111 | * @param pe_session session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 112 | * @return None |
| 113 | */ |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 114 | QDF_STATUS |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 115 | rrm_send_set_max_tx_power_req(struct mac_context *mac, int8_t txPower, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 116 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 117 | { |
| 118 | tpMaxTxPowerParams pMaxTxParams; |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 119 | QDF_STATUS retCode = QDF_STATUS_SUCCESS; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 120 | struct scheduler_msg msgQ = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 121 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 122 | if (!pe_session) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 123 | pe_err("Invalid parameters"); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 124 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 125 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 126 | pMaxTxParams = qdf_mem_malloc(sizeof(tMaxTxPowerParams)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 127 | if (!pMaxTxParams) |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 128 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 129 | /* Allocated memory for pMaxTxParams...will be freed in other module */ |
| 130 | pMaxTxParams->power = txPower; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 131 | qdf_mem_copy(pMaxTxParams->bssId.bytes, pe_session->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 132 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 133 | qdf_mem_copy(pMaxTxParams->selfStaMacAddr.bytes, |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 134 | pe_session->self_mac_addr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 135 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 136 | |
| 137 | msgQ.type = WMA_SET_MAX_TX_POWER_REQ; |
| 138 | msgQ.reserved = 0; |
| 139 | msgQ.bodyptr = pMaxTxParams; |
| 140 | msgQ.bodyval = 0; |
| 141 | |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 142 | pe_debug("Sending WMA_SET_MAX_TX_POWER_REQ with power(%d) to HAL", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 143 | txPower); |
| 144 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 145 | MTRACE(mac_trace_msg_tx(mac, pe_session->peSessionId, msgQ.type)); |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 146 | retCode = wma_post_ctrl_msg(mac, &msgQ); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 147 | if (QDF_STATUS_SUCCESS != retCode) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 148 | pe_err("Posting WMA_SET_MAX_TX_POWER_REQ to HAL failed, reason=%X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 149 | retCode); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 150 | qdf_mem_free(pMaxTxParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 151 | return retCode; |
| 152 | } |
| 153 | return retCode; |
| 154 | } |
| 155 | |
| 156 | /* -------------------------------------------------------------------- */ |
| 157 | /** |
| 158 | * rrm_set_max_tx_power_rsp |
| 159 | * |
| 160 | * FUNCTION: Process WMA_SET_MAX_TX_POWER_RSP message. |
| 161 | * |
| 162 | * LOGIC: |
| 163 | * |
| 164 | * ASSUMPTIONS: |
| 165 | * |
| 166 | * NOTE: |
| 167 | * |
| 168 | * @param txPower txPower to be set. |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 169 | * @param pe_session session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 170 | * @return None |
| 171 | */ |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 172 | QDF_STATUS rrm_set_max_tx_power_rsp(struct mac_context *mac, |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 173 | struct scheduler_msg *limMsgQ) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 174 | { |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 175 | QDF_STATUS retCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 176 | tpMaxTxPowerParams pMaxTxParams = (tpMaxTxPowerParams) limMsgQ->bodyptr; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 177 | struct pe_session *pe_session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 178 | uint8_t sessionId, i; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 179 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 180 | if (qdf_is_macaddr_broadcast(&pMaxTxParams->bssId)) { |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 181 | for (i = 0; i < mac->lim.maxBssId; i++) { |
| 182 | if (mac->lim.gpSession[i].valid == true) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 183 | pe_session = &mac->lim.gpSession[i]; |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 184 | rrm_cache_mgmt_tx_power(mac, pMaxTxParams->power, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 185 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 186 | } |
| 187 | } |
| 188 | } else { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 189 | pe_session = pe_find_session_by_bssid(mac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 190 | pMaxTxParams->bssId.bytes, |
| 191 | &sessionId); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 192 | if (!pe_session) { |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 193 | retCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 194 | } else { |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 195 | rrm_cache_mgmt_tx_power(mac, pMaxTxParams->power, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 196 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 197 | } |
| 198 | } |
| 199 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 200 | qdf_mem_free(limMsgQ->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 201 | limMsgQ->bodyptr = NULL; |
| 202 | return retCode; |
| 203 | } |
| 204 | |
| 205 | /* -------------------------------------------------------------------- */ |
| 206 | /** |
| 207 | * rrm_process_link_measurement_request |
| 208 | * |
| 209 | * FUNCTION: Processes the Link measurement request and send the report. |
| 210 | * |
| 211 | * LOGIC: |
| 212 | * |
| 213 | * ASSUMPTIONS: |
| 214 | * |
| 215 | * NOTE: |
| 216 | * |
| 217 | * @param pBd pointer to BD to extract RSSI and SNR |
| 218 | * @param pLinkReq pointer to the Link request frame structure. |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 219 | * @param pe_session session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 220 | * @return None |
| 221 | */ |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 222 | QDF_STATUS |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 223 | rrm_process_link_measurement_request(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 224 | uint8_t *pRxPacketInfo, |
| 225 | tDot11fLinkMeasurementRequest *pLinkReq, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 226 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 227 | { |
| 228 | tSirMacLinkReport LinkReport; |
| 229 | tpSirMacMgmtHdr pHdr; |
| 230 | int8_t currentRSSI = 0; |
Rajeev Kumar Sirasanagandla | 1a21bf6 | 2019-04-08 15:28:57 +0530 | [diff] [blame] | 231 | struct lim_max_tx_pwr_attr tx_pwr_attr = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 232 | |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 233 | pe_debug("Received Link measurement request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 234 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 235 | if (!pRxPacketInfo || !pLinkReq || !pe_session) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 236 | pe_err("Invalid parameters - Ignoring the request"); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 237 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 238 | } |
| 239 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 240 | |
Rajeev Kumar Sirasanagandla | 1a21bf6 | 2019-04-08 15:28:57 +0530 | [diff] [blame] | 241 | tx_pwr_attr.reg_max = pe_session->def_max_tx_pwr; |
| 242 | tx_pwr_attr.ap_tx_power = pLinkReq->MaxTxPower.maxTxPower; |
| 243 | tx_pwr_attr.ini_tx_power = mac->mlme_cfg->power.max_tx_power; |
| 244 | |
| 245 | LinkReport.txPower = lim_get_max_tx_power(mac, &tx_pwr_attr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 246 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 247 | if ((LinkReport.txPower != (uint8_t) (pe_session->maxTxPower)) && |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 248 | (QDF_STATUS_SUCCESS == rrm_send_set_max_tx_power_req(mac, |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 249 | LinkReport.txPower, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 250 | pe_session))) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 251 | pe_warn("maxTx power in link report is not same as local..." |
| 252 | " Local: %d Link Request TxPower: %d" |
| 253 | " Link Report TxPower: %d", |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 254 | pe_session->maxTxPower, LinkReport.txPower, |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 255 | pLinkReq->MaxTxPower.maxTxPower); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 256 | pe_session->maxTxPower = |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 257 | LinkReport.txPower; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | LinkReport.dialogToken = pLinkReq->DialogToken.token; |
| 261 | LinkReport.rxAntenna = 0; |
| 262 | LinkReport.txAntenna = 0; |
Deepak Dhamdhere | 68929ec | 2015-08-05 15:16:35 -0700 | [diff] [blame] | 263 | currentRSSI = WMA_GET_RX_RSSI_RAW(pRxPacketInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 264 | |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 265 | pe_info("Received Link report frame with %d", currentRSSI); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 266 | |
| 267 | /* 2008 11k spec reference: 18.4.8.5 RCPI Measurement */ |
| 268 | if ((currentRSSI) <= RCPI_LOW_RSSI_VALUE) |
| 269 | LinkReport.rcpi = 0; |
| 270 | else if ((currentRSSI > RCPI_LOW_RSSI_VALUE) && (currentRSSI <= 0)) |
| 271 | LinkReport.rcpi = CALCULATE_RCPI(currentRSSI); |
| 272 | else |
| 273 | LinkReport.rcpi = RCPI_MAX_VALUE; |
| 274 | |
| 275 | LinkReport.rsni = WMA_GET_RX_SNR(pRxPacketInfo); |
| 276 | |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 277 | pe_debug("Sending Link report frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 278 | |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 279 | return lim_send_link_report_action_frame(mac, &LinkReport, pHdr->sa, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 280 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | /* -------------------------------------------------------------------- */ |
| 284 | /** |
| 285 | * rrm_process_neighbor_report_response |
| 286 | * |
| 287 | * FUNCTION: Processes the Neighbor Report response from the peer AP. |
| 288 | * |
| 289 | * LOGIC: |
| 290 | * |
| 291 | * ASSUMPTIONS: |
| 292 | * |
| 293 | * NOTE: |
| 294 | * |
| 295 | * @param pNeighborRep pointer to the Neighbor report frame structure. |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 296 | * @param pe_session session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 297 | * @return None |
| 298 | */ |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 299 | QDF_STATUS |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 300 | rrm_process_neighbor_report_response(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 301 | tDot11fNeighborReportResponse *pNeighborRep, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 302 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 303 | { |
Harprit Chhabada | e20b556 | 2019-03-11 14:13:42 -0700 | [diff] [blame] | 304 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 305 | tpSirNeighborReportInd pSmeNeighborRpt = NULL; |
| 306 | uint16_t length; |
| 307 | uint8_t i; |
Rajeev Kumar | cf7bd80 | 2017-04-18 11:11:42 -0700 | [diff] [blame] | 308 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 309 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 310 | if (!pNeighborRep || !pe_session) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 311 | pe_err("Invalid parameters"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 312 | return status; |
| 313 | } |
| 314 | |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 315 | pe_debug("Neighbor report response received"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 316 | |
| 317 | /* Dialog token */ |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 318 | if (mac->rrm.rrmPEContext.DialogToken != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 319 | pNeighborRep->DialogToken.token) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 320 | pe_err("Dialog token mismatch in the received Neighbor report"); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 321 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 322 | } |
| 323 | if (pNeighborRep->num_NeighborReport == 0) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 324 | pe_err("No neighbor report in the frame...Dropping it"); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 325 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 326 | } |
Varun Reddy Yeturu | 151376c | 2017-08-30 14:19:10 -0700 | [diff] [blame] | 327 | pe_debug("RRM:received num neighbor reports: %d", |
| 328 | pNeighborRep->num_NeighborReport); |
| 329 | if (pNeighborRep->num_NeighborReport > MAX_SUPPORTED_NEIGHBOR_RPT) |
| 330 | pNeighborRep->num_NeighborReport = MAX_SUPPORTED_NEIGHBOR_RPT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 331 | length = (sizeof(tSirNeighborReportInd)) + |
| 332 | (sizeof(tSirNeighborBssDescription) * |
| 333 | (pNeighborRep->num_NeighborReport - 1)); |
| 334 | |
| 335 | /* Prepare the request to send to SME. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 336 | pSmeNeighborRpt = qdf_mem_malloc(length); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 337 | if (!pSmeNeighborRpt) |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 338 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 339 | |
| 340 | /* Allocated memory for pSmeNeighborRpt...will be freed by other module */ |
| 341 | |
| 342 | for (i = 0; i < pNeighborRep->num_NeighborReport; i++) { |
| 343 | pSmeNeighborRpt->sNeighborBssDescription[i].length = sizeof(tSirNeighborBssDescription); /*+ any optional ies */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 344 | qdf_mem_copy(pSmeNeighborRpt->sNeighborBssDescription[i].bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 345 | pNeighborRep->NeighborReport[i].bssid, |
| 346 | sizeof(tSirMacAddr)); |
| 347 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo. |
| 348 | fApPreauthReachable = |
| 349 | pNeighborRep->NeighborReport[i].APReachability; |
| 350 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo. |
| 351 | fSameSecurityMode = |
| 352 | pNeighborRep->NeighborReport[i].Security; |
| 353 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo. |
| 354 | fSameAuthenticator = |
| 355 | pNeighborRep->NeighborReport[i].KeyScope; |
| 356 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo. |
| 357 | fCapSpectrumMeasurement = |
| 358 | pNeighborRep->NeighborReport[i].SpecMgmtCap; |
| 359 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo. |
| 360 | fCapQos = pNeighborRep->NeighborReport[i].QosCap; |
| 361 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo. |
| 362 | fCapApsd = pNeighborRep->NeighborReport[i].apsd; |
| 363 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo. |
| 364 | fCapRadioMeasurement = pNeighborRep->NeighborReport[i].rrm; |
| 365 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo. |
| 366 | fCapDelayedBlockAck = |
| 367 | pNeighborRep->NeighborReport[i].DelayedBA; |
| 368 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo. |
| 369 | fCapImmediateBlockAck = |
| 370 | pNeighborRep->NeighborReport[i].ImmBA; |
| 371 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo. |
| 372 | fMobilityDomain = |
| 373 | pNeighborRep->NeighborReport[i].MobilityDomain; |
| 374 | |
Amar Singhal | 999bd8a | 2019-10-25 12:04:33 -0700 | [diff] [blame] | 375 | if (!wlan_reg_is_6ghz_supported(mac->pdev) && |
| 376 | (wlan_reg_is_6ghz_op_class(mac->pdev, |
| 377 | pNeighborRep->NeighborReport[i]. |
| 378 | regulatoryClass))) { |
| 379 | pe_err("channel belongs to 6 ghz spectrum, abort"); |
| 380 | qdf_mem_free(pSmeNeighborRpt); |
| 381 | return QDF_STATUS_E_FAILURE; |
| 382 | } |
| 383 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 384 | pSmeNeighborRpt->sNeighborBssDescription[i].regClass = |
| 385 | pNeighborRep->NeighborReport[i].regulatoryClass; |
| 386 | pSmeNeighborRpt->sNeighborBssDescription[i].channel = |
| 387 | pNeighborRep->NeighborReport[i].channel; |
| 388 | pSmeNeighborRpt->sNeighborBssDescription[i].phyType = |
| 389 | pNeighborRep->NeighborReport[i].PhyType; |
| 390 | } |
| 391 | |
| 392 | pSmeNeighborRpt->messageType = eWNI_SME_NEIGHBOR_REPORT_IND; |
| 393 | pSmeNeighborRpt->length = length; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 394 | pSmeNeighborRpt->sessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 395 | pSmeNeighborRpt->numNeighborReports = pNeighborRep->num_NeighborReport; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 396 | qdf_mem_copy(pSmeNeighborRpt->bssId, pe_session->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 397 | sizeof(tSirMacAddr)); |
| 398 | |
| 399 | /* Send request to SME. */ |
| 400 | mmhMsg.type = pSmeNeighborRpt->messageType; |
| 401 | mmhMsg.bodyptr = pSmeNeighborRpt; |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 402 | MTRACE(mac_trace(mac, TRACE_CODE_TX_SME_MSG, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 403 | pe_session->peSessionId, mmhMsg.type)); |
Harprit Chhabada | e20b556 | 2019-03-11 14:13:42 -0700 | [diff] [blame] | 404 | lim_sys_process_mmh_msg_api(mac, &mmhMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 405 | |
| 406 | return status; |
| 407 | |
| 408 | } |
| 409 | |
| 410 | /* -------------------------------------------------------------------- */ |
| 411 | /** |
| 412 | * rrm_process_neighbor_report_req |
| 413 | * |
| 414 | * FUNCTION: |
| 415 | * |
| 416 | * LOGIC: Create a Neighbor report request and send it to peer. |
| 417 | * |
| 418 | * ASSUMPTIONS: |
| 419 | * |
| 420 | * NOTE: |
| 421 | * |
| 422 | * @param pNeighborReq Neighbor report request params . |
| 423 | * @return None |
| 424 | */ |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 425 | QDF_STATUS |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 426 | rrm_process_neighbor_report_req(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 427 | tpSirNeighborReportReqInd pNeighborReq) |
| 428 | { |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 429 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 430 | tSirMacNeighborReportReq NeighborReportReq; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 431 | struct pe_session *pe_session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 432 | uint8_t sessionId; |
| 433 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 434 | if (!pNeighborReq) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 435 | pe_err("NeighborReq is NULL"); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 436 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 437 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 438 | pe_session = pe_find_session_by_bssid(mac, pNeighborReq->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 439 | &sessionId); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 440 | if (!pe_session) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 441 | pe_err("session does not exist for given bssId"); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 442 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 443 | } |
| 444 | |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 445 | pe_debug("SSID present: %d", pNeighborReq->noSSID); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 446 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 447 | qdf_mem_zero(&NeighborReportReq, sizeof(tSirMacNeighborReportReq)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 448 | |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 449 | NeighborReportReq.dialogToken = ++mac->rrm.rrmPEContext.DialogToken; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 450 | NeighborReportReq.ssid_present = !pNeighborReq->noSSID; |
| 451 | if (NeighborReportReq.ssid_present) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 452 | qdf_mem_copy(&NeighborReportReq.ssid, &pNeighborReq->ucSSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 453 | sizeof(tSirMacSSid)); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 454 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, |
| 455 | QDF_TRACE_LEVEL_DEBUG, |
| 456 | (uint8_t *) NeighborReportReq.ssid.ssId, |
| 457 | NeighborReportReq.ssid.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 458 | } |
| 459 | |
| 460 | status = |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 461 | lim_send_neighbor_report_request_frame(mac, &NeighborReportReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 462 | pNeighborReq->bssId, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 463 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 464 | |
| 465 | return status; |
| 466 | } |
| 467 | |
| 468 | #define ABS(x) ((x < 0) ? -x : x) |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 469 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 470 | /** |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 471 | * rrm_process_beacon_report_req: Processes the Beacon report request |
| 472 | * from the peer AP. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 473 | * |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 474 | * @pCurrentReq: pointer to the current Req comtext. |
| 475 | * @pBeaconReq: pointer to the beacon report request IE from the peer. |
| 476 | * @pe_session: session entry. |
| 477 | * @error_code: pointer to beacon report error_code |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 478 | * |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 479 | * @return : eRRM status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 480 | */ |
| 481 | static tRrmRetStatus |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 482 | rrm_process_beacon_report_req(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 483 | tpRRMReq pCurrentReq, |
| 484 | tDot11fIEMeasurementRequest *pBeaconReq, |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 485 | struct pe_session *pe_session, |
| 486 | enum beacon_report_status_code *error_code) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 487 | { |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 488 | struct scheduler_msg mmh_msg = {0}; |
| 489 | tpSirBeaconReportReqInd psbrr; |
| 490 | uint8_t num_rpt, idx_rpt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 491 | uint16_t measDuration, maxMeasduration; |
| 492 | int8_t maxDuration; |
| 493 | uint8_t sign; |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 494 | tDot11fIEAPChannelReport *ie_ap_chan_rpt; |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 495 | uint8_t tmp_idx, buf_left, buf_cons; |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 496 | uint16_t ch_ctr = 0; |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 497 | char req_ssid[WLAN_SSID_MAX_LEN] = {0}; |
| 498 | char ch_buf[RRM_CH_BUF_LEN]; |
| 499 | char *tmp_buf = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 500 | |
| 501 | if (pBeaconReq->measurement_request.Beacon.BeaconReporting.present && |
| 502 | (pBeaconReq->measurement_request.Beacon.BeaconReporting. |
| 503 | reportingCondition != 0)) { |
| 504 | /* Repeated measurement is not supported. This means number of repetitions should be zero.(Already checked) */ |
| 505 | /* All test case in VoWifi(as of version 0.36) use zero for number of repetitions. */ |
| 506 | /* Beacon reporting should not be included in request if number of repetitons is zero. */ |
| 507 | /* IEEE Std 802.11k-2008 Table 7-29g and section 11.10.8.1 */ |
| 508 | |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 509 | pe_nofl_err("RX: [802.11 BCN_RPT] Dropping req: Reporting condition included is not zero"); |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 510 | *error_code = BCN_RPT_ERR_NOT_SUPPORTED_PARAMETERS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 511 | return eRRM_INCAPABLE; |
| 512 | } |
| 513 | |
| 514 | /* The logic here is to check the measurement duration passed in the beacon request. Following are the cases handled. |
| 515 | Case 1: If measurement duration received in the beacon request is greater than the max measurement duration advertised |
| 516 | in the RRM capabilities(Assoc Req), and Duration Mandatory bit is set to 1, REFUSE the beacon request |
| 517 | Case 2: If measurement duration received in the beacon request is greater than the max measurement duration advertised |
| 518 | in the RRM capabilities(Assoc Req), and Duration Mandatory bit is set to 0, perform measurement for |
| 519 | the duration advertised in the RRM capabilities |
| 520 | |
| 521 | maxMeasurementDuration = 2^(nonOperatingChanMax - 4) * BeaconInterval |
| 522 | */ |
| 523 | maxDuration = |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 524 | mac->rrm.rrmPEContext.rrmEnabledCaps.nonOperatingChanMax - 4; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 525 | sign = (maxDuration < 0) ? 1 : 0; |
| 526 | maxDuration = (1L << ABS(maxDuration)); |
| 527 | if (!sign) |
| 528 | maxMeasduration = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 529 | maxDuration * pe_session->beaconParams.beaconInterval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 530 | else |
| 531 | maxMeasduration = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 532 | pe_session->beaconParams.beaconInterval / maxDuration; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 533 | |
| 534 | measDuration = pBeaconReq->measurement_request.Beacon.meas_duration; |
| 535 | |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 536 | if (pBeaconReq->measurement_request.Beacon.SSID.present) |
| 537 | qdf_snprintf(req_ssid, WLAN_SSID_MAX_LEN, "%s", |
| 538 | pBeaconReq->measurement_request.Beacon.SSID.ssid); |
| 539 | |
sheenam monga | 724306f | 2020-02-08 14:59:35 +0530 | [diff] [blame] | 540 | pe_nofl_info("RX: [802.11 BCN_RPT] SSID:%s BSSID:%pM Token:%d op_class:%d ch:%d meas_mode:%d meas_duration:%d max_dur: %d sign: %d max_meas_dur: %d", |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 541 | req_ssid, pBeaconReq->measurement_request.Beacon.BSSID, |
| 542 | pBeaconReq->measurement_token, |
| 543 | pBeaconReq->measurement_request.Beacon.regClass, |
| 544 | pBeaconReq->measurement_request.Beacon.channel, |
| 545 | pBeaconReq->measurement_request.Beacon.meas_mode, |
sheenam monga | 724306f | 2020-02-08 14:59:35 +0530 | [diff] [blame] | 546 | measDuration, maxDuration, sign, maxMeasduration); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 547 | |
Manikandan Mohan | f70120a | 2019-06-28 13:11:53 -0700 | [diff] [blame] | 548 | if (measDuration == 0 && |
| 549 | pBeaconReq->measurement_request.Beacon.meas_mode != |
| 550 | eSIR_BEACON_TABLE) { |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 551 | *error_code = BCN_RPT_ERR_VALIDATION_FAILED_IN_A_REQUEST_FRAME; |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 552 | pe_nofl_err("RX: [802.11 BCN_RPT] Invalid measurement duration"); |
Manikandan Mohan | f70120a | 2019-06-28 13:11:53 -0700 | [diff] [blame] | 553 | return eRRM_REFUSED; |
| 554 | } |
| 555 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 556 | if (maxMeasduration < measDuration) { |
| 557 | if (pBeaconReq->durationMandatory) { |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 558 | pe_nofl_err("RX: [802.11 BCN_RPT] Dropping the req: duration mandatory & maxduration > measduration"); |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 559 | *error_code = |
| 560 | BCN_RPT_ERR_MAXIMUM_MEASUREMENT_DURATION_EXCCEED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 561 | return eRRM_REFUSED; |
| 562 | } else |
| 563 | measDuration = maxMeasduration; |
| 564 | } |
| 565 | /* Cache the data required for sending report. */ |
| 566 | pCurrentReq->request.Beacon.reportingDetail = |
| 567 | pBeaconReq->measurement_request.Beacon.BcnReportingDetail. |
| 568 | present ? pBeaconReq->measurement_request.Beacon.BcnReportingDetail. |
| 569 | reportingDetail : BEACON_REPORTING_DETAIL_ALL_FF_IE; |
| 570 | |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 571 | if (pBeaconReq->measurement_request.Beacon. |
| 572 | last_beacon_report_indication.present) { |
| 573 | pCurrentReq->request.Beacon.last_beacon_report_indication = |
| 574 | pBeaconReq->measurement_request.Beacon. |
| 575 | last_beacon_report_indication.last_fragment; |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 576 | pe_debug("RX: [802.11 BCN_RPT] Last Bcn Report in the req: %d", |
| 577 | pCurrentReq->request.Beacon.last_beacon_report_indication); |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 578 | } else { |
| 579 | pCurrentReq->request.Beacon.last_beacon_report_indication = 0; |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 580 | pe_debug("RX: [802.11 BCN_RPT] Last Bcn rpt ind not present"); |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 581 | } |
| 582 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 583 | if (pBeaconReq->measurement_request.Beacon.RequestedInfo.present) { |
Pragaspathi Thilagaraj | d54655f | 2019-11-21 18:42:30 +0530 | [diff] [blame] | 584 | if (!pBeaconReq->measurement_request.Beacon.RequestedInfo. |
| 585 | num_requested_eids) { |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 586 | pe_debug("RX: [802.11 BCN_RPT]: Requested num of EID is 0"); |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 587 | *error_code = |
| 588 | BCN_RPT_ERR_VALIDATION_FAILED_IN_A_REQUEST_FRAME; |
Pragaspathi Thilagaraj | d54655f | 2019-11-21 18:42:30 +0530 | [diff] [blame] | 589 | return eRRM_FAILURE; |
| 590 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 591 | pCurrentReq->request.Beacon.reqIes.pElementIds = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 592 | qdf_mem_malloc(sizeof(uint8_t) * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 593 | pBeaconReq->measurement_request.Beacon. |
| 594 | RequestedInfo.num_requested_eids); |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 595 | if (!pCurrentReq->request.Beacon.reqIes.pElementIds) { |
| 596 | *error_code = BCN_RPT_ERR_TEMPORARILY_UNAVAILABLE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 597 | return eRRM_FAILURE; |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 598 | } |
Pragaspathi Thilagaraj | d54655f | 2019-11-21 18:42:30 +0530 | [diff] [blame] | 599 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 600 | pCurrentReq->request.Beacon.reqIes.num = |
| 601 | pBeaconReq->measurement_request.Beacon.RequestedInfo. |
| 602 | num_requested_eids; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 603 | qdf_mem_copy(pCurrentReq->request.Beacon.reqIes.pElementIds, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 604 | pBeaconReq->measurement_request.Beacon. |
| 605 | RequestedInfo.requested_eids, |
| 606 | pCurrentReq->request.Beacon.reqIes.num); |
| 607 | } |
| 608 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 609 | /* Prepare the request to send to SME. */ |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 610 | psbrr = qdf_mem_malloc(sizeof(tSirBeaconReportReqInd)); |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 611 | if (!psbrr) { |
| 612 | *error_code = BCN_RPT_ERR_TEMPORARILY_UNAVAILABLE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 613 | return eRRM_FAILURE; |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 614 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 615 | |
Lin Bai | 7bae103 | 2019-04-30 12:29:36 +0800 | [diff] [blame] | 616 | /* Alloc memory for pSmeBcnReportReq, will be freed by other modules */ |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 617 | qdf_mem_copy(psbrr->bssId, pe_session->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 618 | sizeof(tSirMacAddr)); |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 619 | psbrr->messageType = eWNI_SME_BEACON_REPORT_REQ_IND; |
| 620 | psbrr->length = sizeof(tSirBeaconReportReqInd); |
| 621 | psbrr->uDialogToken = pBeaconReq->measurement_token; |
| 622 | psbrr->msgSource = eRRM_MSG_SOURCE_11K; |
| 623 | psbrr->randomizationInterval = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 624 | SYS_TU_TO_MS(pBeaconReq->measurement_request.Beacon.randomization); |
Amar Singhal | 999bd8a | 2019-10-25 12:04:33 -0700 | [diff] [blame] | 625 | |
| 626 | if (!wlan_reg_is_6ghz_supported(mac->pdev) && |
| 627 | (wlan_reg_is_6ghz_op_class(mac->pdev, |
| 628 | pBeaconReq->measurement_request.Beacon.regClass))) { |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 629 | pe_nofl_err("RX: [802.11 BCN_RPT] Ch belongs to 6 ghz spectrum, abort"); |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 630 | *error_code = BCN_RPT_ERR_NOT_SUPPORTED_PARAMETERS; |
Amar Singhal | 999bd8a | 2019-10-25 12:04:33 -0700 | [diff] [blame] | 631 | qdf_mem_free(psbrr); |
| 632 | return eRRM_FAILURE; |
| 633 | } |
| 634 | |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 635 | psbrr->channel_info.chan_num = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 636 | pBeaconReq->measurement_request.Beacon.channel; |
Amar Singhal | 999bd8a | 2019-10-25 12:04:33 -0700 | [diff] [blame] | 637 | psbrr->channel_info.reg_class = |
| 638 | pBeaconReq->measurement_request.Beacon.regClass; |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 639 | psbrr->channel_info.chan_freq = |
| 640 | wlan_reg_chan_opclass_to_freq(psbrr->channel_info.chan_num, |
| 641 | psbrr->channel_info.reg_class, |
| 642 | false); |
| 643 | psbrr->measurementDuration[0] = measDuration; |
| 644 | psbrr->fMeasurementtype[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 645 | pBeaconReq->measurement_request.Beacon.meas_mode; |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 646 | qdf_mem_copy(psbrr->macaddrBssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 647 | pBeaconReq->measurement_request.Beacon.BSSID, |
| 648 | sizeof(tSirMacAddr)); |
| 649 | |
| 650 | if (pBeaconReq->measurement_request.Beacon.SSID.present) { |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 651 | psbrr->ssId.length = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 652 | pBeaconReq->measurement_request.Beacon.SSID.num_ssid; |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 653 | qdf_mem_copy(psbrr->ssId.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 654 | pBeaconReq->measurement_request.Beacon.SSID.ssid, |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 655 | psbrr->ssId.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 656 | } |
| 657 | |
| 658 | pCurrentReq->token = pBeaconReq->measurement_token; |
| 659 | |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 660 | num_rpt = pBeaconReq->measurement_request.Beacon.num_APChannelReport; |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 661 | for (idx_rpt = 0; idx_rpt < num_rpt; idx_rpt++) { |
| 662 | ie_ap_chan_rpt = |
| 663 | &pBeaconReq->measurement_request.Beacon.APChannelReport[idx_rpt]; |
| 664 | for (tmp_idx = 0; |
| 665 | tmp_idx < ie_ap_chan_rpt->num_channelList; |
| 666 | tmp_idx++) { |
Amar Singhal | 999bd8a | 2019-10-25 12:04:33 -0700 | [diff] [blame] | 667 | if (!wlan_reg_is_6ghz_supported(mac->pdev) && |
| 668 | (wlan_reg_is_6ghz_op_class(mac->pdev, |
| 669 | ie_ap_chan_rpt->regulatoryClass))) { |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 670 | pe_nofl_err("RX: [802.11 BCN_RPT] Ch belongs to 6 ghz spectrum, abort"); |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 671 | *error_code = |
| 672 | BCN_RPT_ERR_NOT_SUPPORTED_PARAMETERS; |
Amar Singhal | 999bd8a | 2019-10-25 12:04:33 -0700 | [diff] [blame] | 673 | qdf_mem_free(psbrr); |
| 674 | return eRRM_FAILURE; |
| 675 | } |
| 676 | |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 677 | psbrr->channel_list.chan_freq_lst[ch_ctr++] = |
| 678 | wlan_reg_chan_opclass_to_freq( |
| 679 | ie_ap_chan_rpt->channelList[tmp_idx], |
| 680 | ie_ap_chan_rpt->regulatoryClass, |
| 681 | false); |
| 682 | if (ch_ctr >= QDF_ARRAY_SIZE(psbrr->channel_list.chan_freq_lst)) |
Naveen Rawat | d85a390 | 2017-06-19 11:57:31 -0700 | [diff] [blame] | 683 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 684 | } |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 685 | if (ch_ctr >= QDF_ARRAY_SIZE(psbrr->channel_list.chan_freq_lst)) |
| 686 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 687 | } |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 688 | |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 689 | psbrr->channel_list.num_channels = ch_ctr; |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 690 | buf_left = sizeof(ch_buf); |
| 691 | tmp_buf = ch_buf; |
| 692 | for (idx_rpt = 0; idx_rpt < ch_ctr; idx_rpt++) { |
| 693 | buf_cons = qdf_snprint(tmp_buf, buf_left, "%d ", |
| 694 | psbrr->channel_list.chan_freq_lst[idx_rpt]); |
| 695 | buf_left -= buf_cons; |
| 696 | tmp_buf += buf_cons; |
| 697 | } |
| 698 | |
| 699 | if (ch_ctr) |
| 700 | pe_nofl_info("RX: [802.11 BCN_RPT] Ch-list:%s", ch_buf); |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 701 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 702 | /* Send request to SME. */ |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 703 | mmh_msg.type = eWNI_SME_BEACON_REPORT_REQ_IND; |
| 704 | mmh_msg.bodyptr = psbrr; |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 705 | MTRACE(mac_trace(mac, TRACE_CODE_TX_SME_MSG, |
Will Huang | 2f11454 | 2019-10-31 17:35:29 +0800 | [diff] [blame] | 706 | pe_session->peSessionId, mmh_msg.type)); |
| 707 | lim_sys_process_mmh_msg_api(mac, &mmh_msg); |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 708 | *error_code = BCN_RPT_SUCCESS; |
Yingying Tang | 76caff9 | 2016-09-29 14:32:30 +0800 | [diff] [blame] | 709 | return eRRM_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 710 | } |
| 711 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 712 | /** |
Pragaspathi Thilagaraj | 3548a66 | 2019-09-30 12:32:52 +0530 | [diff] [blame] | 713 | * rrm_fill_beacon_ies() - Fills fixed fields and Ies in bss description to an |
| 714 | * array of uint8_t. |
| 715 | * @pIes - pointer to the buffer that should be populated with ies. |
| 716 | * @pNumIes - returns the num of ies filled in this param. |
| 717 | * @pIesMaxSize - Max size of the buffer pIes. |
| 718 | * @eids - pointer to array of eids. If NULL, all ies will be populated. |
| 719 | * @numEids - number of elements in array eids. |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 720 | * @start_offset: Offset from where the IEs in the bss_desc should be parsed |
Pragaspathi Thilagaraj | 3548a66 | 2019-09-30 12:32:52 +0530 | [diff] [blame] | 721 | * @bss_desc - pointer to Bss Description. |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 722 | * |
Pragaspathi Thilagaraj | 3548a66 | 2019-09-30 12:32:52 +0530 | [diff] [blame] | 723 | * Return: Remaining length of IEs in current bss_desc which are not included |
| 724 | * in pIes. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 725 | */ |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 726 | static uint8_t |
Pragaspathi Thilagaraj | 3548a66 | 2019-09-30 12:32:52 +0530 | [diff] [blame] | 727 | rrm_fill_beacon_ies(struct mac_context *mac, uint8_t *pIes, |
| 728 | uint8_t *pNumIes, uint8_t pIesMaxSize, uint8_t *eids, |
| 729 | uint8_t numEids, uint8_t start_offset, |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 730 | struct bss_description *bss_desc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 731 | { |
Pragaspathi Thilagaraj | 3548a66 | 2019-09-30 12:32:52 +0530 | [diff] [blame] | 732 | uint8_t *pBcnIes, count = 0, i; |
| 733 | uint16_t BcnNumIes, total_ies_len, len; |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 734 | uint8_t rem_len = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 735 | |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 736 | if ((!pIes) || (!pNumIes) || (!bss_desc)) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 737 | pe_err("Invalid parameters"); |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 738 | return 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 739 | } |
| 740 | /* Make sure that if eid is null, numEids is set to zero. */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 741 | numEids = (!eids) ? 0 : numEids; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 742 | |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 743 | total_ies_len = GET_IE_LEN_IN_BSS(bss_desc->length); |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 744 | BcnNumIes = total_ies_len; |
| 745 | if (start_offset > BcnNumIes) { |
| 746 | pe_err("Invalid start offset %d Bcn IE len %d", |
| 747 | start_offset, total_ies_len); |
| 748 | return 0; |
| 749 | } |
| 750 | |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 751 | pBcnIes = (uint8_t *)&bss_desc->ieFields[0]; |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 752 | pBcnIes += start_offset; |
| 753 | BcnNumIes = BcnNumIes - start_offset; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 754 | |
| 755 | *pNumIes = 0; |
| 756 | |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 757 | /* |
| 758 | * If start_offset is 0, this is the first fragment of the current |
| 759 | * beacon. Include the Beacon Fixed Fields of length 12 bytes |
| 760 | * (BEACON_FRAME_IES_OFFSET) in the first fragment. |
| 761 | */ |
| 762 | if (start_offset == 0) { |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 763 | *((uint32_t *)pIes) = bss_desc->timeStamp[0]; |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 764 | *pNumIes += sizeof(uint32_t); |
| 765 | pIes += sizeof(uint32_t); |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 766 | *((uint32_t *)pIes) = bss_desc->timeStamp[1]; |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 767 | *pNumIes += sizeof(uint32_t); |
| 768 | pIes += sizeof(uint32_t); |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 769 | *((uint16_t *)pIes) = bss_desc->beaconInterval; |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 770 | *pNumIes += sizeof(uint16_t); |
| 771 | pIes += sizeof(uint16_t); |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 772 | *((uint16_t *)pIes) = bss_desc->capabilityInfo; |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 773 | *pNumIes += sizeof(uint16_t); |
| 774 | pIes += sizeof(uint16_t); |
| 775 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 776 | |
| 777 | while (BcnNumIes > 0) { |
Pragaspathi Thilagaraj | 77a8a13 | 2019-12-05 19:55:28 +0530 | [diff] [blame] | 778 | len = *(pBcnIes + 1); |
| 779 | len += 2; /* element id + length. */ |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 780 | pe_debug("EID = %d, len = %d total = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 781 | *pBcnIes, *(pBcnIes + 1), len); |
| 782 | |
sheenam monga | 724306f | 2020-02-08 14:59:35 +0530 | [diff] [blame] | 783 | if (BcnNumIes < len || len <= 2) { |
Pragaspathi Thilagaraj | 77a8a13 | 2019-12-05 19:55:28 +0530 | [diff] [blame] | 784 | pe_err("RRM: Invalid IE len:%d exp_len:%d", |
| 785 | len, BcnNumIes); |
| 786 | break; |
| 787 | } |
| 788 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 789 | i = 0; |
| 790 | do { |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 791 | if ((!eids) || (*pBcnIes == eids[i])) { |
| 792 | if (((*pNumIes) + len) < pIesMaxSize) { |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 793 | qdf_mem_copy(pIes, pBcnIes, len); |
| 794 | pIes += len; |
| 795 | *pNumIes += len; |
| 796 | count++; |
| 797 | } else { |
| 798 | /* |
| 799 | * If max size of fragment is reached, |
| 800 | * calculate the remaining length and |
| 801 | * break. For first fragment, account |
| 802 | * for the fixed fields also. |
| 803 | */ |
| 804 | rem_len = total_ies_len - *pNumIes; |
| 805 | if (start_offset == 0) |
| 806 | rem_len = rem_len + |
| 807 | BEACON_FRAME_IES_OFFSET; |
| 808 | pe_debug("rem_len %d ies added %d", |
| 809 | rem_len, *pNumIes); |
| 810 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 811 | break; |
| 812 | } |
| 813 | i++; |
| 814 | } while (i < numEids); |
| 815 | |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 816 | if (rem_len) |
| 817 | break; |
| 818 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 819 | pBcnIes += len; |
| 820 | BcnNumIes -= len; |
| 821 | } |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 822 | pe_debug("Total length of Ies added = %d rem_len %d", |
| 823 | *pNumIes, rem_len); |
| 824 | |
| 825 | return rem_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 826 | } |
| 827 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 828 | /** |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 829 | * rrm_process_beacon_report_xmit() - create a rrm action frame |
| 830 | * @mac_ctx: Global pointer to MAC context |
| 831 | * @beacon_xmit_ind: Data for beacon report IE from SME. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 832 | * |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 833 | * Create a Radio measurement report action frame and send it to peer. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 834 | * |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 835 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 836 | */ |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 837 | QDF_STATUS |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 838 | rrm_process_beacon_report_xmit(struct mac_context *mac_ctx, |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 839 | tpSirBeaconReportXmitInd beacon_xmit_ind) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 840 | { |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 841 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 842 | tSirMacRadioMeasureReport *report = NULL; |
Deepak Dhamdhere | 6aa33ba | 2016-08-23 14:29:45 -0700 | [diff] [blame] | 843 | tSirMacBeaconReport *beacon_report; |
Pragaspathi Thilagaraj | 1d8e2ab | 2019-03-04 23:59:21 +0530 | [diff] [blame] | 844 | struct bss_description *bss_desc; |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 845 | tpRRMReq curr_req = mac_ctx->rrm.rrmPEContext.pCurrentReq; |
Jeff Johnson | 66845ca | 2018-11-18 21:44:10 -0800 | [diff] [blame] | 846 | struct pe_session *session_entry; |
Krunal Soni | f05a670 | 2017-05-01 10:54:23 -0700 | [diff] [blame] | 847 | uint8_t session_id, counter; |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 848 | uint8_t i, j, offset = 0; |
Arif Hussain | a86aa43 | 2016-07-18 17:05:57 -0700 | [diff] [blame] | 849 | uint8_t bss_desc_count = 0; |
Deepak Dhamdhere | 1e4298f | 2017-06-24 11:46:00 -0700 | [diff] [blame] | 850 | uint8_t report_index = 0; |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 851 | uint8_t rem_len = 0; |
| 852 | uint8_t frag_id = 0; |
| 853 | uint8_t num_frames, num_reports_in_frame; |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 854 | enum beacon_report_status_code error_code = |
| 855 | BCN_RPT_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 856 | |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 857 | pe_debug("Received beacon report xmit indication"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 858 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 859 | if (!beacon_xmit_ind) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 860 | pe_err("Received beacon_xmit_ind is NULL in PE"); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 861 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 862 | } |
| 863 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 864 | if (!curr_req) { |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 865 | pe_err("Received report xmit while there is no request pending in PE"); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 866 | status = QDF_STATUS_E_FAILURE; |
Krunal Soni | f05a670 | 2017-05-01 10:54:23 -0700 | [diff] [blame] | 867 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 868 | } |
| 869 | |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 870 | if ((beacon_xmit_ind->numBssDesc) || curr_req->sendEmptyBcnRpt) { |
| 871 | beacon_xmit_ind->numBssDesc = (beacon_xmit_ind->numBssDesc == |
| 872 | RRM_BCN_RPT_NO_BSS_INFO) ? RRM_BCN_RPT_MIN_RPT : |
| 873 | beacon_xmit_ind->numBssDesc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 874 | |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 875 | session_entry = pe_find_session_by_bssid(mac_ctx, |
| 876 | beacon_xmit_ind->bssId, &session_id); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 877 | if (!session_entry) { |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 878 | pe_err("TX: [802.11 BCN_RPT] Session does not exist for bssId:%pM", |
| 879 | beacon_xmit_ind->bssId); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 880 | status = QDF_STATUS_E_FAILURE; |
Krunal Soni | f05a670 | 2017-05-01 10:54:23 -0700 | [diff] [blame] | 881 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 882 | } |
| 883 | |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 884 | report = qdf_mem_malloc(MAX_BEACON_REPORTS * sizeof(*report)); |
| 885 | |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 886 | if (!report) { |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 887 | pe_err("RRM Report is NULL, allocation failed"); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 888 | status = QDF_STATUS_E_NOMEM; |
Krunal Soni | f05a670 | 2017-05-01 10:54:23 -0700 | [diff] [blame] | 889 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 890 | } |
| 891 | |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 892 | for (i = 0; i < MAX_BEACON_REPORTS && |
| 893 | bss_desc_count < beacon_xmit_ind->numBssDesc; i++) { |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 894 | beacon_report = &report[i].report.beaconReport; |
Arif Hussain | a86aa43 | 2016-07-18 17:05:57 -0700 | [diff] [blame] | 895 | /* |
| 896 | * If the scan result is NULL then send report request |
| 897 | * with option subelement as NULL. |
| 898 | */ |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 899 | pe_debug("TX: [802.11 BCN_RPT] report %d bss %d", i, |
| 900 | bss_desc_count); |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 901 | bss_desc = beacon_xmit_ind-> |
| 902 | pBssDescription[bss_desc_count]; |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 903 | |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 904 | /* Prepare the beacon report and send it to the peer.*/ |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 905 | report[i].token = beacon_xmit_ind->uDialogToken; |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 906 | report[i].refused = 0; |
| 907 | report[i].incapable = 0; |
| 908 | report[i].type = SIR_MAC_RRM_BEACON_TYPE; |
Arif Hussain | a86aa43 | 2016-07-18 17:05:57 -0700 | [diff] [blame] | 909 | |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 910 | /* |
| 911 | * Valid response is included if the size of |
| 912 | * becon xmit is == size of beacon xmit ind + ies |
| 913 | */ |
| 914 | if (beacon_xmit_ind->length < sizeof(*beacon_xmit_ind)) |
| 915 | continue; |
Deepak Dhamdhere | 6aa33ba | 2016-08-23 14:29:45 -0700 | [diff] [blame] | 916 | beacon_report->regClass = beacon_xmit_ind->regClass; |
Arif Hussain | a86aa43 | 2016-07-18 17:05:57 -0700 | [diff] [blame] | 917 | if (bss_desc) { |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 918 | beacon_report->channel = |
| 919 | wlan_reg_freq_to_chan( |
| 920 | mac_ctx->pdev, |
| 921 | bss_desc->chan_freq); |
Deepak Dhamdhere | 6aa33ba | 2016-08-23 14:29:45 -0700 | [diff] [blame] | 922 | qdf_mem_copy(beacon_report->measStartTime, |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 923 | bss_desc->startTSF, |
| 924 | sizeof(bss_desc->startTSF)); |
Deepak Dhamdhere | 6aa33ba | 2016-08-23 14:29:45 -0700 | [diff] [blame] | 925 | beacon_report->measDuration = |
Bala Venkatesh | 40f20fd | 2019-04-12 20:54:17 +0530 | [diff] [blame] | 926 | beacon_xmit_ind->duration; |
Deepak Dhamdhere | 6aa33ba | 2016-08-23 14:29:45 -0700 | [diff] [blame] | 927 | beacon_report->phyType = bss_desc->nwType; |
| 928 | beacon_report->bcnProbeRsp = 1; |
| 929 | beacon_report->rsni = bss_desc->sinr; |
| 930 | beacon_report->rcpi = bss_desc->rssi; |
| 931 | beacon_report->antennaId = 0; |
| 932 | beacon_report->parentTSF = bss_desc->parentTSF; |
| 933 | qdf_mem_copy(beacon_report->bssid, |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 934 | bss_desc->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 935 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 936 | |
sheenam monga | 724306f | 2020-02-08 14:59:35 +0530 | [diff] [blame] | 937 | pe_debug("TX: [802.11 BCN_RPT] reporting detail requested %d", |
| 938 | curr_req->request.Beacon.reportingDetail); |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 939 | switch (curr_req->request.Beacon.reportingDetail) { |
| 940 | case BEACON_REPORTING_DETAIL_NO_FF_IE: |
| 941 | /* 0: No need to include any elements. */ |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 942 | break; |
| 943 | case BEACON_REPORTING_DETAIL_ALL_FF_REQ_IE: |
| 944 | /* 1: Include all FFs and Requested Ies. */ |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 945 | if (!bss_desc) |
| 946 | break; |
| 947 | |
| 948 | rem_len = rrm_fill_beacon_ies(mac_ctx, |
| 949 | (uint8_t *)&beacon_report->Ies[0], |
| 950 | (uint8_t *)&beacon_report->numIes, |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 951 | BEACON_REPORT_MAX_IES, |
| 952 | curr_req->request.Beacon.reqIes. |
| 953 | pElementIds, |
| 954 | curr_req->request.Beacon.reqIes.num, |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 955 | offset, bss_desc); |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 956 | break; |
| 957 | case BEACON_REPORTING_DETAIL_ALL_FF_IE: |
| 958 | /* 2: default - Include all FFs and all Ies. */ |
| 959 | default: |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 960 | if (!bss_desc) |
| 961 | break; |
| 962 | |
| 963 | rem_len = rrm_fill_beacon_ies(mac_ctx, |
Deepak Dhamdhere | 6aa33ba | 2016-08-23 14:29:45 -0700 | [diff] [blame] | 964 | (uint8_t *) &beacon_report->Ies[0], |
| 965 | (uint8_t *) &beacon_report->numIes, |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 966 | BEACON_REPORT_MAX_IES, |
| 967 | NULL, |
| 968 | 0, |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 969 | offset, bss_desc); |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 970 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 971 | } |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 972 | beacon_report->frame_body_frag_id.id = bss_desc_count; |
| 973 | beacon_report->frame_body_frag_id.frag_id = frag_id; |
| 974 | /* |
| 975 | * If remaining length is non-zero, the beacon needs to |
| 976 | * be fragmented only if the current request supports |
| 977 | * last beacon report indication. |
| 978 | * If last beacon report indication is not supported, |
| 979 | * truncate and move on to the next beacon. |
| 980 | */ |
| 981 | if (rem_len && |
| 982 | curr_req->request.Beacon. |
| 983 | last_beacon_report_indication) { |
| 984 | offset = GET_IE_LEN_IN_BSS( |
| 985 | bss_desc->length) - rem_len; |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 986 | pe_debug("TX: [802.11 BCN_RPT] offset %d ie_len %lu rem_len %d frag_id %d", |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 987 | offset, |
| 988 | GET_IE_LEN_IN_BSS(bss_desc->length), |
| 989 | rem_len, frag_id); |
| 990 | frag_id++; |
| 991 | beacon_report->frame_body_frag_id.more_frags = |
| 992 | true; |
| 993 | } else { |
| 994 | offset = 0; |
| 995 | beacon_report->frame_body_frag_id.more_frags = |
| 996 | false; |
| 997 | frag_id = 0; |
| 998 | bss_desc_count++; |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 999 | pe_debug("TX: [802.11 BCN_RPT] No remaining IEs"); |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 1000 | } |
Vignesh Viswanathan | 23bec98 | 2018-09-28 08:46:41 +0530 | [diff] [blame] | 1001 | |
| 1002 | if (curr_req->request.Beacon. |
| 1003 | last_beacon_report_indication) { |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 1004 | pe_debug("TX: [802.11 BCN_RPT] Setting last beacon report support"); |
Vignesh Viswanathan | 23bec98 | 2018-09-28 08:46:41 +0530 | [diff] [blame] | 1005 | beacon_report->last_bcn_report_ind_support = 1; |
| 1006 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1007 | } |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 1008 | |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 1009 | pe_debug("TX: [802.11 BCN_RPT] Total reports filled %d", i); |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 1010 | num_frames = i / RADIO_REPORTS_MAX_IN_A_FRAME; |
| 1011 | if (i % RADIO_REPORTS_MAX_IN_A_FRAME) |
| 1012 | num_frames++; |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 1013 | |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 1014 | for (j = 0; j < num_frames; j++) { |
| 1015 | num_reports_in_frame = QDF_MIN((i - report_index), |
| 1016 | RADIO_REPORTS_MAX_IN_A_FRAME); |
Deepak Dhamdhere | 1e4298f | 2017-06-24 11:46:00 -0700 | [diff] [blame] | 1017 | lim_send_radio_measure_report_action_frame(mac_ctx, |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 1018 | curr_req->dialog_token, num_reports_in_frame, |
| 1019 | (j == num_frames - 1) ? true : false, |
Deepak Dhamdhere | 1e4298f | 2017-06-24 11:46:00 -0700 | [diff] [blame] | 1020 | &report[report_index], |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1021 | beacon_xmit_ind->bssId, session_entry, |
| 1022 | error_code); |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 1023 | report_index += num_reports_in_frame; |
Deepak Dhamdhere | 1e4298f | 2017-06-24 11:46:00 -0700 | [diff] [blame] | 1024 | } |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 1025 | curr_req->sendEmptyBcnRpt = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1026 | } |
| 1027 | |
Krunal Soni | f05a670 | 2017-05-01 10:54:23 -0700 | [diff] [blame] | 1028 | end: |
| 1029 | for (counter = 0; counter < beacon_xmit_ind->numBssDesc; counter++) |
| 1030 | qdf_mem_free(beacon_xmit_ind->pBssDescription[counter]); |
| 1031 | |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 1032 | if (beacon_xmit_ind->fMeasureDone) { |
sheenam monga | 724306f | 2020-02-08 14:59:35 +0530 | [diff] [blame] | 1033 | pe_debug("Measurement done."); |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 1034 | rrm_cleanup(mac_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1035 | } |
| 1036 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1037 | if (report) |
Sreelakshmi Konamki | 20ee4d6 | 2016-03-07 16:10:25 +0530 | [diff] [blame] | 1038 | qdf_mem_free(report); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1039 | |
| 1040 | return status; |
| 1041 | } |
| 1042 | |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 1043 | static void rrm_process_beacon_request_failure(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1044 | struct pe_session *pe_session, |
Jeff Johnson | 1628188 | 2016-10-07 07:35:40 -0700 | [diff] [blame] | 1045 | tSirMacAddr peer, |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1046 | tRrmRetStatus status, |
| 1047 | enum beacon_report_status_code |
| 1048 | error_code) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1049 | { |
| 1050 | tpSirMacRadioMeasureReport pReport = NULL; |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 1051 | tpRRMReq pCurrentReq = mac->rrm.rrmPEContext.pCurrentReq; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1052 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1053 | pReport = qdf_mem_malloc(sizeof(tSirMacRadioMeasureReport)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1054 | if (!pReport) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1055 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1056 | pReport->token = pCurrentReq->token; |
| 1057 | pReport->type = SIR_MAC_RRM_BEACON_TYPE; |
| 1058 | |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 1059 | pe_debug("status %d token %d", status, pReport->token); |
Padma, Santhosh Kumar | 93ec7d2 | 2016-12-26 15:58:37 +0530 | [diff] [blame] | 1060 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1061 | switch (status) { |
| 1062 | case eRRM_REFUSED: |
| 1063 | pReport->refused = 1; |
| 1064 | break; |
| 1065 | case eRRM_INCAPABLE: |
| 1066 | pReport->incapable = 1; |
| 1067 | break; |
| 1068 | default: |
sheenam monga | 724306f | 2020-02-08 14:59:35 +0530 | [diff] [blame] | 1069 | pe_err("RX [802.11 BCN_RPT] Beacon request processing failed no report sent"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1070 | qdf_mem_free(pReport); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1071 | return; |
| 1072 | } |
| 1073 | |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 1074 | lim_send_radio_measure_report_action_frame(mac, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 1075 | pCurrentReq->dialog_token, |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 1076 | 1, true, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 1077 | pReport, peer, |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1078 | pe_session, error_code); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1079 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1080 | qdf_mem_free(pReport); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1081 | return; |
| 1082 | } |
| 1083 | |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1084 | /** |
| 1085 | * rrm_process_beacon_req() - Update curr_req and report |
| 1086 | * @mac_ctx: Global pointer to MAC context |
| 1087 | * @peer: Macaddress of the peer requesting the radio measurement |
| 1088 | * @session_entry: session entry |
| 1089 | * @curr_req: Pointer to RRM request |
Sandeep Puligilla | 63633f6 | 2017-11-15 16:51:51 -0800 | [diff] [blame] | 1090 | * @radiomes_report: Pointer to radio measurement report |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1091 | * @rrm_req: Array of Measurement request IEs |
| 1092 | * @num_report: No.of reports |
| 1093 | * @index: Index for Measurement request |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1094 | * @error_code: pointer beacon report resp error code |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1095 | * |
| 1096 | * Update structure sRRMReq and sSirMacRadioMeasureReport and pass it to |
| 1097 | * rrm_process_beacon_report_req(). |
| 1098 | * |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1099 | * Return: QDF_STATUS |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1100 | */ |
Jeff Johnson | 1628188 | 2016-10-07 07:35:40 -0700 | [diff] [blame] | 1101 | static |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 1102 | QDF_STATUS rrm_process_beacon_req(struct mac_context *mac_ctx, tSirMacAddr peer, |
Jeff Johnson | 66845ca | 2018-11-18 21:44:10 -0800 | [diff] [blame] | 1103 | struct pe_session *session_entry, tpRRMReq curr_req, |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1104 | tpSirMacRadioMeasureReport *radiomes_report, |
| 1105 | tDot11fRadioMeasurementRequest *rrm_req, |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1106 | uint8_t *num_report, int index, |
| 1107 | enum beacon_report_status_code |
| 1108 | *error_code) |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1109 | { |
| 1110 | tRrmRetStatus rrm_status = eRRM_SUCCESS; |
Sandeep Puligilla | 63633f6 | 2017-11-15 16:51:51 -0800 | [diff] [blame] | 1111 | tpSirMacRadioMeasureReport report; |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1112 | if (curr_req) { |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1113 | if (!*radiomes_report) { |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1114 | /* |
| 1115 | * Allocate memory to send reports for |
| 1116 | * any subsequent requests. |
| 1117 | */ |
Sandeep Puligilla | 63633f6 | 2017-11-15 16:51:51 -0800 | [diff] [blame] | 1118 | *radiomes_report = qdf_mem_malloc(sizeof(*report) * |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1119 | (rrm_req->num_MeasurementRequest - index)); |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1120 | if (!*radiomes_report) { |
| 1121 | *error_code = |
| 1122 | BCN_RPT_ERR_TEMPORARILY_UNAVAILABLE; |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1123 | return QDF_STATUS_E_NOMEM; |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1124 | } |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 1125 | pe_debug("rrm beacon type refused of %d report in beacon table", |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1126 | *num_report); |
| 1127 | } |
Sandeep Puligilla | 63633f6 | 2017-11-15 16:51:51 -0800 | [diff] [blame] | 1128 | report = *radiomes_report; |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1129 | report[*num_report].refused = 1; |
| 1130 | report[*num_report].type = SIR_MAC_RRM_BEACON_TYPE; |
| 1131 | report[*num_report].token = |
| 1132 | rrm_req->MeasurementRequest[index].measurement_token; |
| 1133 | (*num_report)++; |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1134 | *error_code = BCN_RPT_SUCCESS; |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1135 | return QDF_STATUS_SUCCESS; |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1136 | } |
| 1137 | curr_req = qdf_mem_malloc(sizeof(*curr_req)); |
| 1138 | if (!curr_req) { |
| 1139 | qdf_mem_free(*radiomes_report); |
| 1140 | return QDF_STATUS_E_NOMEM; |
| 1141 | } |
| 1142 | pe_debug("Processing Beacon Report request"); |
| 1143 | curr_req->dialog_token = rrm_req->DialogToken.token; |
| 1144 | curr_req->token = |
| 1145 | rrm_req->MeasurementRequest[index].measurement_token; |
| 1146 | curr_req->sendEmptyBcnRpt = true; |
| 1147 | mac_ctx->rrm.rrmPEContext.pCurrentReq = curr_req; |
| 1148 | rrm_status = |
| 1149 | rrm_process_beacon_report_req(mac_ctx, curr_req, |
| 1150 | &rrm_req->MeasurementRequest[index], |
| 1151 | session_entry, error_code); |
| 1152 | if (eRRM_SUCCESS != rrm_status) { |
| 1153 | rrm_process_beacon_request_failure(mac_ctx, session_entry, peer, |
| 1154 | rrm_status, *error_code); |
| 1155 | rrm_cleanup(mac_ctx); |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1156 | } |
sheenam monga | 724306f | 2020-02-08 14:59:35 +0530 | [diff] [blame] | 1157 | |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1158 | return QDF_STATUS_SUCCESS; |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1159 | } |
| 1160 | |
| 1161 | /** |
| 1162 | * update_rrm_report() - Set incapable bit |
| 1163 | * @mac_ctx: Global pointer to MAC context |
| 1164 | * @report: Pointer to radio measurement report |
| 1165 | * @rrm_req: Array of Measurement request IEs |
| 1166 | * @num_report: No.of reports |
| 1167 | * @index: Index for Measurement request |
| 1168 | * |
| 1169 | * Send a report with incapabale bit set |
| 1170 | * |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1171 | * Return: QDF_STATUS |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1172 | */ |
Jeff Johnson | 1628188 | 2016-10-07 07:35:40 -0700 | [diff] [blame] | 1173 | static |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 1174 | QDF_STATUS update_rrm_report(struct mac_context *mac_ctx, |
Abhinav Kumar | 18c78a3 | 2019-11-14 14:19:44 +0530 | [diff] [blame] | 1175 | tpSirMacRadioMeasureReport *report, |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1176 | tDot11fRadioMeasurementRequest *rrm_req, |
| 1177 | uint8_t *num_report, int index) |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1178 | { |
Abhinav Kumar | 18c78a3 | 2019-11-14 14:19:44 +0530 | [diff] [blame] | 1179 | tpSirMacRadioMeasureReport rrm_report; |
| 1180 | |
| 1181 | if (!*report) { |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1182 | /* |
| 1183 | * Allocate memory to send reports for |
| 1184 | * any subsequent requests. |
| 1185 | */ |
Abhinav Kumar | 18c78a3 | 2019-11-14 14:19:44 +0530 | [diff] [blame] | 1186 | *report = qdf_mem_malloc(sizeof(tSirMacRadioMeasureReport) * |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1187 | (rrm_req->num_MeasurementRequest - index)); |
Abhinav Kumar | 18c78a3 | 2019-11-14 14:19:44 +0530 | [diff] [blame] | 1188 | if (!*report) |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1189 | return QDF_STATUS_E_NOMEM; |
Abhinav Kumar | 18c78a3 | 2019-11-14 14:19:44 +0530 | [diff] [blame] | 1190 | pe_debug("rrm beacon type incapable of %d report", *num_report); |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1191 | } |
Abhinav Kumar | 18c78a3 | 2019-11-14 14:19:44 +0530 | [diff] [blame] | 1192 | rrm_report = *report; |
| 1193 | rrm_report[*num_report].incapable = 1; |
| 1194 | rrm_report[*num_report].type = |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1195 | rrm_req->MeasurementRequest[index].measurement_type; |
Abhinav Kumar | 18c78a3 | 2019-11-14 14:19:44 +0530 | [diff] [blame] | 1196 | rrm_report[*num_report].token = |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1197 | rrm_req->MeasurementRequest[index].measurement_token; |
| 1198 | (*num_report)++; |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1199 | return QDF_STATUS_SUCCESS; |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1200 | } |
| 1201 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1202 | /** |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1203 | * rrm_process_radio_measurement_request - Processes the Radio Resource |
| 1204 | * Measurement request |
| 1205 | * |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1206 | * @mac_ctx: Global pointer to MAC context |
| 1207 | * @peer: Macaddress of the peer requesting the radio measurement. |
| 1208 | * @rrm_req: Array of Measurement request IEs |
| 1209 | * @session_entry: session entry. |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1210 | * @error_code: beacon report resp error code |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1211 | * |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1212 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1213 | */ |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1214 | QDF_STATUS |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 1215 | rrm_process_radio_measurement_request(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1216 | tSirMacAddr peer, |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1217 | tDot11fRadioMeasurementRequest *rrm_req, |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1218 | struct pe_session *session_entry, |
| 1219 | enum beacon_report_status_code |
| 1220 | error_code) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1221 | { |
| 1222 | uint8_t i; |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1223 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1224 | tpSirMacRadioMeasureReport report = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1225 | uint8_t num_report = 0; |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1226 | tpRRMReq curr_req = mac_ctx->rrm.rrmPEContext.pCurrentReq; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1227 | |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1228 | if (!rrm_req->num_MeasurementRequest) { |
| 1229 | report = qdf_mem_malloc(sizeof(tSirMacRadioMeasureReport)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1230 | if (!report) |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1231 | return QDF_STATUS_E_NOMEM; |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 1232 | pe_err("RX: [802.11 RRM] No requestIes in the measurement request, sending incapable report"); |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1233 | report->incapable = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1234 | num_report = 1; |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1235 | error_code = BCN_RPT_ERR_VALIDATION_FAILED_IN_A_REQUEST_FRAME; |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1236 | lim_send_radio_measure_report_action_frame(mac_ctx, |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 1237 | rrm_req->DialogToken.token, num_report, true, |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1238 | report, peer, session_entry, error_code); |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1239 | qdf_mem_free(report); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1240 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1241 | } |
| 1242 | /* PF Fix */ |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1243 | if (rrm_req->NumOfRepetitions.repetitions > 0) { |
Pragaspathi Thilagaraj | acdf340 | 2020-01-27 16:52:50 +0530 | [diff] [blame] | 1244 | pe_info("RX: [802.11 RRM] number of repetitions %d, sending incapable report", |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1245 | rrm_req->NumOfRepetitions.repetitions); |
| 1246 | /* |
| 1247 | * Send a report with incapable bit set. |
| 1248 | * Not supporting repetitions. |
| 1249 | */ |
| 1250 | report = qdf_mem_malloc(sizeof(tSirMacRadioMeasureReport)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 1251 | if (!report) |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1252 | return QDF_STATUS_E_NOMEM; |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1253 | report->incapable = 1; |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1254 | error_code = BCN_RPT_ERR_PREVIOUS_REQUEST_PROGRESS; |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1255 | report->type = rrm_req->MeasurementRequest[0].measurement_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1256 | num_report = 1; |
| 1257 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1258 | } |
| 1259 | |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1260 | for (i = 0; i < rrm_req->num_MeasurementRequest; i++) { |
| 1261 | switch (rrm_req->MeasurementRequest[i].measurement_type) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1262 | case SIR_MAC_RRM_BEACON_TYPE: |
| 1263 | /* Process beacon request. */ |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1264 | status = rrm_process_beacon_req(mac_ctx, peer, |
Sandeep Puligilla | 63633f6 | 2017-11-15 16:51:51 -0800 | [diff] [blame] | 1265 | session_entry, curr_req, &report, rrm_req, |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1266 | &num_report, i, &error_code); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1267 | if (QDF_STATUS_SUCCESS != status) |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1268 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1269 | break; |
| 1270 | case SIR_MAC_RRM_LCI_TYPE: |
| 1271 | case SIR_MAC_RRM_LOCATION_CIVIC_TYPE: |
| 1272 | case SIR_MAC_RRM_FINE_TIME_MEAS_TYPE: |
Srinivas Girigowda | 19b944f | 2017-03-26 16:22:22 -0700 | [diff] [blame] | 1273 | pe_debug("RRM with type: %d sent to userspace", |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1274 | rrm_req->MeasurementRequest[i].measurement_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1275 | break; |
| 1276 | default: |
| 1277 | /* Send a report with incapabale bit set. */ |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1278 | error_code = BCN_RPT_ERR_UNSPECIFIED; |
Abhinav Kumar | 18c78a3 | 2019-11-14 14:19:44 +0530 | [diff] [blame] | 1279 | status = update_rrm_report(mac_ctx, &report, rrm_req, |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1280 | &num_report, i); |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1281 | if (QDF_STATUS_SUCCESS != status) |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1282 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1283 | break; |
| 1284 | } |
| 1285 | } |
| 1286 | |
| 1287 | end: |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1288 | if (report) { |
| 1289 | lim_send_radio_measure_report_action_frame(mac_ctx, |
Vignesh Viswanathan | 09bd8f4 | 2018-08-14 22:04:36 +0530 | [diff] [blame] | 1290 | rrm_req->DialogToken.token, num_report, true, |
sheenam monga | 26165ab | 2020-02-23 05:25:01 +0530 | [diff] [blame^] | 1291 | report, peer, session_entry, error_code); |
Sreelakshmi Konamki | d178ca8 | 2016-03-15 10:26:04 +0530 | [diff] [blame] | 1292 | qdf_mem_free(report); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1293 | } |
| 1294 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1295 | } |
| 1296 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1297 | /** |
| 1298 | * rrm_get_start_tsf |
| 1299 | * |
| 1300 | * FUNCTION: Get the Start TSF. |
| 1301 | * |
| 1302 | * LOGIC: |
| 1303 | * |
| 1304 | * ASSUMPTIONS: |
| 1305 | * |
| 1306 | * NOTE: |
| 1307 | * |
| 1308 | * @param startTSF - store star TSF in this buffer. |
| 1309 | * @return txPower |
| 1310 | */ |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 1311 | void rrm_get_start_tsf(struct mac_context *mac, uint32_t *pStartTSF) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1312 | { |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 1313 | pStartTSF[0] = mac->rrm.rrmPEContext.startTSF[0]; |
| 1314 | pStartTSF[1] = mac->rrm.rrmPEContext.startTSF[1]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1315 | |
| 1316 | } |
| 1317 | |
| 1318 | /* -------------------------------------------------------------------- */ |
| 1319 | /** |
| 1320 | * rrm_get_capabilities |
| 1321 | * |
| 1322 | * FUNCTION: |
| 1323 | * Returns a pointer to tpRRMCaps with all the caps enabled in RRM |
| 1324 | * |
| 1325 | * LOGIC: |
| 1326 | * |
| 1327 | * ASSUMPTIONS: |
| 1328 | * |
| 1329 | * NOTE: |
| 1330 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1331 | * @param pe_session |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1332 | * @return pointer to tRRMCaps |
| 1333 | */ |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 1334 | tpRRMCaps rrm_get_capabilities(struct mac_context *mac, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1335 | { |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 1336 | return &mac->rrm.rrmPEContext.rrmEnabledCaps; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1337 | } |
| 1338 | |
| 1339 | /* -------------------------------------------------------------------- */ |
| 1340 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1341 | * rrm_initialize |
| 1342 | * |
| 1343 | * FUNCTION: |
| 1344 | * Initialize RRM module |
| 1345 | * |
| 1346 | * LOGIC: |
| 1347 | * |
| 1348 | * ASSUMPTIONS: |
| 1349 | * |
| 1350 | * NOTE: |
| 1351 | * |
| 1352 | * @return None |
| 1353 | */ |
| 1354 | |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 1355 | QDF_STATUS rrm_initialize(struct mac_context *mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1356 | { |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 1357 | tpRRMCaps pRRMCaps = &mac->rrm.rrmPEContext.rrmEnabledCaps; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1358 | |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 1359 | mac->rrm.rrmPEContext.pCurrentReq = NULL; |
| 1360 | mac->rrm.rrmPEContext.txMgmtPower = 0; |
| 1361 | mac->rrm.rrmPEContext.DialogToken = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1362 | |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 1363 | mac->rrm.rrmPEContext.rrmEnable = 0; |
| 1364 | mac->rrm.rrmPEContext.prev_rrm_report_seq_num = 0xFFFF; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1365 | |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1366 | qdf_mem_zero(pRRMCaps, sizeof(tRRMCaps)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1367 | pRRMCaps->LinkMeasurement = 1; |
| 1368 | pRRMCaps->NeighborRpt = 1; |
| 1369 | pRRMCaps->BeaconPassive = 1; |
| 1370 | pRRMCaps->BeaconActive = 1; |
| 1371 | pRRMCaps->BeaconTable = 1; |
| 1372 | pRRMCaps->APChanReport = 1; |
| 1373 | pRRMCaps->fine_time_meas_rpt = 1; |
| 1374 | pRRMCaps->lci_capability = 1; |
| 1375 | |
Jeff Johnson | 1c17173 | 2016-09-08 14:35:36 -0700 | [diff] [blame] | 1376 | pRRMCaps->operatingChanMax = 3; |
| 1377 | pRRMCaps->nonOperatingChanMax = 3; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1378 | |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1379 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1380 | } |
| 1381 | |
| 1382 | /* -------------------------------------------------------------------- */ |
| 1383 | /** |
| 1384 | * rrm_cleanup |
| 1385 | * |
| 1386 | * FUNCTION: |
| 1387 | * cleanup RRM module |
| 1388 | * |
| 1389 | * LOGIC: |
| 1390 | * |
| 1391 | * ASSUMPTIONS: |
| 1392 | * |
| 1393 | * NOTE: |
| 1394 | * |
| 1395 | * @param mode |
| 1396 | * @param rate |
| 1397 | * @return None |
| 1398 | */ |
| 1399 | |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 1400 | QDF_STATUS rrm_cleanup(struct mac_context *mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1401 | { |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 1402 | if (mac->rrm.rrmPEContext.pCurrentReq) { |
| 1403 | if (mac->rrm.rrmPEContext.pCurrentReq->request.Beacon.reqIes. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1404 | pElementIds) { |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 1405 | qdf_mem_free(mac->rrm.rrmPEContext.pCurrentReq-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1406 | request.Beacon.reqIes.pElementIds); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1407 | } |
| 1408 | |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 1409 | qdf_mem_free(mac->rrm.rrmPEContext.pCurrentReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1410 | } |
| 1411 | |
Jeff Johnson | 86a9a35 | 2018-11-22 14:08:32 -0800 | [diff] [blame] | 1412 | mac->rrm.rrmPEContext.pCurrentReq = NULL; |
Jeff Johnson | ceb4e9b | 2018-06-22 14:44:24 -0700 | [diff] [blame] | 1413 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1414 | } |
| 1415 | |
Krishna Kumaar Natarajan | f599c6e | 2015-11-03 11:44:03 -0800 | [diff] [blame] | 1416 | /** |
| 1417 | * lim_update_rrm_capability() - Update PE context's rrm capability |
| 1418 | * @mac_ctx: Global pointer to MAC context |
| 1419 | * @join_req: Pointer to SME join request. |
| 1420 | * |
| 1421 | * Update PE context's rrm capability based on SME join request. |
| 1422 | * |
| 1423 | * Return: None |
| 1424 | */ |
Jeff Johnson | b228e0a | 2018-12-02 12:27:26 -0800 | [diff] [blame] | 1425 | void lim_update_rrm_capability(struct mac_context *mac_ctx, |
Jeff Johnson | 701444f | 2019-02-02 22:35:13 -0800 | [diff] [blame] | 1426 | struct join_req *join_req) |
Krishna Kumaar Natarajan | f599c6e | 2015-11-03 11:44:03 -0800 | [diff] [blame] | 1427 | { |
| 1428 | mac_ctx->rrm.rrmPEContext.rrmEnable = join_req->rrm_config.rrm_enabled; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1429 | qdf_mem_copy(&mac_ctx->rrm.rrmPEContext.rrmEnabledCaps, |
Krishna Kumaar Natarajan | f599c6e | 2015-11-03 11:44:03 -0800 | [diff] [blame] | 1430 | &join_req->rrm_config.rm_capability, |
| 1431 | RMENABLEDCAP_MAX_LEN); |
| 1432 | |
| 1433 | return; |
| 1434 | } |