net: wireless: bcm4329: Update to Version 4.218.248-15
authorGreg Goldman <ggoldman@broadcom.com>
Thu, 18 Nov 2010 21:49:25 +0000 (13:49 -0800)
committerDmitry Shmidt <dimitrysh@google.com>
Thu, 18 Nov 2010 21:49:25 +0000 (13:49 -0800)
- Increase default Listen Interval to 20 Beacons
- Add logic to adjust SKIP_DTIM if Listen Interval < DTIM * DTIM_SKIP to
  avoid data lost due to fact that packet maybe not retrieved during Listen
  Interval and AP may toss it
- Fix problem with Hidden AP setting after AP reconfigure
- Add new SoftAP optional parameter as COUNTRY to pass country code to SoftAP

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcm4329/dhd.h
drivers/net/wireless/bcm4329/dhd_common.c
drivers/net/wireless/bcm4329/dhd_linux.c
drivers/net/wireless/bcm4329/include/epivers.h
drivers/net/wireless/bcm4329/include/wlioctl.h
drivers/net/wireless/bcm4329/wl_iw.c
drivers/net/wireless/bcm4329/wl_iw.h

index 8f95e576ca65c633c4c3d453882b98c37e0d7195..1ddf1ff61e7052cd36613dfd0e5c18296fd5d871 100644 (file)
@@ -24,7 +24,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: dhd.h,v 1.32.4.7.2.4.14.49.4.1 2010/09/23 02:33:19 Exp $
+ * $Id: dhd.h,v 1.32.4.7.2.4.14.49.4.7 2010/11/12 22:48:36 Exp $
  */
 
 /****************
@@ -90,6 +90,7 @@ enum dhd_bus_wake_state {
        WAKE_LOCK_SOFTAP_SET,
        WAKE_LOCK_SOFTAP_STOP,
        WAKE_LOCK_SOFTAP_START,
+       WAKE_LOCK_SOFTAP_THREAD,
        WAKE_LOCK_MAX
 };
 enum dhd_prealloc_index {
@@ -351,6 +352,7 @@ typedef enum cust_gpio_modes {
        WLAN_POWER_ON,
        WLAN_POWER_OFF
 } cust_gpio_modes_t;
+
 extern int wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag);
 extern int wl_iw_send_priv_event(struct net_device *dev, char *flag);
 extern int net_os_send_hang_message(struct net_device *dev);
index dbd4b922a262395ef9d56cf02b14ee524ce4924b..b8bab30161158bc2e6c9f27d97e847c46ab22d94 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: dhd_common.c,v 1.5.6.8.2.6.6.69.4.10 2010/10/29 19:58:08 Exp $
+ * $Id: dhd_common.c,v 1.5.6.8.2.6.6.69.4.16 2010/11/18 03:53:32 Exp $
  */
 #include <typedefs.h>
 #include <osl.h>
@@ -1230,8 +1230,9 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
        uint bcn_timeout = 3;
        int scan_assoc_time = 40;
        int scan_unassoc_time = 40;
+       uint32 listen_interval = LISTEN_INTERVAL; /* Default Listen Interval in Beacons */
+       int ret = 0;
 #ifdef GET_CUSTOM_MAC_ENABLE
-       int ret;
        struct ether_addr ea_addr;
 #endif /* GET_CUSTOM_MAC_ENABLE */
 
@@ -1258,7 +1259,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
 #ifdef SET_RANDOM_MAC_SOFTAP
        if (strstr(fw_path, "apsta") != NULL) {
                uint rand_mac;
-               int ret;
 
                srandom32((uint)jiffies);
                rand_mac = random32();
@@ -1289,6 +1289,11 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
                }
        }
 
+       /* Set Listen Interval */
+       bcm_mkiovar("assoc_listen", (char *)&listen_interval, 4, iovbuf, sizeof(iovbuf));
+       if ((ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf))) < 0)
+               DHD_ERROR(("%s assoc_listen failed %d\n", __FUNCTION__, ret));
+
        /* query for 'ver' to get version info from firmware */
        memset(buf, 0, sizeof(buf));
        ptr = buf;
@@ -1797,6 +1802,57 @@ fail:
 
 #endif 
 
