~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to drivers/net/wireless/mwifiex/scan.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
1048
1048
 * This function parses provided beacon buffer and updates
1049
1049
 * respective fields in bss descriptor structure.
1050
1050
 */
1051
 
int
1052
 
mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
1053
 
                                struct mwifiex_bssdescriptor *bss_entry,
1054
 
                                u8 *ie_buf, u32 ie_len)
 
1051
int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
 
1052
                                    struct mwifiex_bssdescriptor *bss_entry)
1055
1053
{
1056
1054
        int ret = 0;
1057
1055
        u8 element_id;
1073
1071
 
1074
1072
        found_data_rate_ie = false;
1075
1073
        rate_size = 0;
1076
 
        current_ptr = ie_buf;
1077
 
        bytes_left = ie_len;
1078
 
        bss_entry->beacon_buf = ie_buf;
1079
 
        bss_entry->beacon_buf_size = ie_len;
 
1074
        current_ptr = bss_entry->beacon_buf;
 
1075
        bytes_left = bss_entry->beacon_buf_size;
1080
1076
 
1081
1077
        /* Process variable IE */
1082
1078
        while (bytes_left >= 2) {
1447
1443
        return ret;
1448
1444
}
1449
1445
 
1450
 
static int
1451
 
mwifiex_update_curr_bss_params(struct mwifiex_private *priv, u8 *bssid,
1452
 
                               s32 rssi, const u8 *ie_buf, size_t ie_len,
1453
 
                               u16 beacon_period, u16 cap_info_bitmap, u8 band)
 
1446
static int mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
 
1447
                                          struct cfg80211_bss *bss)
1454
1448
{
1455
1449
        struct mwifiex_bssdescriptor *bss_desc;
1456
1450
        int ret;
1457
1451
        unsigned long flags;
1458
 
        u8 *beacon_ie;
1459
1452
 
1460
1453
        /* Allocate and fill new bss descriptor */
1461
1454
        bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor),
1465
1458
                return -ENOMEM;
1466
1459
        }
1467
1460
 
1468
 
        beacon_ie = kmemdup(ie_buf, ie_len, GFP_KERNEL);
1469
 
        if (!beacon_ie) {
1470
 
                kfree(bss_desc);
1471
 
                dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n");
1472
 
                return -ENOMEM;
1473
 
        }
1474
 
 
1475
 
        ret = mwifiex_fill_new_bss_desc(priv, bssid, rssi, beacon_ie,
1476
 
                                        ie_len, beacon_period,
1477
 
                                        cap_info_bitmap, band, bss_desc);
 
1461
        ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc);
1478
1462
        if (ret)
1479
1463
                goto done;
1480
1464
 
1514
1498
 
1515
1499
done:
1516
1500
        kfree(bss_desc);
1517
 
        kfree(beacon_ie);
1518
1501
        return 0;
1519
1502
}
1520
1503
 
1620
1603
                const u8 *ie_buf;
1621
1604
                size_t ie_len;
1622
1605
                u16 channel = 0;
1623
 
                u64 network_tsf = 0;
 
1606
                u64 fw_tsf = 0;
1624
1607
                u16 beacon_size = 0;
1625
1608
                u32 curr_bcn_bytes;
1626
1609
                u32 freq;
1627
1610
                u16 beacon_period;
1628
1611
                u16 cap_info_bitmap;
1629
1612
                u8 *current_ptr;
 
1613
                u64 timestamp;
1630
1614
                struct mwifiex_bcn_param *bcn_param;
 
1615
                struct mwifiex_bss_priv *bss_priv;
1631
1616
 
1632
1617
                if (bytes_left >= sizeof(beacon_size)) {
1633
1618
                        /* Extract & convert beacon size from command buffer */
1667
1652
 
1668
1653
                memcpy(bssid, bcn_param->bssid, ETH_ALEN);
1669
1654
 
1670
 
                rssi = (s32) (bcn_param->rssi);
1671
 
                dev_dbg(adapter->dev, "info: InterpretIE: RSSI=%02X\n", rssi);
 
1655
                rssi = (s32) bcn_param->rssi;
 
1656
                rssi = (-rssi) * 100;           /* Convert dBm to mBm */
 
1657
                dev_dbg(adapter->dev, "info: InterpretIE: RSSI=%d\n", rssi);
1672
1658
 
 
1659
                timestamp = le64_to_cpu(bcn_param->timestamp);
1673
1660
                beacon_period = le16_to_cpu(bcn_param->beacon_period);
1674
1661
 
1675
1662
                cap_info_bitmap = le16_to_cpu(bcn_param->cap_info_bitmap);
1709
1696
 
1710
1697
                /*
1711
1698
                 * If the TSF TLV was appended to the scan results, save this
1712
 
                 * entry's TSF value in the networkTSF field.The networkTSF is
1713
 
                 * the firmware's TSF value at the time the beacon or probe
1714
 
                 * response was received.
 
1699
                 * entry's TSF value in the fw_tsf field. It is the firmware's
 
1700
                 * TSF value at the time the beacon or probe response was
 
1701
                 * received.
1715
1702
                 */
1716
1703
                if (tsf_tlv)
1717
 
                        memcpy(&network_tsf,
1718
 
                               &tsf_tlv->tsf_data[idx * TSF_DATA_SIZE],
1719
 
                               sizeof(network_tsf));
 
1704
                        memcpy(&fw_tsf, &tsf_tlv->tsf_data[idx * TSF_DATA_SIZE],
 
1705
                               sizeof(fw_tsf));
1720
1706
 
1721
1707
                if (channel) {
1722
1708
                        struct ieee80211_channel *chan;
1739
1725
 
1740
1726
                        if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
1741
1727
                                bss = cfg80211_inform_bss(priv->wdev->wiphy,
1742
 
                                              chan, bssid, network_tsf,
 
1728
                                              chan, bssid, timestamp,
1743
1729
                                              cap_info_bitmap, beacon_period,
1744
1730
                                              ie_buf, ie_len, rssi, GFP_KERNEL);
1745
 
                                *(u8 *)bss->priv = band;
1746
 
                                cfg80211_put_bss(bss);
1747
 
 
 
1731
                                bss_priv = (struct mwifiex_bss_priv *)bss->priv;
 
1732
                                bss_priv->band = band;
 
1733
                                bss_priv->fw_tsf = fw_tsf;
1748
1734
                                if (priv->media_connected &&
1749
1735
                                    !memcmp(bssid,
1750
1736
                                            priv->curr_bss_params.bss_descriptor
1751
1737
                                            .mac_address, ETH_ALEN))
1752
 
                                        mwifiex_update_curr_bss_params
1753
 
                                                        (priv, bssid, rssi,
1754
 
                                                         ie_buf, ie_len,
1755
 
                                                         beacon_period,
1756
 
                                                         cap_info_bitmap, band);
 
1738
                                        mwifiex_update_curr_bss_params(priv,
 
1739
                                                                       bss);
 
1740
                                cfg80211_put_bss(bss);
1757
1741
                        }
1758
1742
                } else {
1759
1743
                        dev_dbg(adapter->dev, "missing BSS channel IE\n");