* [PATCH 1/2] mwifiex: cleanup in snmp_mib command preparation code
@ 2012-02-03 4:48 Bing Zhao
2012-02-03 4:48 ` [PATCH 2/2] mwifiex: update correct dtim_period in dump_station() Bing Zhao
0 siblings, 1 reply; 2+ messages in thread
From: Bing Zhao @ 2012-02-03 4:48 UTC (permalink / raw)
To: linux-wireless
Cc: John W. Linville, Amitkumar Karwar, Kiran Divekar, Yogesh Powar,
Avinash Patil, Frank Huang, Bing Zhao
From: Amitkumar Karwar <akarwar@marvell.com>
1) Remove unnecessary switch case usage.
2) Replace "X=cpu_to_le16(le16_to_cpu(X) + Y)" by "le16_add_cpu(X, Y)"
3) Declare "ul_temp" variable as u16 instead of u32 to avoid
unnecessary typecasting
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
drivers/net/wireless/mwifiex/sta_cmd.c | 60 ++++---------------------------
1 files changed, 8 insertions(+), 52 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c
index 6e443ff..324c651 100644
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -103,7 +103,7 @@ static int mwifiex_cmd_mac_control(struct mwifiex_private *priv,
static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv,
struct host_cmd_ds_command *cmd,
u16 cmd_action, u32 cmd_oid,
- u32 *ul_temp)
+ u16 *ul_temp)
{
struct host_cmd_ds_802_11_snmp_mib *snmp_mib = &cmd->params.smib;
@@ -112,62 +112,18 @@ static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv,
cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_snmp_mib)
- 1 + S_DS_GEN);
+ snmp_mib->oid = cpu_to_le16((u16)cmd_oid);
if (cmd_action == HostCmd_ACT_GEN_GET) {
snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_GET);
snmp_mib->buf_size = cpu_to_le16(MAX_SNMP_BUF_SIZE);
- cmd->size = cpu_to_le16(le16_to_cpu(cmd->size)
- + MAX_SNMP_BUF_SIZE);
+ le16_add_cpu(&cmd->size, MAX_SNMP_BUF_SIZE);
+ } else if (cmd_action == HostCmd_ACT_GEN_SET) {
+ snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET);
+ snmp_mib->buf_size = cpu_to_le16(sizeof(u16));
+ *((__le16 *) (snmp_mib->value)) = cpu_to_le16(*ul_temp);
+ le16_add_cpu(&cmd->size, sizeof(u16));
}
- switch (cmd_oid) {
- case FRAG_THRESH_I:
- snmp_mib->oid = cpu_to_le16((u16) FRAG_THRESH_I);
- if (cmd_action == HostCmd_ACT_GEN_SET) {
- snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET);
- snmp_mib->buf_size = cpu_to_le16(sizeof(u16));
- *((__le16 *) (snmp_mib->value)) =
- cpu_to_le16((u16) *ul_temp);
- cmd->size = cpu_to_le16(le16_to_cpu(cmd->size)
- + sizeof(u16));
- }
- break;
- case RTS_THRESH_I:
- snmp_mib->oid = cpu_to_le16((u16) RTS_THRESH_I);
- if (cmd_action == HostCmd_ACT_GEN_SET) {
- snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET);
- snmp_mib->buf_size = cpu_to_le16(sizeof(u16));
- *(__le16 *) (snmp_mib->value) =
- cpu_to_le16((u16) *ul_temp);
- cmd->size = cpu_to_le16(le16_to_cpu(cmd->size)
- + sizeof(u16));
- }
- break;
-
- case SHORT_RETRY_LIM_I:
- snmp_mib->oid = cpu_to_le16((u16) SHORT_RETRY_LIM_I);
- if (cmd_action == HostCmd_ACT_GEN_SET) {
- snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET);
- snmp_mib->buf_size = cpu_to_le16(sizeof(u16));
- *((__le16 *) (snmp_mib->value)) =
- cpu_to_le16((u16) *ul_temp);
- cmd->size = cpu_to_le16(le16_to_cpu(cmd->size)
- + sizeof(u16));
- }
- break;
- case DOT11D_I:
- snmp_mib->oid = cpu_to_le16((u16) DOT11D_I);
- if (cmd_action == HostCmd_ACT_GEN_SET) {
- snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET);
- snmp_mib->buf_size = cpu_to_le16(sizeof(u16));
- *((__le16 *) (snmp_mib->value)) =
- cpu_to_le16((u16) *ul_temp);
- cmd->size = cpu_to_le16(le16_to_cpu(cmd->size)
- + sizeof(u16));
- }
- break;
- default:
- break;
- }
dev_dbg(priv->adapter->dev,
"cmd: SNMP_CMD: Action=0x%x, OID=0x%x, OIDSize=0x%x,"
" Value=0x%x\n",
--
1.7.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] mwifiex: update correct dtim_period in dump_station()
2012-02-03 4:48 [PATCH 1/2] mwifiex: cleanup in snmp_mib command preparation code Bing Zhao
@ 2012-02-03 4:48 ` Bing Zhao
0 siblings, 0 replies; 2+ messages in thread
From: Bing Zhao @ 2012-02-03 4:48 UTC (permalink / raw)
To: linux-wireless
Cc: John W. Linville, Amitkumar Karwar, Kiran Divekar, Yogesh Powar,
Avinash Patil, Frank Huang, Bing Zhao
From: Amitkumar Karwar <akarwar@marvell.com>
Earlier we were using dtim period extracted from scan response
buffer provided by FW in scan operation. But it is observed that
sometimes the buffer doesn't contain dtim period tlv, and wrong
value (0) was sent to user space.
After association FW will start listening to beacon frames of
connected AP and store dtim period. Therefore we can get it from
FW in dump_station() instead of using wrong value obtained in
scanning.
Redundant code after adapting new approach for dtim period is
also removed in this patch.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
drivers/net/wireless/mwifiex/cfg80211.c | 8 ++++++--
drivers/net/wireless/mwifiex/main.h | 2 +-
drivers/net/wireless/mwifiex/scan.c | 6 ------
drivers/net/wireless/mwifiex/sta_cmdresp.c | 3 +++
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 54e45c8..478d2f1 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -539,6 +539,11 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
ret = -EFAULT;
}
+ /* Get DTIM period information from firmware */
+ mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
+ HostCmd_ACT_GEN_GET, DTIM_PERIOD_I,
+ &priv->dtim_period);
+
/*
* Bit 0 in tx_htinfo indicates that current Tx rate is 11n rate. Valid
* MCS index values for us are 0 to 7.
@@ -573,8 +578,7 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
WLAN_CAPABILITY_SHORT_SLOT_TIME)
sinfo->bss_param.flags |=
BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
- sinfo->bss_param.dtim_period =
- priv->curr_bss_params.bss_descriptor.dtim_period;
+ sinfo->bss_param.dtim_period = priv->dtim_period;
sinfo->bss_param.beacon_interval =
priv->curr_bss_params.bss_descriptor.beacon_period;
}
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 3dc0f72..52810b1 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -249,7 +249,6 @@ struct mwifiex_bssdescriptor {
u32 channel;
u32 freq;
u16 beacon_period;
- u8 dtim_period;
u8 erp_flags;
u32 bss_mode;
u8 supported_rates[MWIFIEX_SUPPORTED_RATES];
@@ -392,6 +391,7 @@ struct mwifiex_private {
u8 prev_bssid[ETH_ALEN];
struct mwifiex_current_bss_params curr_bss_params;
u16 beacon_period;
+ u8 dtim_period;
u16 listen_interval;
u16 atim_window;
u8 adhoc_channel;
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 1352085..98f1ca9 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1086,7 +1086,6 @@ mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
struct ieee_types_vendor_specific *vendor_ie;
const u8 wpa_oui[4] = { 0x00, 0x50, 0xf2, 0x01 };
const u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 };
- struct ieee80211_tim_ie *tim_ie;
found_data_rate_ie = false;
rate_size = 0;
@@ -1259,11 +1258,6 @@ mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
sizeof(struct ieee_types_header) -
bss_entry->beacon_buf);
break;
- case WLAN_EID_TIM:
- tim_ie = (void *) (current_ptr +
- sizeof(struct ieee_types_header));
- bss_entry->dtim_period = tim_ie->dtim_period;
- break;
default:
break;
}
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index e812db8..0d8618a 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -210,6 +210,9 @@ static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv,
dev_dbg(priv->adapter->dev,
"info: SNMP_RESP: TxRetryCount=%u\n", ul_temp);
break;
+ case DTIM_PERIOD_I:
+ dev_dbg(priv->adapter->dev,
+ "info: SNMP_RESP: DTIM period=%u\n", ul_temp);
default:
break;
}
--
1.7.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-03 4:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-03 4:48 [PATCH 1/2] mwifiex: cleanup in snmp_mib command preparation code Bing Zhao
2012-02-03 4:48 ` [PATCH 2/2] mwifiex: update correct dtim_period in dump_station() Bing Zhao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).