Release 5.90.125.48 Add regulatory domain check in cfg80211 driver and fix PNO issues
Lin Ma [Wed, 20 Jul 2011 01:20:12 +0000 (18:20 -0700)]
Change-Id: I394f4eb017ca61861f16632e8998a8fb07e6fca7
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>

drivers/net/wireless/bcmdhd/dhd_common.c
drivers/net/wireless/bcmdhd/include/epivers.h
drivers/net/wireless/bcmdhd/include/wlioctl.h
drivers/net/wireless/bcmdhd/wl_cfg80211.c

index 1fbc283..2e6a53e 100644 (file)
@@ -1994,7 +1994,7 @@ dhd_iscan_get_partial_result(void *dhdp, uint *scan_count)
        results->version = dtoh32(results->version);
        *scan_count = results->count = dtoh32(results->count);
        status = dtoh32(list_buf->status);
-       DHD_ISCAN(("%s: Got %d resuls\n", __FUNCTION__, results->count));
+       DHD_ISCAN(("%s: Got %d resuls status = (%x)\n", __FUNCTION__, results->count, status));
 
        dhd_iscan_unlock();
 
@@ -2178,6 +2178,7 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr,
                DHD_ERROR(("%s failed error=%d\n", __FUNCTION__, err));
                return err;
        }
+       memset(iovbuf, 0, sizeof(iovbuf));
        memset(&pfn_param, 0, sizeof(pfn_param));
        memset(&pfn_element, 0, sizeof(pfn_element));
 
@@ -2188,8 +2189,8 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr,
        /* check and set extra pno params */
        if ((pno_repeat != 0) || (pno_freq_expo_max != 0)) {
                pfn_param.flags |= htod16(ENABLE << ENABLE_ADAPTSCAN_BIT);
-               pfn_param.repeat = htod32(pno_repeat);
-               pfn_param.exp = htod32(pno_freq_expo_max);
+               pfn_param.repeat = (uchar) (pno_repeat);
+               pfn_param.exp = (uchar) (pno_freq_expo_max);
        }
        /* set up pno scan fr */
        if (scan_fr  != 0)
@@ -2203,8 +2204,13 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr,
                DHD_ERROR(("%s pno freq less %d sec\n", __FUNCTION__, PNO_SCAN_MIN_FW_SEC));
                return err;
        }
+
        len = bcm_mkiovar("pfn_set", (char *)&pfn_param, sizeof(pfn_param), iovbuf, sizeof(iovbuf));
