summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mwifiex/scan.c
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2014-02-08 04:23:34 +0400
committerJohn W. Linville <linville@tuxdriver.com>2014-02-13 00:36:11 +0400
commitb8b3ecec91f106e2f26ac2e24dcda21f63336286 (patch)
treedfc3a11fd66bd7cb625926c3ad185a930c29f8fb /drivers/net/wireless/mwifiex/scan.c
parentf25b14315e8084efbcc5c672cec8ee1f691dc2fd (diff)
downloadlinux-b8b3ecec91f106e2f26ac2e24dcda21f63336286.tar.xz
mwifiex: change beacon parameter structure
'mwifiex_bcn_param' structure contains five parameters which are present in beacon buffer in case of legacy scan. 'rssi' field won't be there in this buffer for extended scan. Hence 'bssid' and 'rssi' are removed from the structure and it is renamed as 'mwifiex_fixed_bcn_param' so that we can have common parsing logic later for both. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/scan.c')
-rw-r--r--drivers/net/wireless/mwifiex/scan.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 0a8a26e10f01..b0be830aa342 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1689,7 +1689,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
u16 cap_info_bitmap;
u8 *current_ptr;
u64 timestamp;
- struct mwifiex_bcn_param *bcn_param;
+ struct mwifiex_fixed_bcn_param *bcn_param;
struct mwifiex_bss_priv *bss_priv;
if (bytes_left >= sizeof(beacon_size)) {
@@ -1716,25 +1716,30 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
curr_bcn_bytes = beacon_size;
- /*
- * First 5 fields are bssid, RSSI, time stamp, beacon interval,
- * and capability information
+ /* First 5 fields are bssid, RSSI(for legacy scan only),
+ * time stamp, beacon interval, and capability information
*/
- if (curr_bcn_bytes < sizeof(struct mwifiex_bcn_param)) {
+ if (curr_bcn_bytes < ETH_ALEN + sizeof(u8) +
+ sizeof(struct mwifiex_fixed_bcn_param)) {
dev_err(adapter->dev,
"InterpretIE: not enough bytes left\n");
continue;
}
- bcn_param = (struct mwifiex_bcn_param *)current_ptr;
- current_ptr += sizeof(*bcn_param);
- curr_bcn_bytes -= sizeof(*bcn_param);
- memcpy(bssid, bcn_param->bssid, ETH_ALEN);
+ memcpy(bssid, current_ptr, ETH_ALEN);
+ current_ptr += ETH_ALEN;
+ curr_bcn_bytes -= ETH_ALEN;
- rssi = (s32) bcn_param->rssi;
+ rssi = (s32) *(u8 *)current_ptr;
rssi = (-rssi) * 100; /* Convert dBm to mBm */
+ current_ptr += sizeof(u8);
+ curr_bcn_bytes -= sizeof(u8);
dev_dbg(adapter->dev, "info: InterpretIE: RSSI=%d\n", rssi);
+ bcn_param = (struct mwifiex_fixed_bcn_param *)current_ptr;
+ current_ptr += sizeof(*bcn_param);
+ curr_bcn_bytes -= sizeof(*bcn_param);
+
timestamp = le64_to_cpu(bcn_param->timestamp);
beacon_period = le16_to_cpu(bcn_param->beacon_period);