Commit 600f5d90 authored by Amitkumar Karwar's avatar Amitkumar Karwar Committed by John W. Linville

mwifiex: cleanup ioctl wait queue and abstraction layer

1) remove mwifiex_alloc_fill_wait_queue() and
mwifiex_request_ioctl()
2) avoid dynamic allocation of wait queue
3) remove unnecessary mwifiex_error_code macros that
were used mainly by the wait queue status code
4) remove some abstraction functions
5) split mwifiex_prepare_cmd() to mwifiex_send_cmd_async()
and mwifiex_send_sync() to handle asynchronous and
synchronous commands respectively
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3a9dddea
...@@ -541,9 +541,8 @@ mwifiex_cfg_tx_buf(struct mwifiex_private *priv, ...@@ -541,9 +541,8 @@ mwifiex_cfg_tx_buf(struct mwifiex_private *priv,
else if (priv->adapter->curr_tx_buf_size <= MWIFIEX_TX_DATA_BUF_SIZE_8K) else if (priv->adapter->curr_tx_buf_size <= MWIFIEX_TX_DATA_BUF_SIZE_8K)
curr_tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_8K; curr_tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_8K;
if (curr_tx_buf_size != tx_buf) if (curr_tx_buf_size != tx_buf)
mwifiex_prepare_cmd(priv, HostCmd_CMD_RECONFIGURE_TX_BUFF, mwifiex_send_cmd_async(priv, HostCmd_CMD_RECONFIGURE_TX_BUFF,
HostCmd_ACT_GEN_SET, 0, HostCmd_ACT_GEN_SET, 0, &tx_buf);
NULL, &tx_buf);
return; return;
} }
...@@ -694,8 +693,8 @@ int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac) ...@@ -694,8 +693,8 @@ int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac)
memcpy(&add_ba_req.peer_mac_addr, peer_mac, ETH_ALEN); memcpy(&add_ba_req.peer_mac_addr, peer_mac, ETH_ALEN);
/* We don't wait for the response of this command */ /* We don't wait for the response of this command */
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_11N_ADDBA_REQ, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_ADDBA_REQ,
0, 0, NULL, &add_ba_req); 0, 0, &add_ba_req);
return ret; return ret;
} }
...@@ -722,8 +721,8 @@ int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac, ...@@ -722,8 +721,8 @@ int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac,
memcpy(&delba.peer_mac_addr, peer_mac, ETH_ALEN); memcpy(&delba.peer_mac_addr, peer_mac, ETH_ALEN);
/* We don't wait for the response of this command */ /* We don't wait for the response of this command */
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_11N_DELBA, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_DELBA,
HostCmd_ACT_GEN_SET, 0, NULL, &delba); HostCmd_ACT_GEN_SET, 0, &delba);
return ret; return ret;
} }
......
...@@ -609,7 +609,7 @@ void mwifiex_11n_ba_stream_timeout(struct mwifiex_private *priv, ...@@ -609,7 +609,7 @@ void mwifiex_11n_ba_stream_timeout(struct mwifiex_private *priv,
delba.del_ba_param_set |= cpu_to_le16( delba.del_ba_param_set |= cpu_to_le16(
(u16) event->origninator << DELBA_INITIATOR_POS); (u16) event->origninator << DELBA_INITIATOR_POS);
delba.reason_code = cpu_to_le16(WLAN_REASON_QSTA_TIMEOUT); delba.reason_code = cpu_to_le16(WLAN_REASON_QSTA_TIMEOUT);
mwifiex_prepare_cmd(priv, HostCmd_CMD_11N_DELBA, 0, 0, NULL, &delba); mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_DELBA, 0, 0, &delba);
return; return;
} }
......
...@@ -157,7 +157,7 @@ info ...@@ -157,7 +157,7 @@ info
mp_wr_bitmap = <SDIO multi-port write bitmap> mp_wr_bitmap = <SDIO multi-port write bitmap>
cmd_resp_received = <0/1, no cmd response to process/response received and yet to process> cmd_resp_received = <0/1, no cmd response to process/response received and yet to process>
event_received = <0/1, no event to process/event received and yet to process> event_received = <0/1, no event to process/event received and yet to process>
ioctl_pending = <number of ioctl pending> cmd_pending = <number of cmd pending>
tx_pending = <number of Tx packet pending> tx_pending = <number of Tx packet pending>
rx_pending = <number of Rx packet pending> rx_pending = <number of Rx packet pending>
......
...@@ -139,8 +139,16 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy, ...@@ -139,8 +139,16 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy,
{ {
int ret = 0; int ret = 0;
struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
struct mwifiex_power_cfg power_cfg;
ret = mwifiex_set_tx_power(priv, type, dbm); if (type == NL80211_TX_POWER_FIXED) {
power_cfg.is_power_auto = 0;
power_cfg.power_level = dbm;
} else {
power_cfg.is_power_auto = 1;
}
ret = mwifiex_set_tx_power(priv, &power_cfg);
return ret; return ret;
} }
...@@ -157,13 +165,15 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy, ...@@ -157,13 +165,15 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
{ {
int ret = 0; int ret = 0;
struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
u32 ps_mode;
if (timeout) if (timeout)
wiphy_dbg(wiphy, wiphy_dbg(wiphy,
"info: ignoring the timeout value" "info: ignoring the timeout value"
" for IEEE power save\n"); " for IEEE power save\n");
ret = mwifiex_drv_set_power(priv, enabled); ps_mode = enabled;
ret = mwifiex_drv_set_power(priv, &ps_mode);
return ret; return ret;
} }
...@@ -291,8 +301,8 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy) ...@@ -291,8 +301,8 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
domain_info->no_of_triplet = no_of_triplet; domain_info->no_of_triplet = no_of_triplet;
/* Send cmd to FW to set domain info */ /* Send cmd to FW to set domain info */
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11D_DOMAIN_INFO, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO,
HostCmd_ACT_GEN_SET, 0, NULL, NULL); HostCmd_ACT_GEN_SET, 0, NULL);
if (ret) if (ret)
wiphy_err(wiphy, "11D: setting domain info in FW\n"); wiphy_err(wiphy, "11D: setting domain info in FW\n");
...@@ -347,7 +357,6 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv, ...@@ -347,7 +357,6 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
{ {
struct mwifiex_chan_freq_power cfp; struct mwifiex_chan_freq_power cfp;
int ret = 0; int ret = 0;
int status = 0;
struct mwifiex_ds_band_cfg band_cfg; struct mwifiex_ds_band_cfg band_cfg;
u32 config_bands = 0; u32 config_bands = 0;
struct wiphy *wiphy = priv->wdev->wiphy; struct wiphy *wiphy = priv->wdev->wiphy;
...@@ -370,10 +379,9 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv, ...@@ -370,10 +379,9 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
band_cfg.sec_chan_offset = band_cfg.sec_chan_offset =
mwifiex_cfg80211_channel_type_to_mwifiex_channels mwifiex_cfg80211_channel_type_to_mwifiex_channels
(channel_type); (channel_type);
status = mwifiex_radio_ioctl_band_cfg(priv, HostCmd_ACT_GEN_SET, ret = mwifiex_set_radio_band_cfg(priv, &band_cfg);
&band_cfg);
if (status) if (ret)
return -EFAULT; return -EFAULT;
mwifiex_send_domain_info_cmd_fw(wiphy); mwifiex_send_domain_info_cmd_fw(wiphy);
} }
...@@ -389,8 +397,8 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv, ...@@ -389,8 +397,8 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
/* Convert frequency to channel */ /* Convert frequency to channel */
cfp.channel = ieee80211_frequency_to_channel(chan->center_freq); cfp.channel = ieee80211_frequency_to_channel(chan->center_freq);
status = mwifiex_bss_ioctl_channel(priv, HostCmd_ACT_GEN_SET, &cfp); ret = mwifiex_bss_set_channel(priv, &cfp);
if (status) if (ret)
return -EFAULT; return -EFAULT;
ret = mwifiex_drv_change_adhoc_chan(priv, cfp.channel); ret = mwifiex_drv_change_adhoc_chan(priv, cfp.channel);
...@@ -422,66 +430,45 @@ mwifiex_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev, ...@@ -422,66 +430,45 @@ mwifiex_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
/* /*
* This function sets the fragmentation threshold. * This function sets the fragmentation threshold.
* *
* This function creates an IOCTL request, populates it accordingly * The fragmentation threshold value must lie between MWIFIEX_FRAG_MIN_VALUE
* and issues an IOCTL.
*
* The fragmentation threshold value must lies between MWIFIEX_FRAG_MIN_VALUE
* and MWIFIEX_FRAG_MAX_VALUE. * and MWIFIEX_FRAG_MAX_VALUE.
*/ */
static int static int
mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr) mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr)
{ {
int ret = 0; int ret = 0;
int status = 0;
struct mwifiex_wait_queue *wait = NULL;
u8 wait_option = MWIFIEX_IOCTL_WAIT;
if (frag_thr < MWIFIEX_FRAG_MIN_VALUE if (frag_thr < MWIFIEX_FRAG_MIN_VALUE
|| frag_thr > MWIFIEX_FRAG_MAX_VALUE) || frag_thr > MWIFIEX_FRAG_MAX_VALUE)
return -EINVAL; return -EINVAL;
wait = mwifiex_alloc_fill_wait_queue(priv, wait_option); /* Send request to firmware */
if (!wait) ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
return -ENOMEM; HostCmd_ACT_GEN_SET, FRAG_THRESH_I,
&frag_thr);
status = mwifiex_snmp_mib_ioctl(priv, wait, FRAG_THRESH_I,
HostCmd_ACT_GEN_SET, &frag_thr);
if (mwifiex_request_ioctl(priv, wait, status, wait_option))
ret = -EFAULT;
kfree(wait);
return ret; return ret;
} }
/* /*
* This function sets the RTS threshold. * This function sets the RTS threshold.
*
* This function creates an IOCTL request, populates it accordingly * The rts value must lie between MWIFIEX_RTS_MIN_VALUE
* and issues an IOCTL. * and MWIFIEX_RTS_MAX_VALUE.
*/ */
static int static int
mwifiex_set_rts(struct mwifiex_private *priv, u32 rts_thr) mwifiex_set_rts(struct mwifiex_private *priv, u32 rts_thr)
{ {
int ret = 0; int ret = 0;
struct mwifiex_wait_queue *wait = NULL;
int status = 0;
u8 wait_option = MWIFIEX_IOCTL_WAIT;
if (rts_thr < MWIFIEX_RTS_MIN_VALUE || rts_thr > MWIFIEX_RTS_MAX_VALUE) if (rts_thr < MWIFIEX_RTS_MIN_VALUE || rts_thr > MWIFIEX_RTS_MAX_VALUE)
rts_thr = MWIFIEX_RTS_MAX_VALUE; rts_thr = MWIFIEX_RTS_MAX_VALUE;
wait = mwifiex_alloc_fill_wait_queue(priv, wait_option); /* Send request to firmware */
if (!wait) ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
return -ENOMEM; HostCmd_ACT_GEN_SET, RTS_THRESH_I,
&rts_thr);
status = mwifiex_snmp_mib_ioctl(priv, wait, RTS_THRESH_I,
HostCmd_ACT_GEN_SET, &rts_thr);
if (mwifiex_request_ioctl(priv, wait, status, wait_option))
ret = -EFAULT;
kfree(wait);
return ret; return ret;
} }
...@@ -518,7 +505,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, ...@@ -518,7 +505,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
{ {
int ret = 0; int ret = 0;
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
struct mwifiex_wait_queue *wait = NULL;
if (priv->bss_mode == type) { if (priv->bss_mode == type) {
wiphy_warn(wiphy, "already set to required type\n"); wiphy_warn(wiphy, "already set to required type\n");
...@@ -545,24 +531,13 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, ...@@ -545,24 +531,13 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
return -EINVAL; return -EINVAL;
} }
wait = mwifiex_alloc_fill_wait_queue(priv, MWIFIEX_IOCTL_WAIT); mwifiex_deauthenticate(priv, NULL);
if (!wait)
return -ENOMEM;
mwifiex_deauthenticate(priv, wait, NULL);
priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM;
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_SET_BSS_MODE, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_SET_BSS_MODE,
HostCmd_ACT_GEN_SET, 0, wait, NULL); HostCmd_ACT_GEN_SET, 0, NULL);
if (!ret)
ret = -EINPROGRESS;
ret = mwifiex_request_ioctl(priv, wait, ret, MWIFIEX_IOCTL_WAIT);
if (ret)
ret = -EFAULT;
kfree(wait);
return ret; return ret;
} }
...@@ -592,7 +567,7 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, ...@@ -592,7 +567,7 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
/* Get signal information from the firmware */ /* Get signal information from the firmware */
memset(&signal, 0, sizeof(struct mwifiex_ds_get_signal)); memset(&signal, 0, sizeof(struct mwifiex_ds_get_signal));
if (mwifiex_get_signal_info(priv, MWIFIEX_IOCTL_WAIT, &signal)) { if (mwifiex_get_signal_info(priv, &signal)) {
dev_err(priv->adapter->dev, "getting signal information\n"); dev_err(priv->adapter->dev, "getting signal information\n");
ret = -EFAULT; ret = -EFAULT;
} }
...@@ -750,7 +725,7 @@ mwifiex_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, ...@@ -750,7 +725,7 @@ mwifiex_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
return -EBUSY; return -EBUSY;
priv->disconnect = 1; priv->disconnect = 1;
if (mwifiex_disconnect(priv, MWIFIEX_IOCTL_WAIT, NULL)) if (mwifiex_deauthenticate(priv, NULL))
return -EFAULT; return -EFAULT;
wiphy_dbg(wiphy, "info: successfully disconnected from %pM:" wiphy_dbg(wiphy, "info: successfully disconnected from %pM:"
...@@ -838,8 +813,8 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv, ...@@ -838,8 +813,8 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv,
u8 element_id, element_len; u8 element_id, element_len;
memset(&scan_resp, 0, sizeof(scan_resp)); memset(&scan_resp, 0, sizeof(scan_resp));
if (mwifiex_get_scan_table(priv, MWIFIEX_IOCTL_WAIT, &scan_resp)) scan_resp.scan_table = (u8 *) priv->adapter->scan_table;
return -EFAULT; scan_resp.num_in_scan_table = priv->adapter->num_in_scan_table;
#define MAX_IE_BUF 2048 #define MAX_IE_BUF 2048
ie_buf = kzalloc(MAX_IE_BUF, GFP_KERNEL); ie_buf = kzalloc(MAX_IE_BUF, GFP_KERNEL);
...@@ -986,7 +961,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, ...@@ -986,7 +961,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
} }
/* disconnect before try to associate */ /* disconnect before try to associate */
mwifiex_disconnect(priv, MWIFIEX_IOCTL_WAIT, NULL); mwifiex_deauthenticate(priv, NULL);
if (channel) if (channel)
ret = mwifiex_set_rf_channel(priv, channel, ret = mwifiex_set_rf_channel(priv, channel,
...@@ -1046,7 +1021,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, ...@@ -1046,7 +1021,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
} }
done: done:
/* Do specific SSID scanning */ /* Do specific SSID scanning */
if (mwifiex_request_scan(priv, MWIFIEX_IOCTL_WAIT, &req_ssid)) { if (mwifiex_request_scan(priv, &req_ssid)) {
dev_err(priv->adapter->dev, "scan error\n"); dev_err(priv->adapter->dev, "scan error\n");
return -EFAULT; return -EFAULT;
} }
...@@ -1055,8 +1030,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, ...@@ -1055,8 +1030,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
memcpy(&ssid_bssid.ssid, &req_ssid, sizeof(struct mwifiex_802_11_ssid)); memcpy(&ssid_bssid.ssid, &req_ssid, sizeof(struct mwifiex_802_11_ssid));
if (mode != NL80211_IFTYPE_ADHOC) { if (mode != NL80211_IFTYPE_ADHOC) {
if (mwifiex_find_best_bss(priv, MWIFIEX_IOCTL_WAIT, if (mwifiex_find_best_bss(priv, &ssid_bssid))
&ssid_bssid))
return -EFAULT; return -EFAULT;
/* Inform the BSS information to kernel, otherwise /* Inform the BSS information to kernel, otherwise
* kernel will give a panic after successful assoc */ * kernel will give a panic after successful assoc */
...@@ -1072,7 +1046,10 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, ...@@ -1072,7 +1046,10 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
/* Connect to BSS by ESSID */ /* Connect to BSS by ESSID */
memset(&ssid_bssid.bssid, 0, ETH_ALEN); memset(&ssid_bssid.bssid, 0, ETH_ALEN);
if (mwifiex_bss_start(priv, MWIFIEX_IOCTL_WAIT, &ssid_bssid)) if (!netif_queue_stopped(priv->netdev))
netif_stop_queue(priv->netdev);
if (mwifiex_bss_start(priv, &ssid_bssid))
return -EFAULT; return -EFAULT;
if (mode == NL80211_IFTYPE_ADHOC) { if (mode == NL80211_IFTYPE_ADHOC) {
...@@ -1176,7 +1153,7 @@ mwifiex_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) ...@@ -1176,7 +1153,7 @@ mwifiex_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
wiphy_dbg(wiphy, "info: disconnecting from essid %pM\n", wiphy_dbg(wiphy, "info: disconnecting from essid %pM\n",
priv->cfg_bssid); priv->cfg_bssid);
if (mwifiex_disconnect(priv, MWIFIEX_IOCTL_WAIT, NULL)) if (mwifiex_deauthenticate(priv, NULL))
return -EFAULT; return -EFAULT;
queue_work(priv->workqueue, &priv->cfg_workqueue); queue_work(priv->workqueue, &priv->cfg_workqueue);
......
This diff is collapsed.
...@@ -129,8 +129,8 @@ static struct mwifiex_debug_data items[] = { ...@@ -129,8 +129,8 @@ static struct mwifiex_debug_data items[] = {
item_addr(event_received), 1}, item_addr(event_received), 1},
/* variables defined in struct mwifiex_adapter */ /* variables defined in struct mwifiex_adapter */
{"ioctl_pending", adapter_item_size(ioctl_pending), {"cmd_pending", adapter_item_size(cmd_pending),
adapter_item_addr(ioctl_pending), 1}, adapter_item_addr(cmd_pending), 1},
{"tx_pending", adapter_item_size(tx_pending), {"tx_pending", adapter_item_size(tx_pending),
adapter_item_addr(tx_pending), 1}, adapter_item_addr(tx_pending), 1},
{"rx_pending", adapter_item_size(rx_pending), {"rx_pending", adapter_item_size(rx_pending),
......
...@@ -61,23 +61,6 @@ ...@@ -61,23 +61,6 @@
#define MWIFIEX_BUF_FLAG_REQUEUED_PKT BIT(0) #define MWIFIEX_BUF_FLAG_REQUEUED_PKT BIT(0)
enum mwifiex_error_code {
MWIFIEX_ERROR_NO_ERROR = 0,
MWIFIEX_ERROR_FW_NOT_READY = 0x00000001,
MWIFIEX_ERROR_FW_BUSY,
MWIFIEX_ERROR_FW_CMDRESP,
MWIFIEX_ERROR_PKT_SIZE_INVALID = 0x80000001,
MWIFIEX_ERROR_PKT_TIMEOUT,
MWIFIEX_ERROR_CMD_INVALID,
MWIFIEX_ERROR_CMD_TIMEOUT,
MWIFIEX_ERROR_CMD_DNLD_FAIL,
MWIFIEX_ERROR_CMD_CANCEL,
MWIFIEX_ERROR_CMD_RESP_FAIL,
MWIFIEX_ERROR_ASSOC_FAIL,
MWIFIEX_ERROR_EVENT_UNKNOWN,
MWIFIEX_ERROR_INVALID_PARAMETER,
};
enum mwifiex_bss_type { enum mwifiex_bss_type {
MWIFIEX_BSS_TYPE_STA = 0, MWIFIEX_BSS_TYPE_STA = 0,
MWIFIEX_BSS_TYPE_UAP = 1, MWIFIEX_BSS_TYPE_UAP = 1,
...@@ -112,12 +95,9 @@ struct mwifiex_802_11_ssid { ...@@ -112,12 +95,9 @@ struct mwifiex_802_11_ssid {
}; };
struct mwifiex_wait_queue { struct mwifiex_wait_queue {
u32 bss_index; wait_queue_head_t wait;
wait_queue_head_t *wait; u16 condition;
u16 *condition;
u32 start_time;
int status; int status;
u32 enabled;
}; };
struct mwifiex_rxinfo { struct mwifiex_rxinfo {
......
...@@ -35,7 +35,6 @@ static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv) ...@@ -35,7 +35,6 @@ static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv)
{ {
struct mwifiex_adapter *adapter = priv->adapter; struct mwifiex_adapter *adapter = priv->adapter;
struct mwifiex_bss_prio_node *bss_prio; struct mwifiex_bss_prio_node *bss_prio;
int status = 0;
unsigned long flags; unsigned long flags;
bss_prio = kzalloc(sizeof(struct mwifiex_bss_prio_node), GFP_KERNEL); bss_prio = kzalloc(sizeof(struct mwifiex_bss_prio_node), GFP_KERNEL);
...@@ -59,7 +58,7 @@ static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv) ...@@ -59,7 +58,7 @@ static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv)
spin_unlock_irqrestore(&adapter->bss_prio_tbl[priv->bss_priority] spin_unlock_irqrestore(&adapter->bss_prio_tbl[priv->bss_priority]
.bss_prio_lock, flags); .bss_prio_lock, flags);
return status; return 0;
} }
/* /*
......
...@@ -590,11 +590,10 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, ...@@ -590,11 +590,10 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
* an association success (0) or failure (non-zero). * an association success (0) or failure (non-zero).
*/ */
int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
struct host_cmd_ds_command *resp, void *wq_buf) struct host_cmd_ds_command *resp)
{ {
struct mwifiex_adapter *adapter = priv->adapter;
int ret = 0; int ret = 0;
struct mwifiex_wait_queue *wait_queue =
(struct mwifiex_wait_queue *) wq_buf;
struct ieee_types_assoc_rsp *assoc_rsp; struct ieee_types_assoc_rsp *assoc_rsp;
struct mwifiex_bssdescriptor *bss_desc; struct mwifiex_bssdescriptor *bss_desc;
u8 enable_data = true; u8 enable_data = true;
...@@ -718,16 +717,11 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, ...@@ -718,16 +717,11 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
done: done:
/* Need to indicate IOCTL complete */ /* Need to indicate IOCTL complete */
if (wait_queue) { if (adapter->curr_cmd->wait_q_enabled) {
if (ret) { if (ret)
if (assoc_rsp->status_code) adapter->cmd_wait_q.status = -1;
wait_queue->status = else
le16_to_cpu(assoc_rsp->status_code); adapter->cmd_wait_q.status = 0;
else
wait_queue->status = MWIFIEX_ERROR_ASSOC_FAIL;
} else {
wait_queue->status = MWIFIEX_ERROR_NO_ERROR;
}
} }
return ret; return ret;
...@@ -885,9 +879,9 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, ...@@ -885,9 +879,9 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
mwifiex_get_active_data_rates(priv, adhoc_start->DataRate); mwifiex_get_active_data_rates(priv, adhoc_start->DataRate);
if ((adapter->adhoc_start_band & BAND_G) && if ((adapter->adhoc_start_band & BAND_G) &&
(priv->curr_pkt_filter & HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON)) { (priv->curr_pkt_filter & HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON)) {
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_MAC_CONTROL, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL,
HostCmd_ACT_GEN_SET, HostCmd_ACT_GEN_SET, 0,
0, NULL, &priv->curr_pkt_filter); &priv->curr_pkt_filter);
if (ret) { if (ret) {
dev_err(adapter->dev, dev_err(adapter->dev,
...@@ -1066,9 +1060,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, ...@@ -1066,9 +1060,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
priv-> priv->
curr_pkt_filter | HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON; curr_pkt_filter | HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON;
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_MAC_CONTROL, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL,
HostCmd_ACT_GEN_SET, 0, NULL, HostCmd_ACT_GEN_SET, 0,
&curr_pkt_filter); &curr_pkt_filter);
if (ret) { if (ret) {
dev_err(priv->adapter->dev, dev_err(priv->adapter->dev,
"ADHOC_J_CMD: G Protection config failed\n"); "ADHOC_J_CMD: G Protection config failed\n");
...@@ -1192,11 +1186,10 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, ...@@ -1192,11 +1186,10 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
* saves the beacon buffer. * saves the beacon buffer.
*/ */
int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
struct host_cmd_ds_command *resp, void *wq_buf) struct host_cmd_ds_command *resp)
{ {
int ret = 0; int ret = 0;
struct mwifiex_wait_queue *wait_queue = struct mwifiex_adapter *adapter = priv->adapter;
(struct mwifiex_wait_queue *) wq_buf;
struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result;
struct mwifiex_bssdescriptor *bss_desc; struct mwifiex_bssdescriptor *bss_desc;
u16 command = le16_to_cpu(resp->command); u16 command = le16_to_cpu(resp->command);
...@@ -1264,11 +1257,11 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, ...@@ -1264,11 +1257,11 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
done: done:
/* Need to indicate IOCTL complete */ /* Need to indicate IOCTL complete */
if (wait_queue) { if (adapter->curr_cmd->wait_q_enabled) {
if (ret) if (ret)
wait_queue->status = MWIFIEX_ERROR_ASSOC_FAIL; adapter->cmd_wait_q.status = -1;
else else
wait_queue->status = MWIFIEX_ERROR_NO_ERROR; adapter->cmd_wait_q.status = 0;
} }
...@@ -1283,7 +1276,7 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, ...@@ -1283,7 +1276,7 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
* command to firmware. * command to firmware.
*/ */
int mwifiex_associate(struct mwifiex_private *priv, int mwifiex_associate(struct mwifiex_private *priv,
void *wait_queue, struct mwifiex_bssdescriptor *bss_desc) struct mwifiex_bssdescriptor *bss_desc)
{ {
int ret = 0; int ret = 0;
u8 current_bssid[ETH_ALEN]; u8 current_bssid[ETH_ALEN];
...@@ -1301,9 +1294,8 @@ int mwifiex_associate(struct mwifiex_private *priv, ...@@ -1301,9 +1294,8 @@ int mwifiex_associate(struct mwifiex_private *priv,
retrieval */ retrieval */
priv->assoc_rsp_size = 0; priv->assoc_rsp_size = 0;
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_ASSOCIATE, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_ASSOCIATE,
HostCmd_ACT_GEN_SET, 0, wait_queue, HostCmd_ACT_GEN_SET, 0, bss_desc);
bss_desc);
return ret; return ret;
} }
...@@ -1315,7 +1307,7 @@ int mwifiex_associate(struct mwifiex_private *priv, ...@@ -1315,7 +1307,7 @@ int mwifiex_associate(struct mwifiex_private *priv,
*/ */
int int
mwifiex_adhoc_start(struct mwifiex_private *priv, mwifiex_adhoc_start(struct mwifiex_private *priv,
void *wait_queue, struct mwifiex_802_11_ssid *adhoc_ssid) struct mwifiex_802_11_ssid *adhoc_ssid)
{ {
int ret = 0; int ret = 0;
...@@ -1326,9 +1318,8 @@ mwifiex_adhoc_start(struct mwifiex_private *priv, ...@@ -1326,9 +1318,8 @@ mwifiex_adhoc_start(struct mwifiex_private *priv,
dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %d\n", dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %d\n",
priv->curr_bss_params.band); priv->curr_bss_params.band);
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_AD_HOC_START, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_START,
HostCmd_ACT_GEN_SET, 0, wait_queue, HostCmd_ACT_GEN_SET, 0, adhoc_ssid);
adhoc_ssid);
return ret; return ret;
} }
...@@ -1340,7 +1331,7 @@ mwifiex_adhoc_start(struct mwifiex_private *priv, ...@@ -1340,7 +1331,7 @@ mwifiex_adhoc_start(struct mwifiex_private *priv,
* if already not connected to the requested SSID. * if already not connected to the requested SSID.
*/ */
int mwifiex_adhoc_join(struct mwifiex_private *priv, int mwifiex_adhoc_join(struct mwifiex_private *priv,
void *wait_queue, struct mwifiex_bssdescriptor *bss_desc) struct mwifiex_bssdescriptor *bss_desc)
{ {
int ret = 0; int ret = 0;
...@@ -1369,9 +1360,8 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv, ...@@ -1369,9 +1360,8 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv,
dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %c\n", dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %c\n",
priv->curr_bss_params.band); priv->curr_bss_params.band);
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_AD_HOC_JOIN, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_JOIN,
HostCmd_ACT_GEN_SET, 0, wait_queue, HostCmd_ACT_GEN_SET, 0, bss_desc);
bss_desc);
return ret; return ret;
} }
...@@ -1380,9 +1370,7 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv, ...@@ -1380,9 +1370,7 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv,
* This function deauthenticates/disconnects from infra network by sending * This function deauthenticates/disconnects from infra network by sending
* deauthentication request. * deauthentication request.
*/ */
static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, u8 *mac)
struct mwifiex_wait_queue *wait,
u8 *mac)
{ {
u8 mac_address[ETH_ALEN]; u8 mac_address[ETH_ALEN];
int ret = 0; int ret = 0;
...@@ -1400,11 +1388,8 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, ...@@ -1400,11 +1388,8 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv,
bss_descriptor.mac_address, ETH_ALEN); bss_descriptor.mac_address, ETH_ALEN);
} }
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_DEAUTHENTICATE, ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_DEAUTHENTICATE,
HostCmd_ACT_GEN_SET, 0, wait, &mac_address); HostCmd_ACT_GEN_SET, 0, &mac_address);
if (!ret && wait)
ret = -EINPROGRESS;
return ret; return ret;
} }
...@@ -1415,26 +1400,23 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, ...@@ -1415,26 +1400,23 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv,
* In case of infra made, it sends deauthentication request, and * In case of infra made, it sends deauthentication request, and
* in case of ad-hoc mode, a stop network request is sent to the firmware. * in case of ad-hoc mode, a stop network request is sent to the firmware.
*/ */
int mwifiex_deauthenticate(struct mwifiex_private *priv, int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac)
struct mwifiex_wait_queue *wait, u8 *mac)
{ {
int ret = 0; int ret = 0;
if (priv->media_connected) { if (priv->media_connected) {
if (priv->bss_mode == NL80211_IFTYPE_STATION) { if (priv->bss_mode == NL80211_IFTYPE_STATION) {
ret = mwifiex_deauthenticate_infra(priv, wait, mac); ret = mwifiex_deauthenticate_infra(priv, mac);
} else if (priv->bss_mode == NL80211_IFTYPE_ADHOC) { } else if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
ret = mwifiex_prepare_cmd(priv, ret = mwifiex_send_cmd_sync(priv,
HostCmd_CMD_802_11_AD_HOC_STOP, HostCmd_CMD_802_11_AD_HOC_STOP,
HostCmd_ACT_GEN_SET, 0, wait, NULL); HostCmd_ACT_GEN_SET, 0, NULL);
if (!ret && wait)
ret = -EINPROGRESS;
} }
} }
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(mwifiex_deauthenticate);
/* /*
* This function converts band to radio type used in channel TLV. * This function converts band to radio type used in channel TLV.
......
...@@ -597,16 +597,23 @@ mwifiex_set_mac_address(struct net_device *dev, void *addr) ...@@ -597,16 +597,23 @@ mwifiex_set_mac_address(struct net_device *dev, void *addr)
{ {
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
struct sockaddr *hw_addr = (struct sockaddr *) addr; struct sockaddr *hw_addr = (struct sockaddr *) addr;
int ret = 0;
memcpy(priv->curr_addr, hw_addr->sa_data, ETH_ALEN); memcpy(priv->curr_addr, hw_addr->sa_data, ETH_ALEN);
if (mwifiex_request_set_mac_address(priv)) { /* Send request to firmware */
dev_err(priv->adapter->dev, "set MAC address failed\n"); ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_MAC_ADDRESS,
return -EFAULT; HostCmd_ACT_GEN_SET, 0, NULL);
}
if (!ret)
memcpy(priv->netdev->dev_addr, priv->curr_addr, ETH_ALEN);
else
dev_err(priv->adapter->dev, "set mac address failed: ret=%d"
"\n", ret);
memcpy(dev->dev_addr, priv->curr_addr, ETH_ALEN); memcpy(dev->dev_addr, priv->curr_addr, ETH_ALEN);
return 0; return ret;
} }
/* /*
...@@ -615,7 +622,20 @@ mwifiex_set_mac_address(struct net_device *dev, void *addr) ...@@ -615,7 +622,20 @@ mwifiex_set_mac_address(struct net_device *dev, void *addr)
static void mwifiex_set_multicast_list(struct net_device *dev) static void mwifiex_set_multicast_list(struct net_device *dev)
{ {
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
mwifiex_request_set_multicast_list(priv, dev); struct mwifiex_multicast_list mcast_list;
if (dev->flags & IFF_PROMISC) {
mcast_list.mode = MWIFIEX_PROMISC_MODE;
} else if (dev->flags & IFF_ALLMULTI ||
netdev_mc_count(dev) > MWIFIEX_MAX_MULTICAST_LIST_SIZE) {
mcast_list.mode = MWIFIEX_ALL_MULTI_MODE;
} else {
mcast_list.mode = MWIFIEX_MULTICAST_MODE;
if (netdev_mc_count(dev))
mcast_list.num_multicast_addr =
mwifiex_copy_mcast_addr(&mcast_list, dev);
}
mwifiex_request_set_multicast_list(priv, &mcast_list);
} }
/* /*
...@@ -677,9 +697,6 @@ mwifiex_init_priv_params(struct mwifiex_private *priv, struct net_device *dev) ...@@ -677,9 +697,6 @@ mwifiex_init_priv_params(struct mwifiex_private *priv, struct net_device *dev)
{ {
dev->netdev_ops = &mwifiex_netdev_ops; dev->netdev_ops = &mwifiex_netdev_ops;
/* Initialize private structure */ /* Initialize private structure */
init_waitqueue_head(&priv->ioctl_wait_q);
init_waitqueue_head(&priv->cmd_wait_q);
init_waitqueue_head(&priv->w_stats_wait_q);
priv->current_key_index = 0; priv->current_key_index = 0;
priv->media_connected = false; priv->media_connected = false;
memset(&priv->nick_name, 0, sizeof(priv->nick_name)); memset(&priv->nick_name, 0, sizeof(priv->nick_name));
...@@ -807,32 +824,6 @@ mwifiex_remove_interface(struct mwifiex_adapter *adapter, u8 bss_index) ...@@ -807,32 +824,6 @@ mwifiex_remove_interface(struct mwifiex_adapter *adapter, u8 bss_index)
return; return;
} }
/*
* Sends IOCTL request to shutdown firmware.
*
* This function allocates the IOCTL request buffer, fills it
* with requisite parameters and calls the IOCTL handler.
*/
int mwifiex_shutdown_fw(struct mwifiex_private *priv, u8 wait_option)
{
struct mwifiex_wait_queue *wait = NULL;
int status = 0;
/* Allocate an IOCTL request buffer */
wait = mwifiex_alloc_fill_wait_queue(priv, wait_option);
if (!wait)
return -ENOMEM;
status = mwifiex_misc_ioctl_init_shutdown(priv->adapter, wait,
MWIFIEX_FUNC_SHUTDOWN);
status = mwifiex_request_ioctl(priv, wait, status, wait_option);
kfree(wait);
return status;
}
EXPORT_SYMBOL_GPL(mwifiex_shutdown_fw);
/* /*
* This function check if command is pending. * This function check if command is pending.
*/ */
...@@ -927,6 +918,10 @@ mwifiex_add_card(void *card, struct semaphore *sem, ...@@ -927,6 +918,10 @@ mwifiex_add_card(void *card, struct semaphore *sem,
adapter->is_suspended = false; adapter->is_suspended = false;
adapter->hs_activated = false; adapter->hs_activated = false;
init_waitqueue_head(&adapter->hs_activate_wait_q); init_waitqueue_head(&adapter->hs_activate_wait_q);
adapter->cmd_wait_q_required = false;
init_waitqueue_head(&adapter->cmd_wait_q.wait);
adapter->cmd_wait_q.condition = false;
adapter->cmd_wait_q.status = 0;
/* Create workqueue */ /* Create workqueue */
adapter->workqueue = create_workqueue("MWIFIEX_WORK_QUEUE"); adapter->workqueue = create_workqueue("MWIFIEX_WORK_QUEUE");
...@@ -1038,12 +1033,12 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) ...@@ -1038,12 +1033,12 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
dev_dbg(adapter->dev, "cmd: mwifiex_shutdown_drv done\n"); dev_dbg(adapter->dev, "cmd: mwifiex_shutdown_drv done\n");
if (atomic_read(&adapter->rx_pending) || if (atomic_read(&adapter->rx_pending) ||
atomic_read(&adapter->tx_pending) || atomic_read(&adapter->tx_pending) ||
atomic_read(&adapter->ioctl_pending)) { atomic_read(&adapter->cmd_pending)) {
dev_err(adapter->dev, "rx_pending=%d, tx_pending=%d, " dev_err(adapter->dev, "rx_pending=%d, tx_pending=%d, "
"ioctl_pending=%d\n", "cmd_pending=%d\n",
atomic_read(&adapter->rx_pending), atomic_read(&adapter->rx_pending),
atomic_read(&adapter->tx_pending), atomic_read(&adapter->tx_pending),
atomic_read(&adapter->ioctl_pending)); atomic_read(&adapter->cmd_pending));
} }
/* Remove interface */ /* Remove interface */
......
This diff is collapsed.
...@@ -178,9 +178,8 @@ mwifiex_ssid_cmp(struct mwifiex_802_11_ssid *ssid1, ...@@ -178,9 +178,8 @@ mwifiex_ssid_cmp(struct mwifiex_802_11_ssid *ssid1,
* with requisite parameters and calls the IOCTL handler. * with requisite parameters and calls the IOCTL handler.
*/ */
int mwifiex_find_best_bss(struct mwifiex_private *priv, int mwifiex_find_best_bss(struct mwifiex_private *priv,
u8 wait_option, struct mwifiex_ssid_bssid *ssid_bssid) struct mwifiex_ssid_bssid *ssid_bssid)
{ {
struct mwifiex_wait_queue *wait = NULL;
struct mwifiex_ssid_bssid tmp_ssid_bssid; struct mwifiex_ssid_bssid tmp_ssid_bssid;
int ret = 0; int ret = 0;
u8 *mac = NULL; u8 *mac = NULL;
...@@ -188,14 +187,9 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv, ...@@ -188,14 +187,9 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv,
if (!ssid_bssid) if (!ssid_bssid)
return -1; return -1;
/* Allocate wait request buffer */
wait = mwifiex_alloc_fill_wait_queue(priv, wait_option);
if (!wait)
return -ENOMEM;
memcpy(&tmp_ssid_bssid, ssid_bssid, memcpy(&tmp_ssid_bssid, ssid_bssid,
sizeof(struct mwifiex_ssid_bssid)); sizeof(struct mwifiex_ssid_bssid));
ret = mwifiex_bss_ioctl_find_bss(priv, wait, &tmp_ssid_bssid); ret = mwifiex_bss_ioctl_find_bss(priv, &tmp_ssid_bssid);
if (!ret) { if (!ret) {
memcpy(ssid_bssid, &tmp_ssid_bssid, memcpy(ssid_bssid, &tmp_ssid_bssid,
...@@ -205,7 +199,6 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv, ...@@ -205,7 +199,6 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv,
" %pM\n", ssid_bssid->ssid.ssid, mac); " %pM\n", ssid_bssid->ssid.ssid, mac);
} }
kfree(wait);
return ret; return ret;
} }
...@@ -221,22 +214,14 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv, ...@@ -221,22 +214,14 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv,
int mwifiex_set_user_scan_ioctl(struct mwifiex_private *priv, int mwifiex_set_user_scan_ioctl(struct mwifiex_private *priv,
struct mwifiex_user_scan_cfg *scan_req) struct mwifiex_user_scan_cfg *scan_req)
{ {
struct mwifiex_wait_queue *wait = NULL;
int status = 0; int status = 0;
u8 wait_option = MWIFIEX_IOCTL_WAIT;
/* Allocate an IOCTL request buffer */
wait = mwifiex_alloc_fill_wait_queue(priv, wait_option);
if (!wait)
return -ENOMEM;
status = mwifiex_scan_networks(priv, wait, HostCmd_ACT_GEN_SET, priv->adapter->cmd_wait_q.condition = false;
scan_req, NULL);
status = mwifiex_request_ioctl(priv, wait, status, wait_option); status = mwifiex_scan_networks(priv, scan_req);
if (!status)
status = mwifiex_wait_queue_complete(priv->adapter);
if (wait && (status != -EINPROGRESS))
kfree(wait);
return status; return status;
} }
...@@ -674,7 +659,7 @@ mwifiex_scan_create_channel_list(struct mwifiex_private *priv, ...@@ -674,7 +659,7 @@ mwifiex_scan_create_channel_list(struct mwifiex_private *priv,
* along with the other TLVs, to the firmware. * along with the other TLVs, to the firmware.
*/ */
static int static int
mwifiex_scan_channel_list(struct mwifiex_private *priv, void *wait_buf, mwifiex_scan_channel_list(struct mwifiex_private *priv,
u32 max_chan_per_scan, u8 filtered_scan, u32 max_chan_per_scan, u8 filtered_scan,
struct mwifiex_scan_cmd_config *scan_cfg_out, struct mwifiex_scan_cmd_config *scan_cfg_out,
struct mwifiex_ie_types_chan_list_param_set struct mwifiex_ie_types_chan_list_param_set
...@@ -808,9 +793,9 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv, void *wait_buf, ...@@ -808,9 +793,9 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv, void *wait_buf,
/* Send the scan command to the firmware with the specified /* Send the scan command to the firmware with the specified
cfg */ cfg */
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_SCAN, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11_SCAN,
HostCmd_ACT_GEN_SET, HostCmd_ACT_GEN_SET, 0,
0, wait_buf, scan_cfg_out); scan_cfg_out);
if (ret) if (ret)
break; break;
} }
...@@ -2271,9 +2256,7 @@ mwifiex_scan_delete_ssid_table_entry(struct mwifiex_private *priv, ...@@ -2271,9 +2256,7 @@ mwifiex_scan_delete_ssid_table_entry(struct mwifiex_private *priv,
* update the internal driver scan table. * update the internal driver scan table.
*/ */
int mwifiex_scan_networks(struct mwifiex_private *priv, int mwifiex_scan_networks(struct mwifiex_private *priv,
void *wait_buf, u16 action, const struct mwifiex_user_scan_cfg *user_scan_in)
const struct mwifiex_user_scan_cfg *user_scan_in,
struct mwifiex_scan_resp *scan_resp)
{ {
int ret = 0; int ret = 0;
struct mwifiex_adapter *adapter = priv->adapter; struct mwifiex_adapter *adapter = priv->adapter;
...@@ -2288,18 +2271,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, ...@@ -2288,18 +2271,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
u8 max_chan_per_scan; u8 max_chan_per_scan;
unsigned long flags; unsigned long flags;
if (action == HostCmd_ACT_GEN_GET) { if (adapter->scan_processing) {
if (scan_resp) {
scan_resp->scan_table = (u8 *) adapter->scan_table;
scan_resp->num_in_scan_table =
adapter->num_in_scan_table;
} else {
ret = -1;
}
return ret;
}
if (adapter->scan_processing && action == HostCmd_ACT_GEN_SET) {
dev_dbg(adapter->dev, "cmd: Scan already in process...\n"); dev_dbg(adapter->dev, "cmd: Scan already in process...\n");
return ret; return ret;
} }
...@@ -2308,7 +2280,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, ...@@ -2308,7 +2280,7 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
adapter->scan_processing = true; adapter->scan_processing = true;
spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
if (priv->scan_block && action == HostCmd_ACT_GEN_SET) { if (priv->scan_block) {
dev_dbg(adapter->dev, dev_dbg(adapter->dev,
"cmd: Scan is blocked during association...\n"); "cmd: Scan is blocked during association...\n");
return ret; return ret;
...@@ -2348,9 +2320,9 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, ...@@ -2348,9 +2320,9 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
adapter->bcn_buf_end = adapter->bcn_buf; adapter->bcn_buf_end = adapter->bcn_buf;
} }
ret = mwifiex_scan_channel_list(priv, wait_buf, max_chan_per_scan, ret = mwifiex_scan_channel_list(priv, max_chan_per_scan, filtered_scan,
filtered_scan, &scan_cfg_out->config, &scan_cfg_out->config, chan_list_out,
chan_list_out, scan_chan_list); scan_chan_list);
/* Get scan command from scan_pending_q and put to cmd_pending_q */ /* Get scan command from scan_pending_q and put to cmd_pending_q */
if (!ret) { if (!ret) {
...@@ -2367,7 +2339,6 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, ...@@ -2367,7 +2339,6 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
spin_unlock_irqrestore(&adapter->scan_pending_q_lock, spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
flags); flags);
} }
ret = -EINPROGRESS;
} else { } else {
spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
adapter->scan_processing = true; adapter->scan_processing = true;
...@@ -2437,11 +2408,10 @@ int mwifiex_cmd_802_11_scan(struct mwifiex_private *priv, ...@@ -2437,11 +2408,10 @@ int mwifiex_cmd_802_11_scan(struct mwifiex_private *priv,
* .-------------------------------------------------------------. * .-------------------------------------------------------------.
*/ */
int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
struct host_cmd_ds_command *resp, void *wq_buf) struct host_cmd_ds_command *resp)
{ {
int ret = 0; int ret = 0;
struct mwifiex_adapter *adapter = priv->adapter; struct mwifiex_adapter *adapter = priv->adapter;
struct mwifiex_wait_queue *wait_queue = NULL;
struct cmd_ctrl_node *cmd_node = NULL; struct cmd_ctrl_node *cmd_node = NULL;
struct host_cmd_ds_802_11_scan_rsp *scan_rsp = NULL; struct host_cmd_ds_802_11_scan_rsp *scan_rsp = NULL;
struct mwifiex_bssdescriptor *bss_new_entry = NULL; struct mwifiex_bssdescriptor *bss_new_entry = NULL;
...@@ -2653,13 +2623,9 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, ...@@ -2653,13 +2623,9 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
mwifiex_process_scan_results(priv); mwifiex_process_scan_results(priv);
/* Need to indicate IOCTL complete */ /* Need to indicate IOCTL complete */
wait_queue = (struct mwifiex_wait_queue *) wq_buf; if (adapter->curr_cmd->wait_q_enabled) {
if (wait_queue) { adapter->cmd_wait_q.status = 0;
wait_queue->status = MWIFIEX_ERROR_NO_ERROR; mwifiex_complete_cmd(adapter);
/* Indicate ioctl complete */
mwifiex_ioctl_complete(adapter,
(struct mwifiex_wait_queue *) wait_queue, 0);
} }
if (priv->report_scan_result) if (priv->report_scan_result)
priv->report_scan_result = false; priv->report_scan_result = false;
...@@ -2853,6 +2819,7 @@ mwifiex_queue_scan_cmd(struct mwifiex_private *priv, ...@@ -2853,6 +2819,7 @@ mwifiex_queue_scan_cmd(struct mwifiex_private *priv,
struct mwifiex_adapter *adapter = priv->adapter; struct mwifiex_adapter *adapter = priv->adapter;
unsigned long flags; unsigned long flags;
cmd_node->wait_q_enabled = true;
spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
list_add_tail(&cmd_node->list, &adapter->scan_pending_q); list_add_tail(&cmd_node->list, &adapter->scan_pending_q);
spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
...@@ -2899,9 +2866,7 @@ int mwifiex_find_best_network(struct mwifiex_private *priv, ...@@ -2899,9 +2866,7 @@ int mwifiex_find_best_network(struct mwifiex_private *priv,
* firmware, filtered on a specific SSID. * firmware, filtered on a specific SSID.
*/ */
static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv,
void *wait_buf, u16 action, struct mwifiex_802_11_ssid *req_ssid)
struct mwifiex_802_11_ssid *req_ssid,
struct mwifiex_scan_resp *scan_resp)
{ {
struct mwifiex_adapter *adapter = priv->adapter; struct mwifiex_adapter *adapter = priv->adapter;
int ret = 0; int ret = 0;
...@@ -2910,24 +2875,12 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, ...@@ -2910,24 +2875,12 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv,
if (!req_ssid) if (!req_ssid)
return -1; return -1;
if (action == HostCmd_ACT_GEN_GET) { if (adapter->scan_processing) {
if (scan_resp) {
scan_resp->scan_table =
(u8 *) &priv->curr_bss_params.bss_descriptor;
scan_resp->num_in_scan_table =
adapter->num_in_scan_table;
} else {
ret = -1;
}
return ret;
}
if (adapter->scan_processing && action == HostCmd_ACT_GEN_SET) {
dev_dbg(adapter->dev, "cmd: Scan already in process...\n"); dev_dbg(adapter->dev, "cmd: Scan already in process...\n");
return ret; return ret;
} }
if (priv->scan_block && action == HostCmd_ACT_GEN_SET) { if (priv->scan_block) {
dev_dbg(adapter->dev, dev_dbg(adapter->dev,
"cmd: Scan is blocked during association...\n"); "cmd: Scan is blocked during association...\n");
return ret; return ret;
...@@ -2945,7 +2898,7 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, ...@@ -2945,7 +2898,7 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv,
req_ssid->ssid_len); req_ssid->ssid_len);
scan_cfg->keep_previous_scan = true; scan_cfg->keep_previous_scan = true;
ret = mwifiex_scan_networks(priv, wait_buf, action, scan_cfg, NULL); ret = mwifiex_scan_networks(priv, scan_cfg);
kfree(scan_cfg); kfree(scan_cfg);
return ret; return ret;
...@@ -2960,12 +2913,10 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, ...@@ -2960,12 +2913,10 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv,
* Scan command can be issued for both normal scan and specific SSID * Scan command can be issued for both normal scan and specific SSID
* scan, depending upon whether an SSID is provided or not. * scan, depending upon whether an SSID is provided or not.
*/ */
int mwifiex_request_scan(struct mwifiex_private *priv, u8 wait_option, int mwifiex_request_scan(struct mwifiex_private *priv,
struct mwifiex_802_11_ssid *req_ssid) struct mwifiex_802_11_ssid *req_ssid)
{ {
int ret = 0; int ret = 0;
struct mwifiex_wait_queue *wait = NULL;
int status = 0;
if (down_interruptible(&priv->async_sem)) { if (down_interruptible(&priv->async_sem)) {
dev_err(priv->adapter->dev, "%s: acquire semaphore\n", dev_err(priv->adapter->dev, "%s: acquire semaphore\n",
...@@ -2974,32 +2925,23 @@ int mwifiex_request_scan(struct mwifiex_private *priv, u8 wait_option, ...@@ -2974,32 +2925,23 @@ int mwifiex_request_scan(struct mwifiex_private *priv, u8 wait_option,
} }
priv->scan_pending_on_block = true; priv->scan_pending_on_block = true;
/* Allocate wait request buffer */ priv->adapter->cmd_wait_q.condition = false;
wait = mwifiex_alloc_fill_wait_queue(priv, wait_option);
if (!wait) {
ret = -1;
goto done;
}
if (req_ssid && req_ssid->ssid_len != 0) if (req_ssid && req_ssid->ssid_len != 0)
/* Specific SSID scan */ /* Specific SSID scan */
status = mwifiex_scan_specific_ssid(priv, wait, ret = mwifiex_scan_specific_ssid(priv, req_ssid);
HostCmd_ACT_GEN_SET,
req_ssid, NULL);
else else
/* Normal scan */ /* Normal scan */
status = mwifiex_scan_networks(priv, wait, HostCmd_ACT_GEN_SET, ret = mwifiex_scan_networks(priv, NULL);
NULL, NULL);
status = mwifiex_request_ioctl(priv, wait, status, wait_option); if (!ret)
if (status == -1) ret = mwifiex_wait_queue_complete(priv->adapter);
ret = -1;
done:
if ((wait) && (status != -EINPROGRESS))
kfree(wait);
if (ret == -1) { if (ret == -1) {
priv->scan_pending_on_block = false; priv->scan_pending_on_block = false;
up(&priv->async_sem); up(&priv->async_sem);
} }
return ret; return ret;
} }
......
...@@ -208,7 +208,7 @@ static int mwifiex_sdio_resume(struct device *dev) ...@@ -208,7 +208,7 @@ static int mwifiex_sdio_resume(struct device *dev)
/* Disable Host Sleep */ /* Disable Host Sleep */
mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
MWIFIEX_NO_WAIT); MWIFIEX_ASYNC_CMD);
return 0; return 0;
} }
...@@ -1745,13 +1745,12 @@ mwifiex_sdio_cleanup_module(void) ...@@ -1745,13 +1745,12 @@ mwifiex_sdio_cleanup_module(void)
for (i = 0; i < adapter->priv_num; i++) for (i = 0; i < adapter->priv_num; i++)
if ((GET_BSS_ROLE(adapter->priv[i]) == MWIFIEX_BSS_ROLE_STA) && if ((GET_BSS_ROLE(adapter->priv[i]) == MWIFIEX_BSS_ROLE_STA) &&
adapter->priv[i]->media_connected) adapter->priv[i]->media_connected)
mwifiex_disconnect(adapter->priv[i], MWIFIEX_CMD_WAIT, mwifiex_deauthenticate(adapter->priv[i], NULL);
NULL);
if (!adapter->surprise_removed) if (!adapter->surprise_removed)
mwifiex_shutdown_fw(mwifiex_get_priv mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter,
(adapter, MWIFIEX_BSS_ROLE_ANY), MWIFIEX_BSS_ROLE_ANY),
MWIFIEX_CMD_WAIT); MWIFIEX_FUNC_SHUTDOWN);
exit: exit:
up(&add_remove_card_sem); up(&add_remove_card_sem);
......
...@@ -1135,65 +1135,66 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) ...@@ -1135,65 +1135,66 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
if (first_sta) { if (first_sta) {
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_FUNC_INIT, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_FUNC_INIT,
HostCmd_ACT_GEN_SET, 0, NULL, 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_prepare_cmd(priv, HostCmd_CMD_GET_HW_SPEC, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_GET_HW_SPEC,
HostCmd_ACT_GEN_GET, 0, NULL, 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_prepare_cmd(priv, HostCmd_CMD_RECONFIGURE_TX_BUFF, ret = mwifiex_send_cmd_async(priv,
HostCmd_ACT_GEN_SET, 0, NULL, HostCmd_CMD_RECONFIGURE_TX_BUFF,
&priv->adapter->tx_buf_size); HostCmd_ACT_GEN_SET, 0,
&priv->adapter->tx_buf_size);
if (ret) if (ret)
return -1; return -1;
/* 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_prepare_cmd(priv, HostCmd_CMD_802_11_PS_MODE_ENH, ret = mwifiex_send_cmd_async(priv,
EN_AUTO_PS, BITMAP_STA_PS, NULL, HostCmd_CMD_802_11_PS_MODE_ENH,
NULL); EN_AUTO_PS, BITMAP_STA_PS, NULL);
if (ret) if (ret)
return -1; return -1;
} }
/* get tx rate */ /* get tx rate */
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_TX_RATE_CFG, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_TX_RATE_CFG,
HostCmd_ACT_GEN_GET, 0, NULL, 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_prepare_cmd(priv, HostCmd_CMD_TXPWR_CFG, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_TXPWR_CFG,
HostCmd_ACT_GEN_GET, 0, NULL, NULL); HostCmd_ACT_GEN_GET, 0, NULL);
if (ret) if (ret)
return -1; return -1;
/* set ibss coalescing_status */ /* set ibss coalescing_status */
ret = mwifiex_prepare_cmd(priv, ret = mwifiex_send_cmd_async(priv,
HostCmd_CMD_802_11_IBSS_COALESCING_STATUS, HostCmd_CMD_802_11_IBSS_COALESCING_STATUS,
HostCmd_ACT_GEN_SET, 0, NULL, &enable); HostCmd_ACT_GEN_SET, 0, &enable);
if (ret) if (ret)
return -1; return -1;
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_prepare_cmd(priv, HostCmd_CMD_AMSDU_AGGR_CTRL, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_AMSDU_AGGR_CTRL,
HostCmd_ACT_GEN_SET, 0, NULL, HostCmd_ACT_GEN_SET, 0,
(void *) &amsdu_aggr_ctrl); (void *) &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_prepare_cmd(priv, HostCmd_CMD_MAC_CONTROL, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL,
HostCmd_ACT_GEN_SET, 0, NULL, HostCmd_ACT_GEN_SET, 0,
&priv->curr_pkt_filter); &priv->curr_pkt_filter);
if (ret) if (ret)
return -1; return -1;
...@@ -1201,19 +1202,18 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) ...@@ -1201,19 +1202,18 @@ 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_prepare_cmd(priv, ret = mwifiex_send_cmd_async(priv,
HostCmd_CMD_802_11_PS_MODE_ENH, HostCmd_CMD_802_11_PS_MODE_ENH,
EN_AUTO_PS, BITMAP_AUTO_DS, NULL, EN_AUTO_PS, BITMAP_AUTO_DS,
&auto_ds); &auto_ds);
if (ret) if (ret)
return -1; return -1;
} }
/* 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_prepare_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11_SNMP_MIB,
HostCmd_ACT_GEN_SET, DOT11D_I, HostCmd_ACT_GEN_SET, DOT11D_I, &state_11d);
NULL, &state_11d);
if (ret) if (ret)
dev_err(priv->adapter->dev, "11D: failed to enable 11D\n"); dev_err(priv->adapter->dev, "11D: failed to enable 11D\n");
......
...@@ -41,8 +41,7 @@ ...@@ -41,8 +41,7 @@
*/ */
static void static void
mwifiex_process_cmdresp_error(struct mwifiex_private *priv, mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
struct host_cmd_ds_command *resp, struct host_cmd_ds_command *resp)
struct mwifiex_wait_queue *wq_buf)
{ {
struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL; struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL;
struct mwifiex_adapter *adapter = priv->adapter; struct mwifiex_adapter *adapter = priv->adapter;
...@@ -51,8 +50,9 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv, ...@@ -51,8 +50,9 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
dev_err(adapter->dev, "CMD_RESP: cmd %#x error, result=%#x\n", dev_err(adapter->dev, "CMD_RESP: cmd %#x error, result=%#x\n",
resp->command, resp->result); resp->command, resp->result);
if (wq_buf)
wq_buf->status = MWIFIEX_ERROR_FW_CMDRESP; if (adapter->curr_cmd->wait_q_enabled)
adapter->cmd_wait_q.status = -1;
switch (le16_to_cpu(resp->command)) { switch (le16_to_cpu(resp->command)) {
case HostCmd_CMD_802_11_PS_MODE_ENH: case HostCmd_CMD_802_11_PS_MODE_ENH:
...@@ -328,9 +328,9 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, ...@@ -328,9 +328,9 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
if (priv->is_data_rate_auto) if (priv->is_data_rate_auto)
priv->data_rate = 0; priv->data_rate = 0;
else else
ret = mwifiex_prepare_cmd(priv, ret = mwifiex_send_cmd_async(priv,
HostCmd_CMD_802_11_TX_RATE_QUERY, HostCmd_CMD_802_11_TX_RATE_QUERY,
HostCmd_ACT_GEN_GET, 0, NULL, NULL); HostCmd_ACT_GEN_GET, 0, NULL);
if (data_buf) { if (data_buf) {
ds_rate = (struct mwifiex_rate_cfg *) data_buf; ds_rate = (struct mwifiex_rate_cfg *) data_buf;
...@@ -833,19 +833,17 @@ static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv, ...@@ -833,19 +833,17 @@ static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
* response handlers based on the command ID. * response handlers based on the command ID.
*/ */
int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv,
u16 cmdresp_no, void *cmd_buf, void *wq_buf) u16 cmdresp_no, void *cmd_buf)
{ {
int ret = 0; int ret = 0;
struct mwifiex_adapter *adapter = priv->adapter; struct mwifiex_adapter *adapter = priv->adapter;
struct host_cmd_ds_command *resp = struct host_cmd_ds_command *resp =
(struct host_cmd_ds_command *) cmd_buf; (struct host_cmd_ds_command *) cmd_buf;
struct mwifiex_wait_queue *wait_queue =
(struct mwifiex_wait_queue *) wq_buf;
void *data_buf = adapter->curr_cmd->data_buf; void *data_buf = adapter->curr_cmd->data_buf;
/* If the command is not successful, cleanup and return failure */ /* If the command is not successful, cleanup and return failure */
if (resp->result != HostCmd_RESULT_OK) { if (resp->result != HostCmd_RESULT_OK) {
mwifiex_process_cmdresp_error(priv, resp, wait_queue); mwifiex_process_cmdresp_error(priv, resp);
return -1; return -1;
} }
/* Command successful, handle response */ /* Command successful, handle response */
...@@ -865,12 +863,11 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, ...@@ -865,12 +863,11 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv,
ret = mwifiex_ret_tx_rate_cfg(priv, resp, data_buf); ret = mwifiex_ret_tx_rate_cfg(priv, resp, data_buf);
break; break;
case HostCmd_CMD_802_11_SCAN: case HostCmd_CMD_802_11_SCAN:
ret = mwifiex_ret_802_11_scan(priv, resp, wait_queue); ret = mwifiex_ret_802_11_scan(priv, resp);
wait_queue = NULL; adapter->curr_cmd->wait_q_enabled = false;
adapter->curr_cmd->wq_buf = NULL;
break; break;
case HostCmd_CMD_802_11_BG_SCAN_QUERY: case HostCmd_CMD_802_11_BG_SCAN_QUERY:
ret = mwifiex_ret_802_11_scan(priv, resp, wait_queue); ret = mwifiex_ret_802_11_scan(priv, resp);
dev_dbg(adapter->dev, dev_dbg(adapter->dev,
"info: CMD_RESP: BG_SCAN result is ready!\n"); "info: CMD_RESP: BG_SCAN result is ready!\n");
break; break;
...@@ -884,14 +881,14 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, ...@@ -884,14 +881,14 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv,
ret = mwifiex_ret_802_11_hs_cfg(priv, resp); ret = mwifiex_ret_802_11_hs_cfg(priv, resp);
break; break;
case HostCmd_CMD_802_11_ASSOCIATE: case HostCmd_CMD_802_11_ASSOCIATE:
ret = mwifiex_ret_802_11_associate(priv, resp, wait_queue); ret = mwifiex_ret_802_11_associate(priv, resp);
break; break;
case HostCmd_CMD_802_11_DEAUTHENTICATE: case HostCmd_CMD_802_11_DEAUTHENTICATE:
ret = mwifiex_ret_802_11_deauthenticate(priv, resp); ret = mwifiex_ret_802_11_deauthenticate(priv, resp);
break; break;
case HostCmd_CMD_802_11_AD_HOC_START: case HostCmd_CMD_802_11_AD_HOC_START:
case HostCmd_CMD_802_11_AD_HOC_JOIN: case HostCmd_CMD_802_11_AD_HOC_JOIN:
ret = mwifiex_ret_802_11_ad_hoc(priv, resp, wait_queue); ret = mwifiex_ret_802_11_ad_hoc(priv, resp);
break; break;
case HostCmd_CMD_802_11_AD_HOC_STOP: case HostCmd_CMD_802_11_AD_HOC_STOP:
ret = mwifiex_ret_802_11_ad_hoc_stop(priv, resp); ret = mwifiex_ret_802_11_ad_hoc_stop(priv, resp);
......
...@@ -271,8 +271,9 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) ...@@ -271,8 +271,9 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
case EVENT_HS_ACT_REQ: case EVENT_HS_ACT_REQ:
dev_dbg(adapter->dev, "event: HS_ACT_REQ\n"); dev_dbg(adapter->dev, "event: HS_ACT_REQ\n");
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11_HS_CFG_ENH, ret = mwifiex_send_cmd_async(priv,
0, 0, NULL, NULL); HostCmd_CMD_802_11_HS_CFG_ENH,
0, 0, NULL);
break; break;
case EVENT_MIC_ERR_UNICAST: case EVENT_MIC_ERR_UNICAST:
...@@ -303,9 +304,9 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) ...@@ -303,9 +304,9 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
sizeof(struct mwifiex_bssdescriptor) * IW_MAX_AP); sizeof(struct mwifiex_bssdescriptor) * IW_MAX_AP);
adapter->num_in_scan_table = 0; adapter->num_in_scan_table = 0;
adapter->bcn_buf_end = adapter->bcn_buf; adapter->bcn_buf_end = adapter->bcn_buf;
ret = mwifiex_prepare_cmd(priv, ret = mwifiex_send_cmd_async(priv,
HostCmd_CMD_802_11_BG_SCAN_QUERY, HostCmd_CMD_802_11_BG_SCAN_QUERY,
HostCmd_ACT_GEN_GET, 0, NULL, NULL); HostCmd_ACT_GEN_GET, 0, NULL);
break; break;
case EVENT_PORT_RELEASE: case EVENT_PORT_RELEASE:
...@@ -314,8 +315,8 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) ...@@ -314,8 +315,8 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
case EVENT_WMM_STATUS_CHANGE: case EVENT_WMM_STATUS_CHANGE:
dev_dbg(adapter->dev, "event: WMM status changed\n"); dev_dbg(adapter->dev, "event: WMM status changed\n");
ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_WMM_GET_STATUS, ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_WMM_GET_STATUS,
0, 0, NULL, NULL); 0, 0, NULL);
break; break;
case EVENT_RSSI_LOW: case EVENT_RSSI_LOW:
...@@ -353,15 +354,15 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) ...@@ -353,15 +354,15 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
break; break;
case EVENT_IBSS_COALESCED: case EVENT_IBSS_COALESCED:
dev_dbg(adapter->dev, "event: IBSS_COALESCED\n"); dev_dbg(adapter->dev, "event: IBSS_COALESCED\n");
ret = mwifiex_prepare_cmd(priv, ret = mwifiex_send_cmd_async(priv,
HostCmd_CMD_802_11_IBSS_COALESCING_STATUS, HostCmd_CMD_802_11_IBSS_COALESCING_STATUS,
HostCmd_ACT_GEN_GET, 0, NULL, NULL); HostCmd_ACT_GEN_GET, 0, NULL);
break; break;
case EVENT_ADDBA: case EVENT_ADDBA:
dev_dbg(adapter->dev, "event: ADDBA Request\n"); dev_dbg(adapter->dev, "event: ADDBA Request\n");
mwifiex_prepare_cmd(priv, HostCmd_CMD_11N_ADDBA_RSP, mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_ADDBA_RSP,
HostCmd_ACT_GEN_SET, 0, NULL, HostCmd_ACT_GEN_SET, 0,
adapter->event_body); adapter->event_body);
break; break;
case EVENT_DELBA: case EVENT_DELBA:
dev_dbg(adapter->dev, "event: DELBA Request\n"); dev_dbg(adapter->dev, "event: DELBA Request\n");
......
This diff is collapsed.
...@@ -51,7 +51,7 @@ void *mwifiex_process_sta_txpd(struct mwifiex_private *priv, ...@@ -51,7 +51,7 @@ void *mwifiex_process_sta_txpd(struct mwifiex_private *priv,
if (!skb->len) { if (!skb->len) {
dev_err(adapter->dev, "Tx: bad packet length: %d\n", dev_err(adapter->dev, "Tx: bad packet length: %d\n",
skb->len); skb->len);
tx_info->status_code = MWIFIEX_ERROR_PKT_SIZE_INVALID; tx_info->status_code = -1;
return skb->data; return skb->data;
} }
......
...@@ -55,17 +55,12 @@ int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter) ...@@ -55,17 +55,12 @@ int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter)
} }
/* /*
* IOCTL request handler to send function init/shutdown command * This function sends init/shutdown command
* to firmware. * to firmware.
*
* This function prepares the correct firmware command and
* issues it.
*/ */
int mwifiex_misc_ioctl_init_shutdown(struct mwifiex_adapter *adapter, int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
struct mwifiex_wait_queue *wait, u32 func_init_shutdown)
u32 func_init_shutdown)
{ {
struct mwifiex_private *priv = adapter->priv[wait->bss_index];
int ret; int ret;
u16 cmd; u16 cmd;
...@@ -74,19 +69,16 @@ int mwifiex_misc_ioctl_init_shutdown(struct mwifiex_adapter *adapter, ...@@ -74,19 +69,16 @@ int mwifiex_misc_ioctl_init_shutdown(struct mwifiex_adapter *adapter,
} else if (func_init_shutdown == MWIFIEX_FUNC_SHUTDOWN) { } else if (func_init_shutdown == MWIFIEX_FUNC_SHUTDOWN) {
cmd = HostCmd_CMD_FUNC_SHUTDOWN; cmd = HostCmd_CMD_FUNC_SHUTDOWN;
} else { } else {
dev_err(adapter->dev, "unsupported parameter\n"); dev_err(priv->adapter->dev, "unsupported parameter\n");
return -1; return -1;
} }
/* Send command to firmware */ /* Send command to firmware */
ret = mwifiex_prepare_cmd(priv, cmd, HostCmd_ACT_GEN_SET, ret = mwifiex_send_cmd_sync(priv, cmd, HostCmd_ACT_GEN_SET, 0, NULL);
0, wait, NULL);
if (!ret)
ret = -EINPROGRESS;
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(mwifiex_init_shutdown_fw);
/* /*
* IOCTL request handler to set/get debug information. * IOCTL request handler to set/get debug information.
...@@ -222,31 +214,18 @@ int mwifiex_recv_complete(struct mwifiex_adapter *adapter, ...@@ -222,31 +214,18 @@ int mwifiex_recv_complete(struct mwifiex_adapter *adapter,
* corresponding waiting function. Otherwise, it processes the * corresponding waiting function. Otherwise, it processes the
* IOCTL response and frees the response buffer. * IOCTL response and frees the response buffer.
*/ */
int mwifiex_ioctl_complete(struct mwifiex_adapter *adapter, int mwifiex_complete_cmd(struct mwifiex_adapter *adapter)
struct mwifiex_wait_queue *wait_queue,
int status)
{ {
enum mwifiex_error_code status_code = atomic_dec(&adapter->cmd_pending);
(enum mwifiex_error_code) wait_queue->status; dev_dbg(adapter->dev, "cmd completed: status=%d\n",
adapter->cmd_wait_q.status);
atomic_dec(&adapter->ioctl_pending);
dev_dbg(adapter->dev, "cmd: IOCTL completed: status=%d," adapter->cmd_wait_q.condition = true;
" status_code=%#x\n", status, status_code);
if (wait_queue->enabled) { if (adapter->cmd_wait_q.status == -ETIMEDOUT)
*wait_queue->condition = true; dev_err(adapter->dev, "cmd timeout\n");
wait_queue->status = status; else
if (status && (status_code == MWIFIEX_ERROR_CMD_TIMEOUT)) wake_up_interruptible(&adapter->cmd_wait_q.wait);
dev_err(adapter->dev, "cmd timeout\n");
else
wake_up_interruptible(wait_queue->wait);
} else {
if (status)
dev_err(adapter->dev, "cmd failed: status_code=%#x\n",
status_code);
kfree(wait_queue);
}
return 0; return 0;
} }
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