temp revert rk change
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / bcm4329 / wl_iw.c
index 146dffd529764dab9e4257b9d633146e12cc6ca6..230619d901ec13187a13470a85350c0dfc259507 100644 (file)
@@ -21,7 +21,7 @@
  * software in any way with any other Broadcom software provided under a license
  * other than the GPL, without Broadcom's express prior written consent.
  *
- * $Id: wl_iw.c,v 1.51.4.9.2.6.4.142.4.69 2010/12/21 03:00:08 Exp $
+ * $Id: wl_iw.c,v 1.51.4.9.2.6.4.142.4.78 2011/02/11 21:27:52 Exp $
  */
 
 
@@ -54,10 +54,11 @@ typedef const struct si_pub  si_t;
 #define WL_INFORM(x)
 #define WL_WSEC(x)
 #define WL_SCAN(x)
+#define WL_PNO(x)
 #define WL_TRACE_COEX(x)
 
 #include <wl_iw.h>
-#include <linux/wakelock.h>
+
 
 
 #ifndef IW_ENCODE_ALG_SM4
@@ -115,10 +116,6 @@ static int         g_onoff = G_WLAN_SET_ON;
 wl_iw_extra_params_t   g_wl_iw_params;
 static struct mutex    wl_cache_lock;
 
-#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY
-static bool use_non_dfs_channels = true;
-#endif
-
 extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
        uint32 reason, char* stringBuf, uint buflen);
 #include <bcmsdbus.h>
@@ -161,12 +158,13 @@ extern int dhd_wait_pend8021x(struct net_device *dev);
 #endif 
 
 static void *g_scan = NULL;
-static volatile uint g_scan_specified_ssid;    
-static wlc_ssid_t g_specific_ssid;             
+static volatile uint g_scan_specified_ssid;
+static wlc_ssid_t g_specific_ssid;
 
 static wlc_ssid_t g_ssid;
 
-static wl_iw_ss_cache_ctrl_t g_ss_cache_ctrl;  
+bool btcoex_is_sco_active(struct net_device *dev);
+static wl_iw_ss_cache_ctrl_t g_ss_cache_ctrl;
 #if defined(CONFIG_FIRST_SCAN)
 static volatile uint g_first_broadcast_scan;
 static volatile uint g_first_counter_scans;
@@ -594,6 +592,36 @@ wl_iw_set_passive_scan(
        return error;
 }
 
