diff options
author | Dmitry Shmidt <dimitrysh@google.com> | 2010-03-19 11:52:15 -0700 |
---|---|---|
committer | Dmitry Shmidt <dimitrysh@google.com> | 2010-03-19 11:52:15 -0700 |
commit | 1a9040ebea203168187d4e8f55cd5566a8eace4c (patch) | |
tree | 318d1b4ff364e941e9fa82767cc54fcf71ddf4e1 /bcm4329/src | |
parent | 07770aa679cd45674eaac3d8fb2e01a995068838 (diff) | |
download | hardware_broadcom_wlan-1a9040ebea203168187d4e8f55cd5566a8eace4c.zip hardware_broadcom_wlan-1a9040ebea203168187d4e8f55cd5566a8eace4c.tar.gz hardware_broadcom_wlan-1a9040ebea203168187d4e8f55cd5566a8eace4c.tar.bz2 |
bcm4329: Apply all Android patches
Change-Id: I38b791cbfe8f8d4f15f40012d87f49372c5a8e91
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'bcm4329/src')
69 files changed, 927 insertions, 890 deletions
diff --git a/bcm4329/src/bcmsdio/sys/bcmpcispi.c b/bcm4329/src/bcmsdio/sys/bcmpcispi.c index c0a66f1..ba3e0c5 100644 --- a/bcm4329/src/bcmsdio/sys/bcmpcispi.c +++ b/bcm4329/src/bcmsdio/sys/bcmpcispi.c @@ -1,7 +1,7 @@ /* * Broadcom SPI over PCI-SPI Host Controller, low-level hardware driver * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/bcmsdio/sys/bcmsdh.c b/bcm4329/src/bcmsdio/sys/bcmsdh.c index bb3608d..c9906e2 100644 --- a/bcm4329/src/bcmsdio/sys/bcmsdh.c +++ b/bcm4329/src/bcmsdio/sys/bcmsdh.c @@ -2,7 +2,7 @@ * BCMSDH interface glue * implement bcmsdh API for SDIOH driver * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you @@ -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: bcmsdh.c,v 1.35.2.1.4.8.6.12 2009/11/04 20:36:52 Exp $ + * $Id: bcmsdh.c,v 1.35.2.1.4.8.6.11 2009/10/20 09:48:20 Exp $ */ /* ****************** BCMSDH Interface Functions *************************** */ @@ -40,6 +40,9 @@ #include <sdio.h> /* sdio spec */ +/* Defines number of access retries to configuration registers */ +#define SDIOH_API_ACCESS_RETRY_LIMIT 2 + const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL; @@ -56,6 +59,7 @@ struct bcmsdh_info bcmsdh_info_t * l_bcmsdh = NULL; #if defined(OOB_INTR_ONLY) && defined(HW_OOB) + extern int sdioh_enable_hw_oob_intr(void *sdioh, bool enable); @@ -64,6 +68,7 @@ bcmsdh_enable_hw_oob_intr(bcmsdh_info_t *sdh, bool enable) { sdioh_enable_hw_oob_intr(sdh->sdioh, enable); } + #endif bcmsdh_info_t * @@ -205,6 +210,9 @@ bcmsdh_cfg_read(void *sdh, uint fnc_num, uint32 addr, int *err) { bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; SDIOH_API_RC status; +#ifdef SDIOH_API_ACCESS_RETRY_LIMIT + int32 retry = 0; +#endif uint8 data = 0; if (!bcmsdh) @@ -212,7 +220,15 @@ bcmsdh_cfg_read(void *sdh, uint fnc_num, uint32 addr, int *err) ASSERT(bcmsdh->init_success); +#ifdef SDIOH_API_ACCESS_RETRY_LIMIT + do { + if (retry) /* wait for 1 ms till bus get settled down */ + OSL_DELAY(1000); +#endif status = sdioh_cfg_read(bcmsdh->sdioh, fnc_num, addr, (uint8 *)&data); +#ifdef SDIOH_API_ACCESS_RETRY_LIMIT + } while (!SDIOH_API_SUCCESS(status) && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT)); +#endif if (err) *err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR); @@ -227,13 +243,24 @@ bcmsdh_cfg_write(void *sdh, uint fnc_num, uint32 addr, uint8 data, int *err) { bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; SDIOH_API_RC status; +#ifdef SDIOH_API_ACCESS_RETRY_LIMIT + int32 retry = 0; +#endif if (!bcmsdh) bcmsdh = l_bcmsdh; ASSERT(bcmsdh->init_success); +#ifdef SDIOH_API_ACCESS_RETRY_LIMIT + do { + if (retry) /* wait for 1 ms till bus get settled down */ + OSL_DELAY(1000); +#endif status = sdioh_cfg_write(bcmsdh->sdioh, fnc_num, addr, (uint8 *)&data); +#ifdef SDIOH_API_ACCESS_RETRY_LIMIT + } while (!SDIOH_API_SUCCESS(status) && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT)); +#endif if (err) *err = SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR; diff --git a/bcm4329/src/bcmsdio/sys/bcmsdh_linux.c b/bcm4329/src/bcmsdio/sys/bcmsdh_linux.c index 79d610b..0555f87 100644 --- a/bcm4329/src/bcmsdio/sys/bcmsdh_linux.c +++ b/bcm4329/src/bcmsdio/sys/bcmsdh_linux.c @@ -75,7 +75,7 @@ struct bcmsdh_hc { bcmsdh_info_t *sdh; /* SDIO Host Controller handle */ void *ch; unsigned int oob_irq; - unsigned long oob_flags; /* OOB Host specifiction as edge and etc */ + unsigned long oob_flags; }; static bcmsdh_hc_t *sdhcinfo = NULL; @@ -176,7 +176,7 @@ int bcmsdh_probe(struct device *dev) #endif /* BCMLXSDMMC */ int irq = 0; uint32 vendevid; - unsigned long irq_flags = 0; + unsigned long irq_flags = IRQF_TRIGGER_FALLING; #if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) pdev = to_platform_device(dev); @@ -187,7 +187,6 @@ int bcmsdh_probe(struct device *dev) #endif /* BCMLXSDMMC */ #if defined(OOB_INTR_ONLY) - irq_flags = IRQF_TRIGGER_FALLING; irq = dhd_customer_oob_irq_map(&irq_flags); if (irq < 0) { SDLX_MSG(("%s: Host irq is not defined\n", __FUNCTION__)); @@ -332,18 +331,18 @@ static struct pci_driver bcmsdh_pci_driver = { #endif suspend: NULL, resume: NULL, - }; +}; extern uint sd_pci_slot; /* Force detection to a particular PCI */ - /* slot only . Allows for having multiple */ - /* WL devices at once in a PC */ - /* Only one instance of dhd will be */ - /* useable at a time */ - /* Upper word is bus number, */ - /* lower word is slot number */ - /* Default value of 0xFFFFffff turns this */ - /* off */ + /* slot only . Allows for having multiple */ + /* WL devices at once in a PC */ + /* Only one instance of dhd will be */ + /* useable at a time */ + /* Upper word is bus number, */ + /* lower word is slot number */ + /* Default value of 0xFFFFffff turns this */ + /* off */ module_param(sd_pci_slot, uint, 0); @@ -368,8 +367,8 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) SDLX_MSG(("%s: %s: bus %X, slot %X, vend %X, dev %X\n", __FUNCTION__, bcmsdh_chipmatch(pdev->vendor, pdev->device) - ?"Found compatible SDIOHC" - :"Probing unknown device", + ? "Found compatible SDIOHC" + : "Probing unknown device", pdev->bus->number, PCI_SLOT(pdev->devfn), pdev->vendor, pdev->device)); return -ENODEV; @@ -377,8 +376,8 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) SDLX_MSG(("%s: %s: bus %X, slot %X, vendor %X, device %X (good PCI location)\n", __FUNCTION__, bcmsdh_chipmatch(pdev->vendor, pdev->device) - ?"Using compatible SDIOHC" - :"WARNING, forced use of unkown device", + ? "Using compatible SDIOHC" + : "WARNING, forced use of unkown device", pdev->bus->number, PCI_SLOT(pdev->devfn), pdev->vendor, pdev->device)); } @@ -580,8 +579,6 @@ static irqreturn_t wlan_oob_irq(int irq, void *dev_id) return IRQ_HANDLED; } - WAKE_LOCK_TIMEOUT(dhdp, WAKE_LOCK_TMOUT, 25); - dhdsdio_isr((void *)dhdp->bus); return IRQ_HANDLED; @@ -595,7 +592,6 @@ int bcmsdh_register_oob_intr(void * dhdp) dev_set_drvdata(sdhcinfo->dev, dhdp); - /* Refer to customer Host IRQ docs about proper irqflags definition */ error = request_irq(sdhcinfo->oob_irq, wlan_oob_irq, sdhcinfo->oob_flags, "bcmsdh_sdmmc", NULL); diff --git a/bcm4329/src/bcmsdio/sys/bcmsdh_sdmmc.c b/bcm4329/src/bcmsdio/sys/bcmsdh_sdmmc.c index 68b4b24..075d770 100644 --- a/bcm4329/src/bcmsdio/sys/bcmsdh_sdmmc.c +++ b/bcm4329/src/bcmsdio/sys/bcmsdh_sdmmc.c @@ -1069,11 +1069,13 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, u extern int sdioh_abort(sdioh_info_t *sd, uint func) { + char t_func = (char) func; + sd_trace(("%s: Enter\n", __FUNCTION__)); #if defined(MMC_SDIO_ABORT) /* issue abort cmd52 command through F1 */ - sdioh_request_byte(sd, SD_IO_OP_WRITE, SDIO_FUNC_0, SDIOD_CCCR_IOABORT, (uint8 *)&func); + sdioh_request_byte(sd, SD_IO_OP_WRITE, SDIO_FUNC_0, SDIOD_CCCR_IOABORT, &t_func); #endif /* defined(MMC_SDIO_ABORT) */ sd_trace(("%s: Exit\n", __FUNCTION__)); diff --git a/bcm4329/src/bcmsdio/sys/bcmsdspi_linux.c b/bcm4329/src/bcmsdio/sys/bcmsdspi_linux.c index e2e0ca6..1046a17 100644 --- a/bcm4329/src/bcmsdio/sys/bcmsdspi_linux.c +++ b/bcm4329/src/bcmsdio/sys/bcmsdspi_linux.c @@ -1,7 +1,7 @@ /* * Broadcom SPI Host Controller Driver - Linux Per-port * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/bcmsdio/sys/bcmsdstd_linux.c b/bcm4329/src/bcmsdio/sys/bcmsdstd_linux.c index ad6d660..5746b08 100644 --- a/bcm4329/src/bcmsdio/sys/bcmsdstd_linux.c +++ b/bcm4329/src/bcmsdio/sys/bcmsdstd_linux.c @@ -1,7 +1,7 @@ /* * 'Standard' SDIO HOST CONTROLLER driver - linux portion * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/dhd/sys/dhd.h b/bcm4329/src/dhd/sys/dhd.h index faf016f..8aa33b3 100644 --- a/bcm4329/src/dhd/sys/dhd.h +++ b/bcm4329/src/dhd/sys/dhd.h @@ -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.29 2010/02/23 06:58:21 Exp $ + * $Id: dhd.h,v 1.32.4.7.2.4.14.27 2010/01/19 06:42:55 Exp $ */ /**************** @@ -46,9 +46,7 @@ #include <linux/ethtool.h> #include <asm/uaccess.h> #include <asm/unaligned.h> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK) -#include <linux/wakelock.h> -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */ + /* The kernel threading is sdio-specific */ #else /* LINUX */ #define ENOMEM 1 @@ -149,9 +147,6 @@ typedef struct dhd_pub { int dongle_error; uint8 country_code[WLC_CNTRY_BUF_SZ]; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK) - struct wake_lock wakelock[WAKE_LOCK_MAX]; -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */ } dhd_pub_t; #if defined(NDIS60) @@ -171,7 +166,7 @@ WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(wdf_device_info_t, dhd_get_wdf_device_info) #define _DHD_PM_RESUME_WAIT(a, b) do {\ int retry = 0; \ while (dhd_mmc_suspend && retry++ != b) { \ - wait_event_timeout(a, FALSE, HZ/100); \ + wait_event_interruptible_timeout(a, FALSE, HZ/100); \ } \ } while (0) #define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 30) @@ -183,7 +178,7 @@ WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(wdf_device_info_t, dhd_get_wdf_device_info) #define SPINWAIT_SLEEP(a, exp, us) do { \ uint countdown = (us) + 9; \ while ((exp) && (countdown >= 10)) { \ - wait_event_timeout(a, FALSE, HZ/100); \ + wait_event_interruptible_timeout(a, FALSE, HZ/100); \ countdown -= 10; \ } \ } while (0) @@ -208,41 +203,11 @@ WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(wdf_device_info_t, dhd_get_wdf_device_info) #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */ #define DHD_IF_VIF 0x01 /* Virtual IF (Hidden from user) */ -inline static void WAKE_LOCK_INIT(dhd_pub_t * dhdp, int index, char * y) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK) - wake_lock_init(&dhdp->wakelock[index], WAKE_LOCK_SUSPEND, y); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */ -} - -inline static void WAKE_LOCK(dhd_pub_t * dhdp, int index) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK) - wake_lock(&dhdp->wakelock[index]); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */ -} - -inline static void WAKE_UNLOCK(dhd_pub_t * dhdp, int index) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK) - wake_unlock(&dhdp->wakelock[index]); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */ -} - -inline static void WAKE_LOCK_TIMEOUT(dhd_pub_t * dhdp, int index, long time) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK) - wake_lock_timeout(&dhdp->wakelock[index], time); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */ -} - -inline static void WAKE_LOCK_DESTROY(dhd_pub_t * dhdp, int index) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK) - wake_lock_destroy(&dhdp->wakelock[index]); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */ -} - +/* Wakelock Functions */ +extern int dhd_os_wake_lock(dhd_pub_t *pub); +extern int dhd_os_wake_unlock(dhd_pub_t *pub); +extern int dhd_os_wake_lock_timeout(dhd_pub_t *pub); +extern int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub); typedef struct dhd_if_event { uint8 ifidx; @@ -358,7 +323,6 @@ extern int dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag); extern uint dhd_bus_status(dhd_pub_t *dhdp); extern int dhd_bus_start(dhd_pub_t *dhdp); -extern void print_buf(void *pbuf, int len, int bytes_per_line); typedef enum cust_gpio_modes { diff --git a/bcm4329/src/dhd/sys/dhd_bus.h b/bcm4329/src/dhd/sys/dhd_bus.h index 7156543..93392f9 100644 --- a/bcm4329/src/dhd/sys/dhd_bus.h +++ b/bcm4329/src/dhd/sys/dhd_bus.h @@ -4,7 +4,7 @@ * Provides type definitions and function prototypes used to link the * DHD OS, bus, and protocol modules. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/dhd/sys/dhd_cdc.c b/bcm4329/src/dhd/sys/dhd_cdc.c index 77da0ea..43b21c3 100644 --- a/bcm4329/src/dhd/sys/dhd_cdc.c +++ b/bcm4329/src/dhd/sys/dhd_cdc.c @@ -73,9 +73,12 @@ dhdcdc_msg(dhd_pub_t *dhd) { dhd_prot_t *prot = dhd->prot; int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t); + int ret; DHD_TRACE(("%s: Enter\n", __FUNCTION__)); + dhd_os_wake_lock(dhd); + /* NOTE : cdc->msg.len holds the desired length of the buffer to be * returned. Only up to CDC_MAX_MSG_SIZE of this buffer area * is actually sent to the dongle @@ -84,7 +87,9 @@ dhdcdc_msg(dhd_pub_t *dhd) len = CDC_MAX_MSG_SIZE; /* Send request */ - return dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len); + ret = dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len); + dhd_os_wake_unlock(dhd); + return ret; } static int diff --git a/bcm4329/src/dhd/sys/dhd_common.c b/bcm4329/src/dhd/sys/dhd_common.c index ae0c3fb..9dc7113 100644 --- a/bcm4329/src/dhd/sys/dhd_common.c +++ b/bcm4329/src/dhd/sys/dhd_common.c @@ -101,8 +101,16 @@ dhd_common_init(void) * first time that the driver is initialized vs subsequent initializations. */ dhd_msg_level = DHD_ERROR_VAL; +#ifdef CONFIG_BCM4329_FW_PATH + strncpy(fw_path, CONFIG_BCM4329_FW_PATH, MOD_PARAM_PATHLEN-1); +#else fw_path[0] = '\0'; +#endif +#ifdef CONFIG_BCM4329_NVRAM_PATH + strncpy(nv_path, CONFIG_BCM4329_NVRAM_PATH, MOD_PARAM_PATHLEN-1); +#else nv_path[0] = '\0'; +#endif } static int @@ -189,7 +197,6 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, uint32 actionid, const ch dhd_msg_level = int_val; break; - case IOV_GVAL(IOV_BCMERRORSTR): strncpy((char *)arg, bcmerrorstr(dhd_pub->bcmerror), BCME_STRLEN); ((char *)arg)[BCME_STRLEN - 1] = 0x00; @@ -886,25 +893,3 @@ wl_event_to_host_order(wl_event_msg_t *evt) evt->datalen = ntoh32(evt->datalen); evt->version = ntoh16(evt->version); } - -void print_buf(void *pbuf, int len, int bytes_per_line) -{ - int i, j = 0; - unsigned char *buf = pbuf; - - if (bytes_per_line == 0) { - bytes_per_line = len; - } - - for (i = 0; i < len; i++) { - printf("%2.2x", *buf++); - j++; - if (j == bytes_per_line) { - printf("\n"); - j = 0; - } else { - printf(":"); - } - } - printf("\n"); -} diff --git a/bcm4329/src/dhd/sys/dhd_custom_gpio.c b/bcm4329/src/dhd/sys/dhd_custom_gpio.c index cb67ae2..2dc6e42 100644 --- a/bcm4329/src/dhd/sys/dhd_custom_gpio.c +++ b/bcm4329/src/dhd/sys/dhd_custom_gpio.c @@ -42,6 +42,7 @@ extern void bcm_wlan_power_off(int); extern void bcm_wlan_power_on(int); #endif /* CUSTOMER_HW */ + #ifdef CUSTOMER_HW2 int wifi_set_carddetect(int on); int wifi_set_power(int on, unsigned long msec); @@ -54,10 +55,6 @@ int wifi_get_irq_number(unsigned long *irq_flags_ptr); extern int sdioh_mmc_irq(int irq); #endif /* (BCMLXSDMMC) */ -#ifdef CUSTOMER_HW3 -#include <mach/gpio.h> -#endif - /* Customer specific Host GPIO defintion */ static int dhd_oob_gpio_num = -1; /* GG 19 */ @@ -66,12 +63,10 @@ MODULE_PARM_DESC(dhd_oob_gpio_num, "DHD oob gpio number"); int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr) { - int host_oob_irq = 0; - + int host_oob_irq; #ifdef CUSTOMER_HW2 host_oob_irq = wifi_get_irq_number(irq_flags_ptr); - -#else /* for NOT CUSTOMER_HW2 */ +#else #if defined(CUSTOM_OOB_GPIO_NUM) if (dhd_oob_gpio_num < 0) { dhd_oob_gpio_num = CUSTOM_OOB_GPIO_NUM; @@ -80,22 +75,15 @@ int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr) *irq_flags_ptr = IRQF_TRIGGER_FALLING; if (dhd_oob_gpio_num < 0) { WL_ERROR(("%s: ERROR customer specific Host GPIO is NOT defined \n", - __FUNCTION__)); + __FUNCTION__)); return (dhd_oob_gpio_num); } WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n", __FUNCTION__, dhd_oob_gpio_num)); -#if defined CUSTOMER_HW - host_oob_irq = MSM_GPIO_TO_INT(dhd_oob_gpio_num); -#elif defined CUSTOMER_HW3 - gpio_request(dhd_oob_gpio_num, "oob irq"); - host_oob_irq = gpio_to_irq(dhd_oob_gpio_num); - gpio_direction_input(dhd_oob_gpio_num); -#endif /* CUSTOMER_HW */ -#endif /* CUSTOMER_HW2 */ - + host_oob_irq = sdioh_mmc_irq(dhd_oob_gpio_num); +#endif return (host_oob_irq); } #endif /* defined(OOB_INTR_ONLY) */ diff --git a/bcm4329/src/dhd/sys/dhd_dbg.h b/bcm4329/src/dhd/sys/dhd_dbg.h index 852f3c2..e6d18f7 100644 --- a/bcm4329/src/dhd/sys/dhd_dbg.h +++ b/bcm4329/src/dhd/sys/dhd_dbg.h @@ -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_dbg.h,v 1.5.6.2.4.2.14.6 2010/02/23 05:36:53 Exp $ + * $Id: dhd_dbg.h,v 1.5.6.2.4.2.14.4 2009/12/11 01:13:49 Exp $ */ #ifndef _dhd_dbg_ diff --git a/bcm4329/src/dhd/sys/dhd_linux.c b/bcm4329/src/dhd/sys/dhd_linux.c index 38a1a11..ef529e7 100644 --- a/bcm4329/src/dhd/sys/dhd_linux.c +++ b/bcm4329/src/dhd/sys/dhd_linux.c @@ -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.60.4.1 2010/03/16 03:29:40 Exp $ + * $Id: dhd_linux.c,v 1.65.4.9.2.12.2.60 2010/02/23 00:18:36 Exp $ */ #ifdef CONFIG_WIFI_CONTROL_FUNC @@ -57,6 +57,11 @@ #include <dhd_bus.h> #include <dhd_proto.h> #include <dhd_dbg.h> +#include <wl_iw.h> +#ifdef CONFIG_HAS_WAKELOCK +#include <linux/wakelock.h> +#endif +#include <linux/freezer.h> #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) #include <linux/wifi_tiwlan.h> @@ -110,12 +115,13 @@ int wifi_set_reset(int on, unsigned long msec) mdelay(msec); return 0; } + static int wifi_probe(struct platform_device *pdev) { struct wifi_platform_data *wifi_ctrl = (struct wifi_platform_data *)(pdev->dev.platform_data); - printk("## %s\n", __FUNCTION__); + DHD_TRACE(("## %s\n", __FUNCTION__)); wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "bcm4329_wlan_irq"); wifi_control_data = wifi_ctrl; @@ -131,7 +137,7 @@ static int wifi_remove(struct platform_device *pdev) struct wifi_platform_data *wifi_ctrl = (struct wifi_platform_data *)(pdev->dev.platform_data); - printk("## %s\n", __FUNCTION__); + DHD_TRACE(("## %s\n", __FUNCTION__)); wifi_control_data = wifi_ctrl; wifi_set_carddetect(0); /* CardDetect (1->0) */ @@ -148,7 +154,7 @@ static int wifi_suspend(struct platform_device *pdev, pm_message_t state) static int wifi_resume(struct platform_device *pdev) { DHD_TRACE(("##> %s\n", __FUNCTION__)); - return 0; + return 0; } static struct platform_driver wifi_device = { @@ -248,6 +254,15 @@ typedef struct dhd_info { struct semaphore dpc_sem; struct completion dpc_exited; + /* Wakelocks */ +#ifdef CONFIG_HAS_WAKELOCK + struct wake_lock wl_wifi; /* Wifi wakelock */ + struct wake_lock wl_rxwake; /* Wifi rx wakelock */ +#endif + spinlock_t wl_lock; + int wl_count; + int wl_packet; + /* Thread to issue ioctl for multicast */ long sysioc_pid; struct semaphore sysioc_sem; @@ -271,7 +286,6 @@ char nvram_path[MOD_PARAM_PATHLEN]; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && 1 struct semaphore dhd_registration_sem; -#define DHD_REGISTRATION_TIMEOUT 8000 /* msec : allowed time to finished dhd registration */ #endif /* load firmware and/or nvram values from the filesystem */ module_param_string(firmware_path, firmware_path, MOD_PARAM_PATHLEN, 0); @@ -759,7 +773,7 @@ dhd_op_if(dhd_if_t *ifp) break; case WLC_E_IF_DEL: if (ifp->net != NULL) { - DHD_TRACE(("\n%s: got 'WLC_E_IF_DEL' state\n", __FUNCTION__)); + DHD_TRACE(("\n%s: got 'WLC_E_IF_DEL' state\n", __FUNCTION__)); netif_stop_queue(ifp->net); unregister_netdev(ifp->net); ret = DHD_DEL_IF; /* Make sure the free_netdev() is called */ @@ -771,23 +785,17 @@ dhd_op_if(dhd_if_t *ifp) break; } - if (ret < 0) { - if (ifp->net) { - free_netdev(ifp->net); } - dhd->iflist[ifp->idx] = NULL; MFREE(dhd->pub.osh, ifp, sizeof(*ifp)); - #ifdef SOFTAP if (ifp->net == ap_net_dev) - ap_net_dev = NULL; /* NULL SOFTAP global wl0.1 as well */ + ap_net_dev = NULL; /* NULL SOFTAP global as well */ #endif /* SOFTAP */ } - } static int @@ -796,9 +804,12 @@ _dhd_sysioc_thread(void *data) dhd_info_t *dhd = (dhd_info_t *)data; int i; + set_freezable(); + DAEMONIZE("dhd_sysioc"); while (down_interruptible(&dhd->sysioc_sem) == 0) { + dhd_os_wake_lock(&dhd->pub); for (i = 0; i < DHD_MAX_IFS; i++) { if (dhd->iflist[i]) { if (dhd->iflist[i]->state) @@ -813,6 +824,7 @@ _dhd_sysioc_thread(void *data) } } } + dhd_os_wake_unlock(&dhd->pub); } complete_and_exit(&dhd->sysioc_exited, 0); } @@ -886,7 +898,6 @@ dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, void *pktbuf) #ifdef BCMDBUS ret = dbus_send_pkt(dhdp->dbus, pktbuf, NULL /* pktinfo */); #else - WAKE_LOCK_TIMEOUT(dhdp, WAKE_LOCK_TMOUT, 25); ret = dhd_bus_txdata(dhdp->bus, pktbuf); #endif /* BCMDBUS */ @@ -906,6 +917,7 @@ dhd_start_xmit(struct sk_buff *skb, struct net_device *net) /* Reject if down */ if (!dhd->pub.up || (dhd->pub.busstate == DHD_BUS_DOWN)) { DHD_ERROR(("%s: xmit rejected due to dhd bus down status \n", __FUNCTION__)); + netif_stop_queue(net); return -ENODEV; } @@ -1066,6 +1078,7 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt) #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */ } } + dhd_os_wake_lock_timeout_enable(dhdp); } void @@ -1132,7 +1145,6 @@ static int dhd_watchdog_thread(void *data) { dhd_info_t *dhd = (dhd_info_t *)data; - WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_WATCHDOG, "dhd_watchdog_thread"); /* This thread doesn't need any user-level access, * so get rid of all our resources @@ -1146,17 +1158,17 @@ dhd_watchdog_thread(void *data) } #endif /* DHD_SCHED */ + set_freezable(); + DAEMONIZE("dhd_watchdog"); /* Run until signal received */ while (1) { if (down_interruptible (&dhd->watchdog_sem) == 0) { - if (dhd->pub.dongle_reset == FALSE) { - WAKE_LOCK(&dhd->pub, WAKE_LOCK_WATCHDOG); - /* Call the bus module watchdog */ - dhd_bus_watchdog(&dhd->pub); - WAKE_UNLOCK(&dhd->pub, WAKE_LOCK_WATCHDOG); - } + dhd_os_wake_lock(&dhd->pub); + /* Call the bus module watchdog */ + dhd_bus_watchdog(&dhd->pub); + /* Count the tick for reference */ dhd->pub.tickcnt++; @@ -1164,12 +1176,12 @@ dhd_watchdog_thread(void *data) if (dhd->wd_timer_valid) { mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000); } + dhd_os_wake_unlock(&dhd->pub); } else break; } - WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_WATCHDOG); complete_and_exit(&dhd->watchdog_exited, 0); } @@ -1190,8 +1202,12 @@ dhd_watchdog(ulong data) dhd->pub.tickcnt++; /* Reschedule the watchdog */ +#if defined(CONTINUOUS_WATCHDOG) + mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000); +#else if (dhd->wd_timer_valid) mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000); +#endif /* defined(CONTINUOUS_WATCHDOG) */ } static int @@ -1199,7 +1215,6 @@ dhd_dpc_thread(void *data) { dhd_info_t *dhd = (dhd_info_t *)data; - WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_DPC, "dhd_dpc_thread"); /* This thread doesn't need any user-level access, * so get rid of all our resources */ @@ -1212,6 +1227,8 @@ dhd_dpc_thread(void *data) } #endif /* DHD_SCHED */ + set_freezable(); + DAEMONIZE("dhd_dpc"); /* Run until signal received */ @@ -1219,22 +1236,21 @@ dhd_dpc_thread(void *data) if (down_interruptible(&dhd->dpc_sem) == 0) { /* Call bus dpc unless it indicated down (then clean stop) */ if (dhd->pub.busstate != DHD_BUS_DOWN) { - WAKE_LOCK(&dhd->pub, WAKE_LOCK_DPC); if (dhd_bus_dpc(dhd->pub.bus)) { up(&dhd->dpc_sem); - WAKE_LOCK_TIMEOUT(&dhd->pub, WAKE_LOCK_TMOUT, 25); } - WAKE_UNLOCK(&dhd->pub, WAKE_LOCK_DPC); + else { + dhd_os_wake_unlock(&dhd->pub); + } } else { dhd_bus_stop(dhd->pub.bus, TRUE); + dhd_os_wake_unlock(&dhd->pub); } } else break; } - WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_DPC); - complete_and_exit(&dhd->dpc_exited, 0); } @@ -1259,6 +1275,7 @@ dhd_sched_dpc(dhd_pub_t *dhdp) { dhd_info_t *dhd = (dhd_info_t *)dhdp->info; + dhd_os_wake_lock(dhdp); if (dhd->dpc_pid >= 0) { up(&dhd->dpc_sem); return; @@ -1575,13 +1592,9 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) if (is_set_key_cmd) { dhd_wait_pend8021x(net); } - WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_IOCTL, "dhd_ioctl_entry"); - WAKE_LOCK(&dhd->pub, WAKE_LOCK_IOCTL); bcmerror = dhd_prot_ioctl(&dhd->pub, ifidx, (wl_ioctl_t *)&ioc, buf, buflen); - WAKE_UNLOCK(&dhd->pub, WAKE_LOCK_IOCTL); - WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_IOCTL); done: if (!bcmerror && buf && ioc.buf) { if (copy_to_user(ioc.buf, buf, buflen)) @@ -1626,6 +1639,8 @@ dhd_open(struct net_device *net) #endif int ifidx; + wl_control_wl_start(net); /* start if needed */ + ifidx = dhd_net2idx(dhd, net); DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx)); @@ -1772,11 +1787,12 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) if (dhd_add_if(dhd, 0, (void *)net, net->name, NULL, 0, 0) == DHD_BAD_IF) goto fail; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)) +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) net->open = NULL; #else net->netdev_ops = NULL; #endif + init_MUTEX(&dhd->proto_sem); /* Initialize other structure content */ init_waitqueue_head(&dhd->ioctl_resp_wait); @@ -1786,6 +1802,15 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) spin_lock_init(&dhd->sdlock); spin_lock_init(&dhd->txqlock); + /* Initialize Wakelock stuff */ + spin_lock_init(&dhd->wl_lock); + dhd->wl_count = 0; + dhd->wl_packet = 0; +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_init(&dhd->wl_wifi, WAKE_LOCK_SUSPEND, "wlan_wake"); + wake_lock_init(&dhd->wl_rxwake, WAKE_LOCK_SUSPEND, "wlan_rx_wake"); +#endif + /* Link to info module */ dhd->pub.info = dhd; @@ -1859,9 +1884,6 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) register_pm_notifier(&dhd_sleep_pm_notifier); #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */ - /* Init lock suspend to prevent kernel going to suspend */ - WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_TMOUT, "dhd_wake_lock"); - WAKE_LOCK_INIT(&dhd->pub, WAKE_LOCK_LINK_DOWN_TMOUT, "dhd_wake_lock_link_dw_event"); #ifdef CONFIG_HAS_EARLYSUSPEND dhd->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 20; @@ -1894,19 +1916,12 @@ dhd_bus_start(dhd_pub_t *dhdp) /* try to download image and nvram to the dongle */ if (dhd->pub.busstate == DHD_BUS_DOWN) { - WAKE_LOCK_INIT(dhdp, WAKE_LOCK_DOWNLOAD, "dhd_bus_start"); - WAKE_LOCK(dhdp, WAKE_LOCK_DOWNLOAD); if (!(dhd_bus_download_firmware(dhd->pub.bus, dhd->pub.osh, fw_path, nv_path))) { DHD_ERROR(("%s: dhdsdio_probe_download failed. firmware = %s nvram = %s\n", __FUNCTION__, fw_path, nv_path)); - WAKE_UNLOCK(dhdp, WAKE_LOCK_DOWNLOAD); - WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_DOWNLOAD); return -1; } - - WAKE_UNLOCK(dhdp, WAKE_LOCK_DOWNLOAD); - WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_DOWNLOAD); } /* Start the watchdog timer */ @@ -1921,7 +1936,7 @@ dhd_bus_start(dhd_pub_t *dhdp) #if defined(OOB_INTR_ONLY) /* Host registration for OOB interrupt */ if (bcmsdh_register_oob_intr(dhdp)) { - del_timer(&dhd->timer); + del_timer_sync(&dhd->timer); dhd->wd_timer_valid = FALSE; DHD_ERROR(("%s Host failed to resgister for OOB\n", __FUNCTION__)); return -ENODEV; @@ -1933,7 +1948,7 @@ dhd_bus_start(dhd_pub_t *dhdp) /* If bus is not ready, can't come up */ if (dhd->pub.busstate != DHD_BUS_DATA) { - del_timer(&dhd->timer); + del_timer_sync(&dhd->timer); dhd->wd_timer_valid = FALSE; DHD_ERROR(("%s failed bus is not ready\n", __FUNCTION__)); return -ENODEV; @@ -1970,7 +1985,7 @@ dhd_iovar(dhd_pub_t *pub, int ifidx, char *name, char *cmd_buf, uint cmd_len, in return ret; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31)) static struct net_device_ops dhd_ops_pri = { .ndo_open = dhd_open, .ndo_stop = dhd_stop, @@ -1978,7 +1993,7 @@ static struct net_device_ops dhd_ops_pri = { .ndo_do_ioctl = dhd_ioctl_entry, .ndo_start_xmit = dhd_start_xmit, .ndo_set_mac_address = dhd_set_mac_address, - .ndo_set_multicast_list = dhd_set_multicast_list + .ndo_set_multicast_list = dhd_set_multicast_list, }; static struct net_device_ops dhd_ops_virt = { @@ -1986,9 +2001,10 @@ static struct net_device_ops dhd_ops_virt = { .ndo_do_ioctl = dhd_ioctl_entry, .ndo_start_xmit = dhd_start_xmit, .ndo_set_mac_address = dhd_set_mac_address, - .ndo_set_multicast_list = dhd_set_multicast_list + .ndo_set_multicast_list = dhd_set_multicast_list, }; -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) */ +#endif + int dhd_net_attach(dhd_pub_t *dhdp, int ifidx) { @@ -1999,11 +2015,10 @@ dhd_net_attach(dhd_pub_t *dhdp, int ifidx) DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx)); ASSERT(dhd && dhd->iflist[ifidx]); - net = dhd->iflist[ifidx]->net; - ASSERT(net); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)) + ASSERT(net); +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) ASSERT(!net->open); net->get_stats = dhd_get_stats; net->do_ioctl = dhd_ioctl_entry; @@ -2021,7 +2036,7 @@ dhd_net_attach(dhd_pub_t *dhdp, int ifidx) /* * device functions for the primary interface only */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)) +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) net->open = dhd_open; net->stop = dhd_stop; #else @@ -2047,7 +2062,6 @@ dhd_net_attach(dhd_pub_t *dhdp, int ifidx) #endif /* WIRELESS_EXT > 12 */ #endif /* CONFIG_WIRELESS_EXT */ - dhd->pub.rxsz = net->mtu + net->hard_header_len + dhd->pub.hdrlen; memcpy(net->dev_addr, temp_addr, ETHER_ADDR_LEN); @@ -2062,13 +2076,13 @@ dhd_net_attach(dhd_pub_t *dhdp, int ifidx) dhd->pub.mac.octet[3], dhd->pub.mac.octet[4], dhd->pub.mac.octet[5]); wl_iw_iscan_set_scan_broadcast_prep(net, 1); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && 1 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) up(&dhd_registration_sem); #endif return 0; fail: -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) net->open = NULL; #else net->netdev_ops = NULL; @@ -2096,7 +2110,7 @@ dhd_bus_detach(dhd_pub_t *dhdp) #endif /* defined(OOB_INTR_ONLY) */ /* Clear the watchdog timer */ - del_timer(&dhd->timer); + del_timer_sync(&dhd->timer); dhd->wd_timer_valid = FALSE; } } @@ -2118,6 +2132,14 @@ dhd_detach(dhd_pub_t *dhdp) #if defined(CONFIG_HAS_EARLYSUSPEND) unregister_early_suspend(&dhd->early_suspend); #endif /* defined(CONFIG_HAS_EARLYSUSPEND) */ +#ifdef CONFIG_WIRELESS_EXT + /* Attach and link in the iw */ + wl_iw_detach(); +#endif + if (dhd->sysioc_pid >= 0) { + KILL_PROC(dhd->sysioc_pid, SIGTERM); + wait_for_completion(&dhd->sysioc_exited); + } for (i = 1; i < DHD_MAX_IFS; i++) if (dhd->iflist[i]) @@ -2125,7 +2147,7 @@ dhd_detach(dhd_pub_t *dhdp) ifp = dhd->iflist[0]; ASSERT(ifp); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)) +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) if (ifp->net->open) { #else if (ifp->net->netdev_ops == &dhd_ops_pri) { @@ -2134,61 +2156,39 @@ dhd_detach(dhd_pub_t *dhdp) unregister_netdev(ifp->net); } + if (dhd->watchdog_pid >= 0) + { + KILL_PROC(dhd->watchdog_pid, SIGTERM); + wait_for_completion(&dhd->watchdog_exited); + } - if (dhd->watchdog_pid >= 0) - { - KILL_PROC(dhd->watchdog_pid, SIGTERM); - wait_for_completion(&dhd->watchdog_exited); - } - - if (dhd->dpc_pid >= 0) - { - KILL_PROC(dhd->dpc_pid, SIGTERM); - wait_for_completion(&dhd->dpc_exited); - } - else - tasklet_kill(&dhd->tasklet); - - if (dhd->sysioc_pid >= 0) { - KILL_PROC(dhd->sysioc_pid, SIGTERM); - wait_for_completion(&dhd->sysioc_exited); - } - - dhd_bus_detach(dhdp); + if (dhd->dpc_pid >= 0) + { + KILL_PROC(dhd->dpc_pid, SIGTERM); + wait_for_completion(&dhd->dpc_exited); + } + else + tasklet_kill(&dhd->tasklet); - if (dhdp->prot) - dhd_prot_detach(dhdp); + dhd_bus_detach(dhdp); -#ifdef CONFIG_WIRELESS_EXT - /* Attach and link in the iw */ - wl_iw_detach(); -#endif + if (dhdp->prot) + dhd_prot_detach(dhdp); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) - unregister_pm_notifier(&dhd_sleep_pm_notifier); + unregister_pm_notifier(&dhd_sleep_pm_notifier); #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */ - WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_TMOUT); - WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_LINK_DOWN_TMOUT); - free_netdev(ifp->net); - MFREE(dhd->pub.osh, ifp, sizeof(*ifp)); - MFREE(dhd->pub.osh, dhd, sizeof(*dhd)); - } -} -} -static void __exit -dhd_module_cleanup(void) -{ - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - dhd_bus_unregister(); -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) - wifi_del_dev(); + free_netdev(ifp->net); +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_destroy(&dhd->wl_wifi); + wake_lock_destroy(&dhd->wl_rxwake); #endif - /* Call customer gpio to turn off power with WL_REG_ON signal */ - dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF); + MFREE(dhd->pub.osh, ifp, sizeof(*ifp)); + MFREE(dhd->pub.osh, dhd, sizeof(*dhd)); + } + } } - static int __init dhd_module_init(void) { @@ -2209,6 +2209,7 @@ dhd_module_init(void) DHD_ERROR(("Invalid module parameters.\n")); return -EINVAL; } while (0); + /* Call customer gpio to turn on power with WL_REG_ON signal */ dhd_customer_gpio_wlan_ctrl(WLAN_POWER_ON); @@ -2218,19 +2219,18 @@ dhd_module_init(void) error = wifi_add_dev(); if (error) { DHD_ERROR(("%s: platform_driver_register failed\n", __FUNCTION__)); - goto faild; + goto fail_0; } /* Waiting callback after platform_driver_register is done or exit with error */ - if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) { - printk("%s: platform_driver_register timeout\n", __FUNCTION__); - /* renove device */ - wifi_del_dev(); - goto faild; + if (down_timeout(&wifi_control_sem, msecs_to_jiffies(5000)) != 0) { + error = -EINVAL; + DHD_ERROR(("%s: platform_driver_register timeout\n", __FUNCTION__)); + goto fail_1; } #endif /* #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && 1 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) sema_init(&dhd_registration_sem, 0); #endif @@ -2240,28 +2240,51 @@ dhd_module_init(void) printf("\n%s\n", dhd_version); else { DHD_ERROR(("%s: sdio_register_driver failed\n", __FUNCTION__)); - goto faild; + goto fail_1; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && 1 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) /* * Wait till MMC sdio_register_driver callback called and made driver attach. * It's needed to make sync up exit from dhd insmod and * Kernel MMC sdio device callback registration */ - if (down_timeout(&dhd_registration_sem, msecs_to_jiffies(DHD_REGISTRATION_TIMEOUT)) != 0) { + if (down_timeout(&dhd_registration_sem, msecs_to_jiffies(10000)) != 0) { error = -EINVAL; DHD_ERROR(("%s: sdio_register_driver timeout\n", __FUNCTION__)); - dhd_bus_unregister(); + goto fail_2; } #endif return error; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) +fail_2: + dhd_bus_unregister(); +#endif +fail_1: +#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) + wifi_del_dev(); +fail_0: +#endif /* defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */ + + /* Call customer gpio to turn off power with WL_REG_ON signal */ + dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF); + + return error; +} + +static void __exit +dhd_module_cleanup(void) +{ + DHD_TRACE(("%s: Enter\n", __FUNCTION__)); -faild: - /* turn off power and exit */ + dhd_bus_unregister(); +#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) + wifi_del_dev(); +#endif + /* Call customer gpio to turn off power with WL_REG_ON signal */ dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF); - return -EINVAL; } + module_init(dhd_module_init); module_exit(dhd_module_cleanup); @@ -2348,34 +2371,22 @@ void dhd_os_wd_timer(void *bus, uint wdtick) { dhd_pub_t *pub = bus; - static uint save_dhd_watchdog_ms = 0; dhd_info_t *dhd = (dhd_info_t *)pub->info; + static uint save_dhd_watchdog_ms = 0; /* Totally stop the timer */ if (!wdtick && dhd->wd_timer_valid == TRUE) { - del_timer(&dhd->timer); + del_timer_sync(&dhd->timer); dhd->wd_timer_valid = FALSE; save_dhd_watchdog_ms = wdtick; return; } if (wdtick) { - dhd_watchdog_ms = (uint) wdtick; - if (save_dhd_watchdog_ms != dhd_watchdog_ms) { - - if (dhd->wd_timer_valid == TRUE) - /* Stop timer and restart at new value */ - del_timer(&dhd->timer); - - /* Create timer again when watchdog period is - dynamically changed or in the first instance - */ - dhd->timer.expires = jiffies + dhd_watchdog_ms * HZ / 1000; - add_timer(&dhd->timer); - }else { - /* Re arm the timer, at last watchdog period */ - mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000); - } + dhd_watchdog_ms = (uint)wdtick; + + /* Re arm the timer, at last watchdog period */ + mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000); dhd->wd_timer_valid = TRUE; save_dhd_watchdog_ms = wdtick; @@ -2434,7 +2445,7 @@ dhd_os_sdlock(dhd_pub_t *pub) if (dhd->threads_only) down(&dhd->sdsem); else - spin_lock_bh(&dhd->sdlock); + spin_lock_bh(&dhd->sdlock); } void @@ -2447,7 +2458,7 @@ dhd_os_sdunlock(dhd_pub_t *pub) if (dhd->threads_only) up(&dhd->sdsem); else - spin_unlock_bh(&dhd->sdlock); + spin_unlock_bh(&dhd->sdlock); } void @@ -2560,7 +2571,7 @@ dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data) void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar) { -#if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) struct dhd_info *dhdinfo = dhd->info; dhd_os_sdunlock(dhd); wait_event_interruptible_timeout(dhdinfo->ctrl_wait, (*lockvar == FALSE), HZ * 2); @@ -2571,13 +2582,14 @@ void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar) void dhd_wait_event_wakeup(dhd_pub_t *dhd) { -#if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) struct dhd_info *dhdinfo = dhd->info; if (waitqueue_active(&dhdinfo->ctrl_wait)) wake_up_interruptible(&dhdinfo->ctrl_wait); #endif return; } + int dhd_dev_reset(struct net_device *dev, uint8 flag) { @@ -2592,6 +2604,7 @@ dhd_dev_reset(struct net_device *dev, uint8 flag) /* Turning on watchdog back */ if (!flag) dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms); + DHD_ERROR(("%s: WLAN OFF DONE\n", __FUNCTION__)); return 1; @@ -2632,3 +2645,120 @@ dhd_wait_pend8021x(struct net_device *dev) } return pend; } + +int dhd_os_wake_lock_timeout(dhd_pub_t *pub) +{ + dhd_info_t *dhd = (dhd_info_t *)(pub->info); + unsigned long flags; + int ret = 0; + + if (dhd) { + spin_lock_irqsave(&dhd->wl_lock, flags); + ret = dhd->wl_packet; +#ifdef CONFIG_HAS_WAKELOCK + if (dhd->wl_packet) + wake_lock_timeout(&dhd->wl_rxwake, HZ); +#endif + dhd->wl_packet = 0; + spin_unlock_irqrestore(&dhd->wl_lock, flags); + } + /* printk("%s: %d\n", __FUNCTION__, ret); */ + return ret; +} + +int net_os_wake_lock_timeout(struct net_device *dev) +{ + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); + int ret = 0; + + if (dhd) + ret = dhd_os_wake_lock_timeout(&dhd->pub); + return ret; +} + +int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub) +{ + dhd_info_t *dhd = (dhd_info_t *)(pub->info); + unsigned long flags; + + if (dhd) { + spin_lock_irqsave(&dhd->wl_lock, flags); + dhd->wl_packet = 1; + spin_unlock_irqrestore(&dhd->wl_lock, flags); + } + /* printk("%s\n",__func__); */ + return 0; +} + +int net_os_wake_lock_timeout_enable(struct net_device *dev) +{ + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); + int ret = 0; + + if (dhd) + ret = dhd_os_wake_lock_timeout_enable(&dhd->pub); + return ret; +} + +int dhd_os_wake_lock(dhd_pub_t *pub) +{ + dhd_info_t *dhd = (dhd_info_t *)(pub->info); + unsigned long flags; + int ret = 0; + + if (dhd) { + spin_lock_irqsave(&dhd->wl_lock, flags); +#ifdef CONFIG_HAS_WAKELOCK + if (!dhd->wl_count) + wake_lock(&dhd->wl_wifi); +#endif + dhd->wl_count++; + ret = dhd->wl_count; + spin_unlock_irqrestore(&dhd->wl_lock, flags); + } + /* printk("%s: %d\n", __FUNCTION__, ret); */ + return ret; +} + +int net_os_wake_lock(struct net_device *dev) +{ + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); + int ret = 0; + + if (dhd) + ret = dhd_os_wake_lock(&dhd->pub); + return ret; +} + +int dhd_os_wake_unlock(dhd_pub_t *pub) +{ + dhd_info_t *dhd = (dhd_info_t *)(pub->info); + unsigned long flags; + int ret = 0; + + dhd_os_wake_lock_timeout(pub); + if (dhd) { + spin_lock_irqsave(&dhd->wl_lock, flags); + if (dhd->wl_count) { + dhd->wl_count--; +#ifdef CONFIG_HAS_WAKELOCK + if (!dhd->wl_count) + wake_unlock(&dhd->wl_wifi); +#endif + ret = dhd->wl_count; + } + spin_unlock_irqrestore(&dhd->wl_lock, flags); + } + /* printk("%s: %d\n", __FUNCTION__, ret); */ + return ret; +} + +int net_os_wake_unlock(struct net_device *dev) +{ + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); + int ret = 0; + + if (dhd) + ret = dhd_os_wake_unlock(&dhd->pub); + return ret; +} diff --git a/bcm4329/src/dhd/sys/dhd_linux_sched.c b/bcm4329/src/dhd/sys/dhd_linux_sched.c index 480b416..3189123 100644 --- a/bcm4329/src/dhd/sys/dhd_linux_sched.c +++ b/bcm4329/src/dhd/sys/dhd_linux_sched.c @@ -1,7 +1,7 @@ /* * Expose some of the kernel scheduler routines * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/dhd/sys/dhd_proto.h b/bcm4329/src/dhd/sys/dhd_proto.h index 79584d6..1e2401a 100644 --- a/bcm4329/src/dhd/sys/dhd_proto.h +++ b/bcm4329/src/dhd/sys/dhd_proto.h @@ -4,7 +4,7 @@ * Provides type definitions and function prototypes used to link the * DHD OS, bus, and protocol modules. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/dhd/sys/dhd_sdio.c b/bcm4329/src/dhd/sys/dhd_sdio.c index b006623..e571671 100644 --- a/bcm4329/src/dhd/sys/dhd_sdio.c +++ b/bcm4329/src/dhd/sys/dhd_sdio.c @@ -689,9 +689,10 @@ dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok) /* Early exit if we're already there */ if (bus->clkstate == target) { - if (target == CLK_AVAIL) + if (target == CLK_AVAIL) { dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms); bus->activity = TRUE; + } return BCME_OK; } @@ -3751,7 +3752,7 @@ dhdsdio_dpc(dhd_bus_t *bus) if (err) { DHD_ERROR(("%s: error reading DEVCTL: %d\n", __FUNCTION__, err)); bus->dhd->busstate = DHD_BUS_DOWN; - }else + } else ASSERT(devctl & SBSDIO_DEVCTL_CA_INT_ONLY); #endif /* DHD_DEBUG */ @@ -4009,13 +4010,14 @@ dhdsdio_isr(void *arg) #if defined(SDIO_ISR_THREAD) DHD_TRACE(("Calling dhdsdio_dpc() from %s\n", __FUNCTION__)); + dhd_os_wake_lock(bus->dhd); while (dhdsdio_dpc(bus)); + dhd_os_wake_unlock(bus->dhd); #else bus->dpc_sched = TRUE; dhd_sched_dpc(bus->dhd); #endif - } #ifdef SDTEST @@ -4526,12 +4528,15 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot, /* if firmware path present try to download and bring up bus */ if ((ret = dhd_bus_start(bus->dhd)) != 0) { +#if 1 DHD_ERROR(("%s: failed\n", __FUNCTION__)); goto fail; +#else if (ret == BCME_NOTUP) { DHD_ERROR(("%s: dongle is not responding\n", __FUNCTION__)); goto fail; } +#endif } /* Ok, have the per-port tell the stack we're open for business */ if (dhd_net_attach(bus->dhd, 0) != 0) { @@ -4832,7 +4837,6 @@ dhd_bus_download_firmware(struct dhd_bus *bus, osl_t *osh, ret = dhdsdio_download_firmware(bus, osh, bus->sdh); - return ret; } @@ -4842,12 +4846,13 @@ dhdsdio_download_firmware(struct dhd_bus *bus, osl_t *osh, void *sdh) bool ret; /* Download the firmware */ + dhd_os_wake_lock(bus->dhd); dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); ret = _dhdsdio_download_firmware(bus) == 0; dhdsdio_clkctl(bus, CLK_SDONLY, FALSE); - + dhd_os_wake_unlock(bus->dhd); return ret; } diff --git a/bcm4329/src/dongle/dngl_stats.h b/bcm4329/src/dongle/dngl_stats.h index e5db54e..c1776a8 100644 --- a/bcm4329/src/dongle/dngl_stats.h +++ b/bcm4329/src/dongle/dngl_stats.h @@ -2,7 +2,7 @@ * Common stats definitions for clients of dongle * ports * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/aidmp.h b/bcm4329/src/include/aidmp.h index a927e5d..44b3de8 100644 --- a/bcm4329/src/include/aidmp.h +++ b/bcm4329/src/include/aidmp.h @@ -1,7 +1,7 @@ /* * Broadcom AMBA Interconnect definitions. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/bcmcdc.h b/bcm4329/src/include/bcmcdc.h index c2a860b..641d755 100644 --- a/bcm4329/src/include/bcmcdc.h +++ b/bcm4329/src/include/bcmcdc.h @@ -4,7 +4,7 @@ * * Definitions subject to change without notice. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/bcmdefs.h b/bcm4329/src/include/bcmdefs.h index 67d1158..f4e9946 100644 --- a/bcm4329/src/include/bcmdefs.h +++ b/bcm4329/src/include/bcmdefs.h @@ -27,31 +27,8 @@ #ifndef _bcmdefs_h_ #define _bcmdefs_h_ - - - - - - -#define bcmreclaimed 0 -#define r2_reclaimed 0 -#define _data _data -#define _fn _fn -#define _data _data -#define _fn _fn -#define _fn _fn -#define BCMPREATTACHDATA(_data) _data -#define BCMPREATTACHFN(_fn) _fn -#define CONST const - - - -#define _data _data -#define _fn _fn -#define _fn _fn #define STATIC static - #define SI_BUS 0 #define PCI_BUS 1 #define PCMCIA_BUS 2 diff --git a/bcm4329/src/include/bcmdevs.h b/bcm4329/src/include/bcmdevs.h index 910e246..acfd414 100644 --- a/bcm4329/src/include/bcmdevs.h +++ b/bcm4329/src/include/bcmdevs.h @@ -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: bcmdevs.h,v 13.172.4.5.4.10.2.29 2010/03/01 08:56:24 Exp $ + * $Id: bcmdevs.h,v 13.172.4.5.4.10.2.28 2010/01/28 06:57:23 Exp $ */ diff --git a/bcm4329/src/include/bcmendian.h b/bcm4329/src/include/bcmendian.h index ae46838..38887df 100644 --- a/bcm4329/src/include/bcmendian.h +++ b/bcm4329/src/include/bcmendian.h @@ -1,7 +1,7 @@ /* * Byte order utilities * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/bcmpcispi.h b/bcm4329/src/include/bcmpcispi.h index 7d98fb7..e3be826 100644 --- a/bcm4329/src/include/bcmpcispi.h +++ b/bcm4329/src/include/bcmpcispi.h @@ -1,7 +1,7 @@ /* * Broadcom PCI-SPI Host Controller Register Definitions * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/bcmperf.h b/bcm4329/src/include/bcmperf.h index 2a78784..dfc3f44 100644 --- a/bcm4329/src/include/bcmperf.h +++ b/bcm4329/src/include/bcmperf.h @@ -1,7 +1,7 @@ /* * Performance counters software interface. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/bcmsdbus.h b/bcm4329/src/include/bcmsdbus.h index b7b67bc..0e629c0 100644 --- a/bcm4329/src/include/bcmsdbus.h +++ b/bcm4329/src/include/bcmsdbus.h @@ -2,7 +2,7 @@ * Definitions for API from sdio common code (bcmsdh) to individual * host controller drivers. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/bcmsdh.h b/bcm4329/src/include/bcmsdh.h index f5dee5c..f8ab8ab 100644 --- a/bcm4329/src/include/bcmsdh.h +++ b/bcm4329/src/include/bcmsdh.h @@ -3,7 +3,7 @@ * export functions to client drivers * abstract OS and BUS specific details of SDIO * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/bcmsdh_sdmmc.h b/bcm4329/src/include/bcmsdh_sdmmc.h index 4e6d1b5..b572f34 100644 --- a/bcm4329/src/include/bcmsdh_sdmmc.h +++ b/bcm4329/src/include/bcmsdh_sdmmc.h @@ -1,7 +1,7 @@ /* * BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/bcmsdpcm.h b/bcm4329/src/include/bcmsdpcm.h index 450c9c3..b63b1d3 100644 --- a/bcm4329/src/include/bcmsdpcm.h +++ b/bcm4329/src/include/bcmsdpcm.h @@ -2,7 +2,7 @@ * Broadcom SDIO/PCMCIA * Software-specific definitions shared between device and host side * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/bcmsdspi.h b/bcm4329/src/include/bcmsdspi.h index eaae10d..b1e2be9 100644 --- a/bcm4329/src/include/bcmsdspi.h +++ b/bcm4329/src/include/bcmsdspi.h @@ -1,7 +1,7 @@ /* * SD-SPI Protocol Conversion - BCMSDH->SPI Translation Layer * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/bcmspi.h b/bcm4329/src/include/bcmspi.h index 2e2bc93..0c46538 100644 --- a/bcm4329/src/include/bcmspi.h +++ b/bcm4329/src/include/bcmspi.h @@ -1,7 +1,7 @@ /* * Broadcom SPI Low-Level Hardware Driver API * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/bcmwifi.h b/bcm4329/src/include/bcmwifi.h index 038aedc..52f17a6 100644 --- a/bcm4329/src/include/bcmwifi.h +++ b/bcm4329/src/include/bcmwifi.h @@ -42,7 +42,7 @@ typedef uint16 chanspec_t; #define CH_5MHZ_APART 1 #define CH_MAX_2G_CHANNEL 14 #define WLC_MAX_2G_CHANNEL CH_MAX_2G_CHANNEL -#define MAXCHANNEL 224 +#define MAXCHANNEL 224 #define WL_CHANSPEC_CHAN_MASK 0x00ff #define WL_CHANSPEC_CHAN_SHIFT 0 @@ -118,7 +118,7 @@ typedef uint16 chanspec_t; (LOWER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK))) : \ (UPPER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK)))) -#define CHSPEC2WLC_BAND(chspec) (CHSPEC_IS5G((chspec))? WLC_BAND_5G: WLC_BAND_2G) +#define CHSPEC2WLC_BAND(chspec) (CHSPEC_IS5G((chspec)) ? WLC_BAND_5G : WLC_BAND_2G) #define CHANSPEC_STR_LEN 8 diff --git a/bcm4329/src/include/dhdioctl.h b/bcm4329/src/include/dhdioctl.h index 706b4a8..ee78c3d 100644 --- a/bcm4329/src/include/dhdioctl.h +++ b/bcm4329/src/include/dhdioctl.h @@ -5,7 +5,7 @@ * * Definitions subject to change without notice. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/hndpmu.h b/bcm4329/src/include/hndpmu.h index e5568e7..afd78d7 100644 --- a/bcm4329/src/include/hndpmu.h +++ b/bcm4329/src/include/hndpmu.h @@ -1,7 +1,7 @@ /* * HND SiliconBackplane PMU support. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/hndsoc.h b/bcm4329/src/include/hndsoc.h index 3542417..dcbab43 100644 --- a/bcm4329/src/include/hndsoc.h +++ b/bcm4329/src/include/hndsoc.h @@ -1,7 +1,7 @@ /* * Broadcom HND chip & on-chip-interconnect-related definitions. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/linux_osl.h b/bcm4329/src/include/linux_osl.h index c8c658e..98afe9c 100644 --- a/bcm4329/src/include/linux_osl.h +++ b/bcm4329/src/include/linux_osl.h @@ -1,7 +1,7 @@ /* * Linux OS Independent Layer * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/linuxver.h b/bcm4329/src/include/linuxver.h index c329ec2..a36de95 100644 --- a/bcm4329/src/include/linuxver.h +++ b/bcm4329/src/include/linuxver.h @@ -2,7 +2,7 @@ * Linux-specific abstractions to gain some independence from linux kernel versions. * Pave over some 2.2 versus 2.4 versus 2.6 kernel differences. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you @@ -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: linuxver.h,v 13.38.8.1.8.5 2010/02/04 13:47:16 Exp $ + * $Id: linuxver.h,v 13.38.8.1.8.3 2009/06/19 04:42:45 Exp $ */ @@ -425,22 +425,11 @@ pci_restore_state(struct pci_dev *dev, u32 *buffer) #define CHECKSUM_HW CHECKSUM_PARTIAL #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) -#define KILL_PROC(nr, sig) \ -{ \ -struct task_struct *tsk; \ -struct pid *pid; \ -pid = find_get_pid((pid_t)nr); \ -tsk = pid_task(pid, PIDTYPE_PID); \ -if (tsk) send_sig(sig, tsk, 1); \ -} -#else -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (LINUX_VERSION_CODE <= \ - KERNEL_VERSION(2, 6, 30)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) #define KILL_PROC(pid, sig) \ { \ struct task_struct *tsk; \ - tsk = find_task_by_vpid(pid); \ + tsk = pid_task(find_vpid(pid), PIDTYPE_PID); \ if (tsk) send_sig(sig, tsk, 1); \ } #else @@ -449,7 +438,6 @@ if (tsk) send_sig(sig, tsk, 1); \ kill_proc(pid, sig, 1); \ } #endif -#endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) #define netdev_priv(dev) dev->priv diff --git a/bcm4329/src/include/miniopt.h b/bcm4329/src/include/miniopt.h index 3667fb1..91e6603 100644 --- a/bcm4329/src/include/miniopt.h +++ b/bcm4329/src/include/miniopt.h @@ -1,7 +1,7 @@ /* * Command line options parser. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/msgtrace.h b/bcm4329/src/include/msgtrace.h index 1479086..d79a89e 100644 --- a/bcm4329/src/include/msgtrace.h +++ b/bcm4329/src/include/msgtrace.h @@ -1,7 +1,7 @@ /* * Trace messages sent over HBUS * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/osl.h b/bcm4329/src/include/osl.h index 5599e53..02b2b21 100644 --- a/bcm4329/src/include/osl.h +++ b/bcm4329/src/include/osl.h @@ -1,7 +1,7 @@ /* * OS Abstraction Layer * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/packed_section_end.h b/bcm4329/src/include/packed_section_end.h index 5b61c18..e455d69 100644 --- a/bcm4329/src/include/packed_section_end.h +++ b/bcm4329/src/include/packed_section_end.h @@ -15,7 +15,7 @@ * #include <packed_section_end.h> * * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/packed_section_start.h b/bcm4329/src/include/packed_section_start.h index cb93aa6..a15562e 100644 --- a/bcm4329/src/include/packed_section_start.h +++ b/bcm4329/src/include/packed_section_start.h @@ -15,7 +15,7 @@ * #include <packed_section_end.h> * * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/pcicfg.h b/bcm4329/src/include/pcicfg.h index 898962c..61c2f4a 100644 --- a/bcm4329/src/include/pcicfg.h +++ b/bcm4329/src/include/pcicfg.h @@ -1,7 +1,7 @@ /* * pcicfg.h: PCI configuration constants and structures. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/proto/802.11e.h b/bcm4329/src/include/proto/802.11e.h index 1dd6f45..0c53530 100644 --- a/bcm4329/src/include/proto/802.11e.h +++ b/bcm4329/src/include/proto/802.11e.h @@ -1,7 +1,7 @@ /* * 802.11e protocol header file * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/proto/802.1d.h b/bcm4329/src/include/proto/802.1d.h index 45c728b..efd7117 100644 --- a/bcm4329/src/include/proto/802.1d.h +++ b/bcm4329/src/include/proto/802.1d.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/proto/bcmeth.h b/bcm4329/src/include/proto/bcmeth.h index fdb5a2a..bd34a0b 100644 --- a/bcm4329/src/include/proto/bcmeth.h +++ b/bcm4329/src/include/proto/bcmeth.h @@ -1,7 +1,7 @@ /* * Broadcom Ethernettype protocol definitions * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/proto/bcmevent.h b/bcm4329/src/include/proto/bcmevent.h index 46c04d3..1791478 100644 --- a/bcm4329/src/include/proto/bcmevent.h +++ b/bcm4329/src/include/proto/bcmevent.h @@ -1,7 +1,7 @@ /* * Broadcom Event protocol definitions * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/proto/bcmip.h b/bcm4329/src/include/proto/bcmip.h index 9d2fd6f..9645016 100644 --- a/bcm4329/src/include/proto/bcmip.h +++ b/bcm4329/src/include/proto/bcmip.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/proto/ethernet.h b/bcm4329/src/include/proto/ethernet.h index c2fc4bf..05530d5 100644 --- a/bcm4329/src/include/proto/ethernet.h +++ b/bcm4329/src/include/proto/ethernet.h @@ -1,7 +1,7 @@ /* * From FreeBSD 2.2.7: Fundamental constants relating to ethernet. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you @@ -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: ethernet.h,v 9.45.56.5 2010/02/22 22:04:36 Exp $ + * $Id: ethernet.h,v 9.45.56.3 2009/08/15 00:51:27 Exp $ */ diff --git a/bcm4329/src/include/proto/sdspi.h b/bcm4329/src/include/proto/sdspi.h index 7739e68..3c7bcf3 100644 --- a/bcm4329/src/include/proto/sdspi.h +++ b/bcm4329/src/include/proto/sdspi.h @@ -1,7 +1,7 @@ /* * SD-SPI Protocol Standard * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/proto/vlan.h b/bcm4329/src/include/proto/vlan.h index 670bc44..2dda4d5 100644 --- a/bcm4329/src/include/proto/vlan.h +++ b/bcm4329/src/include/proto/vlan.h @@ -1,7 +1,7 @@ /* * 802.1Q VLAN protocol definitions * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/proto/wpa.h b/bcm4329/src/include/proto/wpa.h index f5d0cd5..4c50125 100644 --- a/bcm4329/src/include/proto/wpa.h +++ b/bcm4329/src/include/proto/wpa.h @@ -1,7 +1,7 @@ /* * Fundamental types and constants relating to WPA * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/sbconfig.h b/bcm4329/src/include/sbconfig.h index da18ccb..edf497c 100644 --- a/bcm4329/src/include/sbconfig.h +++ b/bcm4329/src/include/sbconfig.h @@ -1,7 +1,7 @@ /* * Broadcom SiliconBackplane hardware register definitions. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/sbhnddma.h b/bcm4329/src/include/sbhnddma.h index 7681395..2aeee9e 100644 --- a/bcm4329/src/include/sbhnddma.h +++ b/bcm4329/src/include/sbhnddma.h @@ -2,7 +2,7 @@ * Generic Broadcom Home Networking Division (HND) DMA engine HW interface * This supports the following chips: BCM42xx, 44xx, 47xx . * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/sbpcmcia.h b/bcm4329/src/include/sbpcmcia.h index d6d8033..121b1a9 100644 --- a/bcm4329/src/include/sbpcmcia.h +++ b/bcm4329/src/include/sbpcmcia.h @@ -1,7 +1,7 @@ /* * BCM43XX Sonics SiliconBackplane PCMCIA core hardware definitions. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/sbsdio.h b/bcm4329/src/include/sbsdio.h index 75aaf4d..43ed6b5 100644 --- a/bcm4329/src/include/sbsdio.h +++ b/bcm4329/src/include/sbsdio.h @@ -4,7 +4,7 @@ * * SDIO core support 1bit, 4 bit SDIO mode as well as SPI mode. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/sbsdpcmdev.h b/bcm4329/src/include/sbsdpcmdev.h index 7c7c7e4..57e832d 100644 --- a/bcm4329/src/include/sbsdpcmdev.h +++ b/bcm4329/src/include/sbsdpcmdev.h @@ -1,7 +1,7 @@ /* * Broadcom SiliconBackplane SDIO/PCMCIA hardware-specific device core support * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/sbsocram.h b/bcm4329/src/include/sbsocram.h index 5ede0b6..170e8f2 100644 --- a/bcm4329/src/include/sbsocram.h +++ b/bcm4329/src/include/sbsocram.h @@ -1,7 +1,7 @@ /* * BCM47XX Sonics SiliconBackplane embedded ram core * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/sdio.h b/bcm4329/src/include/sdio.h index 280cb84..d20d69c 100644 --- a/bcm4329/src/include/sdio.h +++ b/bcm4329/src/include/sdio.h @@ -2,7 +2,7 @@ * SDIO spec header file * Protocol and standard (common) device definitions * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/trxhdr.h b/bcm4329/src/include/trxhdr.h index 8f5eed9..b79ac35 100644 --- a/bcm4329/src/include/trxhdr.h +++ b/bcm4329/src/include/trxhdr.h @@ -1,7 +1,7 @@ /* * TRX image file header format. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/include/typedefs.h b/bcm4329/src/include/typedefs.h index 4d9dd76..e4daeee 100644 --- a/bcm4329/src/include/typedefs.h +++ b/bcm4329/src/include/typedefs.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/shared/aiutils.c b/bcm4329/src/shared/aiutils.c index a1d00ec..1962711 100644 --- a/bcm4329/src/shared/aiutils.c +++ b/bcm4329/src/shared/aiutils.c @@ -2,7 +2,7 @@ * Misc utility routines for accessing chip-specific features * of the SiliconBackplane-based Broadcom chips. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/shared/bcmwifi.c b/bcm4329/src/shared/bcmwifi.c index 803acf8..641a4fd 100644 --- a/bcm4329/src/shared/bcmwifi.c +++ b/bcm4329/src/shared/bcmwifi.c @@ -3,7 +3,7 @@ * Contents are wifi-specific, used by any kernel or app-level * software that might want wifi things as it grows. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/shared/hndpmu.c b/bcm4329/src/shared/hndpmu.c index 38d72b3..25712ac 100644 --- a/bcm4329/src/shared/hndpmu.c +++ b/bcm4329/src/shared/hndpmu.c @@ -2,7 +2,7 @@ * Misc utility routines for accessing PMU corerev specific features * of the SiliconBackplane-based Broadcom chips. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you @@ -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: hndpmu.c,v 1.95.2.17.4.11.2.58 2010/03/10 21:36:44 Exp $ + * $Id: hndpmu.c,v 1.95.2.17.4.11.2.50 2009/10/26 14:45:51 Exp $ */ #include <typedefs.h> diff --git a/bcm4329/src/shared/linux_osl.c b/bcm4329/src/shared/linux_osl.c index c2f5682..6383e00 100644 --- a/bcm4329/src/shared/linux_osl.c +++ b/bcm4329/src/shared/linux_osl.c @@ -151,8 +151,10 @@ osl_t * osl_attach(void *pdev, uint bustype, bool pkttag) { osl_t *osh; + gfp_t flags; - osh = kmalloc(sizeof(osl_t), GFP_ATOMIC); + flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL; + osh = kmalloc(sizeof(osl_t), flags); ASSERT(osh); bzero(osh, sizeof(osl_t)); @@ -193,9 +195,9 @@ osl_attach(void *pdev, uint bustype, bool pkttag) STATIC_BUF_TOTAL_LEN))) { printk("can not alloc static buf!\n"); } - else - printk("alloc static buf at %x!\n", (unsigned int)bcm_static_buf); - + else { + /* printk("alloc static buf at %x!\n", (unsigned int)bcm_static_buf); */ + } init_MUTEX(&bcm_static_buf->static_sem); @@ -453,8 +455,8 @@ void* osl_malloc(osl_t *osh, uint size) { void *addr; + gfp_t flags; - if (osh) ASSERT(osh->magic == OS_HANDLE_MAGIC); @@ -491,8 +493,8 @@ osl_malloc(osl_t *osh, uint size) } original: #endif - - if ((addr = kmalloc(size, GFP_ATOMIC)) == NULL) { + flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL; + if ((addr = kmalloc(size, flags)) == NULL) { if (osh) osh->failed++; return (NULL); @@ -604,8 +606,10 @@ void * osl_pktdup(osl_t *osh, void *skb) { void * p; + gfp_t flags; - if ((p = skb_clone((struct sk_buff*)skb, GFP_ATOMIC)) == NULL) + flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL; + if ((p = skb_clone((struct sk_buff*)skb, flags)) == NULL) return NULL; diff --git a/bcm4329/src/shared/miniopt.c b/bcm4329/src/shared/miniopt.c index 6a184a7..44199ea 100644 --- a/bcm4329/src/shared/miniopt.c +++ b/bcm4329/src/shared/miniopt.c @@ -1,7 +1,7 @@ /* * Description. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/shared/sbutils.c b/bcm4329/src/shared/sbutils.c index 7500f14..567e94e 100644 --- a/bcm4329/src/shared/sbutils.c +++ b/bcm4329/src/shared/sbutils.c @@ -2,7 +2,7 @@ * Misc utility routines for accessing chip-specific features * of the SiliconBackplane-based Broadcom chips. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/shared/siutils_priv.h b/bcm4329/src/shared/siutils_priv.h index e8ad7e5..1ec59aa 100644 --- a/bcm4329/src/shared/siutils_priv.h +++ b/bcm4329/src/shared/siutils_priv.h @@ -1,7 +1,7 @@ /* * Include file private to the SOC Interconnect support files. * - * Copyright (C) 1999-2010, Broadcom Corporation + * Copyright (C) 1999-2009, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you diff --git a/bcm4329/src/wl/sys/wl_iw.c b/bcm4329/src/wl/sys/wl_iw.c index d67daf3..e324dd3 100644 --- a/bcm4329/src/wl/sys/wl_iw.c +++ b/bcm4329/src/wl/sys/wl_iw.c @@ -56,8 +56,8 @@ typedef const struct si_pub si_t; #include <wl_iw.h> - #include <linux/rtnetlink.h> +#include <linux/mutex.h> #define WL_IW_USE_ISCAN 1 #define ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS 1 @@ -68,7 +68,7 @@ static struct net_device *priv_dev; static bool ap_cfg_running = FALSE; static bool ap_fw_loaded = FALSE; static int ap_mode = 0; -#endif +#endif #define WL_IW_IOCTL_CALL(func_call) \ do { \ @@ -76,6 +76,7 @@ static int ap_mode = 0; } while (0) static int g_onoff = G_WLAN_SET_ON; +static struct mutex wl_start_lock; extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status, uint32 reason, char* stringBuf, uint buflen); @@ -147,7 +148,6 @@ int wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag); #define ISCAN_STATE_IDLE 0 #define ISCAN_STATE_SCANING 1 - #define WLC_IW_ISCAN_MAXLEN 2048 typedef struct iscan_buf { struct iscan_buf * next; @@ -172,7 +172,7 @@ typedef struct iscan_info { char ioctlbuf[WLC_IOCTL_SMLEN]; } iscan_info_t; -#define COEX_DHCP 1 +#define COEX_DHCP 1 static void wl_iw_bt_flag_set(struct net_device *dev, bool set); static void wl_iw_bt_release(void); @@ -267,35 +267,43 @@ dev_wlc_ioctl( struct ifreq ifr; wl_ioctl_t ioc; mm_segment_t fs; - int ret = -1; + int ret = -EINVAL; if (!dev) { WL_ERROR(("%s: dev is null\n", __FUNCTION__)); return ret; } - WL_TRACE(("\n%s, PID:%x: send Local IOCTL -> dhd: cmd:0x%x, buf:%p, len:%d ,\n", + WL_TRACE(("%s, PID:%x: send Local IOCTL -> dhd: cmd:0x%x, buf:%p, len:%d ,\n", __FUNCTION__, current->pid, cmd, arg, len)); - memset(&ioc, 0, sizeof(ioc)); - ioc.cmd = cmd; - ioc.buf = arg; - ioc.len = len; - strcpy(ifr.ifr_name, dev->name); - ifr.ifr_data = (caddr_t) &ioc; + if (g_onoff == G_WLAN_SET_ON) { + memset(&ioc, 0, sizeof(ioc)); + ioc.cmd = cmd; + ioc.buf = arg; + ioc.len = len; - - dev_open(dev); + strcpy(ifr.ifr_name, dev->name); + ifr.ifr_data = (caddr_t) &ioc; - fs = get_fs(); - set_fs(get_ds()); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) - ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE); -#else - ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE); -#endif - set_fs(fs); + ret = dev_open(dev); + if (ret) { + WL_ERROR(("%s: Error dev_open: %d\n", __func__, ret)); + return ret; + } + fs = get_fs(); + set_fs(get_ds()); +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) + ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE); +#else + ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE); +#endif + set_fs(fs); + } + else { + WL_TRACE(("%s: call after driver stop\n", __FUNCTION__)); + } return ret; } @@ -385,11 +393,7 @@ dev_wlc_bufvar_set( char *name, char *buf, int len) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) - char ioctlbuf[MAX_WLIW_IOCTL_LEN]; -#else static char ioctlbuf[MAX_WLIW_IOCTL_LEN]; -#endif uint buflen; buflen = bcm_mkiovar(name, buf, len, ioctlbuf, sizeof(ioctlbuf)); @@ -397,7 +401,7 @@ dev_wlc_bufvar_set( return (dev_wlc_ioctl(dev, WLC_SET_VAR, ioctlbuf, buflen)); } -#endif +#endif static int @@ -406,11 +410,7 @@ dev_wlc_bufvar_get( char *name, char *buf, int buflen) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) - char ioctlbuf[MAX_WLIW_IOCTL_LEN]; -#else static char ioctlbuf[MAX_WLIW_IOCTL_LEN]; -#endif int error; uint len; @@ -549,9 +549,9 @@ wl_iw_set_country( int country_offset; int country_code_size; + WL_TRACE(("%s\n", __FUNCTION__)); memset(country_code, 0, sizeof(country_code)); - country_offset = strcspn(extra, " "); country_code_size = strlen(extra) - country_offset; @@ -743,14 +743,19 @@ wl_iw_get_rssi( if (g_onoff == G_WLAN_SET_ON) { error = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)); + if (error) { + WL_ERROR(("%s: Fails %d\n", __FUNCTION__, error)); + return error; + } rssi = dtoh32(scb_val.val); error = dev_wlc_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid)); - - ssid.SSID_len = dtoh32(ssid.SSID_len); + if (!error) { + ssid.SSID_len = dtoh32(ssid.SSID_len); + wl_format_ssid(ssidbuf, ssid.SSID, dtoh32(ssid.SSID_len)); + } } - wl_format_ssid(ssidbuf, ssid.SSID, dtoh32(ssid.SSID_len)); p += snprintf(p, MAX_WX_STRING, "%s rssi %d ", ssidbuf, rssi); wrqu->data.length = p - extra + 1; @@ -780,18 +785,18 @@ wl_iw_send_priv_event( return 0; } +#ifdef WL_IW_USE_THREAD_WL_OFF static int _wl_control_sysioc_thread_wl_off(void *data) { struct wl_ctrl *wl_ctl = (struct wl_ctrl *)data; - wl_iw_t *iw = *(wl_iw_t **)netdev_priv(wl_ctl->dev); DAEMONIZE("wlcontrol_sysioc"); WL_TRACE(("%s Entered\n", __FUNCTION__)); + net_os_wake_lock(wl_ctl->dev); - WAKE_LOCK_INIT(iw->pub, WAKE_LOCK_OFF, "sysioc_thread_wl_off"); - WAKE_LOCK(iw->pub, WAKE_LOCK_OFF); + mutex_lock(&wl_start_lock); while (down_interruptible(&wl_ctl->timer_sem) == 0) { WL_TRACE(("%s Turning off wifi dev\n", __FUNCTION__)); @@ -805,14 +810,13 @@ _wl_control_sysioc_thread_wl_off(void *data) dhd_dev_reset(wl_ctl->dev, 1); #if defined(WL_IW_USE_ISCAN) - wl_iw_free_ss_cache(); wl_iw_run_ss_cache_timer(0); memset(g_scan, 0, G_SCAN_RESULTS); - + g_ss_cache_ctrl.m_link_down = 1; g_scan_specified_ssid = 0; - + g_first_broadcast_scan = BROADCAST_SCAN_FIRST_IDLE; #endif #if defined(BCMLXSDMMC) @@ -823,17 +827,50 @@ _wl_control_sysioc_thread_wl_off(void *data) wl_iw_send_priv_event(wl_ctl->dev, "STOP"); + net_os_wake_lock_timeout_enable(wl_ctl->dev); break; } - + mutex_unlock(&wl_start_lock); WL_TRACE(("%s Exited\n", __FUNCTION__)); - WAKE_UNLOCK(iw->pub, WAKE_LOCK_OFF); - WAKE_LOCK_DESTROY(iw->pub, WAKE_LOCK_OFF); + net_os_wake_unlock(wl_ctl->dev); complete_and_exit(&wl_ctl->sysioc_exited, 0); KILL_PROC(wl_ctl->sysioc_pid, SIGTERM); } +#endif + +int +wl_control_wl_start(struct net_device *dev) +{ + int ret = 0; + + WL_TRACE(("Enter %s \n", __FUNCTION__)); + + mutex_lock(&wl_start_lock); + if (g_onoff == G_WLAN_SET_OFF) { + dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON); + +#if defined(BCMLXSDMMC) + sdioh_start(NULL, 0); +#endif + + dhd_dev_reset(dev, 0); + +#if defined(BCMLXSDMMC) + sdioh_start(NULL, 1); +#endif + + dhd_dev_init_ioctl(dev); + + g_onoff = G_WLAN_SET_ON; + } + WL_TRACE(("Exited %s \n", __FUNCTION__)); + + mutex_unlock(&wl_start_lock); + return ret; +} +#ifdef WL_IW_USE_THREAD_WL_OFF static void wl_iw_stop_timerfunc(ulong data) { @@ -841,10 +878,11 @@ wl_iw_stop_timerfunc(ulong data) WL_TRACE(("%s\n", __FUNCTION__)); - del_timer(wl_ctl->timer); + del_timer_sync(wl_ctl->timer); up(&wl_ctl->timer_sem); } +#endif static int wl_iw_control_wl_off( @@ -853,24 +891,23 @@ wl_iw_control_wl_off( ) { int ret = 0; +#ifdef WL_IW_USE_THREAD_WL_OFF static struct wl_ctrl ctl; static struct timer_list timer; - +#endif WL_TRACE(("Enter %s\n", __FUNCTION__)); #ifdef SOFTAP ap_mode = 0; ap_cfg_running = FALSE; -#endif +#endif - - +#ifdef WL_IW_USE_THREAD_WL_OFF ctl.timer = &timer; ctl.dev = dev; sema_init(&ctl.timer_sem, 0); init_completion(&ctl.sysioc_exited); - ctl.sysioc_pid = kernel_thread(_wl_control_sysioc_thread_wl_off, &ctl, 0); timer.data = (ulong)&ctl; @@ -878,7 +915,39 @@ wl_iw_control_wl_off( init_timer(&timer); timer.expires = jiffies + 2000 * HZ / 1000; add_timer(&timer); +#else + mutex_lock(&wl_start_lock); + if (g_onoff == G_WLAN_SET_ON) { + g_onoff = G_WLAN_SET_OFF; +#if defined(WL_IW_USE_ISCAN) + g_iscan->iscan_state = ISCAN_STATE_IDLE; +#endif + dhd_dev_reset(dev, 1); + +#if defined(WL_IW_USE_ISCAN) + wl_iw_free_ss_cache(); + wl_iw_run_ss_cache_timer(0); + memset(g_scan, 0, G_SCAN_RESULTS); + + g_ss_cache_ctrl.m_link_down = 1; + g_scan_specified_ssid = 0; + + g_first_broadcast_scan = BROADCAST_SCAN_FIRST_IDLE; +#endif + +#if defined(BCMLXSDMMC) + sdioh_stop(NULL); +#endif + + dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF); + + wl_iw_send_priv_event(dev, "STOP"); + + net_os_wake_lock_timeout_enable(dev); + } + mutex_unlock(&wl_start_lock); +#endif WL_TRACE(("Exited %s\n", __FUNCTION__)); return ret; @@ -894,34 +963,19 @@ wl_iw_control_wl_on( WL_TRACE(("Enter %s \n", __FUNCTION__)); - if (g_onoff == G_WLAN_SET_OFF) { - dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON); - -#if defined(BCMLXSDMMC) - sdioh_start(NULL, 0); -#endif - - dhd_dev_reset(dev, 0); - -#if defined(BCMLXSDMMC) - sdioh_start(NULL, 1); -#endif - - dhd_dev_init_ioctl(dev); - - g_onoff = G_WLAN_SET_ON; - } + ret = wl_control_wl_start(dev); wl_iw_send_priv_event(dev, "START"); #ifdef SOFTAP - if (!ap_fw_loaded) { + if (!ap_fw_loaded) { wl_iw_iscan_set_scan_broadcast_prep(dev, 0); } #else - wl_iw_iscan_set_scan_broadcast_prep(dev, 0); -#endif + wl_iw_iscan_set_scan_broadcast_prep(dev, 0); +#endif + net_os_wake_lock_timeout_enable(dev); WL_TRACE(("Exited %s \n", __FUNCTION__)); @@ -930,18 +984,18 @@ wl_iw_control_wl_on( #ifdef SOFTAP static struct ap_profile my_ap; -static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap); +static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap); static int get_assoc_sta_list(struct net_device *dev, char *buf, int len); static int set_ap_mac_list(struct net_device *dev, char *buf); -#define PTYPE_STRING 0 -#define PTYPE_INTDEC 1 -#define PTYPE_INTHEX 2 -#define PTYPE_STR_HEX 3 +#define PTYPE_STRING 0 +#define PTYPE_INTDEC 1 +#define PTYPE_INTHEX 2 +#define PTYPE_STR_HEX 3 int get_parmeter_from_string( char **str_ptr, const char *token, int param_type, void *dst, int param_max_len); -#endif +#endif int hex2num(char c) { @@ -997,18 +1051,15 @@ int init_ap_profile_from_string(char *param_str, struct ap_profile *ap_cfg) memset(sub_cmd, 0, sizeof(sub_cmd)); memset(ap_cfg, 0, sizeof(struct ap_profile)); - if (get_parmeter_from_string(&str_ptr, "ASCII_CMD=", PTYPE_STRING, sub_cmd, SSID_LEN) != 0) { - return -1; + return -1; } if (strncmp(sub_cmd, "AP_CFG", 6)) { - WL_ERROR(("ERROR: sub_cmd:%s != 'AP_CFG'!\n", sub_cmd)); + WL_ERROR(("ERROR: sub_cmd:%s != 'AP_CFG'!\n", sub_cmd)); return -1; } - - ret = get_parmeter_from_string(&str_ptr, "SSID=", PTYPE_STRING, ap_cfg->ssid, SSID_LEN); ret |= get_parmeter_from_string(&str_ptr, "SEC=", PTYPE_STRING, ap_cfg->sec, SEC_LEN); @@ -1023,15 +1074,14 @@ int init_ap_profile_from_string(char *param_str, struct ap_profile *ap_cfg) return ret; } -#endif - +#endif #ifdef SOFTAP static int iwpriv_set_ap_config(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *ext) + struct iw_request_info *info, + union iwreq_data *wrqu, + char *ext) { int res = 0; char *extra = NULL; @@ -1041,7 +1091,6 @@ static int iwpriv_set_ap_config(struct net_device *dev, info->cmd, info->flags, wrqu->data.pointer, wrqu->data.length)); - if (wrqu->data.length != 0) { char *str_ptr; @@ -1059,33 +1108,51 @@ static int iwpriv_set_ap_config(struct net_device *dev, memset(ap_cfg, 0, sizeof(struct ap_profile)); - - str_ptr = extra; init_ap_profile_from_string(extra, ap_cfg); } else { - - WL_ERROR(("IWPRIV argument len = 0 \n")); - return -1; + WL_ERROR(("IWPRIV argument len = 0 \n")); + return -1; } - res |= set_ap_cfg(dev, ap_cfg); + set_ap_cfg(dev, ap_cfg); kfree(extra); return res; } -#endif - +#endif #ifdef SOFTAP +void print_buf(void *pbuf, int len, int bytes_per_line) +{ + int i, j = 0; + unsigned char *buf = pbuf; + + if (bytes_per_line == 0) { + bytes_per_line = len; + } + + for (i = 0; i < len; i++) { + WL_SOFTAP(("%2.2x", *buf++)); + j++; + if (j == bytes_per_line) { + WL_SOFTAP(("\n")); + j = 0; + } else { + WL_SOFTAP((":")); + } + } + WL_SOFTAP(("\n")); +} + static int iwpriv_get_assoc_list(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *p_iwrq, - char *extra) + struct iw_request_info *info, + union iwreq_data *p_iwrq, + char *extra) { int i, ret = 0; char mac_buf[256]; @@ -1109,17 +1176,15 @@ static int iwpriv_get_assoc_list(struct net_device *dev, get_assoc_sta_list(dev, mac_buf, 256); WL_TRACE((" got %d stations\n", sta_maclist->count)); - memset(mac_lst, 0, sizeof(mac_lst)); p_mac_str = mac_lst; for (i = 0; i < 8; i++) { - struct ether_addr * id = &sta_maclist->ea[i]; + struct ether_addr *id = &sta_maclist->ea[i]; WL_SOFTAP(("dhd_drv>> sta_mac[%d] :", i)); print_buf((unsigned char *)&sta_maclist->ea[i], 6, 0); - p_mac_str += snprintf(p_mac_str, MAX_WX_STRING, "Mac[%d]=%02X:%02X:%02X:%02X:%02X:%02X\n", i, id->octet[0], id->octet[1], id->octet[2], @@ -1142,20 +1207,20 @@ static int iwpriv_get_assoc_list(struct net_device *dev, WL_TRACE(("Exited %s \n", __FUNCTION__)); return ret; } -#endif +#endif #ifdef SOFTAP static int iwpriv_set_mac_filters(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *ext) + struct iw_request_info *info, + union iwreq_data *wrqu, + char *ext) { int i, ret = -1; - char * extra = NULL; + char *extra = NULL; u8 macfilt[8][6]; - int mac_cnt = 0; + int mac_cnt = 0; char sub_cmd[16]; WL_TRACE((">>> Got IWPRIV SET_MAC_FILTER IOCTL: info->cmd:%x, \ @@ -1181,18 +1246,16 @@ static int iwpriv_set_mac_filters(struct net_device *dev, memset(macfilt, 0, sizeof(macfilt)); memset(sub_cmd, 0, sizeof(sub_cmd)); - str_ptr = extra; - - if (get_parmeter_from_string(&str_ptr, "ASCII_CMD=", PTYPE_STRING, sub_cmd, 15) != 0) { - goto exit_proc; - } + if (get_parmeter_from_string(&str_ptr, "ASCII_CMD=", PTYPE_STRING, sub_cmd, 15) != 0) { + goto exit_proc; + } #define MAC_FILT_MAX 8 - + if (strncmp(sub_cmd, "MAC_FLT_W", strlen("MAC_FLT_W"))) { - WL_ERROR(("ERROR: sub_cmd:%s != 'MAC_FLT_W'!\n", sub_cmd)); + WL_ERROR(("ERROR: sub_cmd:%s != 'MAC_FLT_W'!\n", sub_cmd)); goto exit_proc; } @@ -1207,36 +1270,35 @@ static int iwpriv_set_mac_filters(struct net_device *dev, goto exit_proc; } - for (i=0; i< mac_cnt; i++) - if (get_parmeter_from_string(&str_ptr, "MAC=", - PTYPE_STR_HEX, macfilt[i], 12) != 0) { - WL_ERROR(("ERROR: MAC_filter[%d] is missing !\n", i)); - goto exit_proc; + for (i = 0; i < mac_cnt; i++) { + if (get_parmeter_from_string(&str_ptr, "MAC=", + PTYPE_STR_HEX, macfilt[i], 12) != 0) { + WL_ERROR(("ERROR: MAC_filter[%d] is missing !\n", i)); + goto exit_proc; + } } for (i = 0; i < mac_cnt; i++) { - WL_SOFTAP(("mac_filt[%d]:", i)); - print_buf(macfilt[i], 6, 0); + WL_SOFTAP(("mac_filt[%d]:", i)); + print_buf(macfilt[i], 6, 0); } - wrqu->data.pointer = NULL; wrqu->data.length = 0; ret = 0; } else { - - WL_ERROR(("IWPRIV argument len is 0\n")); - return -1; + WL_ERROR(("IWPRIV argument len is 0\n")); + return -1; } exit_proc: kfree(extra); return ret; } -#endif +#endif -#endif +#endif #if WIRELESS_EXT < 13 struct iw_request_info @@ -1246,9 +1308,9 @@ struct iw_request_info }; typedef int (*iw_handler)(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, - char *extra); + struct iw_request_info *info, + void *wrqu, + char *extra); #endif static int @@ -1308,7 +1370,7 @@ wl_iw_set_freq( int error, chan; uint sf = 0; - WL_TRACE(("\n %s %s: SIOCSIWFREQ\n", __FUNCTION__, dev->name)); + WL_TRACE(("%s %s: SIOCSIWFREQ\n", __FUNCTION__, dev->name)); #if defined(SOFTAP) if (ap_cfg_running) { @@ -1977,6 +2039,8 @@ wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, uint16 action) wl_iscan_params_t *params; int err = 0; + WL_TRACE(("%s: start\n", __func__)); + if (ssid && ssid->SSID_len) { params_size += sizeof(wlc_ssid_t); } @@ -2092,13 +2156,12 @@ static void wl_iw_force_specific_scan(iscan_info_t *iscan) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) rtnl_lock(); #endif - (void) dev_wlc_ioctl(iscan->dev, WLC_SCAN, &g_specific_ssid, sizeof(g_specific_ssid)); - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) rtnl_unlock(); #endif } + static void wl_iw_send_scan_complete(iscan_info_t *iscan) { #ifndef SANDGATE2G @@ -2106,34 +2169,36 @@ static void wl_iw_send_scan_complete(iscan_info_t *iscan) memset(&wrqu, 0, sizeof(wrqu)); - wireless_send_event(iscan->dev, SIOCGIWSCAN, &wrqu, NULL); - if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_STARTED) - g_first_broadcast_scan = BROADCAST_SCAN_FIRST_RESULT_READY; - WL_TRACE(("Send Event ISCAN complete\n")); + if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_STARTED) + g_first_broadcast_scan = BROADCAST_SCAN_FIRST_RESULT_READY; + WL_TRACE(("Send Event ISCAN complete\n")); #endif } + static int _iscan_sysioc_thread(void *data) { uint32 status; iscan_info_t *iscan = (iscan_info_t *)data; static bool iscan_pass_abort = FALSE; + DAEMONIZE("iscan_sysioc"); status = WL_SCAN_RESULTS_PARTIAL; while (down_interruptible(&iscan->sysioc_sem) == 0) { -#if defined(SOFTAP) - +#ifdef SOFTAP if (ap_cfg_running) { - WL_TRACE(("%s skipping SCAN ops in AP mode !!!\n", __FUNCTION__)); - continue; + WL_TRACE(("%s skipping SCAN ops in AP mode !!!\n", __FUNCTION__)); + continue; } -#endif +#endif + net_os_wake_lock(iscan->dev); + if (iscan->timer_on) { - del_timer(&iscan->timer); iscan->timer_on = 0; + del_timer_sync(&iscan->timer); } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) @@ -2143,8 +2208,9 @@ _iscan_sysioc_thread(void *data) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) rtnl_unlock(); #endif - if (g_scan_specified_ssid && (iscan_pass_abort == TRUE)) { - WL_TRACE(("%s Get results from specific scan status=%d\n", __FUNCTION__, status)); + + if (g_scan_specified_ssid && (iscan_pass_abort == TRUE)) { + WL_TRACE(("%s Get results from specific scan status=%d\n", __FUNCTION__, status)); wl_iw_send_scan_complete(iscan); iscan_pass_abort = FALSE; status = -1; @@ -2156,12 +2222,12 @@ _iscan_sysioc_thread(void *data) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) rtnl_lock(); #endif - + wl_iw_iscan(iscan, NULL, WL_SCAN_ACTION_CONTINUE); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) rtnl_unlock(); #endif - + mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); iscan->timer_on = 1; break; @@ -2172,7 +2238,7 @@ _iscan_sysioc_thread(void *data) break; case WL_SCAN_RESULTS_PENDING: WL_TRACE(("iscanresults pending\n")); - + mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); iscan->timer_on = 1; break; @@ -2193,13 +2259,16 @@ _iscan_sysioc_thread(void *data) default: WL_TRACE(("iscanresults returned unknown status %d\n", status)); break; - } + } + + net_os_wake_unlock(iscan->dev); } if (iscan->timer_on) { - del_timer(&iscan->timer); iscan->timer_on = 0; + del_timer_sync(&iscan->timer); } + complete_and_exit(&iscan->sysioc_exited, 0); } #endif @@ -2464,24 +2533,20 @@ wl_iw_set_scan( ) { int error; - WL_TRACE(("\n:%s dev:%s: SIOCSIWSCAN : SCAN\n", __FUNCTION__, dev->name)); + WL_TRACE(("%s dev:%s: SIOCSIWSCAN : SCAN\n", __FUNCTION__, dev->name)); #if defined(SOFTAP) - if (ap_cfg_running) { WL_TRACE(("\n>%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__)); return 0; } -#endif +#endif - if (g_onoff == G_WLAN_SET_OFF) return 0; - memset(&g_specific_ssid, 0, sizeof(g_specific_ssid)); #ifndef WL_IW_USE_ISCAN - g_scan_specified_ssid = 0; #endif @@ -2491,7 +2556,6 @@ wl_iw_set_scan( if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { struct iw_scan_req *req = (struct iw_scan_req *)extra; if (g_first_broadcast_scan != BROADCAST_SCAN_FIRST_RESULT_CONSUMED) { - WL_TRACE(("%s Ignoring SC %s first BC is not done = %d\n", \ __FUNCTION__, req->essid, \ g_first_broadcast_scan)); @@ -2500,7 +2564,6 @@ wl_iw_set_scan( if (g_scan_specified_ssid) { WL_TRACE(("%s Specific SCAN is not done ignore scan for = %s \n", \ __FUNCTION__, req->essid)); - return -EBUSY; } else { @@ -2518,8 +2581,7 @@ wl_iw_set_scan( if ((error = dev_wlc_ioctl(dev, WLC_SCAN, &g_specific_ssid, sizeof(g_specific_ssid)))) { WL_TRACE(("#### Set SCAN for %s failed with %d\n", g_specific_ssid.SSID, error)); - - g_scan_specified_ssid = 0; + g_scan_specified_ssid = 0; /* Clean to allow future ISCAN */ return -EBUSY; } @@ -2533,7 +2595,6 @@ wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag) wlc_ssid_t ssid; iscan_info_t *iscan = g_iscan; - if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_IDLE) { g_first_broadcast_scan = BROADCAST_SCAN_FIRST_STARTED; WL_TRACE(("%s: First Brodcast scan was forced\n", __FUNCTION__)); @@ -2543,7 +2604,6 @@ wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag) return 0; } - memset(&ssid, 0, sizeof(ssid)); iscan->list_cur = iscan->list_hdr; @@ -2585,20 +2645,18 @@ wl_iw_iscan_set_scan( WL_TRACE(("%s: SIOCSIWSCAN : ISCAN\n", dev->name)); - #if defined(SOFTAP) if (ap_cfg_running) { WL_TRACE(("\n>%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__)); return 0; } #endif - + if (g_onoff == G_WLAN_SET_OFF) { WL_TRACE(("%s: driver is not up yet after START\n", __FUNCTION__)); return 0; } - if ((!iscan) || (iscan->sysioc_pid < 0)) { WL_TRACE(("%s use backup if iscan thread is not successful\n", \ __FUNCTION__)); @@ -2611,7 +2669,6 @@ wl_iw_iscan_set_scan( return EBUSY; } - memset(&ssid, 0, sizeof(ssid)); #if WIRELESS_EXT > 17 @@ -2621,7 +2678,6 @@ wl_iw_iscan_set_scan( int as = 0; struct iw_scan_req *req = (struct iw_scan_req *)extra; if (g_first_broadcast_scan < BROADCAST_SCAN_FIRST_RESULT_CONSUMED) { - WL_TRACE(("%s First ISCAN in progress : ignoring SC = %s\n", \ __FUNCTION__, req->essid)); return -EBUSY; @@ -2654,17 +2710,13 @@ wl_iw_iscan_set_scan( static bool ie_is_wpa_ie(uint8 **wpaie, uint8 **tlvs, int *tlvs_len) { - - uint8 *ie = *wpaie; - if ((ie[1] >= 6) && !bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x01"), 4)) { return TRUE; } - ie += ie[1] + 2; *tlvs_len -= (int)(ie - *tlvs); @@ -2676,17 +2728,13 @@ ie_is_wpa_ie(uint8 **wpaie, uint8 **tlvs, int *tlvs_len) static bool ie_is_wps_ie(uint8 **wpsie, uint8 **tlvs, int *tlvs_len) { - - uint8 *ie = *wpsie; - if ((ie[1] >= 4) && !bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x04"), 4)) { return TRUE; } - ie += ie[1] + 2; *tlvs_len -= (int)(ie - *tlvs); @@ -2764,8 +2812,6 @@ wl_iw_get_scan_prep( ASSERT(list); - - for (i = 0; i < list->count && i < IW_MAX_AP; i++) { if (list->version != WL_BSS_INFO_VERSION) { @@ -2778,7 +2824,6 @@ wl_iw_get_scan_prep( WL_TRACE(("%s : %s\n", __FUNCTION__, bi->SSID)); - iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; memcpy(iwe.u.ap_addr.sa_data, &bi->BSSID, ETHER_ADDR_LEN); @@ -2814,10 +2859,8 @@ wl_iw_get_scan_prep( iwe.u.qual.noise = 0x100 + bi->phy_noise; event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_QUAL_LEN); - - wl_iw_handle_scanresults_ies(&event, end, info, bi); + wl_iw_handle_scanresults_ies(&event, end, info, bi); - iwe.cmd = SIOCGIWENCODE; if (dtoh16(bi->capability) & DOT11_CAP_PRIVACY) iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; @@ -2831,11 +2874,10 @@ wl_iw_get_scan_prep( if (((event -extra) + IW_EV_LCP_LEN) <= (uintptr)end) { value = event + IW_EV_LCP_LEN; iwe.cmd = SIOCGIWRATE; - + iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; for (j = 0; j < bi->rateset.count && j < IW_MAX_BITRATES; j++) { - iwe.u.bitrate.value = - (bi->rateset.rates[j] & 0x7f) * 500000; + iwe.u.bitrate.value = (bi->rateset.rates[j] & 0x7f) * 500000; value = IWE_STREAM_ADD_VALUE(info, event, value, end, &iwe, IW_EV_PARAM_LEN); } @@ -2872,7 +2914,7 @@ wl_iw_get_scan( iscan_info_t *iscan = g_iscan; iscan_buf_t * p_buf; uint32 counter = 0; -#endif +#endif WL_TRACE(("%s: buflen_from_user %d: \n", dev->name, buflen_from_user)); @@ -2907,7 +2949,6 @@ wl_iw_get_scan( } - if (g_scan_specified_ssid) { list = kmalloc(len, GFP_KERNEL); @@ -2931,10 +2972,9 @@ wl_iw_get_scan( list->version = dtoh32(list->version); list->count = dtoh32(list->count); - if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", \ - __FUNCTION__, list->version)); + WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", + __FUNCTION__, list->version)); if (g_scan_specified_ssid) { g_scan_specified_ssid = 0; kfree(list); @@ -2959,14 +2999,14 @@ wl_iw_get_scan( counter += list_merge->count; if (list_merge->count > 0) len_ret += (__u16) wl_iw_get_scan_prep(list_merge, info, - extra+len_ret, buflen_from_user -len_ret); + extra+len_ret, buflen_from_user -len_ret); p_buf = p_buf->next; } WL_TRACE(("%s merged with total Bcast APs=%d\n", __FUNCTION__, counter)); #else list_merge = (wl_scan_results_t *) g_scan; len_ret = (__u16) wl_iw_get_scan_prep(list_merge, info, extra, buflen_from_user); -#endif +#endif if (g_ss_cache_ctrl.m_link_down) { wl_iw_delete_bss_from_ss_cache(g_ss_cache_ctrl.m_active_bssid); @@ -3068,10 +3108,10 @@ wl_iw_iscan_get_scan( while (p_buf != iscan->list_cur) { list = &((wl_iscan_results_t*)p_buf->iscan_buf)->results; - counter += list->count; + counter += list->count; if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", \ + WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", __FUNCTION__, list->version)); return -EINVAL; } @@ -3986,7 +4026,6 @@ wl_iw_set_pmksa( char eabuf[ETHER_ADDR_STR_LEN]; WL_WSEC(("%s: SIOCSIWPMKSA\n", dev->name)); - CHECK_EXTRA_FOR_NULL(extra); iwpmksa = (struct iw_pmksa *)extra; @@ -4003,8 +4042,7 @@ wl_iw_set_pmksa( uint j; pmkidptr = &pmkid; - bcopy(&iwpmksa->bssid.sa_data[0], &pmkidptr->pmkid[0].BSSID, \ - ETHER_ADDR_LEN); + bcopy(&iwpmksa->bssid.sa_data[0], &pmkidptr->pmkid[0].BSSID, ETHER_ADDR_LEN); bcopy(&iwpmksa->pmkid[0], &pmkidptr->pmkid[0].PMKID, WPA2_PMKID_LEN); WL_WSEC(("wl_iw_set_pmksa,IW_PMKSA_REMOVE - PMKID: %s = ", @@ -4052,6 +4090,7 @@ wl_iw_set_pmksa( } else ret = -EINVAL; + { uint j; uint k; @@ -4064,7 +4103,7 @@ wl_iw_set_pmksa( WL_WSEC(("\n")); } } - WL_WSEC(("PRINTING pmkid LIST - No of elements %d\n", pmkid_list.pmkids.npmkid)); + WL_WSEC(("PRINTING pmkid LIST - No of elements %d, ret = %d\n", pmkid_list.pmkids.npmkid, ret)); for (i = 0; i < pmkid_list.pmkids.npmkid; i++) { uint j; WL_WSEC(("PMKID[%d]: %s = ", i, @@ -4077,8 +4116,7 @@ wl_iw_set_pmksa( WL_WSEC(("\n")); if (!ret) - ret = dev_wlc_bufvar_set(dev, "pmkid_info", (char *)&pmkid_list, \ - sizeof(pmkid_list)); + ret = dev_wlc_bufvar_set(dev, "pmkid_info", (char *)&pmkid_list, sizeof(pmkid_list)); return ret; } #endif @@ -4240,8 +4278,19 @@ wl_iw_set_wpaauth( break; case IW_AUTH_PRIVACY_INVOKED: WL_INFORM(("%s: IW_AUTH_PRIVACY_INVOKED\n", __FUNCTION__)); + /* if paramval is zero, allow association to AP with encryption while + * wsec is not set in the driver. If set to 1, restore default wsec_restrict value + */ + WL_INFORM(("%s: IW_AUTH_PRIVACY_INVOKED %u\n", __FUNCTION__, + paramval)); + + if ((error = dev_wlc_intvar_set(dev, "wsec_restrict", !paramval))) { + WL_ERROR(("%s: FAILED IW_AUTH_PRIVACY_INVOKED %u\n", __FUNCTION__, + paramval)); + return error; + } break; -#endif +#endif default: break; } @@ -4356,7 +4405,7 @@ wl_iw_get_wpaauth( vwrq->value = paramval; return 0; } -#endif +#endif #ifdef SOFTAP @@ -4380,12 +4429,10 @@ wl_iw_parse_wep(char *keystr, wl_wsec_key_t *key) case 28: case 34: case 66: - if (!strnicmp(keystr, "0x", 2)) keystr += 2; else return -1; - case 10: case 26: case 32: @@ -4409,7 +4456,6 @@ wl_iw_parse_wep(char *keystr, wl_wsec_key_t *key) key->algo = CRYPTO_ALGO_WEP128; break; case 16: - key->algo = CRYPTO_ALGO_AES_CCM; break; case 32: @@ -4419,7 +4465,6 @@ wl_iw_parse_wep(char *keystr, wl_wsec_key_t *key) return -1; } - key->flags |= WL_PRIMARY_KEY; return 0; @@ -4427,14 +4472,14 @@ wl_iw_parse_wep(char *keystr, wl_wsec_key_t *key) #ifdef EXT_WPA_CRYPTO #define SHA1HashSize 20 -extern void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, \ - int iterations, u8 *buf, size_t buflen); +extern void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, + int iterations, u8 *buf, size_t buflen); #else #define SHA1HashSize 20 -int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, \ - int iterations, u8 *buf, size_t buflen) +int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, + int iterations, u8 *buf, size_t buflen) { WL_ERROR(("WARNING: %s is not implemented !!!\n", __FUNCTION__)); return -1; @@ -4473,37 +4518,32 @@ static int wl_bssiovar_mkbuf( int *perr) { const char *prefix = "bsscfg:"; - int8* p; + int8 *p; uint prefixlen; uint namelen; uint iolen; - prefixlen = strlen(prefix); - namelen = strlen(iovar) + 1; + prefixlen = strlen(prefix); + namelen = strlen(iovar) + 1; iolen = prefixlen + namelen + sizeof(int) + paramlen; - if (buflen < 0 || iolen > (uint)buflen) { *perr = BCME_BUFTOOSHORT; return 0; } - p = (int8*)bufptr; + p = (int8 *)bufptr; - memcpy(p, prefix, prefixlen); p += prefixlen; - memcpy(p, iovar, namelen); p += namelen; - bssidx = htod32(bssidx); memcpy(p, &bssidx, sizeof(int32)); p += sizeof(int32); - if (paramlen) memcpy(p, param, paramlen); @@ -4512,8 +4552,6 @@ static int wl_bssiovar_mkbuf( } - - int get_user_params(char *user_params, struct iw_point *dwrq) { int ret = 0; @@ -4557,12 +4595,11 @@ static int thr_wait_for_2nd_eth_dev(void *data) WL_TRACE(("\n>%s: Thread:'softap ethdev IF:%s is detected !!!'\n\n", __FUNCTION__, ap_net_dev->name)); - ap_mode = 1; + ap_mode = 1; ap_cfg_running = TRUE; - bcm_mdelay(500); + bcm_mdelay(500); - wl_iw_send_priv_event(priv_dev, "ASCII_CMD=AP_BSS_START"); WL_TRACE(("\n>%s, thread completed\n", __FUNCTION__)); @@ -4579,7 +4616,7 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap) wlc_ssid_t ap_ssid; wlc_ssid_t null_ssid; int max_assoc = 8; - int mpc = 0; + int mpc = 0; int res = 0; int apsta_var = 0; @@ -4599,10 +4636,8 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap) WL_SOFTAP((" channel = %d\n", ap->channel)); WL_SOFTAP((" max scb = %d\n", ap->max_scb)); - if (!ap_cfg_running) { - sema_init(&ap_eth_sema, 0); mpc = 0; @@ -4611,9 +4646,7 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap) updown = 0; res |= dev_wlc_ioctl(dev, WLC_DOWN, &updown, sizeof(updown)); - #ifdef AP_ONLY - apsta_var = 0; res | = dev_wlc_ioctl(dev, WLC_SET_AP, &apsta_var, sizeof(apsta_var)); @@ -4621,62 +4654,60 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap) res |= dev_wlc_ioctl(dev, WLC_SET_AP, &apsta_var, sizeof(apsta_var)); res |= dev_wlc_ioctl(dev, WLC_GET_AP, &apsta_var, sizeof(apsta_var)); #else - apsta_var = 1; - iolen = wl_bssiovar_mkbuf("apsta", - bsscfg_index, &apsta_var, sizeof(apsta_var)+4, - buf, sizeof(buf), &mkvar_err); + iolen = wl_bssiovar_mkbuf("apsta", bsscfg_index, &apsta_var, + sizeof(apsta_var)+4, buf, sizeof(buf), &mkvar_err); ASSERT(iolen); res |= dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen); WL_TRACE(("\n>in %s: apsta set result: %d \n", __FUNCTION__, res)); -#endif +#endif updown = 1; res |= dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown)); WL_TRACE(("\n:%s >>>> dev_wlc_ioctl(WLC_UP) updown:%d, \n", __FUNCTION__, updown)); } else { - + res |= dev_iw_write_cfg1_bss_var(dev, 0); } - if (ap->channel == 0) { - int chosen = 0; - wl_uint32_list_t request; - int rescan = 0; - int retry = 0; - int ret = 0; - res |= dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown)); - res |= dev_wlc_ioctl(dev, WLC_SET_SSID, &null_ssid, sizeof(null_ssid)); - - auto_channel_retry: - request.count = htod32(0); - ret = dev_wlc_ioctl(dev, WLC_START_CHANNEL_SEL, &request, sizeof(request)); - if (ret < 0) { - WL_ERROR(("can't start auto channel scan\n")); - return -1; - } + int chosen = 0; + wl_uint32_list_t request; + int rescan = 0; + int retry = 0; + int ret = 0; - get_channel_retry: - bcm_mdelay(500); + res |= dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown)); + res |= dev_wlc_ioctl(dev, WLC_SET_SSID, &null_ssid, sizeof(null_ssid)); - ret = dev_wlc_ioctl(dev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen)); - if (ret < 0 || dtoh32(chosen) == 0) { - if (retry++ < 3) - goto get_channel_retry; - else { - WL_ERROR(("can't get auto channel sel, err = %d, \ - chosen = %d\n", ret, chosen)); - return -1; - } +auto_channel_retry: + request.count = htod32(0); + ret = dev_wlc_ioctl(dev, WLC_START_CHANNEL_SEL, &request, sizeof(request)); + if (ret < 0) { + WL_ERROR(("can't start auto channel scan\n")); + return -1; + } + +get_channel_retry: + bcm_mdelay(500); + + ret = dev_wlc_ioctl(dev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen)); + if (ret < 0 || dtoh32(chosen) == 0) { + if (retry++ < 3) + goto get_channel_retry; + else { + WL_ERROR(("can't get auto channel sel, err = %d, \ + chosen = %d\n", ret, chosen)); + return -1; } - if ((chosen == 1) && (!rescan++)) - goto auto_channel_retry; - WL_SOFTAP(("Set auto channel = %d\n", chosen)); - ap->channel = chosen; - dev_wlc_ioctl(dev, WLC_DOWN, &updown, sizeof(updown)); - } + } + if ((chosen == 1) && (!rescan++)) + goto auto_channel_retry; + WL_SOFTAP(("Set auto channel = %d\n", chosen)); + ap->channel = chosen; + dev_wlc_ioctl(dev, WLC_DOWN, &updown, sizeof(updown)); + } channel = ap->channel; res |= dev_wlc_ioctl(dev, WLC_SET_CHANNEL, &channel, sizeof(channel)); @@ -4692,32 +4723,20 @@ static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap) ap_ssid.SSID_len = strlen(ap->ssid); strncpy(ap_ssid.SSID, ap->ssid, ap_ssid.SSID_len); - iolen = wl_bssiovar_mkbuf("ssid", bsscfg_index, (char *)(&ap_ssid), ap_ssid.SSID_len+4, buf, sizeof(buf), &mkvar_err); ASSERT(iolen); res |= dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen); if (!ap_cfg_running) { - kernel_thread(thr_wait_for_2nd_eth_dev, 0, 0); } else { - - - WL_TRACE(("%s: Configure security & restart AP bss \n", __FUNCTION__)); - - res |= wl_iw_set_ap_security(dev, &my_ap); - - res |= dev_iw_write_cfg1_bss_var(dev, 1); } - return res; } -#endif - static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap) @@ -4737,10 +4756,7 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap) WL_SOFTAP((" channel = %d\n", ap->channel)); WL_SOFTAP((" max scb = %d\n", ap->max_scb)); - if (strnicmp(ap->sec, "open", strlen("open")) == 0) { - - wsec = 0; res = dev_wlc_intvar_set(dev, "wsec", wsec); wpa_auth = WPA_AUTH_DISABLED; @@ -4752,7 +4768,6 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap) } else if (strnicmp(ap->sec, "wep", strlen("wep")) == 0) { - wl_wsec_key_t key; memset(&key, 0, sizeof(key)); @@ -4780,9 +4795,6 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap) WL_SOFTAP(("=====================\n")); } else if (strnicmp(ap->sec, "wpa2-psk", strlen("wpa2-psk")) == 0) { - - - wsec_pmk_t psk; size_t key_len; @@ -4796,18 +4808,15 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap) return -1; } - if (key_len < WSEC_MAX_PSK_LEN) { unsigned char output[2*SHA1HashSize]; char key_str_buf[WSEC_MAX_PSK_LEN+1]; - memset(output, 0, sizeof(output)); pbkdf2_sha1(ap->key, ap->ssid, strlen(ap->ssid), 4096, output, 32); - + ptr = key_str_buf; for (i = 0; i < (WSEC_MAX_PSK_LEN/8); i++) { - sprintf(ptr, "%02x%02x%02x%02x", (uint)output[i*4], \ (uint)output[i*4+1], (uint)output[i*4+2], \ (uint)output[i*4+3]); @@ -4829,7 +4838,6 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap) } else if (strnicmp(ap->sec, "wpa-psk", strlen("wpa-psk")) == 0) { - wsec_pmk_t psk; size_t key_len; @@ -4843,25 +4851,24 @@ static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap) return -1; } - if (key_len < WSEC_MAX_PSK_LEN) { unsigned char output[2*SHA1HashSize]; char key_str_buf[WSEC_MAX_PSK_LEN+1]; WL_SOFTAP(("%s: do passhash...\n", __FUNCTION__)); - + pbkdf2_sha1(ap->key, ap->ssid, strlen(ap->ssid), 4096, output, 32); - + ptr = key_str_buf; for (i = 0; i < (WSEC_MAX_PSK_LEN/8); i++) { - WL_SOFTAP(("[%02d]: %08x\n", i, *((unsigned int*)&output[i*4]))); - - sprintf(ptr, "%02x%02x%02x%02x", (uint)output[i*4], \ - (uint)output[i*4+1], (uint)output[i*4+2], \ - (uint)output[i*4+3]); + WL_SOFTAP(("[%02d]: %08x\n", i, *((unsigned int *)&output[i*4]))); + + sprintf(ptr, "%02x%02x%02x%02x", (uint)output[i*4], + (uint)output[i*4+1], (uint)output[i*4+2], + (uint)output[i*4+3]); ptr += 8; } - printk("%s: passphase = %s\n", __FUNCTION__, key_str_buf); + WL_SOFTAP(("%s: passphase = %s\n", __FUNCTION__, key_str_buf)); psk.key_len = htod16((ushort)WSEC_MAX_PSK_LEN); memcpy(psk.key, key_str_buf, psk.key_len); @@ -4896,15 +4903,14 @@ int get_parmeter_from_string( if (!strncmp(*str_ptr, token, strlen(token))) { - strsep(str_ptr, "=,"); + strsep(str_ptr, "=,"); param_str_begin = *str_ptr; - strsep(str_ptr, "=,"); + strsep(str_ptr, "=,"); if (*str_ptr == NULL) { - parm_str_len = strlen(param_str_begin); } else { - param_str_end = *str_ptr-1; + param_str_end = *str_ptr-1; parm_str_len = param_str_end - param_str_begin; } @@ -4919,35 +4925,33 @@ int get_parmeter_from_string( switch (param_type) { - case PTYPE_INTDEC: { - - int *pdst_int = dst; - char *eptr; - if (parm_str_len > sizeof(int_str)) - parm_str_len = sizeof(int_str); + case PTYPE_INTDEC: { + int *pdst_int = dst; + char *eptr; - memcpy(int_str, param_str_begin, parm_str_len); + if (parm_str_len > sizeof(int_str)) + parm_str_len = sizeof(int_str); - *pdst_int = simple_strtoul(int_str, &eptr, 10); + memcpy(int_str, param_str_begin, parm_str_len); - WL_TRACE((" written as integer:%d\n", *pdst_int)); + *pdst_int = simple_strtoul(int_str, &eptr, 10); + + WL_TRACE((" written as integer:%d\n", *pdst_int)); } break; - case PTYPE_STR_HEX: { - u8 *buf = dst; - - param_max_len = param_max_len >> 1; - hstr_2_buf(param_str_begin, buf, param_max_len); - print_buf(buf, param_max_len, 0); + case PTYPE_STR_HEX: { + u8 *buf = dst; + + param_max_len = param_max_len >> 1; + hstr_2_buf(param_str_begin, buf, param_max_len); + print_buf(buf, param_max_len, 0); } break; - default: - - memcpy(dst, param_str_begin, parm_str_len); - *((char *)dst + parm_str_len) = 0; - WL_TRACE((" written as a string:%s\n", (char *)dst)); + default: + memcpy(dst, param_str_begin, parm_str_len); + *((char *)dst + parm_str_len) = 0; + WL_TRACE((" written as a string:%s\n", (char *)dst)); break; - } return 0; @@ -4955,7 +4959,7 @@ int get_parmeter_from_string( WL_ERROR(("\n %s: ERROR: can't find token:%s in str:%s \n", __FUNCTION__, token, orig_str)); - return -1; + return -1; } } @@ -4969,11 +4973,9 @@ static int iwpriv_softap_stop(struct net_device *dev, WL_SOFTAP((" iw_handler SOFTAP_STP \n")); - ap_mode = 0; ap_cfg_running = FALSE; - res = dev_iw_write_cfg1_bss_var(dev, 2); wrqu->data.length = 0; @@ -4982,16 +4984,14 @@ static int iwpriv_softap_stop(struct net_device *dev, } - static int iwpriv_fw_reload(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *ext) + struct iw_request_info *info, + union iwreq_data *wrqu, + char *ext) { - int ret = -1; char extra[256]; - char *fwstr = fw_path ; + char *fwstr = fw_path; WL_SOFTAP(("current firmware_path[]=%s\n", fwstr)); @@ -5011,7 +5011,6 @@ static int iwpriv_fw_reload(struct net_device *dev, goto exit_proc; } - extra[wrqu->data.length] = 8; str_ptr = extra; @@ -5020,9 +5019,9 @@ static int iwpriv_fw_reload(struct net_device *dev, goto exit_proc; } - if (strstr(fwstr, "apsta") != NULL) { - WL_SOFTAP(("GOT APSTA FIRMWARE\n")); - ap_fw_loaded = TRUE; + if (strstr(fwstr, "apsta") != NULL) { + WL_SOFTAP(("GOT APSTA FIRMWARE\n")); + ap_fw_loaded = TRUE; } else { WL_SOFTAP(("GOT STA FIRMWARE\n")); ap_fw_loaded = FALSE; @@ -5037,11 +5036,13 @@ static int iwpriv_fw_reload(struct net_device *dev, exit_proc: return ret; } +#endif + #ifdef SOFTAP static int iwpriv_wpasupp_loop_tst(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *ext) + struct iw_request_info *info, + union iwreq_data *wrqu, + char *ext) { int res = 0; char *params = NULL; @@ -5056,7 +5057,6 @@ static int iwpriv_wpasupp_loop_tst(struct net_device *dev, if (!(params = kmalloc(wrqu->data.length+1, GFP_KERNEL))) return -ENOMEM; - if (copy_from_user(params, wrqu->data.pointer, wrqu->data.length)) { kfree(params); return -EFAULT; @@ -5069,17 +5069,16 @@ static int iwpriv_wpasupp_loop_tst(struct net_device *dev, return -EFAULT; } - res = wl_iw_send_priv_event(dev, params); kfree(params); return res; } -#endif +#endif static int - iwpriv_en_ap_bss( +iwpriv_en_ap_bss( struct net_device *dev, struct iw_request_info *info, void *wrqu, @@ -5088,12 +5087,10 @@ static int int res = 0; WL_TRACE(("%s: rcvd IWPRIV IOCTL: for dev:%s\n", __FUNCTION__, dev->name)); - if (wl_iw_set_ap_security(dev, &my_ap) != 0) { - WL_ERROR(("!!!!:ERROR setting SOFTAP security in :%s\n", __FUNCTION__)); + WL_ERROR(("!!!!:ERROR setting SOFTAP security in :%s\n", __FUNCTION__)); }; - dev_iw_write_cfg1_bss_var(dev, 1); return res; } @@ -5101,7 +5098,6 @@ static int static int get_assoc_sta_list(struct net_device *dev, char *buf, int len) { - WL_TRACE(("calling dev_wlc_ioctl(dev:%p, cmd:%d, buf:%p, len:%d)\n", dev, WLC_GET_ASSOCLIST, buf, len)); @@ -5123,10 +5119,9 @@ set_ap_mac_list(struct net_device *dev, char *buf) ap_macmode = mac_mode; if (mac_mode == MACLIST_MODE_DISABLED) { - + bzero(&ap_black_list, sizeof(struct mflist)); - dev_wlc_ioctl(dev, WLC_SET_MACMODE, &mac_mode, sizeof(mac_mode)); } else { scb_val_t scbval; @@ -5134,38 +5129,35 @@ set_ap_mac_list(struct net_device *dev, char *buf) struct maclist *assoc_maclist = (struct maclist *) mac_buf; mac_mode = MACLIST_MODE_ALLOW; - + dev_wlc_ioctl(dev, WLC_SET_MACMODE, &mac_mode, sizeof(mac_mode)); - length = sizeof(white_maclist->count)+white_maclist->count*ETHER_ADDR_LEN; dev_wlc_ioctl(dev, WLC_SET_MACLIST, white_maclist, length); WL_SOFTAP(("White List, length %d:\n", length)); for (i = 0; i < white_maclist->count; i++) WL_SOFTAP(("mac %d: %02X:%02X:%02X:%02X:%02X:%02X\n", - i, white_maclist->ea[i].octet[0], white_maclist->ea[i].octet[1], \ - white_maclist->ea[i].octet[2], \ - white_maclist->ea[i].octet[3], white_maclist->ea[i].octet[4], \ + i, white_maclist->ea[i].octet[0], white_maclist->ea[i].octet[1], + white_maclist->ea[i].octet[2], + white_maclist->ea[i].octet[3], white_maclist->ea[i].octet[4], white_maclist->ea[i].octet[5])); - bcopy(black_maclist, &ap_black_list, sizeof(ap_black_list)); WL_SOFTAP(("Black List, size %d:\n", sizeof(ap_black_list))); for (i = 0; i < ap_black_list.count; i++) WL_SOFTAP(("mac %d: %02X:%02X:%02X:%02X:%02X:%02X\n", - i, ap_black_list.ea[i].octet[0], ap_black_list.ea[i].octet[1], \ - ap_black_list.ea[i].octet[2], \ - ap_black_list.ea[i].octet[3], \ + i, ap_black_list.ea[i].octet[0], ap_black_list.ea[i].octet[1], + ap_black_list.ea[i].octet[2], + ap_black_list.ea[i].octet[3], ap_black_list.ea[i].octet[4], ap_black_list.ea[i].octet[5])); - dev_wlc_ioctl(dev, WLC_GET_ASSOCLIST, assoc_maclist, 256); if (assoc_maclist->count) { int j; for (i = 0; i < assoc_maclist->count; i++) { for (j = 0; j < white_maclist->count; j++) { - if (!bcmp(&assoc_maclist->ea[i], &white_maclist->ea[j], \ + if (!bcmp(&assoc_maclist->ea[i], &white_maclist->ea[j], ETHER_ADDR_LEN)) { WL_SOFTAP(("match allow, let it be\n")); break; @@ -5174,9 +5166,9 @@ set_ap_mac_list(struct net_device *dev, char *buf) if (j == white_maclist->count) { WL_SOFTAP(("match black, deauth it\n")); scbval.val = htod32(1); - bcopy(&assoc_maclist->ea[i], &scbval.ea, \ - ETHER_ADDR_LEN); - dev_wlc_ioctl(dev, \ + bcopy(&assoc_maclist->ea[i], &scbval.ea, + ETHER_ADDR_LEN); + dev_wlc_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scbval, sizeof(scb_val_t)); } @@ -5185,7 +5177,7 @@ set_ap_mac_list(struct net_device *dev, char *buf) } return 0; } -#endif +#endif #ifdef SOFTAP @@ -5217,10 +5209,9 @@ int wl_iw_process_private_ascii_cmd( ap_mode = 0; - if (init_ap_profile_from_string(cmd_str+PROFILE_OFFSET, &my_ap) != 0) { - WL_ERROR(("ERROR: SoftAP CFG prams !\n")); - ret = -1; + WL_ERROR(("ERROR: SoftAP CFG prams !\n")); + ret = -1; } else { set_ap_cfg(dev, &my_ap); } @@ -5229,30 +5220,25 @@ int wl_iw_process_private_ascii_cmd( WL_SOFTAP(("\n SOFTAP - ENABLE BSS \n")); - WL_SOFTAP(("\n!!! got 'WL_AP_EN_BSS' from WPA supplicant, dev:%s\n", dev->name)); if (ap_net_dev == NULL) { - printf("\n ERROR: SOFTAP net_dev* is NULL !!!\n"); + printf("\n ERROR: SOFTAP net_dev* is NULL !!!\n"); } else { - iwpriv_en_ap_bss(ap_net_dev, info, dwrq, cmd_str); } } else if (strnicmp(sub_cmd, "ASSOC_LST", strlen("ASSOC_LST")) == 0) { - - - + /* no code yet */ } else if (strnicmp(sub_cmd, "AP_BSS_STOP", strlen("AP_BSS_STOP")) == 0) { - WL_SOFTAP((" \n temp DOWN SOFTAP\n")); ret = dev_iw_write_cfg1_bss_var(dev, 0); } return ret; - } -#endif +#endif + static int wl_iw_set_priv( struct net_device *dev, struct iw_request_info *info, @@ -5263,7 +5249,6 @@ static int wl_iw_set_priv( int ret = 0; char * extra; - wl_iw_t *iw = *(wl_iw_t **)netdev_priv(dev); if (!(extra = kmalloc(dwrq->length, GFP_KERNEL))) return -ENOMEM; @@ -5275,76 +5260,69 @@ static int wl_iw_set_priv( WL_TRACE(("%s: SIOCSIWPRIV request %s, info->cmd:%x, info->flags:%d\n dwrq->length:%d", dev->name, extra, info->cmd, info->flags, dwrq->length)); + net_os_wake_lock(dev); if (dwrq->length && extra) { - WAKE_LOCK_INIT(iw->pub, WAKE_LOCK_PRIV, "wl_iw_set_priv"); - WAKE_LOCK(iw->pub, WAKE_LOCK_PRIV); + if (strnicmp(extra, "START", strlen("START")) == 0) { + wl_iw_control_wl_on(dev, info); + WL_TRACE(("%s, Received regular START command\n", __FUNCTION__)); + } if (g_onoff == G_WLAN_SET_OFF) { - if (strnicmp(extra, "START", strlen("START")) != 0) { - WL_ERROR(("%s First IOCTL after stop is NOT START \n", \ - __FUNCTION__)); - WAKE_UNLOCK(iw->pub, WAKE_LOCK_PRIV); - WAKE_LOCK_DESTROY(iw->pub, WAKE_LOCK_PRIV); - kfree(extra); - return -EFAULT; - } else { - wl_iw_control_wl_on(dev, info); - WL_TRACE(("%s, Received regular START command\n", __FUNCTION__)); - } + WL_TRACE(("%s, missing START, Fail\n", __FUNCTION__)); + kfree(extra); + net_os_wake_unlock(dev); + return -EFAULT; } - if (strnicmp(extra, "SCAN-ACTIVE", strlen("SCAN-ACTIVE")) == 0) { + if (strnicmp(extra, "SCAN-ACTIVE", strlen("SCAN-ACTIVE")) == 0) { #ifdef ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS WL_TRACE(("%s: active scan setting suppressed\n", dev->name)); #else ret = wl_iw_set_active_scan(dev, info, (union iwreq_data *)dwrq, extra); -#endif - } - else if (strnicmp(extra, "SCAN-PASSIVE", strlen("SCAN-PASSIVE")) == 0) +#endif + } else if (strnicmp(extra, "SCAN-PASSIVE", strlen("SCAN-PASSIVE")) == 0) #ifdef ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS WL_TRACE(("%s: passive scan setting suppressed\n", dev->name)); #else ret = wl_iw_set_passive_scan(dev, info, (union iwreq_data *)dwrq, extra); -#endif - else if (strnicmp(extra, "RSSI", strlen("RSSI")) == 0) +#endif + else if (strnicmp(extra, "RSSI", strlen("RSSI")) == 0) ret = wl_iw_get_rssi(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, "LINKSPEED", strlen("LINKSPEED")) == 0) + else if (strnicmp(extra, "LINKSPEED", strlen("LINKSPEED")) == 0) ret = wl_iw_get_link_speed(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, "MACADDR", strlen("MACADDR")) == 0) + else if (strnicmp(extra, "MACADDR", strlen("MACADDR")) == 0) ret = wl_iw_get_macaddr(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, "COUNTRY", strlen("COUNTRY")) == 0) + else if (strnicmp(extra, "COUNTRY", strlen("COUNTRY")) == 0) ret = wl_iw_set_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); - else if (strnicmp(extra, "POWERMODE", strlen("POWERMODE")) == 0) + else if (strnicmp(extra, "POWERMODE", strlen("POWERMODE")) == 0) ret = wl_iw_set_btcoex_dhcp(dev, info, (union iwreq_data *)dwrq, extra); #ifdef SOFTAP - 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) { + 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) { WL_SOFTAP(("penguin, set AP_MAC_LIST_SET\n")); set_ap_mac_list(dev, (extra + PROFILE_OFFSET)); - } -#endif - else { + } +#endif + else { + WL_TRACE(("Unknown PRIVATE command: %s: ignored\n", extra)); snprintf(extra, MAX_WX_STRING, "OK"); dwrq->length = strlen("OK") + 1; - WL_ERROR(("Unkown PRIVATE command , ignored\n")); } - WAKE_UNLOCK(iw->pub, WAKE_LOCK_PRIV); - WAKE_LOCK_DESTROY(iw->pub, WAKE_LOCK_PRIV); } + net_os_wake_unlock(dev); + if (extra) { - if (copy_to_user(dwrq->pointer, extra, dwrq->length)) { + if (copy_to_user(dwrq->pointer, extra, dwrq->length)) { kfree(extra); return -EFAULT; - } + } - kfree(extra); + kfree(extra); } return ret; @@ -5360,12 +5338,12 @@ static const iw_handler wl_iw_handler[] = (iw_handler) wl_iw_get_freq, (iw_handler) wl_iw_set_mode, (iw_handler) wl_iw_get_mode, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) wl_iw_get_range, - (iw_handler) wl_iw_set_priv, - (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) NULL, + (iw_handler) wl_iw_get_range, + (iw_handler) wl_iw_set_priv, + (iw_handler) NULL, (iw_handler) NULL, (iw_handler) NULL, (iw_handler) wl_iw_set_spy, @@ -5398,7 +5376,7 @@ static const iw_handler wl_iw_handler[] = #endif (iw_handler) wl_iw_set_essid, (iw_handler) wl_iw_get_essid, - (iw_handler) wl_iw_set_nick, + (iw_handler) wl_iw_set_nick, (iw_handler) wl_iw_get_nick, (iw_handler) NULL, (iw_handler) NULL, @@ -5449,40 +5427,32 @@ static const iw_handler wl_iw_priv_handler[] = { (iw_handler)wl_iw_control_wl_off, NULL, (iw_handler)wl_iw_control_wl_on, -#ifdef SOFTAP - - +#ifdef SOFTAP NULL, (iw_handler)iwpriv_set_ap_config, - - NULL, (iw_handler)iwpriv_get_assoc_list, - NULL, (iw_handler)iwpriv_set_mac_filters, - NULL, (iw_handler)iwpriv_en_ap_bss, - NULL, (iw_handler)iwpriv_wpasupp_loop_tst, - + NULL, (iw_handler)iwpriv_softap_stop, - + NULL, (iw_handler)iwpriv_fw_reload -#endif +#endif }; -static const struct iw_priv_args wl_iw_priv_args[] = -{ - { +static const struct iw_priv_args wl_iw_priv_args[] = { + { WL_IW_SET_ACTIVE_SCAN, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, @@ -5526,30 +5496,28 @@ static const struct iw_priv_args wl_iw_priv_args[] = }, #ifdef SOFTAP - - { WL_SET_AP_CFG, - IW_PRIV_TYPE_CHAR | 256, + IW_PRIV_TYPE_CHAR | 256, 0, "AP_SET_CFG" }, { WL_AP_STA_LIST, - 0, - IW_PRIV_TYPE_CHAR | 0, + 0, + IW_PRIV_TYPE_CHAR | 0, "AP_GET_STA_LIST" }, { WL_AP_MAC_FLTR, - IW_PRIV_TYPE_CHAR | 256, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, + IW_PRIV_TYPE_CHAR | 256, + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, "AP_SET_MAC_FLTR" }, - { + { WL_AP_BSS_START, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, @@ -5558,25 +5526,26 @@ static const struct iw_priv_args wl_iw_priv_args[] = { AP_LPB_CMD, - IW_PRIV_TYPE_CHAR | 256, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, + IW_PRIV_TYPE_CHAR | 256, + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, "AP_LPB_CMD" }, - { + { WL_AP_STOP, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, + IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, "AP_BSS_STOP" }, - { + + { WL_FW_RELOAD, IW_PRIV_TYPE_CHAR | 256, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, "WL_FW_RELOAD" }, -#endif - }; +#endif +}; const struct iw_handler_def wl_iw_handler_def = { @@ -5590,11 +5559,10 @@ const struct iw_handler_def wl_iw_handler_def = #if WIRELESS_EXT >= 19 get_wireless_stats: dhd_get_wireless_stats, #endif - }; +}; #endif - int wl_iw_ioctl( struct net_device *dev, struct ifreq *rq, @@ -5607,7 +5575,7 @@ int wl_iw_ioctl( char *extra = NULL; int token_size = 1, max_tokens = 0, ret = 0; - WL_TRACE(("\n%s, cmd:%x alled via dhd->do_ioctl()entry point\n", __FUNCTION__, cmd)); + WL_TRACE(("%s: cmd:%x alled via dhd->do_ioctl()entry point\n", __FUNCTION__, cmd)); if (cmd < SIOCIWFIRST || IW_IOCTL_IDX(cmd) >= ARRAYSIZE(wl_iw_handler) || !(handler = wl_iw_handler[IW_IOCTL_IDX(cmd)])) { @@ -5634,7 +5602,6 @@ int wl_iw_ioctl( break; case SIOCGIWRANGE: - max_tokens = sizeof(struct iw_range) + 500; break; @@ -5800,11 +5767,11 @@ wl_iw_check_conn_fail(wl_event_msg_t *e, char* stringBuf, uint buflen) else return FALSE; } -#endif +#endif #ifndef IW_CUSTOM_MAX #define IW_CUSTOM_MAX 256 -#endif +#endif void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) @@ -5817,23 +5784,18 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) uint16 flags = ntoh16(e->flags); uint32 datalen = ntoh32(e->datalen); uint32 status = ntoh32(e->status); - wl_iw_t *iw; uint32 toto; memset(&wrqu, 0, sizeof(wrqu)); memset(extra, 0, sizeof(extra)); - iw = 0; if (!dev) { WL_ERROR(("%s: dev is null\n", __FUNCTION__)); return; } - iw = *(wl_iw_t **)netdev_priv(dev); - WL_TRACE(("%s: dev=%s event=%d \n", __FUNCTION__, dev->name, event_type)); - switch (event_type) { #if defined(SOFTAP) case WLC_E_PRUNE: @@ -5843,9 +5805,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) macaddr[0], macaddr[1], macaddr[2], macaddr[3], \ macaddr[4], macaddr[5])); - - if (ap_macmode) - { + if (ap_macmode) { int i; for (i = 0; i < ap_black_list.count; i++) { if (!bcmp(macaddr, &ap_black_list.ea[i], \ @@ -5856,7 +5816,6 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) } if (i == ap_black_list.count) { - char mac_buf[32] = {0}; sprintf(mac_buf, "STA_BLOCK %02X:%02X:%02X:%02X:%02X:%02X", macaddr[0], macaddr[1], macaddr[2], @@ -5866,7 +5825,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) } } break; -#endif +#endif case WLC_E_TXFAIL: cmd = IWEVTXDROP; memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN); @@ -5882,7 +5841,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) wl_iw_send_priv_event(priv_dev, "STA_JOIN"); return; } -#endif +#endif memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN); wrqu.addr.sa_family = ARPHRD_ETHER; cmd = IWEVREGISTERED; @@ -5895,7 +5854,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) wl_iw_send_priv_event(priv_dev, "STA_LEAVE"); return; } -#endif +#endif cmd = SIOCGIWAP; bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN); wrqu.addr.sa_family = ARPHRD_ETHER; @@ -5905,25 +5864,21 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) case WLC_E_NDIS_LINK: cmd = SIOCGIWAP; if (!(flags & WLC_EVENT_MSG_LINK)) { - - #ifdef SOFTAP - if (ap_mode && !strncmp(dev->name, "wl0.1", 5)) { - - WL_SOFTAP(("AP DOWN %d\n", event_type)); - wl_iw_send_priv_event(priv_dev, "AP_DOWN"); - } else { - WL_TRACE(("STA_Link Down\n")); + if (ap_mode && !strncmp(dev->name, "wl0.1", 5)) { + WL_SOFTAP(("AP DOWN %d\n", event_type)); + wl_iw_send_priv_event(priv_dev, "AP_DOWN"); + } else { + WL_TRACE(("STA_Link Down\n")); + g_ss_cache_ctrl.m_link_down = 1; + } +#else g_ss_cache_ctrl.m_link_down = 1; - } -#else - g_ss_cache_ctrl.m_link_down = 1; #endif WL_TRACE(("Link Down\n")); bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN); bzero(&extra, ETHER_ADDR_LEN); - WAKE_LOCK_TIMEOUT(iw->pub, WAKE_LOCK_LINK_DOWN_TMOUT, 20 * HZ); } else { @@ -5931,17 +5886,15 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) g_ss_cache_ctrl.m_link_down = 0; memcpy(g_ss_cache_ctrl.m_active_bssid, &e->addr, ETHER_ADDR_LEN); -#ifdef SOFTAP +#ifdef SOFTAP if (ap_mode && !strncmp(dev->name, "wl0.1", 5)) { - WL_SOFTAP(("AP UP %d\n", event_type)); wl_iw_send_priv_event(priv_dev, "AP_UP"); } else { WL_TRACE(("STA_LINK_UP\n")); } -#else -#endif +#endif WL_TRACE(("Link UP\n")); } @@ -6032,7 +5985,7 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) wrqu.data.length = strlen(extra); WL_TRACE(("Event WLC_E_SCAN_COMPLETE\n")); #endif - break; + break; default: @@ -6040,8 +5993,14 @@ wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) break; } #ifndef SANDGATE2G - if (cmd) - wireless_send_event(dev, cmd, &wrqu, extra); + if (cmd) { +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31)) + if (cmd == SIOCGIWSCAN) + wireless_send_event(dev, cmd, &wrqu, NULL); + else +#endif + wireless_send_event(dev, cmd, &wrqu, extra); + } #endif #if WIRELESS_EXT > 14 @@ -6074,7 +6033,7 @@ int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstat phy_noise = dtoh32(phy_noise); WL_TRACE(("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise)); - scb_val.val = 0; + bzero(&scb_val, sizeof(scb_val_t)); if ((res = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)))) goto done; @@ -6186,17 +6145,19 @@ _bt_dhcp_sysioc_thread(void *data) DAEMONIZE("dhcp_sysioc"); while (down_interruptible(&g_bt->bt_sem) == 0) { + + net_os_wake_lock(g_bt->dev); + if (g_bt->timer_on) { - del_timer(&g_bt->timer); g_bt->timer_on = 0; + del_timer_sync(&g_bt->timer); } switch (g_bt->bt_state) { case BT_DHCP_START: g_bt->bt_state = BT_DHCP_OPPORTUNITY_WINDOW; - mod_timer(&g_bt->timer, jiffies + \ - BT_DHCP_OPPORTUNITY_WINDOW_TIEM*HZ/1000); + mod_timer(&g_bt->timer, jiffies + BT_DHCP_OPPORTUNITY_WINDOW_TIEM*HZ/1000); g_bt->timer_on = 1; break; case BT_DHCP_OPPORTUNITY_WINDOW: @@ -6225,12 +6186,15 @@ _bt_dhcp_sysioc_thread(void *data) g_bt->timer_on = 0; break; } + + net_os_wake_unlock(g_bt->dev); } if (g_bt->timer_on) { - del_timer(&g_bt->timer); g_bt->timer_on = 0; + del_timer_sync(&g_bt->timer); } + complete_and_exit(&g_bt->bt_exited, 0); } @@ -6316,6 +6280,7 @@ int wl_iw_attach(struct net_device *dev, void * dhdp) if (iscan->sysioc_pid < 0) return -ENOMEM; #endif + mutex_init(&wl_start_lock); iw = *(wl_iw_t **)netdev_priv(dev); iw->pub = (dhd_pub_t *)dhdp; @@ -6329,15 +6294,13 @@ int wl_iw_attach(struct net_device *dev, void * dhdp) memset(g_scan, 0, G_SCAN_RESULTS); g_scan_specified_ssid = 0; - wl_iw_init_ss_cache_ctrl(); wl_iw_bt_init(dev); #ifdef SOFTAP priv_dev = dev; -#endif - +#endif return 0; } @@ -6362,7 +6325,7 @@ void wl_iw_detach(void) } kfree(iscan); g_iscan = NULL; -#endif +#endif if (g_scan) kfree(g_scan); @@ -6374,7 +6337,6 @@ void wl_iw_detach(void) #ifdef SOFTAP if (ap_mode) { WL_TRACE(("\n%s AP is going down\n", __FUNCTION__)); - wl_iw_send_priv_event(priv_dev, "AP_DOWN"); } #endif diff --git a/bcm4329/src/wl/sys/wl_iw.h b/bcm4329/src/wl/sys/wl_iw.h index 7f770fd..2afbcbc 100644 --- a/bcm4329/src/wl/sys/wl_iw.h +++ b/bcm4329/src/wl/sys/wl_iw.h @@ -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.13.2.2 2010/03/16 22:09:45 Exp $ + * $Id: wl_iw.h,v 1.5.34.1.6.13 2010/03/10 03:55:02 Exp $ */ @@ -35,26 +35,23 @@ #include <wlioctl.h> - - - -#define WL_IW_RSSI_MINVAL -200 -#define WL_IW_RSSI_NO_SIGNAL -91 -#define WL_IW_RSSI_VERY_LOW -80 -#define WL_IW_RSSI_LOW -70 -#define WL_IW_RSSI_GOOD -68 -#define WL_IW_RSSI_VERY_GOOD -58 -#define WL_IW_RSSI_EXCELLENT -57 -#define WL_IW_RSSI_INVALID 0 -#define MAX_WX_STRING 80 -#define isprint(c) bcm_isprint(c) +#define WL_IW_RSSI_MINVAL -200 +#define WL_IW_RSSI_NO_SIGNAL -91 +#define WL_IW_RSSI_VERY_LOW -80 +#define WL_IW_RSSI_LOW -70 +#define WL_IW_RSSI_GOOD -68 +#define WL_IW_RSSI_VERY_GOOD -58 +#define WL_IW_RSSI_EXCELLENT -57 +#define WL_IW_RSSI_INVALID 0 +#define MAX_WX_STRING 80 +#define isprint(c) bcm_isprint(c) #define WL_IW_SET_ACTIVE_SCAN (SIOCIWFIRSTPRIV+1) -#define WL_IW_GET_RSSI (SIOCIWFIRSTPRIV+3) +#define WL_IW_GET_RSSI (SIOCIWFIRSTPRIV+3) #define WL_IW_SET_PASSIVE_SCAN (SIOCIWFIRSTPRIV+5) #define WL_IW_GET_LINK_SPEED (SIOCIWFIRSTPRIV+7) #define WL_IW_GET_CURR_MACADDR (SIOCIWFIRSTPRIV+9) -#define WL_IW_SET_STOP (SIOCIWFIRSTPRIV+11) -#define WL_IW_SET_START (SIOCIWFIRSTPRIV+13) +#define WL_IW_SET_STOP (SIOCIWFIRSTPRIV+11) +#define WL_IW_SET_START (SIOCIWFIRSTPRIV+13) #define WL_SET_AP_CFG (SIOCIWFIRSTPRIV+15) @@ -66,10 +63,10 @@ #define WL_FW_RELOAD (SIOCIWFIRSTPRIV+27) #define WL_AP_SPARE2 (SIOCIWFIRSTPRIV+29) #define WL_AP_SPARE3 (SIOCIWFIRSTPRIV+31) -#define G_SCAN_RESULTS 8*1024 -#define WE_ADD_EVENT_FIX 0x80 -#define G_WLAN_SET_ON 0 -#define G_WLAN_SET_OFF 1 +#define G_SCAN_RESULTS (8*1024) +#define WE_ADD_EVENT_FIX 0x80 +#define G_WLAN_SET_ON 0 +#define G_WLAN_SET_OFF 1 #define CHECK_EXTRA_FOR_NULL(extra) \ if (!extra) { \ @@ -83,8 +80,8 @@ typedef struct wl_iw { struct iw_statistics wstats; int spy_num; - uint32 pwsec; - uint32 gwsec; + uint32 pwsec; + uint32 gwsec; struct ether_addr spy_addr[IW_MAX_SPY]; struct iw_quality spy_qual[IW_MAX_SPY]; @@ -100,7 +97,7 @@ struct wl_ctrl { struct completion sysioc_exited; }; -#define WLC_IW_SS_CACHE_MAXLEN 512 +#define WLC_IW_SS_CACHE_MAXLEN 512 #define WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN 32 #define WLC_IW_BSS_INFO_MAXLEN \ (WLC_IW_SS_CACHE_MAXLEN - WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN) @@ -139,36 +136,43 @@ struct ap_profile { uint8 ssid[SSID_LEN]; uint8 sec[SEC_LEN]; uint8 key[KEY_LEN]; - uint32 channel; + uint32 channel; uint32 preamble; - uint32 max_scb; + uint32 max_scb; }; #define MACLIST_MODE_DISABLED 0 #define MACLIST_MODE_ENABLED 1 -#define MACLIST_MODE_ALLOW 2 +#define MACLIST_MODE_ALLOW 2 struct mflist { uint count; struct ether_addr ea[16]; }; + struct mac_list_set { uint32 mode; struct mflist white_list; struct mflist black_list; }; -#endif +#endif #if WIRELESS_EXT > 12 #include <net/iw_handler.h> extern const struct iw_handler_def wl_iw_handler_def; -#endif +#endif extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data); extern int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats); int wl_iw_attach(struct net_device *dev, void * dhdp); void wl_iw_detach(void); +int wl_control_wl_start(struct net_device *dev); + +extern int net_os_wake_lock(struct net_device *dev); +extern int net_os_wake_unlock(struct net_device *dev); +extern int net_os_wake_lock_timeout(struct net_device *dev); +extern int net_os_wake_lock_timeout_enable(struct net_device *dev); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \ @@ -186,4 +190,4 @@ void wl_iw_detach(void); iwe_stream_add_point(stream, ends, iwe, extra) #endif -#endif +#endif |