Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Marvell Wireless LAN device driver: station command response handling |
| 3 | * |
| 4 | * Copyright (C) 2011, Marvell International Ltd. |
| 5 | * |
| 6 | * This software file (the "File") is distributed by Marvell International |
| 7 | * Ltd. under the terms of the GNU General Public License Version 2, June 1991 |
| 8 | * (the "License"). You may use, redistribute and/or modify this File in |
| 9 | * accordance with the terms and conditions of the License, a copy of which |
| 10 | * is available by writing to the Free Software Foundation, Inc., |
| 11 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the |
| 12 | * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. |
| 13 | * |
| 14 | * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE |
| 16 | * ARE EXPRESSLY DISCLAIMED. The License provides additional details about |
| 17 | * this warranty disclaimer. |
| 18 | */ |
| 19 | |
| 20 | #include "decl.h" |
| 21 | #include "ioctl.h" |
| 22 | #include "util.h" |
| 23 | #include "fw.h" |
| 24 | #include "main.h" |
| 25 | #include "wmm.h" |
| 26 | #include "11n.h" |
Yogesh Ashok Powar | a5f3905 | 2013-02-15 21:44:30 -0800 | [diff] [blame] | 27 | #include "11ac.h" |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 28 | |
| 29 | |
| 30 | /* |
| 31 | * This function handles the command response error case. |
| 32 | * |
| 33 | * For scan response error, the function cancels all the pending |
| 34 | * scan commands and generates an event to inform the applications |
| 35 | * of the scan completion. |
| 36 | * |
| 37 | * For Power Save command failure, we do not retry enter PS |
| 38 | * command in case of Ad-hoc mode. |
| 39 | * |
| 40 | * For all other response errors, the current command buffer is freed |
| 41 | * and returned to the free command queue. |
| 42 | */ |
| 43 | static void |
| 44 | mwifiex_process_cmdresp_error(struct mwifiex_private *priv, |
Amitkumar Karwar | 600f5d9 | 2011-04-13 17:27:06 -0700 | [diff] [blame] | 45 | struct host_cmd_ds_command *resp) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 46 | { |
Yogesh Ashok Powar | 270e58e | 2011-05-03 20:11:46 -0700 | [diff] [blame] | 47 | struct cmd_ctrl_node *cmd_node = NULL, *tmp_node; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 48 | struct mwifiex_adapter *adapter = priv->adapter; |
Marc Yang | 2b06bdb | 2011-03-30 18:12:44 -0700 | [diff] [blame] | 49 | struct host_cmd_ds_802_11_ps_mode_enh *pm; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 50 | unsigned long flags; |
| 51 | |
| 52 | dev_err(adapter->dev, "CMD_RESP: cmd %#x error, result=%#x\n", |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 53 | resp->command, resp->result); |
Amitkumar Karwar | 600f5d9 | 2011-04-13 17:27:06 -0700 | [diff] [blame] | 54 | |
| 55 | if (adapter->curr_cmd->wait_q_enabled) |
| 56 | adapter->cmd_wait_q.status = -1; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 57 | |
| 58 | switch (le16_to_cpu(resp->command)) { |
| 59 | case HostCmd_CMD_802_11_PS_MODE_ENH: |
Marc Yang | 2b06bdb | 2011-03-30 18:12:44 -0700 | [diff] [blame] | 60 | pm = &resp->params.psmode_enh; |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 61 | dev_err(adapter->dev, |
| 62 | "PS_MODE_ENH cmd failed: result=0x%x action=0x%X\n", |
| 63 | resp->result, le16_to_cpu(pm->action)); |
Marc Yang | 2b06bdb | 2011-03-30 18:12:44 -0700 | [diff] [blame] | 64 | /* We do not re-try enter-ps command in ad-hoc mode. */ |
| 65 | if (le16_to_cpu(pm->action) == EN_AUTO_PS && |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 66 | (le16_to_cpu(pm->params.ps_bitmap) & BITMAP_STA_PS) && |
| 67 | priv->bss_mode == NL80211_IFTYPE_ADHOC) |
Marc Yang | 2b06bdb | 2011-03-30 18:12:44 -0700 | [diff] [blame] | 68 | adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; |
| 69 | |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 70 | break; |
| 71 | case HostCmd_CMD_802_11_SCAN: |
Amitkumar Karwar | 21f58d20 | 2014-02-11 18:39:56 -0800 | [diff] [blame] | 72 | case HostCmd_CMD_802_11_SCAN_EXT: |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 73 | /* Cancel all pending scan command */ |
| 74 | spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); |
| 75 | list_for_each_entry_safe(cmd_node, tmp_node, |
| 76 | &adapter->scan_pending_q, list) { |
| 77 | list_del(&cmd_node->list); |
| 78 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, |
| 79 | flags); |
| 80 | mwifiex_insert_cmd_to_free_q(adapter, cmd_node); |
| 81 | spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); |
| 82 | } |
| 83 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); |
| 84 | |
| 85 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); |
| 86 | adapter->scan_processing = false; |
| 87 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); |
| 88 | if (priv->report_scan_result) |
| 89 | priv->report_scan_result = false; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 90 | break; |
| 91 | |
| 92 | case HostCmd_CMD_MAC_CONTROL: |
| 93 | break; |
| 94 | |
| 95 | default: |
| 96 | break; |
| 97 | } |
| 98 | /* Handling errors here */ |
Bing Zhao | 9908b07 | 2013-04-01 12:44:46 -0700 | [diff] [blame] | 99 | mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 100 | |
| 101 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); |
| 102 | adapter->curr_cmd = NULL; |
| 103 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | /* |
| 107 | * This function handles the command response of get RSSI info. |
| 108 | * |
| 109 | * Handling includes changing the header fields into CPU format |
| 110 | * and saving the following parameters in driver - |
| 111 | * - Last data and beacon RSSI value |
| 112 | * - Average data and beacon RSSI value |
| 113 | * - Last data and beacon NF value |
| 114 | * - Average data and beacon NF value |
| 115 | * |
| 116 | * The parameters are send to the application as well, along with |
| 117 | * calculated SNR values. |
| 118 | */ |
| 119 | static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv, |
Amitkumar Karwar | 958a4a8 | 2012-03-15 20:51:49 -0700 | [diff] [blame] | 120 | struct host_cmd_ds_command *resp) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 121 | { |
| 122 | struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp = |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 123 | &resp->params.rssi_info_rsp; |
Jeff Disher | 908fe11 | 2012-08-30 18:20:55 -0700 | [diff] [blame] | 124 | struct mwifiex_ds_misc_subsc_evt *subsc_evt = |
| 125 | &priv->async_subsc_evt_storage; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 126 | |
| 127 | priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last); |
| 128 | priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last); |
| 129 | |
| 130 | priv->data_rssi_avg = le16_to_cpu(rssi_info_rsp->data_rssi_avg); |
| 131 | priv->data_nf_avg = le16_to_cpu(rssi_info_rsp->data_nf_avg); |
| 132 | |
| 133 | priv->bcn_rssi_last = le16_to_cpu(rssi_info_rsp->bcn_rssi_last); |
| 134 | priv->bcn_nf_last = le16_to_cpu(rssi_info_rsp->bcn_nf_last); |
| 135 | |
| 136 | priv->bcn_rssi_avg = le16_to_cpu(rssi_info_rsp->bcn_rssi_avg); |
| 137 | priv->bcn_nf_avg = le16_to_cpu(rssi_info_rsp->bcn_nf_avg); |
| 138 | |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 139 | if (priv->subsc_evt_rssi_state == EVENT_HANDLED) |
| 140 | return 0; |
| 141 | |
Jeff Disher | 908fe11 | 2012-08-30 18:20:55 -0700 | [diff] [blame] | 142 | memset(subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt)); |
| 143 | |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 144 | /* Resubscribe low and high rssi events with new thresholds */ |
Jeff Disher | 908fe11 | 2012-08-30 18:20:55 -0700 | [diff] [blame] | 145 | subsc_evt->events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH; |
| 146 | subsc_evt->action = HostCmd_ACT_BITWISE_SET; |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 147 | if (priv->subsc_evt_rssi_state == RSSI_LOW_RECVD) { |
Jeff Disher | 908fe11 | 2012-08-30 18:20:55 -0700 | [diff] [blame] | 148 | subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg - |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 149 | priv->cqm_rssi_hyst); |
Jeff Disher | 908fe11 | 2012-08-30 18:20:55 -0700 | [diff] [blame] | 150 | subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold); |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 151 | } else if (priv->subsc_evt_rssi_state == RSSI_HIGH_RECVD) { |
Jeff Disher | 908fe11 | 2012-08-30 18:20:55 -0700 | [diff] [blame] | 152 | subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold); |
| 153 | subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg + |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 154 | priv->cqm_rssi_hyst); |
| 155 | } |
Jeff Disher | 908fe11 | 2012-08-30 18:20:55 -0700 | [diff] [blame] | 156 | subsc_evt->bcn_l_rssi_cfg.evt_freq = 1; |
| 157 | subsc_evt->bcn_h_rssi_cfg.evt_freq = 1; |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 158 | |
| 159 | priv->subsc_evt_rssi_state = EVENT_HANDLED; |
| 160 | |
| 161 | mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11_SUBSCRIBE_EVENT, |
Jeff Disher | 908fe11 | 2012-08-30 18:20:55 -0700 | [diff] [blame] | 162 | 0, 0, subsc_evt); |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 163 | |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 164 | return 0; |
| 165 | } |
| 166 | |
| 167 | /* |
| 168 | * This function handles the command response of set/get SNMP |
| 169 | * MIB parameters. |
| 170 | * |
| 171 | * Handling includes changing the header fields into CPU format |
| 172 | * and saving the parameter in driver. |
| 173 | * |
| 174 | * The following parameters are supported - |
| 175 | * - Fragmentation threshold |
| 176 | * - RTS threshold |
| 177 | * - Short retry limit |
| 178 | */ |
| 179 | static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv, |
| 180 | struct host_cmd_ds_command *resp, |
Dan Carpenter | a5e5aa6 | 2011-06-24 16:33:35 +0300 | [diff] [blame] | 181 | u32 *data_buf) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 182 | { |
| 183 | struct host_cmd_ds_802_11_snmp_mib *smib = &resp->params.smib; |
| 184 | u16 oid = le16_to_cpu(smib->oid); |
| 185 | u16 query_type = le16_to_cpu(smib->query_type); |
Dan Carpenter | a5e5aa6 | 2011-06-24 16:33:35 +0300 | [diff] [blame] | 186 | u32 ul_temp; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 187 | |
| 188 | dev_dbg(priv->adapter->dev, "info: SNMP_RESP: oid value = %#x," |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 189 | " query_type = %#x, buf size = %#x\n", |
| 190 | oid, query_type, le16_to_cpu(smib->buf_size)); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 191 | if (query_type == HostCmd_ACT_GEN_GET) { |
Dan Carpenter | a5e5aa6 | 2011-06-24 16:33:35 +0300 | [diff] [blame] | 192 | ul_temp = le16_to_cpu(*((__le16 *) (smib->value))); |
| 193 | if (data_buf) |
| 194 | *data_buf = ul_temp; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 195 | switch (oid) { |
| 196 | case FRAG_THRESH_I: |
| 197 | dev_dbg(priv->adapter->dev, |
Dan Carpenter | a5e5aa6 | 2011-06-24 16:33:35 +0300 | [diff] [blame] | 198 | "info: SNMP_RESP: FragThsd =%u\n", ul_temp); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 199 | break; |
| 200 | case RTS_THRESH_I: |
| 201 | dev_dbg(priv->adapter->dev, |
Dan Carpenter | a5e5aa6 | 2011-06-24 16:33:35 +0300 | [diff] [blame] | 202 | "info: SNMP_RESP: RTSThsd =%u\n", ul_temp); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 203 | break; |
| 204 | case SHORT_RETRY_LIM_I: |
| 205 | dev_dbg(priv->adapter->dev, |
Dan Carpenter | a5e5aa6 | 2011-06-24 16:33:35 +0300 | [diff] [blame] | 206 | "info: SNMP_RESP: TxRetryCount=%u\n", ul_temp); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 207 | break; |
Amitkumar Karwar | caf60a6 | 2012-02-02 20:48:58 -0800 | [diff] [blame] | 208 | case DTIM_PERIOD_I: |
| 209 | dev_dbg(priv->adapter->dev, |
| 210 | "info: SNMP_RESP: DTIM period=%u\n", ul_temp); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 211 | default: |
| 212 | break; |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | return 0; |
| 217 | } |
| 218 | |
| 219 | /* |
| 220 | * This function handles the command response of get log request |
| 221 | * |
| 222 | * Handling includes changing the header fields into CPU format |
| 223 | * and sending the received parameters to application. |
| 224 | */ |
| 225 | static int mwifiex_ret_get_log(struct mwifiex_private *priv, |
| 226 | struct host_cmd_ds_command *resp, |
Amitkumar Karwar | a5ffddb | 2011-06-20 15:21:48 -0700 | [diff] [blame] | 227 | struct mwifiex_ds_get_stats *stats) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 228 | { |
| 229 | struct host_cmd_ds_802_11_get_log *get_log = |
Joe Perches | 2c20889 | 2012-06-04 12:44:17 +0000 | [diff] [blame] | 230 | &resp->params.get_log; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 231 | |
Amitkumar Karwar | a5ffddb | 2011-06-20 15:21:48 -0700 | [diff] [blame] | 232 | if (stats) { |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 233 | stats->mcast_tx_frame = le32_to_cpu(get_log->mcast_tx_frame); |
| 234 | stats->failed = le32_to_cpu(get_log->failed); |
| 235 | stats->retry = le32_to_cpu(get_log->retry); |
| 236 | stats->multi_retry = le32_to_cpu(get_log->multi_retry); |
| 237 | stats->frame_dup = le32_to_cpu(get_log->frame_dup); |
| 238 | stats->rts_success = le32_to_cpu(get_log->rts_success); |
| 239 | stats->rts_failure = le32_to_cpu(get_log->rts_failure); |
| 240 | stats->ack_failure = le32_to_cpu(get_log->ack_failure); |
| 241 | stats->rx_frag = le32_to_cpu(get_log->rx_frag); |
| 242 | stats->mcast_rx_frame = le32_to_cpu(get_log->mcast_rx_frame); |
| 243 | stats->fcs_error = le32_to_cpu(get_log->fcs_error); |
| 244 | stats->tx_frame = le32_to_cpu(get_log->tx_frame); |
| 245 | stats->wep_icv_error[0] = |
| 246 | le32_to_cpu(get_log->wep_icv_err_cnt[0]); |
| 247 | stats->wep_icv_error[1] = |
| 248 | le32_to_cpu(get_log->wep_icv_err_cnt[1]); |
| 249 | stats->wep_icv_error[2] = |
| 250 | le32_to_cpu(get_log->wep_icv_err_cnt[2]); |
| 251 | stats->wep_icv_error[3] = |
| 252 | le32_to_cpu(get_log->wep_icv_err_cnt[3]); |
| 253 | } |
| 254 | |
| 255 | return 0; |
| 256 | } |
| 257 | |
| 258 | /* |
| 259 | * This function handles the command response of set/get Tx rate |
| 260 | * configurations. |
| 261 | * |
| 262 | * Handling includes changing the header fields into CPU format |
| 263 | * and saving the following parameters in driver - |
| 264 | * - DSSS rate bitmap |
| 265 | * - OFDM rate bitmap |
| 266 | * - HT MCS rate bitmaps |
| 267 | * |
| 268 | * Based on the new rate bitmaps, the function re-evaluates if |
| 269 | * auto data rate has been activated. If not, it sends another |
Amitkumar Karwar | 006606c | 2012-07-13 20:09:31 -0700 | [diff] [blame] | 270 | * query to the firmware to get the current Tx data rate. |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 271 | */ |
| 272 | static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, |
Amitkumar Karwar | 006606c | 2012-07-13 20:09:31 -0700 | [diff] [blame] | 273 | struct host_cmd_ds_command *resp) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 274 | { |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 275 | struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg; |
| 276 | struct mwifiex_rate_scope *rate_scope; |
Yogesh Ashok Powar | 270e58e | 2011-05-03 20:11:46 -0700 | [diff] [blame] | 277 | struct mwifiex_ie_types_header *head; |
Amitkumar Karwar | 2636c30 | 2013-10-22 15:24:45 -0700 | [diff] [blame] | 278 | u16 tlv, tlv_buf_len, tlv_buf_left; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 279 | u8 *tlv_buf; |
| 280 | u32 i; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 281 | |
Amitkumar Karwar | 2636c30 | 2013-10-22 15:24:45 -0700 | [diff] [blame] | 282 | tlv_buf = ((u8 *)rate_cfg) + sizeof(struct host_cmd_ds_tx_rate_cfg); |
| 283 | tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*rate_cfg); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 284 | |
Amitkumar Karwar | 2636c30 | 2013-10-22 15:24:45 -0700 | [diff] [blame] | 285 | while (tlv_buf_left >= sizeof(*head)) { |
| 286 | head = (struct mwifiex_ie_types_header *)tlv_buf; |
| 287 | tlv = le16_to_cpu(head->type); |
| 288 | tlv_buf_len = le16_to_cpu(head->len); |
| 289 | |
| 290 | if (tlv_buf_left < (sizeof(*head) + tlv_buf_len)) |
| 291 | break; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 292 | |
| 293 | switch (tlv) { |
| 294 | case TLV_TYPE_RATE_SCOPE: |
| 295 | rate_scope = (struct mwifiex_rate_scope *) tlv_buf; |
| 296 | priv->bitmap_rates[0] = |
| 297 | le16_to_cpu(rate_scope->hr_dsss_rate_bitmap); |
| 298 | priv->bitmap_rates[1] = |
| 299 | le16_to_cpu(rate_scope->ofdm_rate_bitmap); |
| 300 | for (i = 0; |
| 301 | i < |
| 302 | sizeof(rate_scope->ht_mcs_rate_bitmap) / |
| 303 | sizeof(u16); i++) |
| 304 | priv->bitmap_rates[2 + i] = |
| 305 | le16_to_cpu(rate_scope-> |
| 306 | ht_mcs_rate_bitmap[i]); |
| 307 | break; |
| 308 | /* Add RATE_DROP tlv here */ |
| 309 | } |
| 310 | |
Amitkumar Karwar | 2636c30 | 2013-10-22 15:24:45 -0700 | [diff] [blame] | 311 | tlv_buf += (sizeof(*head) + tlv_buf_len); |
| 312 | tlv_buf_left -= (sizeof(*head) + tlv_buf_len); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 313 | } |
| 314 | |
| 315 | priv->is_data_rate_auto = mwifiex_is_rate_auto(priv); |
| 316 | |
| 317 | if (priv->is_data_rate_auto) |
| 318 | priv->data_rate = 0; |
| 319 | else |
Amitkumar Karwar | 006606c | 2012-07-13 20:09:31 -0700 | [diff] [blame] | 320 | return mwifiex_send_cmd_async(priv, |
| 321 | HostCmd_CMD_802_11_TX_RATE_QUERY, |
| 322 | HostCmd_ACT_GEN_GET, 0, NULL); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 323 | |
Amitkumar Karwar | 006606c | 2012-07-13 20:09:31 -0700 | [diff] [blame] | 324 | return 0; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | /* |
| 328 | * This function handles the command response of get Tx power level. |
| 329 | * |
| 330 | * Handling includes saving the maximum and minimum Tx power levels |
| 331 | * in driver, as well as sending the values to user. |
| 332 | */ |
| 333 | static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf) |
| 334 | { |
Yogesh Ashok Powar | 270e58e | 2011-05-03 20:11:46 -0700 | [diff] [blame] | 335 | int length, max_power = -1, min_power = -1; |
| 336 | struct mwifiex_types_power_group *pg_tlv_hdr; |
| 337 | struct mwifiex_power_group *pg; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 338 | |
Yogesh Ashok Powar | bb7de2b | 2012-03-12 19:35:12 -0700 | [diff] [blame] | 339 | if (!data_buf) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 340 | return -1; |
Yogesh Ashok Powar | bb7de2b | 2012-03-12 19:35:12 -0700 | [diff] [blame] | 341 | |
Amitkumar Karwar | d8d13d3 | 2013-10-22 15:24:47 -0700 | [diff] [blame] | 342 | pg_tlv_hdr = (struct mwifiex_types_power_group *)((u8 *)data_buf); |
Yogesh Ashok Powar | bb7de2b | 2012-03-12 19:35:12 -0700 | [diff] [blame] | 343 | pg = (struct mwifiex_power_group *) |
| 344 | ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group)); |
Amitkumar Karwar | 930fd35 | 2013-10-22 15:24:43 -0700 | [diff] [blame] | 345 | length = le16_to_cpu(pg_tlv_hdr->length); |
Amitkumar Karwar | fe1c9a4 | 2013-10-22 15:24:44 -0700 | [diff] [blame] | 346 | |
| 347 | /* At least one structure required to update power */ |
| 348 | if (length < sizeof(struct mwifiex_power_group)) |
| 349 | return 0; |
| 350 | |
| 351 | max_power = pg->power_max; |
| 352 | min_power = pg->power_min; |
| 353 | length -= sizeof(struct mwifiex_power_group); |
| 354 | |
| 355 | while (length >= sizeof(struct mwifiex_power_group)) { |
Yogesh Ashok Powar | bb7de2b | 2012-03-12 19:35:12 -0700 | [diff] [blame] | 356 | pg++; |
| 357 | if (max_power < pg->power_max) |
| 358 | max_power = pg->power_max; |
| 359 | |
| 360 | if (min_power > pg->power_min) |
| 361 | min_power = pg->power_min; |
| 362 | |
| 363 | length -= sizeof(struct mwifiex_power_group); |
| 364 | } |
Amitkumar Karwar | fe1c9a4 | 2013-10-22 15:24:44 -0700 | [diff] [blame] | 365 | priv->min_tx_power_level = (u8) min_power; |
| 366 | priv->max_tx_power_level = (u8) max_power; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 367 | |
| 368 | return 0; |
| 369 | } |
| 370 | |
| 371 | /* |
| 372 | * This function handles the command response of set/get Tx power |
| 373 | * configurations. |
| 374 | * |
| 375 | * Handling includes changing the header fields into CPU format |
| 376 | * and saving the current Tx power level in driver. |
| 377 | */ |
| 378 | static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, |
Amitkumar Karwar | a5ffddb | 2011-06-20 15:21:48 -0700 | [diff] [blame] | 379 | struct host_cmd_ds_command *resp) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 380 | { |
| 381 | struct mwifiex_adapter *adapter = priv->adapter; |
| 382 | struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg; |
Yogesh Ashok Powar | 270e58e | 2011-05-03 20:11:46 -0700 | [diff] [blame] | 383 | struct mwifiex_types_power_group *pg_tlv_hdr; |
| 384 | struct mwifiex_power_group *pg; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 385 | u16 action = le16_to_cpu(txp_cfg->action); |
Amitkumar Karwar | d8d13d3 | 2013-10-22 15:24:47 -0700 | [diff] [blame] | 386 | u16 tlv_buf_left; |
| 387 | |
| 388 | pg_tlv_hdr = (struct mwifiex_types_power_group *) |
| 389 | ((u8 *)txp_cfg + |
| 390 | sizeof(struct host_cmd_ds_txpwr_cfg)); |
| 391 | |
| 392 | pg = (struct mwifiex_power_group *) |
| 393 | ((u8 *)pg_tlv_hdr + |
| 394 | sizeof(struct mwifiex_types_power_group)); |
| 395 | |
| 396 | tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*txp_cfg); |
| 397 | if (tlv_buf_left < |
| 398 | le16_to_cpu(pg_tlv_hdr->length) + sizeof(*pg_tlv_hdr)) |
| 399 | return 0; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 400 | |
| 401 | switch (action) { |
| 402 | case HostCmd_ACT_GEN_GET: |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 403 | if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) |
Amitkumar Karwar | d8d13d3 | 2013-10-22 15:24:47 -0700 | [diff] [blame] | 404 | mwifiex_get_power_level(priv, pg_tlv_hdr); |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 405 | |
| 406 | priv->tx_power_level = (u16) pg->power_min; |
| 407 | break; |
| 408 | |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 409 | case HostCmd_ACT_GEN_SET: |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 410 | if (!le32_to_cpu(txp_cfg->mode)) |
| 411 | break; |
| 412 | |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 413 | if (pg->power_max == pg->power_min) |
| 414 | priv->tx_power_level = (u16) pg->power_min; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 415 | break; |
| 416 | default: |
| 417 | dev_err(adapter->dev, "CMD_RESP: unknown cmd action %d\n", |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 418 | action); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 419 | return 0; |
| 420 | } |
| 421 | dev_dbg(adapter->dev, |
| 422 | "info: Current TxPower Level = %d, Max Power=%d, Min Power=%d\n", |
| 423 | priv->tx_power_level, priv->max_tx_power_level, |
| 424 | priv->min_tx_power_level); |
| 425 | |
| 426 | return 0; |
| 427 | } |
| 428 | |
| 429 | /* |
Amitkumar Karwar | caa8984 | 2012-06-27 19:57:57 -0700 | [diff] [blame] | 430 | * This function handles the command response of get RF Tx power. |
| 431 | */ |
| 432 | static int mwifiex_ret_rf_tx_power(struct mwifiex_private *priv, |
| 433 | struct host_cmd_ds_command *resp) |
| 434 | { |
| 435 | struct host_cmd_ds_rf_tx_pwr *txp = &resp->params.txp; |
| 436 | u16 action = le16_to_cpu(txp->action); |
| 437 | |
| 438 | priv->tx_power_level = le16_to_cpu(txp->cur_level); |
| 439 | |
| 440 | if (action == HostCmd_ACT_GEN_GET) { |
| 441 | priv->max_tx_power_level = txp->max_power; |
| 442 | priv->min_tx_power_level = txp->min_power; |
| 443 | } |
| 444 | |
| 445 | dev_dbg(priv->adapter->dev, |
| 446 | "Current TxPower Level=%d, Max Power=%d, Min Power=%d\n", |
| 447 | priv->tx_power_level, priv->max_tx_power_level, |
| 448 | priv->min_tx_power_level); |
| 449 | |
| 450 | return 0; |
| 451 | } |
| 452 | |
| 453 | /* |
Amitkumar Karwar | 8a279d5 | 2012-07-02 19:32:33 -0700 | [diff] [blame] | 454 | * This function handles the command response of set rf antenna |
| 455 | */ |
| 456 | static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv, |
| 457 | struct host_cmd_ds_command *resp) |
| 458 | { |
| 459 | struct host_cmd_ds_rf_ant_mimo *ant_mimo = &resp->params.ant_mimo; |
| 460 | struct host_cmd_ds_rf_ant_siso *ant_siso = &resp->params.ant_siso; |
| 461 | struct mwifiex_adapter *adapter = priv->adapter; |
| 462 | |
| 463 | if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) |
| 464 | dev_dbg(adapter->dev, |
| 465 | "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x" |
| 466 | " Rx action = 0x%x, Rx Mode = 0x%04x\n", |
| 467 | le16_to_cpu(ant_mimo->action_tx), |
| 468 | le16_to_cpu(ant_mimo->tx_ant_mode), |
| 469 | le16_to_cpu(ant_mimo->action_rx), |
| 470 | le16_to_cpu(ant_mimo->rx_ant_mode)); |
| 471 | else |
| 472 | dev_dbg(adapter->dev, |
| 473 | "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n", |
| 474 | le16_to_cpu(ant_siso->action), |
| 475 | le16_to_cpu(ant_siso->ant_mode)); |
| 476 | |
| 477 | return 0; |
| 478 | } |
| 479 | |
| 480 | /* |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 481 | * This function handles the command response of set/get MAC address. |
| 482 | * |
| 483 | * Handling includes saving the MAC address in driver. |
| 484 | */ |
| 485 | static int mwifiex_ret_802_11_mac_address(struct mwifiex_private *priv, |
| 486 | struct host_cmd_ds_command *resp) |
| 487 | { |
| 488 | struct host_cmd_ds_802_11_mac_address *cmd_mac_addr = |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 489 | &resp->params.mac_addr; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 490 | |
| 491 | memcpy(priv->curr_addr, cmd_mac_addr->mac_addr, ETH_ALEN); |
| 492 | |
| 493 | dev_dbg(priv->adapter->dev, |
| 494 | "info: set mac address: %pM\n", priv->curr_addr); |
| 495 | |
| 496 | return 0; |
| 497 | } |
| 498 | |
| 499 | /* |
| 500 | * This function handles the command response of set/get MAC multicast |
| 501 | * address. |
| 502 | */ |
| 503 | static int mwifiex_ret_mac_multicast_adr(struct mwifiex_private *priv, |
| 504 | struct host_cmd_ds_command *resp) |
| 505 | { |
| 506 | return 0; |
| 507 | } |
| 508 | |
| 509 | /* |
| 510 | * This function handles the command response of get Tx rate query. |
| 511 | * |
| 512 | * Handling includes changing the header fields into CPU format |
| 513 | * and saving the Tx rate and HT information parameters in driver. |
| 514 | * |
| 515 | * Both rate configuration and current data rate can be retrieved |
| 516 | * with this request. |
| 517 | */ |
| 518 | static int mwifiex_ret_802_11_tx_rate_query(struct mwifiex_private *priv, |
| 519 | struct host_cmd_ds_command *resp) |
| 520 | { |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 521 | priv->tx_rate = resp->params.tx_rate.tx_rate; |
| 522 | priv->tx_htinfo = resp->params.tx_rate.ht_info; |
| 523 | if (!priv->is_data_rate_auto) |
| 524 | priv->data_rate = |
Bing Zhao | e3bea1c | 2011-11-16 20:40:35 -0800 | [diff] [blame] | 525 | mwifiex_index_to_data_rate(priv, priv->tx_rate, |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 526 | priv->tx_htinfo); |
| 527 | |
| 528 | return 0; |
| 529 | } |
| 530 | |
| 531 | /* |
| 532 | * This function handles the command response of a deauthenticate |
| 533 | * command. |
| 534 | * |
| 535 | * If the deauthenticated MAC matches the current BSS MAC, the connection |
| 536 | * state is reset. |
| 537 | */ |
| 538 | static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv, |
| 539 | struct host_cmd_ds_command *resp) |
| 540 | { |
| 541 | struct mwifiex_adapter *adapter = priv->adapter; |
| 542 | |
| 543 | adapter->dbg.num_cmd_deauth++; |
| 544 | if (!memcmp(resp->params.deauth.mac_addr, |
| 545 | &priv->curr_bss_params.bss_descriptor.mac_address, |
| 546 | sizeof(resp->params.deauth.mac_addr))) |
Amitkumar Karwar | 8cc1d52 | 2012-10-05 20:21:43 -0700 | [diff] [blame] | 547 | mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 548 | |
| 549 | return 0; |
| 550 | } |
| 551 | |
| 552 | /* |
| 553 | * This function handles the command response of ad-hoc stop. |
| 554 | * |
| 555 | * The function resets the connection state in driver. |
| 556 | */ |
| 557 | static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv, |
| 558 | struct host_cmd_ds_command *resp) |
| 559 | { |
Amitkumar Karwar | 8cc1d52 | 2012-10-05 20:21:43 -0700 | [diff] [blame] | 560 | mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 561 | return 0; |
| 562 | } |
| 563 | |
| 564 | /* |
| 565 | * This function handles the command response of set/get key material. |
| 566 | * |
| 567 | * Handling includes updating the driver parameters to reflect the |
| 568 | * changes. |
| 569 | */ |
| 570 | static int mwifiex_ret_802_11_key_material(struct mwifiex_private *priv, |
| 571 | struct host_cmd_ds_command *resp) |
| 572 | { |
| 573 | struct host_cmd_ds_802_11_key_material *key = |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 574 | &resp->params.key_material; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 575 | |
| 576 | if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) { |
Yogesh Ashok Powar | 6a35a0a | 2011-04-06 16:46:56 -0700 | [diff] [blame] | 577 | if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) { |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 578 | dev_dbg(priv->adapter->dev, "info: key: GTK is set\n"); |
| 579 | priv->wpa_is_gtk_set = true; |
| 580 | priv->scan_block = false; |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | memset(priv->aes_key.key_param_set.key, 0, |
| 585 | sizeof(key->key_param_set.key)); |
| 586 | priv->aes_key.key_param_set.key_len = key->key_param_set.key_len; |
| 587 | memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key, |
| 588 | le16_to_cpu(priv->aes_key.key_param_set.key_len)); |
| 589 | |
| 590 | return 0; |
| 591 | } |
| 592 | |
| 593 | /* |
| 594 | * This function handles the command response of get 11d domain information. |
| 595 | */ |
| 596 | static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv, |
| 597 | struct host_cmd_ds_command *resp) |
| 598 | { |
| 599 | struct host_cmd_ds_802_11d_domain_info_rsp *domain_info = |
| 600 | &resp->params.domain_info_resp; |
| 601 | struct mwifiex_ietypes_domain_param_set *domain = &domain_info->domain; |
| 602 | u16 action = le16_to_cpu(domain_info->action); |
Yogesh Ashok Powar | 270e58e | 2011-05-03 20:11:46 -0700 | [diff] [blame] | 603 | u8 no_of_triplet; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 604 | |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 605 | no_of_triplet = (u8) ((le16_to_cpu(domain->header.len) |
| 606 | - IEEE80211_COUNTRY_STRING_LEN) |
| 607 | / sizeof(struct ieee80211_country_ie_triplet)); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 608 | |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 609 | dev_dbg(priv->adapter->dev, |
| 610 | "info: 11D Domain Info Resp: no_of_triplet=%d\n", |
| 611 | no_of_triplet); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 612 | |
| 613 | if (no_of_triplet > MWIFIEX_MAX_TRIPLET_802_11D) { |
| 614 | dev_warn(priv->adapter->dev, |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 615 | "11D: invalid number of triplets %d returned\n", |
| 616 | no_of_triplet); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 617 | return -1; |
| 618 | } |
| 619 | |
| 620 | switch (action) { |
| 621 | case HostCmd_ACT_GEN_SET: /* Proc Set Action */ |
| 622 | break; |
| 623 | case HostCmd_ACT_GEN_GET: |
| 624 | break; |
| 625 | default: |
| 626 | dev_err(priv->adapter->dev, |
| 627 | "11D: invalid action:%d\n", domain_info->action); |
| 628 | return -1; |
| 629 | } |
| 630 | |
| 631 | return 0; |
| 632 | } |
| 633 | |
| 634 | /* |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 635 | * This function handles the command response of get extended version. |
| 636 | * |
| 637 | * Handling includes forming the extended version string and sending it |
| 638 | * to application. |
| 639 | */ |
| 640 | static int mwifiex_ret_ver_ext(struct mwifiex_private *priv, |
| 641 | struct host_cmd_ds_command *resp, |
Amitkumar Karwar | a5ffddb | 2011-06-20 15:21:48 -0700 | [diff] [blame] | 642 | struct host_cmd_ds_version_ext *version_ext) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 643 | { |
| 644 | struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 645 | |
Amitkumar Karwar | a5ffddb | 2011-06-20 15:21:48 -0700 | [diff] [blame] | 646 | if (version_ext) { |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 647 | version_ext->version_str_sel = ver_ext->version_str_sel; |
| 648 | memcpy(version_ext->version_str, ver_ext->version_str, |
| 649 | sizeof(char) * 128); |
| 650 | memcpy(priv->version_str, ver_ext->version_str, 128); |
| 651 | } |
| 652 | return 0; |
| 653 | } |
| 654 | |
| 655 | /* |
Stone Piao | 7feb4c4 | 2012-09-25 20:23:36 -0700 | [diff] [blame] | 656 | * This function handles the command response of remain on channel. |
| 657 | */ |
| 658 | static int |
| 659 | mwifiex_ret_remain_on_chan(struct mwifiex_private *priv, |
| 660 | struct host_cmd_ds_command *resp, |
| 661 | struct host_cmd_ds_remain_on_chan *roc_cfg) |
| 662 | { |
| 663 | struct host_cmd_ds_remain_on_chan *resp_cfg = &resp->params.roc_cfg; |
| 664 | |
| 665 | if (roc_cfg) |
| 666 | memcpy(roc_cfg, resp_cfg, sizeof(*roc_cfg)); |
| 667 | |
| 668 | return 0; |
| 669 | } |
| 670 | |
| 671 | /* |
Stone Piao | e1a2b7a | 2012-09-25 20:23:41 -0700 | [diff] [blame] | 672 | * This function handles the command response of P2P mode cfg. |
| 673 | */ |
| 674 | static int |
| 675 | mwifiex_ret_p2p_mode_cfg(struct mwifiex_private *priv, |
| 676 | struct host_cmd_ds_command *resp, |
| 677 | void *data_buf) |
| 678 | { |
| 679 | struct host_cmd_ds_p2p_mode_cfg *mode_cfg = &resp->params.mode_cfg; |
| 680 | |
| 681 | if (data_buf) |
| 682 | *((u16 *)data_buf) = le16_to_cpu(mode_cfg->mode); |
| 683 | |
| 684 | return 0; |
| 685 | } |
| 686 | |
| 687 | /* |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 688 | * This function handles the command response of register access. |
| 689 | * |
| 690 | * The register value and offset are returned to the user. For EEPROM |
| 691 | * access, the byte count is also returned. |
| 692 | */ |
| 693 | static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp, |
| 694 | void *data_buf) |
| 695 | { |
Yogesh Ashok Powar | 270e58e | 2011-05-03 20:11:46 -0700 | [diff] [blame] | 696 | struct mwifiex_ds_reg_rw *reg_rw; |
| 697 | struct mwifiex_ds_read_eeprom *eeprom; |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 698 | union reg { |
| 699 | struct host_cmd_ds_mac_reg_access *mac; |
| 700 | struct host_cmd_ds_bbp_reg_access *bbp; |
| 701 | struct host_cmd_ds_rf_reg_access *rf; |
| 702 | struct host_cmd_ds_pmic_reg_access *pmic; |
| 703 | struct host_cmd_ds_802_11_eeprom_access *eeprom; |
| 704 | } r; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 705 | |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 706 | if (!data_buf) |
| 707 | return 0; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 708 | |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 709 | reg_rw = data_buf; |
| 710 | eeprom = data_buf; |
| 711 | switch (type) { |
| 712 | case HostCmd_CMD_MAC_REG_ACCESS: |
Joe Perches | 2c20889 | 2012-06-04 12:44:17 +0000 | [diff] [blame] | 713 | r.mac = &resp->params.mac_reg; |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 714 | reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.mac->offset)); |
| 715 | reg_rw->value = r.mac->value; |
| 716 | break; |
| 717 | case HostCmd_CMD_BBP_REG_ACCESS: |
Joe Perches | 2c20889 | 2012-06-04 12:44:17 +0000 | [diff] [blame] | 718 | r.bbp = &resp->params.bbp_reg; |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 719 | reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.bbp->offset)); |
| 720 | reg_rw->value = cpu_to_le32((u32) r.bbp->value); |
| 721 | break; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 722 | |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 723 | case HostCmd_CMD_RF_REG_ACCESS: |
Joe Perches | 2c20889 | 2012-06-04 12:44:17 +0000 | [diff] [blame] | 724 | r.rf = &resp->params.rf_reg; |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 725 | reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset)); |
| 726 | reg_rw->value = cpu_to_le32((u32) r.bbp->value); |
| 727 | break; |
| 728 | case HostCmd_CMD_PMIC_REG_ACCESS: |
Joe Perches | 2c20889 | 2012-06-04 12:44:17 +0000 | [diff] [blame] | 729 | r.pmic = &resp->params.pmic_reg; |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 730 | reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.pmic->offset)); |
| 731 | reg_rw->value = cpu_to_le32((u32) r.pmic->value); |
| 732 | break; |
| 733 | case HostCmd_CMD_CAU_REG_ACCESS: |
Joe Perches | 2c20889 | 2012-06-04 12:44:17 +0000 | [diff] [blame] | 734 | r.rf = &resp->params.rf_reg; |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 735 | reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset)); |
| 736 | reg_rw->value = cpu_to_le32((u32) r.rf->value); |
| 737 | break; |
| 738 | case HostCmd_CMD_802_11_EEPROM_ACCESS: |
Joe Perches | 2c20889 | 2012-06-04 12:44:17 +0000 | [diff] [blame] | 739 | r.eeprom = &resp->params.eeprom; |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 740 | pr_debug("info: EEPROM read len=%x\n", r.eeprom->byte_count); |
| 741 | if (le16_to_cpu(eeprom->byte_count) < |
| 742 | le16_to_cpu(r.eeprom->byte_count)) { |
| 743 | eeprom->byte_count = cpu_to_le16(0); |
| 744 | pr_debug("info: EEPROM read length is too big\n"); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 745 | return -1; |
| 746 | } |
Yogesh Ashok Powar | 985d68a | 2012-03-12 19:35:09 -0700 | [diff] [blame] | 747 | eeprom->offset = r.eeprom->offset; |
| 748 | eeprom->byte_count = r.eeprom->byte_count; |
| 749 | if (le16_to_cpu(eeprom->byte_count) > 0) |
| 750 | memcpy(&eeprom->value, &r.eeprom->value, |
| 751 | le16_to_cpu(r.eeprom->byte_count)); |
| 752 | |
| 753 | break; |
| 754 | default: |
| 755 | return -1; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 756 | } |
| 757 | return 0; |
| 758 | } |
| 759 | |
| 760 | /* |
| 761 | * This function handles the command response of get IBSS coalescing status. |
| 762 | * |
| 763 | * If the received BSSID is different than the current one, the current BSSID, |
| 764 | * beacon interval, ATIM window and ERP information are updated, along with |
| 765 | * changing the ad-hoc state accordingly. |
| 766 | */ |
| 767 | static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv, |
| 768 | struct host_cmd_ds_command *resp) |
| 769 | { |
| 770 | struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp = |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 771 | &(resp->params.ibss_coalescing); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 772 | |
| 773 | if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET) |
| 774 | return 0; |
| 775 | |
| 776 | dev_dbg(priv->adapter->dev, |
| 777 | "info: new BSSID %pM\n", ibss_coal_resp->bssid); |
| 778 | |
| 779 | /* If rsp has NULL BSSID, Just return..... No Action */ |
Wei Yongjun | 626a43d | 2012-08-24 13:27:10 +0800 | [diff] [blame] | 780 | if (is_zero_ether_addr(ibss_coal_resp->bssid)) { |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 781 | dev_warn(priv->adapter->dev, "new BSSID is NULL\n"); |
| 782 | return 0; |
| 783 | } |
| 784 | |
| 785 | /* If BSSID is diff, modify current BSS parameters */ |
dingtianhong | fcad766 | 2013-12-26 19:41:27 +0800 | [diff] [blame] | 786 | if (!ether_addr_equal(priv->curr_bss_params.bss_descriptor.mac_address, ibss_coal_resp->bssid)) { |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 787 | /* BSSID */ |
| 788 | memcpy(priv->curr_bss_params.bss_descriptor.mac_address, |
| 789 | ibss_coal_resp->bssid, ETH_ALEN); |
| 790 | |
| 791 | /* Beacon Interval */ |
| 792 | priv->curr_bss_params.bss_descriptor.beacon_period |
| 793 | = le16_to_cpu(ibss_coal_resp->beacon_interval); |
| 794 | |
| 795 | /* ERP Information */ |
| 796 | priv->curr_bss_params.bss_descriptor.erp_flags = |
| 797 | (u8) le16_to_cpu(ibss_coal_resp->use_g_rate_protect); |
| 798 | |
| 799 | priv->adhoc_state = ADHOC_COALESCED; |
| 800 | } |
| 801 | |
| 802 | return 0; |
| 803 | } |
Avinash Patil | 429d90d | 2014-02-07 16:27:34 -0800 | [diff] [blame^] | 804 | static int mwifiex_ret_tdls_oper(struct mwifiex_private *priv, |
| 805 | struct host_cmd_ds_command *resp) |
| 806 | { |
| 807 | struct host_cmd_ds_tdls_oper *cmd_tdls_oper = &resp->params.tdls_oper; |
| 808 | u16 reason = le16_to_cpu(cmd_tdls_oper->reason); |
| 809 | u16 action = le16_to_cpu(cmd_tdls_oper->tdls_action); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 810 | |
Avinash Patil | 429d90d | 2014-02-07 16:27:34 -0800 | [diff] [blame^] | 811 | switch (action) { |
| 812 | case ACT_TDLS_DELETE: |
| 813 | if (reason) |
| 814 | dev_err(priv->adapter->dev, |
| 815 | "TDLS link delete for %pM failed: reason %d\n", |
| 816 | cmd_tdls_oper->peer_mac, reason); |
| 817 | else |
| 818 | dev_dbg(priv->adapter->dev, |
| 819 | "TDLS link config for %pM successful\n", |
| 820 | cmd_tdls_oper->peer_mac); |
| 821 | break; |
| 822 | default: |
| 823 | dev_err(priv->adapter->dev, |
| 824 | "Unknown TDLS command action respnse %d", action); |
| 825 | return -1; |
| 826 | } |
| 827 | |
| 828 | return 0; |
| 829 | } |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 830 | /* |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 831 | * This function handles the command response for subscribe event command. |
| 832 | */ |
| 833 | static int mwifiex_ret_subsc_evt(struct mwifiex_private *priv, |
Amitkumar Karwar | e69d1ff | 2012-09-10 18:30:40 -0700 | [diff] [blame] | 834 | struct host_cmd_ds_command *resp) |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 835 | { |
| 836 | struct host_cmd_ds_802_11_subsc_evt *cmd_sub_event = |
Joe Perches | 2c20889 | 2012-06-04 12:44:17 +0000 | [diff] [blame] | 837 | &resp->params.subsc_evt; |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 838 | |
| 839 | /* For every subscribe event command (Get/Set/Clear), FW reports the |
| 840 | * current set of subscribed events*/ |
| 841 | dev_dbg(priv->adapter->dev, "Bitmap of currently subscribed events: %16x\n", |
| 842 | le16_to_cpu(cmd_sub_event->events)); |
| 843 | |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 844 | return 0; |
| 845 | } |
| 846 | |
Amitkumar Karwar | 388ec38 | 2013-05-17 17:50:25 -0700 | [diff] [blame] | 847 | /* This function handles the command response of set_cfg_data */ |
| 848 | static int mwifiex_ret_cfg_data(struct mwifiex_private *priv, |
| 849 | struct host_cmd_ds_command *resp) |
| 850 | { |
| 851 | if (resp->result != HostCmd_RESULT_OK) { |
| 852 | dev_err(priv->adapter->dev, "Cal data cmd resp failed\n"); |
| 853 | return -1; |
| 854 | } |
| 855 | |
| 856 | return 0; |
| 857 | } |
| 858 | |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 859 | /* |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 860 | * This function handles the command responses. |
| 861 | * |
| 862 | * This is a generic function, which calls command specific |
| 863 | * response handlers based on the command ID. |
| 864 | */ |
Amitkumar Karwar | a5ffddb | 2011-06-20 15:21:48 -0700 | [diff] [blame] | 865 | int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, |
| 866 | struct host_cmd_ds_command *resp) |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 867 | { |
| 868 | int ret = 0; |
| 869 | struct mwifiex_adapter *adapter = priv->adapter; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 870 | void *data_buf = adapter->curr_cmd->data_buf; |
| 871 | |
| 872 | /* If the command is not successful, cleanup and return failure */ |
| 873 | if (resp->result != HostCmd_RESULT_OK) { |
Amitkumar Karwar | 600f5d9 | 2011-04-13 17:27:06 -0700 | [diff] [blame] | 874 | mwifiex_process_cmdresp_error(priv, resp); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 875 | return -1; |
| 876 | } |
| 877 | /* Command successful, handle response */ |
| 878 | switch (cmdresp_no) { |
| 879 | case HostCmd_CMD_GET_HW_SPEC: |
| 880 | ret = mwifiex_ret_get_hw_spec(priv, resp); |
| 881 | break; |
Amitkumar Karwar | 388ec38 | 2013-05-17 17:50:25 -0700 | [diff] [blame] | 882 | case HostCmd_CMD_CFG_DATA: |
| 883 | ret = mwifiex_ret_cfg_data(priv, resp); |
| 884 | break; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 885 | case HostCmd_CMD_MAC_CONTROL: |
| 886 | break; |
| 887 | case HostCmd_CMD_802_11_MAC_ADDRESS: |
| 888 | ret = mwifiex_ret_802_11_mac_address(priv, resp); |
| 889 | break; |
| 890 | case HostCmd_CMD_MAC_MULTICAST_ADR: |
| 891 | ret = mwifiex_ret_mac_multicast_adr(priv, resp); |
| 892 | break; |
| 893 | case HostCmd_CMD_TX_RATE_CFG: |
Amitkumar Karwar | 006606c | 2012-07-13 20:09:31 -0700 | [diff] [blame] | 894 | ret = mwifiex_ret_tx_rate_cfg(priv, resp); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 895 | break; |
| 896 | case HostCmd_CMD_802_11_SCAN: |
Amitkumar Karwar | 600f5d9 | 2011-04-13 17:27:06 -0700 | [diff] [blame] | 897 | ret = mwifiex_ret_802_11_scan(priv, resp); |
| 898 | adapter->curr_cmd->wait_q_enabled = false; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 899 | break; |
Amitkumar Karwar | 21f58d20 | 2014-02-11 18:39:56 -0800 | [diff] [blame] | 900 | case HostCmd_CMD_802_11_SCAN_EXT: |
| 901 | ret = mwifiex_ret_802_11_scan_ext(priv); |
| 902 | adapter->curr_cmd->wait_q_enabled = false; |
| 903 | break; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 904 | case HostCmd_CMD_802_11_BG_SCAN_QUERY: |
Amitkumar Karwar | 600f5d9 | 2011-04-13 17:27:06 -0700 | [diff] [blame] | 905 | ret = mwifiex_ret_802_11_scan(priv, resp); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 906 | dev_dbg(adapter->dev, |
| 907 | "info: CMD_RESP: BG_SCAN result is ready!\n"); |
| 908 | break; |
| 909 | case HostCmd_CMD_TXPWR_CFG: |
Amitkumar Karwar | a5ffddb | 2011-06-20 15:21:48 -0700 | [diff] [blame] | 910 | ret = mwifiex_ret_tx_power_cfg(priv, resp); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 911 | break; |
Amitkumar Karwar | caa8984 | 2012-06-27 19:57:57 -0700 | [diff] [blame] | 912 | case HostCmd_CMD_RF_TX_PWR: |
| 913 | ret = mwifiex_ret_rf_tx_power(priv, resp); |
| 914 | break; |
Amitkumar Karwar | 8a279d5 | 2012-07-02 19:32:33 -0700 | [diff] [blame] | 915 | case HostCmd_CMD_RF_ANTENNA: |
| 916 | ret = mwifiex_ret_rf_antenna(priv, resp); |
| 917 | break; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 918 | case HostCmd_CMD_802_11_PS_MODE_ENH: |
| 919 | ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf); |
| 920 | break; |
| 921 | case HostCmd_CMD_802_11_HS_CFG_ENH: |
| 922 | ret = mwifiex_ret_802_11_hs_cfg(priv, resp); |
| 923 | break; |
| 924 | case HostCmd_CMD_802_11_ASSOCIATE: |
Amitkumar Karwar | 600f5d9 | 2011-04-13 17:27:06 -0700 | [diff] [blame] | 925 | ret = mwifiex_ret_802_11_associate(priv, resp); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 926 | break; |
| 927 | case HostCmd_CMD_802_11_DEAUTHENTICATE: |
| 928 | ret = mwifiex_ret_802_11_deauthenticate(priv, resp); |
| 929 | break; |
| 930 | case HostCmd_CMD_802_11_AD_HOC_START: |
| 931 | case HostCmd_CMD_802_11_AD_HOC_JOIN: |
Amitkumar Karwar | 600f5d9 | 2011-04-13 17:27:06 -0700 | [diff] [blame] | 932 | ret = mwifiex_ret_802_11_ad_hoc(priv, resp); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 933 | break; |
| 934 | case HostCmd_CMD_802_11_AD_HOC_STOP: |
| 935 | ret = mwifiex_ret_802_11_ad_hoc_stop(priv, resp); |
| 936 | break; |
| 937 | case HostCmd_CMD_802_11_GET_LOG: |
| 938 | ret = mwifiex_ret_get_log(priv, resp, data_buf); |
| 939 | break; |
| 940 | case HostCmd_CMD_RSSI_INFO: |
Amitkumar Karwar | 958a4a8 | 2012-03-15 20:51:49 -0700 | [diff] [blame] | 941 | ret = mwifiex_ret_802_11_rssi_info(priv, resp); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 942 | break; |
| 943 | case HostCmd_CMD_802_11_SNMP_MIB: |
| 944 | ret = mwifiex_ret_802_11_snmp_mib(priv, resp, data_buf); |
| 945 | break; |
| 946 | case HostCmd_CMD_802_11_TX_RATE_QUERY: |
| 947 | ret = mwifiex_ret_802_11_tx_rate_query(priv, resp); |
| 948 | break; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 949 | case HostCmd_CMD_VERSION_EXT: |
| 950 | ret = mwifiex_ret_ver_ext(priv, resp, data_buf); |
| 951 | break; |
Stone Piao | 7feb4c4 | 2012-09-25 20:23:36 -0700 | [diff] [blame] | 952 | case HostCmd_CMD_REMAIN_ON_CHAN: |
| 953 | ret = mwifiex_ret_remain_on_chan(priv, resp, data_buf); |
| 954 | break; |
Yogesh Ashok Powar | 83c78da | 2013-03-18 20:06:03 -0700 | [diff] [blame] | 955 | case HostCmd_CMD_11AC_CFG: |
| 956 | break; |
Stone Piao | e1a2b7a | 2012-09-25 20:23:41 -0700 | [diff] [blame] | 957 | case HostCmd_CMD_P2P_MODE_CFG: |
| 958 | ret = mwifiex_ret_p2p_mode_cfg(priv, resp, data_buf); |
| 959 | break; |
Stone Piao | 3cec687 | 2012-09-25 20:23:34 -0700 | [diff] [blame] | 960 | case HostCmd_CMD_MGMT_FRAME_REG: |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 961 | case HostCmd_CMD_FUNC_INIT: |
| 962 | case HostCmd_CMD_FUNC_SHUTDOWN: |
| 963 | break; |
| 964 | case HostCmd_CMD_802_11_KEY_MATERIAL: |
| 965 | ret = mwifiex_ret_802_11_key_material(priv, resp); |
| 966 | break; |
| 967 | case HostCmd_CMD_802_11D_DOMAIN_INFO: |
| 968 | ret = mwifiex_ret_802_11d_domain_info(priv, resp); |
| 969 | break; |
| 970 | case HostCmd_CMD_11N_ADDBA_REQ: |
| 971 | ret = mwifiex_ret_11n_addba_req(priv, resp); |
| 972 | break; |
| 973 | case HostCmd_CMD_11N_DELBA: |
| 974 | ret = mwifiex_ret_11n_delba(priv, resp); |
| 975 | break; |
| 976 | case HostCmd_CMD_11N_ADDBA_RSP: |
| 977 | ret = mwifiex_ret_11n_addba_resp(priv, resp); |
| 978 | break; |
| 979 | case HostCmd_CMD_RECONFIGURE_TX_BUFF: |
| 980 | adapter->tx_buf_size = (u16) le16_to_cpu(resp->params. |
| 981 | tx_buf.buff_size); |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 982 | adapter->tx_buf_size = (adapter->tx_buf_size |
| 983 | / MWIFIEX_SDIO_BLOCK_SIZE) |
| 984 | * MWIFIEX_SDIO_BLOCK_SIZE; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 985 | adapter->curr_tx_buf_size = adapter->tx_buf_size; |
Bing Zhao | 5e3175f | 2013-01-30 19:56:02 -0800 | [diff] [blame] | 986 | dev_dbg(adapter->dev, "cmd: curr_tx_buf_size=%d\n", |
| 987 | adapter->curr_tx_buf_size); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 988 | |
| 989 | if (adapter->if_ops.update_mp_end_port) |
| 990 | adapter->if_ops.update_mp_end_port(adapter, |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 991 | le16_to_cpu(resp->params.tx_buf.mp_end_port)); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 992 | break; |
| 993 | case HostCmd_CMD_AMSDU_AGGR_CTRL: |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 994 | break; |
| 995 | case HostCmd_CMD_WMM_GET_STATUS: |
| 996 | ret = mwifiex_ret_wmm_get_status(priv, resp); |
| 997 | break; |
| 998 | case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS: |
| 999 | ret = mwifiex_ret_ibss_coalescing_status(priv, resp); |
| 1000 | break; |
| 1001 | case HostCmd_CMD_MAC_REG_ACCESS: |
| 1002 | case HostCmd_CMD_BBP_REG_ACCESS: |
| 1003 | case HostCmd_CMD_RF_REG_ACCESS: |
| 1004 | case HostCmd_CMD_PMIC_REG_ACCESS: |
| 1005 | case HostCmd_CMD_CAU_REG_ACCESS: |
| 1006 | case HostCmd_CMD_802_11_EEPROM_ACCESS: |
| 1007 | ret = mwifiex_ret_reg_access(cmdresp_no, resp, data_buf); |
| 1008 | break; |
| 1009 | case HostCmd_CMD_SET_BSS_MODE: |
| 1010 | break; |
| 1011 | case HostCmd_CMD_11N_CFG: |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 1012 | break; |
Amitkumar Karwar | d930fae | 2011-10-11 17:41:21 -0700 | [diff] [blame] | 1013 | case HostCmd_CMD_PCIE_DESC_DETAILS: |
| 1014 | break; |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 1015 | case HostCmd_CMD_802_11_SUBSCRIBE_EVENT: |
Amitkumar Karwar | e69d1ff | 2012-09-10 18:30:40 -0700 | [diff] [blame] | 1016 | ret = mwifiex_ret_subsc_evt(priv, resp); |
Amitkumar Karwar | fa444bf | 2012-03-15 20:51:51 -0700 | [diff] [blame] | 1017 | break; |
Avinash Patil | 40d0703 | 2012-05-08 18:30:19 -0700 | [diff] [blame] | 1018 | case HostCmd_CMD_UAP_SYS_CONFIG: |
| 1019 | break; |
| 1020 | case HostCmd_CMD_UAP_BSS_START: |
| 1021 | priv->bss_started = 1; |
| 1022 | break; |
| 1023 | case HostCmd_CMD_UAP_BSS_STOP: |
| 1024 | priv->bss_started = 0; |
| 1025 | break; |
Avinash Patil | 0f9e9b8 | 2013-05-17 17:50:23 -0700 | [diff] [blame] | 1026 | case HostCmd_CMD_UAP_STA_DEAUTH: |
| 1027 | break; |
Amitkumar Karwar | 7da060c | 2013-03-04 16:27:59 -0800 | [diff] [blame] | 1028 | case HostCmd_CMD_MEF_CFG: |
| 1029 | break; |
Amitkumar Karwar | 562fc5b | 2013-08-05 18:52:00 -0700 | [diff] [blame] | 1030 | case HostCmd_CMD_COALESCE_CFG: |
| 1031 | break; |
Avinash Patil | 429d90d | 2014-02-07 16:27:34 -0800 | [diff] [blame^] | 1032 | case HostCmd_CMD_TDLS_OPER: |
| 1033 | ret = mwifiex_ret_tdls_oper(priv, resp); |
| 1034 | break; |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 1035 | default: |
| 1036 | dev_err(adapter->dev, "CMD_RESP: unknown cmd response %#x\n", |
Yogesh Ashok Powar | 9c05fd7 | 2012-03-13 19:22:40 -0700 | [diff] [blame] | 1037 | resp->command); |
Bing Zhao | 5e6e3a9 | 2011-03-21 18:00:50 -0700 | [diff] [blame] | 1038 | break; |
| 1039 | } |
| 1040 | |
| 1041 | return ret; |
| 1042 | } |