Commit 7bff9c97 authored by Stone Piao's avatar Stone Piao Committed by John W. Linville

mwifiex: send firmware initialization commands synchronously

The driver will send some commands to firmware during the
initialization. Currently these commands are sent asynchronously,
which means that we firstly insert all of them to a pre-allocated
command queue, and then start to process them one by one. The
command queue will soon be exhausted if we keep adding new
initialization commands.

This issue can be resolved by sending initialization commands
synchronously because each command is consumed and the buffer is
recycled before queuing next command.
Signed-off-by: default avatarStone Piao <piaoyun@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ea021f56
...@@ -1302,25 +1302,25 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) ...@@ -1302,25 +1302,25 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
if (first_sta) { if (first_sta) {
if (priv->adapter->iface_type == MWIFIEX_PCIE) { if (priv->adapter->iface_type == MWIFIEX_PCIE) {
ret = mwifiex_send_cmd_async(priv, ret = mwifiex_send_cmd_sync(priv,
HostCmd_CMD_PCIE_DESC_DETAILS, HostCmd_CMD_PCIE_DESC_DETAILS,
HostCmd_ACT_GEN_SET, 0, NULL); HostCmd_ACT_GEN_SET, 0, NULL);
if (ret) if (ret)
return -1; return -1;
} }
ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_FUNC_INIT, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_FUNC_INIT,
HostCmd_ACT_GEN_SET, 0, NULL); HostCmd_ACT_GEN_SET, 0, NULL);
if (ret) if (ret)
return -1; return -1;
/* Read MAC address from HW */ /* Read MAC address from HW */
ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_GET_HW_SPEC, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_GET_HW_SPEC,
HostCmd_ACT_GEN_GET, 0, NULL); HostCmd_ACT_GEN_GET, 0, NULL);
if (ret) if (ret)
return -1; return -1;
/* Reconfigure tx buf size */ /* Reconfigure tx buf size */
ret = mwifiex_send_cmd_async(priv, ret = mwifiex_send_cmd_sync(priv,
HostCmd_CMD_RECONFIGURE_TX_BUFF, HostCmd_CMD_RECONFIGURE_TX_BUFF,
HostCmd_ACT_GEN_SET, 0, HostCmd_ACT_GEN_SET, 0,
&priv->adapter->tx_buf_size); &priv->adapter->tx_buf_size);
...@@ -1330,7 +1330,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) ...@@ -1330,7 +1330,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) { if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
/* Enable IEEE PS by default */ /* Enable IEEE PS by default */
priv->adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; priv->adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP;
ret = mwifiex_send_cmd_async( ret = mwifiex_send_cmd_sync(
priv, HostCmd_CMD_802_11_PS_MODE_ENH, priv, HostCmd_CMD_802_11_PS_MODE_ENH,
EN_AUTO_PS, BITMAP_STA_PS, NULL); EN_AUTO_PS, BITMAP_STA_PS, NULL);
if (ret) if (ret)
...@@ -1339,21 +1339,21 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) ...@@ -1339,21 +1339,21 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
} }
/* get tx rate */ /* get tx rate */
ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_TX_RATE_CFG, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_TX_RATE_CFG,
HostCmd_ACT_GEN_GET, 0, NULL); HostCmd_ACT_GEN_GET, 0, NULL);
if (ret) if (ret)
return -1; return -1;
priv->data_rate = 0; priv->data_rate = 0;
/* get tx power */ /* get tx power */
ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_RF_TX_PWR, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_RF_TX_PWR,
HostCmd_ACT_GEN_GET, 0, NULL); HostCmd_ACT_GEN_GET, 0, NULL);
if (ret) if (ret)
return -1; return -1;
if (priv->bss_type == MWIFIEX_BSS_TYPE_STA) { if (priv->bss_type == MWIFIEX_BSS_TYPE_STA) {
/* set ibss coalescing_status */ /* set ibss coalescing_status */
ret = mwifiex_send_cmd_async( ret = mwifiex_send_cmd_sync(
priv, HostCmd_CMD_802_11_IBSS_COALESCING_STATUS, priv, HostCmd_CMD_802_11_IBSS_COALESCING_STATUS,
HostCmd_ACT_GEN_SET, 0, &enable); HostCmd_ACT_GEN_SET, 0, &enable);
if (ret) if (ret)
...@@ -1363,14 +1363,14 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) ...@@ -1363,14 +1363,14 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
memset(&amsdu_aggr_ctrl, 0, sizeof(amsdu_aggr_ctrl)); memset(&amsdu_aggr_ctrl, 0, sizeof(amsdu_aggr_ctrl));
amsdu_aggr_ctrl.enable = true; amsdu_aggr_ctrl.enable = true;
/* Send request to firmware */ /* Send request to firmware */
ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_AMSDU_AGGR_CTRL, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_AMSDU_AGGR_CTRL,
HostCmd_ACT_GEN_SET, 0, HostCmd_ACT_GEN_SET, 0,
&amsdu_aggr_ctrl); &amsdu_aggr_ctrl);
if (ret) if (ret)
return -1; return -1;
/* MAC Control must be the last command in init_fw */ /* MAC Control must be the last command in init_fw */
/* set MAC Control */ /* set MAC Control */
ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_MAC_CONTROL,
HostCmd_ACT_GEN_SET, 0, HostCmd_ACT_GEN_SET, 0,
&priv->curr_pkt_filter); &priv->curr_pkt_filter);
if (ret) if (ret)
...@@ -1381,7 +1381,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) ...@@ -1381,7 +1381,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
/* Enable auto deep sleep */ /* Enable auto deep sleep */
auto_ds.auto_ds = DEEP_SLEEP_ON; auto_ds.auto_ds = DEEP_SLEEP_ON;
auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME; auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME;
ret = mwifiex_send_cmd_async(priv, ret = mwifiex_send_cmd_sync(priv,
HostCmd_CMD_802_11_PS_MODE_ENH, HostCmd_CMD_802_11_PS_MODE_ENH,
EN_AUTO_PS, BITMAP_AUTO_DS, EN_AUTO_PS, BITMAP_AUTO_DS,
&auto_ds); &auto_ds);
...@@ -1392,7 +1392,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) ...@@ -1392,7 +1392,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) { if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
/* Send cmd to FW to enable/disable 11D function */ /* Send cmd to FW to enable/disable 11D function */
state_11d = ENABLE_11D; state_11d = ENABLE_11D;
ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11_SNMP_MIB, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
HostCmd_ACT_GEN_SET, DOT11D_I, HostCmd_ACT_GEN_SET, DOT11D_I,
&state_11d); &state_11d);
if (ret) if (ret)
...@@ -1400,15 +1400,16 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) ...@@ -1400,15 +1400,16 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
"11D: failed to enable 11D\n"); "11D: failed to enable 11D\n");
} }
/* set last_init_cmd before sending the command */
priv->adapter->last_init_cmd = HostCmd_CMD_11N_CFG;
/* Send cmd to FW to configure 11n specific configuration /* Send cmd to FW to configure 11n specific configuration
* (Short GI, Channel BW, Green field support etc.) for transmit * (Short GI, Channel BW, Green field support etc.) for transmit
*/ */
tx_cfg.tx_htcap = MWIFIEX_FW_DEF_HTTXCFG; tx_cfg.tx_htcap = MWIFIEX_FW_DEF_HTTXCFG;
ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_CFG, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_11N_CFG,
HostCmd_ACT_GEN_SET, 0, &tx_cfg); HostCmd_ACT_GEN_SET, 0, &tx_cfg);
/* set last_init_cmd */
priv->adapter->last_init_cmd = HostCmd_CMD_11N_CFG;
ret = -EINPROGRESS; ret = -EINPROGRESS;
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment