summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mwifiex
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r--drivers/net/wireless/mwifiex/11n.c34
-rw-r--r--drivers/net/wireless/mwifiex/11n.h53
-rw-r--r--drivers/net/wireless/mwifiex/11n_aggr.c5
-rw-r--r--drivers/net/wireless/mwifiex/11n_rxreorder.c36
-rw-r--r--drivers/net/wireless/mwifiex/11n_rxreorder.h6
-rw-r--r--drivers/net/wireless/mwifiex/README2
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c224
-rw-r--r--drivers/net/wireless/mwifiex/cfp.c17
-rw-r--r--drivers/net/wireless/mwifiex/cmdevt.c194
-rw-r--r--drivers/net/wireless/mwifiex/debugfs.c7
-rw-r--r--drivers/net/wireless/mwifiex/decl.h38
-rw-r--r--drivers/net/wireless/mwifiex/fw.h29
-rw-r--r--drivers/net/wireless/mwifiex/init.c14
-rw-r--r--drivers/net/wireless/mwifiex/ioctl.h3
-rw-r--r--drivers/net/wireless/mwifiex/join.c128
-rw-r--r--drivers/net/wireless/mwifiex/main.c174
-rw-r--r--drivers/net/wireless/mwifiex/main.h142
-rw-r--r--drivers/net/wireless/mwifiex/scan.c154
-rw-r--r--drivers/net/wireless/mwifiex/sdio.c49
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmd.c127
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmdresp.c47
-rw-r--r--drivers/net/wireless/mwifiex/sta_event.c25
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c1081
-rw-r--r--drivers/net/wireless/mwifiex/sta_tx.c8
-rw-r--r--drivers/net/wireless/mwifiex/txrx.c4
-rw-r--r--drivers/net/wireless/mwifiex/util.c55
-rw-r--r--drivers/net/wireless/mwifiex/wmm.c24
-rw-r--r--drivers/net/wireless/mwifiex/wmm.h8
28 files changed, 715 insertions, 1973 deletions
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c
index 73a6e62f5680..e22d761f2ef2 100644
--- a/drivers/net/wireless/mwifiex/11n.c
+++ b/drivers/net/wireless/mwifiex/11n.c
@@ -115,7 +115,7 @@ mwifiex_fill_cap_info(struct mwifiex_private *priv,
SETHT_MCS32(ht_cap->ht_cap.mcs.rx_mask);
/* Clear RD responder bit */
- RESETHT_EXTCAP_RDG(ht_ext_cap);
+ ht_ext_cap &= ~IEEE80211_HT_EXT_CAP_RD_RESPONDER;
ht_cap->ht_cap.cap_info = cpu_to_le16(ht_cap_info);
ht_cap->ht_cap.extended_ht_cap_info = cpu_to_le16(ht_ext_cap);
@@ -242,9 +242,7 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
*
* Handling includes changing the header fields into CPU format.
*/
-int mwifiex_ret_11n_cfg(struct mwifiex_private *priv,
- struct host_cmd_ds_command *resp,
- void *data_buf)
+int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp, void *data_buf)
{
struct mwifiex_ds_11n_tx_cfg *tx_cfg = NULL;
struct host_cmd_ds_11n_cfg *htcfg = &resp->params.htcfg;
@@ -298,8 +296,7 @@ int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv,
* - Setting AMSDU control parameters (for SET only)
* - Ensuring correct endian-ness
*/
-int mwifiex_cmd_amsdu_aggr_ctrl(struct mwifiex_private *priv,
- struct host_cmd_ds_command *cmd,
+int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd,
int cmd_action, void *data_buf)
{
struct host_cmd_ds_amsdu_aggr_ctrl *amsdu_ctrl =
@@ -331,8 +328,7 @@ int mwifiex_cmd_amsdu_aggr_ctrl(struct mwifiex_private *priv,
*
* Handling includes changing the header fields into CPU format.
*/
-int mwifiex_ret_amsdu_aggr_ctrl(struct mwifiex_private *priv,
- struct host_cmd_ds_command *resp,
+int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp,
void *data_buf)
{
struct mwifiex_ds_11n_amsdu_aggr_ctrl *amsdu_aggr_ctrl = NULL;
@@ -357,8 +353,7 @@ int mwifiex_ret_amsdu_aggr_ctrl(struct mwifiex_private *priv,
* - Setting HT Tx capability and HT Tx information fields
* - Ensuring correct endian-ness
*/
-int mwifiex_cmd_11n_cfg(struct mwifiex_private *priv,
- struct host_cmd_ds_command *cmd,
+int mwifiex_cmd_11n_cfg(struct host_cmd_ds_command *cmd,
u16 cmd_action, void *data_buf)
{
struct host_cmd_ds_11n_cfg *htcfg = &cmd->params.htcfg;
@@ -541,11 +536,8 @@ mwifiex_cfg_tx_buf(struct mwifiex_private *priv,
else if (priv->adapter->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)
- mwifiex_prepare_cmd(priv, HostCmd_CMD_RECONFIGURE_TX_BUFF,
- HostCmd_ACT_GEN_SET, 0,
- NULL, &tx_buf);
-
- return;
+ mwifiex_send_cmd_async(priv, HostCmd_CMD_RECONFIGURE_TX_BUFF,
+ HostCmd_ACT_GEN_SET, 0, &tx_buf);
}
/*
@@ -583,8 +575,6 @@ void mwifiex_11n_delete_tx_ba_stream_tbl_entry(struct mwifiex_private *priv,
list_del(&tx_ba_tsr_tbl->list);
kfree(tx_ba_tsr_tbl);
-
- return;
}
/*
@@ -663,8 +653,6 @@ void mwifiex_11n_create_tx_ba_stream_tbl(struct mwifiex_private *priv,
list_add_tail(&new_node->list, &priv->tx_ba_stream_tbl_ptr);
spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags);
}
-
- return;
}
/*
@@ -694,8 +682,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);
/* We don't wait for the response of this command */
- ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_11N_ADDBA_REQ,
- 0, 0, NULL, &add_ba_req);
+ ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_ADDBA_REQ,
+ 0, 0, &add_ba_req);
return ret;
}
@@ -722,8 +710,8 @@ int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac,
memcpy(&delba.peer_mac_addr, peer_mac, ETH_ALEN);
/* We don't wait for the response of this command */
- ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_11N_DELBA,
- HostCmd_ACT_GEN_SET, 0, NULL, &delba);
+ ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_DELBA,
+ HostCmd_ACT_GEN_SET, 0, &delba);
return ret;
}
diff --git a/drivers/net/wireless/mwifiex/11n.h b/drivers/net/wireless/mwifiex/11n.h
index 71a853e61b61..02602ff30cbf 100644
--- a/drivers/net/wireless/mwifiex/11n.h
+++ b/drivers/net/wireless/mwifiex/11n.h
@@ -28,15 +28,9 @@ int mwifiex_ret_11n_delba(struct mwifiex_private *priv,
struct host_cmd_ds_command *resp);
int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
struct host_cmd_ds_command *resp);
-int mwifiex_ret_11n_cfg(struct mwifiex_private *priv,
- struct host_cmd_ds_command *resp,
+int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp,
void *data_buf);
-int mwifiex_cmd_11n_cfg(struct mwifiex_private *priv,
- struct host_cmd_ds_command *cmd,
- u16 cmd_action, void *data_buf);
-
-int mwifiex_cmd_11n_cfg(struct mwifiex_private *priv,
- struct host_cmd_ds_command *cmd,
+int mwifiex_cmd_11n_cfg(struct host_cmd_ds_command *cmd,
u16 cmd_action, void *data_buf);
int mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv,
@@ -67,24 +61,19 @@ int mwifiex_get_rx_reorder_tbl(struct mwifiex_private *priv,
struct mwifiex_ds_rx_reorder_tbl *buf);
int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private *priv,
struct mwifiex_ds_tx_ba_stream_tbl *buf);
-int mwifiex_ret_amsdu_aggr_ctrl(struct mwifiex_private *priv,
- struct host_cmd_ds_command
- *resp,
+int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp,
void *data_buf);
int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv,
struct host_cmd_ds_command *cmd,
int cmd_action, void *data_buf);
-int mwifiex_cmd_amsdu_aggr_ctrl(struct mwifiex_private *priv,
- struct host_cmd_ds_command *cmd,
- int cmd_action,
- void *data_buf);
+int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd,
+ int cmd_action, void *data_buf);
/*
* This function checks whether AMPDU is allowed or not for a particular TID.
*/
static inline u8
-mwifiex_is_ampdu_allowed(struct mwifiex_private *priv,
- struct mwifiex_ra_list_tbl *ptr, int tid)
+mwifiex_is_ampdu_allowed(struct mwifiex_private *priv, int tid)
{
return ((priv->aggr_prio_tbl[tid].ampdu_ap != BA_STREAM_NOT_ALLOWED)
? true : false);
@@ -94,8 +83,7 @@ mwifiex_is_ampdu_allowed(struct mwifiex_private *priv,
* This function checks whether AMSDU is allowed or not for a particular TID.
*/
static inline u8
-mwifiex_is_amsdu_allowed(struct mwifiex_private *priv,
- struct mwifiex_ra_list_tbl *ptr, int tid)
+mwifiex_is_amsdu_allowed(struct mwifiex_private *priv, int tid)
{
return (((priv->aggr_prio_tbl[tid].amsdu != BA_STREAM_NOT_ALLOWED)
&& ((priv->is_data_rate_auto)
@@ -104,23 +92,21 @@ mwifiex_is_amsdu_allowed(struct mwifiex_private *priv,
}
/*
- * This function checks whether a BA stream is available or not.
+ * This function checks whether a space is available for new BA stream or not.
*/
-static inline u8
-mwifiex_is_ba_stream_avail(struct mwifiex_private *priv)
+static inline u8 mwifiex_space_avail_for_new_ba_stream(
+ struct mwifiex_adapter *adapter)
{
- struct mwifiex_private *pmpriv = NULL;
- u8 i = 0;
+ struct mwifiex_private *priv;
+ u8 i;
u32 ba_stream_num = 0;
- for (i = 0; i < priv->adapter->priv_num; i++) {
- pmpriv = priv->adapter->priv[i];
- if (pmpriv)
- ba_stream_num +=
- mwifiex_wmm_list_len(priv->adapter,
- (struct list_head
- *) &pmpriv->
- tx_ba_stream_tbl_ptr);
+ for (i = 0; i < adapter->priv_num; i++) {
+ priv = adapter->priv[i];
+ if (priv)
+ ba_stream_num += mwifiex_wmm_list_len(
+ (struct list_head *)
+ &priv->tx_ba_stream_tbl_ptr);
}
return ((ba_stream_num <
@@ -133,8 +119,7 @@ mwifiex_is_ba_stream_avail(struct mwifiex_private *priv)
* Upon successfully locating, both the TID and the RA are returned.
*/
static inline u8
-mwifiex_find_stream_to_delete(struct mwifiex_private *priv,
- struct mwifiex_ra_list_tbl *ptr, int ptr_tid,
+mwifiex_find_stream_to_delete(struct mwifiex_private *priv, int ptr_tid,
int *ptid, u8 *ra)
{
int tid;
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c
index c2abced66957..c9fb0627de43 100644
--- a/drivers/net/wireless/mwifiex/11n_aggr.c
+++ b/drivers/net/wireless/mwifiex/11n_aggr.c
@@ -44,8 +44,7 @@
* MSDU => |DA|SA|Length|SNAP|...... ..|
*/
static int
-mwifiex_11n_form_amsdu_pkt(struct mwifiex_adapter *adapter,
- struct sk_buff *skb_aggr,
+mwifiex_11n_form_amsdu_pkt(struct sk_buff *skb_aggr,
struct sk_buff *skb_src, int *pad)
{
@@ -324,7 +323,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock,
ra_list_flags);
- mwifiex_11n_form_amsdu_pkt(adapter, skb_aggr, skb_src, &pad);
+ mwifiex_11n_form_amsdu_pkt(skb_aggr, skb_src, &pad);
mwifiex_write_data_complete(adapter, skb_src, 0);
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c
index 8e94e620e6f4..a93c03fdea82 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c
@@ -27,19 +27,6 @@
#include "11n_rxreorder.h"
/*
- * This function processes a received packet and forwards
- * it to the kernel/upper layer.
- */
-static int mwifiex_11n_dispatch_pkt(struct mwifiex_private *priv, void *payload)
-{
- int ret = 0;
- struct mwifiex_adapter *adapter = priv->adapter;
-
- ret = mwifiex_process_rx_packet(adapter, (struct sk_buff *) payload);
- return ret;
-}
-
-/*
* This function dispatches all packets in the Rx reorder table.
*
* There could be holes in the buffer, which are skipped by the function.
@@ -51,7 +38,7 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
struct mwifiex_rx_reorder_tbl
*rx_reor_tbl_ptr, int start_win)
{
- int no_pkt_to_send, i, xchg;
+ int no_pkt_to_send, i;
void *rx_tmp_ptr = NULL;
unsigned long flags;
@@ -68,7 +55,7 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
}
spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
if (rx_tmp_ptr)
- mwifiex_11n_dispatch_pkt(priv, rx_tmp_ptr);
+ mwifiex_process_rx_packet(priv->adapter, rx_tmp_ptr);
}
spin_lock_irqsave(&priv->rx_pkt_lock, flags);
@@ -76,8 +63,7 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
* We don't have a circular buffer, hence use rotation to simulate
* circular buffer
*/
- xchg = rx_reor_tbl_ptr->win_size - no_pkt_to_send;
- for (i = 0; i < xchg; ++i) {
+ for (i = 0; i < rx_reor_tbl_ptr->win_size - no_pkt_to_send; ++i) {
rx_reor_tbl_ptr->rx_reorder_ptr[i] =
rx_reor_tbl_ptr->rx_reorder_ptr[no_pkt_to_send + i];
rx_reor_tbl_ptr->rx_reorder_ptr[no_pkt_to_send + i] = NULL;
@@ -114,7 +100,7 @@ mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv,
rx_tmp_ptr = rx_reor_tbl_ptr->rx_reorder_ptr[i];
rx_reor_tbl_ptr->rx_reorder_ptr[i] = NULL;
spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
- mwifiex_11n_dispatch_pkt(priv, rx_tmp_ptr);
+ mwifiex_process_rx_packet(priv->adapter, rx_tmp_ptr);
}
spin_lock_irqsave(&priv->rx_pkt_lock, flags);
@@ -309,8 +295,6 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
list_add_tail(&new_node->list, &priv->rx_reorder_tbl_ptr);
spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
-
- return;
}
/*
@@ -321,8 +305,7 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
* - Setting add BA request buffer
* - Ensuring correct endian-ness
*/
-int mwifiex_cmd_11n_addba_req(struct mwifiex_private *priv,
- struct host_cmd_ds_command *cmd, void *data_buf)
+int mwifiex_cmd_11n_addba_req(struct host_cmd_ds_command *cmd, void *data_buf)
{
struct host_cmd_ds_11n_addba_req *add_ba_req =
(struct host_cmd_ds_11n_addba_req *)
@@ -393,8 +376,7 @@ int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
* - Setting del BA request buffer
* - Ensuring correct endian-ness
*/
-int mwifiex_cmd_11n_delba(struct mwifiex_private *priv,
- struct host_cmd_ds_command *cmd, void *data_buf)
+int mwifiex_cmd_11n_delba(struct host_cmd_ds_command *cmd, void *data_buf)
{
struct host_cmd_ds_11n_delba *del_ba = (struct host_cmd_ds_11n_delba *)
&cmd->params.del_ba;
@@ -433,7 +415,7 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv,
tid, ta);
if (!rx_reor_tbl_ptr) {
if (pkt_type != PKT_TYPE_BAR)
- mwifiex_11n_dispatch_pkt(priv, payload);
+ mwifiex_process_rx_packet(priv->adapter, payload);
return 0;
}
start_win = rx_reor_tbl_ptr->start_win;
@@ -609,9 +591,7 @@ void mwifiex_11n_ba_stream_timeout(struct mwifiex_private *priv,
delba.del_ba_param_set |= cpu_to_le16(
(u16) event->origninator << DELBA_INITIATOR_POS);
delba.reason_code = cpu_to_le16(WLAN_REASON_QSTA_TIMEOUT);
- mwifiex_prepare_cmd(priv, HostCmd_CMD_11N_DELBA, 0, 0, NULL, &delba);
-
- return;
+ mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_DELBA, 0, 0, &delba);
}
/*
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.h b/drivers/net/wireless/mwifiex/11n_rxreorder.h
index 42f569035745..f3ca8c8c18f9 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.h
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.h
@@ -49,14 +49,12 @@ void mwifiex_11n_ba_stream_timeout(struct mwifiex_private *priv,
int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
struct host_cmd_ds_command
*resp);
-int mwifiex_cmd_11n_delba(struct mwifiex_private *priv,
- struct host_cmd_ds_command *cmd,
+int mwifiex_cmd_11n_delba(struct host_cmd_ds_command *cmd,
void *data_buf);
int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
struct host_cmd_ds_command
*cmd, void *data_buf);
-int mwifiex_cmd_11n_addba_req(struct mwifiex_private *priv,
- struct host_cmd_ds_command *cmd,
+int mwifiex_cmd_11n_addba_req(struct host_cmd_ds_command *cmd,
void *data_buf);
void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv);
struct mwifiex_rx_reorder_tbl *mwifiex_11n_get_rxreorder_tbl(struct
diff --git a/drivers/net/wireless/mwifiex/README b/drivers/net/wireless/mwifiex/README
index 338377f7093b..b55badef4660 100644
--- a/drivers/net/wireless/mwifiex/README
+++ b/drivers/net/wireless/mwifiex/README
@@ -157,7 +157,7 @@ info
mp_wr_bitmap = <SDIO multi-port write bitmap>
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>
- ioctl_pending = <number of ioctl pending>
+ cmd_pending = <number of cmd pending>
tx_pending = <number of Tx packet pending>
rx_pending = <number of Rx packet pending>
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index ec0895f4e8d3..b99ae2677d78 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -34,22 +34,17 @@ static int
mwifiex_cfg80211_channel_type_to_mwifiex_channels(enum nl80211_channel_type
channel_type)
{
- int channel;
switch (channel_type) {
case NL80211_CHAN_NO_HT:
case NL80211_CHAN_HT20:
- channel = NO_SEC_CHANNEL;
- break;
+ return NO_SEC_CHANNEL;
case NL80211_CHAN_HT40PLUS:
- channel = SEC_CHANNEL_ABOVE;
- break;
+ return SEC_CHANNEL_ABOVE;
case NL80211_CHAN_HT40MINUS:
- channel = SEC_CHANNEL_BELOW;
- break;
+ return SEC_CHANNEL_BELOW;
default:
- channel = NO_SEC_CHANNEL;
+ return NO_SEC_CHANNEL;
}
- return channel;
}
/*
@@ -64,21 +59,16 @@ mwifiex_cfg80211_channel_type_to_mwifiex_channels(enum nl80211_channel_type
static enum nl80211_channel_type
mwifiex_channels_to_cfg80211_channel_type(int channel_type)
{
- int channel;
switch (channel_type) {
case NO_SEC_CHANNEL:
- channel = NL80211_CHAN_HT20;
- break;
+ return NL80211_CHAN_HT20;
case SEC_CHANNEL_ABOVE:
- channel = NL80211_CHAN_HT40PLUS;
- break;
+ return NL80211_CHAN_HT40PLUS;
case SEC_CHANNEL_BELOW:
- channel = NL80211_CHAN_HT40MINUS;
- break;
+ return NL80211_CHAN_HT40MINUS;
default:
- channel = NL80211_CHAN_HT20;
+ return NL80211_CHAN_HT20;
}
- return channel;
}
/*
@@ -117,10 +107,8 @@ mwifiex_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev,
u8 key_index, bool pairwise, const u8 *mac_addr)
{
struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
- int ret = 0;
- ret = mwifiex_set_encode(priv, NULL, 0, key_index, 1);
- if (ret) {
+ if (mwifiex_set_encode(priv, NULL, 0, key_index, 1)) {
wiphy_err(wiphy, "deleting the crypto keys\n");
return -EFAULT;
}
@@ -137,12 +125,17 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy,
enum nl80211_tx_power_setting type,
int dbm)
{
- int ret = 0;
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;
+ }
- return ret;
+ return mwifiex_set_tx_power(priv, &power_cfg);
}
/*
@@ -155,17 +148,17 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
struct net_device *dev,
bool enabled, int timeout)
{
- int ret = 0;
struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
+ u32 ps_mode;
if (timeout)
wiphy_dbg(wiphy,
"info: ignoring the timeout value"
" for IEEE power save\n");
- ret = mwifiex_drv_set_power(priv, enabled);
+ ps_mode = enabled;
- return ret;
+ return mwifiex_drv_set_power(priv, &ps_mode);
}
/*
@@ -177,18 +170,15 @@ mwifiex_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *netdev,
bool multicast)
{
struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
- int ret;
/* Return if WEP key not configured */
if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED)
return 0;
- ret = mwifiex_set_encode(priv, NULL, 0, key_index, 0);
-
- wiphy_dbg(wiphy, "info: set default Tx key index\n");
-
- if (ret)
+ if (mwifiex_set_encode(priv, NULL, 0, key_index, 0)) {
+ wiphy_err(wiphy, "set default Tx key index\n");
return -EFAULT;
+ }
return 0;
}
@@ -202,15 +192,12 @@ mwifiex_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
struct key_params *params)
{
struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
- int ret = 0;
- ret = mwifiex_set_encode(priv, params->key, params->key_len,
- key_index, 0);
-
- wiphy_dbg(wiphy, "info: crypto keys added\n");
-
- if (ret)
+ if (mwifiex_set_encode(priv, params->key, params->key_len,
+ key_index, 0)) {
+ wiphy_err(wiphy, "crypto keys added\n");
return -EFAULT;
+ }
return 0;
}
@@ -235,7 +222,6 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
struct mwifiex_adapter *adapter = priv->adapter;
struct mwifiex_802_11d_domain_reg *domain_info = &adapter->domain_reg;
- int ret = 0;
/* Set country code */
domain_info->country_code[0] = priv->country_code[0];
@@ -290,13 +276,14 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
}
domain_info->no_of_triplet = no_of_triplet;
- /* Send cmd to FW to set domain info */
- ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_802_11D_DOMAIN_INFO,
- HostCmd_ACT_GEN_SET, 0, NULL, NULL);
- if (ret)
+
+ if (mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO,
+ HostCmd_ACT_GEN_SET, 0, NULL)) {
wiphy_err(wiphy, "11D: setting domain info in FW\n");
+ return -1;
+ }
- return ret;
+ return 0;
}
/*
@@ -346,8 +333,6 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
enum nl80211_channel_type channel_type)
{
struct mwifiex_chan_freq_power cfp;
- int ret = 0;
- int status = 0;
struct mwifiex_ds_band_cfg band_cfg;
u32 config_bands = 0;
struct wiphy *wiphy = priv->wdev->wiphy;
@@ -366,15 +351,14 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
band_cfg.config_bands = config_bands;
band_cfg.adhoc_start_band = config_bands;
}
- /* Set channel offset */
+
band_cfg.sec_chan_offset =
mwifiex_cfg80211_channel_type_to_mwifiex_channels
(channel_type);
- status = mwifiex_radio_ioctl_band_cfg(priv, HostCmd_ACT_GEN_SET,
- &band_cfg);
- if (status)
+ if (mwifiex_set_radio_band_cfg(priv, &band_cfg))
return -EFAULT;
+
mwifiex_send_domain_info_cmd_fw(wiphy);
}
@@ -382,20 +366,16 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
"mode %d\n", config_bands, band_cfg.sec_chan_offset,
priv->bss_mode);
if (!chan)
- return ret;
+ return 0;
memset(&cfp, 0, sizeof(cfp));
cfp.freq = chan->center_freq;
- /* Convert frequency to channel */
cfp.channel = ieee80211_frequency_to_channel(chan->center_freq);
- status = mwifiex_bss_ioctl_channel(priv, HostCmd_ACT_GEN_SET, &cfp);
- if (status)
+ if (mwifiex_bss_set_channel(priv, &cfp))
return -EFAULT;
- ret = mwifiex_drv_change_adhoc_chan(priv, cfp.channel);
-
- return ret;
+ return mwifiex_drv_change_adhoc_chan(priv, cfp.channel);
}
/*
@@ -422,67 +402,41 @@ mwifiex_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
/*
* This function sets the fragmentation threshold.
*
- * This function creates an IOCTL request, populates it accordingly
- * and issues an IOCTL.
- *
- * The fragmentation threshold value must lies between MWIFIEX_FRAG_MIN_VALUE
+ * The fragmentation threshold value must lie between MWIFIEX_FRAG_MIN_VALUE
* and MWIFIEX_FRAG_MAX_VALUE.
*/
static int
mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr)
{
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
|| frag_thr > MWIFIEX_FRAG_MAX_VALUE)
return -EINVAL;
- wait = mwifiex_alloc_fill_wait_queue(priv, wait_option);
- if (!wait)
- return -ENOMEM;
-
- 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;
+ /* Send request to firmware */
+ ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
+ HostCmd_ACT_GEN_SET, FRAG_THRESH_I,
+ &frag_thr);
- kfree(wait);
return ret;
}
/*
* This function sets the RTS threshold.
- *
- * This function creates an IOCTL request, populates it accordingly
- * and issues an IOCTL.
+
+ * The rts value must lie between MWIFIEX_RTS_MIN_VALUE
+ * and MWIFIEX_RTS_MAX_VALUE.
*/
static int
mwifiex_set_rts(struct mwifiex_private *priv, u32 rts_thr)
{
- 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)
rts_thr = MWIFIEX_RTS_MAX_VALUE;
- wait = mwifiex_alloc_fill_wait_queue(priv, wait_option);
- if (!wait)
- return -ENOMEM;
-
- 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 mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
+ HostCmd_ACT_GEN_SET, RTS_THRESH_I,
+ &rts_thr);
}
/*
@@ -498,8 +452,11 @@ mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
int ret = 0;
- if (changed & WIPHY_PARAM_RTS_THRESHOLD)
+ if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
ret = mwifiex_set_rts(priv, wiphy->rts_threshold);
+ if (ret)
+ return ret;
+ }
if (changed & WIPHY_PARAM_FRAG_THRESHOLD)
ret = mwifiex_set_frag(priv, wiphy->frag_threshold);
@@ -518,7 +475,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
{
int ret = 0;
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
- struct mwifiex_wait_queue *wait = NULL;
if (priv->bss_mode == type) {
wiphy_warn(wiphy, "already set to required type\n");
@@ -545,24 +501,13 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
return -EINVAL;
}
- wait = mwifiex_alloc_fill_wait_queue(priv, MWIFIEX_IOCTL_WAIT);
- if (!wait)
- return -ENOMEM;
-
- mwifiex_deauthenticate(priv, wait, NULL);
+ mwifiex_deauthenticate(priv, NULL);
priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM;
- ret = mwifiex_prepare_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
- HostCmd_ACT_GEN_SET, 0, wait, NULL);
- if (!ret)
- ret = -EINPROGRESS;
-
- ret = mwifiex_request_ioctl(priv, wait, ret, MWIFIEX_IOCTL_WAIT);
- if (ret)
- ret = -EFAULT;
+ ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_SET_BSS_MODE,
+ HostCmd_ACT_GEN_SET, 0, NULL);
- kfree(wait);
return ret;
}
@@ -592,7 +537,7 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
/* Get signal information from the firmware */
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");
ret = -EFAULT;
}
@@ -623,7 +568,6 @@ mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
u8 *mac, struct station_info *sinfo)
{
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
- int ret = 0;
mwifiex_dump_station_info(priv, sinfo);
@@ -632,10 +576,7 @@ mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
if (memcmp(mac, priv->cfg_bssid, ETH_ALEN))
return -ENOENT;
-
- ret = mwifiex_dump_station_info(priv, sinfo);
-
- return ret;
+ return mwifiex_dump_station_info(priv, sinfo);
}
/* Supported rates to be advertised to the cfg80211 */
@@ -750,7 +691,7 @@ mwifiex_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
return -EBUSY;
priv->disconnect = 1;
- if (mwifiex_disconnect(priv, MWIFIEX_IOCTL_WAIT, NULL))
+ if (mwifiex_deauthenticate(priv, NULL))
return -EFAULT;
wiphy_dbg(wiphy, "info: successfully disconnected from %pM:"
@@ -774,15 +715,13 @@ mwifiex_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
*/
static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
{
- int ret = 0;
struct ieee80211_channel *chan;
struct mwifiex_bss_info bss_info;
int ie_len = 0;
u8 ie_buf[IEEE80211_MAX_SSID_LEN + sizeof(struct ieee_types_header)];
- ret = mwifiex_get_bss_info(priv, &bss_info);
- if (ret)
- return ret;
+ if (mwifiex_get_bss_info(priv, &bss_info))
+ return -1;
ie_buf[0] = WLAN_EID_SSID;
ie_buf[1] = bss_info.ssid.ssid_len;
@@ -801,7 +740,7 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
0, ie_buf, ie_len, 0, GFP_KERNEL);
memcpy(priv->cfg_bssid, bss_info.bssid, ETH_ALEN);
- return ret;
+ return 0;
}
/*
@@ -830,16 +769,15 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv,
struct mwifiex_bssdescriptor *scan_table;
int i, j;
struct ieee80211_channel *chan;
- u8 *ie, *tmp, *ie_buf;
+ u8 *ie, *ie_buf;
u32 ie_len;
- u64 ts = 0;
u8 *beacon;
int beacon_size;
u8 element_id, element_len;
memset(&scan_resp, 0, sizeof(scan_resp));
- if (mwifiex_get_scan_table(priv, MWIFIEX_IOCTL_WAIT, &scan_resp))
- return -