/* * This function handles the command response error case. * * For scan response error, the function cancels all the pending * scan commands and generates an event to inform the applications * of the scan completion. * * For Power Save command failure, we do not retry enter PS * command in case of Ad-hoc mode. * * For all other response errors, the current command buffer is freed * and returned to the free command queue.
*/ staticvoid
mwifiex_process_cmdresp_error(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{ struct mwifiex_adapter *adapter = priv->adapter; struct host_cmd_ds_802_11_ps_mode_enh *pm;
/* * This function handles the command response of get RSSI info. * * Handling includes changing the header fields into CPU format * and saving the following parameters in driver - * - Last data and beacon RSSI value * - Average data and beacon RSSI value * - Last data and beacon NF value * - Average data and beacon NF value * * The parameters are send to the application as well, along with * calculated SNR values.
*/ staticint mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{ struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp =
&resp->params.rssi_info_rsp; struct mwifiex_ds_misc_subsc_evt *subsc_evt =
&priv->async_subsc_evt_storage;
/* * This function handles the command response of set/get SNMP * MIB parameters. * * Handling includes changing the header fields into CPU format * and saving the parameter in driver. * * The following parameters are supported - * - Fragmentation threshold * - RTS threshold * - Short retry limit
*/ staticint mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv, struct host_cmd_ds_command *resp,
u32 *data_buf)
{ struct host_cmd_ds_802_11_snmp_mib *smib = &resp->params.smib;
u16 oid = le16_to_cpu(smib->oid);
u16 query_type = le16_to_cpu(smib->query_type);
u32 ul_temp;
mwifiex_dbg(priv->adapter, INFO, "info: SNMP_RESP: oid value = %#x,\t" "query_type = %#x, buf size = %#x\n",
oid, query_type, le16_to_cpu(smib->buf_size)); if (query_type == HostCmd_ACT_GEN_GET) {
ul_temp = get_unaligned_le16(smib->value); if (data_buf)
*data_buf = ul_temp; switch (oid) { case FRAG_THRESH_I:
mwifiex_dbg(priv->adapter, INFO, "info: SNMP_RESP: FragThsd =%u\n",
ul_temp); break; case RTS_THRESH_I:
mwifiex_dbg(priv->adapter, INFO, "info: SNMP_RESP: RTSThsd =%u\n",
ul_temp); break; case SHORT_RETRY_LIM_I:
mwifiex_dbg(priv->adapter, INFO, "info: SNMP_RESP: TxRetryCount=%u\n",
ul_temp); break; case DTIM_PERIOD_I:
mwifiex_dbg(priv->adapter, INFO, "info: SNMP_RESP: DTIM period=%u\n",
ul_temp); break; default: break;
}
}
return 0;
}
/* * This function handles the command response of get log request * * Handling includes changing the header fields into CPU format * and sending the received parameters to application.
*/ staticint mwifiex_ret_get_log(struct mwifiex_private *priv, struct host_cmd_ds_command *resp, struct mwifiex_ds_get_stats *stats)
{ struct host_cmd_ds_802_11_get_log *get_log =
&resp->params.get_log;
/* * This function handles the command response of set/get Tx rate * configurations. * * Handling includes changing the header fields into CPU format * and saving the following parameters in driver - * - DSSS rate bitmap * - OFDM rate bitmap * - HT MCS rate bitmaps * * Based on the new rate bitmaps, the function re-evaluates if * auto data rate has been activated. If not, it sends another * query to the firmware to get the current Tx data rate.
*/ staticint mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{ struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg; struct mwifiex_rate_scope *rate_scope; struct mwifiex_ie_types_header *head;
u16 tlv, tlv_buf_len, tlv_buf_left;
u8 *tlv_buf;
u32 i;
/* * This function handles the command response of get Tx power level. * * Handling includes saving the maximum and minimum Tx power levels * in driver, as well as sending the values to user.
*/ staticint mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)
{ int length, max_power = -1, min_power = -1; struct mwifiex_types_power_group *pg_tlv_hdr; struct mwifiex_power_group *pg;
/* * This function handles the command response of set/get Tx power * configurations. * * Handling includes changing the header fields into CPU format * and saving the current Tx power level in driver.
*/ staticint mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{ struct mwifiex_adapter *adapter = priv->adapter; struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg; struct mwifiex_types_power_group *pg_tlv_hdr; struct mwifiex_power_group *pg;
u16 action = le16_to_cpu(txp_cfg->action);
u16 tlv_buf_left;
/* * This function handles the command response of set/get MAC address. * * Handling includes saving the MAC address in driver.
*/ staticint mwifiex_ret_802_11_mac_address(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{ struct host_cmd_ds_802_11_mac_address *cmd_mac_addr =
&resp->params.mac_addr;
mwifiex_dbg(priv->adapter, INFO, "info: set mac address: %pM\n", priv->curr_addr);
return 0;
}
/* * This function handles the command response of set/get MAC multicast * address.
*/ staticint mwifiex_ret_mac_multicast_adr(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{ return 0;
}
/* * This function handles the command response of get Tx rate query. * * Handling includes changing the header fields into CPU format * and saving the Tx rate and HT information parameters in driver. * * Both rate configuration and current data rate can be retrieved * with this request.
*/ staticint mwifiex_ret_802_11_tx_rate_query(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{
priv->tx_rate = resp->params.tx_rate.tx_rate;
priv->tx_htinfo = resp->params.tx_rate.ht_info; if (!priv->is_data_rate_auto)
priv->data_rate =
mwifiex_index_to_data_rate(priv, priv->tx_rate,
priv->tx_htinfo);
return 0;
}
/* * This function handles the command response of a deauthenticate * command. * * If the deauthenticated MAC matches the current BSS MAC, the connection * state is reset.
*/ staticint mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{ struct mwifiex_adapter *adapter = priv->adapter;
adapter->dbg.num_cmd_deauth++; if (!memcmp(resp->params.deauth.mac_addr,
&priv->curr_bss_params.bss_descriptor.mac_address, sizeof(resp->params.deauth.mac_addr)))
mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING, false);
return 0;
}
/* * This function handles the command response of ad-hoc stop. * * The function resets the connection state in driver.
*/ staticint mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{
mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING, false); return 0;
}
/* * This function handles the command response of set/get v1 key material. * * Handling includes updating the driver parameters to reflect the * changes.
*/ staticint mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{ struct host_cmd_ds_802_11_key_material *key =
&resp->params.key_material; int len;
len = le16_to_cpu(key->key_param_set.key_len); if (len > sizeof(key->key_param_set.key)) return -EINVAL;
if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) { if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) {
mwifiex_dbg(priv->adapter, INFO, "info: key: GTK is set\n");
priv->wpa_is_gtk_set = true;
priv->scan_block = false;
priv->port_open = true;
}
}
/* * This function handles the command response of set/get v2 key material. * * Handling includes updating the driver parameters to reflect the * changes.
*/ staticint mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{ struct host_cmd_ds_802_11_key_material_v2 *key_v2; int len;
key_v2 = &resp->params.key_material_v2;
len = le16_to_cpu(key_v2->key_param_set.key_params.aes.key_len); if (len > sizeof(key_v2->key_param_set.key_params.aes.key)) return -EINVAL;
if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) { if ((le16_to_cpu(key_v2->key_param_set.key_info) & KEY_MCAST)) {
mwifiex_dbg(priv->adapter, INFO, "info: key: GTK is set\n");
priv->wpa_is_gtk_set = true;
priv->scan_block = false;
priv->port_open = true;
}
}
if (key_v2->key_param_set.key_type != KEY_TYPE_ID_AES) return 0;
mwifiex_dbg(priv->adapter, INFO, "info: 11D Domain Info Resp: no_of_triplet=%d\n",
no_of_triplet);
if (no_of_triplet > MWIFIEX_MAX_TRIPLET_802_11D) {
mwifiex_dbg(priv->adapter, FATAL, "11D: invalid number of triplets %d returned\n",
no_of_triplet); return -1;
}
switch (action) { case HostCmd_ACT_GEN_SET: /* Proc Set Action */ break; case HostCmd_ACT_GEN_GET: break; default:
mwifiex_dbg(priv->adapter, ERROR, "11D: invalid action:%d\n", domain_info->action); return -1;
}
return 0;
}
/* * This function handles the command response of get extended version. * * Handling includes forming the extended version string and sending it * to application.
*/ staticint mwifiex_ret_ver_ext(struct mwifiex_private *priv, struct host_cmd_ds_command *resp, struct host_cmd_ds_version_ext *version_ext)
{ struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext;
return 0;
} /* * This function handles the command response of register access. * * The register value and offset are returned to the user. For EEPROM * access, the byte count is also returned.
*/ staticint mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp, void *data_buf)
{ struct mwifiex_ds_reg_rw *reg_rw; struct mwifiex_ds_read_eeprom *eeprom; union reg { struct host_cmd_ds_mac_reg_access *mac; struct host_cmd_ds_bbp_reg_access *bbp; struct host_cmd_ds_rf_reg_access *rf; struct host_cmd_ds_pmic_reg_access *pmic; struct host_cmd_ds_802_11_eeprom_access *eeprom;
} r;
/* * This function handles the command response of get IBSS coalescing status. * * If the received BSSID is different than the current one, the current BSSID, * beacon interval, ATIM window and ERP information are updated, along with * changing the ad-hoc state accordingly.
*/ staticint mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{ struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp =
&(resp->params.ibss_coalescing);
if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET) return 0;
mwifiex_dbg(priv->adapter, INFO, "info: new BSSID %pM\n", ibss_coal_resp->bssid);
/* If rsp has NULL BSSID, Just return..... No Action */ if (is_zero_ether_addr(ibss_coal_resp->bssid)) {
mwifiex_dbg(priv->adapter, FATAL, "new BSSID is NULL\n"); return 0;
}
/* If BSSID is diff, modify current BSS parameters */ if (!ether_addr_equal(priv->curr_bss_params.bss_descriptor.mac_address, ibss_coal_resp->bssid)) { /* BSSID */
memcpy(priv->curr_bss_params.bss_descriptor.mac_address,
ibss_coal_resp->bssid, ETH_ALEN);
switch (action) { case ACT_TDLS_DELETE: if (reason) { if (!node || reason == TDLS_ERR_LINK_NONEXISTENT)
mwifiex_dbg(priv->adapter, MSG, "TDLS link delete for %pM failed: reason %d\n",
cmd_tdls_oper->peer_mac, reason); else
mwifiex_dbg(priv->adapter, ERROR, "TDLS link delete for %pM failed: reason %d\n",
cmd_tdls_oper->peer_mac, reason);
} else {
mwifiex_dbg(priv->adapter, MSG, "TDLS link delete for %pM successful\n",
cmd_tdls_oper->peer_mac);
} break; case ACT_TDLS_CREATE: if (reason) {
mwifiex_dbg(priv->adapter, ERROR, "TDLS link creation for %pM failed: reason %d",
cmd_tdls_oper->peer_mac, reason); if (node && reason != TDLS_ERR_LINK_EXISTS)
node->tdls_status = TDLS_SETUP_FAILURE;
} else {
mwifiex_dbg(priv->adapter, MSG, "TDLS link creation for %pM successful",
cmd_tdls_oper->peer_mac);
} break; case ACT_TDLS_CONFIG: if (reason) {
mwifiex_dbg(priv->adapter, ERROR, "TDLS link config for %pM failed, reason %d\n",
cmd_tdls_oper->peer_mac, reason); if (node)
node->tdls_status = TDLS_SETUP_FAILURE;
} else {
mwifiex_dbg(priv->adapter, MSG, "TDLS link config for %pM successful\n",
cmd_tdls_oper->peer_mac);
} break; default:
mwifiex_dbg(priv->adapter, ERROR, "Unknown TDLS command action response %d", action); return -1;
}
return 0;
} /* * This function handles the command response for subscribe event command.
*/ staticint mwifiex_ret_subsc_evt(struct mwifiex_private *priv, struct host_cmd_ds_command *resp)
{ struct host_cmd_ds_802_11_subsc_evt *cmd_sub_event =
&resp->params.subsc_evt;
/* For every subscribe event command (Get/Set/Clear), FW reports the
* current set of subscribed events*/
mwifiex_dbg(priv->adapter, EVENT, "Bitmap of currently subscribed events: %16x\n",
le16_to_cpu(cmd_sub_event->events));
/* * This function handles the command responses. * * This is a generic function, which calls command specific * response handlers based on the command ID.
*/ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, struct host_cmd_ds_command *resp)
{ int ret = 0; struct mwifiex_adapter *adapter = priv->adapter; void *data_buf = adapter->curr_cmd->data_buf;
/* If the command is not successful, cleanup and return failure */ if (resp->result != HostCmd_RESULT_OK) {
mwifiex_process_cmdresp_error(priv, resp); return -1;
} /* Command successful, handle response */ switch (cmdresp_no) { case HostCmd_CMD_GET_HW_SPEC:
ret = mwifiex_ret_get_hw_spec(priv, resp); break; case HostCmd_CMD_CFG_DATA:
ret = mwifiex_ret_cfg_data(priv, resp); break; case HostCmd_CMD_MAC_CONTROL: break; case HostCmd_CMD_802_11_MAC_ADDRESS:
ret = mwifiex_ret_802_11_mac_address(priv, resp); break; case HostCmd_CMD_MAC_MULTICAST_ADR:
ret = mwifiex_ret_mac_multicast_adr(priv, resp); break; case HostCmd_CMD_TX_RATE_CFG:
ret = mwifiex_ret_tx_rate_cfg(priv, resp); break; case HostCmd_CMD_802_11_SCAN:
ret = mwifiex_ret_802_11_scan(priv, resp);
adapter->curr_cmd->wait_q_enabled = false; break; case HostCmd_CMD_802_11_SCAN_EXT:
ret = mwifiex_ret_802_11_scan_ext(priv, resp);
adapter->curr_cmd->wait_q_enabled = false; break; case HostCmd_CMD_802_11_BG_SCAN_QUERY:
ret = mwifiex_ret_802_11_scan(priv, resp);
cfg80211_sched_scan_results(priv->wdev.wiphy, 0);
mwifiex_dbg(adapter, CMD, "info: CMD_RESP: BG_SCAN result is ready!\n"); break; case HostCmd_CMD_802_11_BG_SCAN_CONFIG: break; case HostCmd_CMD_TXPWR_CFG:
ret = mwifiex_ret_tx_power_cfg(priv, resp); break; case HostCmd_CMD_RF_TX_PWR:
ret = mwifiex_ret_rf_tx_power(priv, resp); break; case HostCmd_CMD_RF_ANTENNA:
ret = mwifiex_ret_rf_antenna(priv, resp); break; case HostCmd_CMD_802_11_PS_MODE_ENH:
ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf); break; case HostCmd_CMD_802_11_HS_CFG_ENH:
ret = mwifiex_ret_802_11_hs_cfg(priv, resp); break; case HostCmd_CMD_802_11_ASSOCIATE:
ret = mwifiex_ret_802_11_associate(priv, resp); break; case HostCmd_CMD_802_11_DEAUTHENTICATE:
ret = mwifiex_ret_802_11_deauthenticate(priv, resp); break; case HostCmd_CMD_802_11_AD_HOC_START: case HostCmd_CMD_802_11_AD_HOC_JOIN:
ret = mwifiex_ret_802_11_ad_hoc(priv, resp); break; case HostCmd_CMD_802_11_AD_HOC_STOP:
ret = mwifiex_ret_802_11_ad_hoc_stop(priv, resp); break; case HostCmd_CMD_802_11_GET_LOG:
ret = mwifiex_ret_get_log(priv, resp, data_buf); break; case HostCmd_CMD_RSSI_INFO:
ret = mwifiex_ret_802_11_rssi_info(priv, resp); break; case HostCmd_CMD_802_11_SNMP_MIB:
ret = mwifiex_ret_802_11_snmp_mib(priv, resp, data_buf); break; case HostCmd_CMD_802_11_TX_RATE_QUERY:
ret = mwifiex_ret_802_11_tx_rate_query(priv, resp); break; case HostCmd_CMD_VERSION_EXT:
ret = mwifiex_ret_ver_ext(priv, resp, data_buf); break; case HostCmd_CMD_REMAIN_ON_CHAN:
ret = mwifiex_ret_remain_on_chan(priv, resp, data_buf); break; case HostCmd_CMD_11AC_CFG: break; case HostCmd_CMD_PACKET_AGGR_CTRL:
ret = mwifiex_ret_pkt_aggr_ctrl(priv, resp); break; case HostCmd_CMD_P2P_MODE_CFG:
ret = mwifiex_ret_p2p_mode_cfg(priv, resp, data_buf); break; case HostCmd_CMD_MGMT_FRAME_REG: case HostCmd_CMD_FUNC_INIT: case HostCmd_CMD_FUNC_SHUTDOWN: break; case HostCmd_CMD_802_11_KEY_MATERIAL:
ret = mwifiex_ret_802_11_key_material(priv, resp); break; case HostCmd_CMD_802_11D_DOMAIN_INFO:
ret = mwifiex_ret_802_11d_domain_info(priv, resp); break; case HostCmd_CMD_11N_ADDBA_REQ:
ret = mwifiex_ret_11n_addba_req(priv, resp); break; case HostCmd_CMD_11N_DELBA:
ret = mwifiex_ret_11n_delba(priv, resp); break; case HostCmd_CMD_11N_ADDBA_RSP:
ret = mwifiex_ret_11n_addba_resp(priv, resp); break; case HostCmd_CMD_RECONFIGURE_TX_BUFF: if (0xffff == (u16)le16_to_cpu(resp->params.tx_buf.buff_size)) { if (adapter->iface_type == MWIFIEX_USB &&
adapter->usb_mc_setup) { if (adapter->if_ops.multi_port_resync)
adapter->if_ops.
multi_port_resync(adapter);
adapter->usb_mc_setup = false;
adapter->tx_lock_flag = false;
} break;
}
adapter->tx_buf_size = (u16) le16_to_cpu(resp->params.
tx_buf.buff_size);
adapter->tx_buf_size = (adapter->tx_buf_size
/ MWIFIEX_SDIO_BLOCK_SIZE)
* MWIFIEX_SDIO_BLOCK_SIZE;
adapter->curr_tx_buf_size = adapter->tx_buf_size;
mwifiex_dbg(adapter, CMD, "cmd: curr_tx_buf_size=%d\n",
adapter->curr_tx_buf_size);
if (adapter->if_ops.update_mp_end_port)
adapter->if_ops.update_mp_end_port(adapter,
le16_to_cpu(resp->params.tx_buf.mp_end_port)); break; case HostCmd_CMD_AMSDU_AGGR_CTRL: break; case HostCmd_CMD_WMM_GET_STATUS:
ret = mwifiex_ret_wmm_get_status(priv, resp); break; case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS:
ret = mwifiex_ret_ibss_coalescing_status(priv, resp); break; case HostCmd_CMD_MEM_ACCESS:
ret = mwifiex_ret_mem_access(priv, resp, data_buf); break; case HostCmd_CMD_MAC_REG_ACCESS: case HostCmd_CMD_BBP_REG_ACCESS: case HostCmd_CMD_RF_REG_ACCESS: case HostCmd_CMD_PMIC_REG_ACCESS: case HostCmd_CMD_CAU_REG_ACCESS: case HostCmd_CMD_802_11_EEPROM_ACCESS:
ret = mwifiex_ret_reg_access(cmdresp_no, resp, data_buf); break; case HostCmd_CMD_SET_BSS_MODE: break; case HostCmd_CMD_11N_CFG: break; case HostCmd_CMD_PCIE_DESC_DETAILS: break; case HostCmd_CMD_802_11_SUBSCRIBE_EVENT:
ret = mwifiex_ret_subsc_evt(priv, resp); break; case HostCmd_CMD_UAP_SYS_CONFIG: break; case HOST_CMD_APCMD_STA_LIST:
ret = mwifiex_ret_uap_sta_list(priv, resp); break; case HostCmd_CMD_UAP_BSS_START:
adapter->tx_lock_flag = false;
adapter->pps_uapsd_mode = false;
adapter->delay_null_pkt = false;
priv->bss_started = 1; break; case HostCmd_CMD_UAP_BSS_STOP:
priv->bss_started = 0; break; case HostCmd_CMD_UAP_STA_DEAUTH: break; case HostCmd_CMD_ADD_NEW_STATION: break; case HOST_CMD_APCMD_SYS_RESET: break; case HostCmd_CMD_MEF_CFG: break; case HostCmd_CMD_COALESCE_CFG: break; case HostCmd_CMD_TDLS_OPER:
ret = mwifiex_ret_tdls_oper(priv, resp); break; case HostCmd_CMD_MC_POLICY: break; case HostCmd_CMD_CHAN_REPORT_REQUEST: break; case HostCmd_CMD_SDIO_SP_RX_AGGR_CFG:
ret = mwifiex_ret_sdio_rx_aggr_cfg(priv, resp); break; case HostCmd_CMD_HS_WAKEUP_REASON:
ret = mwifiex_ret_wakeup_reason(priv, resp, data_buf); break; case HostCmd_CMD_TDLS_CONFIG: break; case HostCmd_CMD_ROBUST_COEX:
ret = mwifiex_ret_robust_coex(priv, resp, data_buf); break; case HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG: break; case HostCmd_CMD_CHAN_REGION_CFG:
ret = mwifiex_ret_chan_region_cfg(priv, resp); break; case HostCmd_CMD_STA_CONFIGURE:
ret = mwifiex_ret_get_chan_info(priv, resp, data_buf); break; default:
mwifiex_dbg(adapter, ERROR, "CMD_RESP: unknown cmd response %#x\n",
resp->command); break;
}
return ret;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.40 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.