+/* Function to estimate possible DTIM_SKIP value */
+int dhd_get_dtim_skip(dhd_pub_t *dhd)
+{
+       int bcn_li_dtim;
+       char buf[128];
+       int ret;
+       int dtim_assoc = 0;
+
+       if ((dhd->dtim_skip == 0) || (dhd->dtim_skip == 1))
+               bcn_li_dtim = 3;
+       else
+               bcn_li_dtim = dhd->dtim_skip;
+
+       /* Read DTIM value if associated */
+       memset(buf, 0, sizeof(buf));
+       bcm_mkiovar("dtim_assoc", 0, 0, buf, sizeof(buf));
+       if ((ret = dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf))) < 0) {
+               DHD_ERROR(("%s failed code %d\n", __FUNCTION__, ret));
+               bcn_li_dtim = 1;
+               goto exit;
+       }
+       else
+               dtim_assoc = dtoh32(*(int *)buf);
+
+       DHD_ERROR(("%s bcn_li_dtim=%d DTIM=%d Listen=%d\n", \
+                        __FUNCTION__, bcn_li_dtim, dtim_assoc, LISTEN_INTERVAL));
+
+       /* if not assocated just eixt */
+       if (dtim_assoc == 0) {
+               goto exit;
+       }
+
+       /* check if sta listen interval fits into AP dtim */
+       if (dtim_assoc > LISTEN_INTERVAL) {
+               /* AP DTIM to big for our Listen Interval : no dtim skiping */
+               bcn_li_dtim = 1;
+               DHD_ERROR(("%s DTIM=%d > Listen=%d : too big ...\n", \
+                                __FUNCTION__, dtim_assoc, LISTEN_INTERVAL));
+               goto exit;
+       }
+
+       if ((bcn_li_dtim * dtim_assoc) > LISTEN_INTERVAL) {
+               /* Round up dtim_skip to fit into STAs Listen Interval */
+               bcn_li_dtim = (int)(LISTEN_INTERVAL / dtim_assoc);
+               DHD_TRACE(("%s agjust dtim_skip as %d\n", __FUNCTION__, bcn_li_dtim));
+       }
+
+exit:
+       return bcn_li_dtim;
+}
+
 #ifdef PNO_SUPPORT
 int dhd_pno_clean(dhd_pub_t *dhd)
 {
index 80dbbff9b772f38c1dc0f55dbf1d98daa7c3c135..1b7a6f4b788752d5a4d4e67969ba848d732f90c6 100644 (file)
@@ -22,7 +22,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: dhd_linux.c,v 1.65.4.9.2.12.2.104.4.29 2010/11/04 01:14:41 Exp $
+ * $Id: dhd_linux.c,v 1.65.4.9.2.12.2.104.4.35 2010/11/17 03:13:21 Exp $
  */
 
 #ifdef CONFIG_WIFI_CONTROL_FUNC
@@ -555,10 +555,7 @@ static int dhd_set_suspend(int value, dhd_pub_t *dhd)
                         *  for better power saving.
                         *  Note that side effect is chance to miss BC/MC packet
                        */
-                       if ((dhd->dtim_skip == 0) || (dhd->dtim_skip == 1))
-                               bcn_li_dtim = 3;
-                       else
-                               bcn_li_dtim = dhd->dtim_skip;
+                       bcn_li_dtim = dhd_get_dtim_skip(dhd);
                        bcm_mkiovar("bcn_li_dtim", (char *)&bcn_li_dtim,
                                4, iovbuf, sizeof(iovbuf));
                        dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf));
@@ -1867,7 +1864,7 @@ dhd_stop(struct net_device *net)
 #if !defined(IGNORE_ETH0_DOWN)
        dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net);
 
-       DHD_TRACE(("%s: Enter\n", __FUNCTION__));
+       DHD_TRACE(("%s: Enter %s\n", __FUNCTION__, net->name));
        if (dhd->pub.up == 0) {
                return 0;
        }
index 9b5a2f1f20d7a8b56af16c38ce4a810a59b137c1..062df0480357b7b80f69ba97b58d3e956d76694b 100644 (file)
 
 #define        EPI_RC_NUMBER           248
 
-#define        EPI_INCREMENTAL_NUMBER  13
+#define        EPI_INCREMENTAL_NUMBER  15
 
 #define        EPI_BUILD_NUMBER        0
 
-#define        EPI_VERSION             4, 218, 248, 13
+#define        EPI_VERSION             4, 218, 248, 15
 
-#define        EPI_VERSION_NUM         0x04daf80d
+#define        EPI_VERSION_NUM         0x04daf80f
 
 
-#define        EPI_VERSION_STR         "4.218.248.13"
-#define        EPI_ROUTER_VERSION_STR  "4.219.248.13"
+#define        EPI_VERSION_STR         "4.218.248.15"
+#define        EPI_ROUTER_VERSION_STR  "4.219.248.15"
 
 #endif 
index 345ba34b94c096b1f95a357cbce2fc79fa591ebf..cd7725a70db41d3fdd4f509fe9ba706b0747f38d 100644 (file)
@@ -24,7 +24,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: wlioctl.h,v 1.601.4.15.2.14.2.62 2010/08/19 01:20:12 Exp $
+ * $Id: wlioctl.h,v 1.601.4.15.2.14.2.62.4.1 2010/11/17 03:09:28 Exp $
  */
 
 