-       dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, len, TRUE, 0);
+       if ((err = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, len, TRUE, 0)) < 0) {
+                               DHD_ERROR(("%s pfn_set failed for error=%d\n",
+                                       __FUNCTION__, err));
+                               return err;
+       }
 
        /* set all pfn ssid */
        for (i = 0; i < nssid; i++) {
index f8623f0..3dfcc15 100644 (file)
 
 #define        EPI_RC_NUMBER           125
 
-#define        EPI_INCREMENTAL_NUMBER  33
+#define        EPI_INCREMENTAL_NUMBER  48
 
 #define        EPI_BUILD_NUMBER        0
 
-#define        EPI_VERSION             5, 90, 125, 33
+#define        EPI_VERSION             5, 90, 125, 48
 
-#define        EPI_VERSION_NUM         0x055a7d21
+#define        EPI_VERSION_NUM         0x055a7d30
 
 #define EPI_VERSION_DEV                5.90.125
 
 
-#define        EPI_VERSION_STR         "5.90.125.33"
+#define        EPI_VERSION_STR         "5.90.125.48"
 
 #endif 
index 2f5e9e1..f1af5b1 100644 (file)
@@ -1238,6 +1238,12 @@ typedef struct wl_po {
 #define WL_CHAN_FREQ_RANGE_5GMH_VER2    7
 #define WL_CHAN_FREQ_RANGE_5GH_VER2     8
 
+#define WL_CHAN_FREQ_RANGE_5GLL_5BAND    4
+#define WL_CHAN_FREQ_RANGE_5GLH_5BAND    5
+#define WL_CHAN_FREQ_RANGE_5GML_5BAND    6
+#define WL_CHAN_FREQ_RANGE_5GMH_5BAND    7
+#define WL_CHAN_FREQ_RANGE_5GH_5BAND     8
+
 
 #define WLC_PHY_TYPE_A      0
 #define WLC_PHY_TYPE_B      1
@@ -1765,7 +1771,8 @@ enum {
 enum {
        OFF_ADAPT,
        SMART_ADAPT,
-       STRICT_ADAPT
+       STRICT_ADAPT,
+       SLOW_ADAPT
 };
 
 #define SORT_CRITERIA_BIT              0
@@ -1775,14 +1782,16 @@ enum {
 #define        AUTO_CONNECT_BIT                4
 #define        ENABLE_BD_SCAN_BIT              5
 #define ENABLE_ADAPTSCAN_BIT   6
+#define IMMEDIATE_EVENT_BIT            8
 
-#define SORT_CRITERIA_MASK             0x01
-#define AUTO_NET_SWITCH_MASK   0x02
-#define ENABLE_BKGRD_SCAN_MASK 0x04
-#define IMMEDIATE_SCAN_MASK            0x08
-#define        AUTO_CONNECT_MASK               0x10
-#define ENABLE_BD_SCAN_MASK            0x20
-#define ENABLE_ADAPTSCAN_MASK  0xc0
+#define SORT_CRITERIA_MASK             0x0001
+#define AUTO_NET_SWITCH_MASK   0x0002
+#define ENABLE_BKGRD_SCAN_MASK 0x0004
+#define IMMEDIATE_SCAN_MASK            0x0008
+#define        AUTO_CONNECT_MASK               0x0010
+#define ENABLE_BD_SCAN_MASK            0x0020
+#define ENABLE_ADAPTSCAN_MASK  0x00c0
+#define IMMEDIATE_EVENT_MASK   0x0100
 
 #define PFN_VERSION                            2
 #define PFN_SCANRESULT_VERSION 1
@@ -1828,6 +1837,7 @@ typedef struct wl_pfn_param {
        uint8 mscan; 
        uint8 repeat; 
        uint8 exp; 
+       int32 slow_freq;
 } wl_pfn_param_t;
 
 typedef struct wl_pfn_bssid {
index d0b82ab..201cb61 100644 (file)
@@ -125,6 +125,44 @@ static ctl_table wl_sysctl_table[] = {
 static struct ctl_table_header *wl_sysctl_hdr;
 #endif /* CONFIG_SYSCTL */ 
 
+/* This is to override regulatory domains defined in cfg80211 module (reg.c)
+ * By default world regulatory domain defined in reg.c puts the flags NL80211_RRF_PASSIVE_SCAN
+ * and NL80211_RRF_NO_IBSS for 5GHz channels (for 36..48 and 149..165).
+ * With respect to these flags, wpa_supplicant doesn't start p2p operations on 5GHz channels.
+ * All the chnages in world regulatory domain are to be done here.
+ */
+static const struct ieee80211_regdomain brcm_regdom = {
+       .n_reg_rules = 5,
+       .alpha2 =  "99",
+       .reg_rules = {
+               /* IEEE 802.11b/g, channels 1..11 */
+               REG_RULE(2412-10, 2462+10, 40, 6, 20, 0),
+               /* IEEE 802.11b/g, channels 12..13. No HT40
+                * channel fits here. */
+               REG_RULE(2467-10, 2472+10, 20, 6, 20,
+                       NL80211_RRF_PASSIVE_SCAN |
+                       NL80211_RRF_NO_IBSS),
+               /* IEEE 802.11 channel 14 - Only JP enables
+                * this and for 802.11b only */
+               REG_RULE(2484-10, 2484+10, 20, 6, 20,
+                       NL80211_RRF_PASSIVE_SCAN |
+                       NL80211_RRF_NO_IBSS |
+                       NL80211_RRF_NO_OFDM),
+               /* IEEE 802.11a, channel 36..48 */
+               REG_RULE(5180-10, 5240+10, 40, 6, 20, 0
+                        /*NL80211_RRF_PASSIVE_SCAN |
+                        NL80211_RRF_NO_IBSS*/),
+
+               /* NB: 5260 MHz - 5700 MHz requies DFS */
+
+               /* IEEE 802.11a, channel 149..165 */
+               REG_RULE(5745-10, 5825+10, 40, 6, 20, 0
+                       /*NL80211_RRF_PASSIVE_SCAN |
+                       NL80211_RRF_NO_IBSS*/),
+       }
+};
+
+
 /* Data Element Definitions */
 #define WPS_ID_CONFIG_METHODS     0x1008
 #define WPS_ID_REQ_TYPE           0x103A
@@ -2021,7 +2059,7 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
                }
 
        } else {
-               WL_ERR(("No P2PIE in beacon \n"));
+               WL_INFO(("No P2PIE in beacon \n"));
        }
 
        if (unlikely(!sme->ssid)) {
@@ -2072,7 +2110,7 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
        WL_DBG(("join_param_size %d\n", join_params_size));
 
        if (join_params.ssid.SSID_len < IEEE80211_MAX_SSID_LEN) {
-               WL_ERR(("ssid \"%s\", len (%d)\n", join_params.ssid.SSID,
+               WL_INFO(("ssid \"%s\", len (%d)\n", join_params.ssid.SSID,
                        join_params.ssid.SSID_len));
        }
        err = wldev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size, false);
@@ -3000,7 +3038,7 @@ wl_cfg80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
                WL_ERR(("Can not find the bssidx for dev( %p )\n", dev));
                return -ENODEV;
        }
-       if (p2p_on(wl)) {
+       if (wl->p2p_supported && p2p_on(wl)) {
                wl_cfgp2p_generate_bss_mac(&dhd->mac, &wl->p2p->dev_addr, &wl->p2p->int_addr);
           /* Suspend P2P discovery search-listen to prevent it from changing the
                * channel.
@@ -3849,6 +3887,11 @@ static struct wireless_dev *wl_alloc_wdev(s32 sizeof_iface,
                WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS |
 #endif
                WIPHY_FLAG_4ADDR_STATION;
+
+       WL_DBG(("Registering custom regulatory)\n"));
+       wdev->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
+       wiphy_apply_custom_regulatory(wdev->wiphy, &brcm_regdom);
+       /* Now we can register wiphy with cfg80211 module */
        err = wiphy_register(wdev->wiphy);
        if (unlikely(err < 0)) {
                WL_ERR(("Couldn not register wiphy device (%d)\n", err));