Samsung VZW MB1 update
/drivers/net/wireless/bcmdhd/dhd_linux.c
blob:654fb3e40631a1cfe96893477a8f2460ecf58368 -> blob:0cb2c4906c9763ea0de70af40d7a521dabd219fb
--- drivers/net/wireless/bcmdhd/dhd_linux.c
+++ drivers/net/wireless/bcmdhd/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 358099 2012-09-21 04:38:52Z $
+ * $Id: dhd_linux.c 373329 2012-12-07 04:46:09Z $
*/
#include <typedefs.h>
@@ -95,10 +95,6 @@ typedef struct histo_ {
static histo_t vi_d1, vi_d2, vi_d3, vi_d4;
#endif /* WLMEDIA_HTSF */
-#ifndef DTIM_COUNT
-#define DTIM_COUNT 3
-#endif
-
#if defined(PKT_FILTER_SUPPORT)
#if defined(BLOCK_IPV6_PACKET)
#define HEX_PREF_STR "0x"
@@ -130,7 +126,7 @@ extern bool ap_fw_loaded;
#include <wl_android.h>
#ifdef ARP_OFFLOAD_SUPPORT
-void aoe_update_host_ipv4_table(dhd_pub_t *dhd_pub, u32 ipa, bool add);
+void aoe_update_host_ipv4_table(dhd_pub_t *dhd_pub, u32 ipa, bool add, int idx);
static int dhd_device_event(struct notifier_block *this,
unsigned long event,
void *ptr);
@@ -146,9 +142,9 @@ volatile bool dhd_mmc_suspend = FALSE;
DECLARE_WAIT_QUEUE_HEAD(dhd_dpc_wait);
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */
-#if defined(OOB_INTR_ONLY)
+#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID)
extern void dhd_enable_oob_intr(struct dhd_bus *bus, bool enable);
-#endif /* defined(OOB_INTR_ONLY) */
+#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (1)
static void dhd_hang_process(struct work_struct *work);
#endif
@@ -196,7 +192,7 @@ extern wl_iw_extra_params_t g_wl_iw_par
#endif /* defined(CONFIG_HAS_EARLYSUSPEND) && defined(DHD_USE_EARLYSUSPEND) */
#endif /* CUSTOMER_HW4 && CONFIG_PARTIALSUSPEND_SLP */
-extern int dhd_get_dtim_skip(dhd_pub_t *dhd);
+extern int dhd_get_suspend_bcn_li_dtim(dhd_pub_t *dhd);
#ifdef PKT_FILTER_SUPPORT
extern void dhd_pktfilter_offload_set(dhd_pub_t * dhd, char *arg);
@@ -395,7 +391,11 @@ module_param(dhd_msg_level, int, 0);
module_param(disable_proptx, int, 0644);
/* load firmware and/or nvram values from the filesystem */
module_param_string(firmware_path, firmware_path, MOD_PARAM_PATHLEN, 0660);
+#ifdef CUSTOMER_HW4
module_param_string(nvram_path, nvram_path, MOD_PARAM_PATHLEN, 0660);
+#else
+module_param_string(nvram_path, nvram_path, MOD_PARAM_PATHLEN, 0);
+#endif /* CUSTOMER_HW4 */
/* Watchdog interval */
uint dhd_watchdog_ms = 10;
@@ -411,7 +411,12 @@ uint dhd_slpauto = TRUE;
module_param(dhd_slpauto, uint, 0);
/* ARP offload agent mode : Enable ARP Host Auto-Reply and ARP Peer Auto-Reply */
+#if defined(CUSTOMER_HW4)
uint dhd_arp_mode = ARP_OL_AGENT | ARP_OL_PEER_AUTO_REPLY | ARP_OL_SNOOP;
+#else
+uint dhd_arp_mode = ARP_OL_AGENT | ARP_OL_PEER_AUTO_REPLY;
+#endif
+
module_param(dhd_arp_mode, uint, 0);
/* ARP offload enable */
@@ -602,9 +607,9 @@ extern int register_pm_notifier(struct n
extern int unregister_pm_notifier(struct notifier_block *nb);
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */
-#ifdef PKT_FILTER_SUPPORT
void dhd_set_packet_filter(dhd_pub_t *dhd)
{
+#ifdef PKT_FILTER_SUPPORT
int i;
DHD_TRACE(("%s: enter\n", __FUNCTION__));
@@ -613,20 +618,24 @@ void dhd_set_packet_filter(dhd_pub_t *dh
dhd_pktfilter_offload_set(dhd, dhd->pktfilter[i]);
}
}
+#endif /* PKT_FILTER_SUPPORT */
}
void dhd_enable_packet_filter(int value, dhd_pub_t *dhd)
{
+#ifdef PKT_FILTER_SUPPORT
int i;
DHD_TRACE(("%s: enter, value = %d\n", __FUNCTION__, value));
/* 1 - Enable packet filter, only allow unicast packet to send up */
/* 0 - Disable packet filter */
- if (dhd_pkt_filter_enable) {
+ if (dhd_pkt_filter_enable && (!value ||
+ (dhd_support_sta_mode(dhd) && !dhd->dhcp_in_progress)))
+ {
for (i = 0; i < dhd->pktfilter_count; i++) {
#ifdef PASS_ARP_PACKET
if (value && (i == dhd->pktfilter_count -1) &&
- !(dhd->op_mode & (P2P_GC_ENABLED | P2P_GO_ENABLED))) {
+ !(dhd->op_mode & (DHD_FLAG_P2P_GC_MODE | DHD_FLAG_P2P_GO_MODE))) {
DHD_TRACE_HW4(("Do not turn on ARP white list pkt filter:"
"val %d, cnt %d, op_mode 0x%x\n",
value, i, dhd->op_mode));
@@ -637,8 +646,8 @@ void dhd_enable_packet_filter(int value,
value, dhd_master_mode);
}
}
-}
#endif /* PKT_FILTER_SUPPORT */
+}
static int dhd_set_suspend(int value, dhd_pub_t *dhd)
{
@@ -647,9 +656,7 @@ static int dhd_set_suspend(int value, dh
#endif
/* wl_pkt_filter_enable_t enable_parm; */
char iovbuf[32];
-#if !defined(CUSTOMER_HW4)
- int bcn_li_dtim = DTIM_COUNT;
-#endif
+ int bcn_li_dtim = 0; /* Default bcn_li_dtim in resume mode is 0 */
#ifndef DISABLE_FW_ROAM_SUSPEND
uint roamvar = 1;
#endif
@@ -657,7 +664,9 @@ static int dhd_set_suspend(int value, dh
int bcn_li_bcn;
#endif /* ENABLE_BCN_LI_BCN_WAKEUP */
#ifdef PASS_ALL_MCAST_PKTS
+ struct dhd_info *dhdinfo = dhd->info;
uint32 allmulti;
+ uint i;
#endif /* PASS_ALL_MCAST_PKTS */
DHD_TRACE(("%s: enter, value = %d in_suspend=%d\n",
@@ -670,34 +679,36 @@ static int dhd_set_suspend(int value, dh
dhd->early_suspended = 1;
#endif
/* Kernel suspended */
- DHD_ERROR(("%s: force extra Suspend setting \n", __FUNCTION__));
+ DHD_ERROR(("%s: force extra Suspend setting\n", __FUNCTION__));
#ifndef SUPPORT_PM2_ONLY
dhd_wl_ioctl_cmd(dhd, WLC_SET_PM, (char *)&power_mode,
sizeof(power_mode), TRUE, 0);
#endif
-#ifdef PKT_FILTER_SUPPORT
+
/* Enable packet filter, only allow unicast packet to send up */
- if (!dhd->dhcp_in_progress)
- dhd_enable_packet_filter(1, dhd);
-#endif /* PKT_FILTER_SUPPORT */
+ dhd_enable_packet_filter(1, dhd);
+
#ifdef PASS_ALL_MCAST_PKTS
allmulti = 0;
bcm_mkiovar("allmulti", (char *)&allmulti,
4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ for (i = 0; i < DHD_MAX_IFS; i++) {
+ if (dhdinfo->iflist[i] && dhdinfo->iflist[i]->net)
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
+ sizeof(iovbuf), TRUE, i);
+ }
#endif /* PASS_ALL_MCAST_PKTS */
-#if !defined(CUSTOMER_HW4)
/* If DTIM skip is set up as default, force it to wake
* each third DTIM for better power savings. Note that
* one side effect is a chance to miss BC/MC packet.
*/
- bcn_li_dtim = dhd_get_dtim_skip(dhd);
+ bcn_li_dtim = dhd_get_suspend_bcn_li_dtim(dhd);
bcm_mkiovar("bcn_li_dtim", (char *)&bcn_li_dtim,
4, iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-#endif /* !defined(CUSTOMER_HW4) */
+
#ifndef DISABLE_FW_ROAM_SUSPEND
/* Disable firmware roaming during suspend */
bcm_mkiovar("roam_off", (char *)&roamvar, 4,
@@ -716,31 +727,33 @@ static int dhd_set_suspend(int value, dh
dhd->early_suspended = 0;
#endif
/* Kernel resumed */
- DHD_TRACE(("%s: Remove extra suspend setting \n", __FUNCTION__));
+ DHD_ERROR(("%s: Remove extra suspend setting\n", __FUNCTION__));
#ifndef SUPPORT_PM2_ONLY
power_mode = PM_FAST;
dhd_wl_ioctl_cmd(dhd, WLC_SET_PM, (char *)&power_mode,
sizeof(power_mode), TRUE, 0);
#endif
-#ifdef PKT_FILTER_SUPPORT
+
/* disable pkt filter */
dhd_enable_packet_filter(0, dhd);
-#endif /* PKT_FILTER_SUPPORT */
+
#ifdef PASS_ALL_MCAST_PKTS
allmulti = 1;
bcm_mkiovar("allmulti", (char *)&allmulti,
4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ for (i = 0; i < DHD_MAX_IFS; i++) {
+ if (dhdinfo->iflist[i] && dhdinfo->iflist[i]->net)
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf,
+ sizeof(iovbuf), TRUE, i);
+ }
#endif /* PASS_ALL_MCAST_PKTS */
-#if !defined(CUSTOMER_HW4)
/* restore pre-suspend setting for dtim_skip */
- bcm_mkiovar("bcn_li_dtim", (char *)&dhd->dtim_skip,
+ bcm_mkiovar("bcn_li_dtim", (char *)&bcn_li_dtim,
4, iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
-#endif
#ifndef DISABLE_FW_ROAM_SUSPEND
roamvar = dhd_roam_disable;
bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf,
@@ -770,7 +783,7 @@ static int dhd_suspend_resume_helper(str
/* Set flag when early suspend was called */
dhdp->in_suspend = val;
if ((force || !dhdp->suspend_disable_flag) &&
- (dhd_check_ap_wfd_mode_set(dhdp) == FALSE))
+ dhd_support_sta_mode(dhdp))
{
ret = dhd_set_suspend(val, dhdp);
}
@@ -964,9 +977,13 @@ _dhd_set_multicast_list(dhd_info_t *dhd,
for (i = 0; i < DHD_MAX_IFS; i++) {
if (dhd->iflist[i]) {
dev = dhd->iflist[i]->net;
+ if (!dev)
+ continue;
#else
ASSERT(dhd && dhd->iflist[ifidx]);
dev = dhd->iflist[ifidx]->net;
+ if (!dev)
+ return;
#endif /* MCAST_LIST_ACCUMULATION */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
netif_addr_lock_bh(dev);
@@ -1047,7 +1064,7 @@ _dhd_set_multicast_list(dhd_info_t *dhd,
#ifdef MCAST_LIST_ACCUMULATION
DHD_TRACE(("_dhd_set_multicast_list: cnt "
"%d " MACDBG "\n",
- cnt_iface[i], STR_TO_MACD(ha->addr)));
+ cnt_iface[i], MAC2STRDBG(ha->addr)));
cnt_iface[i]--;
#else
cnt--;
@@ -1493,7 +1510,9 @@ dhd_sendpkt(dhd_pub_t *dhdp, int ifidx,
}
/* Look into the packet and update the packet priority */
+#ifndef PKTPRIO_OVERRIDE
if (PKTPRIO(pktbuf) == 0)
+#endif /* !CUSTOMER_HW4 */
pktsetprio(pktbuf, FALSE);
#ifdef PROP_TXSTATUS
@@ -1520,9 +1539,9 @@ dhd_sendpkt(dhd_pub_t *dhdp, int ifidx,
dhd_htsf_addtxts(dhdp, pktbuf);
#endif
#ifdef PROP_TXSTATUS
+ dhd_os_wlfc_block(dhdp);
if (dhdp->wlfc_state && ((athost_wl_status_info_t*)dhdp->wlfc_state)->proptxstatus_mode
!= WLFC_FCMODE_NONE) {
- dhd_os_wlfc_block(dhdp);
ret = dhd_wlfc_enque_sendq(dhdp->wlfc_state, DHD_PKTTAG_FIFO(PKTTAG(pktbuf)),
pktbuf);
dhd_wlfc_commit_packets(dhdp->wlfc_state, (f_commitpkt_t)dhd_bus_txdata,
@@ -1532,9 +1551,11 @@ dhd_sendpkt(dhd_pub_t *dhdp, int ifidx,
}
dhd_os_wlfc_unblock(dhdp);
}
- else
+ else{
+ dhd_os_wlfc_unblock(dhdp);
/* non-proptxstatus way */
ret = dhd_bus_txdata(dhdp->bus, pktbuf);
+ }
#else
ret = dhd_bus_txdata(dhdp->bus, pktbuf);
#endif /* PROP_TXSTATUS */
@@ -1713,11 +1734,6 @@ static const char *_get_packet_type_str(
}
#endif /* DHD_RX_DUMP */
-#ifdef CUSTOMER_HW4
-extern int pkt_free;
-extern int caller;
-extern void *free_ptr;
-#endif
void
dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt, uint8 chan)
{
@@ -1757,11 +1773,11 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx,
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
/* Dropping packets before registering net device to avoid kernel panic */
-#ifdef BCMDHDUSB
+#ifndef PROP_TXSTATUS_VSDB
if (!ifp->net || ifp->net->reg_state != NETREG_REGISTERED) {
#else
if (!ifp->net || ifp->net->reg_state != NETREG_REGISTERED || !dhd->pub.up) {
-#endif /* BCMDHDUSB */
+#endif /* PROP_TXSTATUS_VSDB */
DHD_ERROR(("%s: net device is NOT registered yet. drop packet\n",
__FUNCTION__));
PKTFREE(dhdp->osh, pktbuf, TRUE);
@@ -1793,16 +1809,10 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx,
piggy-back on
*/
((athost_wl_status_info_t*)dhdp->wlfc_state)->stats.wlfc_header_only_pkt++;
-#ifdef CUSTOMER_HW4
- /*if (numpkt == 1 && pkt_free && (free_ptr == pktbuf)) {
- DHD_ERROR(("DHD TRACE2(FREE):%d %d %p\n",
- pkt_free, caller, free_ptr));
- }*/
-#endif
PKTFREE(dhdp->osh, pktbuf, TRUE);
continue;
}
-#endif /* PROP_TXSTATUS */
+#endif
skb = PKTTONATIVE(dhdp->osh, pktbuf);
@@ -1845,7 +1855,7 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx,
}
} else if (dump_data[0] & 1) {
DHD_ERROR(("%s: MULTICAST: " MACDBG "\n",
- __FUNCTION__, STR_TO_MACD(dump_data)));
+ __FUNCTION__, MAC2STRDBG(dump_data)));
}
if (protocol == ETHER_TYPE_802_1X) {
@@ -1903,7 +1913,11 @@ dhd_rx_frame(dhd_pub_t *dhdp, int ifidx,
#if defined(PNO_SUPPORT)
if (event.event_type == WLC_E_PFN_NET_FOUND) {
+#ifdef CUSTOMER_HW4
+ tout_ctrl = DHD_PNO_TIMEOUT_MS;
+#else
tout_ctrl *= 2;
+#endif
}
#endif /* PNO_SUPPORT */
} else {
@@ -2741,7 +2755,9 @@ dhd_stop(struct net_device *net)
#endif
#ifdef PROP_TXSTATUS
+ dhd_os_wlfc_block(&dhd->pub);
dhd_wlfc_cleanup(&dhd->pub);
+ dhd_os_wlfc_unblock(&dhd->pub);
#endif
/* Stop the protocol module */
@@ -2784,8 +2800,14 @@ dhd_open(struct net_device *net)
int ifidx;
int32 ret = 0;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
+ if (mutex_is_locked(&_dhd_sdio_mutex_lock_) != 0) {
+ DHD_ERROR(("%s : dhd_open: call dev open before insmod complete!\n", __FUNCTION__));
+ }
+ mutex_lock(&_dhd_sdio_mutex_lock_);
+#endif
+
DHD_OS_WAKE_LOCK(&dhd->pub);
- DHD_ERROR(("%s: Enter, net[%p]\n", __FUNCTION__, net));
/* Update FW path if it was changed */
if (strlen(firmware_path) != 0) {
if (firmware_path[strlen(firmware_path)-1] == '\n')
@@ -2802,6 +2824,7 @@ dhd_open(struct net_device *net)
firmware_path[0] = '\0';
}
+#ifdef CUSTOMER_HW4
/* Update NVRAM path if it was changed */
if (!dhd_download_fw_on_driverload && (strlen(nvram_path) != 0)) {
if (nvram_path[strlen(nvram_path)-1] == '\n')
@@ -2809,7 +2832,7 @@ dhd_open(struct net_device *net)
strcpy(nv_path, nvram_path);
nvram_path[0] = '\0';
}
-
+#endif /* CUSTOMER_HW4 */
dhd->pub.dongle_trap_occured = 0;
dhd->pub.hang_was_sent = 0;
@@ -2870,32 +2893,12 @@ dhd_open(struct net_device *net)
if (dhd->pub.busstate != DHD_BUS_DATA) {
-#if defined(CUSTOMER_HW4)
-#define WAIT_DHDBUS_READY 5
- /* Delay ifup until insmod completed in case of module type */
- if (dhd_download_fw_on_driverload) {
- uint retry = 0;
-
- do {
- OSL_DELAY(100*1000);
- } while ((dhd->pub.busstate != DHD_BUS_DATA) &&
- (retry++ < WAIT_DHDBUS_READY));
-
- if (dhd->pub.busstate != DHD_BUS_DATA) {
- DHD_ERROR(("%s: call dev open before insmod complete!\n",
- __FUNCTION__));
- ret = -1;
- goto exit;
- }
+ /* try to bring up bus */
+ if ((ret = dhd_bus_start(&dhd->pub)) != 0) {
+ DHD_ERROR(("%s: failed with code %d\n", __FUNCTION__, ret));
+ ret = -1;
+ goto exit;
}
- else
-#endif /* CUSTOMER_HW4 */
- /* try to bring up bus */
- if ((ret = dhd_bus_start(&dhd->pub)) != 0) {
- DHD_ERROR(("%s: failed with code %d\n", __FUNCTION__, ret));
- ret = -1;
- goto exit;
- }
}
@@ -2933,6 +2936,10 @@ exit:
dhd_stop(net);
DHD_OS_WAKE_UNLOCK(&dhd->pub);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
+ mutex_unlock(&_dhd_sdio_mutex_lock_);
+#endif
return ret;
}
@@ -2945,6 +2952,15 @@ int dhd_do_driver_init(struct net_device
return -EINVAL;
}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
+#ifdef MULTIPLE_SUPPLICANT
+ if (mutex_is_locked(&_dhd_sdio_mutex_lock_) != 0) {
+ DHD_ERROR(("%s : dhdsdio_probe is already running!\n", __FUNCTION__));
+ return 0;
+ }
+#endif /* MULTIPLE_SUPPLICANT */
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) */
+
dhd = *(dhd_info_t **)netdev_priv(net);
/* If driver is already initialized, do nothing
@@ -2953,7 +2969,7 @@ int dhd_do_driver_init(struct net_device
DHD_TRACE(("Driver already Inititalized. Nothing to do"));
return 0;
}
- DHD_ERROR(("%s: call dhd_open\n", __FUNCTION__));
+
if (dhd_open(net) < 0) {
DHD_ERROR(("Driver Init Failed \n"));
return -1;
@@ -3166,6 +3182,11 @@ dhd_attach(osl_t *osh, struct dhd_bus *b
#ifdef PROP_TXSTATUS
spin_lock_init(&dhd->wlfc_spinlock);
+#ifdef PROP_TXSTATUS_VSDB
+ dhd->pub.wlfc_enabled = FALSE;
+#else
+ dhd->pub.wlfc_enabled = TRUE;
+#endif /* PROP_TXSTATUS_VSDB */
#endif /* PROP_TXSTATUS */
/* Initialize other structure content */
@@ -3186,10 +3207,7 @@ dhd_attach(osl_t *osh, struct dhd_bus *b
wake_lock_init(&dhd->wl_wifi, WAKE_LOCK_SUSPEND, "wlan_wake");
wake_lock_init(&dhd->wl_rxwake, WAKE_LOCK_SUSPEND, "wlan_rx_wake");
wake_lock_init(&dhd->wl_ctrlwake, WAKE_LOCK_SUSPEND, "wlan_ctrl_wake");
-#if defined(CUSTOMER_HW4) && defined(PNO_SUPPORT)
- wake_lock_init(&dhd->pub.pno_wakelock, WAKE_LOCK_SUSPEND, "pno_wake_lock");
-#endif
-#endif
+#endif /* CONFIG_HAS_WAKELOCK */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
mutex_init(&dhd->dhd_net_if_mutex);
mutex_init(&dhd->dhd_suspend_mutex);
@@ -3240,7 +3258,7 @@ dhd_attach(osl_t *osh, struct dhd_bus *b
dhd->threads_only = FALSE;
}
- if (dhd_dpc_prio >= 0) {
+ if (dhd_watchdog_prio >= 0) {
/* Initialize watchdog thread */
#ifdef USE_KTHREAD_API
PROC_START2(dhd_watchdog_thread, dhd, &dhd->thr_wdt_ctl, 0, "dhd_watchdog_thread");
@@ -3396,10 +3414,8 @@ dhd_bus_start(dhd_pub_t *dhdp)
return -ENODEV;
}
-#ifndef BCMSPI_ANDROID
/* Enable oob at firmware */
dhd_enable_oob_intr(dhd->pub.bus, TRUE);
-#endif /* !BCMSPI_ANDROID */
#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
/* If bus is not ready, can't come up */
@@ -3469,7 +3485,7 @@ dhd_bus_start(dhd_pub_t *dhdp)
#ifdef ARP_OFFLOAD_SUPPORT
if (dhd->pend_ipaddr) {
#ifdef AOE_IP_ALIAS_SUPPORT
- aoe_update_host_ipv4_table(&dhd->pub, dhd->pend_ipaddr, TRUE);
+ aoe_update_host_ipv4_table(&dhd->pub, dhd->pend_ipaddr, TRUE, 0);
#endif /* AOE_IP_ALIAS_SUPPORT */
dhd->pend_ipaddr = 0;
}
@@ -3478,18 +3494,37 @@ dhd_bus_start(dhd_pub_t *dhdp)
return 0;
}
+bool dhd_is_concurrent_mode(dhd_pub_t *dhd)
+{
+ if (!dhd)
+ return FALSE;
+
+ if (dhd->op_mode & DHD_FLAG_CONCURR_MULTI_CHAN_MODE)
+ return TRUE;
+ else if ((dhd->op_mode & DHD_FLAG_CONCURR_SINGLE_CHAN_MODE) ==
+ DHD_FLAG_CONCURR_SINGLE_CHAN_MODE)
+ return TRUE;
+ else
+ return FALSE;
+}
+
#if !defined(AP) && defined(WLP2P)
-/* For Android ICS MR2 release, the concurrent mode is enabled by default and the firmware
+/* From Android JerryBean release, the concurrent mode is enabled by default and the firmware
* name would be fw_bcmdhd.bin. So we need to determine whether P2P is enabled in the STA
* firmware and accordingly enable concurrent mode (Apply P2P settings). SoftAP firmware
* would still be named as fw_bcmdhd_apsta.
*/
-int
+uint32
dhd_get_concurrent_capabilites(dhd_pub_t *dhd)
{
- int ret = 0;
+ int32 ret = 0;
char buf[WLC_IOCTL_SMLEN];
- bool vsdb_supported = false;
+ bool mchan_supported = FALSE;
+ /* if dhd->op_mode is already set for HOSTAP,
+ * that means we only will use the mode as it is
+ */
+ if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE)
+ return 0;
memset(buf, 0, sizeof(buf));
bcm_mkiovar("cap", 0, 0, buf, sizeof(buf));
if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf),
@@ -3499,7 +3534,7 @@ dhd_get_concurrent_capabilites(dhd_pub_t
return 0;
}
if (strstr(buf, "vsdb")) {
- vsdb_supported = true;
+ mchan_supported = TRUE;
}
if (strstr(buf, "p2p") == NULL) {
DHD_TRACE(("Chip does not support p2p\n"));
@@ -3516,14 +3551,19 @@ dhd_get_concurrent_capabilites(dhd_pub_t
}
else {
if (buf[0] == 1) {
- /* Chip supports p2p, now lets check for vsdb */
- if (vsdb_supported)
- return 2;
- else
-#ifdef WL_ENABLE_P2P_IF
- return 1;
+ /* By default, chip supports single chan concurrency,
+ * now lets check for mchan
+ */
+ ret = DHD_FLAG_CONCURR_SINGLE_CHAN_MODE;
+ if (mchan_supported)
+ ret |= DHD_FLAG_CONCURR_MULTI_CHAN_MODE;
+#if defined(WL_ENABLE_P2P_IF) || defined(CUSTOMER_HW4)
+ /* For customer_hw4, although ICS,
+ * we still support concurrent mode
+ */
+ return ret;
#else
- return 0;
+ return 0;
#endif
}
}
@@ -3556,7 +3596,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
#if defined(ARP_OFFLOAD_SUPPORT)
int arpoe = 1;
#endif
- int scan_assoc_time = DHD_SCAN_ACTIVE_TIME;
+ int scan_assoc_time = DHD_SCAN_ASSOC_ACTIVE_TIME;
int scan_unassoc_time = DHD_SCAN_UNASSOC_ACTIVE_TIME;
int scan_passive_time = DHD_SCAN_PASSIVE_TIME;
char buf[WLC_IOCTL_SMLEN];
@@ -3564,9 +3604,9 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
uint32 listen_interval = LISTEN_INTERVAL; /* Default Listen Interval in Beacons */
#ifdef ROAM_ENABLE
uint roamvar = 0;
- int roam_trigger[2] = {-75, WLC_BAND_ALL};
+ int roam_trigger[2] = {CUSTOM_ROAM_TRIGGER_SETTING, WLC_BAND_ALL};
int roam_scan_period[2] = {10, WLC_BAND_ALL};
- int roam_delta[2] = {10, WLC_BAND_ALL};
+ int roam_delta[2] = {CUSTOM_ROAM_DELTA_SETTING, WLC_BAND_ALL};
#ifdef ROAM_AP_ENV_DETECTION
int roam_env_mode = AP_ENV_INDETERMINATE;
#endif /* ROAM_AP_ENV_DETECTION */
@@ -3608,9 +3648,14 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
#if defined(VSDB) && defined(CUSTOMER_HW4)
int interference_mode = 3;
#endif
+ dhd->suspend_bcn_li_dtim = CUSTOM_SUSPEND_BCN_LI_DTIM;
#ifdef PROP_TXSTATUS
+#ifdef PROP_TXSTATUS_VSDB
dhd->wlfc_enabled = FALSE;
/* enable WLFC only if the firmware is VSDB */
+#else
+ dhd->wlfc_enabled = TRUE;
+#endif /* PROP_TXSTATUS_VSDB */
#endif /* PROP_TXSTATUS */
DHD_TRACE(("Enter %s\n", __FUNCTION__));
dhd->op_mode = 0;
@@ -3642,12 +3687,14 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
}
#endif /* GET_CUSTOM_MAC_ENABLE */
+ DHD_TRACE(("Firmware = %s\n", fw_path));
- if ((!op_mode && strstr(fw_path, "_apsta") != NULL) || (op_mode == HOSTAPD_MASK)) {
+ if ((!op_mode && strstr(fw_path, "_apsta") != NULL) ||
+ (op_mode == DHD_FLAG_HOSTAP_MODE)) {
#ifdef SET_RANDOM_MAC_SOFTAP
uint rand_mac;
#endif
- op_mode = HOSTAPD_MASK;
+ dhd->op_mode = DHD_FLAG_HOSTAP_MODE;
#if defined(ARP_OFFLOAD_SUPPORT)
arpoe = 0;
#endif
@@ -3682,31 +3729,33 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
}
else {
- int concurrent_capab = 0;
- if ((!op_mode && strstr(fw_path, "_p2p") != NULL) || (op_mode == WFD_MASK)) {
+ uint32 concurrent_mode = 0;
+ if ((!op_mode && strstr(fw_path, "_p2p") != NULL) ||
+ (op_mode == DHD_FLAG_P2P_MODE)) {
#if defined(ARP_OFFLOAD_SUPPORT)
arpoe = 0;
#endif
#ifdef PKT_FILTER_SUPPORT
dhd_pkt_filter_enable = FALSE;
#endif
- op_mode = WFD_MASK;
+ dhd->op_mode = DHD_FLAG_P2P_MODE;
}
else
- op_mode = STA_MASK;
+ dhd->op_mode = DHD_FLAG_STA_MODE;
#if !defined(AP) && defined(WLP2P)
- if ((concurrent_capab = dhd_get_concurrent_capabilites(dhd)) > 0) {
- op_mode = STA_MASK | WFD_MASK;
- if (concurrent_capab == 2)
- op_mode = STA_MASK | WFD_MASK | CONCURRENT_MULTI_CHAN;
+ if ((concurrent_mode = dhd_get_concurrent_capabilites(dhd))) {
+#if defined(ARP_OFFLOAD_SUPPORT)
+ arpoe = 1;
+#endif
+ dhd->op_mode |= concurrent_mode;
}
/* Check if we are enabling p2p */
- if (op_mode & WFD_MASK) {
+ if (dhd->op_mode & DHD_FLAG_P2P_MODE) {
bcm_mkiovar("apsta", (char *)&apsta, 4, iovbuf, sizeof(iovbuf));
if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR,
iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) {
- DHD_ERROR(("%s APSTA for WFD failed ret= %d\n", __FUNCTION__, ret));
+ DHD_ERROR(("%s APSTA for P2P failed ret= %d\n", __FUNCTION__, ret));
}
memcpy(&p2p_ea, &dhd->mac, ETHER_ADDR_LEN);
@@ -3721,15 +3770,14 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
}
}
#else
- (void)concurrent_capab;
-#endif
+ (void)concurrent_mode;
+#endif
}
- dhd->op_mode = op_mode;
- DHD_ERROR(("Firmware up: op_mode=%d, "
+ DHD_ERROR(("Firmware up: op_mode=0x%04x, "
"Broadcom Dongle Host Driver mac="MACDBG"\n",
dhd->op_mode,
- STR_TO_MACD(dhd->mac.octet)));
+ MAC2STRDBG(dhd->mac.octet)));
/* Set Country code */
if (dhd->dhd_cspec.ccode[0] != 0) {
bcm_mkiovar("country", (char *)&dhd->dhd_cspec,
@@ -3749,20 +3797,27 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
#endif /* ROAM_ENABLE || DISABLE_BUILTIN_ROAM */
#ifdef ROAM_ENABLE
- dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_TRIGGER, roam_trigger, sizeof(roam_trigger), TRUE, 0);
- dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_SCAN_PERIOD, roam_scan_period,
- sizeof(roam_scan_period), TRUE, 0);
- dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_DELTA, roam_delta, sizeof(roam_delta), TRUE, 0);
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_TRIGGER, roam_trigger,
+ sizeof(roam_trigger), TRUE, 0)) < 0)
+ DHD_ERROR(("%s: roam trigger set failed %d\n", __FUNCTION__, ret));
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_SCAN_PERIOD, roam_scan_period,
+ sizeof(roam_scan_period), TRUE, 0)) < 0)
+ DHD_ERROR(("%s: roam scan period set failed %d\n", __FUNCTION__, ret));
+ if ((dhd_wl_ioctl_cmd(dhd, WLC_SET_ROAM_DELTA, roam_delta,
+ sizeof(roam_delta), TRUE, 0)) < 0)
+ DHD_ERROR(("%s: roam delta set failed %d\n", __FUNCTION__, ret));
bcm_mkiovar("fullroamperiod", (char *)&roam_fullscan_period, 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0)
+ DHD_ERROR(("%s: roam fullscan period set failed %d\n", __FUNCTION__, ret));
#ifdef ROAM_AP_ENV_DETECTION
if (roam_trigger[0] == WL_AUTO_ROAM_TRIGGER) {
bcm_mkiovar("roam_env_detection", (char *)&roam_env_mode,
4, iovbuf, sizeof(iovbuf));
if (dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0) == BCME_OK)
dhd->roam_env_detection = TRUE;
- else
+ else {
dhd->roam_env_detection = FALSE;
+ }
}
#endif /* ROAM_AP_ENV_DETECTION */
#endif /* ROAM_ENABLE */
@@ -3783,9 +3838,11 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
bcm_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, sizeof(iovbuf));
dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
- DHD_INFO(("%s set glom=0x%X\n", __FUNCTION__, glom));
- bcm_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf));
- dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ if (glom != DEFAULT_GLOM_VALUE) {
+ DHD_INFO(("%s set glom=0x%X\n", __FUNCTION__, glom));
+ bcm_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf));
+ dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
+ }
/* Setup timeout if Beacons are lost and roam is off to report link down */
bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, sizeof(iovbuf));
@@ -3819,7 +3876,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
#if defined(SOFTAP)
if (ap_fw_loaded == FALSE)
#endif
- if ((dhd->op_mode & HOSTAPD_MASK) != HOSTAPD_MASK) {
+ if (!(dhd->op_mode & DHD_FLAG_HOSTAP_MODE)) {
if ((res = dhd_keep_alive_onoff(dhd)) < 0)
DHD_ERROR(("%s set keeplive failed %d\n",
__FUNCTION__, res));
@@ -3874,7 +3931,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
#endif /* BCMCCX */
#ifdef WL_CFG80211
setbit(eventmask, WLC_E_ESCAN_RESULT);
- if ((dhd->op_mode & WFD_MASK) == WFD_MASK) {
+ if (dhd->op_mode & DHD_FLAG_P2P_MODE) {
setbit(eventmask, WLC_E_ACTION_FRAME_RX);
setbit(eventmask, WLC_E_ACTION_FRAME_COMPLETE);
setbit(eventmask, WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE);
@@ -3914,6 +3971,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
dhd_arp_offload_enable(dhd, FALSE);
dhd_arp_offload_set(dhd, 0);
}
+ dhd_arp_enable = arpoe;
#endif /* ARP_OFFLOAD_SUPPORT */
#ifdef PKT_FILTER_SUPPORT
@@ -3954,13 +4012,14 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
dhd->pktfilter[dhd->pktfilter_count++] = "105 0 0 12 0xFFFF 0x0806";
#endif
#endif /* CUSTOMER_HW4 */
+ dhd_set_packet_filter(dhd);
#if defined(SOFTAP)
if (ap_fw_loaded) {
dhd_enable_packet_filter(0, dhd);
}
#endif /* defined(SOFTAP) */
- dhd_set_packet_filter(dhd);
+
#endif /* PKT_FILTER_SUPPORT */
#ifdef DISABLE_11N
bcm_mkiovar("nmode", (char *)&nmode, 4, iovbuf, sizeof(iovbuf));
@@ -4009,7 +4068,7 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
/* Check and adjust IOCTL response timeout for Manufactring firmware */
if (strstr(buf, MANUFACTRING_FW) != NULL) {
- dhd_os_set_ioctl_resp_timeout(IOCTL_RESP_TIMEOUT * 10);
+ dhd_os_set_ioctl_resp_timeout(20000);
DHD_ERROR(("%s : adjust IOCTL response time for Manufactring Firmware\n",
__FUNCTION__));
}
@@ -4073,7 +4132,7 @@ int dhd_change_mtu(dhd_pub_t *dhdp, int
#ifdef ARP_OFFLOAD_SUPPORT
/* add or remove AOE host ip(s) (up to 8 IPs on the interface) */
void
-aoe_update_host_ipv4_table(dhd_pub_t *dhd_pub, u32 ipa, bool add)
+aoe_update_host_ipv4_table(dhd_pub_t *dhd_pub, u32 ipa, bool add, int idx)
{
u32 ipv4_buf[MAX_IPV4_ENTRIES]; /* temp save for AOE host_ip table */
int i;
@@ -4082,13 +4141,13 @@ aoe_update_host_ipv4_table(dhd_pub_t *dh
bzero(ipv4_buf, sizeof(ipv4_buf));
/* display what we've got */
- ret = dhd_arp_get_arp_hostip_table(dhd_pub, ipv4_buf, sizeof(ipv4_buf));
+ ret = dhd_arp_get_arp_hostip_table(dhd_pub, ipv4_buf, sizeof(ipv4_buf), idx);
DHD_ARPOE(("%s: hostip table read from Dongle:\n", __FUNCTION__));
#ifdef AOE_DBG
dhd_print_buf(ipv4_buf, 32, 4); /* max 8 IPs 4b each */
#endif
/* now we saved hoste_ip table, clr it in the dongle AOE */
- dhd_aoe_hostip_clr(dhd_pub);
+ dhd_aoe_hostip_clr(dhd_pub, idx);
if (ret) {
DHD_ERROR(("%s failed\n", __FUNCTION__));
@@ -4109,19 +4168,24 @@ aoe_update_host_ipv4_table(dhd_pub_t *dh
if (ipv4_buf[i] != 0) {
/* add back host_ip entries from our local cache */
- dhd_arp_offload_add_ip(dhd_pub, ipv4_buf[i]);
+ dhd_arp_offload_add_ip(dhd_pub, ipv4_buf[i], idx);
DHD_ARPOE(("%s: added IP:%x to dongle arp_hostip[%d]\n\n",
__FUNCTION__, ipv4_buf[i], i));
}
}
#ifdef AOE_DBG
/* see the resulting hostip table */
- dhd_arp_get_arp_hostip_table(dhd_pub, ipv4_buf, sizeof(ipv4_buf));
+ dhd_arp_get_arp_hostip_table(dhd_pub, ipv4_buf, sizeof(ipv4_buf), idx);
DHD_ARPOE(("%s: read back arp_hostip table:\n", __FUNCTION__));
dhd_print_buf(ipv4_buf, 32, 4); /* max 8 IPs 4b each */
#endif
}
+/*
+ * Notification mechanism from kernel to our driver. This function is called by the Linux kernel
+ * whenever there is an event related to an IP address.
+ * ptr : kernel provided pointer to IP address that has changed
+ */
static int dhd_device_event(struct notifier_block *this,
unsigned long event,
void *ptr)
@@ -4130,19 +4194,48 @@ static int dhd_device_event(struct notif
dhd_info_t *dhd;
dhd_pub_t *dhd_pub;
+ int idx;
+
+ if (!dhd_arp_enable)
+ return NOTIFY_DONE;
+ if (!ifa || !(ifa->ifa_dev->dev))
+ return NOTIFY_DONE;
- if (!ifa)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31))
+ /* Filter notifications meant for non Broadcom devices */
+ if ((ifa->ifa_dev->dev->netdev_ops != &dhd_ops_pri) &&
+ (ifa->ifa_dev->dev->netdev_ops != &dhd_ops_virt)) {
+#ifdef WLP2P
+ if (!wl_cfgp2p_is_ifops(ifa->ifa_dev->dev->netdev_ops))
+#endif
return NOTIFY_DONE;
+ }
+#endif /* LINUX_VERSION_CODE */
dhd = *(dhd_info_t **)netdev_priv(ifa->ifa_dev->dev);
+ if (!dhd)
+ return NOTIFY_DONE;
+
dhd_pub = &dhd->pub;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31))
- if (ifa->ifa_dev->dev->netdev_ops == &dhd_ops_pri) {
-#else
- if (ifa->ifa_dev->dev) {
-#endif
- switch (event) {
+ if (dhd_pub->arp_version == 1) {
+ idx = 0;
+ }
+ else {
+ for (idx = 0; idx < DHD_MAX_IFS; idx++) {
+ if (dhd->iflist[idx] && dhd->iflist[idx]->net == ifa->ifa_dev->dev)
+ break;
+ }
+ if (idx < DHD_MAX_IFS)
+ DHD_TRACE(("ifidx : %p %s %d\n", dhd->iflist[idx]->net,
+ dhd->iflist[idx]->name, dhd->iflist[idx]->idx));
+ else {
+ DHD_ERROR(("Cannot find ifidx for(%s) set to 0\n", ifa->ifa_label));
+ idx = 0;
+ }
+ }
+
+ switch (event) {
case NETDEV_UP:
DHD_ARPOE(("%s: [%s] Up IP: 0x%x\n",
__FUNCTION__, ifa->ifa_label, ifa->ifa_address));
@@ -4158,16 +4251,9 @@ static int dhd_device_event(struct notif
}
#ifdef AOE_IP_ALIAS_SUPPORT
- if ((dhd_pub->op_mode & HOSTAPD_MASK) != HOSTAPD_MASK) {
- if (ifa->ifa_label[strlen(ifa->ifa_label)-2] == 0x3a) {
- /* 0x3a = ':' */
- DHD_ARPOE(("%s:add aliased IP to AOE hostip cache\n",
- __FUNCTION__));
- aoe_update_host_ipv4_table(dhd_pub, ifa->ifa_address, TRUE);
- }
- else
- aoe_update_host_ipv4_table(dhd_pub, ifa->ifa_address, TRUE);
- }
+ DHD_ARPOE(("%s:add aliased IP to AOE hostip cache\n",
+ __FUNCTION__));
+ aoe_update_host_ipv4_table(dhd_pub, ifa->ifa_address, TRUE, idx);
#endif
break;
@@ -4176,27 +4262,19 @@ static int dhd_device_event(struct notif
__FUNCTION__, ifa->ifa_label, ifa->ifa_address));
dhd->pend_ipaddr = 0;
#ifdef AOE_IP_ALIAS_SUPPORT
- if ((dhd_pub->op_mode & HOSTAPD_MASK) != HOSTAPD_MASK) {
- if (!(ifa->ifa_label[strlen(ifa->ifa_label)-2] == 0x3a)) {
- /* 0x3a = ':' */
- DHD_ARPOE(("%s: primary interface is down, AOE clr all\n",
- __FUNCTION__));
- dhd_aoe_hostip_clr(&dhd->pub);
- dhd_aoe_arp_clr(&dhd->pub);
- } else
- aoe_update_host_ipv4_table(dhd_pub, ifa->ifa_address, FALSE);
- }
+ DHD_ARPOE(("%s:interface is down, AOE clr all for this if\n",
+ __FUNCTION__));
+ aoe_update_host_ipv4_table(dhd_pub, ifa->ifa_address, FALSE, idx);
#else
- dhd_aoe_hostip_clr(&dhd->pub);
- dhd_aoe_arp_clr(&dhd->pub);
-#endif
+ dhd_aoe_hostip_clr(&dhd->pub, idx);
+ dhd_aoe_arp_clr(&dhd->pub, idx);
+#endif /* AOE_IP_ALIAS_SUPPORT */
break;
default:
DHD_ARPOE(("%s: do noting for [%s] Event: %lu\n",
__func__, ifa->ifa_label, event));
break;
- }
}
return NOTIFY_DONE;
}
@@ -4210,7 +4288,7 @@ dhd_net_attach(dhd_pub_t *dhdp, int ifid
int err = 0;
uint8 temp_addr[ETHER_ADDR_LEN] = { 0x00, 0x90, 0x4c, 0x11, 0x22, 0x33 };
- DHD_ERROR(("%s: ifidx %d\n", __FUNCTION__, ifidx));
+ DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx));
ASSERT(dhd && dhd->iflist[ifidx]);
@@ -4287,9 +4365,9 @@ dhd_net_attach(dhd_pub_t *dhdp, int ifid
" MAC: "MACDBG"\n",
net->name,
#if defined(CUSTOMER_HW4)
- STR_TO_MACD(dhd->pub.mac.octet));
+ MAC2STRDBG(dhd->pub.mac.octet));
#else
- STR_TO_MACD(net->dev_addr));
+ MAC2STRDBG(net->dev_addr));
#endif /* CUSTOMER_HW4 */
#if defined(SOFTAP) && defined(CONFIG_WIRELESS_EXT) && !defined(WL_CFG80211)
@@ -4479,9 +4557,6 @@ void dhd_detach(dhd_pub_t *dhdp)
wake_lock_destroy(&dhd->wl_wifi);
wake_lock_destroy(&dhd->wl_rxwake);
wake_lock_destroy(&dhd->wl_ctrlwake);
-#if defined(CUSTOMER_HW4) && defined(PNO_SUPPORT)
- wake_lock_destroy(&dhdp->pno_wakelock);
-#endif
#endif /* CONFIG_HAS_WAKELOCK */
}
}
@@ -5081,9 +5156,9 @@ void dhd_wait_for_event(dhd_pub_t *dhd,
struct dhd_info *dhdinfo = dhd->info;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27))
- int timeout = msecs_to_jiffies(2000);
+ int timeout = msecs_to_jiffies(IOCTL_RESP_TIMEOUT);
#else
- int timeout = 2 * HZ;
+ int timeout = (IOCTL_RESP_TIMEOUT / 1000) * HZ;
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
dhd_os_sdunlock(dhd);
@@ -5149,16 +5224,19 @@ int net_os_set_suspend(struct net_device
#else
ret = dhd_suspend_resume_helper(dhd, val, force);
#endif
+#ifdef WL_CFG80211
+ wl_cfg80211_update_power_mode(dev);
+#endif
}
return ret;
}
-int net_os_set_dtim_skip(struct net_device *dev, int val)
+int net_os_set_suspend_bcn_li_dtim(struct net_device *dev, int val)
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
if (dhd)
- dhd->pub.dtim_skip = val;
+ dhd->pub.suspend_bcn_li_dtim = val;
return 0;
}
@@ -5203,9 +5281,9 @@ int net_os_rxfilter_add_remove(struct ne
#endif /* GAN_LITE_NAT_KEEPALIVE_FILTER */
}
-int net_os_enable_packet_filter(struct net_device *dev, int val)
+int dhd_os_enable_packet_filter(dhd_pub_t *dhdp, int val)
+
{
- dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
int ret = 0;
/* Packet filtering is set only if we still in early-suspend and
@@ -5213,15 +5291,22 @@ int net_os_enable_packet_filter(struct n
* We can always turn it OFF in case of early-suspend, but we turn it
* back ON only if suspend_disable_flag was not set
*/
- if (dhd && dhd->pub.up) {
- if (dhd->pub.in_suspend) {
- if (!val || (val && !dhd->pub.suspend_disable_flag)) {
- dhd_enable_packet_filter(val, &dhd->pub);
- }
+ if (dhdp && dhdp->up) {
+ if (dhdp->in_suspend) {
+ if (!val || (val && !dhdp->suspend_disable_flag))
+ dhd_enable_packet_filter(val, dhdp);
}
}
return ret;
}
+
+/* function to enable/disable packet for Network device */
+int net_os_enable_packet_filter(struct net_device *dev, int val)
+{
+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
+
+ return dhd_os_enable_packet_filter(&dhd->pub, val);
+}
#endif /* PKT_FILTER_SUPPORT */
int
@@ -5515,22 +5600,6 @@ int net_os_wake_lock_timeout(struct net_
return ret;
}
-#if defined(CUSTOMER_HW4) && defined(PNO_SUPPORT) && defined(CONFIG_HAS_WAKELOCK)
-int net_os_wake_lock_timeout_for_pno(struct net_device *dev, int sec)
-{
- dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
- int ret = 0;
- unsigned long flags;
-
- if (dhd) {
- spin_lock_irqsave(&dhd->wakelock_spinlock, flags);
- wake_lock_timeout(&dhd->pub.pno_wakelock, HZ * sec);
- spin_unlock_irqrestore(&dhd->wakelock_spinlock, flags);
- }
- return ret;
-}
-#endif
-
int dhd_os_wake_lock_rx_timeout_enable(dhd_pub_t *pub, int val)
{
dhd_info_t *dhd = (dhd_info_t *)(pub->info);