@@ -857,6 +857,7 @@ typedef struct wl_ioctl {
 #define PM_MAX 1
 #define PM_FAST 2
 
+#define LISTEN_INTERVAL                        20
 
 #define        INTERFERE_NONE  0       
 #define        NON_WLAN        1       
index 8ebd0737e92f89f07fd70ed8125e91b10e2d442d..415ef99128e2625e2e568bba6855721d659f646c 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.45 2010/11/04 21:08:09 Exp $
+ * $Id: wl_iw.c,v 1.51.4.9.2.6.4.142.4.58 2010/11/18 02:08:30 Exp $
  */
 
 
@@ -1686,6 +1686,8 @@ int init_ap_profile_from_string(char *param_str, struct ap_profile *ap_cfg)
 
        get_parmeter_from_string(&str_ptr, "HIDDEN=", PTYPE_INTDEC, &ap_cfg->closednet, 5);
 
+       get_parmeter_from_string(&str_ptr, "COUNTRY=", PTYPE_STRING, &ap_cfg->country_code, 3);
+
        return ret;
 }
 #endif
@@ -2773,7 +2775,6 @@ wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, uint16 action)
        WL_SCAN(("scan_type=%d\n", iscan->iscan_ex_params_p->params.scan_type));
        WL_SCAN(("bss_type=%d\n", iscan->iscan_ex_params_p->params.bss_type));
 
-       
        if ((err = dev_iw_iovar_setbuf(iscan->dev, "iscan", iscan->iscan_ex_params_p, \
                iscan->iscan_ex_param_size, iscan->ioctlbuf, sizeof(iscan->ioctlbuf)))) {
                        WL_ERROR(("Set ISCAN for %s failed with %d\n", __FUNCTION__, err));
@@ -5957,15 +5958,22 @@ static int thr_wait_for_2nd_eth_dev(void *data)
 
        DAEMONIZE("wl0_eth_wthread");
 
-       WL_TRACE(("\n>%s threda started:, PID:%x\n", __FUNCTION__, current->pid));
+       WL_TRACE(("\n>%s thread started:, PID:%x\n", __FUNCTION__, current->pid));
+       iw = *(wl_iw_t **)netdev_priv(dev);
+       if (!iw) {
+               WL_ERROR(("%s: dev is null\n", __FUNCTION__));
+               ret = -1;
+               goto fail;
+       }
 
+#ifndef BCMSDIOH_STD
        if (down_timeout(&ap_eth_sema,  msecs_to_jiffies(5000)) != 0) {
                WL_ERROR(("\n%s: sap_eth_sema timeout \n", __FUNCTION__));
                ret = -1;
                goto fail;
        }
+#endif
 
-       iw = *(wl_iw_t **)netdev_priv(dev);
        flags = dhd_os_spin_lock(iw->pub);
        if (!ap_net_dev) {
                WL_ERROR((" ap_net_dev is null !!!"));
@@ -6156,15 +6164,6 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap)
                WL_TRACE(("\n>in %s: apsta set result: %d \n", __FUNCTION__, res));
 #endif
 
-               iolen = wl_bssiovar_mkbuf("closednet",
-                       bsscfg_index,  &ap->closednet, sizeof(ap->closednet)+4,
-                       buf, sizeof(buf), &mkvar_err);
-               ASSERT(iolen);
-               if ((res = dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen)) < 0) {
-                       WL_ERROR(("%s failed to set 'closednet'for apsta \n", __FUNCTION__));
-                       goto fail;
-               }
-
                updown = 1;
                if ((res = dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown))) < 0) {
                        WL_ERROR(("%s fail to set apsta \n", __FUNCTION__));
@@ -6187,6 +6186,32 @@ 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));
+               }
+       } else {
+               WL_SOFTAP(("%s: Country code is not specified,"
+                       " will use Radio's default\n",
+                       __FUNCTION__));
+       }
+
+       iolen = wl_bssiovar_mkbuf("closednet",
+               bsscfg_index,  &ap->closednet, sizeof(ap->closednet)+4,
+               buf, sizeof(buf), &mkvar_err);
+       ASSERT(iolen);
+       if ((res = dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen)) < 0) {
+               WL_ERROR(("%s failed to set 'closednet'for apsta \n", __FUNCTION__));
+               goto fail;
+       }
+
        
        if ((ap->channel == 0) && (get_softap_auto_channel(dev, ap) < 0)) {
                ap->channel = 1;
index 0f5f4db32eff66da2ec7d7079ca1c8cc95dd8594..48655df97d5e48849a157ffa4d6dda4bcd3bd920 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.h,v 1.5.34.1.6.36.4.12 2010/11/03 03:15:49 Exp $
+ * $Id: wl_iw.h,v 1.5.34.1.6.36.4.15 2010/11/17 03:13:51 Exp $
  */
 
 
@@ -160,6 +160,7 @@ struct ap_profile {
        uint32  preamble;
        uint32  max_scb;
        uint32  closednet;
+       char country_code[WLC_CNTRY_BUF_SZ];
 };
 
 
@@ -198,6 +199,7 @@ extern int net_os_set_suspend(struct net_device *dev, int val);
 extern int net_os_set_dtim_skip(struct net_device *dev, int val);
 extern int net_os_set_packet_filter(struct net_device *dev, int val);
 extern void dhd_bus_country_set(struct net_device *dev, char *country_code);
+extern int dhd_get_dtim_skip(dhd_pub_t *dhd);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
 #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \