aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/scan.c
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2012-04-17 00:36:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-17 14:57:15 -0400
commitb5abcf0219263f4e961dca71cbe26e06c5b0ee68 (patch)
tree8e8898fd6b41a13a24098b762d2f2be8a50869c0 /drivers/net/wireless/mwifiex/scan.c
parent9558a407dd00f6cd7f93b923768e8ee255fa4444 (diff)
mwifiex: corrections in timestamp related code
We get two timing related fields for each bss from firmware in scan results. 1) timestamp - Actual timestamp information in probe response/beacon 2) network_tsf - firmware's TSF value at the time the beacon or probe response was received. Both are needed while associating by firmware. The patch takes care of following things. 1) We should pass "timestamp" to cfg80211_inform_bss(), but currently "network_tsf" is being provided. This error is corrected here. 2) Rename "network_tsf" to "fw_tsf" 3) Make use of u64 variable instead of an array of u8/u32 to save parsed "timestamp" information. 4) Use timestamp provided to stack in scan results using cfg80211_inform_bss() while associating. (bss->tsf) 5) Allocate space to save fw_tsf in "priv" of cfg80211_bss and retrieve it while associating. 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.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index f6bec2f4ae53..74f045715723 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1603,14 +1603,16 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1603 const u8 *ie_buf; 1603 const u8 *ie_buf;
1604 size_t ie_len; 1604 size_t ie_len;
1605 u16 channel = 0; 1605 u16 channel = 0;
1606 u64 network_tsf = 0; 1606 u64 fw_tsf = 0;
1607 u16 beacon_size = 0; 1607 u16 beacon_size = 0;
1608 u32 curr_bcn_bytes; 1608 u32 curr_bcn_bytes;
1609 u32 freq; 1609 u32 freq;
1610 u16 beacon_period; 1610 u16 beacon_period;
1611 u16 cap_info_bitmap; 1611 u16 cap_info_bitmap;
1612 u8 *current_ptr; 1612 u8 *current_ptr;
1613 u64 timestamp;
1613 struct mwifiex_bcn_param *bcn_param; 1614 struct mwifiex_bcn_param *bcn_param;
1615 struct mwifiex_bss_priv *bss_priv;
1614 1616
1615 if (bytes_left >= sizeof(beacon_size)) { 1617 if (bytes_left >= sizeof(beacon_size)) {
1616 /* Extract & convert beacon size from command buffer */ 1618 /* Extract & convert beacon size from command buffer */
@@ -1654,6 +1656,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1654 rssi = (-rssi) * 100; /* Convert dBm to mBm */ 1656 rssi = (-rssi) * 100; /* Convert dBm to mBm */
1655 dev_dbg(adapter->dev, "info: InterpretIE: RSSI=%d\n", rssi); 1657 dev_dbg(adapter->dev, "info: InterpretIE: RSSI=%d\n", rssi);
1656 1658
1659 timestamp = le64_to_cpu(bcn_param->timestamp);
1657 beacon_period = le16_to_cpu(bcn_param->beacon_period); 1660 beacon_period = le16_to_cpu(bcn_param->beacon_period);
1658 1661
1659 cap_info_bitmap = le16_to_cpu(bcn_param->cap_info_bitmap); 1662 cap_info_bitmap = le16_to_cpu(bcn_param->cap_info_bitmap);
@@ -1693,14 +1696,13 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1693 1696
1694 /* 1697 /*
1695 * If the TSF TLV was appended to the scan results, save this 1698 * If the TSF TLV was appended to the scan results, save this
1696 * entry's TSF value in the networkTSF field.The networkTSF is 1699 * entry's TSF value in the fw_tsf field. It is the firmware's
1697 * the firmware's TSF value at the time the beacon or probe 1700 * TSF value at the time the beacon or probe response was
1698 * response was received. 1701 * received.
1699 */ 1702 */
1700 if (tsf_tlv) 1703 if (tsf_tlv)
1701 memcpy(&network_tsf, 1704 memcpy(&fw_tsf, &tsf_tlv->tsf_data[idx * TSF_DATA_SIZE],
1702 &tsf_tlv->tsf_data[idx * TSF_DATA_SIZE], 1705 sizeof(fw_tsf));
1703 sizeof(network_tsf));
1704 1706
1705 if (channel) { 1707 if (channel) {
1706 struct ieee80211_channel *chan; 1708 struct ieee80211_channel *chan;
@@ -1723,10 +1725,12 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1723 1725
1724 if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { 1726 if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
1725 bss = cfg80211_inform_bss(priv->wdev->wiphy, 1727 bss = cfg80211_inform_bss(priv->wdev->wiphy,
1726 chan, bssid, network_tsf, 1728 chan, bssid, timestamp,
1727 cap_info_bitmap, beacon_period, 1729 cap_info_bitmap, beacon_period,
1728 ie_buf, ie_len, rssi, GFP_KERNEL); 1730 ie_buf, ie_len, rssi, GFP_KERNEL);
1729 *(u8 *)bss->priv = band; 1731 bss_priv = (struct mwifiex_bss_priv *)bss->priv;
1732 bss_priv->band = band;
1733 bss_priv->fw_tsf = fw_tsf;
1730 if (priv->media_connected && 1734 if (priv->media_connected &&
1731 !memcmp(bssid, 1735 !memcmp(bssid,
1732 priv->curr_bss_params.bss_descriptor 1736 priv->curr_bss_params.bss_descriptor