+
+static int
+wl_iw_set_txpower(
+       struct net_device *dev,
+       struct iw_request_info *info,
+       union iwreq_data *wrqu,
+       char *extra
+)
+{
+       int error = 0;
+       char *p = extra;
+       int txpower = -1;
+
+       txpower = bcm_atoi(extra + strlen(TXPOWER_SET_CMD) + 1);
+       if ((txpower >= 0) && (txpower <= 127)) {
+               txpower |= WL_TXPWR_OVERRIDE;
+               txpower = htod32(txpower);
+
+               error = dev_wlc_intvar_set(dev, "qtxpower", txpower);
+               p += snprintf(p, MAX_WX_STRING, "OK");
+               WL_TRACE(("%s: set TXpower 0x%X is OK\n", __FUNCTION__, txpower));
+       } else {
+               WL_ERROR(("%s: set tx power failed\n", __FUNCTION__));
+               p += snprintf(p, MAX_WX_STRING, "FAIL");
+       }
+
+       wrqu->data.length = p - extra + 1;
+       return error;
+}
+
 static int
 wl_iw_get_macaddr(
        struct net_device *dev,
@@ -619,31 +647,6 @@ wl_iw_get_macaddr(
        return error;
 }
 
-static int
-wl_iw_set_country_code(struct net_device *dev, char *ccode)
-{
-       char country_code[WLC_CNTRY_BUF_SZ];
-       int ret = -1;
-
-       WL_TRACE(("%s\n", __FUNCTION__));
-       if (!ccode)
-               ccode = dhd_bus_country_get(dev);
-       strncpy(country_code, ccode, sizeof(country_code));
-       if (ccode && (country_code[0] != 0)) {
-#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY
-               if (use_non_dfs_channels && !strncmp(country_code, "US", 2))
-                       strncpy(country_code, "Q2", WLC_CNTRY_BUF_SZ);
-               if (!use_non_dfs_channels && !strncmp(country_code, "Q2", 2))
-                       strncpy(country_code, "US", WLC_CNTRY_BUF_SZ);
-#endif
-               ret = dev_wlc_ioctl(dev, WLC_SET_COUNTRY, &country_code, sizeof(country_code));
-               if (ret >= 0) {
-                       WL_TRACE(("%s: set country %s OK\n", __FUNCTION__, country_code));
-                       dhd_bus_country_set(dev, &country_code[0]);
-               }
-       }
-       return ret;
-}
 
 static int
 wl_iw_set_country(
@@ -658,25 +661,39 @@ wl_iw_set_country(
        char *p = extra;
        int country_offset;
        int country_code_size;
+       wl_country_t cspec = {{0}, 0, {0}};
+       char smbuf[WLC_IOCTL_SMLEN];
 
-       WL_TRACE(("%s\n", __FUNCTION__));
+       cspec.rev = -1;
        memset(country_code, 0, sizeof(country_code));
+       memset(smbuf, 0, sizeof(smbuf));
 
        country_offset = strcspn(extra, " ");
        country_code_size = strlen(extra) - country_offset;
 
        if (country_offset != 0) {
-               strncpy(country_code, extra + country_offset + 1,
+               strncpy(country_code, extra + country_offset +1,
                        MIN(country_code_size, sizeof(country_code)));
-               error = wl_iw_set_country_code(dev, country_code);
-               if (error >= 0) {
+
+
+               memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);
+               memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ);
+
+               get_customized_country_code((char *)&cspec.country_abbrev, &cspec);
+
+               if ((error = dev_iw_iovar_setbuf(dev, "country", &cspec, \
+                       sizeof(cspec), smbuf, sizeof(smbuf))) >= 0) {
                        p += snprintf(p, MAX_WX_STRING, "OK");
-                       WL_TRACE(("%s: set country %s OK\n", __FUNCTION__, country_code));
+                       WL_ERROR(("%s: set country for %s as %s rev %d is OK\n", \
+                               __FUNCTION__, country_code, cspec.ccode, cspec.rev));
+                       dhd_bus_country_set(dev, &cspec);
                        goto exit;
                }
        }
 
-       WL_ERROR(("%s: set country %s failed code %d\n", __FUNCTION__, country_code, error));
+       WL_ERROR(("%s: set country for %s as %s rev %d failed\n", \
+                       __FUNCTION__, country_code, cspec.ccode, cspec.rev));
+
        p += snprintf(p, MAX_WX_STRING, "FAIL");
 
 exit:
@@ -684,33 +701,6 @@ exit:
        return error;
 }
 
-static int
-wl_iw_get_country(
-        struct net_device *dev,
-        struct iw_request_info *info,
-        union iwreq_data *wrqu,
-        char *extra
-)
-{
-       char *ccode;
-       int current_channels;
-       
-       WL_TRACE(("%s\n", __FUNCTION__));
-
-       ccode = dhd_bus_country_get(dev);
-       if(ccode){
-               if(0 == strcmp(ccode, "Q2"))
-                       current_channels = 11;
-               else if(0 == strcmp(ccode, "EU"))
-                       current_channels = 13;
-               else if(0 == strcmp(ccode, "JP"))
-                       current_channels = 14;
-       }
-       sprintf(extra, "Scan-Channels = %d", current_channels);
-       printk("Get Channels return %d,(country code = %s)\n",current_channels, ccode); 
-       return 0;
-}
-
 #ifdef CUSTOMER_HW2
 static int
 wl_iw_set_power_mode(
@@ -765,26 +755,40 @@ wl_iw_set_power_mode(
 #endif
 
 
-static bool btcoex_is_sco_active(struct net_device *dev)
+bool btcoex_is_sco_active(struct net_device *dev)
 {
        int ioc_res = 0;
        bool res = false;
-       int temp = 0;
+       int sco_id_cnt = 0;
+       int param27;
+       int i;
+
+       for (i = 0; i < 12; i++) {
 
-       ioc_res = dev_wlc_intvar_get_reg(dev, "btc_params", 4, &temp);
+               ioc_res = dev_wlc_intvar_get_reg(dev, "btc_params", 27, &param27);
 
-       if (ioc_res == 0) {
-               WL_TRACE_COEX(("%s: read btc_params[4] = %x\n", __FUNCTION__, temp));
+               WL_TRACE_COEX(("%s, sample[%d], btc params: 27:%x\n",
+                       __FUNCTION__, i, param27));
+
+               if (ioc_res < 0) {
+                       WL_ERROR(("%s ioc read btc params error\n", __FUNCTION__));
+                       break;
+               }
+
+               if ((param27 & 0x6) == 2) {
+                       sco_id_cnt++;
+               }
 
-               if ((temp > 0xea0) && (temp < 0xed8)) {
-                       WL_TRACE_COEX(("%s: BT SCO/eSCO is ACTIVE\n", __FUNCTION__));
+               if (sco_id_cnt > 2) {
+                       WL_TRACE_COEX(("%s, sco/esco detected, pkt id_cnt:%d  samples:%d\n",
+                               __FUNCTION__, sco_id_cnt, i));
                        res = true;
-               } else {
-                       WL_TRACE_COEX(("%s: BT SCO/eSCO is NOT detected\n", __FUNCTION__));
+                       break;
                }
-       } else {
-               WL_ERROR(("%s ioc read btc params error\n", __FUNCTION__));
+
+               msleep(5);
        }
+
        return res;
 }
 
@@ -1070,21 +1074,6 @@ wl_iw_set_suspend(
        return ret;
 }
 
-#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY
-static int
-wl_iw_set_dfs_channels(
-       struct net_device *dev,
-       struct iw_request_info *info,
-       union iwreq_data *wrqu,
-       char *extra
-)
-{
-       use_non_dfs_channels = *(extra + strlen(SETDFSCHANNELS_CMD) + 1) - '0';
-       use_non_dfs_channels = (use_non_dfs_channels != 0) ? false : true;
-       wl_iw_set_country_code(dev, NULL);
-       return 0;
-}
-#endif
 
 int
 wl_format_ssid(char* ssid_buf, uint8* ssid, int ssid_len)
@@ -1370,9 +1359,10 @@ wl_iw_set_pno_set(
        int nssid = 0;
        cmd_tlv_t *cmd_tlv_temp;
        char *str_ptr;
-       char *str_ptr_end;
        int tlv_size_left;
        int pno_time;
+       int pno_repeat;
+       int pno_freq_expo_max;
 
 #ifdef PNO_SET_DEBUG
        int i;
@@ -1386,6 +1376,10 @@ wl_iw_set_pno_set(
                                                        'G', 'O', 'O', 'G',
                                                        'T',
                                                        '1','E',
+                                                       'R',
+                                                       '2',
+                                                       'M',
+                                                       '2',
                                                        0x00
                                                        };
 #endif
@@ -1429,6 +1423,7 @@ wl_iw_set_pno_set(
 
        cmd_tlv_temp = (cmd_tlv_t *)str_ptr;
        memset(ssids_local, 0, sizeof(ssids_local));
+       pno_repeat = pno_freq_expo_max = 0;
 
        if ((cmd_tlv_temp->prefix == PNO_TLV_PREFIX) && \
                (cmd_tlv_temp->version == PNO_TLV_VERSION) && \
@@ -1449,9 +1444,28 @@ wl_iw_set_pno_set(
                                goto exit_proc;
                        }
                        str_ptr++;
-                       pno_time = simple_strtoul(str_ptr, &str_ptr_end, 16);
-                       WL_ERROR((" got %d bytes left pno_time %d or %#x\n", \
-                                       tlv_size_left, pno_time, pno_time));
+                       pno_time = simple_strtoul(str_ptr, &str_ptr, 16);
+                       WL_PNO(("%s: pno_time=%d\n", __FUNCTION__, pno_time));
+
+                       if (str_ptr[0] != 0) {
+                               if ((str_ptr[0] != PNO_TLV_FREQ_REPEAT)) {
+                                       WL_ERROR(("%s pno repeat : corrupted field\n", \
+                                               __FUNCTION__));
+                                       goto exit_proc;
+                               }
+                               str_ptr++;
+                               pno_repeat = simple_strtoul(str_ptr, &str_ptr, 16);
+                               WL_PNO(("%s :got pno_repeat=%d\n", __FUNCTION__, pno_repeat));
+                               if (str_ptr[0] != PNO_TLV_FREQ_EXPO_MAX) {
+                                       WL_ERROR(("%s FREQ_EXPO_MAX corrupted field size\n", \
+                                                       __FUNCTION__));
+                                       goto exit_proc;
+                               }
+                               str_ptr++;
+                               pno_freq_expo_max = simple_strtoul(str_ptr, &str_ptr, 16);
+                               WL_PNO(("%s: pno_freq_expo_max=%d\n", \
+                                                       __FUNCTION__, pno_freq_expo_max));
+                       }
                }
        }
        else {
@@ -1459,7 +1473,7 @@ wl_iw_set_pno_set(
                goto exit_proc;
        }
 
-       res = dhd_dev_pno_set(dev, ssids_local, nssid, pno_time);
+       res = dhd_dev_pno_set(dev, ssids_local, nssid, pno_time, pno_repeat, pno_freq_expo_max);
 
 exit_proc:
        net_os_wake_unlock(dev);
@@ -1746,6 +1760,79 @@ int hstr_2_buf(const char *txt, u8 *buf, int len)
        return 0;
 }
 
+#if defined(SOFTAP) && defined(SOFTAP_TLV_CFG)
+
+static int wl_iw_softap_cfg_tlv(
+       struct net_device *dev,
+       struct iw_request_info *info,
+       union iwreq_data *wrqu,
+       char *extra
+)
+{
+       int res = -1;
+       char *str_ptr;
+       int tlv_size_left;
+
+
+#define SOFTAP_TLV_DEBUG  1
+#ifdef SOFTAP_TLV_DEBUG
+char softap_cmd_example[] = {
+
+       'S', 'O', 'F', 'T', 'A', 'P', 'S', 'E', 'T', ' ',
+
+       SOFTAP_TLV_PREFIX, SOFTAP_TLV_VERSION,
+       SOFTAP_TLV_SUBVERSION, SOFTAP_TLV_RESERVED,
+
+       TLV_TYPE_SSID,          9, 'B', 'R', 'C', 'M', ',', 'G', 'O', 'O', 'G',
+
+       TLV_TYPE_SECUR,         4, 'O', 'P', 'E', 'N',
+
+       TLV_TYPE_KEY,           4, 0x31, 0x32, 0x33, 0x34,
+
+       TLV_TYPE_CHANNEL,       4, 0x06, 0x00, 0x00, 0x00
+};
+#endif
+
+
+#ifdef SOFTAP_TLV_DEBUG
+       {
+       int i;
+       if (!(extra = kmalloc(sizeof(softap_cmd_example) +10, GFP_KERNEL)))
+               return -ENOMEM;
+       memcpy(extra, softap_cmd_example, sizeof(softap_cmd_example));
+       wrqu->data.length = sizeof(softap_cmd_example);
+       print_buf(extra, wrqu->data.length, 16);
+       for (i = 0; i < wrqu->data.length; i++)
+               printf("%c ", extra[i]);
+       printf("\n");
+       }
+#endif
+
+       WL_ERROR(("\n### %s: info->cmd:%x, info->flags:%x, u.data=0x%p, u.len=%d\n",
+               __FUNCTION__, info->cmd, info->flags,
+               wrqu->data.pointer, wrqu->data.length));
+
+       if (g_onoff == G_WLAN_SET_OFF) {
+               WL_TRACE(("%s: driver is not up yet after START\n", __FUNCTION__));
+               return -1;
+       }
+
+       if (wrqu->data.length < (strlen(SOFTAP_SET_CMD) + sizeof(cmd_tlv_t))) {
+               WL_ERROR(("%s argument=%d  less %d\n", __FUNCTION__,
+                       wrqu->data.length, strlen(SOFTAP_SET_CMD) + sizeof(cmd_tlv_t)));
+               return -1;
+       }
+
+       str_ptr =  extra + strlen(SOFTAP_SET_CMD)+1; 
+       tlv_size_left = wrqu->data.length - (strlen(SOFTAP_SET_CMD)+1);
+
+       memset(&my_ap, 0, sizeof(my_ap));
+
+       return res;
+}
+#endif
+
+
 #ifdef SOFTAP
 int init_ap_profile_from_string(char *param_str, struct ap_profile *ap_cfg)
 {
@@ -3713,6 +3800,7 @@ wl_iw_handle_scanresults_ies(char **event_p, char *end,
                        wpa_snprintf_hex(buf + 10, 2+1, &(ie->len), 1);
                        wpa_snprintf_hex(buf + 12, 2*ie->len+1, ie->data, ie->len);
                        event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, buf);
+                       kfree(buf);
 #endif 
                        break;
                }
@@ -5754,7 +5842,7 @@ wl_iw_combined_scan_set(struct net_device *dev, wlc_ssid_t* ssids_local, int nss
                WL_SCAN(("scan_type=%d\n", iscan->iscan_ex_params_p->params.scan_type));
                WL_SCAN(("\n###################\n"));
        }
-#endif 
+#endif
 
        if (params_size > WLC_IOCTL_MEDLEN) {
                        WL_ERROR(("Set ISCAN for %s due to params_size=%d  \n", \
@@ -5794,6 +5882,11 @@ static int iwpriv_set_cscan(struct net_device *dev, struct iw_request_info *info
                return -1;
        }
 
+#ifdef PNO_SET_DEBUG
+       wl_iw_set_pno_set(dev, info, wrqu, extra);
+       return 0;
+#endif
+
        if (wrqu->data.length != 0) {
 
                char *str_ptr;
@@ -6321,16 +6414,8 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap)
        }
 
        if (strlen(ap->country_code)) {
-               int error = 0;
-               if ((error = dev_wlc_ioctl(dev, WLC_SET_COUNTRY,
-                       ap->country_code, sizeof(ap->country_code))) >= 0) {
-                       WL_SOFTAP(("%s: set country %s OK\n",
-                               __FUNCTION__, ap->country_code));
-                       dhd_bus_country_set(dev, &ap->country_code[0]);
-               } else {
-                       WL_ERROR(("%s: ERROR:%d setting country %s\n",
-                               __FUNCTION__, error, ap->country_code));
-               }
+               WL_ERROR(("%s: Igonored: Country MUST be specified \
+                                 COUNTRY command with \n",     __FUNCTION__));
        } else {
                WL_SOFTAP(("%s: Country code is not specified,"
                        " will use Radio's default\n",
@@ -7072,30 +7157,6 @@ int wl_iw_process_private_ascii_cmd(
 }
 #endif
 
-#define BCM4329_WAKELOCK_NAME "bcm4329_wifi_wakelock"
-
-static struct wake_lock bcm4329_suspend_lock;
-
-int bcm4329_wakelock_init = 0;
-
-void bcm4329_power_save_init(void)
-{
-        wake_lock_init(&bcm4329_suspend_lock, WAKE_LOCK_SUSPEND, BCM4329_WAKELOCK_NAME);
-        wake_lock(&bcm4329_suspend_lock);
-        
-       bcm4329_wakelock_init = 2;
-}
-
-void bcm4329_power_save_exit(void)
-{
-        bcm4329_wakelock_init = 0;
-        msleep(100);
-        
-       if (bcm4329_wakelock_init == 2)
-                wake_unlock(&bcm4329_suspend_lock);
-        wake_lock_destroy(&bcm4329_suspend_lock);
-}
-
 static int wl_iw_set_priv(
        struct net_device *dev,
        struct iw_request_info *info,
@@ -7121,11 +7182,6 @@ static int wl_iw_set_priv(
        
        if (dwrq->length && extra) {
                if (strnicmp(extra, "START", strlen("START")) == 0) {
-                       if (bcm4329_wakelock_init == 1)
-                        {
-                                wake_lock(&bcm4329_suspend_lock);
-                                bcm4329_wakelock_init = 2;
-                        }
                        wl_iw_control_wl_on(dev, info);
                        WL_TRACE(("%s, Received regular START command\n", __FUNCTION__));
                }
@@ -7157,16 +7213,8 @@ static int wl_iw_set_priv(
                        ret = wl_iw_get_macaddr(dev, info, (union iwreq_data *)dwrq, extra);
                else if (strnicmp(extra, "COUNTRY", strlen("COUNTRY")) == 0)
                        ret = wl_iw_set_country(dev, info, (union iwreq_data *)dwrq, extra);
-               else if (strnicmp(extra, "SCAN-CHANNELS", strlen("SCAN-CHANNELS")) == 0)
-                       ret = wl_iw_get_country(dev, info, (union iwreq_data *)dwrq, extra);
-               else if (strnicmp(extra, "STOP", strlen("STOP")) == 0){
+               else if (strnicmp(extra, "STOP", strlen("STOP")) == 0)
                        ret = wl_iw_control_wl_off(dev, info);
-                       if (bcm4329_wakelock_init == 2)
-                        {
-                                wake_unlock(&bcm4329_suspend_lock);
-                                bcm4329_wakelock_init = 1;
-                        }
-               }
                else if (strnicmp(extra, BAND_GET_CMD, strlen(BAND_GET_CMD)) == 0)
                        ret = wl_iw_get_band(dev, info, (union iwreq_data *)dwrq, extra);
                else if (strnicmp(extra, BAND_SET_CMD, strlen(BAND_SET_CMD)) == 0)
@@ -7177,10 +7225,8 @@ static int wl_iw_set_priv(
                        ret = wl_iw_set_dtim_skip(dev, info, (union iwreq_data *)dwrq, extra);
                else if (strnicmp(extra, SETSUSPEND_CMD, strlen(SETSUSPEND_CMD)) == 0)
                        ret = wl_iw_set_suspend(dev, info, (union iwreq_data *)dwrq, extra);
-#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY
-               else if (strnicmp(extra, SETDFSCHANNELS_CMD, strlen(SETDFSCHANNELS_CMD)) == 0)
-                       ret = wl_iw_set_dfs_channels(dev, info, (union iwreq_data *)dwrq, extra);
-#endif
+           else if (strnicmp(extra, TXPOWER_SET_CMD, strlen(TXPOWER_SET_CMD)) == 0)
+                       ret = wl_iw_set_txpower(dev, info, (union iwreq_data *)dwrq, extra);
 #if defined(PNO_SUPPORT)
                else if (strnicmp(extra, PNOSSIDCLR_SET_CMD, strlen(PNOSSIDCLR_SET_CMD)) == 0)
                        ret = wl_iw_set_pno_reset(dev, info, (union iwreq_data *)dwrq, extra);
@@ -7196,8 +7242,10 @@ static int wl_iw_set_priv(
 #ifdef CUSTOMER_HW2
                else if (strnicmp(extra, "POWERMODE", strlen("POWERMODE")) == 0)
                        ret = wl_iw_set_power_mode(dev, info, (union iwreq_data *)dwrq, extra);
-               else if (strnicmp(extra, "BTCOEXMODE", strlen("BTCOEXMODE")) == 0)
+           else if (strnicmp(extra, "BTCOEXMODE", strlen("BTCOEXMODE")) == 0) {
+                       WL_TRACE_COEX(("%s:got Framwrork cmd: 'BTCOEXMODE'\n", __FUNCTION__));
                        ret = wl_iw_set_btcoex_dhcp(dev, info, (union iwreq_data *)dwrq, extra);
+           }
 #else
                else if (strnicmp(extra, "POWERMODE", strlen("POWERMODE")) == 0)
                        ret = wl_iw_set_btcoex_dhcp(dev, info, (union iwreq_data *)dwrq, extra);
@@ -7205,6 +7253,11 @@ static int wl_iw_set_priv(
                else if (strnicmp(extra, "GETPOWER", strlen("GETPOWER")) == 0)
                        ret = wl_iw_get_power_mode(dev, info, (union iwreq_data *)dwrq, extra);
 #ifdef SOFTAP
+#ifdef SOFTAP_TLV_CFG
+               else if (strnicmp(extra, SOFTAP_SET_CMD, strlen(SOFTAP_SET_CMD)) == 0) {
+                   wl_iw_softap_cfg_tlv(dev, info, (union iwreq_data *)dwrq, extra);
+           }
+#endif
                else if (strnicmp(extra, "ASCII_CMD", strlen("ASCII_CMD")) == 0) {
                        wl_iw_process_private_ascii_cmd(dev, info, (union iwreq_data *)dwrq, extra);
                } else if (strnicmp(extra, "AP_MAC_LIST_SET", strlen("AP_MAC_LIST_SET")) == 0) {
@@ -7725,9 +7778,10 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
        uint32 datalen = ntoh32(e->datalen);
        uint32 status =  ntoh32(e->status);
        uint32 toto;
+#if defined(ROAM_NOT_USED)
        static uint32 roam_no_success = 0;
        static bool roam_no_success_send = FALSE;
-
+#endif
        memset(&wrqu, 0, sizeof(wrqu));
        memset(extra, 0, sizeof(extra));
 
@@ -7802,6 +7856,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
                        wrqu.addr.sa_family = ARPHRD_ETHER;
                        cmd = SIOCGIWAP;
                }
+#if defined(ROAM_NOT_USED)
                else if (status == WLC_E_STATUS_NO_NETWORKS) {
                        roam_no_success++;
                        if ((roam_no_success == 5) && (roam_no_success_send == FALSE)) {
@@ -7816,6 +7871,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
                                goto wl_iw_event_end;
                        }
                }
+#endif
                break;
        case WLC_E_DEAUTH_IND:
        case WLC_E_DISASSOC_IND:
@@ -7871,8 +7927,10 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data)
                                wl_iw_send_priv_event(priv_dev, "AP_UP");
                        } else {
                                WL_TRACE(("STA_LINK_UP\n"));
+#if defined(ROAM_NOT_USED)
                                roam_no_success_send = FALSE;
                                roam_no_success = 0;
+#endif
                        }
 #endif
                        WL_TRACE(("Link UP\n"));