Lines Matching +full:refclk +full:- +full:dig
2 * Broadcom Dongle Host Driver (DHD), Linux-specific network interface.
3 * Basically selected code segments from usb-cdc.c and usb-rndis.c
22 * <<Broadcom-WL-IPTag/Open:>>
139 #include <linux/exynos-pci-ctrl.h>
387 #define DBUS_RX_BUFFER_SIZE_DHD(net) (net->mtu + net->hard_header_len + dhd->pub.hdrlen)
389 #define DBUS_RX_BUFFER_SIZE_DHD(net) (net->mtu + net->hard_header_len + dhd->pub.hdrlen + 128)
660 /* ARP offload agent mode : Enable ARP Host Auto-Reply and ARP Peer Auto-Reply */
832 * there is a constant delay of 45us between CLKREQ# and stable REFCLK
834 * there is a chance of the refclk sense to trigger on noise.
1041 /* Use in dongle supplicant for 4-way handshake */
1147 dhd_pub_t *dhd = &dhdinfo->pub; in dhd_pm_callback()
1148 struct dhd_conf *conf = dhd->conf; in dhd_pm_callback()
1149 int suspend_mode = conf->suspend_mode; in dhd_pm_callback()
1166 if(!dhd->early_suspended && suspend_mode != PM_NOTIFIER) { in dhd_pm_callback()
1168 conf->suspend_mode = PM_NOTIFIER; in dhd_pm_callback()
1169 conf->insuspend |= (NO_TXDATA_IN_SUSPEND | NO_TXCTL_IN_SUSPEND); in dhd_pm_callback()
1186 if (dhd->busstate == DHD_BUS_DATA) { in dhd_pm_callback()
1240 #define DHD_DEV_INFO(dev) (((dhd_dev_priv_t *)DEV_PRIV(dev))->dhd)
1241 #define DHD_DEV_IFP(dev) (((dhd_dev_priv_t *)DEV_PRIV(dev))->ifp)
1242 #define DHD_DEV_IFIDX(dev) (((dhd_dev_priv_t *)DEV_PRIV(dev))->ifidx)
1243 #define DHD_DEV_LKUP(dev) (((dhd_dev_priv_t *)DEV_PRIV(dev))->lkup)
1252 dev_priv->dhd = (dhd_info_t *)NULL; in dhd_dev_priv_clear()
1253 dev_priv->ifp = (dhd_if_t *)NULL; in dhd_dev_priv_clear()
1254 dev_priv->ifidx = DHD_BAD_IF; in dhd_dev_priv_clear()
1255 dev_priv->lkup = (void *)NULL; in dhd_dev_priv_clear()
1266 dev_priv->dhd = dhd; in dhd_dev_priv_save()
1267 dev_priv->ifp = ifp; in dhd_dev_priv_save()
1268 dev_priv->ifidx = ifidx; in dhd_dev_priv_save()
1276 if (!dhdp || !dhdp->info || ifidx >= DHD_MAX_IFS) in dhd_get_ifp()
1279 return dhdp->info->iflist[ifidx]; in dhd_get_ifp()
1294 memcpy(ifp->_1905_al_mcast, ea, ETHER_ADDR_LEN); in dhd_set_1905_almac()
1296 memcpy(ifp->_1905_al_ucast, ea, ETHER_ADDR_LEN); in dhd_set_1905_almac()
1311 memcpy(ea, ifp->_1905_al_mcast, ETHER_ADDR_LEN); in dhd_get_1905_almac()
1313 memcpy(ea, ifp->_1905_al_ucast, ETHER_ADDR_LEN); in dhd_get_1905_almac()
1377 /* Clear the pool of dhd_sta_t objects for built-in type driver */
1386 ASSERT((sta != DHD_STA_NULL) && (sta->idx != ID16_INVALID)); in dhd_sta_free()
1388 ASSERT((dhdp->staid_allocator != NULL) && (dhdp->sta_pool != NULL)); in dhd_sta_free()
1395 uint16 flowid = sta->flowid[prio]; in dhd_sta_free()
1410 flow_queue_t *queue = &flow_ring_node->queue; in dhd_sta_free()
1412 DHD_FLOWRING_LOCK(flow_ring_node->lock, flags); in dhd_sta_free()
1413 flow_ring_node->status = FLOW_RING_STATUS_STA_FREEING; in dhd_sta_free()
1419 PKTFREE(dhdp->osh, pkt, TRUE); in dhd_sta_free()
1423 DHD_FLOWRING_UNLOCK(flow_ring_node->lock, flags); in dhd_sta_free()
1428 sta->flowid[prio] = FLOWID_INVALID; in dhd_sta_free()
1431 id16_map_free(dhdp->staid_allocator, sta->idx); in dhd_sta_free()
1432 DHD_CUMM_CTR_INIT(&sta->cumm_ctr); in dhd_sta_free()
1433 sta->ifp = DHD_IF_NULL; /* dummy dhd_if object */ in dhd_sta_free()
1434 sta->ifidx = DHD_BAD_IF; in dhd_sta_free()
1435 bzero(sta->ea.octet, ETHER_ADDR_LEN); in dhd_sta_free()
1436 INIT_LIST_HEAD(&sta->list); in dhd_sta_free()
1437 sta->idx = ID16_INVALID; /* implying free */ in dhd_sta_free()
1448 ASSERT((dhdp->staid_allocator != NULL) && (dhdp->sta_pool != NULL)); in dhd_sta_alloc()
1450 idx = id16_map_alloc(dhdp->staid_allocator); in dhd_sta_alloc()
1456 sta_pool = (dhd_sta_pool_t *)(dhdp->sta_pool); in dhd_sta_alloc()
1459 ASSERT((sta->idx == ID16_INVALID) && in dhd_sta_alloc()
1460 (sta->ifp == DHD_IF_NULL) && (sta->ifidx == DHD_BAD_IF)); in dhd_sta_alloc()
1462 DHD_CUMM_CTR_INIT(&sta->cumm_ctr); in dhd_sta_alloc()
1464 sta->idx = idx; /* implying allocated */ in dhd_sta_alloc()
1476 DHD_IF_STA_LIST_LOCK(&ifp->sta_list_lock, flags); in dhd_if_del_sta_list()
1478 list_for_each_entry_safe(sta, next, &ifp->sta_list, list) { in dhd_if_del_sta_list()
1480 list_del(&sta->list); in dhd_if_del_sta_list()
1481 dhd_sta_free(&ifp->info->pub, sta); in dhd_if_del_sta_list()
1484 DHD_IF_STA_LIST_UNLOCK(&ifp->sta_list_lock, flags); in dhd_if_del_sta_list()
1499 ASSERT((dhdp->staid_allocator == NULL) && (dhdp->sta_pool == NULL)); in dhd_sta_pool_init()
1502 staid_allocator = id16_map_init(dhdp->osh, max_sta, 1); in dhd_sta_pool_init()
1510 sta_pool = (dhd_sta_pool_t *)MALLOC(dhdp->osh, sta_pool_memsz); in dhd_sta_pool_init()
1513 id16_map_fini(dhdp->osh, staid_allocator); in dhd_sta_pool_init()
1517 dhdp->sta_pool = sta_pool; in dhd_sta_pool_init()
1518 dhdp->staid_allocator = staid_allocator; in dhd_sta_pool_init()
1520 /* Initialize all sta(s) for the pre-allocated free pool. */ in dhd_sta_pool_init()
1522 for (idx = max_sta; idx >= 1; idx--) { /* skip sta_pool[0] */ in dhd_sta_pool_init()
1524 sta->idx = id16_map_alloc(staid_allocator); in dhd_sta_pool_init()
1525 ASSERT(sta->idx <= max_sta); in dhd_sta_pool_init()
1528 /* Now place them into the pre-allocated free pool. */ in dhd_sta_pool_init()
1532 sta->flowid[prio] = FLOWID_INVALID; /* Flow rings do not exist */ in dhd_sta_pool_init()
1546 dhd_sta_pool_t * sta_pool = (dhd_sta_pool_t *)dhdp->sta_pool; in dhd_sta_pool_fini()
1555 MFREE(dhdp->osh, dhdp->sta_pool, sta_pool_memsz); in dhd_sta_pool_fini()
1558 id16_map_fini(dhdp->osh, dhdp->staid_allocator); in dhd_sta_pool_fini()
1559 dhdp->staid_allocator = NULL; in dhd_sta_pool_fini()
1562 /* Clear the pool of dhd_sta_t objects for built-in type driver */
1576 sta_pool = (dhd_sta_pool_t *)dhdp->sta_pool; in dhd_sta_pool_clear()
1577 staid_allocator = dhdp->staid_allocator; in dhd_sta_pool_clear()
1596 /* Initialize all sta(s) for the pre-allocated free pool. */ in dhd_sta_pool_clear()
1597 for (idx = max_sta; idx >= 1; idx--) { /* skip sta_pool[0] */ in dhd_sta_pool_clear()
1599 sta->idx = id16_map_alloc(staid_allocator); in dhd_sta_pool_clear()
1600 ASSERT(sta->idx <= max_sta); in dhd_sta_pool_clear()
1602 /* Now place them into the pre-allocated free pool. */ in dhd_sta_pool_clear()
1606 sta->flowid[prio] = FLOWID_INVALID; /* Flow rings do not exist */ in dhd_sta_pool_clear()
1625 DHD_IF_STA_LIST_LOCK(&ifp->sta_list_lock, flags); in dhd_find_sta()
1627 list_for_each_entry(sta, &ifp->sta_list, list) { in dhd_find_sta()
1629 if (!memcmp(sta->ea.octet, ea, ETHER_ADDR_LEN)) { in dhd_find_sta()
1632 DHD_IF_STA_LIST_UNLOCK(&ifp->sta_list_lock, flags); in dhd_find_sta()
1637 DHD_IF_STA_LIST_UNLOCK(&ifp->sta_list_lock, flags); in dhd_find_sta()
1655 if (!memcmp(ifp->net->dev_addr, ea, ETHER_ADDR_LEN)) { in dhd_add_sta()
1666 memcpy(sta->ea.octet, ea, ETHER_ADDR_LEN); in dhd_add_sta()
1669 sta->ifp = ifp; in dhd_add_sta()
1670 sta->ifidx = ifidx; in dhd_add_sta()
1672 sta->psta_prim = NULL; in dhd_add_sta()
1674 INIT_LIST_HEAD(&sta->list); in dhd_add_sta()
1676 DHD_IF_STA_LIST_LOCK(&ifp->sta_list_lock, flags); in dhd_add_sta()
1678 list_add_tail(&sta->list, &ifp->sta_list); in dhd_add_sta()
1683 DHD_IF_STA_LIST_UNLOCK(&ifp->sta_list_lock, flags); in dhd_add_sta()
1700 DHD_IF_STA_LIST_LOCK(&ifp->sta_list_lock, flags); in dhd_del_all_sta()
1702 list_for_each_entry_safe(sta, next, &ifp->sta_list, list) { in dhd_del_all_sta()
1704 list_del(&sta->list); in dhd_del_all_sta()
1705 dhd_sta_free(&ifp->info->pub, sta); in dhd_del_all_sta()
1707 if (ifp->parp_enable) { in dhd_del_all_sta()
1709 bcm_l2_filter_arp_table_update(((dhd_pub_t*)pub)->osh, in dhd_del_all_sta()
1710 ifp->phnd_arp_table, FALSE, in dhd_del_all_sta()
1711 sta->ea.octet, FALSE, ((dhd_pub_t*)pub)->tickcnt); in dhd_del_all_sta()
1716 DHD_IF_STA_LIST_UNLOCK(&ifp->sta_list_lock, flags); in dhd_del_all_sta()
1734 DHD_IF_STA_LIST_LOCK(&ifp->sta_list_lock, flags); in dhd_del_sta()
1736 list_for_each_entry_safe(sta, next, &ifp->sta_list, list) { in dhd_del_sta()
1738 if (!memcmp(sta->ea.octet, ea, ETHER_ADDR_LEN)) { in dhd_del_sta()
1740 __FUNCTION__, MAC2STRDBG(sta->ea.octet))); in dhd_del_sta()
1741 list_del(&sta->list); in dhd_del_sta()
1742 dhd_sta_free(&ifp->info->pub, sta); in dhd_del_sta()
1746 DHD_IF_STA_LIST_UNLOCK(&ifp->sta_list_lock, flags); in dhd_del_sta()
1748 if (ifp->parp_enable) { in dhd_del_sta()
1750 bcm_l2_filter_arp_table_update(((dhd_pub_t*)pub)->osh, ifp->phnd_arp_table, FALSE, in dhd_del_sta()
1751 ea, FALSE, ((dhd_pub_t*)pub)->tickcnt); in dhd_del_sta()
1782 DHD_IF_STA_LIST_LOCK(&ifp->sta_list_lock, flags); in dhd_sta_list_snapshot()
1784 list_for_each_entry(sta, &ifp->sta_list, list) { in dhd_sta_list_snapshot()
1786 snapshot = (dhd_sta_t *)MALLOC(dhd->pub.osh, sizeof(dhd_sta_t)); in dhd_sta_list_snapshot()
1792 memcpy(snapshot->ea.octet, sta->ea.octet, ETHER_ADDR_LEN); in dhd_sta_list_snapshot()
1794 INIT_LIST_HEAD(&snapshot->list); in dhd_sta_list_snapshot()
1795 list_add_tail(&snapshot->list, snapshot_list); in dhd_sta_list_snapshot()
1798 DHD_IF_STA_LIST_UNLOCK(&ifp->sta_list_lock, flags); in dhd_sta_list_snapshot()
1809 list_del(&sta->list); in dhd_sta_list_snapshot_free()
1810 MFREE(dhd->pub.osh, sta, sizeof(dhd_sta_t)); in dhd_sta_list_snapshot_free()
1851 dhd_queue_budget, queue->max, DHD_FLOW_QUEUE_CLEN_PTR(queue), in dhd_add_flowid()
1852 dhd_if_threshold, (void *)&ifp->cumm_ctr); in dhd_add_flowid()
1860 /* Use default dhdp->cumm_ctr and dhdp->l2cumm_ctr, in dhd_add_flowid()
1865 queue->max, queue->max, DHD_FLOW_QUEUE_CLEN_PTR(queue), in dhd_add_flowid()
1868 else if (DHD_FLOW_QUEUE_L2CLEN_PTR(queue) != (void *)&ifp->cumm_ctr) { in dhd_add_flowid()
1870 queue->max, queue->max, DHD_FLOW_QUEUE_CLEN_PTR(queue), in dhd_add_flowid()
1871 dhd_if_threshold, (void *)&ifp->cumm_ctr); in dhd_add_flowid()
1879 dhd_sta_threshold, (void *)&sta->cumm_ctr, in dhd_add_flowid()
1880 dhd_if_threshold, (void *)&ifp->cumm_ctr); in dhd_add_flowid()
1886 if (dhdp->flow_prio_map[prio] == ac_prio) { in dhd_add_flowid()
1888 sta->flowid[prio] = flowid; in dhd_add_flowid()
1908 DHD_IF_STA_LIST_LOCK(&ifp->sta_list_lock, flags); in dhd_del_flowid()
1910 list_for_each_entry(sta, &ifp->sta_list, list) { in dhd_del_flowid()
1912 if (sta->flowid[prio] == flowid) { in dhd_del_flowid()
1913 sta->flowid[prio] = FLOWID_INVALID; in dhd_del_flowid()
1918 DHD_IF_STA_LIST_UNLOCK(&ifp->sta_list_lock, flags); in dhd_del_flowid()
1926 dhd_info_t *dhd = dhdp->info; in dhd_axi_error_dispatch()
1927 schedule_work(&dhd->axi_error_dispatcher_work); in dhd_axi_error_dispatch()
1934 dhd_axi_error(&dhd->pub); in dhd_axi_error_dispatcher_fn()
1942 dhd_info_t *dhd = dhdp->info; in dhd_bssidx2idx()
1949 ifp = dhd->iflist[i]; in dhd_bssidx2idx()
1950 if (ifp && (ifp->bssidx == bssidx)) { in dhd_bssidx2idx()
1952 ifp->name, bssidx, i)); in dhd_bssidx2idx()
1970 store_idx = dhdp->store_idx; in dhd_rxf_enqueue()
1971 sent_idx = dhdp->sent_idx; in dhd_rxf_enqueue()
1972 if (dhdp->skbbuf[store_idx] != NULL) { in dhd_rxf_enqueue()
1991 DHD_TRACE(("dhd_rxf_enqueue: Store SKB %p. idx %d -> %d\n", in dhd_rxf_enqueue()
1992 skb, store_idx, (store_idx + 1) & (MAXSKBPEND - 1))); in dhd_rxf_enqueue()
1993 dhdp->skbbuf[store_idx] = skb; in dhd_rxf_enqueue()
1994 dhdp->store_idx = (store_idx + 1) & (MAXSKBPEND - 1); in dhd_rxf_enqueue()
2008 store_idx = dhdp->store_idx; in dhd_rxf_dequeue()
2009 sent_idx = dhdp->sent_idx; in dhd_rxf_dequeue()
2010 skb = dhdp->skbbuf[sent_idx]; in dhd_rxf_dequeue()
2019 dhdp->skbbuf[sent_idx] = NULL; in dhd_rxf_dequeue()
2020 dhdp->sent_idx = (sent_idx + 1) & (MAXSKBPEND - 1); in dhd_rxf_dequeue()
2055 dhd_write_macaddr(&dhdp->mac); in dhd_process_cid_mac()
2093 for (i = 0; i < dhd->pktfilter_count; i++) { in dhd_set_packet_filter()
2094 dhd_pktfilter_offload_set(dhd, dhd->pktfilter[i]); in dhd_set_packet_filter()
2105 if ((dhd->op_mode & DHD_FLAG_HOSTAP_MODE) && value && in dhd_enable_packet_filter()
2110 /* 1 - Enable packet filter, only allow unicast packet to send up */ in dhd_enable_packet_filter()
2111 /* 0 - Disable packet filter */ in dhd_enable_packet_filter()
2113 (dhd_support_sta_mode(dhd) && !dhd->dhcp_in_progress) || in dhd_enable_packet_filter()
2116 for (i = 0; i < dhd->pktfilter_count; i++) { in dhd_enable_packet_filter()
2120 !_turn_on_arp_filter(dhd, dhd->op_mode)) { in dhd_enable_packet_filter()
2123 value, i, dhd->op_mode)); in dhd_enable_packet_filter()
2129 dhd->pktfilter[DHD_BROADCAST_ARP_FILTER_NUM]) { in dhd_enable_packet_filter()
2140 dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i], in dhd_enable_packet_filter()
2160 if (dhdp->pktfilter[num] != NULL) { in dhd_packet_filter_add_remove()
2162 dhdp->pktfilter[num] = NULL; in dhd_packet_filter_add_remove()
2175 if (dhdp->pktfilter[num] != NULL) { in dhd_packet_filter_add_remove()
2177 dhdp->pktfilter[num] = NULL; in dhd_packet_filter_add_remove()
2201 return -EINVAL; in dhd_packet_filter_add_remove()
2206 dhdp->pktfilter[num] = filterp; in dhd_packet_filter_add_remove()
2207 dhd_pktfilter_offload_set(dhdp, dhdp->pktfilter[num]); in dhd_packet_filter_add_remove()
2209 if (dhdp->pktfilter[num] != NULL) { in dhd_packet_filter_add_remove()
2211 dhdp->pktfilter[num] = NULL; in dhd_packet_filter_add_remove()
2269 return -ENODEV; in dhd_set_suspend()
2272 dhdinfo = dhd->info; in dhd_set_suspend()
2276 __FUNCTION__, value, dhd->in_suspend)); in dhd_set_suspend()
2285 if (dhd->up) { in dhd_set_suspend()
2286 if (value && dhd->in_suspend) { in dhd_set_suspend()
2287 dhd->early_suspended = 1; in dhd_set_suspend()
2306 if (dhd->arpoe_enable) { in dhd_set_suspend()
2314 if (dhdinfo->iflist[i] && dhdinfo->iflist[i]->net) { in dhd_set_suspend()
2333 if (dhd->tdls_mode) { in dhd_set_suspend()
2368 * MIN(max_roam_threshold, bcn_timeout -1); in dhd_set_suspend()
2438 if (dhd->ndo_enable) { in dhd_set_suspend()
2439 if (!dhd->ndo_host_ip_overflow) { in dhd_set_suspend()
2496 if (!dhd->sroamed) { in dhd_set_suspend()
2503 dhd->sroamed = FALSE; in dhd_set_suspend()
2507 dhd->early_suspended = 0; in dhd_set_suspend()
2531 if (dhd->arpoe_enable) { in dhd_set_suspend()
2545 if (dhdinfo->iflist[i] && dhdinfo->iflist[i]->net) in dhd_set_suspend()
2557 /* restore pre-suspend setting */ in dhd_set_suspend()
2586 /* restore pre-suspend setting for dtim_skip */ in dhd_set_suspend()
2631 if (dhd->ndo_enable) { in dhd_set_suspend()
2691 dhd_pub_t *dhdp = &dhd->pub; in dhd_suspend_resume_helper()
2697 dhdp->in_suspend = val; in dhd_suspend_resume_helper()
2698 if ((force || !dhdp->suspend_disable_flag) && in dhd_suspend_resume_helper()
2714 if (dhd && (dhd->pub.conf->suspend_mode == EARLY_SUSPEND || in dhd_early_suspend()
2715 dhd->pub.conf->suspend_mode == SUSPEND_MODE_2)) { in dhd_early_suspend()
2717 if (dhd->pub.conf->suspend_mode == EARLY_SUSPEND) in dhd_early_suspend()
2718 dhd_conf_set_suspend_resume(&dhd->pub, 1); in dhd_early_suspend()
2727 if (dhd && (dhd->pub.conf->suspend_mode == EARLY_SUSPEND || in dhd_late_resume()
2728 dhd->pub.conf->suspend_mode == SUSPEND_MODE_2)) { in dhd_late_resume()
2729 dhd_conf_set_suspend_resume(&dhd->pub, 0); in dhd_late_resume()
2730 if (dhd->pub.conf->suspend_mode == EARLY_SUSPEND) in dhd_late_resume()
2737 * Generalized timeout mechanism. Uses spin sleep with exponential back-off until
2752 tmo->limit = usec * htclkratio; in dhd_timeout_start()
2754 tmo->limit = usec; in dhd_timeout_start()
2756 tmo->increment = 0; in dhd_timeout_start()
2757 tmo->elapsed = 0; in dhd_timeout_start()
2758 tmo->tick = 10 * USEC_PER_MSEC; /* 10 msec */ in dhd_timeout_start()
2765 if (tmo->increment == 0) { in dhd_timeout_expired()
2766 tmo->increment = USEC_PER_MSEC; /* Start with 1 msec */ in dhd_timeout_expired()
2770 if (tmo->elapsed >= tmo->limit) in dhd_timeout_expired()
2773 DHD_INFO(("%s: CAN_SLEEP():%d tmo->increment=%ld msec\n", in dhd_timeout_expired()
2774 __FUNCTION__, CAN_SLEEP(), tmo->increment / USEC_PER_MSEC)); in dhd_timeout_expired()
2776 CAN_SLEEP() ? OSL_SLEEP(tmo->increment / USEC_PER_MSEC) : OSL_DELAY(tmo->increment); in dhd_timeout_expired()
2778 /* Till tmo->tick, the delay will be in 2x, after that delay will be constant in dhd_timeout_expired()
2779 * tmo->tick (10 msec), till timer elapses. in dhd_timeout_expired()
2781 tmo->increment = (tmo->increment >= tmo->tick) ? tmo->tick : (tmo->increment * 2); in dhd_timeout_expired()
2785 tmo->elapsed += tmo->increment * htclkratio; in dhd_timeout_expired()
2787 tmo->elapsed += tmo->increment; in dhd_timeout_expired()
2804 if (dhd->iflist[i] && dhd->iflist[i]->net && (dhd->iflist[i]->net == net)) in dhd_net2idx()
2819 dhd_info = dhd_pub->info; in dhd_idx2net()
2820 if (dhd_info && dhd_info->iflist[ifidx]) in dhd_idx2net()
2821 return dhd_info->iflist[ifidx]->net; in dhd_idx2net()
2835 while (--i > 0) in dhd_ifname2idx()
2836 if (dhd->iflist[i] && !strncmp(dhd->iflist[i]->dngl_name, name, IFNAMSIZ)) in dhd_ifname2idx()
2841 return i; /* default - the primary interface */ in dhd_ifname2idx()
2847 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_ifname()
2856 if (dhd->iflist[ifidx] == NULL) { in dhd_ifname()
2861 if (dhd->iflist[ifidx]->net) in dhd_ifname()
2862 return dhd->iflist[ifidx]->net->name; in dhd_ifname()
2875 if (dhd->iflist[i] && dhd->iflist[i]->bssidx == idx) in dhd_bssidx2bssid()
2876 return dhd->iflist[i]->mac_addr; in dhd_bssidx2bssid()
2904 if (dhd->iflist[i]) { in _dhd_set_multicast_list()
2905 dev = dhd->iflist[i]->net; in _dhd_set_multicast_list()
2914 allmulti |= (dev->flags & IFF_ALLMULTI) ? TRUE : FALSE; in _dhd_set_multicast_list()
2918 if (!dhd->iflist[ifidx]) { in _dhd_set_multicast_list()
2919 DHD_ERROR(("%s : dhd->iflist[%d] was NULL\n", __FUNCTION__, ifidx)); in _dhd_set_multicast_list()
2922 dev = dhd->iflist[ifidx]->net; in _dhd_set_multicast_list()
2929 cnt = dev->mc_count; in _dhd_set_multicast_list()
2935 allmulti = (dev->flags & IFF_ALLMULTI) ? TRUE : FALSE; in _dhd_set_multicast_list()
2940 if (!dhd->pub.early_suspended) in _dhd_set_multicast_list()
2952 if (!(bufp = buf = MALLOC(dhd->pub.osh, buflen))) { in _dhd_set_multicast_list()
2954 dhd_ifname(&dhd->pub, ifidx), cnt)); in _dhd_set_multicast_list()
2967 if (dhd->iflist[i]) { in _dhd_set_multicast_list()
2969 dev = dhd->iflist[i]->net; in _dhd_set_multicast_list()
2977 memcpy(bufp, ha->addr, ETHER_ADDR_LEN); in _dhd_set_multicast_list()
2981 cnt_iface[i], MAC2STRDBG(ha->addr))); in _dhd_set_multicast_list()
2982 cnt_iface[i]--; in _dhd_set_multicast_list()
2995 memcpy(bufp, ha->addr, ETHER_ADDR_LEN); in _dhd_set_multicast_list()
2997 cnt--; in _dhd_set_multicast_list()
3000 for (mclist = dev->mc_list; (mclist && (cnt > 0)); in _dhd_set_multicast_list()
3001 cnt--, mclist = mclist->next) { in _dhd_set_multicast_list()
3002 memcpy(bufp, (void *)mclist->dmi_addr, ETHER_ADDR_LEN); in _dhd_set_multicast_list()
3015 ret = dhd_wl_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); in _dhd_set_multicast_list()
3018 dhd_ifname(&dhd->pub, ifidx), cnt)); in _dhd_set_multicast_list()
3022 MFREE(dhd->pub.osh, buf, buflen); in _dhd_set_multicast_list()
3030 ret = dhd_iovar(&dhd->pub, ifidx, "allmulti", (char *)&allmulti, in _dhd_set_multicast_list()
3034 dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti))); in _dhd_set_multicast_list()
3042 if (dhd->iflist[i]) { in _dhd_set_multicast_list()
3043 dev = dhd->iflist[i]->net; in _dhd_set_multicast_list()
3044 allmulti |= (dev->flags & IFF_PROMISC) ? TRUE : FALSE; in _dhd_set_multicast_list()
3048 allmulti = (dev->flags & IFF_PROMISC) ? TRUE : FALSE; in _dhd_set_multicast_list()
3059 ret = dhd_wl_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); in _dhd_set_multicast_list()
3062 dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti))); in _dhd_set_multicast_list()
3073 WL_MSG(dhd_ifname(&dhd->pub, ifidx), "close dev for mac changing\n"); in _dhd_set_mac_address()
3074 dhd->pub.skip_dhd_stop = TRUE; in _dhd_set_mac_address()
3075 dev_close(dhd->iflist[ifidx]->net); in _dhd_set_mac_address()
3079 ret = dhd_iovar(&dhd->pub, ifidx, "cur_etheraddr", (char *)addr, in _dhd_set_mac_address()
3083 dhd_ifname(&dhd->pub, ifidx), addr, ret)); in _dhd_set_mac_address()
3086 dev_addr_set(dhd->iflist[ifidx]->net, addr); in _dhd_set_mac_address()
3088 memcpy(dhd->pub.mac.octet, addr, ETHER_ADDR_LEN); in _dhd_set_mac_address()
3089 WL_MSG(dhd_ifname(&dhd->pub, ifidx), "MACID %pM is overwritten\n", addr); in _dhd_set_mac_address()
3096 dev_open(dhd->iflist[ifidx]->net, NULL); in _dhd_set_mac_address()
3098 dev_open(dhd->iflist[ifidx]->net); in _dhd_set_mac_address()
3100 dhd->pub.skip_dhd_stop = FALSE; in _dhd_set_mac_address()
3101 WL_MSG(dhd_ifname(&dhd->pub, ifidx), "notify mac changed done\n"); in _dhd_set_mac_address()
3112 if (_dhd_set_mac_address(dhd->info, 0, mac_addr.octet, TRUE) != 0) { in dhd_update_rand_mac_addr()
3125 dhd_if_t *ifp = dhdp->info->iflist[ifidx]; in dhd_update_dpsta_interface_for_sta()
3127 if (dpsta_prim_event->intf_type == WL_INTF_DWDS) { in dhd_update_dpsta_interface_for_sta()
3128 ifp->primsta_dwds = TRUE; in dhd_update_dpsta_interface_for_sta()
3130 ifp->primsta_dwds = FALSE; in dhd_update_dpsta_interface_for_sta()
3148 ifindex = (uint8)dhd_ifname2idx(dhdp->info, ifname); in dhd_update_psta_interface_for_sta()
3152 (void *)(psta_prim_event->prim_ea.octet)); in dhd_update_psta_interface_for_sta()
3154 sta->psta_prim = psta_interface; in dhd_update_psta_interface_for_sta()
3162 dhd_info_t *dhd = dhdp->info; in dhd_get_wmf_psta_disable()
3165 ifp = dhd->iflist[idx]; in dhd_get_wmf_psta_disable()
3166 return ifp->wmf_psta_disable; in dhd_get_wmf_psta_disable()
3172 dhd_info_t *dhd = dhdp->info; in dhd_set_wmf_psta_disable()
3175 ifp = dhd->iflist[idx]; in dhd_set_wmf_psta_disable()
3176 ifp->wmf_psta_disable = val; in dhd_set_wmf_psta_disable()
3185 dhd_info_t *dhd = dhdp->info; in dhd_get_psta_mode()
3186 return (int)dhd->psta_mode; in dhd_get_psta_mode()
3191 dhd_info_t *dhd = dhdp->info; in dhd_set_psta_mode()
3192 dhd->psta_mode = val; in dhd_set_psta_mode()
3201 dhd_info_t *dhd = dhdp->info; in dhd_update_rx_pkt_chainable_state()
3206 ifp = dhd->iflist[idx]; in dhd_update_rx_pkt_chainable_state()
3210 (ifp->block_ping) || in dhd_update_rx_pkt_chainable_state()
3213 (dhd->wet_mode) || in dhd_update_rx_pkt_chainable_state()
3216 (ifp->mcast_regen_bss_enable) || in dhd_update_rx_pkt_chainable_state()
3219 ifp->rx_pkt_chainable = FALSE; in dhd_update_rx_pkt_chainable_state()
3228 dhd_info_t *dhd = dhdp->info; in dhd_get_wet_mode()
3229 return (int)dhd->wet_mode; in dhd_get_wet_mode()
3235 dhd_info_t *dhd = dhdp->info; in dhd_set_wet_mode()
3236 dhd->wet_mode = val; in dhd_set_wet_mode()
3301 DHD_OS_WAKE_LOCK(&dhd->pub); in dhd_ifadd_event_handler()
3303 ifidx = if_event->event.ifidx; in dhd_ifadd_event_handler()
3304 bssidx = if_event->event.bssidx; in dhd_ifadd_event_handler()
3308 if (if_event->event.opcode == WLC_E_IF_ADD && in dhd_ifadd_event_handler()
3309 if_event->event.role == WLC_E_IF_ROLE_AWDL) { in dhd_ifadd_event_handler()
3310 dhd->pub.awdl_ifidx = ifidx; in dhd_ifadd_event_handler()
3316 if (if_event->event.ifidx > 0) { in dhd_ifadd_event_handler()
3321 info.role = if_event->event.role; in dhd_ifadd_event_handler()
3322 strlcpy(info.name, if_event->name, sizeof(info.name)); in dhd_ifadd_event_handler()
3323 if (is_valid_ether_addr(if_event->mac)) { in dhd_ifadd_event_handler()
3324 mac_addr = if_event->mac; in dhd_ifadd_event_handler()
3330 if ((ndev = wl_cfg80211_post_ifcreate(dhd->pub.info->iflist[0]->net, in dhd_ifadd_event_handler()
3331 &info, mac_addr, if_event->name, true)) == NULL) in dhd_ifadd_event_handler()
3333 if (wl_cfg80211_post_ifcreate(dhd->pub.info->iflist[0]->net, in dhd_ifadd_event_handler()
3344 /* This path is for non-android case */ in dhd_ifadd_event_handler()
3347 ndev = dhd_allocate_if(&dhd->pub, ifidx, if_event->name, in dhd_ifadd_event_handler()
3348 if_event->mac, bssidx, TRUE, if_event->name); in dhd_ifadd_event_handler()
3355 ret = dhd_register_if(&dhd->pub, ifidx, TRUE); in dhd_ifadd_event_handler()
3358 dhd_remove_if(&dhd->pub, ifidx, TRUE); in dhd_ifadd_event_handler()
3366 if (FW_SUPPORTED((&dhd->pub), ap) && (if_event->event.role != WLC_E_IF_ROLE_STA)) { in dhd_ifadd_event_handler()
3368 ret = dhd_iovar(&dhd->pub, ifidx, "ap_isolate", (char *)&var_int, sizeof(var_int), in dhd_ifadd_event_handler()
3372 dhd_remove_if(&dhd->pub, ifidx, TRUE); in dhd_ifadd_event_handler()
3384 dhd->pub.awdl_ifidx = 0; in dhd_ifadd_event_handler()
3388 MFREE(dhd->pub.osh, if_event, sizeof(dhd_if_event_t)); in dhd_ifadd_event_handler()
3390 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ifadd_event_handler()
3417 DHD_OS_WAKE_LOCK(&dhd->pub); in dhd_ifdel_event_handler()
3419 ifidx = if_event->event.ifidx; in dhd_ifdel_event_handler()
3422 if (!dhd->pub.info->iflist[ifidx]) { in dhd_ifdel_event_handler()
3431 if (if_event->event.ifidx > 0) { in dhd_ifdel_event_handler()
3433 if (wl_cfg80211_post_ifdel(dhd->pub.info->iflist[ifidx]->net, in dhd_ifdel_event_handler()
3434 true, if_event->event.ifidx) != 0) { in dhd_ifdel_event_handler()
3440 /* For non-cfg80211 drivers */ in dhd_ifdel_event_handler()
3441 dhd_remove_if(&dhd->pub, ifidx, TRUE); in dhd_ifdel_event_handler()
3443 if (if_event->event.opcode == WLC_E_IF_DEL && in dhd_ifdel_event_handler()
3444 if_event->event.role == WLC_E_IF_ROLE_AWDL) { in dhd_ifdel_event_handler()
3445 dhd->pub.awdl_ifidx = 0; in dhd_ifdel_event_handler()
3452 MFREE(dhd->pub.osh, if_event, sizeof(dhd_if_event_t)); in dhd_ifdel_event_handler()
3453 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ifdel_event_handler()
3481 DHD_OS_WAKE_LOCK(&dhd->pub); in dhd_ifupdate_event_handler()
3483 ifidx = if_event->event.ifidx; in dhd_ifupdate_event_handler()
3486 dhd_op_if_update(&dhd->pub, ifidx); in dhd_ifupdate_event_handler()
3488 MFREE(dhd->pub.osh, if_event, sizeof(dhd_if_event_t)); in dhd_ifupdate_event_handler()
3490 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ifupdate_event_handler()
3501 if ((NULL==dhdpub)||(NULL==dhdpub->info)) { in dhd_op_if_update()
3503 return -1; in dhd_op_if_update()
3505 dhdinfo = (dhd_info_t *)dhdpub->info; in dhd_op_if_update()
3506 ifp = dhdinfo->iflist[ifidx]; in dhd_op_if_update()
3509 return -2; in dhd_op_if_update()
3516 ret = dhd_wl_ioctl_cmd(&dhdinfo->pub, WLC_GET_VAR, buf, sizeof(buf), FALSE, ifp->idx); in dhd_op_if_update()
3518 DHD_ERROR(("Failed to upudate the MAC address for itf=%s, ret=%d\n", ifp->name, ret)); in dhd_op_if_update()
3520 dhdinfo->iflist[ifp->idx]->mac_addr[5] += 1; in dhd_op_if_update()
3522 ETHER_SET_LOCALADDR(&dhdinfo->iflist[ifp->idx]->mac_addr); in dhd_op_if_update()
3525 ifp->name, ifp->idx, in dhd_op_if_update()
3528 memcpy(dhdinfo->iflist[ifp->idx]->mac_addr, buf, ETHER_ADDR_LEN); in dhd_op_if_update()
3529 if (dhdinfo->iflist[ifp->idx]->net) { in dhd_op_if_update()
3530 dev_addr_set(dhdinfo->iflist[ifp->idx]->net, buf); in dhd_op_if_update()
3554 DHD_OS_WAKE_LOCK(&dhd->pub); in dhd_set_mac_addr_handler()
3557 if (ifp == NULL || !ifp->set_macaddress) { in dhd_set_mac_addr_handler()
3560 if (ifp == NULL || !dhd->pub.up) { in dhd_set_mac_addr_handler()
3565 ifp->set_macaddress = FALSE; in dhd_set_mac_addr_handler()
3571 if (_dhd_set_mac_address(dhd, ifp->idx, ifp->mac_addr, TRUE) == 0) in dhd_set_mac_addr_handler()
3581 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_set_mac_addr_handler()
3603 DHD_OS_WAKE_LOCK(&dhd->pub); in dhd_set_mcast_list_handler()
3605 ifp = dhd->iflist[ifidx]; in dhd_set_mcast_list_handler()
3607 if (ifp == NULL || !dhd->pub.up) { in dhd_set_mcast_list_handler()
3612 if (ifp == NULL || !dhd->pub.up) { in dhd_set_mcast_list_handler()
3617 ifidx = ifp->idx; in dhd_set_mcast_list_handler()
3627 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_set_mcast_list_handler()
3643 dhd_pub_t *dhdp = &dhd->pub; in dhd_set_mac_address()
3651 return -ENODEV; in dhd_set_mac_address()
3653 ifidx = dhdif->idx; in dhd_set_mac_address()
3655 memcpy(dhdif->mac_addr, sa->sa_data, ETHER_ADDR_LEN); in dhd_set_mac_address()
3656 dhdif->set_macaddress = TRUE; in dhd_set_mac_address()
3659 WL_MSG(dev->name, "macaddr = %pM\n", dhdif->mac_addr); in dhd_set_mac_address()
3661 /* Check wdev->iftype for the role */ in dhd_set_mac_address()
3667 if (wl_cfg80211_static_if(cfg, dev) && !(dev->flags & IFF_UP)) { in dhd_set_mac_address()
3673 dev_addr_set(dev, dhdif->mac_addr); in dhd_set_mac_address()
3684 wl_cfg80211_handle_macaddr_change(dev, dhdif->mac_addr); in dhd_set_mac_address()
3685 return _dhd_set_mac_address(dhd, ifidx, dhdif->mac_addr, TRUE); in dhd_set_mac_address()
3689 dhd_deferred_schedule_work(dhd->dhd_deferred_wq, (void *)dhdif, DHD_WQ_WORK_SET_MAC, in dhd_set_mac_address()
3704 dhd->iflist[ifidx]->set_multicast = TRUE; in dhd_set_multicast_list()
3705 dhd_deferred_schedule_work(dhd->dhd_deferred_wq, (void *)((long int)ifidx), in dhd_set_multicast_list()
3709 dhd_deferred_schedule_work(dhd->dhd_deferred_wq, (void *)dhd->iflist[ifidx], in dhd_set_multicast_list()
3718 dhd_info_t *dhd = dhdp->info; in dhd_get_ucode_path()
3719 return dhd->uc_path; in dhd_get_ucode_path()
3727 dhd_info_t *di = (dhd_info_t *)(pub->info); in dhd_os_wlfc_block()
3733 spin_lock_irqsave(&di->wlfc_spinlock, di->wlfc_lock_flags); in dhd_os_wlfc_block()
3735 spin_lock_bh(&di->wlfc_spinlock); in dhd_os_wlfc_block()
3743 dhd_info_t *di = (dhd_info_t *)(pub->info); in dhd_os_wlfc_unblock()
3750 spin_unlock_irqrestore(&di->wlfc_spinlock, di->wlfc_lock_flags); in dhd_os_wlfc_unblock()
3752 spin_unlock_bh(&di->wlfc_spinlock); in dhd_os_wlfc_unblock()
3776 skb = PKTTONATIVE(dhdp->osh, p); in dhd_sendup()
3778 ifp = dhdp->info->iflist[ifidx]; in dhd_sendup()
3779 skb->dev = ifp->net; in dhd_sendup()
3780 skb->protocol = eth_type_trans(skb, skb->dev); in dhd_sendup()
3787 if (dhdp->info->rxthread_enabled) { in dhd_sendup()
3791 PKTSETNEXT(dhdp->osh, skbprev, skb); in dhd_sendup()
3812 if (dhdp->info->rxthread_enabled && skbhead) in dhd_sendup()
3832 ether_type = ntoh16(eh->ether_type); in dhd_handle_pktdata()
3915 dhd_info_t *dhd = (dhd_info_t *)(dhdp->info); in BCMFASTPATH()
3924 if (!dhdp->up || (dhdp->busstate == DHD_BUS_DOWN)) { in BCMFASTPATH()
3926 PKTCFREE(dhdp->osh, pktbuf, TRUE); in BCMFASTPATH()
3927 return -ENODEV; in BCMFASTPATH()
3931 if (dhdp->busstate == DHD_BUS_SUSPEND) { in BCMFASTPATH()
3933 PKTCFREE(dhdp->osh, pktbuf, TRUE); in BCMFASTPATH()
3939 if (PKTLEN(dhdp->osh, pktbuf) > MAX_MTU_SZ) { in BCMFASTPATH()
3941 dhdp->tx_big_packets++; in BCMFASTPATH()
3942 PKTCFREE(dhdp->osh, pktbuf, TRUE); in BCMFASTPATH()
3949 if (ifp->dhcp_unicast) { in BCMFASTPATH()
3953 ret = bcm_l2_filter_get_mac_addr_dhcp_pkt(dhdp->osh, pktbuf, ifidx, &mac_addr); in BCMFASTPATH()
3959 ehptr = PKTDATA(dhdp->osh, pktbuf); in BCMFASTPATH()
3965 if (ifp->grat_arp && DHD_IF_ROLE_AP(dhdp, ifidx)) { in BCMFASTPATH()
3966 if (bcm_l2_filter_gratuitous_arp(dhdp->osh, pktbuf) == BCME_OK) { in BCMFASTPATH()
3967 PKTCFREE(dhdp->osh, pktbuf, TRUE); in BCMFASTPATH()
3972 if (ifp->parp_enable && DHD_IF_ROLE_AP(dhdp, ifidx)) { in BCMFASTPATH()
3979 PKTCFREE(dhdp->osh, pktbuf, TRUE); in BCMFASTPATH()
3985 if (PKTLEN(dhdp->osh, pktbuf) >= ETHER_HDR_LEN) { in BCMFASTPATH()
3986 uint8 *pktdata = (uint8 *)PKTDATA(dhdp->osh, pktbuf); in BCMFASTPATH()
3989 if (ETHER_ISMULTI(eh->ether_dhost)) in BCMFASTPATH()
3990 dhdp->tx_multicast++; in BCMFASTPATH()
3991 if (ntoh16(eh->ether_type) == ETHER_TYPE_802_1X) { in BCMFASTPATH()
3996 dhdp->prio_8021x = prio; in BCMFASTPATH()
3999 atomic_inc(&dhd->pend_8021x_cnt); in BCMFASTPATH()
4002 pktdata, PKTLEN(dhdp->osh, pktbuf), TRUE); in BCMFASTPATH()
4009 (uint32)PKTLEN(dhdp->osh, pktbuf), TRUE, NULL, NULL); in BCMFASTPATH()
4011 PKTCFREE(dhdp->osh, pktbuf, TRUE); in BCMFASTPATH()
4016 if (ifp->qosmap_up_table_enable) { in BCMFASTPATH()
4017 pktsetprio_qms(pktbuf, ifp->qosmap_up_table, FALSE); in BCMFASTPATH()
4024 /* XXX RB:6270 Ignore skb->priority from TCP/IP stack */ in BCMFASTPATH()
4056 * packets generated from iperf uisng -S option. Can't understand why. in BCMFASTPATH()
4072 if (dhdp->tx_profile_enab && dhdp->num_profiles > 0 && in BCMFASTPATH()
4073 dhd_protocol_matches_profile(PKTDATA(dhdp->osh, pktbuf), in BCMFASTPATH()
4074 PKTLEN(dhdp->osh, pktbuf), dhdp->protocol_filters, in BCMFASTPATH()
4075 dhdp->host_sfhllc_supported)) { in BCMFASTPATH()
4083 pkt_flow_prio = dhdp->flow_prio_map[(PKTPRIO(pktbuf))]; in BCMFASTPATH()
4088 PKTCFREE(dhd->pub.osh, pktbuf, TRUE); in BCMFASTPATH()
4094 if (dhdp->conf->pktprio8021x >= 0) in BCMFASTPATH()
4095 pktset8021xprio(pktbuf, dhdp->conf->pktprio8021x); in BCMFASTPATH()
4103 DHD_PKTTAG_SETDSTN(PKTTAG(pktbuf), eh->ether_dhost); in BCMFASTPATH()
4106 if (ETHER_ISMULTI(eh->ether_dhost)) in BCMFASTPATH()
4122 dhdp->bus, pktbuf, TRUE) == WLFC_UNSUPPORTED) { in BCMFASTPATH()
4123 /* non-proptxstatus way */ in BCMFASTPATH()
4125 ret = dhd_bus_txdata(dhdp->bus, pktbuf, (uint8)ifidx); in BCMFASTPATH()
4127 ret = dhd_bus_txdata(dhdp->bus, pktbuf); in BCMFASTPATH()
4133 ret = dhd_bus_txdata(dhdp->bus, pktbuf, (uint8)ifidx); in BCMFASTPATH()
4135 ret = dhd_bus_txdata(dhdp->bus, pktbuf); in BCMFASTPATH()
4140 PKTCFREE(dhdp->osh, pktbuf, TRUE); in BCMFASTPATH()
4155 if (!ifp || ifp->del_in_progress) { in BCMFASTPATH()
4157 __FUNCTION__, ifp, ifp ? ifp->del_in_progress : 0)); in BCMFASTPATH()
4159 PKTCFREE(dhdp->osh, pktbuf, TRUE); in BCMFASTPATH()
4160 return -ENODEV; in BCMFASTPATH()
4164 __FUNCTION__, dhdp->busstate)); in BCMFASTPATH()
4166 PKTCFREE(dhdp->osh, pktbuf, TRUE); in BCMFASTPATH()
4167 return -ENODEV; in BCMFASTPATH()
4176 PKTCFREE(dhdp->osh, pktbuf, TRUE); in BCMFASTPATH()
4177 ret = -EBUSY; in BCMFASTPATH()
4185 __FUNCTION__, dhdp->busstate, dhdp->dhd_bus_busy_state)); in BCMFASTPATH()
4191 PKTCFREE(dhdp->osh, pktbuf, TRUE); in BCMFASTPATH()
4192 return -ENODEV; in BCMFASTPATH()
4221 dhd_pub_t *dhdp = &dhd_info->pub; in BCMFASTPATH()
4238 prio = dhdp->flow_prio_map[skb->priority]; in BCMFASTPATH()
4273 /* if in a non pre-emptable context, smp_processor_id can be used in BCMFASTPATH()
4283 prio = dhd->pub.flow_prio_map[skb->priority]; in BCMFASTPATH()
4286 dhd->pktcnt_qac_histo[qidx][prio]++; in BCMFASTPATH()
4287 dhd->pktcnt_per_ac[prio]++; in BCMFASTPATH()
4288 dhd->cpu_qstats[qidx][cpuid]++; in BCMFASTPATH()
4291 if (dhd_query_bus_erros(&dhd->pub)) { in BCMFASTPATH()
4292 return -ENODEV; in BCMFASTPATH()
4295 DHD_GENERAL_LOCK(&dhd->pub, flags); in BCMFASTPATH()
4296 DHD_BUS_BUSY_SET_IN_TX(&dhd->pub); in BCMFASTPATH()
4297 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in BCMFASTPATH()
4300 if (dhdpcie_runtime_bus_wake(&dhd->pub, FALSE, dhd_start_xmit)) { in BCMFASTPATH()
4301 /* In order to avoid pkt loss. Return NETDEV_TX_BUSY until run-time resumed. */ in BCMFASTPATH()
4303 DHD_GENERAL_LOCK(&dhd->pub, flags); in BCMFASTPATH()
4304 if (!dhdpcie_is_resume_done(&dhd->pub)) { in BCMFASTPATH()
4305 dhd_bus_stop_queue(dhd->pub.bus); in BCMFASTPATH()
4307 DHD_BUS_BUSY_CLEAR_IN_TX(&dhd->pub); in BCMFASTPATH()
4308 dhd_os_busbusy_wake(&dhd->pub); in BCMFASTPATH()
4309 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in BCMFASTPATH()
4314 DHD_GENERAL_LOCK(&dhd->pub, flags); in BCMFASTPATH()
4316 if (DHD_BUS_CHECK_SUSPEND_OR_SUSPEND_IN_PROGRESS(&dhd->pub)) { in BCMFASTPATH()
4318 __FUNCTION__, dhd->pub.busstate, dhd->pub.dhd_bus_busy_state)); in BCMFASTPATH()
4319 DHD_BUS_BUSY_CLEAR_IN_TX(&dhd->pub); in BCMFASTPATH()
4322 if (DHD_BUS_CHECK_ANY_SUSPEND_IN_PROGRESS(&dhd->pub)) { in BCMFASTPATH()
4323 dhd_bus_stop_queue(dhd->pub.bus); in BCMFASTPATH()
4326 dhd_os_busbusy_wake(&dhd->pub); in BCMFASTPATH()
4327 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in BCMFASTPATH()
4331 if (DHD_BUS_CHECK_SUSPEND_OR_SUSPEND_IN_PROGRESS(&dhd->pub)) { in BCMFASTPATH()
4333 __FUNCTION__, dhd->pub.busstate, dhd->pub.dhd_bus_busy_state)); in BCMFASTPATH()
4337 DHD_OS_WAKE_LOCK(&dhd->pub); in BCMFASTPATH()
4340 if (dhd->pub.req_hang_type == HANG_REASON_BUS_DOWN) { in BCMFASTPATH()
4342 dhd->pub.busstate = DHD_BUS_DOWN; in BCMFASTPATH()
4350 if (dhd->pub.hang_was_sent || DHD_BUS_CHECK_DOWN_OR_DOWN_IN_PROGRESS(&dhd->pub)) { in BCMFASTPATH()
4352 __FUNCTION__, dhd->pub.up, dhd->pub.busstate)); in BCMFASTPATH()
4356 if (dhd->pub.up && !dhd->pub.hang_was_sent && !DHD_BUS_CHECK_REMOVE(&dhd->pub)) { in BCMFASTPATH()
4358 dhd->pub.hang_reason = HANG_REASON_BUS_DOWN; in BCMFASTPATH()
4362 DHD_BUS_BUSY_CLEAR_IN_TX(&dhd->pub); in BCMFASTPATH()
4363 dhd_os_busbusy_wake(&dhd->pub); in BCMFASTPATH()
4364 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in BCMFASTPATH()
4365 DHD_OS_WAKE_UNLOCK(&dhd->pub); in BCMFASTPATH()
4377 DHD_BUS_BUSY_CLEAR_IN_TX(&dhd->pub); in BCMFASTPATH()
4378 dhd_os_busbusy_wake(&dhd->pub); in BCMFASTPATH()
4379 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in BCMFASTPATH()
4380 DHD_OS_WAKE_UNLOCK(&dhd->pub); in BCMFASTPATH()
4384 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in BCMFASTPATH()
4387 if (dhd->pub.tput_data.tput_test_running) { in BCMFASTPATH()
4392 ASSERT((ifp != NULL) && ((ifidx < DHD_MAX_IFS) && (ifp == dhd->iflist[ifidx]))); in BCMFASTPATH()
4396 /* re-align socket buffer if "skb->data" is odd address */ in BCMFASTPATH()
4397 if (((unsigned long)(skb->data)) & 0x1) { in BCMFASTPATH()
4398 unsigned char *data = skb->data; in BCMFASTPATH()
4399 uint32 length = skb->len; in BCMFASTPATH()
4400 PKTPUSH(dhd->pub.osh, skb, 1); in BCMFASTPATH()
4401 memmove(skb->data, data, length); in BCMFASTPATH()
4402 PKTSETLEN(dhd->pub.osh, skb, length); in BCMFASTPATH()
4405 datalen = PKTLEN(dhd->pub.osh, skb); in BCMFASTPATH()
4408 if (dhd->pub.conf->tput_monitor_ms) { in BCMFASTPATH()
4409 dhd_os_sdlock_txq(&dhd->pub); in BCMFASTPATH()
4410 dhd->pub.conf->net_len += datalen; in BCMFASTPATH()
4411 dhd_os_sdunlock_txq(&dhd->pub); in BCMFASTPATH()
4412 if ((dhd->pub.conf->data_drop_mode == XMIT_DROP) && in BCMFASTPATH()
4413 (PKTLEN(dhd->pub.osh, skb) > 500)) { in BCMFASTPATH()
4421 if (skb_headroom(skb) < dhd->pub.hdrlen + htsfdlystat_sz) { in BCMFASTPATH()
4425 dhd_ifname(&dhd->pub, ifidx))); in BCMFASTPATH()
4426 dhd->pub.tx_realloc++; in BCMFASTPATH()
4429 skb2 = skb_realloc_headroom(skb, dhd->pub.hdrlen + htsfdlystat_sz); in BCMFASTPATH()
4434 dhd_ifname(&dhd->pub, ifidx))); in BCMFASTPATH()
4435 ret = -ENOMEM; in BCMFASTPATH()
4443 if (dhd->pub.conf->orphan_move == 2) in BCMFASTPATH()
4444 PKTORPHAN(skb, dhd->pub.conf->tsq); in BCMFASTPATH()
4445 else if (dhd->pub.conf->orphan_move == 3) in BCMFASTPATH()
4449 if (!(pktbuf = PKTFRMNATIVE(dhd->pub.osh, skb))) { in BCMFASTPATH()
4451 dhd_ifname(&dhd->pub, ifidx))); in BCMFASTPATH()
4454 ret = -ENOMEM; in BCMFASTPATH()
4462 if (WET_ENABLED(&dhd->pub) && in BCMFASTPATH()
4463 (dhd_wet_send_proc(dhd->pub.wet_info, pktbuf, &pktbuf) < 0)) { in BCMFASTPATH()
4465 __FUNCTION__, dhd_ifname(&dhd->pub, ifidx))); in BCMFASTPATH()
4466 PKTFREE(dhd->pub.osh, pktbuf, FALSE); in BCMFASTPATH()
4467 ret = -EFAULT; in BCMFASTPATH()
4473 eh = (struct ether_header *)PKTDATA(dhd->pub.osh, pktbuf); in BCMFASTPATH()
4479 if (ifp->wmf.wmf_enable && (ntoh16(eh->ether_type) == ETHER_TYPE_IP) && in BCMFASTPATH()
4480 (IP_VER(iph) == IP_VER_4) && (ETHER_ISMULTI(eh->ether_dhost) || in BCMFASTPATH()
4481 ((IPV4_PROT(iph) == IP_PROT_IGMP) && dhd->pub.wmf_ucast_igmp))) { in BCMFASTPATH()
4489 ucast_convert = dhd->pub.wmf_ucast_upnp && MCAST_ADDR_UPNP_SSDP(dest_ip); in BCMFASTPATH()
4492 ucast_convert |= dhd->pub.wmf_ucast_igmp_query && in BCMFASTPATH()
4514 if (sta->psta_prim != NULL && !ifp->wmf_psta_disable) { in BCMFASTPATH()
4517 if ((sdu_clone = PKTDUP(dhd->pub.osh, pktbuf)) == NULL) { in BCMFASTPATH()
4521 dhd_wmf_forward(ifp->wmf.wmfh, sdu_clone, 0, sta, 1); in BCMFASTPATH()
4525 DHD_GENERAL_LOCK(&dhd->pub, flags); in BCMFASTPATH()
4526 DHD_BUS_BUSY_CLEAR_IN_TX(&dhd->pub); in BCMFASTPATH()
4527 dhd_os_busbusy_wake(&dhd->pub); in BCMFASTPATH()
4528 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in BCMFASTPATH()
4529 DHD_OS_WAKE_UNLOCK(&dhd->pub); in BCMFASTPATH()
4532 PKTFREE(dhd->pub.osh, pktbuf, TRUE); in BCMFASTPATH()
4541 ret = dhd_wmf_packets_handle(&dhd->pub, pktbuf, NULL, ifidx, 0); in BCMFASTPATH()
4549 DHD_GENERAL_LOCK(&dhd->pub, flags); in BCMFASTPATH()
4550 DHD_BUS_BUSY_CLEAR_IN_TX(&dhd->pub); in BCMFASTPATH()
4551 dhd_os_busbusy_wake(&dhd->pub); in BCMFASTPATH()
4552 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in BCMFASTPATH()
4553 DHD_OS_WAKE_UNLOCK(&dhd->pub); in BCMFASTPATH()
4566 if (PSR_ENABLED(&dhd->pub) && in BCMFASTPATH()
4568 !(ifp->primsta_dwds) && in BCMFASTPATH()
4570 (dhd_psta_proc(&dhd->pub, ifidx, &pktbuf, TRUE) < 0)) { in BCMFASTPATH()
4573 dhd_ifname(&dhd->pub, ifidx))); in BCMFASTPATH()
4581 if (skb->sk) { in BCMFASTPATH()
4582 sk_pacing_shift_update(skb->sk, DHD_DEFAULT_TCP_PACING_SHIFT); in BCMFASTPATH()
4587 if (dhd_tcpdata_get_flag(&dhd->pub, pktbuf) == FLAG_SYNCACK) { in BCMFASTPATH()
4588 ifp->tsyncack_txed ++; in BCMFASTPATH()
4593 if (dhd->pub.tcpack_sup_mode == TCPACK_SUP_HOLD) { in BCMFASTPATH()
4595 if (dhd_tcpack_hold(&dhd->pub, pktbuf, ifidx)) { in BCMFASTPATH()
4601 if (dhd_tcpack_suppress(&dhd->pub, pktbuf)) { in BCMFASTPATH()
4615 ret = __dhd_sendpkt(&dhd->pub, ifidx, pktbuf); in BCMFASTPATH()
4623 ifp->stats.tx_dropped++; in BCMFASTPATH()
4624 dhd->pub.tx_dropped++; in BCMFASTPATH()
4628 if (!dhd_wlfc_is_supported(&dhd->pub)) in BCMFASTPATH()
4631 dhd->pub.tx_packets++; in BCMFASTPATH()
4632 ifp->stats.tx_packets++; in BCMFASTPATH()
4633 ifp->stats.tx_bytes += datalen; in BCMFASTPATH()
4635 dhd->pub.actual_tx_pkts++; in BCMFASTPATH()
4638 DHD_GENERAL_LOCK(&dhd->pub, flags); in BCMFASTPATH()
4639 DHD_BUS_BUSY_CLEAR_IN_TX(&dhd->pub); in BCMFASTPATH()
4641 dhd_os_tx_completion_wake(&dhd->pub); in BCMFASTPATH()
4642 dhd_os_busbusy_wake(&dhd->pub); in BCMFASTPATH()
4643 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in BCMFASTPATH()
4644 DHD_OS_WAKE_UNLOCK(&dhd->pub); in BCMFASTPATH()
4660 pub = work->pub; in dhd_rx_wq_wakeup()
4664 if (atomic_read(&pub->block_bus) || pub->busstate == DHD_BUS_DOWN) { in dhd_rx_wq_wakeup()
4669 if (pm_runtime_get_sync(dhd_bus_to_dev(pub->bus)) >= 0) { in dhd_rx_wq_wakeup()
4672 pm_runtime_mark_last_busy(dhd_bus_to_dev(pub->bus)); in dhd_rx_wq_wakeup()
4673 pm_runtime_put_autosuspend(dhd_bus_to_dev(pub->bus)); in dhd_rx_wq_wakeup()
4688 dhd = DHD_DEV_INFO(work->net); in dhd_start_xmit_wq_adapter()
4690 bus = dhd->pub.bus; in dhd_start_xmit_wq_adapter()
4692 if (atomic_read(&dhd->pub.block_bus)) { in dhd_start_xmit_wq_adapter()
4693 kfree_skb(work->skb); in dhd_start_xmit_wq_adapter()
4700 ret = dhd_start_xmit(work->skb, work->net); in dhd_start_xmit_wq_adapter()
4708 netdev_err(work->net, in dhd_start_xmit_wq_adapter()
4719 if (dhd->pub.busstate == DHD_BUS_SUSPEND) { in BCMFASTPATH()
4722 dhd_netif_stop_queue(dhd->pub.bus); in BCMFASTPATH()
4730 ret = -ENOMEM; in BCMFASTPATH()
4734 INIT_WORK(&start_xmit_work->work, dhd_start_xmit_wq_adapter); in BCMFASTPATH()
4735 start_xmit_work->skb = skb; in BCMFASTPATH()
4736 start_xmit_work->net = net; in BCMFASTPATH()
4737 queue_work(dhd->tx_wq, &start_xmit_work->work); in BCMFASTPATH()
4740 } else if (dhd->pub.busstate == DHD_BUS_DATA) { in BCMFASTPATH()
4744 ret = -ENODEV; in BCMFASTPATH()
4754 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_bus_wakeup_work()
4762 INIT_WORK(&rx_work->work, dhd_rx_wq_wakeup); in dhd_bus_wakeup_work()
4763 rx_work->pub = dhdp; in dhd_bus_wakeup_work()
4764 queue_work(dhd->rx_wq, &rx_work->work); in dhd_bus_wakeup_work()
4773 if (net->reg_state != NETREG_REGISTERED) { in __dhd_txflowcontrol()
4800 dhd_info_t *dhd = dhdp->info; in dhd_txflowcontrol()
4810 if ((dhdp->dequeue_prec_map == (1 << dhdp->flow_prio_map[PRIO_8021D_NC])) && (state == ON)) in dhd_txflowcontrol()
4813 __FUNCTION__, dhdp->dequeue_prec_map, dhdp->flow_prio_map[PRIO_8021D_NC])); in dhd_txflowcontrol()
4818 flags = dhd_os_sdlock_txoff(&dhd->pub); in dhd_txflowcontrol()
4821 if (dhd->iflist[i]) { in dhd_txflowcontrol()
4822 net = dhd->iflist[i]->net; in dhd_txflowcontrol()
4827 if (dhd->iflist[ifidx]) { in dhd_txflowcontrol()
4828 net = dhd->iflist[ifidx]->net; in dhd_txflowcontrol()
4832 dhdp->txoff = state; in dhd_txflowcontrol()
4833 dhd_os_sdunlock_txoff(&dhd->pub, flags); in dhd_txflowcontrol()
4842 dhd_info_t *dhd = dhdp->info; in dhd_ctf_dump()
4845 ctf_dump(dhd->cih, strbuf); in dhd_ctf_dump()
4851 dhd_info_t *dhd = dhdp->info; in BCMFASTPATH()
4852 dhd_if_t *ifp = dhd->iflist[ifidx]; in BCMFASTPATH()
4854 return ifp->rx_pkt_chainable; in BCMFASTPATH()
4862 dhd_info_t *dhd = dhdp->info; in BCMFASTPATH()
4863 dhd_if_t *ifp = dhd->iflist[ifidx]; in BCMFASTPATH()
4865 return ifp->block_ping ? FALSE : TRUE; in BCMFASTPATH()
4885 dhd_info_t *dhd = dhdp->info; in BCMFASTPATH()
4886 dhd_if_t *ifp = dhd->iflist[ifidx]; in BCMFASTPATH()
4890 if (!dhd->brc_hot) in BCMFASTPATH()
4893 return CTF_HOTBRC_CMP(dhd->brc_hot, (eh), (void *)(ifp->net)); in BCMFASTPATH()
4899 * - link the chain by skb->next
4900 * - change the pnext to the 2nd packet of the chain
4901 * - the chained packets will be sent up to the n/w stack
4906 dhd_pub_t *dhdp = &dhd->pub; in BCMFASTPATH()
4911 if (!CTF_ENAB(dhd->cih) || (ctf_forward(dhd->cih, skb, skb->dev) == BCME_ERROR)) { in BCMFASTPATH()
4915 PKTCLRSKIPCT(dhdp->osh, skb); in BCMFASTPATH()
4919 if (PKTISFAST(dhdp->osh, skb)) in BCMFASTPATH()
4920 osl_ctfpool_add(dhdp->osh); in BCMFASTPATH()
4923 PKTCLRFAST(dhdp->osh, skb); in BCMFASTPATH()
4925 /* re-init the hijacked field */ in BCMFASTPATH()
4926 CTFPOOLPTR(dhdp->osh, skb) = NULL; in BCMFASTPATH()
4929 /* link the chained packets by skb->next */ in BCMFASTPATH()
4932 PKTFRMNATIVE(dhdp->osh, skb); in BCMFASTPATH()
4935 PKTCLRCHAINED(dhdp->osh, p); in BCMFASTPATH()
4938 PKTTONATIVE(dhdp->osh, p); in BCMFASTPATH()
4940 PKTSETNEXT(dhdp->osh, p, n); in BCMFASTPATH()
4942 PKTSETNEXT(dhdp->osh, p, old_pnext); in BCMFASTPATH()
4944 *pnext = PKTNEXT(dhdp->osh, skb); in BCMFASTPATH()
4945 PKTSETNEXT(dhdp->osh, skb, NULL); in BCMFASTPATH()
4958 dhd_info_t *dhd = dhdp->info; in dhd_is_rxthread_enabled()
4960 return dhd->rxthread_enabled; in dhd_is_rxthread_enabled()
4968 * Input eh - pointer to the ethernet header
4980 if (eh->ether_type != hton16(ETHER_TYPE_IP)) in dhd_mcast_reverse_translation()
4983 /* Non-IPv4 multicast packets are not handled */ in dhd_mcast_reverse_translation()
4991 if (IPV4_ISMULTI(dest_ip) && !ETHER_ISMULTI(&eh->ether_dhost)) { in dhd_mcast_reverse_translation()
4992 ETHER_FILL_MCAST_ADDR_FROM_IP(eh->ether_dhost, dest_ip); in dhd_mcast_reverse_translation()
5012 tasklet_schedule(&dhd->tasklet); in dhd_dpc_tasklet_dispatcher_work()
5018 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_schedule_delayed_dpc_on_dpc_cpu()
5019 int dpc_cpu = atomic_read(&dhd->dpc_cpu); in dhd_schedule_delayed_dpc_on_dpc_cpu()
5023 schedule_delayed_work_on(dpc_cpu, &dhd->dhd_dpc_dispatcher_work, delay); in dhd_schedule_delayed_dpc_on_dpc_cpu()
5044 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_event_logtrace_pkt_process()
5058 pktlen = skb->len + ETH_HLEN; in dhd_event_logtrace_pkt_process()
5074 dhd_dbg_trace_evnt_handler(dhdp, data, &dhd->event_data, datalen); in dhd_event_logtrace_pkt_process()
5100 dhdp = &dhd->pub; in dhd_event_logtrace_process_items()
5113 qlen = skb_queue_len(&dhd->evt_trace_queue); in dhd_event_logtrace_process_items()
5117 while (process_len--) { in dhd_event_logtrace_process_items()
5119 skb = skb_dequeue(&dhd->evt_trace_queue); in dhd_event_logtrace_process_items()
5131 dhd_event_logtrace_infobuf_pkt_process(dhdp, skb, &dhd->event_data); in dhd_event_logtrace_process_items()
5143 if (dhdp->logtrace_pkt_sendup) { in dhd_event_logtrace_process_items()
5149 void *npkt = PKTDUP(dhdp->osh, skb); in dhd_event_logtrace_process_items()
5151 PKTFREE_STATIC(dhdp->osh, skb, FALSE); in dhd_event_logtrace_process_items()
5162 * to send skb to network layer, assign skb->dev with in dhd_event_logtrace_process_items()
5166 skb = PKTTONATIVE(dhdp->osh, skb); in dhd_event_logtrace_process_items()
5167 skb->dev = dhd->iflist[0]->net; in dhd_event_logtrace_process_items()
5175 PKTFREE_STATIC(dhdp->osh, skb, FALSE); in dhd_event_logtrace_process_items()
5177 PKTFREE(dhdp->osh, skb, FALSE); in dhd_event_logtrace_process_items()
5191 dhd_info_t *dhd = (dhd_info_t *)tsk->parent; in dhd_logtrace_thread()
5192 dhd_pub_t *dhdp = (dhd_pub_t *)&dhd->pub; in dhd_logtrace_thread()
5196 dhdp->logtrace_thr_ts.entry_time = OSL_LOCALTIME_NS(); in dhd_logtrace_thread()
5198 dhdp->logtrace_thr_ts.sem_down_time = OSL_LOCALTIME_NS(); in dhd_logtrace_thread()
5200 if (dhd->pub.dongle_reset == FALSE) { in dhd_logtrace_thread()
5203 if (tsk->terminated) { in dhd_logtrace_thread()
5209 if (dhd->pub.dongle_edl_support) { in dhd_logtrace_thread()
5210 ret = dhd_prot_process_edl_complete(&dhd->pub, in dhd_logtrace_thread()
5211 &dhd->event_data); in dhd_logtrace_thread()
5236 if (tsk->flush_ind) { in dhd_logtrace_thread()
5238 dhdp->logtrace_thr_ts.flush_time = OSL_LOCALTIME_NS(); in dhd_logtrace_thread()
5239 tsk->flush_ind = 0; in dhd_logtrace_thread()
5240 complete(&tsk->flushed); in dhd_logtrace_thread()
5244 dhdp->logtrace_thr_ts.unexpected_break_time = OSL_LOCALTIME_NS(); in dhd_logtrace_thread()
5249 complete_and_exit(&tsk->completed, 0); in dhd_logtrace_thread()
5250 dhdp->logtrace_thr_ts.complete_time = OSL_LOCALTIME_NS(); in dhd_logtrace_thread()
5256 /* Ignore compiler warnings due to -Werror=cast-qual */ in dhd_event_logtrace_process()
5265 if (dhd->pub.dongle_edl_support) { in dhd_event_logtrace_process()
5266 ret = dhd_prot_process_edl_complete(&dhd->pub, &dhd->event_data); in dhd_event_logtrace_process()
5275 schedule_delayed_work(&(dhd)->event_log_dispatcher_work, in dhd_event_logtrace_process()
5288 if (dhd->thr_logtrace_ctl.thr_pid >= 0) { in dhd_schedule_logtrace()
5289 binary_sema_up(&dhd->thr_logtrace_ctl); in dhd_schedule_logtrace()
5292 dhd->thr_logtrace_ctl.thr_pid)); in dhd_schedule_logtrace()
5295 schedule_delayed_work(&dhd->event_log_dispatcher_work, 0); in dhd_schedule_logtrace()
5304 if (dhd->thr_logtrace_ctl.thr_pid >= 0) { in dhd_cancel_logtrace_process_sync()
5305 PROC_STOP_USING_BINARY_SEMA(&dhd->thr_logtrace_ctl); in dhd_cancel_logtrace_process_sync()
5308 dhd->thr_logtrace_ctl.thr_pid)); in dhd_cancel_logtrace_process_sync()
5311 cancel_delayed_work_sync(&dhd->event_log_dispatcher_work); in dhd_cancel_logtrace_process_sync()
5319 if (dhd->thr_logtrace_ctl.thr_pid >= 0) { in dhd_flush_logtrace_process()
5320 PROC_FLUSH_USING_BINARY_SEMA(&dhd->thr_logtrace_ctl); in dhd_flush_logtrace_process()
5323 dhd->thr_logtrace_ctl.thr_pid)); in dhd_flush_logtrace_process()
5326 flush_delayed_work(&dhd->event_log_dispatcher_work); in dhd_flush_logtrace_process()
5334 dhd->thr_logtrace_ctl.thr_pid = DHD_PID_KT_INVALID; in dhd_init_logtrace_process()
5335 PROC_START(dhd_logtrace_thread, dhd, &dhd->thr_logtrace_ctl, 0, "dhd_logtrace_thread"); in dhd_init_logtrace_process()
5336 if (dhd->thr_logtrace_ctl.thr_pid < 0) { in dhd_init_logtrace_process()
5341 dhd->thr_logtrace_ctl.thr_pid)); in dhd_init_logtrace_process()
5344 INIT_DELAYED_WORK(&dhd->event_log_dispatcher_work, dhd_event_logtrace_process); in dhd_init_logtrace_process()
5353 /* Re-init only if PROC_STOP from dhd_stop was called in dhd_reinit_logtrace_process()
5356 if (dhd->thr_logtrace_ctl.thr_pid < 0) { in dhd_reinit_logtrace_process()
5357 PROC_START(dhd_logtrace_thread, dhd, &dhd->thr_logtrace_ctl, in dhd_reinit_logtrace_process()
5359 if (dhd->thr_logtrace_ctl.thr_pid < 0) { in dhd_reinit_logtrace_process()
5364 dhd->thr_logtrace_ctl.thr_pid)); in dhd_reinit_logtrace_process()
5368 /* No need to re-init for WQ as calcel_delayed_work_sync will in dhd_reinit_logtrace_process()
5378 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_event_logtrace_enqueue()
5384 skb_queue_tail(&dhd->evt_trace_queue, pktbuf); in dhd_event_logtrace_enqueue()
5394 dhd_info_t *dhd = (dhd_info_t *) dhdp->info; in dhd_event_logtrace_enqueue_fwtrace()
5407 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_event_logtrace_flush_queue()
5410 while ((skb = skb_dequeue(&dhd->evt_trace_queue)) != NULL) { in dhd_event_logtrace_flush_queue()
5412 PKTFREE_STATIC(dhdp->osh, skb, FALSE); in dhd_event_logtrace_flush_queue()
5414 PKTFREE(dhdp->osh, skb, FALSE); in dhd_event_logtrace_flush_queue()
5427 dhd_info_t *dhd = dhdp->info; in dhd_sendup_info_buf()
5435 pktsize = (uint32)(ltoh16(infobuf->length) + sizeof(info_buf_payload_hdr_t) + in dhd_sendup_info_buf()
5437 pkt = PKTGET(dhdp->osh, pktsize, FALSE); in dhd_sendup_info_buf()
5441 PKTSETLEN(dhdp->osh, pkt, pktsize); in dhd_sendup_info_buf()
5442 pktdata = PKTDATA(dhdp->osh, pkt); in dhd_sendup_info_buf()
5444 /* For infobuf packets assign skb->dev with in dhd_sendup_info_buf()
5447 skb = PKTTONATIVE(dhdp->osh, pkt); in dhd_sendup_info_buf()
5448 skb->dev = dhd->iflist[0]->net; in dhd_sendup_info_buf()
5464 /* Ignore compiler warnings due to -Werror=cast-qual */ in dhd_bt_log_process()
5474 dhdp = &dhd->pub; in dhd_bt_log_process()
5484 while ((skb = skb_dequeue(&dhd->bt_log_queue)) != NULL) { in dhd_bt_log_process()
5487 PKTFREE_STATIC(dhdp->osh, skb, FALSE); in dhd_bt_log_process()
5489 PKTFREE(dhdp->osh, skb, FALSE); in dhd_bt_log_process()
5497 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_rx_bt_log()
5499 skb_queue_tail(&dhd->bt_log_queue, pkt); in dhd_rx_bt_log()
5502 schedule_work(&dhd->bt_log_dispatcher_work); in dhd_rx_bt_log()
5512 /* Ignore compiler warnings due to -Werror=cast-qual */ in dhd_edl_process_work()
5518 dhd_prot_process_edl_complete(&dhd_info->pub, &dhd_info->event_data); in dhd_edl_process_work()
5524 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_schedule_edl_work()
5525 schedule_delayed_work(&dhd->edl_dispatcher_work, msecs_to_jiffies(delay_ms)); in dhd_schedule_edl_work()
5535 uint32 evt_type = ntoh32_ua(&evt_msg->event_type); in dhd_nho_evt_process()
5540 uint32 event_len = sizeof(wl_event_msg_t) + ntoh32_ua(&evt_msg->datalen); in dhd_nho_evt_process()
5542 bcm_nanho_evt(pub->nanhoi, &pvt_data->event, event_len, &consumed); in dhd_nho_evt_process()
5554 if ((p = PKTGET(dhdp->osh, evt_len, FALSE))) { in dhd_nho_evt_cb()
5555 memcpy(PKTDATA(dhdp->osh, p), (uint8 *)evt, evt_len); in dhd_nho_evt_cb()
5556 skb = PKTTONATIVE(dhdp->osh, p); in dhd_nho_evt_cb()
5558 ifp = dhdp->info->iflist[ifidx]; in dhd_nho_evt_cb()
5561 ifp = dhdp->info->iflist[0]; in dhd_nho_evt_cb()
5565 skb->dev = ifp->net; in dhd_nho_evt_cb()
5566 skb->protocol = eth_type_trans(skb, skb->dev); in dhd_nho_evt_cb()
5596 ip_header = (struct iphdr *)(skb->data); in update_wake_pkt_info()
5598 temp_raw |= ((long long)ntoh16(skb->protocol)) << 48; in update_wake_pkt_info()
5600 DHD_INFO(("eth_hdr(skb)->h_dest : %pM\n", eth_hdr(skb)->h_dest)); in update_wake_pkt_info()
5601 if (eth_hdr(skb)->h_dest[0] & 0x01) { in update_wake_pkt_info()
5605 if (ntoh16(skb->protocol) == ETHER_TYPE_BRCM) { in update_wake_pkt_info()
5615 skb->mac.raw, in update_wake_pkt_info()
5617 skb->len, &evu); in update_wake_pkt_info()
5627 } else if (ntoh16(skb->protocol) == ETHER_TYPE_IP || in update_wake_pkt_info()
5628 ntoh16(skb->protocol) == ETHER_TYPE_IPV6) { in update_wake_pkt_info()
5629 if (ip_header->version == 6) { in update_wake_pkt_info()
5631 temp_raw |= ((long long)ipv6_header->nexthdr) << 40; in update_wake_pkt_info()
5634 if (ipv6_header->daddr.s6_addr[0] & 0xff) { in update_wake_pkt_info()
5639 ip_header->protocol, &(ipv6_header->saddr.s6_addr), in update_wake_pkt_info()
5640 &(ipv6_header->daddr.s6_addr), dport)); in update_wake_pkt_info()
5641 } else if (ip_header->version == 4) { in update_wake_pkt_info()
5642 temp_raw |= ((long long)ip_header->protocol) << 40; in update_wake_pkt_info()
5645 if (ip_header->protocol == IPPROTO_TCP) { in update_wake_pkt_info()
5647 dport = ntohs(tcp_header->dest); in update_wake_pkt_info()
5649 else if (ip_header->protocol == IPPROTO_UDP) { in update_wake_pkt_info()
5651 dport = ntohs(udp_header->dest); in update_wake_pkt_info()
5654 if (ipv4_is_multicast(ip_header->daddr)) { in update_wake_pkt_info()
5659 ip_header->protocol, &(ip_header->saddr), in update_wake_pkt_info()
5660 &(ip_header->daddr), dport)); in update_wake_pkt_info()
5679 skb = PKTTONATIVE(dhdp->osh, pktbuf); in dhd_check_shinfo_nrfrags()
5682 if (shinfo->nr_frags) { in dhd_check_shinfo_nrfrags()
5687 shinfo->nr_frags, (uint64)(pa->loaddr), (uint64)(pa->hiaddr), in dhd_check_shinfo_nrfrags()
5688 (uint64)skb, (uint64)(skb->data), (uint64)(skb->head), (uint64)(skb->tail), in dhd_check_shinfo_nrfrags()
5689 (uint64)(skb->end), skb->len, (uint64)shinfo, pktid)); in dhd_check_shinfo_nrfrags()
5694 shinfo->nr_frags, in dhd_check_shinfo_nrfrags()
5695 (uint)skb, (uint)(skb->data), (uint)(skb->head), (uint)(skb->tail), in dhd_check_shinfo_nrfrags()
5696 (uint)(skb->end), skb->len, (uint)shinfo, pktid)); in dhd_check_shinfo_nrfrags()
5702 if (dhdp->memdump_enabled) { in dhd_check_shinfo_nrfrags()
5704 dhdp->memdump_type = DUMP_TYPE_INVALID_SHINFO_NRFRAGS; in dhd_check_shinfo_nrfrags()
5709 shinfo->nr_frags = 0; in dhd_check_shinfo_nrfrags()
5711 * if nfrags is corrupted. Whereas in non-production in dhd_check_shinfo_nrfrags()
5714 PKTCFREE(dhdp->osh, pktbuf, FALSE); in dhd_check_shinfo_nrfrags()
5727 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_rx_frame()
5762 if (dhdp->conf->pktsetsum) in dhd_rx_frame()
5768 ifp = dhd->iflist[ifidx]; in dhd_rx_frame()
5769 if (ifp && ifp->net->qdisc) { in dhd_rx_frame()
5770 if (ifp->net->qdisc->ops->cl_ops) { in dhd_rx_frame()
5776 if (dev_ingress_queue(ifp->net)) { in dhd_rx_frame()
5777 qdisc = dev_ingress_queue(ifp->net)->qdisc_sleeping; in dhd_rx_frame()
5778 if (qdisc != NULL && (qdisc->flags & TCQ_F_INGRESS)) { in dhd_rx_frame()
5787 if (!dhdp->permitted_gro && dhd_gro_enable) { in dhd_rx_frame()
5796 pnext = PKTNEXT(dhdp->osh, pktbuf); in dhd_rx_frame()
5797 PKTSETNEXT(dhdp->osh, pktbuf, NULL); in dhd_rx_frame()
5821 PKTFREE_STATIC(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5823 PKTFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5841 eh = (struct ether_header *)PKTDATA(dhdp->osh, pktbuf); in dhd_rx_frame()
5843 if (dhdp->awdl_llc_enabled && in dhd_rx_frame()
5844 dhdp->awdl_ifidx && ifidx == dhdp->awdl_ifidx) { in dhd_rx_frame()
5845 if (ntoh16(eh->ether_type) < ETHER_TYPE_MIN) { in dhd_rx_frame()
5851 if (dhd->pub.tput_data.tput_test_running && in dhd_rx_frame()
5852 dhd->pub.tput_data.direction == TPUT_DIR_RX && in dhd_rx_frame()
5853 ntoh16(eh->ether_type) == ETHER_TYPE_IP) { in dhd_rx_frame()
5855 PKTFREE(dhd->pub.osh, pktbuf, FALSE); in dhd_rx_frame()
5862 if (ntoh16(eh->ether_type) == ETHER_TYPE_BRCM) { in dhd_rx_frame()
5864 PKTFREE_STATIC(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5866 PKTFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5869 PKTCFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5874 ifp = dhd->iflist[ifidx]; in dhd_rx_frame()
5878 if (ntoh16(eh->ether_type) == ETHER_TYPE_BRCM) { in dhd_rx_frame()
5880 PKTFREE_STATIC(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5882 PKTFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5885 PKTCFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5892 if ((!ifp->net || ifp->net->reg_state != NETREG_REGISTERED) && in dhd_rx_frame()
5893 (ntoh16(eh->ether_type) != ETHER_TYPE_BRCM)) in dhd_rx_frame()
5895 if ((!ifp->net || ifp->net->reg_state != NETREG_REGISTERED || !dhd->pub.up) && in dhd_rx_frame()
5896 (ntoh16(eh->ether_type) != ETHER_TYPE_BRCM)) in dhd_rx_frame()
5901 PKTCFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5909 piggy-back on in dhd_rx_frame()
5911 PKTCFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5917 if (ifp->block_ping) { in dhd_rx_frame()
5918 if (bcm_l2_filter_block_ping(dhdp->osh, pktbuf) == BCME_OK) { in dhd_rx_frame()
5919 PKTCFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5923 if (ifp->grat_arp && DHD_IF_ROLE_STA(dhdp, ifidx)) { in dhd_rx_frame()
5924 if (bcm_l2_filter_gratuitous_arp(dhdp->osh, pktbuf) == BCME_OK) { in dhd_rx_frame()
5925 PKTCFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5929 if (ifp->parp_enable && DHD_IF_ROLE_AP(dhdp, ifidx)) { in dhd_rx_frame()
5936 PKTCFREE(dhdp->osh, pktbuf, TRUE); in dhd_rx_frame()
5940 if (ifp->block_tdls) { in dhd_rx_frame()
5941 if (bcm_l2_filter_block_tdls(dhdp->osh, pktbuf) == BCME_OK) { in dhd_rx_frame()
5942 PKTCFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
5949 DHD_FLOWID_LOCK(dhdp->flowid_lock, flags); in dhd_rx_frame()
5950 if_flow_lkup = (if_flow_lkup_t *)dhdp->if_flow_lkup; in dhd_rx_frame()
5954 DHD_FLOWID_UNLOCK(dhdp->flowid_lock, flags); in dhd_rx_frame()
5956 if (ifp->mcast_regen_bss_enable && (interface_role != WLC_E_IF_ROLE_WDS) && in dhd_rx_frame()
5958 ETHER_ISUCAST(eh->ether_dhost)) { in dhd_rx_frame()
5961 /* Change bsscfg to primary bsscfg for unicast-multicast packets */ in dhd_rx_frame()
5979 if (ifp->wmf.wmf_enable && (ETHER_ISMULTI(eh->ether_dhost))) { in dhd_rx_frame()
5983 sta = dhd_find_sta(dhdp, ifidx, (void *)eh->ether_shost); in dhd_rx_frame()
5993 PKTCFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6008 ifp->tsync_rcvd ++; in dhd_rx_frame()
6009 delta_sync = ifp->tsync_rcvd - ifp->tsyncack_txed; in dhd_rx_frame()
6010 delta_sec = curr_time - ifp->last_sync; in dhd_rx_frame()
6014 schedule_work(&ifp->blk_tsfl_work); in dhd_rx_frame()
6018 ifp->tsync_per_sec = sync_per_sec; in dhd_rx_frame()
6029 skb = PKTTONATIVE(dhdp->osh, pktbuf); in dhd_rx_frame()
6032 skb->dev = ifp->net; in dhd_rx_frame()
6037 if (WET_ENABLED(&dhd->pub) && (dhd_wet_recv_proc(dhd->pub.wet_info, in dhd_rx_frame()
6047 !(ifp->primsta_dwds) && in dhd_rx_frame()
6056 /* XXX Use WOFA for both dhdap and dhdap-atlas router. */ in dhd_rx_frame()
6059 if (DHD_IF_ROLE_AP(dhdp, ifidx) && (!ifp->ap_isolate)) { in dhd_rx_frame()
6060 eh = (struct ether_header *)PKTDATA(dhdp->osh, pktbuf); in dhd_rx_frame()
6061 if (ETHER_ISUCAST(eh->ether_dhost)) { in dhd_rx_frame()
6062 if (dhd_find_sta(dhdp, ifidx, (void *)eh->ether_dhost)) { in dhd_rx_frame()
6072 PKTFRMNATIVE(dhdp->osh, pktbuf); in dhd_rx_frame()
6073 PKTCFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6077 if ((ntoh16(eh->ether_type) != ETHER_TYPE_IAPP_L2_UPDATE) && in dhd_rx_frame()
6078 ((npkt = PKTDUP(dhdp->osh, pktbuf)) != NULL)) in dhd_rx_frame()
6093 (!ifp->ap_isolate)) { in dhd_rx_frame()
6094 eh = (struct ether_header *)PKTDATA(dhdp->osh, pktbuf); in dhd_rx_frame()
6095 if (ETHER_ISUCAST(eh->ether_dhost)) { in dhd_rx_frame()
6096 if (dhd_find_sta(dhdp, ifidx, (void *)eh->ether_dhost)) { in dhd_rx_frame()
6101 if ((ntoh16(eh->ether_type) != ETHER_TYPE_IAPP_L2_UPDATE)) { in dhd_rx_frame()
6109 if (dhdp->host_sfhllc_supported) { in dhd_rx_frame()
6112 npktbuf = PKTDUP(dhdp->osh, pktbuf); in dhd_rx_frame()
6123 if (IS_STA_IFACE(ndev_to_wdev(ifp->net)) && in dhd_rx_frame()
6124 (ifp->recv_reassoc_evt == TRUE) && (ifp->post_roam_evt == FALSE) && in dhd_rx_frame()
6125 (dhd_is_4way_msg((char *)(skb->data)) == EAPOL_4WAY_M1)) { in dhd_rx_frame()
6128 PKTFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6133 if ((dhdp->conf->fw_type == FW_TYPE_EZMESH) && in dhd_rx_frame()
6134 (ntoh16(eh->ether_type) != ETHER_TYPE_BRCM)) { in dhd_rx_frame()
6135 uint16 * da = (uint16 *)(eh->ether_dhost); in dhd_rx_frame()
6142 if (ntoh16(eh->ether_type) == ETHER_TYPE_1905_1) { in dhd_rx_frame()
6143 if (!eacmp(da, ifp->_1905_al_ucast) || !eacmp(da, ifp->_1905_al_mcast)) { in dhd_rx_frame()
6144 //skb->fwr_flood = 0; in dhd_rx_frame()
6146 //skb->fwr_flood = 1; in dhd_rx_frame()
6153 * Linux 2.4 where 'eth_type_trans' uses the 'net->hard_header_len' in dhd_rx_frame()
6157 * we set the 'net->hard_header_len' to ETH_HLEN + extra space required in dhd_rx_frame()
6160 eth = skb->data; in dhd_rx_frame()
6161 len = skb->len; in dhd_rx_frame()
6162 dump_data = skb->data; in dhd_rx_frame()
6163 protocol = (skb->data[12] << 8) | skb->data[13]; in dhd_rx_frame()
6168 wl_handle_wps_states(ifp->net, dump_data, len, FALSE); in dhd_rx_frame()
6171 if (dhd_is_4way_msg((uint8 *)(skb->data)) == EAPOL_4WAY_M3) { in dhd_rx_frame()
6172 OSL_ATOMIC_SET(dhdp->osh, &ifp->m4state, M3_RXED); in dhd_rx_frame()
6184 DHD_ERROR(("config check in_suspend: %d ", dhdp->in_suspend)); in dhd_rx_frame()
6186 DHD_ERROR(("arp hmac_update:%d \n", dhdp->hmac_updated)); in dhd_rx_frame()
6192 if (dhd->pub.loopback) { in dhd_rx_frame()
6194 if (ntoh16(local_eh->ether_type) == ETHER_TYPE_IP) { in dhd_rx_frame()
6197 uint16 iplen = (iph->version_ihl & 0xf) * sizeof(uint32); in dhd_rx_frame()
6198 if (iph->prot == 1) { in dhd_rx_frame()
6204 memcpy(temp_addr, local_eh->ether_dhost, in dhd_rx_frame()
6206 memcpy(local_eh->ether_dhost, in dhd_rx_frame()
6207 local_eh->ether_shost, ETHER_ADDR_LEN); in dhd_rx_frame()
6208 memcpy(local_eh->ether_shost, temp_addr, in dhd_rx_frame()
6212 memcpy(temp_ip, iph->src_ip, IPV4_ADDR_LEN); in dhd_rx_frame()
6213 memcpy(iph->src_ip, iph->dst_ip, IPV4_ADDR_LEN); in dhd_rx_frame()
6214 memcpy(iph->dst_ip, temp_ip, IPV4_ADDR_LEN); in dhd_rx_frame()
6219 } else if (iph->prot == 17) { in dhd_rx_frame()
6226 memcpy(temp_addr, local_eh->ether_dhost, in dhd_rx_frame()
6228 memcpy(local_eh->ether_dhost, in dhd_rx_frame()
6229 local_eh->ether_shost, ETHER_ADDR_LEN); in dhd_rx_frame()
6230 memcpy(local_eh->ether_shost, temp_addr, in dhd_rx_frame()
6234 memcpy(temp_ip, iph->src_ip, IPV4_ADDR_LEN); in dhd_rx_frame()
6235 memcpy(iph->src_ip, iph->dst_ip, IPV4_ADDR_LEN); in dhd_rx_frame()
6236 memcpy(iph->dst_ip, temp_ip, IPV4_ADDR_LEN); in dhd_rx_frame()
6245 skb->protocol = eth_type_trans(skb, skb->dev); in dhd_rx_frame()
6247 if (skb->pkt_type == PACKET_MULTICAST) { in dhd_rx_frame()
6248 dhd->pub.rx_multicast++; in dhd_rx_frame()
6249 ifp->stats.multicast++; in dhd_rx_frame()
6252 skb->data = eth; in dhd_rx_frame()
6253 skb->len = len; in dhd_rx_frame()
6255 /* TODO: XXX: re-look into dropped packets. */ in dhd_rx_frame()
6278 if (ntoh16(skb->protocol) == ETHER_TYPE_BRCM) { in dhd_rx_frame()
6289 PKTFREE_STATIC(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6291 PKTFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6321 PKTFREE_STATIC(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6323 PKTFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6352 wcp->rc_event[event.event_type]++; in dhd_rx_frame()
6353 wcp->rcwake++; in dhd_rx_frame()
6367 PKTFREE_STATIC(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6369 PKTFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6379 ASSERT(ifidx < DHD_MAX_IFS && dhd->iflist[ifidx]); in dhd_rx_frame()
6380 ifp = dhd->iflist[ifidx]; in dhd_rx_frame()
6382 if (!(ifp && ifp->net && (ifp->net->reg_state == NETREG_REGISTERED))) in dhd_rx_frame()
6384 if (!(ifp && ifp->net && (ifp->net->reg_state == NETREG_REGISTERED) && in dhd_rx_frame()
6385 dhd->pub.up)) in dhd_rx_frame()
6391 PKTFREE_STATIC(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6393 PKTFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6399 if (dhdp->wl_event_enabled || in dhd_rx_frame()
6400 (dhdp->recv_probereq && (event.event_type == WLC_E_PROBREQ_MSG))) in dhd_rx_frame()
6402 if (dhdp->wl_event_enabled) in dhd_rx_frame()
6412 PKTFREE_STATIC(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6423 PKTFREE_STATIC(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6425 PKTFREE(dhdp->osh, pktbuf, FALSE); in dhd_rx_frame()
6440 wcp->rxwake++; in dhd_rx_frame()
6447 if (ntoh16(skb->protocol) == ETHER_TYPE_ARP) /* ARP */ in dhd_rx_frame()
6448 wcp->rx_arp++; in dhd_rx_frame()
6450 wcp->rx_bcast++; in dhd_rx_frame()
6452 wcp->rx_mcast++; in dhd_rx_frame()
6453 if (ntoh16(skb->protocol) == ETHER_TYPE_IPV6) { in dhd_rx_frame()
6454 wcp->rx_multi_ipv6++; in dhd_rx_frame()
6455 if ((skb->len > ETHER_ICMP6_HEADER) && in dhd_rx_frame()
6457 wcp->rx_icmpv6++; in dhd_rx_frame()
6458 if (skb->len > ETHER_ICMPV6_TYPE) { in dhd_rx_frame()
6461 wcp->rx_icmpv6_ra++; in dhd_rx_frame()
6464 wcp->rx_icmpv6_na++; in dhd_rx_frame()
6467 wcp->rx_icmpv6_ns++; in dhd_rx_frame()
6473 wcp->rx_multi_ipv4++; in dhd_rx_frame()
6475 wcp->rx_multi_other++; in dhd_rx_frame()
6478 wcp->rx_ucast++; in dhd_rx_frame()
6491 ifp->net->last_rx = jiffies; in dhd_rx_frame()
6494 if (ntoh16(skb->protocol) != ETHER_TYPE_BRCM) { in dhd_rx_frame()
6495 dhdp->dstats.rx_bytes += skb->len; in dhd_rx_frame()
6496 dhdp->rx_packets++; /* Local count */ in dhd_rx_frame()
6497 ifp->stats.rx_bytes += skb->len; in dhd_rx_frame()
6498 ifp->stats.rx_packets++; in dhd_rx_frame()
6502 if (ifidx == 0 && ntoh16(skb->protocol) == ETHER_TYPE_IP) { in dhd_rx_frame()
6503 dhd_adjust_tcp_winsize(dhdp->op_mode, skb); in dhd_rx_frame()
6508 /* XXX WL here makes sure data is 4-byte aligned? */ in dhd_rx_frame()
6524 ntoh16(skb->protocol) != ETHER_TYPE_BRCM) { in dhd_rx_frame()
6525 napi_gro_receive(&dhd->rx_napi_struct, skb); in dhd_rx_frame()
6541 if (dhd->rxthread_enabled) { in dhd_rx_frame()
6545 PKTSETNEXT(dhdp->osh, skbprev, skb); in dhd_rx_frame()
6559 dhd_tcpack_suppress_set(&dhd->pub, TCPACK_SUP_OFF); in dhd_rx_frame()
6564 ntoh16(skb->protocol) != ETHER_TYPE_BRCM) { in dhd_rx_frame()
6565 napi_gro_receive(&dhd->rx_napi_struct, skb); in dhd_rx_frame()
6579 if (dhd->rxthread_enabled && skbhead) in dhd_rx_frame()
6598 dhd_info_t *dhd = (dhd_info_t *)(dhdp->info); in dhd_txcomplete()
6602 if (dhdp->tput_data.tput_test_running) { in dhd_txcomplete()
6604 dhdp->batch_tx_pkts_cmpl++; in dhd_txcomplete()
6608 dhdp->batch_tx_pkts_cmpl <= dhdp->batch_tx_num_pkts) in dhd_txcomplete()
6609 dhdp->tput_data.pkts_good++; in dhd_txcomplete()
6611 dhdp->tput_data.pkts_bad++; in dhd_txcomplete()
6614 if (dhdp->batch_tx_pkts_cmpl == dhdp->batch_tx_num_pkts) { in dhd_txcomplete()
6615 dhdp->tput_stop_ts = OSL_SYSUPTIME_US(); in dhd_txcomplete()
6616 dhdp->tput_data.pkts_cmpl += dhdp->batch_tx_pkts_cmpl; in dhd_txcomplete()
6617 dhdp->tput_data.num_pkts += dhdp->batch_tx_num_pkts; in dhd_txcomplete()
6626 eh = (struct ether_header *)PKTDATA(dhdp->osh, txp); in dhd_txcomplete()
6627 type = ntoh16(eh->ether_type); in dhd_txcomplete()
6630 atomic_dec(&dhd->pend_8021x_cnt); in dhd_txcomplete()
6634 if (dhdp->wlfc_state && (dhdp->proptxstatus_mode != WLFC_FCMODE_NONE)) { in dhd_txcomplete()
6635 dhd_if_t *ifp = dhd->iflist[DHD_PKTTAG_IF(PKTTAG(txp))]; in dhd_txcomplete()
6636 uint datalen = PKTLEN(dhd->pub.osh, txp); in dhd_txcomplete()
6639 dhd->pub.tx_packets++; in dhd_txcomplete()
6640 ifp->stats.tx_packets++; in dhd_txcomplete()
6641 ifp->stats.tx_bytes += datalen; in dhd_txcomplete()
6643 ifp->stats.tx_dropped++; in dhd_txcomplete()
6649 dhd->pub.tot_txcpl++; in dhd_txcomplete()
6660 pub->tput_test_done = FALSE; in dhd_os_tput_test_wait()
6661 condition = (uint *)&pub->tput_test_done; in dhd_os_tput_test_wait()
6662 timeout = wait_event_timeout(pub->tx_tput_test_wait, in dhd_os_tput_test_wait()
6671 pub->tput_test_done = TRUE; in dhd_os_tput_test_wake()
6673 wake_up(&(pub->tx_tput_test_wait)); in dhd_os_tput_test_wake()
6690 ifp = dhd_get_ifp_by_ndev(&dhd->pub, net); in dhd_get_stats()
6697 if (dhd->pub.up) { in dhd_get_stats()
6699 dhd_prot_dstats(&dhd->pub); in dhd_get_stats()
6701 return &ifp->stats; in dhd_get_stats()
6704 memset(&net->stats, 0, sizeof(net->stats)); in dhd_get_stats()
6705 return &net->stats; in dhd_get_stats()
6713 dhd_info_t *dhd = (dhd_info_t *)tsk->parent; in dhd_watchdog_thread()
6714 /* This thread doesn't need any user-level access, in dhd_watchdog_thread()
6720 dhd_watchdog_prio:(MAX_RT_PRIO-1); in dhd_watchdog_thread()
6725 if (down_interruptible (&tsk->sema) == 0) { in dhd_watchdog_thread()
6730 DHD_OS_WD_WAKE_LOCK(&dhd->pub); in dhd_watchdog_thread()
6734 if (tsk->terminated) { in dhd_watchdog_thread()
6736 DHD_OS_WD_WAKE_UNLOCK(&dhd->pub); in dhd_watchdog_thread()
6741 if (dhd->pub.dongle_reset == FALSE) { in dhd_watchdog_thread()
6744 dhd_bus_watchdog(&dhd->pub); in dhd_watchdog_thread()
6748 dhd_timesync_watchdog(&dhd->pub); in dhd_watchdog_thread()
6752 if (CTF_ENAB(dhd->cih)) in dhd_watchdog_thread()
6753 osl_ctfpool_replenish(dhd->pub.osh, CTFPOOL_REFILL_THRESH); in dhd_watchdog_thread()
6756 DHD_GENERAL_LOCK(&dhd->pub, flags); in dhd_watchdog_thread()
6758 dhd->pub.tickcnt++; in dhd_watchdog_thread()
6760 dhd_l2_filter_watchdog(&dhd->pub); in dhd_watchdog_thread()
6762 time_lapse = jiffies - jiffies_at_start; in dhd_watchdog_thread()
6765 if (dhd->wd_timer_valid) { in dhd_watchdog_thread()
6766 mod_timer(&dhd->timer, in dhd_watchdog_thread()
6768 msecs_to_jiffies(dhd_watchdog_ms) - in dhd_watchdog_thread()
6771 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in dhd_watchdog_thread()
6774 DHD_OS_WD_WAKE_UNLOCK(&dhd->pub); in dhd_watchdog_thread()
6781 complete_and_exit(&tsk->completed, 0); in dhd_watchdog_thread()
6789 if (dhd->pub.dongle_reset) { in dhd_watchdog()
6793 if (dhd->thr_wdt_ctl.thr_pid >= 0) { in dhd_watchdog()
6794 up(&dhd->thr_wdt_ctl.sema); in dhd_watchdog()
6799 DHD_OS_WD_WAKE_LOCK(&dhd->pub); in dhd_watchdog()
6802 dhd_bus_watchdog(&dhd->pub); in dhd_watchdog()
6806 dhd_timesync_watchdog(&dhd->pub); in dhd_watchdog()
6809 DHD_GENERAL_LOCK(&dhd->pub, flags); in dhd_watchdog()
6811 dhd->pub.tickcnt++; in dhd_watchdog()
6814 dhd_l2_filter_watchdog(&dhd->pub); in dhd_watchdog()
6817 if (dhd->wd_timer_valid) in dhd_watchdog()
6818 mod_timer(&dhd->timer, jiffies + msecs_to_jiffies(dhd_watchdog_ms)); in dhd_watchdog()
6819 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in dhd_watchdog()
6821 DHD_OS_WD_WAKE_UNLOCK(&dhd->pub); in dhd_watchdog()
6825 if (CTF_ENAB(dhd->cih)) in dhd_watchdog()
6826 osl_ctfpool_replenish(dhd->pub.osh, CTFPOOL_REFILL_THRESH); in dhd_watchdog()
6835 dhd_info_t *dhd = (dhd_info_t *)tsk->parent; in dhd_rpm_state_thread()
6838 if (down_interruptible (&tsk->sema) == 0) { in dhd_rpm_state_thread()
6844 if (tsk->terminated) { in dhd_rpm_state_thread()
6848 if (dhd->pub.dongle_reset == FALSE) { in dhd_rpm_state_thread()
6850 if (dhd->pub.up) { in dhd_rpm_state_thread()
6852 dhd_bus_dw_deassert(&dhd->pub); in dhd_rpm_state_thread()
6854 if (dhd_get_rpm_state(&dhd->pub)) { in dhd_rpm_state_thread()
6855 dhd_runtimepm_state(&dhd->pub); in dhd_rpm_state_thread()
6858 DHD_GENERAL_LOCK(&dhd->pub, flags); in dhd_rpm_state_thread()
6859 time_lapse = jiffies - jiffies_at_start; in dhd_rpm_state_thread()
6862 if (dhd->rpm_timer_valid) { in dhd_rpm_state_thread()
6863 mod_timer(&dhd->rpm_timer, in dhd_rpm_state_thread()
6865 msecs_to_jiffies(dhd_runtimepm_ms) - in dhd_rpm_state_thread()
6869 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in dhd_rpm_state_thread()
6876 complete_and_exit(&tsk->completed, 0); in dhd_rpm_state_thread()
6883 if (dhd->pub.dongle_reset) { in dhd_runtimepm()
6887 if (dhd->thr_rpm_ctl.thr_pid >= 0) { in dhd_runtimepm()
6888 up(&dhd->thr_rpm_ctl.sema); in dhd_runtimepm()
6902 if (!(dhdp->op_mode & DHD_FLAG_MFG_MODE)) { in dhd_runtime_pm_enable()
6921 param.sched_priority = (prio < MAX_RT_PRIO)? prio : (MAX_RT_PRIO-1); in dhd_sched_policy()
6933 if (!dhd->new_freq) in dhd_cpufreq_notifier()
6937 freq->new, freq->cpu)); in dhd_cpufreq_notifier()
6938 *per_cpu_ptr(dhd->new_freq, freq->cpu) = freq->new; in dhd_cpufreq_notifier()
6950 dhd_info_t *dhd = (dhd_info_t *)tsk->parent; in dhd_dpc_thread()
6952 /* This thread doesn't need any user-level access, in dhd_dpc_thread()
6958 param.sched_priority = (dhd_dpc_prio < MAX_RT_PRIO)?dhd_dpc_prio:(MAX_RT_PRIO-1); in dhd_dpc_thread()
6966 dhd->pub.current_dpc = current; in dhd_dpc_thread()
6970 if (dhd->pub.conf->dpc_cpucore >= 0) { in dhd_dpc_thread()
6971 printf("%s: set dpc_cpucore %d\n", __FUNCTION__, dhd->pub.conf->dpc_cpucore); in dhd_dpc_thread()
6972 set_cpus_allowed_ptr(current, cpumask_of(dhd->pub.conf->dpc_cpucore)); in dhd_dpc_thread()
6973 dhd->pub.conf->dpc_cpucore = -1; in dhd_dpc_thread()
6975 if (dhd->pub.conf->dhd_dpc_prio >= 0) { in dhd_dpc_thread()
6977 printf("%s: set dhd_dpc_prio %d\n", __FUNCTION__, dhd->pub.conf->dhd_dpc_prio); in dhd_dpc_thread()
6978 param.sched_priority = (dhd->pub.conf->dhd_dpc_prio < MAX_RT_PRIO)? in dhd_dpc_thread()
6979 dhd->pub.conf->dhd_dpc_prio:(MAX_RT_PRIO-1); in dhd_dpc_thread()
6981 dhd->pub.conf->dhd_dpc_prio = -1; in dhd_dpc_thread()
6988 if (tsk->terminated) { in dhd_dpc_thread()
6989 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_dpc_thread()
6994 if (dhd->pub.busstate != DHD_BUS_DOWN) { in dhd_dpc_thread()
6998 dhd_os_wd_timer_extend(&dhd->pub, TRUE); in dhd_dpc_thread()
6999 while (dhd_bus_dpc(dhd->pub.bus)) { in dhd_dpc_thread()
7007 dhd->pub.dhd_bug_on = true; in dhd_dpc_thread()
7013 dhd_os_wd_timer_extend(&dhd->pub, FALSE); in dhd_dpc_thread()
7014 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_dpc_thread()
7016 if (dhd->pub.up) in dhd_dpc_thread()
7017 dhd_bus_stop(dhd->pub.bus, TRUE); in dhd_dpc_thread()
7018 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_dpc_thread()
7024 complete_and_exit(&tsk->completed, 0); in dhd_dpc_thread()
7031 dhd_info_t *dhd = (dhd_info_t *)tsk->parent; in dhd_rxf_thread()
7036 dhd_pub_t *pub = &dhd->pub; in dhd_rxf_thread()
7038 /* This thread doesn't need any user-level access, in dhd_rxf_thread()
7044 param.sched_priority = (dhd_rxf_prio < MAX_RT_PRIO)?dhd_rxf_prio:(MAX_RT_PRIO-1); in dhd_rxf_thread()
7049 dhd->pub.current_rxf = current; in dhd_rxf_thread()
7053 if (dhd->pub.conf->rxf_cpucore >= 0) { in dhd_rxf_thread()
7054 printf("%s: set rxf_cpucore %d\n", __FUNCTION__, dhd->pub.conf->rxf_cpucore); in dhd_rxf_thread()
7055 set_cpus_allowed_ptr(current, cpumask_of(dhd->pub.conf->rxf_cpucore)); in dhd_rxf_thread()
7056 dhd->pub.conf->rxf_cpucore = -1; in dhd_rxf_thread()
7058 if (down_interruptible(&tsk->sema) == 0) { in dhd_rxf_thread()
7066 if (tsk->terminated) { in dhd_rxf_thread()
7076 void *skbnext = PKTNEXT(pub->osh, skb); in dhd_rxf_thread()
7077 PKTSETNEXT(pub->osh, skb, NULL); in dhd_rxf_thread()
7089 if (OSL_SYSUPTIME() - watchdogTime > RXF_WATCHDOG_TIME) { in dhd_rxf_thread()
7100 complete_and_exit(&tsk->completed, 0); in dhd_rxf_thread()
7109 if (!dhdp || !dhdp->info) in dhd_dpc_enable()
7111 dhd = dhdp->info; in dhd_dpc_enable()
7115 __skb_queue_head_init(&dhd->rx_pend_queue); in dhd_dpc_enable()
7119 skb_queue_head_init(&dhd->tx_pend_queue); in dhd_dpc_enable()
7134 dhd = dhdp->info; in dhd_dpc_kill()
7140 if (dhd->thr_dpc_ctl.thr_pid < 0) { in dhd_dpc_kill()
7141 tasklet_kill(&dhd->tasklet); in dhd_dpc_kill()
7145 cancel_delayed_work_sync(&dhd->dhd_dpc_dispatcher_work); in dhd_dpc_kill()
7148 cancel_work_sync(&dhd->rx_napi_dispatcher_work); in dhd_dpc_kill()
7149 __skb_queue_purge(&dhd->rx_pend_queue); in dhd_dpc_kill()
7152 cancel_work_sync(&dhd->tx_dispatcher_work); in dhd_dpc_kill()
7153 skb_queue_purge(&dhd->tx_pend_queue); in dhd_dpc_kill()
7154 tasklet_kill(&dhd->tx_tasklet); in dhd_dpc_kill()
7168 dhd = dhdp->info; in dhd_dpc_tasklet_kill()
7174 if (dhd->thr_dpc_ctl.thr_pid < 0) { in dhd_dpc_tasklet_kill()
7175 tasklet_kill(&dhd->tasklet); in dhd_dpc_tasklet_kill()
7189 atomic_set(&dhd->dpc_cpu, curr_cpu); in dhd_dpc()
7196 if (dhd->pub.busstate != DHD_BUS_DOWN) { in dhd_dpc()
7198 DHD_LB_STATS_INCR(dhd->dhd_dpc_cnt); in dhd_dpc()
7200 if (dhd_bus_dpc(dhd->pub.bus)) { in dhd_dpc()
7201 tasklet_schedule(&dhd->tasklet); in dhd_dpc()
7204 dhd_bus_stop(dhd->pub.bus, TRUE); in dhd_dpc()
7208 atomic_set(&dhd->prev_dpc_cpu, curr_cpu); in dhd_dpc()
7215 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_sched_dpc()
7217 if (dhd->thr_dpc_ctl.thr_pid >= 0) { in dhd_sched_dpc()
7222 if (!binary_sema_up(&dhd->thr_dpc_ctl)) { in dhd_sched_dpc()
7227 tasklet_schedule(&dhd->tasklet); in dhd_sched_dpc()
7235 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_sched_rxf()
7251 } while (retry-- > 0); in dhd_sched_rxf()
7257 void *skbnext = PKTNEXT(dhdp->osh, skbp); in dhd_sched_rxf()
7258 PKTSETNEXT(dhdp->osh, skbp, NULL); in dhd_sched_rxf()
7266 if (dhd->thr_rxf_ctl.thr_pid >= 0) { in dhd_sched_rxf()
7267 up(&dhd->thr_rxf_ctl.sema); in dhd_sched_rxf()
7275 if (dhd->thr_rxf_ctl.thr_pid >= 0) { in dhd_sched_rxf()
7276 up(&dhd->thr_rxf_ctl.sema); in dhd_sched_rxf()
7295 ret = dhd_iovar(&dhd->pub, ifidx, "toe_ol", NULL, 0, (char *)&buf, sizeof(buf), FALSE); in dhd_toe_get()
7298 if (ret == -EIO) { in dhd_toe_get()
7299 DHD_ERROR(("%s: toe not supported by device\n", dhd_ifname(&dhd->pub, in dhd_toe_get()
7301 return -EOPNOTSUPP; in dhd_toe_get()
7304 DHD_INFO(("%s: could not get toe_ol: ret=%d\n", dhd_ifname(&dhd->pub, ifidx), ret)); in dhd_toe_get()
7319 ret = dhd_iovar(&dhd->pub, ifidx, "toe_ol", (char *)&toe_ol, sizeof(toe_ol), NULL, 0, TRUE); in dhd_toe_set()
7322 dhd_ifname(&dhd->pub, ifidx), ret)); in dhd_toe_set()
7328 ret = dhd_iovar(&dhd->pub, ifidx, "toe", (char *)&toe, sizeof(toe), NULL, 0, TRUE); in dhd_toe_set()
7330 DHD_ERROR(("%s: could not set toe: ret=%d\n", dhd_ifname(&dhd->pub, ifidx), ret)); in dhd_toe_set()
7345 if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) { in dhd_set_scb_probe()
7372 snprintf(info->driver, sizeof(info->driver), "wl"); in dhd_ethtool_get_drvinfo()
7373 snprintf(info->version, sizeof(info->version), "%lu", dhd->pub.drv_version); in dhd_ethtool_get_drvinfo()
7396 return -EFAULT; in dhd_ethtool()
7403 return -EFAULT; in dhd_ethtool()
7404 if (info.driver[sizeof(info.driver) - 1] != '\0') { in dhd_ethtool()
7407 info.driver[sizeof(info.driver) - 1] = '\0'; in dhd_ethtool()
7422 else if (!dhd->pub.up) { in dhd_ethtool()
7424 return -ENODEV; in dhd_ethtool()
7428 else if (dhd->pub.iswl) in dhd_ethtool()
7433 snprintf(info.version, sizeof(info.version), "%lu", dhd->pub.drv_version); in dhd_ethtool()
7435 return -EFAULT; in dhd_ethtool()
7453 return -EFAULT; in dhd_ethtool()
7460 return -EFAULT; in dhd_ethtool()
7479 dhd->iflist[0]->net->features |= NETIF_F_IP_CSUM; in dhd_ethtool()
7481 dhd->iflist[0]->net->features &= ~NETIF_F_IP_CSUM; in dhd_ethtool()
7488 return -EOPNOTSUPP; in dhd_ethtool()
7503 if (!dhdp->up) in dhd_check_hang()
7507 if (dhdp->info->thr_dpc_ctl.thr_pid < 0) { in dhd_check_hang()
7508 DHD_ERROR(("%s : skipped due to negative pid - unloading?\n", __FUNCTION__)); in dhd_check_hang()
7513 if ((error == -ETIMEDOUT) || (error == -EREMOTEIO) || in dhd_check_hang()
7514 ((dhdp->busstate == DHD_BUS_DOWN) && (!dhdp->dongle_reset))) { in dhd_check_hang()
7517 __FUNCTION__, dhdp->rxcnt_timeout, dhdp->txcnt_timeout, in dhd_check_hang()
7518 dhdp->d3ackcnt_timeout, error, dhdp->busstate)); in dhd_check_hang()
7521 dhdp->rxcnt_timeout, dhdp->txcnt_timeout, error, dhdp->busstate)); in dhd_check_hang()
7523 if (dhdp->hang_reason == 0) { in dhd_check_hang()
7524 if (dhdp->dongle_trap_occured) { in dhd_check_hang()
7525 dhdp->hang_reason = HANG_REASON_DONGLE_TRAP; in dhd_check_hang()
7527 } else if (dhdp->d3ackcnt_timeout) { in dhd_check_hang()
7528 dhdp->hang_reason = dhdp->is_sched_error ? in dhd_check_hang()
7533 dhdp->hang_reason = dhdp->is_sched_error ? in dhd_check_hang()
7539 printf("MAC %pM\n", &dhdp->mac); in dhd_check_hang()
7551 return (dhd->info->monitor_type != 0); in dhd_monitor_enabled()
7558 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_rx_mon_pkt_sdio()
7560 if (!dhd->monitor_skb) { in dhd_rx_mon_pkt_sdio()
7561 if ((dhd->monitor_skb = PKTTONATIVE(dhdp->osh, pkt)) == NULL) in dhd_rx_mon_pkt_sdio()
7565 if (dhd->monitor_type && dhd->monitor_dev) in dhd_rx_mon_pkt_sdio()
7566 dhd->monitor_skb->dev = dhd->monitor_dev; in dhd_rx_mon_pkt_sdio()
7568 PKTFREE(dhdp->osh, pkt, FALSE); in dhd_rx_mon_pkt_sdio()
7569 dhd->monitor_skb = NULL; in dhd_rx_mon_pkt_sdio()
7573 dhd->monitor_skb->protocol = in dhd_rx_mon_pkt_sdio()
7574 eth_type_trans(dhd->monitor_skb, dhd->monitor_skb->dev); in dhd_rx_mon_pkt_sdio()
7575 dhd->monitor_len = 0; in dhd_rx_mon_pkt_sdio()
7577 netif_rx_ni(dhd->monitor_skb); in dhd_rx_mon_pkt_sdio()
7579 dhd->monitor_skb = NULL; in dhd_rx_mon_pkt_sdio()
7586 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_rx_mon_pkt()
7588 if (dhd->host_radiotap_conv) { in dhd_rx_mon_pkt()
7592 memcpy(&pkt_info.marker, &msg->marker, sizeof(msg->marker)); in dhd_rx_mon_pkt()
7593 memcpy(&pkt_info.ts, &msg->ts, sizeof(monitor_pkt_ts_t)); in dhd_rx_mon_pkt()
7595 if (!dhd->monitor_skb) { in dhd_rx_mon_pkt()
7596 if ((dhd->monitor_skb = dev_alloc_skb(MAX_MON_PKT_SIZE)) == NULL) in dhd_rx_mon_pkt()
7600 len = bcmwifi_monitor(dhd->monitor_info, &pkt_info, PKTDATA(dhdp->osh, pkt), in dhd_rx_mon_pkt()
7601 PKTLEN(dhdp->osh, pkt), PKTDATA(dhdp->osh, dhd->monitor_skb), &offset); in dhd_rx_mon_pkt()
7603 if (dhd->monitor_type && dhd->monitor_dev) in dhd_rx_mon_pkt()
7604 dhd->monitor_skb->dev = dhd->monitor_dev; in dhd_rx_mon_pkt()
7606 PKTFREE(dhdp->osh, pkt, FALSE); in dhd_rx_mon_pkt()
7607 dev_kfree_skb(dhd->monitor_skb); in dhd_rx_mon_pkt()
7611 PKTFREE(dhdp->osh, pkt, FALSE); in dhd_rx_mon_pkt()
7617 skb_put(dhd->monitor_skb, len); in dhd_rx_mon_pkt()
7618 skb_pull(dhd->monitor_skb, offset); in dhd_rx_mon_pkt()
7620 dhd->monitor_skb->protocol = eth_type_trans(dhd->monitor_skb, in dhd_rx_mon_pkt()
7621 dhd->monitor_skb->dev); in dhd_rx_mon_pkt()
7626 uint8 amsdu_flag = (msg->flags & BCMPCIE_PKT_FLAGS_MONITOR_MASK) >> in dhd_rx_mon_pkt()
7631 if (!dhd->monitor_skb) { in dhd_rx_mon_pkt()
7632 if ((dhd->monitor_skb = PKTTONATIVE(dhdp->osh, pkt)) in dhd_rx_mon_pkt()
7636 if (dhd->monitor_type && dhd->monitor_dev) in dhd_rx_mon_pkt()
7637 dhd->monitor_skb->dev = dhd->monitor_dev; in dhd_rx_mon_pkt()
7639 PKTFREE(dhdp->osh, pkt, FALSE); in dhd_rx_mon_pkt()
7640 dhd->monitor_skb = NULL; in dhd_rx_mon_pkt()
7643 dhd->monitor_skb->protocol = in dhd_rx_mon_pkt()
7644 eth_type_trans(dhd->monitor_skb, dhd->monitor_skb->dev); in dhd_rx_mon_pkt()
7645 dhd->monitor_len = 0; in dhd_rx_mon_pkt()
7649 if (!dhd->monitor_skb) { in dhd_rx_mon_pkt()
7650 if ((dhd->monitor_skb = dev_alloc_skb(MAX_MON_PKT_SIZE)) in dhd_rx_mon_pkt()
7653 dhd->monitor_len = 0; in dhd_rx_mon_pkt()
7655 if (dhd->monitor_type && dhd->monitor_dev) in dhd_rx_mon_pkt()
7656 dhd->monitor_skb->dev = dhd->monitor_dev; in dhd_rx_mon_pkt()
7658 PKTFREE(dhdp->osh, pkt, FALSE); in dhd_rx_mon_pkt()
7659 dev_kfree_skb(dhd->monitor_skb); in dhd_rx_mon_pkt()
7662 memcpy(PKTDATA(dhdp->osh, dhd->monitor_skb), in dhd_rx_mon_pkt()
7663 PKTDATA(dhdp->osh, pkt), PKTLEN(dhdp->osh, pkt)); in dhd_rx_mon_pkt()
7664 dhd->monitor_len = PKTLEN(dhdp->osh, pkt); in dhd_rx_mon_pkt()
7665 PKTFREE(dhdp->osh, pkt, FALSE); in dhd_rx_mon_pkt()
7669 memcpy(PKTDATA(dhdp->osh, dhd->monitor_skb) + dhd->monitor_len, in dhd_rx_mon_pkt()
7670 PKTDATA(dhdp->osh, pkt), PKTLEN(dhdp->osh, pkt)); in dhd_rx_mon_pkt()
7671 dhd->monitor_len += PKTLEN(dhdp->osh, pkt); in dhd_rx_mon_pkt()
7672 PKTFREE(dhdp->osh, pkt, FALSE); in dhd_rx_mon_pkt()
7676 memcpy(PKTDATA(dhdp->osh, dhd->monitor_skb) + dhd->monitor_len, in dhd_rx_mon_pkt()
7677 PKTDATA(dhdp->osh, pkt), PKTLEN(dhdp->osh, pkt)); in dhd_rx_mon_pkt()
7678 dhd->monitor_len += PKTLEN(dhdp->osh, pkt); in dhd_rx_mon_pkt()
7679 PKTFREE(dhdp->osh, pkt, FALSE); in dhd_rx_mon_pkt()
7680 skb_put(dhd->monitor_skb, dhd->monitor_len); in dhd_rx_mon_pkt()
7681 dhd->monitor_skb->protocol = in dhd_rx_mon_pkt()
7682 eth_type_trans(dhd->monitor_skb, dhd->monitor_skb->dev); in dhd_rx_mon_pkt()
7683 dhd->monitor_len = 0; in dhd_rx_mon_pkt()
7688 if (skb_headroom(dhd->monitor_skb) < ETHER_HDR_LEN) { in dhd_rx_mon_pkt()
7692 dhd_ifname(&dhd->pub, ifidx))); in dhd_rx_mon_pkt()
7694 skb2 = skb_realloc_headroom(dhd->monitor_skb, ETHER_HDR_LEN); in dhd_rx_mon_pkt()
7696 dev_kfree_skb(dhd->monitor_skb); in dhd_rx_mon_pkt()
7697 if ((dhd->monitor_skb = skb2) == NULL) { in dhd_rx_mon_pkt()
7699 dhd_ifname(&dhd->pub, ifidx))); in dhd_rx_mon_pkt()
7703 PKTPUSH(dhd->pub.osh, dhd->monitor_skb, ETHER_HDR_LEN); in dhd_rx_mon_pkt()
7705 /* XXX WL here makes sure data is 4-byte aligned? */ in dhd_rx_mon_pkt()
7709 netif_rx(dhd->monitor_skb); in dhd_rx_mon_pkt()
7717 bcm_object_trace_opr(dhd->monitor_skb, BCM_OBJDBG_REMOVE, in dhd_rx_mon_pkt()
7720 netif_rx_ni(dhd->monitor_skb); in dhd_rx_mon_pkt()
7723 dhd->monitor_skb = NULL; in dhd_rx_mon_pkt()
7733 #define DHD_MON_DEV_STATS(dev) (((dhd_mon_dev_priv_t *)DEV_PRIV(dev))->stats)
7747 dhdp->info->bus_user_count++; in dhdsdio_bus_usr_cnt_inc()
7753 dhdp->info->bus_user_count--; in dhdsdio_bus_usr_cnt_dec()
7758 * Failure: Returns -1 or errono code
7764 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_bus_get()
7767 mutex_lock(&dhd->bus_user_lock); in dhd_bus_get()
7768 ++dhd->bus_user_count; in dhd_bus_get()
7769 if (dhd->bus_user_count < 0) { in dhd_bus_get()
7771 ret = -1; in dhd_bus_get()
7775 if (dhd->bus_user_count == 1) { in dhd_bus_get()
7777 dhd->pub.hang_was_sent = 0; in dhd_bus_get()
7782 if (!wifi_platform_set_power(dhd->adapter, TRUE, WIFI_TURNON_DELAY)) { in dhd_bus_get()
7798 dhd_bus_update_fw_nv_path(dhd->pub.bus, in dhd_bus_get()
7799 dhd->fw_path, dhd->nv_path); in dhd_bus_get()
7805 if (dhd_sync_with_dongle(&dhd->pub) < 0) { in dhd_bus_get()
7807 ret = -EFAULT; in dhd_bus_get()
7814 __FUNCTION__, dhd->bus_user_count)); in dhd_bus_get()
7817 mutex_unlock(&dhd->bus_user_lock); in dhd_bus_get()
7824 * Failure: Returns -1 or errono code
7830 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_bus_put()
7834 mutex_lock(&dhd->bus_user_lock); in dhd_bus_put()
7835 --dhd->bus_user_count; in dhd_bus_put()
7836 if (dhd->bus_user_count < 0) { in dhd_bus_put()
7838 dhd->bus_user_count = 0; in dhd_bus_put()
7839 ret = -1; in dhd_bus_put()
7843 if (dhd->bus_user_count == 0) { in dhd_bus_put()
7848 if (dhd->pub.wlfc_enabled) { in dhd_bus_put()
7849 dhd_wlfc_deinit(&dhd->pub); in dhd_bus_put()
7853 if (dhd->pub.pno_state) { in dhd_bus_put()
7854 dhd_pno_deinit(&dhd->pub); in dhd_bus_put()
7858 if (dhd->pub.rtt_state) { in dhd_bus_put()
7859 dhd_rtt_deinit(&dhd->pub); in dhd_bus_put()
7865 wifi_platform_set_power(dhd->adapter, FALSE, WIFI_TURNOFF_DELAY); in dhd_bus_put()
7869 __FUNCTION__, dhd->bus_user_count)); in dhd_bus_put()
7872 mutex_unlock(&dhd->bus_user_lock); in dhd_bus_put()
7881 return dhd_bus_get(&dhd->pub, WLAN_MODULE); in dhd_net_bus_get()
7888 return dhd_bus_put(&dhd->pub, WLAN_MODULE); in dhd_net_bus_put()
7895 * This function is not callable from non-sleepable context
7909 ret = __dhdsdio_clk_enable(dhdp->bus, owner, TRUE); in dhd_bus_clk_enable()
7920 * This function is not callable from non-sleepable context
7934 ret = __dhdsdio_clk_disable(dhdp->bus, owner, TRUE); in dhd_bus_clk_disable()
7944 * This function is not callable from non-sleepable context
7952 dhdsdio_reset_bt_use_count(dhdp->bus); in dhd_bus_reset_bt_use_count()
7960 dhd_info_t *dhd = (dhd_info_t*)dhdp->info; in dhd_bus_retry_hang_recovery()
7962 dhdp->hang_was_sent = 0; in dhd_bus_retry_hang_recovery()
7964 dhd_os_send_hang_message(&dhd->pub); in dhd_bus_retry_hang_recovery()
7995 dhd_pub_t *dhdp = (dhd_pub_t *)&dhd->pub; in dhd_add_monitor_if()
8005 if (dhd->monitor_dev) { in dhd_add_monitor_if()
8018 snprintf(dev->name, sizeof(dev->name), "%s%u", devname, dhd->unit); in dhd_add_monitor_if()
8028 dev->type = ARPHRD_IEEE80211_RADIOTAP; in dhd_add_monitor_if()
8030 dev->netdev_ops = &netdev_monitor_ops; in dhd_add_monitor_if()
8038 __FUNCTION__, dev->name)); in dhd_add_monitor_if()
8043 if (FW_SUPPORTED((&dhd->pub), monitor)) { in dhd_add_monitor_if()
8046 DHD_DISABLE_RUNTIME_PM(&dhd->pub); in dhd_add_monitor_if()
8051 ret = dhd_iovar(&dhd->pub, 0, "scansuppress", (char *)&scan_suppress, in dhd_add_monitor_if()
8059 bcmwifi_monitor_create(&dhd->monitor_info); in dhd_add_monitor_if()
8060 bcmwifi_set_corerev_major(dhd->monitor_info, dhdpcie_get_corerev_major(dhdp)); in dhd_add_monitor_if()
8061 bcmwifi_set_corerev_minor(dhd->monitor_info, dhdpcie_get_corerev_minor(dhdp)); in dhd_add_monitor_if()
8063 dhd->monitor_dev = dev; in dhd_add_monitor_if()
8077 if (!dhd->monitor_dev) { in dhd_del_monitor_if()
8082 if (FW_SUPPORTED((&dhd->pub), monitor)) { in dhd_del_monitor_if()
8085 DHD_ENABLE_RUNTIME_PM(&dhd->pub); in dhd_del_monitor_if()
8090 ret = dhd_iovar(&dhd->pub, 0, "scansuppress", (char *)&scan_suppress, in dhd_del_monitor_if()
8097 if (dhd->monitor_dev) { in dhd_del_monitor_if()
8098 if (dhd->monitor_dev->reg_state == NETREG_UNINITIALIZED) { in dhd_del_monitor_if()
8099 free_netdev(dhd->monitor_dev); in dhd_del_monitor_if()
8102 unregister_netdevice(dhd->monitor_dev); in dhd_del_monitor_if()
8104 unregister_netdev(dhd->monitor_dev); in dhd_del_monitor_if()
8107 dhd->monitor_dev = NULL; in dhd_del_monitor_if()
8110 if (dhd->monitor_info) { in dhd_del_monitor_if()
8111 bcmwifi_monitor_delete(dhd->monitor_info); in dhd_del_monitor_if()
8112 dhd->monitor_info = NULL; in dhd_del_monitor_if()
8120 dhd_info_t *dhd = pub->info; in dhd_set_monitor()
8132 dhd->monitor_type = val; in dhd_set_monitor()
8144 dhd_info_t *info = dhdp->info; in dhd_h2d_log_time_sync_deferred_wq_schedule()
8147 dhd_deferred_schedule_work(info->dhd_deferred_wq, NULL, in dhd_h2d_log_time_sync_deferred_wq_schedule()
8169 dhd = &dhd_info->pub; in dhd_deferred_work_rte_log_time_sync()
8199 if (ioc->driver == DHD_IOCTL_MAGIC) { in dhd_ioctl_process()
8204 __FUNCTION__, ioc->len, MAX_NVRAMBUF_SIZE)); in dhd_ioctl_process()
8205 if (ioc->len > MAX_NVRAMBUF_SIZE) { in dhd_ioctl_process()
8207 __FUNCTION__, ioc->len, MAX_NVRAMBUF_SIZE)); in dhd_ioctl_process()
8211 buflen = ioc->len; in dhd_ioctl_process()
8213 buflen = MIN(ioc->len, DHD_IOCTL_MAXLEN_32K); in dhd_ioctl_process()
8216 buflen = MIN(ioc->len, DHD_IOCTL_MAXLEN); in dhd_ioctl_process()
8221 pub->bcmerror = bcmerror; in dhd_ioctl_process()
8227 buflen = MIN(ioc->len, WLC_IOCTL_MAXLEN); in dhd_ioctl_process()
8231 if (pub->busstate == DHD_BUS_DOWN || pub->busstate == DHD_BUS_LOAD) { in dhd_ioctl_process()
8232 if ((!pub->dongle_trap_occured) && allow_delay_fwdl) { in dhd_ioctl_process()
8251 if (!pub->iswl) { in dhd_ioctl_process()
8259 * Intercept WLC_SET_KEY IOCTL - serialize M4 send and set key IOCTL to in dhd_ioctl_process()
8261 * intercept WLC_DISASSOC IOCTL - serialize WPS-DONE and WLC_DISASSOC IOCTL to in dhd_ioctl_process()
8262 * prevent disassoc frame being sent before WPS-DONE frame. in dhd_ioctl_process()
8264 if (ioc->cmd == WLC_SET_KEY || in dhd_ioctl_process()
8265 (ioc->cmd == WLC_SET_VAR && data_buf != NULL && in dhd_ioctl_process()
8267 (ioc->cmd == WLC_SET_VAR && data_buf != NULL && in dhd_ioctl_process()
8269 ioc->cmd == WLC_DISASSOC) in dhd_ioctl_process()
8272 if ((ioc->cmd == WLC_SET_VAR || ioc->cmd == WLC_GET_VAR) && in dhd_ioctl_process()
8284 if (ioc->cmd == WLC_SET_WPA_AUTH) { in dhd_ioctl_process()
8287 wpa_auth = *((int *)ioc->buf); in dhd_ioctl_process()
8293 pub->secure_join = TRUE; in dhd_ioctl_process()
8298 pub->secure_join = FALSE; in dhd_ioctl_process()
8302 if (ioc->cmd == WLC_SET_AUTH) { in dhd_ioctl_process()
8304 auth = *((int *)ioc->buf); in dhd_ioctl_process()
8311 pub->secure_join = TRUE; in dhd_ioctl_process()
8314 pub->secure_join = FALSE; in dhd_ioctl_process()
8318 if (ioc->cmd == WLC_SET_SSID) { in dhd_ioctl_process()
8319 bool set_ssid_rcvd = OSL_ATOMIC_READ(pub->osh, &pub->set_ssid_rcvd); in dhd_ioctl_process()
8320 if ((!set_ssid_rcvd) && (!pub->secure_join)) { in dhd_ioctl_process()
8325 __FUNCTION__, set_ssid_rcvd, pub->secure_join)); in dhd_ioctl_process()
8326 OSL_ATOMIC_SET(pub->osh, &pub->set_ssid_rcvd, FALSE); in dhd_ioctl_process()
8330 if (ioc->cmd == WLC_SCAN) { in dhd_ioctl_process()
8350 if ((ioc->cmd == WLC_SET_VAR) || (ioc->cmd == WLC_GET_VAR)) { in dhd_nho_iovar_filter()
8351 if ((ioc->len >= sizeof("nan")) && !strcmp(ioc->buf, "nan")) { in dhd_nho_iovar_filter()
8354 } else if ((ioc->len >= sizeof("slot_bss")) && !strcmp(ioc->buf, "slot_bss")) { in dhd_nho_iovar_filter()
8369 err = bcm_nanho_iov(pub->nanhoi, ifidx, (wl_ioctl_t *)ioc); in dhd_nho_ioctl_process()
8386 err = dhd_ioctl_process((dhd_pub_t *)drv_ctx, ifidx, (dhd_ioctl_t *)ioc, ioc->buf); in dhd_nho_ioctl_cb()
8426 DHD_OS_WAKE_LOCK(&dhd->pub); in dhd_ioctl_entry()
8429 /* Interface up check for built-in type */ in dhd_ioctl_entry()
8430 if (!dhd_download_fw_on_driverload && dhd->pub.up == FALSE) { in dhd_ioctl_entry()
8432 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ioctl_entry()
8442 if (dhd_is_static_ndev(&dhd->pub, net) && !(net->flags & IFF_UP)) { in dhd_ioctl_entry()
8443 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ioctl_entry()
8444 return -1; in dhd_ioctl_entry()
8450 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ioctl_entry()
8451 return -1; in dhd_ioctl_entry()
8459 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ioctl_entry()
8465 ret = dhd_ethtool(dhd, (void*)ifr->ifr_data); in dhd_ioctl_entry()
8466 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ioctl_entry()
8473 dhd_check_hang(net, &dhd->pub, ret); in dhd_ioctl_entry()
8474 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ioctl_entry()
8481 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ioctl_entry()
8482 return -EOPNOTSUPP; in dhd_ioctl_entry()
8508 if (copy_from_user(&compat_ioc, ifr->ifr_data, sizeof(compat_wl_ioctl_t))) { in dhd_ioctl_entry()
8516 if (copy_from_user(&ioc, ifr->ifr_data, sizeof(wl_ioctl_t))) { in dhd_ioctl_entry()
8523 if ((copy_from_user(&ioc.driver, (char *)ifr->ifr_data + sizeof(wl_ioctl_t), in dhd_ioctl_entry()
8536 if ((copy_from_user(&ioc.driver, (char *)ifr->ifr_data + sizeof(compat_wl_ioctl_t), in dhd_ioctl_entry()
8546 if (copy_from_user(&ioc, ifr->ifr_data, sizeof(wl_ioctl_t))) { in dhd_ioctl_entry()
8555 if ((copy_from_user(&ioc.driver, (char *)ifr->ifr_data + sizeof(wl_ioctl_t), in dhd_ioctl_entry()
8581 if (!(local_buf = MALLOC(dhd->pub.osh, buflen+1))) { in dhd_ioctl_entry()
8602 if (ioc.driver != DHD_IOCTL_MAGIC && dhd->pub.hang_was_sent) { in dhd_ioctl_entry()
8604 DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(&dhd->pub, DHD_EVENT_TIMEOUT_MS); in dhd_ioctl_entry()
8611 bcmerror = dhd_nho_ioctl_process(&dhd->pub, ifidx, &ioc, local_buf); in dhd_ioctl_entry()
8613 bcmerror = dhd_ioctl_process(&dhd->pub, ifidx, &ioc, local_buf); in dhd_ioctl_entry()
8620 bcmerror = -EFAULT; in dhd_ioctl_entry()
8625 MFREE(dhd->pub.osh, local_buf, buflen+1); in dhd_ioctl_entry()
8627 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ioctl_entry()
8634 * user set the memu "Keep Wi-Fi on during sleep" to "Never"
8643 mutex_init(&dhd->cpufreq_fix); in dhd_init_cpufreq_fix()
8644 dhd->cpufreq_fix_status = FALSE; in dhd_init_cpufreq_fix()
8651 mutex_lock(&dhd->cpufreq_fix); in dhd_fix_cpu_freq()
8652 if (dhd && !dhd->cpufreq_fix_status) { in dhd_fix_cpu_freq()
8653 pm_qos_add_request(&dhd->dhd_cpu_qos, PM_QOS_CPU_FREQ_MIN, 300000); in dhd_fix_cpu_freq()
8655 pm_qos_add_request(&dhd->dhd_bus_qos, PM_QOS_BUS_THROUGHPUT, 400000); in dhd_fix_cpu_freq()
8659 dhd->cpufreq_fix_status = TRUE; in dhd_fix_cpu_freq()
8661 mutex_unlock(&dhd->cpufreq_fix); in dhd_fix_cpu_freq()
8666 mutex_lock(&dhd ->cpufreq_fix); in dhd_rollback_cpu_freq()
8667 if (dhd && dhd->cpufreq_fix_status != TRUE) { in dhd_rollback_cpu_freq()
8668 mutex_unlock(&dhd->cpufreq_fix); in dhd_rollback_cpu_freq()
8672 pm_qos_remove_request(&dhd->dhd_cpu_qos); in dhd_rollback_cpu_freq()
8674 pm_qos_remove_request(&dhd->dhd_bus_qos); in dhd_rollback_cpu_freq()
8678 dhd->cpufreq_fix_status = FALSE; in dhd_rollback_cpu_freq()
8679 mutex_unlock(&dhd->cpufreq_fix); in dhd_rollback_cpu_freq()
8694 if (atomic_read(&dhd->pub.block_bus)) in dhd_ioctl_entry_wrapper()
8695 return -EHOSTDOWN; in dhd_ioctl_entry_wrapper()
8697 if (pm_runtime_get_sync(dhd_bus_to_dev(dhd->pub.bus)) < 0) in dhd_ioctl_entry_wrapper()
8706 pm_runtime_mark_last_busy(dhd_bus_to_dev(dhd->pub.bus)); in dhd_ioctl_entry_wrapper()
8707 pm_runtime_put_autosuspend(dhd_bus_to_dev(dhd->pub.bus)); in dhd_ioctl_entry_wrapper()
8742 DHD_OS_WAKE_LOCK(&dhd->pub); in dhd_stop()
8743 WL_MSG(net->name, "Enter\n"); in dhd_stop()
8744 dhd->pub.rxcnt_timeout = 0; in dhd_stop()
8745 dhd->pub.txcnt_timeout = 0; in dhd_stop()
8748 dhd->pub.d3ackcnt_timeout = 0; in dhd_stop()
8751 mutex_lock(&dhd->pub.ndev_op_sync); in dhd_stop()
8752 if (dhd->pub.up == 0) { in dhd_stop()
8756 if (dhd->pub.req_hang_type) { in dhd_stop()
8758 __FUNCTION__, dhd->pub.req_hang_type)); in dhd_stop()
8759 dhd->pub.req_hang_type = 0; in dhd_stop()
8764 if (!dhd->wl_accel_force_reg_on && dhd_query_bus_erros(&dhd->pub)) { in dhd_stop()
8766 dhd->wl_accel_force_reg_on = TRUE; in dhd_stop()
8782 if ((!dhd->pub.hang_was_sent) && wl_cfg80211_static_if_active(cfg)) { in dhd_stop()
8783 WL_MSG(net->name, "static if operational. skip chip reset.\n"); in dhd_stop()
8790 if (!dhd->pub.hang_was_sent && dhd->pub.skip_dhd_stop) { in dhd_stop()
8791 WL_MSG(net->name, "skip chip reset.\n"); in dhd_stop()
8808 DHD_STOP_RPM_TIMER(&dhd->pub); in dhd_stop()
8810 DHD_UP_LOCK(&dhd->pub.up_lock, flags); in dhd_stop()
8811 dhd->pub.up = 0; in dhd_stop()
8812 DHD_UP_UNLOCK(&dhd->pub.up_lock, flags); in dhd_stop()
8814 dhd->pub.up = 0; in dhd_stop()
8817 dhd_bus_inform_ep_loaded_to_rc(&dhd->pub, dhd->pub.up); in dhd_stop()
8820 ifp = dhd->iflist[0]; in dhd_stop()
8826 DHD_STATLOG_CTRL(&dhd->pub, ST(WLAN_POWER_OFF), ifidx, 0); in dhd_stop()
8827 if ((dhd->dhd_state & DHD_ATTACH_STATE_ADD_IF) && in dhd_stop()
8828 (dhd->dhd_state & DHD_ATTACH_STATE_CFG80211)) { in dhd_stop()
8831 dhd_cleanup_m4_state_work(&dhd->pub, ifidx); in dhd_stop()
8834 dhd_dump_pkt_clear(&dhd->pub); in dhd_stop()
8839 dhd_remove_if(&dhd->pub, i, FALSE); in dhd_stop()
8841 if (ifp && ifp->net) { in dhd_stop()
8860 cancel_work_sync(dhd->dhd_deferred_wq); in dhd_stop()
8870 cancel_work_sync(&dhd->bt_log_dispatcher_work); in dhd_stop()
8874 cancel_delayed_work_sync(&dhd->edl_dispatcher_work); in dhd_stop()
8878 __skb_queue_purge(&dhd->rx_pend_queue); in dhd_stop()
8882 skb_queue_purge(&dhd->tx_pend_queue); in dhd_stop()
8886 dhd_tcpack_suppress_set(&dhd->pub, TCPACK_SUP_OFF); in dhd_stop()
8889 if (ifp && ifp->net == dhd->rx_napi_netdev) { in dhd_stop()
8890 DHD_INFO(("%s napi<%p> disabled ifp->net<%p,%s>\n", in dhd_stop()
8891 __FUNCTION__, &dhd->rx_napi_struct, net, net->name)); in dhd_stop()
8892 skb_queue_purge(&dhd->rx_napi_queue); in dhd_stop()
8893 napi_disable(&dhd->rx_napi_struct); in dhd_stop()
8894 netif_napi_del(&dhd->rx_napi_struct); in dhd_stop()
8895 dhd->rx_napi_netdev = NULL; in dhd_stop()
8902 dhd_wlfc_cleanup(&dhd->pub, NULL, 0); in dhd_stop()
8907 dhd_event_logtrace_flush_queue(&dhd->pub); in dhd_stop()
8908 if (dhd->dhd_state & DHD_ATTACH_LOGTRACE_INIT) { in dhd_stop()
8909 if (dhd->event_data.fmts) { in dhd_stop()
8910 MFREE(dhd->pub.osh, dhd->event_data.fmts, in dhd_stop()
8911 dhd->event_data.fmts_size); in dhd_stop()
8913 if (dhd->event_data.raw_fmts) { in dhd_stop()
8914 MFREE(dhd->pub.osh, dhd->event_data.raw_fmts, in dhd_stop()
8915 dhd->event_data.raw_fmts_size); in dhd_stop()
8917 if (dhd->event_data.raw_sstr) { in dhd_stop()
8918 MFREE(dhd->pub.osh, dhd->event_data.raw_sstr, in dhd_stop()
8919 dhd->event_data.raw_sstr_size); in dhd_stop()
8921 if (dhd->event_data.rom_raw_sstr) { in dhd_stop()
8922 MFREE(dhd->pub.osh, dhd->event_data.rom_raw_sstr, in dhd_stop()
8923 dhd->event_data.rom_raw_sstr_size); in dhd_stop()
8925 dhd->dhd_state &= ~DHD_ATTACH_LOGTRACE_INIT; in dhd_stop()
8931 dhd_os_reset_logging(&dhd->pub); in dhd_stop()
8938 dhd_prot_stop(&dhd->pub); in dhd_stop()
8950 wl_android_wifi_accel_off(net, dhd->wl_accel_force_reg_on); in dhd_stop()
8953 dhd_bus_put(&dhd->pub, WLAN_MODULE); in dhd_stop()
8973 * "Keep Wi-Fi on during sleep" to "Never" in dhd_stop()
8981 dhd->pub.hang_was_sent = 0; in dhd_stop()
8982 dhd->pub.hang_was_pending = 0; in dhd_stop()
8984 /* Clear country spec for for built-in type driver */ in dhd_stop()
8986 dhd->pub.dhd_cspec.country_abbrev[0] = 0x00; in dhd_stop()
8987 dhd->pub.dhd_cspec.rev = 0; in dhd_stop()
8988 dhd->pub.dhd_cspec.ccode[0] = 0x00; in dhd_stop()
8996 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_stop()
9000 (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT) && in dhd_stop()
9003 dhd->dhd_state &= ~DHD_ATTACH_STATE_WAKELOCKS_INIT; in dhd_stop()
9009 WL_MSG(net->name, "Exit\n"); in dhd_stop()
9011 mutex_unlock(&dhd->pub.ndev_op_sync); in dhd_stop()
9043 * previous FW mode - dhd->pub.op_mode remember the previous mode in dhd_verify_firmware_mode_change()
9044 * current mode - update fw/nv path, get current FW mode from dhd->fw_path in dhd_verify_firmware_mode_change()
9048 DHD_INFO(("%s : check monitor mode with fw_path : %s\n", __FUNCTION__, dhd->fw_path)); in dhd_verify_firmware_mode_change()
9050 if (strstr(dhd->fw_path, "_mon") != NULL) { in dhd_verify_firmware_mode_change()
9052 dhd->wl_accel_force_reg_on = TRUE; in dhd_verify_firmware_mode_change()
9054 } else if (dhd->pub.monitor_enable == TRUE) { in dhd_verify_firmware_mode_change()
9056 dhd->wl_accel_force_reg_on = TRUE; in dhd_verify_firmware_mode_change()
9063 current_mode, dhd->pub.op_mode)); in dhd_verify_firmware_mode_change()
9065 if (!(dhd->pub.op_mode & current_mode)) { in dhd_verify_firmware_mode_change()
9067 dhd->wl_accel_force_reg_on = TRUE; in dhd_verify_firmware_mode_change()
9104 /* Ignore compiler warnings due to -Werror=cast-qual */ in dhd_wifi_accel_on_work_cb()
9112 dhd->wl_accel_force_reg_on = TRUE; in dhd_wifi_accel_on_work_cb()
9115 if (!dhd->fs_check_retry--) { in dhd_wifi_accel_on_work_cb()
9119 schedule_delayed_work(&dhd->wl_accel_work, in dhd_wifi_accel_on_work_cb()
9124 net = dhd->iflist[0]->net; in dhd_wifi_accel_on_work_cb()
9137 ret = dhd_wl_ioctl_set_intiovar(&dhd->pub, "bus:host_access", 0, WLC_SET_VAR, TRUE, 0); in dhd_wifi_accel_on_work_cb()
9151 dhd->wl_accel_force_reg_on = FALSE; in dhd_wifi_accel_on_work_cb()
9155 dhd->wl_accel_boot_on_done = TRUE; in dhd_wifi_accel_on_work_cb()
9171 uint32 bus_type = -1; in dhd_open()
9172 uint32 bus_num = -1; in dhd_open()
9173 uint32 slot_num = -1; in dhd_open()
9182 if (dhd->pub.hang_was_sent == 1) { in dhd_open()
9187 if (!dhd_download_fw_on_driverload && dhd->pub.up == 1) { in dhd_open()
9191 return -1; in dhd_open()
9196 mutex_lock(&dhd->pub.ndev_op_sync); in dhd_open()
9199 wl_ext_reset_scan_busy(&dhd->pub); in dhd_open()
9202 if (dhd->pub.up == 1) { in dhd_open()
9204 WL_MSG(net->name, "Primary net_device is already up\n"); in dhd_open()
9205 mutex_unlock(&dhd->pub.ndev_op_sync); in dhd_open()
9211 if (dhd->wl_accel_boot_on_done == FALSE) { in dhd_open()
9213 dhd_wifi_accel_on_work_cb(&dhd->wl_accel_work.work); in dhd_open()
9216 mutex_unlock(&dhd->pub.ndev_op_sync); in dhd_open()
9217 return -1; in dhd_open()
9220 if (!dhd->wl_accel_force_reg_on && dhd_query_bus_erros(&dhd->pub)) { in dhd_open()
9222 dhd->wl_accel_force_reg_on = TRUE; in dhd_open()
9227 mutex_unlock(&dhd->pub.ndev_op_sync); in dhd_open()
9228 return -1; in dhd_open()
9232 WL_MSG(net->name, "Enter\n"); in dhd_open()
9236 if (!(dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT)) { in dhd_open()
9238 dhd->dhd_state |= DHD_ATTACH_STATE_WAKELOCKS_INIT; in dhd_open()
9242 skb_queue_head_init(&dhd->evt_trace_queue); in dhd_open()
9244 if (!(dhd->dhd_state & DHD_ATTACH_LOGTRACE_INIT)) { in dhd_open()
9245 ret = dhd_init_logstrs_array(dhd->pub.osh, &dhd->event_data); in dhd_open()
9247 dhd_init_static_strs_array(dhd->pub.osh, &dhd->event_data, in dhd_open()
9249 dhd_init_static_strs_array(dhd->pub.osh, &dhd->event_data, in dhd_open()
9251 dhd->dhd_state |= DHD_ATTACH_LOGTRACE_INIT; in dhd_open()
9257 DHD_OS_WAKE_LOCK(&dhd->pub); in dhd_open()
9258 dhd->pub.dongle_trap_occured = 0; in dhd_open()
9260 dhd->pub.dongle_trap_due_to_bt = 0; in dhd_open()
9262 dhd->pub.hang_was_sent = 0; in dhd_open()
9263 dhd->pub.hang_was_pending = 0; in dhd_open()
9264 dhd->pub.hang_reason = 0; in dhd_open()
9265 dhd->pub.iovar_timeout_occured = 0; in dhd_open()
9267 dhd->pub.d3ack_timeout_occured = 0; in dhd_open()
9268 dhd->pub.livelock_occured = 0; in dhd_open()
9269 dhd->pub.pktid_audit_failed = 0; in dhd_open()
9271 dhd->pub.iface_op_failed = 0; in dhd_open()
9272 dhd->pub.scan_timeout_occurred = 0; in dhd_open()
9273 dhd->pub.scan_busy_occurred = 0; in dhd_open()
9274 dhd->pub.smmu_fault_occurred = 0; in dhd_open()
9276 dhd->pub.dequeue_prec_map = ALLPRIO; in dhd_open()
9279 dhd->pub.permitted_gro = TRUE; in dhd_open()
9290 ret = -1; in dhd_open()
9301 ret = -1; in dhd_open()
9305 if (!dhd->iflist[ifidx]) { in dhd_open()
9307 ret = -1; in dhd_open()
9318 atomic_set(&dhd->pend_8021x_cnt, 0); in dhd_open()
9320 DHD_STATLOG_CTRL(&dhd->pub, ST(WLAN_POWER_ON), ifidx, 0); in dhd_open()
9322 wl_ext_event_attach_netdev(net, ifidx, dhd->iflist[ifidx]->bssidx); in dhd_open()
9328 wl_ext_iapsta_attach_netdev(net, ifidx, dhd->iflist[ifidx]->bssidx); in dhd_open()
9335 * for built-in models. Need to start logtrace kthread before in dhd_open()
9345 ret = wl_android_wifi_accel_on(net, dhd->wl_accel_force_reg_on); in dhd_open()
9348 dhd->wl_accel_force_reg_on = TRUE; in dhd_open()
9350 dhd->wl_accel_force_reg_on = FALSE; in dhd_open()
9354 ret = dhd_bus_get(&dhd->pub, WLAN_MODULE); in dhd_open()
9363 ret = -1; in dhd_open()
9371 * "Keep Wi-Fi on during sleep" to "Never" in dhd_open()
9389 if (dhd->pub.conf->dpc_cpucore >= 0) { in dhd_open()
9390 dhd_bus_get_ids(dhd->pub.bus, &bus_type, &bus_num, &slot_num); in dhd_open()
9393 printf("%s: set irq affinity hit %d\n", __FUNCTION__, dhd->pub.conf->dpc_cpucore); in dhd_open()
9394 irq_set_affinity_hint(adapter->irq_num, cpumask_of(dhd->pub.conf->dpc_cpucore)); in dhd_open()
9399 if (dhd->pub.busstate != DHD_BUS_DATA) { in dhd_open()
9401 dhd_set_path(&dhd->pub); in dhd_open()
9403 wait_event_interruptible_timeout(dhd->adapter->status_event, in dhd_open()
9404 wifi_get_adapter_status(dhd->adapter, WIFI_STATUS_FW_READY), in dhd_open()
9407 if ((ret = dbus_up(dhd->pub.bus)) != 0) { in dhd_open()
9411 dhd->pub.busstate = DHD_BUS_DATA; in dhd_open()
9413 if ((ret = dhd_sync_with_dongle(&dhd->pub)) < 0) { in dhd_open()
9421 if (pm_runtime_get_sync(dhd_bus_to_dev(dhd->pub.bus)) >= 0) { in dhd_open()
9422 ret = dhd_bus_start(&dhd->pub); in dhd_open()
9423 pm_runtime_mark_last_busy(dhd_bus_to_dev(dhd->pub.bus)); in dhd_open()
9424 pm_runtime_put_autosuspend(dhd_bus_to_dev(dhd->pub.bus)); in dhd_open()
9427 ret = dhd_bus_start(&dhd->pub); in dhd_open()
9432 ret = -1; in dhd_open()
9443 if (dhd->pub.is_bt_recovery_required) { in dhd_open()
9447 dhd->pub.is_bt_recovery_required = FALSE; in dhd_open()
9451 dev_addr_set(net, dhd->pub.mac.octet); in dhd_open()
9456 dhd->iflist[ifidx]->net->features |= NETIF_F_IP_CSUM; in dhd_open()
9458 dhd->iflist[ifidx]->net->features &= ~NETIF_F_IP_CSUM; in dhd_open()
9464 dhd->iflist[ifidx]->net->features |= NETIF_F_GRO; in dhd_open()
9468 dhd->iflist[ifidx]->net->needed_headroom = DOT11_LLC_SNAP_HDR_LEN; in dhd_open()
9472 __skb_queue_head_init(&dhd->rx_pend_queue); in dhd_open()
9473 if (dhd->rx_napi_netdev == NULL) { in dhd_open()
9474 dhd->rx_napi_netdev = dhd->iflist[ifidx]->net; in dhd_open()
9475 memset(&dhd->rx_napi_struct, 0, sizeof(struct napi_struct)); in dhd_open()
9476 netif_napi_add(dhd->rx_napi_netdev, &dhd->rx_napi_struct, in dhd_open()
9478 DHD_INFO(("%s napi<%p> enabled ifp->net<%p,%s> dhd_napi_weight: %d\n", in dhd_open()
9479 __FUNCTION__, &dhd->rx_napi_struct, net, in dhd_open()
9480 net->name, dhd_napi_weight)); in dhd_open()
9481 napi_enable(&dhd->rx_napi_struct); in dhd_open()
9483 skb_queue_head_init(&dhd->rx_napi_queue); in dhd_open()
9484 __skb_queue_head_init(&dhd->rx_process_queue); in dhd_open()
9490 skb_queue_head_init(&dhd->tx_pend_queue); in dhd_open()
9492 dhd->dhd_lb_candidacy_override = FALSE; in dhd_open()
9501 ret = -1; in dhd_open()
9506 dhd->pend_ipaddr = 0; in dhd_open()
9521 dhd_bus_aspm_enable_rc_ep(dhd->pub.bus, TRUE); in dhd_open()
9524 dhd_irq_set_affinity(&dhd->pub, cpumask_of(0)); in dhd_open()
9527 dhd_set_scb_probe(&dhd->pub); in dhd_open()
9533 ret = -1; in dhd_open()
9539 if (dhd->pub.conf) { in dhd_open()
9540 wl_android_ext_priv_cmd(net, dhd->pub.conf->isam_init, 0, &bytes_written); in dhd_open()
9541 wl_android_ext_priv_cmd(net, dhd->pub.conf->isam_config, 0, &bytes_written); in dhd_open()
9542 wl_android_ext_priv_cmd(net, dhd->pub.conf->isam_enable, 0, &bytes_written); in dhd_open()
9548 dhd->pub.up = 1; in dhd_open()
9550 dhd_bus_inform_ep_loaded_to_rc(&dhd->pub, dhd->pub.up); in dhd_open()
9552 DHD_START_RPM_TIMER(&dhd->pub); in dhd_open()
9556 dhd->pub.wl_event_enabled = true; in dhd_open()
9558 dhd->pub.wl_event_enabled = false; in dhd_open()
9563 dhd->pub.logtrace_pkt_sendup = true; in dhd_open()
9565 dhd->pub.logtrace_pkt_sendup = false; in dhd_open()
9571 dhd_dbgfs_init(&dhd->pub); in dhd_open()
9575 mutex_unlock(&dhd->pub.ndev_op_sync); in dhd_open()
9588 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_open()
9590 WL_MSG(net->name, "Exit ret=%d\n", ret); in dhd_open()
9613 WL_MSG(net->name, "tx queue started\n"); in dhd_pri_open()
9637 WL_MSG(net->name, "tx queue stopped\n"); in dhd_pri_stop()
9679 WL_MSG(net->name, "non-static interface ..do nothing\n"); in dhd_static_if_open()
9684 WL_MSG(net->name, "Enter\n"); in dhd_static_if_open()
9689 WL_MSG(net->name, "switch to EasyMesh fw\n"); in dhd_static_if_open()
9690 dhd->pub.conf->fw_type = FW_TYPE_EZMESH; in dhd_static_if_open()
9710 WL_MSG(net->name, "Exit ret=%d\n", ret); in dhd_static_if_open()
9723 WL_MSG(net->name, "Enter\n"); in dhd_static_if_stop()
9727 DHD_TRACE(("non-static interface (%s)..do nothing \n", net->name)); in dhd_static_if_stop()
9731 if (dhd->pub.skip_dhd_stop) { in dhd_static_if_stop()
9732 WL_MSG(net->name, "Exit skip stop\n"); in dhd_static_if_stop()
9744 if (dhd->pub.up == 0) { in dhd_static_if_stop()
9754 if (dhd->pub.conf->fw_type == FW_TYPE_EZMESH) { in dhd_static_if_stop()
9755 WL_MSG(net->name, "switch to STA fw\n"); in dhd_static_if_stop()
9756 dhd->pub.conf->fw_type = FW_TYPE_STA; in dhd_static_if_stop()
9759 if (!(primary_netdev->flags & IFF_UP)) { in dhd_static_if_stop()
9764 WL_MSG(net->name, "Exit ret=%d\n", ret); in dhd_static_if_stop()
9777 return -EINVAL; in dhd_do_driver_init()
9788 if (dhd->pub.busstate == DHD_BUS_DATA) { in dhd_do_driver_init()
9795 ret = -1; in dhd_do_driver_init()
9809 if (wl_cfg80211_notify_ifadd(dhd_linux_get_primary_netdev(&dhdinfo->pub), in dhd_event_ifadd()
9810 ifevent->ifidx, name, mac, ifevent->bssidx, ifevent->role) == BCME_OK) in dhd_event_ifadd()
9819 if (ifevent->ifidx > 0) { in dhd_event_ifadd()
9820 dhd_if_event_t *if_event = MALLOC(dhdinfo->pub.osh, sizeof(dhd_if_event_t)); in dhd_event_ifadd()
9823 MALLOCED(dhdinfo->pub.osh))); in dhd_event_ifadd()
9827 memcpy(&if_event->event, ifevent, sizeof(if_event->event)); in dhd_event_ifadd()
9828 memcpy(if_event->mac, mac, ETHER_ADDR_LEN); in dhd_event_ifadd()
9829 strlcpy(if_event->name, name, sizeof(if_event->name)); in dhd_event_ifadd()
9830 dhd_deferred_schedule_work(dhdinfo->dhd_deferred_wq, (void *)if_event, in dhd_event_ifadd()
9843 if (wl_cfg80211_notify_ifdel(dhd_linux_get_primary_netdev(&dhdinfo->pub), in dhd_event_ifdel()
9844 ifevent->ifidx, name, mac, ifevent->bssidx) == BCME_OK) in dhd_event_ifdel()
9851 if_event = MALLOC(dhdinfo->pub.osh, sizeof(dhd_if_event_t)); in dhd_event_ifdel()
9854 MALLOCED(dhdinfo->pub.osh))); in dhd_event_ifdel()
9857 memcpy(&if_event->event, ifevent, sizeof(if_event->event)); in dhd_event_ifdel()
9858 memcpy(if_event->mac, mac, ETHER_ADDR_LEN); in dhd_event_ifdel()
9859 strlcpy(if_event->name, name, sizeof(if_event->name)); in dhd_event_ifdel()
9860 dhd_deferred_schedule_work(dhdinfo->dhd_deferred_wq, (void *)if_event, DHD_WQ_WORK_IF_DEL, in dhd_event_ifdel()
9874 wl_cfg80211_notify_ifchange(dhd_linux_get_primary_netdev(&dhdinfo->pub), in dhd_event_ifchange()
9875 ifevent->ifidx, name, mac, ifevent->bssidx); in dhd_event_ifchange()
9882 if_event = MALLOC(dhdinfo->pub.osh, sizeof(dhd_if_event_t)); in dhd_event_ifchange()
9885 MALLOCED(dhdinfo->pub.osh))); in dhd_event_ifchange()
9888 memcpy(&if_event->event, ifevent, sizeof(if_event->event)); in dhd_event_ifchange()
9890 if_event->event.ifidx = dhd_ifname2idx(dhdinfo, name); in dhd_event_ifchange()
9891 if_event->event.opcode = WLC_E_IF_CHANGE; in dhd_event_ifchange()
9892 memcpy(if_event->mac, mac, ETHER_ADDR_LEN); in dhd_event_ifchange()
9893 strncpy(if_event->name, name, IFNAMSIZ); in dhd_event_ifchange()
9894 if_event->name[IFNAMSIZ - 1] = '\0'; in dhd_event_ifchange()
9895 dhd_deferred_schedule_work(dhdinfo->dhd_deferred_wq, (void *)if_event, DHD_WQ_WORK_IF_UPDATE, in dhd_event_ifchange()
9909 dhd_nfct_info_t *nfct = dhd->pub.nfct; in dhd_natoe_ct_event_hanlder()
9920 if (natoe->natoe_active && natoe->sta_ip && natoe->start_port && natoe->end_port && in dhd_natoe_ct_event_hanlder()
9921 (natoe->start_port < natoe->end_port)) { in dhd_natoe_ct_event_hanlder()
9923 if (dhd_ct_nl_bind(nfct, nfct->subscriptions) < 0) { in dhd_natoe_ct_event_hanlder()
9927 } else if (!natoe->natoe_active) { in dhd_natoe_ct_event_hanlder()
9943 if (dhd->nfct) { in dhd_natoe_ct_event()
9944 wl_event_data_natoe_t *natoe = dhd->nfct->natoe_info; in dhd_natoe_ct_event()
9945 uint8 prev_enable = natoe->natoe_active; in dhd_natoe_ct_event()
9947 spin_lock_bh(&dhd->nfct_lock); in dhd_natoe_ct_event()
9949 spin_unlock_bh(&dhd->nfct_lock); in dhd_natoe_ct_event()
9951 if (prev_enable != event_data->natoe_active) { in dhd_natoe_ct_event()
9952 dhd_deferred_schedule_work(dhd->info->dhd_deferred_wq, in dhd_natoe_ct_event()
9979 if (dhd_natoe_prep_send_exception_port_ioctl(&dhd->pub, ct_ioc) < 0) { in dhd_natoe_ct_ioctl_handler()
9991 dhd_deferred_schedule_work(dhd->info->dhd_deferred_wq, (void *)ioc, in dhd_natoe_ct_ioctl_schedule_work()
10003 u32 ifidx = (DHD_MAX_IFS + DHD_MAX_STATIC_IFS - 1); in dhd_get_ifp_by_ndev()
10005 u32 ifidx = (DHD_MAX_IFS - 1); in dhd_get_ifp_by_ndev()
10008 dhd_info_t *dhdinfo = (dhd_info_t *)dhdp->info; in dhd_get_ifp_by_ndev()
10010 ifp = dhdinfo->iflist[ifidx]; in dhd_get_ifp_by_ndev()
10011 if (ifp && (ifp->net == ndev)) { in dhd_get_ifp_by_ndev()
10013 ndev->name, ifidx)); in dhd_get_ifp_by_ndev()
10016 } while (ifidx--); in dhd_get_ifp_by_ndev()
10018 DHD_ERROR(("no entry found for %s\n", ndev->name)); in dhd_get_ifp_by_ndev()
10034 return (ifp && (ifp->static_if == true)); in dhd_is_static_ndev()
10046 dhd_info_t *dhdinfo = (dhd_info_t *)dhdp->info; in dhd_update_iflist_info()
10057 return -ENODEV; in dhd_update_iflist_info()
10059 cur_idx = ifp->idx; in dhd_update_iflist_info()
10063 ifp->static_if = TRUE; in dhd_update_iflist_info()
10067 ifp_new = dhdinfo->iflist[ifidx]; in dhd_update_iflist_info()
10072 dhdp->hang_reason = HANG_REASON_IFACE_ADD_FAILURE; in dhd_update_iflist_info()
10073 net_os_send_hang_message(ifp->net); in dhd_update_iflist_info()
10074 return -EINVAL; in dhd_update_iflist_info()
10080 dhd_cleanup_if(ifp->net); in dhd_update_iflist_info()
10082 dev_priv->ifidx = ifidx; in dhd_update_iflist_info()
10086 dhdinfo->iflist[ifidx] = ifp; in dhd_update_iflist_info()
10087 dhdinfo->iflist[cur_idx] = NULL; in dhd_update_iflist_info()
10090 ifp->idx = ifidx; in dhd_update_iflist_info()
10091 ifp->bssidx = bssidx; in dhd_update_iflist_info()
10097 strncpy(ifp->dngl_name, dngl_name, IFNAMSIZ); in dhd_update_iflist_info()
10098 } else if (ndev->name[0] != '\0') { in dhd_update_iflist_info()
10099 strncpy(ifp->dngl_name, ndev->name, IFNAMSIZ); in dhd_update_iflist_info()
10101 if (mac != NULL && ifp->set_macaddress == FALSE) { in dhd_update_iflist_info()
10102 /* To and fro locations have same size - ETHER_ADDR_LEN */ in dhd_update_iflist_info()
10103 (void)memcpy_s(&ifp->mac_addr, ETHER_ADDR_LEN, mac, ETHER_ADDR_LEN); in dhd_update_iflist_info()
10142 dhd_info_t *dhdinfo = (dhd_info_t *)dhdpub->info; in dhd_allocate_if()
10150 ifp = dhdinfo->iflist[ifidx]; in dhd_allocate_if()
10153 if (ifp->net != NULL) { in dhd_allocate_if()
10155 __FUNCTION__, ifp->net->name, ifidx)); in dhd_allocate_if()
10166 dhd_dev_priv_clear(ifp->net); /* clear net_device private */ in dhd_allocate_if()
10168 /* in unregister_netdev case, the interface gets freed by net->destructor in dhd_allocate_if()
10172 net_stat_tizen_unregister(ifp->net); in dhd_allocate_if()
10174 if (ifp->net->reg_state == NETREG_UNINITIALIZED) { in dhd_allocate_if()
10175 free_netdev(ifp->net); in dhd_allocate_if()
10177 dhd_tx_stop_queues(ifp->net); in dhd_allocate_if()
10179 unregister_netdev(ifp->net); in dhd_allocate_if()
10181 unregister_netdevice(ifp->net); in dhd_allocate_if()
10183 ifp->net = NULL; in dhd_allocate_if()
10186 ifp = MALLOC(dhdinfo->pub.osh, sizeof(dhd_if_t)); in dhd_allocate_if()
10188 DHD_ERROR(("%s: OOM - dhd_if_t(%zu)\n", __FUNCTION__, sizeof(dhd_if_t))); in dhd_allocate_if()
10194 ifp->info = dhdinfo; in dhd_allocate_if()
10195 ifp->idx = ifidx; in dhd_allocate_if()
10196 ifp->bssidx = bssidx; in dhd_allocate_if()
10198 ifp->mcast_regen_bss_enable = FALSE; in dhd_allocate_if()
10201 ifp->rx_pkt_chainable = TRUE; in dhd_allocate_if()
10204 memcpy(&ifp->mac_addr, mac, ETHER_ADDR_LEN); in dhd_allocate_if()
10209 ifp->net = alloc_etherdev_mq(DHD_DEV_PRIV_SIZE, MQ_MAX_QUEUES); in dhd_allocate_if()
10211 ifp->net = alloc_etherdev(DHD_DEV_PRIV_SIZE); in dhd_allocate_if()
10214 ifp->net = alloc_etherdev(DHD_DEV_PRIV_SIZE); in dhd_allocate_if()
10217 if (ifp->net == NULL) { in dhd_allocate_if()
10218 DHD_ERROR(("%s: OOM - alloc_etherdev(%zu)\n", __FUNCTION__, sizeof(dhdinfo))); in dhd_allocate_if()
10223 dhd_dev_priv_save(ifp->net, dhdinfo, ifp, ifidx); in dhd_allocate_if()
10226 strlcpy(ifp->net->name, name, IFNAMSIZ); in dhd_allocate_if()
10231 ifp->net->needs_free_netdev = 0; in dhd_allocate_if()
10234 ifp->net->priv_destructor = free_netdev; in dhd_allocate_if()
10236 ifp->net->priv_destructor = dhd_netdev_free; in dhd_allocate_if()
10238 ifp->net->priv_destructor = free_netdev; in dhd_allocate_if()
10243 ifp->net->destructor = free_netdev; in dhd_allocate_if()
10245 ifp->net->destructor = dhd_netdev_free; in dhd_allocate_if()
10247 ifp->net->destructor = free_netdev; in dhd_allocate_if()
10250 strlcpy(ifp->name, ifp->net->name, sizeof(ifp->name)); in dhd_allocate_if()
10251 dhdinfo->iflist[ifidx] = ifp; in dhd_allocate_if()
10255 strlcpy(ifp->dngl_name, dngl_name, sizeof(ifp->dngl_name)); in dhd_allocate_if()
10257 strlcpy(ifp->dngl_name, name, sizeof(ifp->dngl_name)); in dhd_allocate_if()
10262 INIT_LIST_HEAD(&ifp->sta_list); in dhd_allocate_if()
10263 DHD_IF_STA_LIST_LOCK_INIT(&ifp->sta_list_lock); in dhd_allocate_if()
10267 ifp->phnd_arp_table = init_l2_filter_arp_table(dhdpub->osh); in dhd_allocate_if()
10268 ifp->parp_allnode = TRUE; in dhd_allocate_if()
10272 ifp->qosmap_up_table = ((uint8*)MALLOCZ(dhdpub->osh, UP_TABLE_MAX)); in dhd_allocate_if()
10273 ifp->qosmap_up_table_enable = FALSE; in dhd_allocate_if()
10276 DHD_CUMM_CTR_INIT(&ifp->cumm_ctr); in dhd_allocate_if()
10279 INIT_DELAYED_WORK(&ifp->m4state_work, dhd_m4_state_handler); in dhd_allocate_if()
10283 ifp->recv_reassoc_evt = FALSE; in dhd_allocate_if()
10284 ifp->post_roam_evt = FALSE; in dhd_allocate_if()
10288 INIT_WORK(&ifp->blk_tsfl_work, dhd_blk_tsfl_handler); in dhd_allocate_if()
10292 return ifp->net; in dhd_allocate_if()
10296 if (ifp->net != NULL) { in dhd_allocate_if()
10298 if (ifp->net == dhdinfo->rx_napi_netdev) { in dhd_allocate_if()
10299 napi_disable(&dhdinfo->rx_napi_struct); in dhd_allocate_if()
10300 netif_napi_del(&dhdinfo->rx_napi_struct); in dhd_allocate_if()
10301 skb_queue_purge(&dhdinfo->rx_napi_queue); in dhd_allocate_if()
10302 dhdinfo->rx_napi_netdev = NULL; in dhd_allocate_if()
10305 dhd_dev_priv_clear(ifp->net); in dhd_allocate_if()
10306 free_netdev(ifp->net); in dhd_allocate_if()
10307 ifp->net = NULL; in dhd_allocate_if()
10309 MFREE(dhdinfo->pub.osh, ifp, sizeof(*ifp)); in dhd_allocate_if()
10311 dhdinfo->iflist[ifidx] = NULL; in dhd_allocate_if()
10320 if_flow_lkup_t *if_flow_lkup = (if_flow_lkup_t *)dhdp->if_flow_lkup; in dhd_cleanup_ifp()
10324 if ((ifp->idx < 0) || (ifp->idx >= DHD_MAX_IFS)) { in dhd_cleanup_ifp()
10325 DHD_ERROR(("Wrong idx:%d \n", ifp->idx)); in dhd_cleanup_ifp()
10330 bcm_l2_filter_arp_table_update(dhdpub->osh, ifp->phnd_arp_table, TRUE, in dhd_cleanup_ifp()
10331 NULL, FALSE, dhdpub->tickcnt); in dhd_cleanup_ifp()
10332 deinit_l2_filter_arp_table(dhdpub->osh, ifp->phnd_arp_table); in dhd_cleanup_ifp()
10333 ifp->phnd_arp_table = NULL; in dhd_cleanup_ifp()
10337 MFREE(dhdpub->osh, ifp->qosmap_up_table, UP_TABLE_MAX); in dhd_cleanup_ifp()
10338 ifp->qosmap_up_table = NULL; in dhd_cleanup_ifp()
10339 ifp->qosmap_up_table_enable = FALSE; in dhd_cleanup_ifp()
10345 ifidx = ifp->idx; in dhd_cleanup_ifp()
10358 dhd_pub_t *dhdp = &dhdinfo->pub; in dhd_cleanup_if()
10363 if (ifp->idx >= DHD_MAX_IFS) { in dhd_cleanup_if()
10364 DHD_ERROR(("Wrong ifidx: %p, %d\n", ifp, ifp->idx)); in dhd_cleanup_if()
10379 dhd_info_t *dhdinfo = (dhd_info_t *)dhdpub->info; in dhd_remove_if()
10384 ifp = dhdinfo->iflist[ifidx]; in dhd_remove_if()
10388 cancel_delayed_work_sync(&ifp->m4state_work); in dhd_remove_if()
10392 cancel_work_sync(&ifp->blk_tsfl_work); in dhd_remove_if()
10397 if (ifp->static_if) { in dhd_remove_if()
10403 if (ifp->net != NULL) { in dhd_remove_if()
10404 DHD_ERROR(("deleting interface '%s' idx %d\n", ifp->net->name, ifp->idx)); in dhd_remove_if()
10407 ifp->del_in_progress = true; in dhd_remove_if()
10413 timeout = wait_event_timeout(dhdpub->tx_completion_wait, in dhd_remove_if()
10414 ((ifp->tx_paths_active & DHD_TX_CONTEXT_MASK) == 0), in dhd_remove_if()
10424 dhdinfo->iflist[ifidx] = NULL; in dhd_remove_if()
10425 /* in unregister_netdev case, the interface gets freed by net->destructor in dhd_remove_if()
10428 if (ifp->net->reg_state == NETREG_UNINITIALIZED) { in dhd_remove_if()
10429 free_netdev(ifp->net); in dhd_remove_if()
10431 netif_tx_disable(ifp->net); in dhd_remove_if()
10434 custom_rps_map_clear(ifp->net->_rx); in dhd_remove_if()
10437 if (dhdinfo->cih) in dhd_remove_if()
10438 ctf_dev_unregister(dhdinfo->cih, ifp->net); in dhd_remove_if()
10445 unregister_netdev(ifp->net); in dhd_remove_if()
10447 unregister_netdevice(ifp->net); in dhd_remove_if()
10449 if (ifp->dwds) { in dhd_remove_if()
10450 wl_ext_iapsta_dettach_dwds_netdev(ifp->net, ifidx, ifp->bssidx); in dhd_remove_if()
10455 wl_ext_iapsta_dettach_netdev(ifp->net, ifidx); in dhd_remove_if()
10458 wl_escan_event_dettach(ifp->net, ifidx); in dhd_remove_if()
10461 wl_ext_event_dettach_netdev(ifp->net, ifidx); in dhd_remove_if()
10465 ifp->net = NULL; in dhd_remove_if()
10467 ifp->del_in_progress = false; in dhd_remove_if()
10473 DHD_CUMM_CTR_INIT(&ifp->cumm_ctr); in dhd_remove_if()
10475 MFREE(dhdinfo->pub.osh, ifp, sizeof(*ifp)); in dhd_remove_if()
10486 dhd_info_t *dhd = dhdp->info; in dhd_set_qosmap_up_table()
10490 ifp = dhd->iflist[idx]; in dhd_set_qosmap_up_table()
10495 wl_set_up_table(ifp->qosmap_up_table, qos_map_ie); in dhd_set_qosmap_up_table()
10496 ifp->qosmap_up_table_enable = TRUE; in dhd_set_qosmap_up_table()
10566 dhd->cih = NULL; in dhd_ctf_detach()
10570 osl_ctfpool_cleanup(dhd->pub.osh); in dhd_ctf_detach()
10584 return -1; in dhd_os_write_file_posn()
10587 return -1; in dhd_os_write_file_posn()
10600 return -1; in dhd_os_read_file()
10602 return dhd_vfs_read(filep, buf, size, &filep->f_pos); in dhd_os_read_file()
10610 return -1; in dhd_os_seek_file()
10612 /* offset can be -ve */ in dhd_os_seek_file()
10613 filep->f_pos = filep->f_pos + offset; in dhd_os_seek_file()
10670 size = fw->size; in dhd_lookup_map()
10695 read_size = size - mem_offset; in dhd_lookup_map()
10699 ((char *)(fw->data) + mem_offset), read_size); in dhd_lookup_map()
10756 DHD_FUNC_STR_LEN - 1); in dhd_lookup_map()
10767 func, pc - addr1); in dhd_lookup_map()
10781 DHD_FUNC_STR_LEN - 1); in dhd_lookup_map()
10792 func, lr - addr1); in dhd_lookup_map()
10810 mem_offset += (read_size -(len + 1)); in dhd_lookup_map()
10828 dhd_os_seek_file(filep, -(len + 1)); in dhd_lookup_map()
10830 DHD_TRACE(("%s: seek %d \n", __FUNCTION__, -(len + 1))); in dhd_lookup_map()
10878 logstrs_size = (int)fw->size; in dhd_init_logstrs_array()
10884 if (temp->raw_fmts != NULL) { in dhd_init_logstrs_array()
10885 raw_fmts = temp->raw_fmts; /* reuse already malloced raw_fmts */ in dhd_init_logstrs_array()
10893 error = memcpy_s(raw_fmts, logstrs_size, (char *)(fw->data), logstrs_size); in dhd_init_logstrs_array()
10912 if (temp->fmts != NULL) { in dhd_init_logstrs_array()
10913 MFREE(osh, temp->fmts, temp->num_fmts * sizeof(char *)); in dhd_init_logstrs_array()
10916 temp->fmts = NULL; in dhd_init_logstrs_array()
10917 temp->raw_fmts = NULL; in dhd_init_logstrs_array()
10971 temp->raw_sstr = NULL; in dhd_init_static_strs_array()
10973 temp->rom_raw_sstr = NULL; in dhd_init_static_strs_array()
10981 logstrs_size = rodata_end - rodata_start; in dhd_init_static_strs_array()
10982 logfilebase = rodata_start - ramstart; in dhd_init_static_strs_array()
10989 if (strstr(str_file, ram_file_str) != NULL && temp->raw_sstr != NULL) { in dhd_init_static_strs_array()
10990 raw_fmts = temp->raw_sstr; /* reuse already malloced raw_fmts */ in dhd_init_static_strs_array()
10991 } else if (strstr(str_file, rom_file_str) != NULL && temp->rom_raw_sstr != NULL) { in dhd_init_static_strs_array()
10992 raw_fmts = temp->rom_raw_sstr; /* reuse already malloced raw_fmts */ in dhd_init_static_strs_array()
11003 if (error < 0 || (fw == NULL) || (fw->size < logfilebase)) { in dhd_init_static_strs_array()
11009 error = memcpy_s(raw_fmts, logstrs_size, (char *)((fw->data) + logfilebase), in dhd_init_static_strs_array()
11018 temp->raw_sstr = raw_fmts; in dhd_init_static_strs_array()
11019 temp->raw_sstr_size = logstrs_size; in dhd_init_static_strs_array()
11020 temp->rodata_start = rodata_start; in dhd_init_static_strs_array()
11021 temp->rodata_end = rodata_end; in dhd_init_static_strs_array()
11023 temp->rom_raw_sstr = raw_fmts; in dhd_init_static_strs_array()
11024 temp->rom_raw_sstr_size = logstrs_size; in dhd_init_static_strs_array()
11025 temp->rom_rodata_start = rodata_start; in dhd_init_static_strs_array()
11026 temp->rom_rodata_end = rodata_end; in dhd_init_static_strs_array()
11046 temp->raw_sstr = NULL; in dhd_init_static_strs_array()
11048 temp->rom_raw_sstr = NULL; in dhd_init_static_strs_array()
11095 if (temp->raw_fmts != NULL) { in dhd_init_logstrs_array()
11096 raw_fmts = temp->raw_fmts; /* reuse already malloced raw_fmts */ in dhd_init_logstrs_array()
11105 if (dhd_vfs_read(filep, raw_fmts, logstrs_size, &filep->f_pos) != logstrs_size) { in dhd_init_logstrs_array()
11123 if (temp->fmts != NULL) { in dhd_init_logstrs_array()
11124 MFREE(osh, temp->fmts, temp->num_fmts * sizeof(char *)); in dhd_init_logstrs_array()
11134 temp->fmts = NULL; in dhd_init_logstrs_array()
11135 temp->raw_fmts = NULL; in dhd_init_logstrs_array()
11201 temp->raw_sstr = NULL; in dhd_init_static_strs_array()
11203 temp->rom_raw_sstr = NULL; in dhd_init_static_strs_array()
11223 logstrs_size = rodata_end - rodata_start; in dhd_init_static_strs_array()
11224 logfilebase = rodata_start - ramstart; in dhd_init_static_strs_array()
11232 if (strstr(str_file, ram_file_str) != NULL && temp->raw_sstr != NULL) { in dhd_init_static_strs_array()
11233 raw_fmts = temp->raw_sstr; /* reuse already malloced raw_fmts */ in dhd_init_static_strs_array()
11234 } else if (strstr(str_file, rom_file_str) != NULL && temp->rom_raw_sstr != NULL) { in dhd_init_static_strs_array()
11235 raw_fmts = temp->rom_raw_sstr; /* reuse already malloced raw_fmts */ in dhd_init_static_strs_array()
11253 error = dhd_vfs_read(filep, raw_fmts, logstrs_size, (&filep->f_pos)); in dhd_init_static_strs_array()
11260 temp->raw_sstr = raw_fmts; in dhd_init_static_strs_array()
11261 temp->raw_sstr_size = logstrs_size; in dhd_init_static_strs_array()
11262 temp->rodata_start = rodata_start; in dhd_init_static_strs_array()
11263 temp->rodata_end = rodata_end; in dhd_init_static_strs_array()
11265 temp->rom_raw_sstr = raw_fmts; in dhd_init_static_strs_array()
11266 temp->rom_raw_sstr_size = logstrs_size; in dhd_init_static_strs_array()
11267 temp->rom_rodata_start = rodata_start; in dhd_init_static_strs_array()
11268 temp->rom_rodata_end = rodata_end; in dhd_init_static_strs_array()
11292 temp->raw_sstr = NULL; in dhd_init_static_strs_array()
11294 temp->rom_raw_sstr = NULL; in dhd_init_static_strs_array()
11334 bool dongle_isolation = dhdp->dongle_isolation; in dhd_wlan_power_off_handler()
11341 if (dhdp->memdump_enabled) { in dhd_wlan_power_off_handler()
11344 dhdp->collect_sssr = TRUE; in dhd_wlan_power_off_handler()
11346 dhdp->memdump_type = DUMP_TYPE_DUE_TO_BT; in dhd_wlan_power_off_handler()
11353 dhd_bus_stop_queue(dhdp->bus); in dhd_wlan_power_off_handler()
11356 dhdp->dongle_isolation = TRUE; in dhd_wlan_power_off_handler()
11358 dhdp->dongle_isolation = dongle_isolation; /* Restore the old value */ in dhd_wlan_power_off_handler()
11366 bool dongle_isolation = dhdp->dongle_isolation; in dhd_wlan_power_on_handler()
11368 DHD_ERROR(("%s: WLAN DHD re-init reason: %d\n", __FUNCTION__, reason)); in dhd_wlan_power_on_handler()
11370 dhdp->dongle_isolation = TRUE; in dhd_wlan_power_on_handler()
11371 dhd_bus_devreset(dhdp, 0); /* DHD structure re-init */ in dhd_wlan_power_on_handler()
11372 dhdp->dongle_isolation = dongle_isolation; /* Restore the old value */ in dhd_wlan_power_on_handler()
11374 dhd_bus_start_queue(dhdp->bus); in dhd_wlan_power_on_handler()
11390 dhd = pub->info; in dhd_get_rxsz()
11391 net = dhd->iflist[0]->net; in dhd_get_rxsz()
11392 net->hard_header_len = ETH_HLEN + pub->hdrlen; in dhd_get_rxsz()
11403 dhd = pub->info; in dhd_set_path()
11406 if (dhd_update_fw_nv_path(dhd) && dhd->pub.bus) { in dhd_set_path()
11408 __FUNCTION__, dhd->fw_path, dhd->nv_path, dhd->conf_path)); in dhd_set_path()
11409 dhd_bus_update_fw_nv_path(dhd->pub.bus, in dhd_set_path()
11410 dhd->fw_path, dhd->nv_path, dhd->clm_path, dhd->conf_path); in dhd_set_path()
11433 uint32 bus_type = -1; in dhd_attach()
11434 uint32 bus_num = -1; in dhd_attach()
11435 uint32 slot_num = -1; in dhd_attach()
11460 DHD_ERROR(("%s: OOM - alloc dhd_info\n", __FUNCTION__)); in dhd_attach()
11467 dhd->unit = dhd_found + instance_base; /* do not increment dhd_found, yet */ in dhd_attach()
11469 dhd->pub.osh = osh; in dhd_attach()
11471 dll_init(&(dhd->pub.dump_iovlist_head)); in dhd_attach()
11474 dhd->pub.dhd_console_ms = dhd_console_ms; /* assigns default value */ in dhd_attach()
11476 dhd->adapter = adapter; in dhd_attach()
11477 dhd->pub.adapter = (void *)adapter; in dhd_attach()
11479 dhd->pub.is_bt_recovery_required = FALSE; in dhd_attach()
11480 mutex_init(&dhd->bus_user_lock); in dhd_attach()
11483 g_dhd_pub = &dhd->pub; in dhd_attach()
11486 dll_init(&(dhd->pub.mw_list_head)); in dhd_attach()
11490 dhd->pub.dhd_cflags |= WLAN_PLAT_NODFS_FLAG; in dhd_attach()
11491 dhd->pub.force_country_change = TRUE; in dhd_attach()
11494 get_customized_country_code(dhd->adapter, in dhd_attach()
11495 dhd->pub.dhd_cspec.country_abbrev, &dhd->pub.dhd_cspec, in dhd_attach()
11496 dhd->pub.dhd_cflags); in dhd_attach()
11499 dhd->thr_dpc_ctl.thr_pid = DHD_PID_KT_TL_INVALID; in dhd_attach()
11500 dhd->thr_wdt_ctl.thr_pid = DHD_PID_KT_INVALID; in dhd_attach()
11502 dhd->pub.wet_info = dhd_get_wet_info(&dhd->pub); in dhd_attach()
11506 if (bcm_nanho_init(&dhd->pub.nanhoi, &dhd->pub, in dhd_attach()
11512 sema_init(&dhd->sdsem, 1); in dhd_attach()
11515 dhd->host_radiotap_conv = FALSE; in dhd_attach()
11517 dhd->pub.pcie_txs_metadata_enable = pcie_txs_metadata_enable; in dhd_attach()
11520 dhd->pub.info = dhd; in dhd_attach()
11523 dhd->pub.bus = bus; in dhd_attach()
11524 dhd->pub.hdrlen = bus_hdrlen; in dhd_attach()
11525 dhd->pub.txoff = FALSE; in dhd_attach()
11527 dhd->pub.check_trap_rot = TRUE; in dhd_attach()
11529 dhd->pub.check_trap_rot = FALSE; in dhd_attach()
11532 /* dhd_conf must be attached after linking dhd to dhd->pub.info, in dhd_attach()
11535 if (dhd_conf_attach(&dhd->pub) != 0) { in dhd_attach()
11540 dhd_conf_reset(&dhd->pub); in dhd_attach()
11541 dhd_conf_set_chiprev(&dhd->pub, dhd_bus_chip(bus), dhd_bus_chiprev(bus)); in dhd_attach()
11542 dhd_conf_preinit(&dhd->pub); in dhd_attach()
11557 ch = if_name[len - 1]; in dhd_attach()
11558 if ((ch > '9' || ch < '0') && (len < IFNAMSIZ - 2)) { in dhd_attach()
11559 strncat(if_name, "%d", sizeof(if_name) - len - 1); in dhd_attach()
11564 net = dhd_allocate_if(&dhd->pub, 0, if_name, NULL, 0, TRUE, NULL); in dhd_attach()
11568 mutex_init(&dhd->pub.ndev_op_sync); in dhd_attach()
11573 dhd->pub.l2_filter_cnt = 0; in dhd_attach()
11575 net->netdev_ops = NULL; in dhd_attach()
11577 mutex_init(&dhd->dhd_iovar_mutex); in dhd_attach()
11578 sema_init(&dhd->proto_sem, 1); in dhd_attach()
11581 dhd->pub.req_hang_type = 0; in dhd_attach()
11585 spin_lock_init(&dhd->wlfc_spinlock); in dhd_attach()
11587 dhd->pub.skip_fc = dhd_wlfc_skip_fc; in dhd_attach()
11588 dhd->pub.plat_init = dhd_wlfc_plat_init; in dhd_attach()
11589 dhd->pub.plat_deinit = dhd_wlfc_plat_deinit; in dhd_attach()
11592 init_waitqueue_head(&dhd->pub.wlfc_wqhead); in dhd_attach()
11593 dhd->pub.wlfc_thread = kthread_create(dhd_wlfc_transfer_packets, &dhd->pub, "wlfc-thread"); in dhd_attach()
11594 if (IS_ERR(dhd->pub.wlfc_thread)) { in dhd_attach()
11598 wake_up_process(dhd->pub.wlfc_thread); in dhd_attach()
11606 init_waitqueue_head(&dhd->ioctl_resp_wait); in dhd_attach()
11607 init_waitqueue_head(&dhd->pub.tx_tput_test_wait); in dhd_attach()
11608 init_waitqueue_head(&dhd->d3ack_wait); in dhd_attach()
11610 init_waitqueue_head(&dhd->ds_exit_wait); in dhd_attach()
11612 init_waitqueue_head(&dhd->ctrl_wait); in dhd_attach()
11613 init_waitqueue_head(&dhd->dhd_bus_busy_state_wait); in dhd_attach()
11614 init_waitqueue_head(&dhd->dmaxfer_wait); in dhd_attach()
11616 init_waitqueue_head(&dhd->quiesce_wait); in dhd_attach()
11618 init_waitqueue_head(&dhd->pub.tx_completion_wait); in dhd_attach()
11619 dhd->pub.dhd_bus_busy_state = 0; in dhd_attach()
11621 spin_lock_init(&dhd->sdlock); in dhd_attach()
11622 spin_lock_init(&dhd->txqlock); in dhd_attach()
11623 spin_lock_init(&dhd->dhd_lock); in dhd_attach()
11624 spin_lock_init(&dhd->txoff_lock); in dhd_attach()
11625 spin_lock_init(&dhd->rxf_lock); in dhd_attach()
11627 spin_lock_init(&dhd->pub.tdls_lock); in dhd_attach()
11630 dhd->rxthread_enabled = TRUE; in dhd_attach()
11634 spin_lock_init(&dhd->tcpack_lock); in dhd_attach()
11638 spin_lock_init(&dhd->hp2p_lock); in dhd_attach()
11641 spin_lock_init(&dhd->wakelock_spinlock); in dhd_attach()
11642 spin_lock_init(&dhd->wakelock_evt_spinlock); in dhd_attach()
11644 dhd->wakelock_counter = 0; in dhd_attach()
11647 dhd_wake_lock_init(dhd->wl_wdwake, dhd_bus_to_dev(bus), "wlan_wd_wake"); in dhd_attach()
11651 mutex_init(&dhd->dhd_net_if_mutex); in dhd_attach()
11652 mutex_init(&dhd->dhd_suspend_mutex); in dhd_attach()
11654 mutex_init(&dhd->dhd_apf_mutex); in dhd_attach()
11660 if (dhd_prot_attach(&dhd->pub) != 0) { in dhd_attach()
11668 if (dhd_timesync_attach(&dhd->pub) != 0) { in dhd_attach()
11676 spin_lock_init(&dhd->pub.up_lock); in dhd_attach()
11678 if (unlikely(wl_cfg80211_attach(net, &dhd->pub))) { in dhd_attach()
11683 dhd_monitor_init(&dhd->pub); in dhd_attach()
11728 ret = dhd_init_logstrs_array(osh, &dhd->event_data); in dhd_attach()
11730 dhd_init_static_strs_array(osh, &dhd->event_data, st_str_file_path, map_file_path); in dhd_attach()
11731 dhd_init_static_strs_array(osh, &dhd->event_data, rom_st_str_file_path, in dhd_attach()
11738 if (dhd_os_dbg_attach(&dhd->pub)) { in dhd_attach()
11745 dhd_os_start_logging(&dhd->pub, FW_VERBOSE_RING_NAME, 3, 0, 0, 0); in dhd_attach()
11750 dhd_os_start_logging(&dhd->pub, BT_LOG_RING_NAME, 3, 0, 0, 0); in dhd_attach()
11753 dhd->pub.dbg->pkt_mon_lock = osl_spin_lock_init(dhd->pub.osh); in dhd_attach()
11755 dhd_os_dbg_attach_pkt_monitor(&dhd->pub); in dhd_attach()
11762 dhd->pub.mem_stats_lock = osl_spin_lock_init(dhd->pub.osh); in dhd_attach()
11763 dhd->pub.txpath_mem = 0; in dhd_attach()
11764 dhd->pub.rxpath_mem = 0; in dhd_attach()
11768 dhd->pub.awdl_stats_lock = osl_spin_lock_init(dhd->pub.osh); in dhd_attach()
11772 dhd->pub.statlog = dhd_attach_statlog(&dhd->pub, MAX_STATLOG_ITEM, in dhd_attach()
11774 if (dhd->pub.statlog == NULL) { in dhd_attach()
11780 dhd_log_dump_init(&dhd->pub); in dhd_attach()
11783 dhd_dump_pkt_init(&dhd->pub); in dhd_attach()
11786 dhd_os_attach_pktlog(&dhd->pub); in dhd_attach()
11790 dhd->pub.hang_info = MALLOCZ(osh, VENDOR_SEND_HANG_EXT_INFO_LEN); in dhd_attach()
11791 if (dhd->pub.hang_info == NULL) { in dhd_attach()
11795 if (dhd_sta_pool_init(&dhd->pub, DHD_MAX_STA) != BCME_OK) { in dhd_attach()
11802 dhd->cih = ctf_attach(dhd->pub.osh, "dhd", &dhd_msg_level, dhd_ctf_detach, dhd); in dhd_attach()
11803 if (!dhd->cih) { in dhd_attach()
11809 if (CTF_ENAB(dhd->cih) && (osl_ctfpool_init(dhd->pub.osh, in dhd_attach()
11819 dhd->tx_wq = alloc_workqueue("bcmdhd-tx-wq", WQ_HIGHPRI | WQ_UNBOUND | WQ_MEM_RECLAIM, 1); in dhd_attach()
11820 if (!dhd->tx_wq) { in dhd_attach()
11821 DHD_ERROR(("%s: alloc_workqueue(bcmdhd-tx-wq) failed\n", __FUNCTION__)); in dhd_attach()
11824 dhd->rx_wq = alloc_workqueue("bcmdhd-rx-wq", WQ_HIGHPRI | WQ_UNBOUND | WQ_MEM_RECLAIM, 1); in dhd_attach()
11825 if (!dhd->rx_wq) { in dhd_attach()
11826 DHD_ERROR(("%s: alloc_workqueue(bcmdhd-rx-wq) failed\n", __FUNCTION__)); in dhd_attach()
11827 destroy_workqueue(dhd->tx_wq); in dhd_attach()
11828 dhd->tx_wq = NULL; in dhd_attach()
11835 init_timer_compat(&dhd->timer, dhd_watchdog, dhd); in dhd_attach()
11836 dhd->default_wd_interval = dhd_watchdog_ms; in dhd_attach()
11840 PROC_START(dhd_watchdog_thread, dhd, &dhd->thr_wdt_ctl, 0, "dhd_watchdog_thread"); in dhd_attach()
11841 if (dhd->thr_wdt_ctl.thr_pid < 0) { in dhd_attach()
11846 dhd->thr_wdt_ctl.thr_pid = -1; in dhd_attach()
11851 init_timer_compat(&dhd->rpm_timer, dhd_runtimepm, dhd); in dhd_attach()
11852 dhd->rpm_timer_valid = FALSE; in dhd_attach()
11854 dhd->thr_rpm_ctl.thr_pid = DHD_PID_KT_INVALID; in dhd_attach()
11855 PROC_START(dhd_rpm_state_thread, dhd, &dhd->thr_rpm_ctl, 0, "dhd_rpm_state_thread"); in dhd_attach()
11856 if (dhd->thr_rpm_ctl.thr_pid < 0) { in dhd_attach()
11862 skb_queue_head_init(&dhd->bt_log_queue); in dhd_attach()
11866 mutex_init(&dhd->quiesce_flr_lock); in dhd_attach()
11867 mutex_init(&dhd->quiesce_lock); in dhd_attach()
11873 PROC_START(dhd_dpc_thread, dhd, &dhd->thr_dpc_ctl, 0, "dhd_dpc"); in dhd_attach()
11874 if (dhd->thr_dpc_ctl.thr_pid < 0) { in dhd_attach()
11879 tasklet_init(&dhd->tasklet, dhd_dpc, (ulong)dhd); in dhd_attach()
11880 dhd->thr_dpc_ctl.thr_pid = -1; in dhd_attach()
11883 if (dhd->rxthread_enabled) { in dhd_attach()
11884 bzero(&dhd->pub.skbbuf[0], sizeof(void *) * MAXSKBPEND); in dhd_attach()
11886 PROC_START(dhd_rxf_thread, dhd, &dhd->thr_rxf_ctl, 0, "dhd_rxf"); in dhd_attach()
11887 if (dhd->thr_rxf_ctl.thr_pid < 0) { in dhd_attach()
11894 skb_queue_head_init(&dhd->evt_trace_queue); in dhd_attach()
11897 dhd_dbg_ring_proc_create(&dhd->pub); in dhd_attach()
11905 dhd->pm_notifier.notifier_call = dhd_pm_callback; in dhd_attach()
11906 dhd->pm_notifier.priority = 10; in dhd_attach()
11907 register_pm_notifier(&dhd->pm_notifier); in dhd_attach()
11913 dhd->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 20; in dhd_attach()
11914 dhd->early_suspend.suspend = dhd_early_suspend; in dhd_attach()
11915 dhd->early_suspend.resume = dhd_late_resume; in dhd_attach()
11916 register_early_suspend(&dhd->early_suspend); in dhd_attach()
11921 dhd->pend_ipaddr = 0; in dhd_attach()
11934 dhd->dhd_deferred_wq = dhd_deferred_work_init((void *)dhd); in dhd_attach()
11936 INIT_WORK(&dhd->dhd_hang_process_work, dhd_hang_process); in dhd_attach()
11939 dhd->new_freq = alloc_percpu(int); in dhd_attach()
11940 dhd->freq_trans.notifier_call = dhd_cpufreq_notifier; in dhd_attach()
11941 cpufreq_register_notifier(&dhd->freq_trans, CPUFREQ_TRANSITION_NOTIFIER); in dhd_attach()
11945 dhd_tcpack_suppress_set(&dhd->pub, TCPACK_SUP_DELAYTX); in dhd_attach()
11950 dhd_tcpack_suppress_set(&dhd->pub, TCPACK_SUP_HOLD); in dhd_attach()
11952 dhd_tcpack_suppress_set(&dhd->pub, TCPACK_SUP_OFF); in dhd_attach()
11960 register_page_corrupt_cb(dhd_page_corrupt_cb, &dhd->pub); in dhd_attach()
11963 INIT_DELAYED_WORK(&dhd->dhd_dpc_dispatcher_work, dhd_dpc_tasklet_dispatcher_work); in dhd_attach()
11967 dhd->permitted_primary_cpu = FALSE; in dhd_attach()
11970 DHD_LB_STATS_INIT(&dhd->pub); in dhd_attach()
11977 /* Register the call backs to CPU Hotplug sub-system */ in dhd_attach()
11986 dhd->cpu_notifier.notifier_call = NULL; in dhd_attach()
11994 atomic_set(&dhd->lb_txp_active, 1); in dhd_attach()
11997 atomic_set(&dhd->lb_txp_active, 0); in dhd_attach()
12003 atomic_set(&dhd->lb_rxp_active, 1); in dhd_attach()
12008 __skb_queue_head_init(&dhd->rx_pend_queue); in dhd_attach()
12009 skb_queue_head_init(&dhd->rx_napi_queue); in dhd_attach()
12010 __skb_queue_head_init(&dhd->rx_process_queue); in dhd_attach()
12012 INIT_WORK(&dhd->rx_napi_dispatcher_work, dhd_rx_napi_dispatcher_work); in dhd_attach()
12018 INIT_WORK(&dhd->tx_dispatcher_work, dhd_tx_dispatcher_work); in dhd_attach()
12019 skb_queue_head_init(&dhd->tx_pend_queue); in dhd_attach()
12021 tasklet_init(&dhd->tx_tasklet, in dhd_attach()
12030 INIT_WORK(&dhd->axi_error_dispatcher_work, dhd_axi_error_dispatcher_fn); in dhd_attach()
12034 if (dhd_macdbg_attach(&dhd->pub) != BCME_OK) { in dhd_attach()
12041 init_dhd_timeouts(&dhd->pub); in dhd_attach()
12044 dhd->pub.extended_trap_data = MALLOCZ(osh, BCMPCIE_EXT_TRAP_DATA_MAXLEN); in dhd_attach()
12045 if (dhd->pub.extended_trap_data == NULL) { in dhd_attach()
12049 dhd->pub.axi_err_dump = MALLOCZ(osh, sizeof(dhd_axi_error_dump_t)); in dhd_attach()
12050 if (dhd->pub.axi_err_dump == NULL) { in dhd_attach()
12063 INIT_WORK(&dhd->bt_log_dispatcher_work, dhd_bt_log_process); in dhd_attach()
12067 INIT_DELAYED_WORK(&dhd->edl_dispatcher_work, dhd_edl_process_work); in dhd_attach()
12070 DHD_SSSR_MEMPOOL_INIT(&dhd->pub); in dhd_attach()
12071 DHD_SSSR_REG_INFO_INIT(&dhd->pub); in dhd_attach()
12074 dhd_sdtc_etb_mempool_init(&dhd->pub); in dhd_attach()
12079 if (DHD_EDL_MEM_INIT(&dhd->pub) != BCME_OK) { in dhd_attach()
12091 dhd->pub.nfct = dhd_ct_open(&dhd->pub, NFNL_SUBSYS_CTNETLINK | NFNL_SUBSYS_CTNETLINK_EXP, in dhd_attach()
12095 dhd->pub.gdb_proxy_nodeadman = nodeadman != 0; in dhd_attach()
12098 dhd->dhd_state = dhd_state; in dhd_attach()
12103 dhd_csi_init(&dhd->pub); in dhd_attach()
12109 dhd->pub.memdump_enabled = DUMP_DISABLED; in dhd_attach()
12112 dhd->pub.memdump_enabled = DUMP_MEMFILE; in dhd_attach()
12114 dhd->pub.memdump_enabled = DUMP_MEMFILE_BUGON; in dhd_attach()
12117 dhd->pub.memdump_enabled = DUMP_MEMFILE; in dhd_attach()
12120 dhd_get_memdump_info(&dhd->pub); in dhd_attach()
12125 pom_handler = &dhd->pub.pom_wlan_handler; in dhd_attach()
12126 pom_handler->func_id = WLAN_FUNC_ID; in dhd_attach()
12127 pom_handler->handler = (void *)g_dhd_pub; in dhd_attach()
12128 pom_handler->power_off = dhd_wlan_power_off_handler; in dhd_attach()
12129 pom_handler->power_on = dhd_wlan_power_on_handler; in dhd_attach()
12131 dhd->pub.pom_func_register = NULL; in dhd_attach()
12132 dhd->pub.pom_func_deregister = NULL; in dhd_attach()
12133 dhd->pub.pom_toggle_reg_on = NULL; in dhd_attach()
12135 dhd->pub.pom_func_register = symbol_get(pom_func_register); in dhd_attach()
12136 dhd->pub.pom_func_deregister = symbol_get(pom_func_deregister); in dhd_attach()
12137 dhd->pub.pom_toggle_reg_on = symbol_get(pom_toggle_reg_on); in dhd_attach()
12143 if (!dhd->pub.pom_func_register || in dhd_attach()
12144 !dhd->pub.pom_func_deregister || in dhd_attach()
12145 !dhd->pub.pom_toggle_reg_on) { in dhd_attach()
12151 dhd->pub.pom_func_register(pom_handler); in dhd_attach()
12152 dhd->pub.enable_erpom = TRUE; in dhd_attach()
12158 dhd->pub.dump_file_manage = in dhd_attach()
12159 (dhd_dump_file_manage_t *)MALLOCZ(dhd->pub.osh, sizeof(dhd_dump_file_manage_t)); in dhd_attach()
12160 if (unlikely(!dhd->pub.dump_file_manage)) { in dhd_attach()
12161 DHD_ERROR(("%s(): could not allocate memory for - " in dhd_attach()
12169 if (dhd_fwtrace_attach(&dhd->pub) != 0) { in dhd_attach()
12177 if (dhd_rtt_attach(&dhd->pub)) { in dhd_attach()
12184 if (dhd_tx_profile_attach(&dhd->pub) != BCME_OK) { in dhd_attach()
12190 return &dhd->pub; in dhd_attach()
12194 DHD_TRACE(("%s: Calling dhd_detach dhd_state 0x%x &dhd->pub %p\n", in dhd_attach()
12195 __FUNCTION__, dhd_state, &dhd->pub)); in dhd_attach()
12196 dhd->dhd_state = dhd_state; in dhd_attach()
12197 dhd_detach(&dhd->pub); in dhd_attach()
12198 dhd_free(&dhd->pub); in dhd_attach()
12207 if (strstr(dhdinfo->fw_path, "_apsta") != NULL) in dhd_get_fw_mode()
12209 if (strstr(dhdinfo->fw_path, "_p2p") != NULL) in dhd_get_fw_mode()
12211 if (strstr(dhdinfo->fw_path, "_ibss") != NULL) in dhd_get_fw_mode()
12213 if (strstr(dhdinfo->fw_path, "_mfg") != NULL) in dhd_get_fw_mode()
12221 return dhd_get_fw_mode(dhdp->info); in dhd_bus_get_fw_mode()
12239 wifi_adapter_info_t *adapter = dhdinfo->adapter; in dhd_update_fw_nv_path()
12240 int fw_path_len = sizeof(dhdinfo->fw_path); in dhd_update_fw_nv_path()
12241 int nv_path_len = sizeof(dhdinfo->nv_path); in dhd_update_fw_nv_path()
12247 * time. When it changes we need to copy it to dhdinfo->fw_path. Also Android private in dhd_update_fw_nv_path()
12248 * command may change dhdinfo->fw_path. As such we need to clear the path info in in dhd_update_fw_nv_path()
12253 /* set default firmware and nvram path for built-in type driver */ in dhd_update_fw_nv_path()
12269 if (dhdinfo->fw_path[0] == '\0') { in dhd_update_fw_nv_path()
12270 if (adapter && adapter->fw_path && adapter->fw_path[0] != '\0') in dhd_update_fw_nv_path()
12271 fw = adapter->fw_path; in dhd_update_fw_nv_path()
12274 if (dhdinfo->nv_path[0] == '\0') { in dhd_update_fw_nv_path()
12275 if (adapter && adapter->nv_path && adapter->nv_path[0] != '\0') in dhd_update_fw_nv_path()
12276 nv = adapter->nv_path; in dhd_update_fw_nv_path()
12278 if (dhdinfo->clm_path[0] == '\0') { in dhd_update_fw_nv_path()
12279 if (adapter && adapter->clm_path && adapter->clm_path[0] != '\0') in dhd_update_fw_nv_path()
12280 clm = adapter->clm_path; in dhd_update_fw_nv_path()
12282 if (dhdinfo->conf_path[0] == '\0') { in dhd_update_fw_nv_path()
12283 if (adapter && adapter->conf_path && adapter->conf_path[0] != '\0') in dhd_update_fw_nv_path()
12284 conf = adapter->conf_path; in dhd_update_fw_nv_path()
12289 * TODO: need a solution for multi-chip, can't use the same firmware for all chips in dhd_update_fw_nv_path()
12310 snprintf(var, sizeof(var), "firmware_path%d", dhdinfo->unit); in dhd_update_fw_nv_path()
12316 snprintf(var, sizeof(var), "nvram_path%d", dhdinfo->unit); in dhd_update_fw_nv_path()
12319 DHD_ERROR(("dhd:%d: fw path:%s nv path:%s\n", dhdinfo->unit, fw, nv)); in dhd_update_fw_nv_path()
12325 DHD_ERROR(("fw path len exceeds max len of dhdinfo->fw_path\n")); in dhd_update_fw_nv_path()
12328 strlcpy(dhdinfo->fw_path, fw, fw_path_len); in dhd_update_fw_nv_path()
12333 DHD_ERROR(("nvram path len exceeds max len of dhdinfo->nv_path\n")); in dhd_update_fw_nv_path()
12336 memset(dhdinfo->nv_path, 0, nv_path_len); in dhd_update_fw_nv_path()
12337 strlcpy(dhdinfo->nv_path, nv, nv_path_len); in dhd_update_fw_nv_path()
12343 char *sp_nvram = strnstr(dhdinfo->nv_path, nvram_tag, nv_path_len); in dhd_update_fw_nv_path()
12345 strlen(ext_tag) - dhdinfo->nv_path) <= nv_path_len); in dhd_update_fw_nv_path()
12347 char *sp = sp_nvram + strlen(nvram_tag) - 1; in dhd_update_fw_nv_path()
12348 uint32 padding_size = (uint32)(dhdinfo->nv_path + in dhd_update_fw_nv_path()
12349 nv_path_len - sp); in dhd_update_fw_nv_path()
12351 strncat(dhdinfo->nv_path, ext_tag, strlen(ext_tag)); in dhd_update_fw_nv_path()
12352 nv_len = strlen(dhdinfo->nv_path); in dhd_update_fw_nv_path()
12354 __FUNCTION__, dhdinfo->nv_path)); in dhd_update_fw_nv_path()
12361 " nvram path = %s\n", __FUNCTION__, dhdinfo->nv_path)); in dhd_update_fw_nv_path()
12368 if (clm_len >= sizeof(dhdinfo->clm_path)) { in dhd_update_fw_nv_path()
12369 DHD_ERROR(("clm path len exceeds max len of dhdinfo->clm_path\n")); in dhd_update_fw_nv_path()
12372 strncpy(dhdinfo->clm_path, clm, sizeof(dhdinfo->clm_path)); in dhd_update_fw_nv_path()
12373 if (dhdinfo->clm_path[clm_len-1] == '\n') in dhd_update_fw_nv_path()
12374 dhdinfo->clm_path[clm_len-1] = '\0'; in dhd_update_fw_nv_path()
12378 if (conf_len >= sizeof(dhdinfo->conf_path)) { in dhd_update_fw_nv_path()
12379 DHD_ERROR(("config path len exceeds max len of dhdinfo->conf_path\n")); in dhd_update_fw_nv_path()
12382 strncpy(dhdinfo->conf_path, conf, sizeof(dhdinfo->conf_path)); in dhd_update_fw_nv_path()
12383 if (dhdinfo->conf_path[conf_len-1] == '\n') in dhd_update_fw_nv_path()
12384 dhdinfo->conf_path[conf_len-1] = '\0'; in dhd_update_fw_nv_path()
12389 if (uc_len >= sizeof(dhdinfo->uc_path)) { in dhd_update_fw_nv_path()
12390 DHD_ERROR(("uc path len exceeds max len of dhdinfo->uc_path\n")); in dhd_update_fw_nv_path()
12393 strlcpy(dhdinfo->uc_path, uc, sizeof(dhdinfo->uc_path)); in dhd_update_fw_nv_path()
12408 DHD_ERROR(("ucode path: %s\n", dhdinfo->uc_path)); in dhd_update_fw_nv_path()
12413 if (dhdinfo->fw_path[0] == '\0') { in dhd_update_fw_nv_path()
12417 if (dhdinfo->nv_path[0] == '\0') { in dhd_update_fw_nv_path()
12431 wifi_adapter_info_t *adapter = dhdinfo->adapter; in dhd_update_btfw_path()
12437 * time. When it changes we need to copy it to dhdinfo->btfw_path. Also Android private in dhd_update_btfw_path()
12438 * command may change dhdinfo->btfw_path. As such we need to clear the path info in in dhd_update_btfw_path()
12443 /* set default firmware and nvram path for built-in type driver */ in dhd_update_btfw_path()
12451 if (dhdinfo->btfw_path[0] == '\0') { in dhd_update_btfw_path()
12452 if (adapter && adapter->btfw_path && adapter->btfw_path[0] != '\0') in dhd_update_btfw_path()
12453 fw = adapter->btfw_path; in dhd_update_btfw_path()
12463 if (fw_len >= sizeof(dhdinfo->btfw_path)) { in dhd_update_btfw_path()
12464 DHD_ERROR(("fw path len exceeds max len of dhdinfo->btfw_path\n")); in dhd_update_btfw_path()
12467 strlcpy(dhdinfo->btfw_path, fw, sizeof(dhdinfo->btfw_path)); in dhd_update_btfw_path()
12473 if (dhdinfo->btfw_path[0] == '\0') { in dhd_update_btfw_path()
12561 int ret = -1; in dhd_download_btfw()
12563 dhd_info_t *dhd = (dhd_info_t*)dhdp->info; in dhd_download_btfw()
12566 if (dhd->pub.busstate == DHD_BUS_DATA && dhd_update_btfw_path(dhd, btfw_path)) { in dhd_download_btfw()
12567 DHD_INFO(("%s: download btfw from: %s\n", __FUNCTION__, dhd->btfw_path)); in dhd_download_btfw()
12568 ret = dhd_bus_download_btfw(dhd->pub.bus, dhd->pub.osh, dhd->btfw_path); in dhd_download_btfw()
12571 __FUNCTION__, dhd->btfw_path)); in dhd_download_btfw()
12583 int ret = -1; in dhd_bus_start()
12584 dhd_info_t *dhd = (dhd_info_t*)dhdp->info; in dhd_bus_start()
12593 dhdp->memdump_type = 0; in dhd_bus_start()
12594 dhdp->dongle_trap_occured = 0; in dhd_bus_start()
12596 if (dhdp->extended_trap_data) { in dhd_bus_start()
12597 memset(dhdp->extended_trap_data, 0, BCMPCIE_EXT_TRAP_DATA_MAXLEN); in dhd_bus_start()
12602 dhdp->sssr_dump_collected = 0; in dhd_bus_start()
12605 dhd->pub.dongle_trap_due_to_bt = 0; in dhd_bus_start()
12607 dhdp->iovar_timeout_occured = 0; in dhd_bus_start()
12609 dhdp->d3ack_timeout_occured = 0; in dhd_bus_start()
12610 dhdp->livelock_occured = 0; in dhd_bus_start()
12611 dhdp->pktid_audit_failed = 0; in dhd_bus_start()
12613 dhd->pub.iface_op_failed = 0; in dhd_bus_start()
12614 dhd->pub.scan_timeout_occurred = 0; in dhd_bus_start()
12615 dhd->pub.scan_busy_occurred = 0; in dhd_bus_start()
12617 if (dhd->pub.dhd_induce_error) { in dhd_bus_start()
12618 dhd->pub.dhd_induce_bh_error = dhd->pub.dhd_induce_error; in dhd_bus_start()
12620 dhd->pub.dhd_induce_error = DHD_INDUCE_ERROR_CLEAR; in dhd_bus_start()
12622 dhd->latency = 0; in dhd_bus_start()
12624 dhd->pub.tput_test_done = FALSE; in dhd_bus_start()
12628 /* JIRA:SW4349-436 JIRA:HW4349-302 Work around for 4349a0 PCIE-D11 DMA bug */ in dhd_bus_start()
12629 uint chipid = dhd_bus_chip_id(&dhd->pub); in dhd_bus_start()
12630 uint revid = dhd_bus_chiprev_id(&dhd->pub); in dhd_bus_start()
12635 osl_flag_set(dhd->pub.osh, OSL_PHYS_MEM_LESS_THAN_16MB); in dhd_bus_start()
12640 if (dhd->pub.busstate == DHD_BUS_DOWN && dhd_update_fw_nv_path(dhd)) { in dhd_bus_start()
12642 dhd->pub.fw_download_status = FW_DOWNLOAD_IN_PROGRESS; in dhd_bus_start()
12644 __FUNCTION__, dhd->fw_path, dhd->nv_path, dhd->conf_path)); in dhd_bus_start()
12648 ret = dhd_bus_download_firmware(dhd->pub.bus, dhd->pub.osh, in dhd_bus_start()
12649 dhd->fw_path, dhd->nv_path, dhd->clm_path, dhd->conf_path); in dhd_bus_start()
12655 __FUNCTION__, dhd->fw_path)); in dhd_bus_start()
12659 dhd->pub.fw_download_status = FW_DOWNLOAD_DONE; in dhd_bus_start()
12661 if (dhd->pub.busstate != DHD_BUS_LOAD) { in dhd_bus_start()
12662 return -ENETDOWN; in dhd_bus_start()
12670 dhd->pub.tickcnt = 0; in dhd_bus_start()
12671 dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms); in dhd_bus_start()
12674 if ((ret = dhd_bus_init(&dhd->pub, FALSE)) != 0) { in dhd_bus_start()
12687 DHD_GENERAL_LOCK(&dhd->pub, flags); in dhd_bus_start()
12688 dhd->wd_timer_valid = FALSE; in dhd_bus_start()
12689 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in dhd_bus_start()
12690 del_timer_sync(&dhd->timer); in dhd_bus_start()
12693 DHD_STOP_RPM_TIMER(&dhd->pub); in dhd_bus_start()
12696 DHD_OS_WD_WAKE_UNLOCK(&dhd->pub); in dhd_bus_start()
12697 return -ENODEV; in dhd_bus_start()
12704 dhd_enable_oob_intr(dhd->pub.bus, TRUE); in dhd_bus_start()
12708 dhd_enable_oob_intr(dhd->pub.bus, TRUE); in dhd_bus_start()
12713 uint32 max_h2d_rings = dhd_bus_max_h2d_queues(dhd->pub.bus); in dhd_bus_start()
12717 if ((ret = dhd_flow_rings_init(&dhd->pub, max_h2d_rings)) != BCME_OK) { in dhd_bus_start()
12729 dhdp->event_log_max_sets = NUM_EVENT_LOG_SETS; in dhd_bus_start()
12730 dhdp->event_log_max_sets_queried = FALSE; in dhd_bus_start()
12732 dhdp->smmu_fault_occurred = 0; in dhd_bus_start()
12734 dhdp->axi_error = FALSE; in dhd_bus_start()
12738 ret = dhd_prot_init(&dhd->pub); in dhd_bus_start()
12740 DHD_OS_WD_WAKE_UNLOCK(&dhd->pub); in dhd_bus_start()
12745 if (dhd->pub.busstate != DHD_BUS_DATA) { in dhd_bus_start()
12746 DHD_GENERAL_LOCK(&dhd->pub, flags); in dhd_bus_start()
12747 dhd->wd_timer_valid = FALSE; in dhd_bus_start()
12748 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in dhd_bus_start()
12749 del_timer_sync(&dhd->timer); in dhd_bus_start()
12751 DHD_STOP_RPM_TIMER(&dhd->pub); in dhd_bus_start()
12755 DHD_OS_WD_WAKE_UNLOCK(&dhd->pub); in dhd_bus_start()
12756 return -ENODEV; in dhd_bus_start()
12768 if ((ret = dhd_sync_with_dongle(&dhd->pub)) < 0) { in dhd_bus_start()
12769 DHD_GENERAL_LOCK(&dhd->pub, flags); in dhd_bus_start()
12770 dhd->wd_timer_valid = FALSE; in dhd_bus_start()
12771 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in dhd_bus_start()
12772 del_timer_sync(&dhd->timer); in dhd_bus_start()
12774 DHD_OS_WD_WAKE_UNLOCK(&dhd->pub); in dhd_bus_start()
12780 dhd_bus_l1ss_enable_rc_ep(dhdp->bus, TRUE); in dhd_bus_start()
12786 rk_dhd_bus_l1ss_enable_rc_ep(dhdp->bus, TRUE); in dhd_bus_start()
12792 /* XXX: JIRA SWWLAN-139454: Added L1ss enable in dhd_bus_start()
12794 * JIRA SWWLAN-142236: Amendment - Changed L1ss enable point in dhd_bus_start()
12807 (fw_download_end - fw_download_start) + (f2_sync_end - f2_sync_start))); in dhd_bus_start()
12811 if (dhd->pend_ipaddr) { in dhd_bus_start()
12814 aoe_update_host_ipv4_table(&dhd->pub, dhd->pend_ipaddr, TRUE, 0); in dhd_bus_start()
12816 dhd->pend_ipaddr = 0; in dhd_bus_start()
12821 bzero(&dhd->pub.dhd_tm_dwm_tbl, sizeof(dhd_trf_mgmt_dwm_tbl_t)); in dhd_bus_start()
12843 if (dhd->tdls_enable == tdls_on) in _dhd_tdls_enable()
12850 dhd->tdls_enable = tdls_on; in _dhd_tdls_enable()
12903 ret = _dhd_tdls_enable(&dhd->pub, tdls_on, auto_on, mac); in dhd_tdls_enable()
12943 dhd->tdls_mode = mode; in dhd_tdls_set_mode()
12950 tdls_peer_node_t *cur = dhd_pub->peer_tbl.node; in dhd_tdls_update_peer_info()
12952 int ifindex = dhd_ifname2idx(dhd_pub->info, event->ifname); in dhd_tdls_update_peer_info()
12953 uint8 *da = (uint8 *)&event->addr.octet[0]; in dhd_tdls_update_peer_info()
12955 uint32 reason = ntoh32(event->reason); in dhd_tdls_update_peer_info()
12976 if (!memcmp(da, cur->addr, ETHER_ADDR_LEN)) { in dhd_tdls_update_peer_info()
12981 cur = cur->next; in dhd_tdls_update_peer_info()
12984 new = MALLOC(dhd_pub->osh, sizeof(tdls_peer_node_t)); in dhd_tdls_update_peer_info()
12989 memcpy(new->addr, da, ETHER_ADDR_LEN); in dhd_tdls_update_peer_info()
12990 DHD_TDLS_LOCK(&dhdp->tdls_lock, flags); in dhd_tdls_update_peer_info()
12991 new->next = dhd_pub->peer_tbl.node; in dhd_tdls_update_peer_info()
12992 dhd_pub->peer_tbl.node = new; in dhd_tdls_update_peer_info()
12993 dhd_pub->peer_tbl.tdls_peer_count++; in dhd_tdls_update_peer_info()
12995 __FUNCTION__, dhd_pub->peer_tbl.tdls_peer_count, in dhd_tdls_update_peer_info()
12997 DHD_TDLS_UNLOCK(&dhdp->tdls_lock, flags); in dhd_tdls_update_peer_info()
13001 if (!memcmp(da, cur->addr, ETHER_ADDR_LEN)) { in dhd_tdls_update_peer_info()
13003 DHD_TDLS_LOCK(&dhdp->tdls_lock, flags); in dhd_tdls_update_peer_info()
13005 prev->next = cur->next; in dhd_tdls_update_peer_info()
13007 dhd_pub->peer_tbl.node = cur->next; in dhd_tdls_update_peer_info()
13008 MFREE(dhd_pub->osh, cur, sizeof(tdls_peer_node_t)); in dhd_tdls_update_peer_info()
13009 dhd_pub->peer_tbl.tdls_peer_count--; in dhd_tdls_update_peer_info()
13011 __FUNCTION__, dhd_pub->peer_tbl.tdls_peer_count, in dhd_tdls_update_peer_info()
13013 DHD_TDLS_UNLOCK(&dhdp->tdls_lock, flags); in dhd_tdls_update_peer_info()
13017 cur = cur->next; in dhd_tdls_update_peer_info()
13031 if (dhd->op_mode & DHD_FLAG_CONCURR_MULTI_CHAN_MODE) in dhd_is_concurrent_mode()
13033 else if ((dhd->op_mode & DHD_FLAG_CONCURR_SINGLE_CHAN_MODE) == in dhd_is_concurrent_mode()
13051 /* if dhd->op_mode is already set for HOSTAP and Manufacturing in dhd_get_concurrent_capabilites()
13054 if (dhd->op_mode & (DHD_FLAG_HOSTAP_MODE | DHD_FLAG_MFG_MODE)) in dhd_get_concurrent_capabilites()
13152 wl_country_t cspec = {{0}, -1, {0}}; in dhd_preinit_proc()
13162 if (dhd->is_blob) { in dhd_preinit_proc()
13175 cspec.rev = -1; in dhd_preinit_proc()
13178 get_customized_country_code(dhd->info->adapter, in dhd_preinit_proc()
13213 dhd->roam_env_detection = TRUE; in dhd_preinit_proc()
13215 dhd->roam_env_detection = FALSE; in dhd_preinit_proc()
13263 ret = memcmp(&ea.octet, dhd->mac.octet, ETHER_ADDR_LEN); in dhd_preinit_proc()
13278 memcpy(dhd->mac.octet, (void *)&ea, ETHER_ADDR_LEN); in dhd_preinit_proc()
13354 if (!(buf = MALLOC(dhd->osh, stat.size + 1))) { in dhd_preinit_config()
13356 return -ENOMEM; in dhd_preinit_config()
13366 printk("dhd_preinit_config : Error - read length mismatched len = %d\n", len); in dhd_preinit_config()
13394 MFREE(dhd->osh, buf, stat.size+1); in dhd_preinit_config()
13398 ret = -1; in dhd_preinit_config()
13471 dhd->op_mode |= DHD_FLAG_IBSS_MODE; in dhd_preinit_aibss_ioctls()
13487 DHD_ERROR(("%s - not associated\n", __FUNCTION__)); in dhd_check_adps_bad_ap()
13494 return -ENODEV; in dhd_check_adps_bad_ap()
13500 return -EINVAL; in dhd_check_adps_bad_ap()
13504 memcpy(bssid.octet, profile->bssid, ETHER_ADDR_LEN); in dhd_check_adps_bad_ap()
13526 iov_buf = MALLOC(dhd->osh, len); in dhd_enable_adps()
13528 DHD_ERROR(("%s - failed to allocate %d bytes for iov_buf\n", __FUNCTION__, len)); in dhd_enable_adps()
13533 iov_buf->version = WL_ADPS_IOV_VER; in dhd_enable_adps()
13534 iov_buf->len = sizeof(*data); in dhd_enable_adps()
13535 iov_buf->id = WL_ADPS_IOV_MODE; in dhd_enable_adps()
13537 data = (wl_adps_params_v1_t *)iov_buf->data; in dhd_enable_adps()
13538 data->version = ADPS_SUB_IOV_VERSION_1; in dhd_enable_adps()
13539 data->length = sizeof(*data); in dhd_enable_adps()
13540 data->mode = on; in dhd_enable_adps()
13543 data->band = i; in dhd_enable_adps()
13567 MFREE(dhd->osh, iov_buf, len); in dhd_enable_adps()
13588 (sizeof(wl_el_set_type_v1_t) * dhd->event_log_max_sets); in dhd_get_preserve_log_numbers()
13590 logset_all_type_op = (wl_el_set_all_type_v1_t *) MALLOC(dhd->osh, el_set_all_type_len); in dhd_get_preserve_log_numbers()
13604 logset_type.set = dhd->event_log_max_sets; in dhd_get_preserve_log_numbers()
13612 for (i = 0; i < dhd->event_log_max_sets; i++) { in dhd_get_preserve_log_numbers()
13614 logset_op.type = logset_all_type_op->set_type[i].type_val; in dhd_get_preserve_log_numbers()
13631 MFREE(dhd->osh, logset_all_type_op, el_set_all_type_len); in dhd_get_preserve_log_numbers()
13636 /* For non-android FC modular builds, override firmware preinited values */
13679 uint32 cap_buf_size = sizeof(dhd->fw_capabilities); in dhd_get_fw_capabilities()
13680 memset(dhd->fw_capabilities, 0, cap_buf_size); in dhd_get_fw_capabilities()
13681 ret = dhd_iovar(dhd, 0, "cap", NULL, 0, dhd->fw_capabilities, (cap_buf_size - 1), in dhd_get_fw_capabilities()
13690 memmove(&dhd->fw_capabilities[1], dhd->fw_capabilities, (cap_buf_size - 1)); in dhd_get_fw_capabilities()
13691 dhd->fw_capabilities[0] = ' '; in dhd_get_fw_capabilities()
13692 dhd->fw_capabilities[cap_buf_size - 2] = ' '; in dhd_get_fw_capabilities()
13693 dhd->fw_capabilities[cap_buf_size - 1] = '\0'; in dhd_get_fw_capabilities()
13715 dhd_info_t *dhdinfo = (dhd_info_t*)dhd->info; in dhd_optimised_preinit_ioctls()
13757 dhd->apf_set = FALSE; in dhd_optimised_preinit_ioctls()
13760 dhd->suspend_bcn_li_dtim = CUSTOM_SUSPEND_BCN_LI_DTIM; in dhd_optimised_preinit_ioctls()
13762 dhd->max_dtim_enable = TRUE; in dhd_optimised_preinit_ioctls()
13764 dhd->max_dtim_enable = FALSE; in dhd_optimised_preinit_ioctls()
13766 dhd->disable_dtim_in_suspend = FALSE; in dhd_optimised_preinit_ioctls()
13768 dhd->ocl_off = FALSE; in dhd_optimised_preinit_ioctls()
13771 dhd->tid_mode = SET_TID_OFF; in dhd_optimised_preinit_ioctls()
13772 dhd->target_uid = 0; in dhd_optimised_preinit_ioctls()
13773 dhd->target_tid = 0; in dhd_optimised_preinit_ioctls()
13776 dhd->op_mode = 0; in dhd_optimised_preinit_ioctls()
13780 dhd->arpoe_enable = TRUE; in dhd_optimised_preinit_ioctls()
13781 dhd->arpol_configured = FALSE; in dhd_optimised_preinit_ioctls()
13786 dhd->dhd_cflags &= ~WLAN_PLAT_AP_FLAG; in dhd_optimised_preinit_ioctls()
13810 fw_version[FW_VER_STR_LEN-1] = '\0'; in dhd_optimised_preinit_ioctls()
13822 dhd->wlc_ver_major = wlc_ver.wlc_ver_major; in dhd_optimised_preinit_ioctls()
13823 dhd->wlc_ver_minor = wlc_ver.wlc_ver_minor; in dhd_optimised_preinit_ioctls()
13840 if ((!op_mode && dhd_get_fw_mode(dhd->info) == DHD_FLAG_MFG_MODE) || in dhd_optimised_preinit_ioctls()
13842 dhd->op_mode = DHD_FLAG_MFG_MODE; in dhd_optimised_preinit_ioctls()
13845 pm_runtime_disable(dhd_bus_to_dev(dhd->bus)); in dhd_optimised_preinit_ioctls()
13858 dhd->arpoe_enable = FALSE; in dhd_optimised_preinit_ioctls()
13882 dhd->op_mode = DHD_FLAG_STA_MODE; in dhd_optimised_preinit_ioctls()
13887 dhd->op_mode |= concurrent_mode; in dhd_optimised_preinit_ioctls()
13891 if (dhd->op_mode & DHD_FLAG_P2P_MODE) { in dhd_optimised_preinit_ioctls()
13892 memcpy(&p2p_ea, &dhd->mac, ETHER_ADDR_LEN); in dhd_optimised_preinit_ioctls()
13923 ret = dhd_iovar(dhd, 0, "axierror_logbuf_addr", NULL, 0, (char *)&dhd->axierror_logbuf_addr, in dhd_optimised_preinit_ioctls()
13924 sizeof(dhd->axierror_logbuf_addr), FALSE); in dhd_optimised_preinit_ioctls()
13927 dhd->axierror_logbuf_addr = 0; in dhd_optimised_preinit_ioctls()
13930 __FUNCTION__, dhd->axierror_logbuf_addr)); in dhd_optimised_preinit_ioctls()
13935 ret = wifi_platform_get_mac_addr(dhd->info->adapter, ea_addr.octet, 0); in dhd_optimised_preinit_ioctls()
13944 memcpy(dhd->mac.octet, ea_addr.octet, ETHER_ADDR_LEN); in dhd_optimised_preinit_ioctls()
13968 memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN); in dhd_optimised_preinit_ioctls()
13971 if (ETHER_ISNULLADDR(dhd->mac.octet)) { in dhd_optimised_preinit_ioctls()
13972 DHD_ERROR(("%s: NULL MAC address during pre-init\n", __FUNCTION__)); in dhd_optimised_preinit_ioctls()
13976 (void)memcpy_s(dhd_linux_get_primary_netdev(dhd)->perm_addr, ETHER_ADDR_LEN, in dhd_optimised_preinit_ioctls()
13977 dhd->mac.octet, ETHER_ADDR_LEN); in dhd_optimised_preinit_ioctls()
13980 if ((ret = dhd_apply_default_clm(dhd, dhd->clm_path)) < 0) { in dhd_optimised_preinit_ioctls()
13986 dhd->op_mode, MAC2STRDBG(dhd->mac.octet))); in dhd_optimised_preinit_ioctls()
13989 if (!dhd->is_blob) in dhd_optimised_preinit_ioctls()
13994 get_customized_country_code(dhd->info->adapter, dhd->dhd_cspec.country_abbrev, in dhd_optimised_preinit_ioctls()
13995 &dhd->dhd_cspec, dhd->dhd_cflags); in dhd_optimised_preinit_ioctls()
13997 get_customized_country_code(dhd->info->adapter, dhd->dhd_cspec.country_abbrev, in dhd_optimised_preinit_ioctls()
13998 &dhd->dhd_cspec); in dhd_optimised_preinit_ioctls()
14003 if (dhd->op_mode == DHD_FLAG_HOSTAP_MODE) in dhd_optimised_preinit_ioctls()
14004 dhd->info->rxthread_enabled = FALSE; in dhd_optimised_preinit_ioctls()
14006 dhd->info->rxthread_enabled = TRUE; in dhd_optimised_preinit_ioctls()
14009 if (dhd->dhd_cspec.ccode[0] != 0) { in dhd_optimised_preinit_ioctls()
14010 ret = dhd_iovar(dhd, 0, "country", (char *)&dhd->dhd_cspec, sizeof(wl_country_t), in dhd_optimised_preinit_ioctls()
14022 /* roamvar is set to 0 by preinit fw, change only if roamvar is non-zero */ in dhd_optimised_preinit_ioctls()
14024 /* Disable built-in roaming to allowed ext supplicant to take care of roaming */ in dhd_optimised_preinit_ioctls()
14035 dhd->roam_env_detection = FALSE; in dhd_optimised_preinit_ioctls()
14042 dhd->roam_env_detection = TRUE; in dhd_optimised_preinit_ioctls()
14061 dhd->tdls_enable = FALSE; in dhd_optimised_preinit_ioctls()
14063 ret = dhd_iovar(dhd, 0, "tdls_enable", NULL, 0, (char *)&dhd->tdls_enable, in dhd_optimised_preinit_ioctls()
14064 sizeof(dhd->tdls_enable), FALSE); in dhd_optimised_preinit_ioctls()
14065 DHD_ERROR(("%s: tdls_enable=%d ret=%d\n", __FUNCTION__, dhd->tdls_enable, ret)); in dhd_optimised_preinit_ioctls()
14087 /* Set Keep Alive : be sure to use FW with -keepalive */ in dhd_optimised_preinit_ioctls()
14088 if (!(dhd->op_mode & in dhd_optimised_preinit_ioctls()
14099 dhd->event_log_max_sets = event_log_max_sets; in dhd_optimised_preinit_ioctls()
14101 dhd->event_log_max_sets = NUM_EVENT_LOG_SETS; in dhd_optimised_preinit_ioctls()
14108 dhd->event_log_max_sets_queried = TRUE; in dhd_optimised_preinit_ioctls()
14110 __FUNCTION__, dhd->event_log_max_sets, ret)); in dhd_optimised_preinit_ioctls()
14134 if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) { in dhd_optimised_preinit_ioctls()
14151 iov_buf = (char*)MALLOC(dhd->osh, WLC_IOCTL_SMLEN); in dhd_optimised_preinit_ioctls()
14159 /* Read 4-way handshake requirements */ in dhd_optimised_preinit_ioctls()
14164 * in-dongle supplicant. in dhd_optimised_preinit_ioctls()
14167 dhd->fw_4way_handshake = TRUE; in dhd_optimised_preinit_ioctls()
14168 DHD_TRACE(("4-way handshake mode is: %d\n", dhd->fw_4way_handshake)); in dhd_optimised_preinit_ioctls()
14186 dhd->arpoe_enable, dhd->arpol_configured)); in dhd_optimised_preinit_ioctls()
14196 dhd->pktfilter_count = 6; in dhd_optimised_preinit_ioctls()
14197 dhd->pktfilter[DHD_BROADCAST_FILTER_NUM] = NULL; in dhd_optimised_preinit_ioctls()
14199 dhd->pktfilter[DHD_MULTICAST4_FILTER_NUM] = NULL; in dhd_optimised_preinit_ioctls()
14200 dhd->pktfilter[DHD_MULTICAST6_FILTER_NUM] = NULL; in dhd_optimised_preinit_ioctls()
14203 dhd->pktfilter[DHD_MULTICAST4_FILTER_NUM] = DISCARD_IPV4_MCAST; in dhd_optimised_preinit_ioctls()
14204 dhd->pktfilter[DHD_MULTICAST6_FILTER_NUM] = DISCARD_IPV6_MCAST; in dhd_optimised_preinit_ioctls()
14207 dhd->pktfilter[DHD_ARP_FILTER_NUM] = "105 0 0 12 0xFFFF 0x0806"; in dhd_optimised_preinit_ioctls()
14211 dhd->pktfilter[DHD_UNICAST_FILTER_NUM] = "100 0 0 0 " in dhd_optimised_preinit_ioctls()
14217 dhd->pktfilter[DHD_UNICAST_FILTER_NUM] = "100 0 0 0 0x01 0x00"; in dhd_optimised_preinit_ioctls()
14222 dhd->pktfilter[DHD_MDNS_FILTER_NUM] = "104 0 0 0 0xFFFFFF 0x01005E"; in dhd_optimised_preinit_ioctls()
14225 dhd->pktfilter[DHD_MDNS_FILTER_NUM] = NULL; in dhd_optimised_preinit_ioctls()
14229 dhd->pktfilter[DHD_IP4BCAST_DROP_FILTER_NUM] = DISCARD_IPV4_BCAST; in dhd_optimised_preinit_ioctls()
14231 dhd->pktfilter[DHD_LLC_STP_DROP_FILTER_NUM] = DISCARD_LLC_STP; in dhd_optimised_preinit_ioctls()
14233 dhd->pktfilter[DHD_LLC_XID_DROP_FILTER_NUM] = DISCARD_LLC_XID; in dhd_optimised_preinit_ioctls()
14235 dhd->pktfilter[DHD_UDPNETBIOS_DROP_FILTER_NUM] = DISCARD_UDPNETBIOS; in dhd_optimised_preinit_ioctls()
14236 dhd->pktfilter_count = 11; in dhd_optimised_preinit_ioctls()
14240 dhd->pktfilter_count = 4; in dhd_optimised_preinit_ioctls()
14243 dhd->pktfilter[DHD_UNICAST_FILTER_NUM] = "100 0 0 0 0xffffff 0xffffff"; in dhd_optimised_preinit_ioctls()
14245 dhd->pktfilter[DHD_BROADCAST_FILTER_NUM] = "102 0 0 36 0xffffffff 0x11940009"; in dhd_optimised_preinit_ioctls()
14247 dhd->pktfilter[DHD_MULTICAST4_FILTER_NUM] = "104 0 0 38 0xffffffff 0x11940009"; in dhd_optimised_preinit_ioctls()
14248 dhd->pktfilter[DHD_MULTICAST6_FILTER_NUM] = NULL; in dhd_optimised_preinit_ioctls()
14296 CLM_VER_STR_LEN - 1, "%s, Blob ver = Major : %s minor : ", in dhd_optimised_preinit_ioctls()
14329 sec_save_wlinfo(fw_version, EPI_VERSION_STR, dhd->info->nv_path, clm_version); in dhd_optimised_preinit_ioctls()
14337 if (!dhd->pno_state) { in dhd_optimised_preinit_ioctls()
14355 dhd->pkt_metadata_version = 0; in dhd_optimised_preinit_ioctls()
14356 dhd->pkt_metadata_buflen = 0; in dhd_optimised_preinit_ioctls()
14358 dhd->pkt_metadata_version = GET_METADATA_VER(val); in dhd_optimised_preinit_ioctls()
14359 dhd->pkt_metadata_buflen = GET_METADATA_BUFLEN(val); in dhd_optimised_preinit_ioctls()
14370 if (dhd->rtt_state) { in dhd_optimised_preinit_ioctls()
14381 !(dhd->op_mode & (DHD_FLAG_HOSTAP_MODE | DHD_FLAG_MFG_MODE))) { in dhd_optimised_preinit_ioctls()
14387 dhd->ndo_enable = FALSE; in dhd_optimised_preinit_ioctls()
14388 dhd->ndo_host_ip_overflow = FALSE; in dhd_optimised_preinit_ioctls()
14389 dhd->ndo_max_host_ip = NDO_MAX_HOST_IP_ENTRIES; in dhd_optimised_preinit_ioctls()
14393 dhd->ndo_version = dhd_ndo_get_version(dhd); in dhd_optimised_preinit_ioctls()
14396 dhd->wbtext_support = FALSE; in dhd_optimised_preinit_ioctls()
14401 dhd->wbtext_policy = wnm_bsstrans_resp; in dhd_optimised_preinit_ioctls()
14402 if (dhd->wbtext_policy == WL_BSSTRANS_POLICY_PRODUCT_WBTEXT) { in dhd_optimised_preinit_ioctls()
14403 dhd->wbtext_support = TRUE; in dhd_optimised_preinit_ioctls()
14407 if (dhd->wbtext_support) { in dhd_optimised_preinit_ioctls()
14418 if (dhd->op_mode == DHD_FLAG_MFG_MODE && in dhd_optimised_preinit_ioctls()
14454 * 0 - Host supports Radiotap conversion. in dhd_optimised_preinit_ioctls()
14455 * 1 - FW supports Radiotap conversion. in dhd_optimised_preinit_ioctls()
14461 dhdinfo->host_radiotap_conv = (monitor & HOST_RADIOTAP_CONV_BIT) ? TRUE : FALSE; in dhd_optimised_preinit_ioctls()
14468 dhd->monitor_enable = TRUE; in dhd_optimised_preinit_ioctls()
14471 dhd->monitor_enable = FALSE; in dhd_optimised_preinit_ioctls()
14477 if (dhd_get_preserve_log_numbers(dhd, &dhd->logset_prsrv_mask) in dhd_optimised_preinit_ioctls()
14483 dhd->sroam_turn_on = TRUE; in dhd_optimised_preinit_ioctls()
14484 dhd->sroamed = FALSE; in dhd_optimised_preinit_ioctls()
14488 /* For non-android FC modular builds, override firmware preinited values */ in dhd_optimised_preinit_ioctls()
14496 MFREE(dhd->osh, iov_buf, WLC_IOCTL_SMLEN); in dhd_optimised_preinit_ioctls()
14523 dhd_info_t *dhdinfo = (dhd_info_t*)dhd->info; in dhd_legacy_preinit_ioctls()
14703 dhd->arpoe_enable = TRUE; in dhd_legacy_preinit_ioctls()
14704 dhd->arpol_configured = FALSE; in dhd_legacy_preinit_ioctls()
14711 dhd->apf_set = FALSE; in dhd_legacy_preinit_ioctls()
14714 dhd->suspend_bcn_li_dtim = CUSTOM_SUSPEND_BCN_LI_DTIM; in dhd_legacy_preinit_ioctls()
14716 dhd->max_dtim_enable = TRUE; in dhd_legacy_preinit_ioctls()
14718 dhd->max_dtim_enable = FALSE; in dhd_legacy_preinit_ioctls()
14720 dhd->disable_dtim_in_suspend = FALSE; in dhd_legacy_preinit_ioctls()
14722 dhd->ocl_off = FALSE; in dhd_legacy_preinit_ioctls()
14725 dhd->tid_mode = SET_TID_OFF; in dhd_legacy_preinit_ioctls()
14726 dhd->target_uid = 0; in dhd_legacy_preinit_ioctls()
14727 dhd->target_tid = 0; in dhd_legacy_preinit_ioctls()
14730 dhd_tcpack_suppress_set(dhd, dhd->conf->tcpack_sup_mode); in dhd_legacy_preinit_ioctls()
14732 dhd->op_mode = 0; in dhd_legacy_preinit_ioctls()
14736 dhd->dhd_cflags &= ~WLAN_PLAT_AP_FLAG; in dhd_legacy_preinit_ioctls()
14760 fw_version[FW_VER_STR_LEN-1] = '\0'; in dhd_legacy_preinit_ioctls()
14770 if ((!op_mode && dhd_get_fw_mode(dhd->info) == DHD_FLAG_MFG_MODE) || in dhd_legacy_preinit_ioctls()
14772 dhd->op_mode = DHD_FLAG_MFG_MODE; in dhd_legacy_preinit_ioctls()
14775 pm_runtime_disable(dhd_bus_to_dev(dhd->bus)); in dhd_legacy_preinit_ioctls()
14808 ret = dhd_iovar(dhd, 0, "axierror_logbuf_addr", NULL, 0, (char *)&dhd->axierror_logbuf_addr, in dhd_legacy_preinit_ioctls()
14809 sizeof(dhd->axierror_logbuf_addr), FALSE); in dhd_legacy_preinit_ioctls()
14812 dhd->axierror_logbuf_addr = 0; in dhd_legacy_preinit_ioctls()
14815 __FUNCTION__, dhd->axierror_logbuf_addr)); in dhd_legacy_preinit_ioctls()
14832 ret = wifi_platform_get_mac_addr(dhd->info->adapter, hw_ether, 0); in dhd_legacy_preinit_ioctls()
14834 if (!memcmp(ðer_null, &dhd->conf->hw_ether, ETHER_ADDR_LEN)) { in dhd_legacy_preinit_ioctls()
14841 memcpy(hw_ether, &dhd->conf->hw_ether, sizeof(dhd->conf->hw_ether)); in dhd_legacy_preinit_ioctls()
14853 prhex("MACPAD", &hw_ether[ETHER_ADDR_LEN], sizeof(hw_ether)-ETHER_ADDR_LEN); in dhd_legacy_preinit_ioctls()
14884 memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN); in dhd_legacy_preinit_ioctls()
14886 if (ETHER_ISNULLADDR(dhd->mac.octet)) { in dhd_legacy_preinit_ioctls()
14887 DHD_ERROR(("%s: NULL MAC address during pre-init\n", __FUNCTION__)); in dhd_legacy_preinit_ioctls()
14891 (void)memcpy_s(dhd_linux_get_primary_netdev(dhd)->perm_addr, ETHER_ADDR_LEN, in dhd_legacy_preinit_ioctls()
14892 dhd->mac.octet, ETHER_ADDR_LEN); in dhd_legacy_preinit_ioctls()
14897 * primary netdev->perm_addr will hold the original factory MAC. in dhd_legacy_preinit_ioctls()
14907 if ((ret = dhd_apply_default_clm(dhd, dhd->clm_path)) < 0) { in dhd_legacy_preinit_ioctls()
14914 uint32 cap_buf_size = sizeof(dhd->fw_capabilities); in dhd_legacy_preinit_ioctls()
14915 memset(dhd->fw_capabilities, 0, cap_buf_size); in dhd_legacy_preinit_ioctls()
14916 ret = dhd_iovar(dhd, 0, "cap", NULL, 0, dhd->fw_capabilities, (cap_buf_size - 1), in dhd_legacy_preinit_ioctls()
14924 memmove(&dhd->fw_capabilities[1], dhd->fw_capabilities, (cap_buf_size - 1)); in dhd_legacy_preinit_ioctls()
14925 dhd->fw_capabilities[0] = ' '; in dhd_legacy_preinit_ioctls()
14926 dhd->fw_capabilities[cap_buf_size - 2] = ' '; in dhd_legacy_preinit_ioctls()
14927 dhd->fw_capabilities[cap_buf_size - 1] = '\0'; in dhd_legacy_preinit_ioctls()
14930 if ((!op_mode && dhd_get_fw_mode(dhd->info) == DHD_FLAG_HOSTAP_MODE) || in dhd_legacy_preinit_ioctls()
14935 dhd->op_mode = DHD_FLAG_HOSTAP_MODE; in dhd_legacy_preinit_ioctls()
14957 memcpy(dhd->mac.octet, iovbuf, ETHER_ADDR_LEN); in dhd_legacy_preinit_ioctls()
14976 dhd->dhd_cflags |= WLAN_PLAT_AP_FLAG | WLAN_PLAT_NODFS_FLAG; in dhd_legacy_preinit_ioctls()
14978 } else if ((!op_mode && dhd_get_fw_mode(dhd->info) == DHD_FLAG_MFG_MODE) || in dhd_legacy_preinit_ioctls()
14981 dhd->arpoe_enable = FALSE; in dhd_legacy_preinit_ioctls()
14986 dhd->op_mode = DHD_FLAG_MFG_MODE; in dhd_legacy_preinit_ioctls()
15012 if ((!op_mode && dhd_get_fw_mode(dhd->info) == DHD_FLAG_P2P_MODE) || in dhd_legacy_preinit_ioctls()
15017 dhd->op_mode = DHD_FLAG_P2P_MODE; in dhd_legacy_preinit_ioctls()
15018 } else if ((!op_mode && dhd_get_fw_mode(dhd->info) == DHD_FLAG_IBSS_MODE) || in dhd_legacy_preinit_ioctls()
15020 dhd->op_mode = DHD_FLAG_IBSS_MODE; in dhd_legacy_preinit_ioctls()
15022 dhd->op_mode = DHD_FLAG_STA_MODE; in dhd_legacy_preinit_ioctls()
15024 if (dhd->op_mode != DHD_FLAG_IBSS_MODE && in dhd_legacy_preinit_ioctls()
15026 dhd->op_mode |= concurrent_mode; in dhd_legacy_preinit_ioctls()
15030 if (dhd->op_mode & DHD_FLAG_P2P_MODE) { in dhd_legacy_preinit_ioctls()
15042 memcpy(&p2p_ea, &dhd->mac, ETHER_ADDR_LEN); in dhd_legacy_preinit_ioctls()
15083 dhd->op_mode, MAC2STRDBG(dhd->mac.octet))); in dhd_legacy_preinit_ioctls()
15085 if (!dhd->is_blob) in dhd_legacy_preinit_ioctls()
15090 get_customized_country_code(dhd->info->adapter, dhd->dhd_cspec.country_abbrev, in dhd_legacy_preinit_ioctls()
15091 &dhd->dhd_cspec, dhd->dhd_cflags); in dhd_legacy_preinit_ioctls()
15093 get_customized_country_code(dhd->info->adapter, dhd->dhd_cspec.country_abbrev, in dhd_legacy_preinit_ioctls()
15094 &dhd->dhd_cspec); in dhd_legacy_preinit_ioctls()
15099 if (dhd->op_mode == DHD_FLAG_HOSTAP_MODE) in dhd_legacy_preinit_ioctls()
15100 dhd->info->rxthread_enabled = FALSE; in dhd_legacy_preinit_ioctls()
15102 dhd->info->rxthread_enabled = TRUE; in dhd_legacy_preinit_ioctls()
15105 if (dhd->dhd_cspec.ccode[0] != 0) { in dhd_legacy_preinit_ioctls()
15106 ret = dhd_iovar(dhd, 0, "country", (char *)&dhd->dhd_cspec, sizeof(wl_country_t), in dhd_legacy_preinit_ioctls()
15130 /* Disable built-in roaming to allowed ext supplicant to take care of roaming */ in dhd_legacy_preinit_ioctls()
15161 dhd->roam_env_detection = TRUE; in dhd_legacy_preinit_ioctls()
15163 dhd->roam_env_detection = FALSE; in dhd_legacy_preinit_ioctls()
15196 dhd->tdls_enable = FALSE; in dhd_legacy_preinit_ioctls()
15213 DHD_ERROR(("%s Set lpc ret --> %d\n", __FUNCTION__, ret)); in dhd_legacy_preinit_ioctls()
15219 if (dhd->op_mode & DHD_FLAG_STA_MODE) { in dhd_legacy_preinit_ioctls()
15295 /* Set Keep Alive : be sure to use FW with -keepalive */ in dhd_legacy_preinit_ioctls()
15301 if (!(dhd->op_mode & in dhd_legacy_preinit_ioctls()
15324 if ((ret = dhd_apply_default_clm(dhd, dhd->clm_path)) < 0) { in dhd_legacy_preinit_ioctls()
15330 if (!(dhd->op_mode & in dhd_legacy_preinit_ioctls()
15339 memset(dhd->fw_capabilities, 0, sizeof(dhd->fw_capabilities)); in dhd_legacy_preinit_ioctls()
15340 ret = dhd_iovar(dhd, 0, "cap", NULL, 0, dhd->fw_capabilities, sizeof(dhd->fw_capabilities), in dhd_legacy_preinit_ioctls()
15352 dhd->event_log_max_sets = event_log_max_sets; in dhd_legacy_preinit_ioctls()
15354 dhd->event_log_max_sets = NUM_EVENT_LOG_SETS; in dhd_legacy_preinit_ioctls()
15360 dhd->event_log_max_sets_queried = TRUE; in dhd_legacy_preinit_ioctls()
15362 __FUNCTION__, dhd->event_log_max_sets, ret)); in dhd_legacy_preinit_ioctls()
15393 if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) { in dhd_legacy_preinit_ioctls()
15417 iov_buf = (char*)MALLOC(dhd->osh, WLC_IOCTL_SMLEN); in dhd_legacy_preinit_ioctls()
15442 if (dhd->op_mode == DHD_FLAG_IBSS_MODE) in dhd_legacy_preinit_ioctls()
15492 /* Read 4-way handshake requirements */ in dhd_legacy_preinit_ioctls()
15497 * in-dongle supplicant. in dhd_legacy_preinit_ioctls()
15500 dhd->fw_4way_handshake = TRUE; in dhd_legacy_preinit_ioctls()
15501 DHD_TRACE(("4-way handshake mode is: %d\n", dhd->fw_4way_handshake)); in dhd_legacy_preinit_ioctls()
15533 DHD_ERROR(("%s vht_features set. ret --> %d\n", __FUNCTION__, ret)); in dhd_legacy_preinit_ioctls()
15538 DHD_INFO(("%s vht_features ret(%d) - need to check BANDLOCK\n", in dhd_legacy_preinit_ioctls()
15569 /* XXX Enable firmware key buffering before sent 4-way M4 */ in dhd_legacy_preinit_ioctls()
15583 eventmask_msg = (eventmsgs_ext_t*)MALLOC(dhd->osh, msglen); in dhd_legacy_preinit_ioctls()
15590 eventmask_msg->ver = EVENTMSGS_VER; in dhd_legacy_preinit_ioctls()
15591 eventmask_msg->len = ROUNDUP(WLC_E_LAST, NBBY)/NBBY; in dhd_legacy_preinit_ioctls()
15605 mask = eventmask_msg->mask; in dhd_legacy_preinit_ioctls()
15615 if (!(dhd->op_mode & DHD_FLAG_IBSS_MODE)) in dhd_legacy_preinit_ioctls()
15676 if (dhd->op_mode & DHD_FLAG_P2P_MODE) { in dhd_legacy_preinit_ioctls()
15762 eventmask_msg->ver = EVENTMSGS_VER; in dhd_legacy_preinit_ioctls()
15763 eventmask_msg->command = EVENTMSGS_SET_MASK; in dhd_legacy_preinit_ioctls()
15764 eventmask_msg->len = WL_EVENTING_MASK_EXT_LEN; in dhd_legacy_preinit_ioctls()
15774 el_tag = (wl_el_tag_params_t *)MALLOC(dhd->osh, sizeof(wl_el_tag_params_t)); in dhd_legacy_preinit_ioctls()
15781 el_tag->tag = EVENT_LOG_TAG_4WAYHANDSHAKE; in dhd_legacy_preinit_ioctls()
15782 el_tag->set = 1; in dhd_legacy_preinit_ioctls()
15783 el_tag->flags = EVENT_LOG_TAG_FLAG_LOG; in dhd_legacy_preinit_ioctls()
15812 dhd->arpoe_enable, dhd->arpol_configured)); in dhd_legacy_preinit_ioctls()
15818 dhd->pktfilter_count = 6; in dhd_legacy_preinit_ioctls()
15819 dhd->pktfilter[DHD_BROADCAST_FILTER_NUM] = NULL; in dhd_legacy_preinit_ioctls()
15821 dhd->pktfilter[DHD_MULTICAST4_FILTER_NUM] = NULL; in dhd_legacy_preinit_ioctls()
15822 dhd->pktfilter[DHD_MULTICAST6_FILTER_NUM] = NULL; in dhd_legacy_preinit_ioctls()
15825 dhd->pktfilter[DHD_MULTICAST4_FILTER_NUM] = DISCARD_IPV4_MCAST; in dhd_legacy_preinit_ioctls()
15826 dhd->pktfilter[DHD_MULTICAST6_FILTER_NUM] = DISCARD_IPV6_MCAST; in dhd_legacy_preinit_ioctls()
15829 dhd->pktfilter[DHD_ARP_FILTER_NUM] = "105 0 0 12 0xFFFF 0x0806"; in dhd_legacy_preinit_ioctls()
15833 dhd->pktfilter[DHD_UNICAST_FILTER_NUM] = "100 0 0 0 " in dhd_legacy_preinit_ioctls()
15839 dhd->pktfilter[DHD_UNICAST_FILTER_NUM] = "100 0 0 0 0x01 0x00"; in dhd_legacy_preinit_ioctls()
15844 dhd->pktfilter[DHD_MDNS_FILTER_NUM] = "104 0 0 0 0xFFFFFF 0x01005E"; in dhd_legacy_preinit_ioctls()
15847 dhd->pktfilter[DHD_MDNS_FILTER_NUM] = NULL; in dhd_legacy_preinit_ioctls()
15851 dhd->pktfilter[DHD_IP4BCAST_DROP_FILTER_NUM] = DISCARD_IPV4_BCAST; in dhd_legacy_preinit_ioctls()
15852 dhd->pktfilter_count = 8; in dhd_legacy_preinit_ioctls()
15856 dhd->pktfilter_count = 4; in dhd_legacy_preinit_ioctls()
15859 dhd->pktfilter[DHD_UNICAST_FILTER_NUM] = "100 0 0 0 0xffffff 0xffffff"; in dhd_legacy_preinit_ioctls()
15861 dhd->pktfilter[DHD_BROADCAST_FILTER_NUM] = "102 0 0 36 0xffffffff 0x11940009"; in dhd_legacy_preinit_ioctls()
15863 dhd->pktfilter[DHD_MULTICAST4_FILTER_NUM] = "104 0 0 38 0xffffffff 0x11940009"; in dhd_legacy_preinit_ioctls()
15864 dhd->pktfilter[DHD_MULTICAST6_FILTER_NUM] = NULL; in dhd_legacy_preinit_ioctls()
15908 if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) { in dhd_legacy_preinit_ioctls()
15962 len = snprintf(clm_version, CLM_VER_STR_LEN - 1, "%s", ver_temp_buf); in dhd_legacy_preinit_ioctls()
15967 snprintf(clm_version+len, CLM_VER_STR_LEN-1-len, in dhd_legacy_preinit_ioctls()
15985 CLM_VER_STR_LEN - 1, "%s, Blob ver = Major : %s minor : ", in dhd_legacy_preinit_ioctls()
16018 sec_save_wlinfo(fw_version, EPI_VERSION_STR, dhd->info->nv_path, clm_version); in dhd_legacy_preinit_ioctls()
16027 dhd_txglom_enable(dhd, dhd->conf->bus_rxglom); in dhd_legacy_preinit_ioctls()
16035 (dhd->op_mode != DHD_FLAG_HOSTAP_MODE && in dhd_legacy_preinit_ioctls()
16036 dhd->op_mode != DHD_FLAG_IBSS_MODE) || in dhd_legacy_preinit_ioctls()
16079 DHD_ERROR(("%s wl ampdu_hostreorder. ret --> %d\n", __FUNCTION__, ret2)); in dhd_legacy_preinit_ioctls()
16108 /* For FD we need all the packets at DHD to handle intra-BSS forwarding */ in dhd_legacy_preinit_ioctls()
16118 if (!dhd->pno_state) { in dhd_legacy_preinit_ioctls()
16136 dhd->pkt_metadata_version = 0; in dhd_legacy_preinit_ioctls()
16137 dhd->pkt_metadata_buflen = 0; in dhd_legacy_preinit_ioctls()
16139 dhd->pkt_metadata_version = GET_METADATA_VER(val); in dhd_legacy_preinit_ioctls()
16140 dhd->pkt_metadata_buflen = GET_METADATA_BUFLEN(val); in dhd_legacy_preinit_ioctls()
16151 if (dhd->rtt_state) { in dhd_legacy_preinit_ioctls()
16161 !(dhd->op_mode & (DHD_FLAG_HOSTAP_MODE | DHD_FLAG_MFG_MODE))) { in dhd_legacy_preinit_ioctls()
16170 dhd->ndo_enable = FALSE; in dhd_legacy_preinit_ioctls()
16171 dhd->ndo_host_ip_overflow = FALSE; in dhd_legacy_preinit_ioctls()
16172 dhd->ndo_max_host_ip = NDO_MAX_HOST_IP_ENTRIES; in dhd_legacy_preinit_ioctls()
16176 dhd->ndo_version = dhd_ndo_get_version(dhd); in dhd_legacy_preinit_ioctls()
16177 if (dhd->ndo_version > 0) { in dhd_legacy_preinit_ioctls()
16178 DHD_INFO(("%s: ndo version %d\n", __FUNCTION__, dhd->ndo_version)); in dhd_legacy_preinit_ioctls()
16190 dhd->wbtext_support = FALSE; in dhd_legacy_preinit_ioctls()
16195 dhd->wbtext_policy = wnm_bsstrans_resp; in dhd_legacy_preinit_ioctls()
16196 if (dhd->wbtext_policy == WL_BSSTRANS_POLICY_PRODUCT_WBTEXT) { in dhd_legacy_preinit_ioctls()
16197 dhd->wbtext_support = TRUE; in dhd_legacy_preinit_ioctls()
16201 if (dhd->wbtext_support) { in dhd_legacy_preinit_ioctls()
16212 if (dhd->op_mode == DHD_FLAG_MFG_MODE && in dhd_legacy_preinit_ioctls()
16272 * 0 - Host supports Radiotap conversion. in dhd_legacy_preinit_ioctls()
16273 * 1 - FW supports Radiotap conversion. in dhd_legacy_preinit_ioctls()
16279 dhdinfo->host_radiotap_conv = (monitor & HOST_RADIOTAP_CONV_BIT) ? TRUE : FALSE; in dhd_legacy_preinit_ioctls()
16286 dhd->monitor_enable = TRUE; in dhd_legacy_preinit_ioctls()
16289 dhd->monitor_enable = FALSE; in dhd_legacy_preinit_ioctls()
16295 if (dhd_get_preserve_log_numbers(dhd, &dhd->logset_prsrv_mask) in dhd_legacy_preinit_ioctls()
16305 dhd->sroam_turn_on = TRUE; in dhd_legacy_preinit_ioctls()
16306 dhd->sroamed = FALSE; in dhd_legacy_preinit_ioctls()
16314 MFREE(dhd->osh, eventmask_msg, msglen); in dhd_legacy_preinit_ioctls()
16317 MFREE(dhd->osh, iov_buf, WLC_IOCTL_SMLEN); in dhd_legacy_preinit_ioctls()
16321 MFREE(dhd->osh, el_tag, sizeof(wl_el_tag_params_t)); in dhd_legacy_preinit_ioctls()
16343 dhd->fw_preinit = TRUE; in dhd_preinit_ioctls()
16348 dhd->fw_preinit = FALSE; in dhd_preinit_ioctls()
16355 dhd->fw_preinit = FALSE; in dhd_preinit_ioctls()
16393 struct dhd_info *dhd = dhdp->info; in dhd_change_mtu()
16396 ASSERT(dhd && dhd->iflist[ifidx]); in dhd_change_mtu()
16397 dev = dhd->iflist[ifidx]->net; in dhd_change_mtu()
16402 DHD_ERROR(("%s: Must be down to change its MTU\n", dev->name)); in dhd_change_mtu()
16415 dev->mtu = new_mtu; in dhd_change_mtu()
16459 __FUNCTION__, dhdp->dhd_bus_busy_state)); in dhd_wait_for_file_dump()
16461 &dhdp->dhd_bus_busy_state, DHD_BUS_BUSY_IN_HALDUMP, 0); in dhd_wait_for_file_dump()
16462 if ((dhdp->dhd_bus_busy_state & DHD_BUS_BUSY_IN_HALDUMP) != 0) { in dhd_wait_for_file_dump()
16464 __FUNCTION__, timeleft, dhdp->dhd_bus_busy_state)); in dhd_wait_for_file_dump()
16554 if (!ifa || !(ifa->ifa_dev->dev)) in dhd_inetaddr_notifier_call()
16558 if ((ifa->ifa_dev->dev->netdev_ops != &dhd_ops_pri) && in dhd_inetaddr_notifier_call()
16559 (ifa->ifa_dev->dev->netdev_ops != &dhd_ops_virt)) { in dhd_inetaddr_notifier_call()
16561 if (!wl_cfgp2p_is_ifops(ifa->ifa_dev->dev->netdev_ops)) in dhd_inetaddr_notifier_call()
16566 dhd = DHD_DEV_INFO(ifa->ifa_dev->dev); in dhd_inetaddr_notifier_call()
16570 dhd_pub = &dhd->pub; in dhd_inetaddr_notifier_call()
16572 if (!dhd_pub->arpoe_enable) { in dhd_inetaddr_notifier_call()
16577 if (dhd_pub->arp_version == 1) { in dhd_inetaddr_notifier_call()
16581 if (dhd->iflist[idx] && dhd->iflist[idx]->net == ifa->ifa_dev->dev) in dhd_inetaddr_notifier_call()
16585 DHD_TRACE(("ifidx : %p %s %d\n", dhd->iflist[idx]->net, in dhd_inetaddr_notifier_call()
16586 dhd->iflist[idx]->name, dhd->iflist[idx]->idx)); in dhd_inetaddr_notifier_call()
16588 DHD_ERROR(("Cannot find ifidx for(%s) set to 0\n", ifa->ifa_label)); in dhd_inetaddr_notifier_call()
16596 __FUNCTION__, ifa->ifa_label, ifa->ifa_address)); in dhd_inetaddr_notifier_call()
16602 if (DHD_BUS_CHECK_DOWN_OR_DOWN_IN_PROGRESS(&dhd->pub) || in dhd_inetaddr_notifier_call()
16603 dhd->pub.busstate == DHD_BUS_LOAD) { in dhd_inetaddr_notifier_call()
16605 __FUNCTION__, dhd->pub.busstate)); in dhd_inetaddr_notifier_call()
16606 if (dhd->pend_ipaddr) { in dhd_inetaddr_notifier_call()
16608 __FUNCTION__, dhd->pend_ipaddr)); in dhd_inetaddr_notifier_call()
16610 dhd->pend_ipaddr = ifa->ifa_address; in dhd_inetaddr_notifier_call()
16618 aoe_update_host_ipv4_table(dhd_pub, ifa->ifa_address, TRUE, idx); in dhd_inetaddr_notifier_call()
16620 dhd_conf_set_garp(dhd_pub, idx, ifa->ifa_address, TRUE); in dhd_inetaddr_notifier_call()
16625 __FUNCTION__, ifa->ifa_label, ifa->ifa_address)); in dhd_inetaddr_notifier_call()
16626 dhd->pend_ipaddr = 0; in dhd_inetaddr_notifier_call()
16631 if ((dhd_pub->op_mode & DHD_FLAG_HOSTAP_MODE) || in dhd_inetaddr_notifier_call()
16632 (ifa->ifa_dev->dev != dhd_linux_get_primary_netdev(dhd_pub))) { in dhd_inetaddr_notifier_call()
16633 aoe_update_host_ipv4_table(dhd_pub, ifa->ifa_address, FALSE, idx); in dhd_inetaddr_notifier_call()
16638 dhd_aoe_hostip_clr(&dhd->pub, idx); in dhd_inetaddr_notifier_call()
16639 dhd_aoe_arp_clr(&dhd->pub, idx); in dhd_inetaddr_notifier_call()
16641 dhd_conf_set_garp(dhd_pub, idx, ifa->ifa_address, FALSE); in dhd_inetaddr_notifier_call()
16646 __func__, ifa->ifa_label, event)); in dhd_inetaddr_notifier_call()
16667 dhdp = &dhd->pub; in dhd_inet6_work_handler()
16679 switch (ndo_work->event) { in dhd_inet6_work_handler()
16689 if (dhdp->ndo_version > 0) { in dhd_inet6_work_handler()
16691 ret = dhd_ndo_add_ip_with_type(dhdp, &ndo_work->ipv6_addr[0], in dhd_inet6_work_handler()
16692 WL_ND_IPV6_ADDR_TYPE_UNICAST, ndo_work->if_idx); in dhd_inet6_work_handler()
16694 ret = dhd_ndo_add_ip(dhdp, &ndo_work->ipv6_addr[0], in dhd_inet6_work_handler()
16695 ndo_work->if_idx); in dhd_inet6_work_handler()
16703 if (dhdp->ndo_version > 0) { in dhd_inet6_work_handler()
16706 &ndo_work->ipv6_addr[0], ndo_work->if_idx); in dhd_inet6_work_handler()
16709 ret = dhd_ndo_remove_ip(dhdp, ndo_work->if_idx); in dhd_inet6_work_handler()
16717 if (dhdp->ndo_host_ip_overflow) { in dhd_inet6_work_handler()
16719 dhd_idx2net(dhdp, ndo_work->if_idx)); in dhd_inet6_work_handler()
16764 if (inet6_ifa->idev->dev->netdev_ops != &dhd_ops_pri) { in dhd_inet6addr_notifier_call()
16768 dhd = DHD_DEV_INFO(inet6_ifa->idev->dev); in dhd_inet6addr_notifier_call()
16772 dhdp = &dhd->pub; in dhd_inet6addr_notifier_call()
16775 idx = dhd_net2idx(dhd, inet6_ifa->idev->dev); in dhd_inet6addr_notifier_call()
16792 ndo_info->event = event; in dhd_inet6addr_notifier_call()
16793 ndo_info->if_idx = idx; in dhd_inet6addr_notifier_call()
16794 memcpy(ndo_info->ipv6_addr, &inet6_ifa->addr, IPV6_ADDR_LEN); in dhd_inet6addr_notifier_call()
16797 dhd_deferred_schedule_work(dhd->dhd_deferred_wq, (void *)ndo_info, DHD_WQ_WORK_IPV6_NDO, in dhd_inet6addr_notifier_call()
16818 ret = wifi_platform_get_mac_addr(dhdp->adapter, hw_ether, 0); in dhd_attach_net()
16820 bcopy(hw_ether, dhdp->mac.octet, ETHER_ADDR_LEN); in dhd_attach_net()
16824 if (ret && memcmp(ðer_null, &dhdp->conf->otp_mac, ETHER_ADDR_LEN)) in dhd_attach_net()
16825 bcopy(&dhdp->conf->otp_mac, &dhdp->mac, ETHER_ADDR_LEN); in dhd_attach_net()
16847 dhd_info_t *dhd = (dhd_info_t *)dhdp->info; in dhd_register_if()
16855 if (dhd == NULL || dhd->iflist[ifidx] == NULL) { in dhd_register_if()
16860 ASSERT(dhd && dhd->iflist[ifidx]); in dhd_register_if()
16861 ifp = dhd->iflist[ifidx]; in dhd_register_if()
16862 net = ifp->net; in dhd_register_if()
16863 ASSERT(net && (ifp->idx == ifidx)); in dhd_register_if()
16865 ASSERT(!net->netdev_ops); in dhd_register_if()
16866 net->netdev_ops = &dhd_ops_virt; in dhd_register_if()
16873 net->netdev_ops = &dhd_ops_pri; in dhd_register_if()
16874 if (!ETHER_ISNULLADDR(dhd->pub.mac.octet)) in dhd_register_if()
16875 memcpy(temp_addr, dhd->pub.mac.octet, ETHER_ADDR_LEN); in dhd_register_if()
16880 memcpy(temp_addr, ifp->mac_addr, ETHER_ADDR_LEN); in dhd_register_if()
16887 if (!memcmp(temp_addr, dhd->iflist[0]->mac_addr, in dhd_register_if()
16890 __func__, net->name)); in dhd_register_if()
16896 net->hard_header_len = ETH_HLEN + dhd->pub.hdrlen; in dhd_register_if()
16898 net->needed_headroom += DOT11_LLC_SNAP_HDR_LEN; in dhd_register_if()
16902 if (dhdp->awdl_ifidx && in dhd_register_if()
16903 ifidx == dhdp->awdl_ifidx) { in dhd_register_if()
16917 net->needed_headroom += DOT11_LLC_SNAP_HDR_LEN; in dhd_register_if()
16919 net->needed_headroom += DOT11_LLC_SNAP_HDR_LEN; in dhd_register_if()
16924 net->ethtool_ops = &dhd_ethtool_ops; in dhd_register_if()
16928 net->get_wireless_stats = dhd_get_wireless_stats; in dhd_register_if()
16931 net->wireless_handlers = &wl_iw_handler_def; in dhd_register_if()
16936 dhd->pub.rxsz = DBUS_RX_BUFFER_SIZE_DHD(net); in dhd_register_if()
16939 if (ifidx >= 2 && dhdp->conf->fw_type == FW_TYPE_MESH) { in dhd_register_if()
16957 if (dhd->pub.up == 1) { in dhd_register_if()
16958 if (_dhd_set_mac_address(dhd, ifidx, net->dev_addr, FALSE) == 0) in dhd_register_if()
16976 DHD_ERROR(("couldn't register the net device [%s], err %d\n", net->name, err)); in dhd_register_if()
16981 if ((ctf_dev_register(dhd->cih, net, FALSE) != BCME_OK) || in dhd_register_if()
16982 (ctf_enable(dhd->cih, net, TRUE, &dhd->brc_hot) != BCME_OK)) { in dhd_register_if()
16990 if (ifp->dwds) { in dhd_register_if()
16991 wl_ext_iapsta_attach_dwds_netdev(net, ifidx, ifp->bssidx); in dhd_register_if()
16996 wl_ext_event_attach_netdev(net, ifidx, ifp->bssidx); in dhd_register_if()
17002 wl_ext_iapsta_attach_netdev(net, ifidx, ifp->bssidx); in dhd_register_if()
17011 printf("Register interface [%s] MAC: "MACDBG"\n\n", net->name, in dhd_register_if()
17013 MAC2STRDBG(dhd->pub.mac.octet)); in dhd_register_if()
17015 MAC2STRDBG(net->dev_addr)); in dhd_register_if()
17028 __skb_queue_purge(&dhd->rx_pend_queue); in dhd_register_if()
17032 skb_queue_purge(&dhd->tx_pend_queue); in dhd_register_if()
17045 dhd->fs_check_retry = DHD_FS_CHECK_RETRIES; in dhd_register_if()
17046 dhd->wl_accel_boot_on_done = FALSE; in dhd_register_if()
17047 INIT_DELAYED_WORK(&dhd->wl_accel_work, dhd_wifi_accel_on_work_cb); in dhd_register_if()
17053 schedule_delayed_work(&dhd->wl_accel_work, in dhd_register_if()
17059 dhd_bus_put(&dhd->pub, WLAN_MODULE); in dhd_register_if()
17070 gdb_proxy_fs_try_create(ifp->info, net->name); in dhd_register_if()
17075 net->netdev_ops = NULL; in dhd_register_if()
17087 dhd = (dhd_info_t *)dhdp->info; in dhd_bus_detach()
17094 if (dhd->pub.busstate != DHD_BUS_DOWN && dhd_download_fw_on_driverload) { in dhd_bus_detach()
17096 dhd_prot_stop(&dhd->pub); in dhd_bus_detach()
17104 dbus_stop(dhd->pub.bus); in dhd_bus_detach()
17106 dhd->pub.busstate = DHD_BUS_DOWN; in dhd_bus_detach()
17108 dhd_bus_stop(dhd->pub.bus, TRUE); in dhd_bus_detach()
17132 dhd = (dhd_info_t *)dhdp->info; in dhd_detach()
17141 ifp = dhd->iflist[0]; in dhd_detach()
17142 if (ifp && ifp->net) { in dhd_detach()
17143 dev = ifp->net; in dhd_detach()
17149 if (dhd->dhd_state & DHD_ATTACH_STATE_CFG80211) { in dhd_detach()
17153 if (dev->flags & IFF_UP) { in dhd_detach()
17165 DHD_TRACE(("%s: Enter state 0x%x\n", __FUNCTION__, dhd->dhd_state)); in dhd_detach()
17171 dhd->pub.up = 0; in dhd_detach()
17172 if (!(dhd->dhd_state & DHD_ATTACH_STATE_DONE)) { in dhd_detach()
17179 dhd_free_wet_info(&dhd->pub, dhd->pub.wet_info); in dhd_detach()
17183 bcm_nanho_deinit(dhd->pub.nanhoi); in dhd_detach()
17190 if (dhd->pub.wlfc_thread) { in dhd_detach()
17191 kthread_stop(dhd->pub.wlfc_thread); in dhd_detach()
17192 dhdp->wlfc_thread_go = TRUE; in dhd_detach()
17193 wake_up_interruptible(&dhdp->wlfc_wqhead); in dhd_detach()
17195 dhd->pub.wlfc_thread = NULL; in dhd_detach()
17200 if (dhd->dhd_state & DHD_ATTACH_TIMESYNC_ATTACH_DONE) { in dhd_detach()
17205 if (dhd->dhd_state & DHD_ATTACH_STATE_PROT_ATTACH) { in dhd_detach()
17214 if (dhd_wifi_platdata && !dhdp->dongle_reset) { in dhd_detach()
17215 dhdpcie_bus_stop_host_dev(dhdp->bus); in dhd_detach()
17216 wifi_platform_set_power(dhd_wifi_platdata->adapters, in dhd_detach()
17224 if (dhdp->prot) in dhd_detach()
17243 if (dhd->dhd_state & DHD_ATTACH_STATE_EARLYSUSPEND_DONE) { in dhd_detach()
17244 if (dhd->early_suspend.suspend) in dhd_detach()
17245 unregister_early_suspend(&dhd->early_suspend); in dhd_detach()
17250 if (dhd->dhd_state & DHD_ATTACH_STATE_WL_ATTACH) { in dhd_detach()
17272 if (dhd->dhd_state & DHD_ATTACH_STATE_ADD_IF) { in dhd_detach()
17278 if (dhd->iflist[i]) { in dhd_detach()
17279 dhd_remove_if(&dhd->pub, i, TRUE); in dhd_detach()
17285 if (ifp && ifp->net) { in dhd_detach()
17287 if (dhd->cih) in dhd_detach()
17288 ctf_dev_unregister(dhd->cih, ifp->net); in dhd_detach()
17292 cfg = wl_get_cfg(ifp->net); in dhd_detach()
17294 /* in unregister_netdev case, the interface gets freed by net->destructor in dhd_detach()
17297 if (ifp->net->reg_state == NETREG_UNINITIALIZED) { in dhd_detach()
17298 free_netdev(ifp->net); in dhd_detach()
17301 custom_rps_map_clear(ifp->net->_rx); in dhd_detach()
17303 netif_tx_disable(ifp->net); in dhd_detach()
17304 unregister_netdev(ifp->net); in dhd_detach()
17307 ifp->net = DHD_NET_DEV_NULL; in dhd_detach()
17309 ifp->net = NULL; in dhd_detach()
17314 if (dhdp->prot) in dhd_detach()
17322 bcm_l2_filter_arp_table_update(dhdp->osh, ifp->phnd_arp_table, TRUE, in dhd_detach()
17323 NULL, FALSE, dhdp->tickcnt); in dhd_detach()
17324 deinit_l2_filter_arp_table(dhdp->osh, ifp->phnd_arp_table); in dhd_detach()
17325 ifp->phnd_arp_table = NULL; in dhd_detach()
17329 MFREE(dhdp->osh, ifp->qosmap_up_table, UP_TABLE_MAX); in dhd_detach()
17330 ifp->qosmap_up_table_enable = FALSE; in dhd_detach()
17335 MFREE(dhd->pub.osh, ifp, sizeof(*ifp)); in dhd_detach()
17338 if (cfg && cfg->wdev) in dhd_detach()
17339 cfg->wdev->netdev = NULL; in dhd_detach()
17345 DHD_GENERAL_LOCK(&dhd->pub, flags); in dhd_detach()
17346 timer_valid = dhd->wd_timer_valid; in dhd_detach()
17347 dhd->wd_timer_valid = FALSE; in dhd_detach()
17348 DHD_GENERAL_UNLOCK(&dhd->pub, flags); in dhd_detach()
17350 del_timer_sync(&dhd->timer); in dhd_detach()
17351 DHD_STOP_RPM_TIMER(&dhd->pub); in dhd_detach()
17354 tasklet_kill(&dhd->tasklet); in dhd_detach()
17356 if (dhd->dhd_state & DHD_ATTACH_STATE_THREADS_CREATED) { in dhd_detach()
17358 if (dhd->thr_rpm_ctl.thr_pid >= 0) { in dhd_detach()
17359 PROC_STOP(&dhd->thr_rpm_ctl); in dhd_detach()
17362 if (dhd->thr_wdt_ctl.thr_pid >= 0) { in dhd_detach()
17363 PROC_STOP(&dhd->thr_wdt_ctl); in dhd_detach()
17366 if (dhd->rxthread_enabled && dhd->thr_rxf_ctl.thr_pid >= 0) { in dhd_detach()
17367 PROC_STOP(&dhd->thr_rxf_ctl); in dhd_detach()
17370 if (dhd->thr_dpc_ctl.thr_pid >= 0) { in dhd_detach()
17371 PROC_STOP(&dhd->thr_dpc_ctl); in dhd_detach()
17374 tasklet_kill(&dhd->tasklet); in dhd_detach()
17380 if (dhd->pub.nfct) { in dhd_detach()
17381 dhd_ct_close(dhd->pub.nfct); in dhd_detach()
17385 cancel_delayed_work_sync(&dhd->dhd_dpc_dispatcher_work); in dhd_detach()
17387 if (dhd->dhd_state & DHD_ATTACH_STATE_LB_ATTACH_DONE) { in dhd_detach()
17389 dhd->dhd_state &= ~DHD_ATTACH_STATE_LB_ATTACH_DONE; in dhd_detach()
17393 cancel_work_sync(&dhd->rx_napi_dispatcher_work); in dhd_detach()
17394 __skb_queue_purge(&dhd->rx_pend_queue); in dhd_detach()
17397 cancel_work_sync(&dhd->tx_dispatcher_work); in dhd_detach()
17398 tasklet_kill(&dhd->tx_tasklet); in dhd_detach()
17399 __skb_queue_purge(&dhd->tx_pend_queue); in dhd_detach()
17406 DHD_LB_STATS_DEINIT(&dhd->pub); in dhd_detach()
17415 cancel_work_sync(&dhd->axi_error_dispatcher_work); in dhd_detach()
17418 DHD_SSSR_REG_INFO_DEINIT(&dhd->pub); in dhd_detach()
17419 DHD_SSSR_MEMPOOL_DEINIT(&dhd->pub); in dhd_detach()
17422 dhd_sdtc_etb_mempool_deinit(&dhd->pub); in dhd_detach()
17433 if (dhd->dhd_state & DHD_ATTACH_STATE_CFG80211) { in dhd_detach()
17445 destroy_workqueue(dhd->tx_wq); in dhd_detach()
17446 dhd->tx_wq = NULL; in dhd_detach()
17447 destroy_workqueue(dhd->rx_wq); in dhd_detach()
17448 dhd->rx_wq = NULL; in dhd_detach()
17451 if (dhdp->dbg) { in dhd_detach()
17454 osl_spin_lock_deinit(dhd->pub.osh, dhd->pub.dbg->pkt_mon_lock); in dhd_detach()
17458 if (dhdp->dbg) { in dhd_detach()
17462 osl_spin_lock_deinit(dhd->pub.osh, dhd->pub.mem_stats_lock); in dhd_detach()
17466 osl_spin_lock_deinit(dhd->pub.osh, dhd->pub.awdl_stats_lock); in dhd_detach()
17478 if (dhd->pub.hang_info) { in dhd_detach()
17479 MFREE(dhd->pub.osh, dhd->pub.hang_info, VENDOR_SEND_HANG_EXT_INFO_LEN); in dhd_detach()
17490 dhd_dbg_ring_proc_destroy(&dhd->pub); in dhd_detach()
17492 if (dhd->dhd_state & DHD_ATTACH_LOGTRACE_INIT) { in dhd_detach()
17493 if (dhd->event_data.fmts) { in dhd_detach()
17494 MFREE(dhd->pub.osh, dhd->event_data.fmts, in dhd_detach()
17495 dhd->event_data.fmts_size); in dhd_detach()
17497 if (dhd->event_data.raw_fmts) { in dhd_detach()
17498 MFREE(dhd->pub.osh, dhd->event_data.raw_fmts, in dhd_detach()
17499 dhd->event_data.raw_fmts_size); in dhd_detach()
17501 if (dhd->event_data.raw_sstr) { in dhd_detach()
17502 MFREE(dhd->pub.osh, dhd->event_data.raw_sstr, in dhd_detach()
17503 dhd->event_data.raw_sstr_size); in dhd_detach()
17505 if (dhd->event_data.rom_raw_sstr) { in dhd_detach()
17506 MFREE(dhd->pub.osh, dhd->event_data.rom_raw_sstr, in dhd_detach()
17507 dhd->event_data.rom_raw_sstr_size); in dhd_detach()
17509 dhd->dhd_state &= ~DHD_ATTACH_LOGTRACE_INIT; in dhd_detach()
17513 skb_queue_purge(&dhd->bt_log_queue); in dhd_detach()
17516 if (dhdp->pno_state) in dhd_detach()
17520 if (dhdp->rtt_state) { in dhd_detach()
17526 unregister_pm_notifier(&dhd->pm_notifier); in dhd_detach()
17532 if (dhd->new_freq) in dhd_detach()
17533 free_percpu(dhd->new_freq); in dhd_detach()
17534 dhd->new_freq = NULL; in dhd_detach()
17535 cpufreq_unregister_notifier(&dhd->freq_trans, CPUFREQ_TRANSITION_NOTIFIER); in dhd_detach()
17537 DHD_TRACE(("wd wakelock count:%d\n", dhd->wakelock_wd_counter)); in dhd_detach()
17539 dhd->wakelock_wd_counter = 0; in dhd_detach()
17540 dhd_wake_lock_destroy(dhd->wl_wdwake); in dhd_detach()
17542 if (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT) { in dhd_detach()
17548 dhd_tcpack_suppress_set(&dhd->pub, TCPACK_SUP_OFF); in dhd_detach()
17553 if (dhdp->prot) in dhd_detach()
17567 osl_ctfpool_cleanup(dhd->pub.osh); in dhd_detach()
17571 if (dhd->cih) in dhd_detach()
17572 ctf_detach(dhd->cih); in dhd_detach()
17579 dhd_iov_li_delete(dhdp, &(dhdp->dump_iovlist_head)); in dhd_detach()
17583 dhd_mw_list_delete(dhdp, &(dhdp->mw_list_head)); in dhd_detach()
17590 if (dhdp->enable_erpom) { in dhd_detach()
17591 dhdp->pom_func_deregister(&dhdp->pom_wlan_handler); in dhd_detach()
17595 cancel_work_sync(&dhd->dhd_hang_process_work); in dhd_detach()
17597 /* Prefer adding de-init code above this comment unless necessary. in dhd_detach()
17600 dhd_deferred_work_deinit(dhd->dhd_deferred_wq); in dhd_detach()
17601 dhd->dhd_deferred_wq = NULL; in dhd_detach()
17605 dhd_log_dump_deinit(&dhd->pub); in dhd_detach()
17608 if (dhdp->extended_trap_data) in dhd_detach()
17610 MFREE(dhdp->osh, dhdp->extended_trap_data, BCMPCIE_EXT_TRAP_DATA_MAXLEN); in dhd_detach()
17611 dhdp->extended_trap_data = NULL; in dhd_detach()
17614 if (dhdp->axi_err_dump) in dhd_detach()
17616 MFREE(dhdp->osh, dhdp->axi_err_dump, sizeof(dhd_axi_error_dump_t)); in dhd_detach()
17617 dhdp->axi_err_dump = NULL; in dhd_detach()
17624 cancel_work_sync(&dhd->bt_log_dispatcher_work); in dhd_detach()
17628 cancel_delayed_work_sync(&dhd->edl_dispatcher_work); in dhd_detach()
17634 if (dhd->pub.dump_file_manage) { in dhd_detach()
17635 MFREE(dhd->pub.osh, dhd->pub.dump_file_manage, in dhd_detach()
17641 dhd->pub.fw_download_status = FW_UNLOADED; in dhd_detach()
17644 mutex_destroy(&dhd->bus_user_lock); in dhd_detach()
17668 for (i = 0; i < ARRAYSIZE(dhdp->reorder_bufs); i++) { in dhd_free()
17669 if (dhdp->reorder_bufs[i]) { in dhd_free()
17673 ptr = dhdp->reorder_bufs[i]; in dhd_free()
17675 buf_size += ((ptr->max_idx + 1) * sizeof(void*)); in dhd_free()
17677 i, ptr->max_idx, buf_size)); in dhd_free()
17679 MFREE(dhdp->osh, dhdp->reorder_bufs[i], buf_size); in dhd_free()
17685 dhd = (dhd_info_t *)dhdp->info; in dhd_free()
17686 if (dhdp->soc_ram) { in dhd_free()
17688 DHD_OS_PREFREE(dhdp, dhdp->soc_ram, dhdp->soc_ram_length); in dhd_free()
17690 if (is_vmalloc_addr(dhdp->soc_ram)) { in dhd_free()
17691 VMFREE(dhdp->osh, dhdp->soc_ram, dhdp->soc_ram_length); in dhd_free()
17694 MFREE(dhdp->osh, dhdp->soc_ram, dhdp->soc_ram_length); in dhd_free()
17697 dhdp->soc_ram = NULL; in dhd_free()
17700 if (dhdp->cached_fw) { in dhd_free()
17701 MFREE(dhdp->osh, dhdp->cached_fw, dhdp->bus->ramsize); in dhd_free()
17704 if (dhdp->cached_nvram) { in dhd_free()
17705 MFREE(dhdp->osh, dhdp->cached_nvram, MAX_NVRAMBUF_SIZE); in dhd_free()
17710 deinit_dhd_timeouts(&dhd->pub); in dhd_free()
17716 MFREE(dhd->pub.osh, dhd, sizeof(*dhd)); in dhd_free()
17733 for (i = 0; i < ARRAYSIZE(dhdp->reorder_bufs); i++) { in dhd_clear()
17734 if (dhdp->reorder_bufs[i]) { in dhd_clear()
17738 ptr = dhdp->reorder_bufs[i]; in dhd_clear()
17740 buf_size += ((ptr->max_idx + 1) * sizeof(void*)); in dhd_clear()
17742 i, ptr->max_idx, buf_size)); in dhd_clear()
17744 MFREE(dhdp->osh, dhdp->reorder_bufs[i], buf_size); in dhd_clear()
17750 if (dhdp->soc_ram) { in dhd_clear()
17752 DHD_OS_PREFREE(dhdp, dhdp->soc_ram, dhdp->soc_ram_length); in dhd_clear()
17754 if (is_vmalloc_addr(dhdp->soc_ram)) { in dhd_clear()
17755 VMFREE(dhdp->osh, dhdp->soc_ram, dhdp->soc_ram_length); in dhd_clear()
17758 MFREE(dhdp->osh, dhdp->soc_ram, dhdp->soc_ram_length); in dhd_clear()
17761 dhdp->soc_ram = NULL; in dhd_clear()
17850 } while (retry--); in _dhd_module_init()
18001 dhd_info_t * dhd = (dhd_info_t *)(pub->info); in dhd_os_proto_block()
18004 down(&dhd->proto_sem); in dhd_os_proto_block()
18015 dhd_info_t * dhd = (dhd_info_t *)(pub->info); in dhd_os_proto_unblock()
18018 up(&dhd->proto_sem); in dhd_os_proto_unblock()
18028 dhd_info_t * dhd = (dhd_info_t *)(pub->info); in dhd_os_dhdiovar_lock()
18031 mutex_lock(&dhd->dhd_iovar_mutex); in dhd_os_dhdiovar_lock()
18038 dhd_info_t * dhd = (dhd_info_t *)(pub->info); in dhd_os_dhdiovar_unlock()
18041 mutex_unlock(&dhd->dhd_iovar_mutex); in dhd_os_dhdiovar_unlock()
18053 dhd = (dhd_info_t *)(pub->info); in dhd_os_logdump_lock()
18056 mutex_lock(&dhd->logdump_lock); in dhd_os_logdump_lock()
18068 dhd = (dhd_info_t *)(pub->info); in dhd_os_logdump_unlock()
18071 mutex_unlock(&dhd->logdump_lock); in dhd_os_logdump_unlock()
18112 dhd_info_t * dhd = (dhd_info_t *)(pub->info); in dhd_os_ioctl_resp_wait()
18123 timeout = wait_event_timeout(dhd->ioctl_resp_wait, (*condition), timeout); in dhd_os_ioctl_resp_wait()
18131 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_ioctl_resp_wake()
18133 wake_up(&dhd->ioctl_resp_wait); in dhd_os_ioctl_resp_wake()
18140 dhd_info_t * dhd = (dhd_info_t *)(pub->info); in dhd_os_d3ack_wait()
18149 timeout = wait_event_timeout(dhd->d3ack_wait, (*condition), timeout); in dhd_os_d3ack_wait()
18158 dhd_info_t * dhd = (dhd_info_t *)(pub->info); in dhd_os_ds_exit_wait()
18167 timeout = wait_event_timeout(dhd->ds_exit_wait, (*condition), timeout); in dhd_os_ds_exit_wait()
18175 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_ds_exit_wake()
18177 wake_up_all(&dhd->ds_exit_wait); in dhd_os_ds_exit_wake()
18186 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_d3ack_wake()
18188 wake_up(&dhd->d3ack_wait); in dhd_os_d3ack_wake()
18195 dhd_info_t * dhd = (dhd_info_t *)(pub->info); in dhd_os_busbusy_wait_negation()
18205 timeout = wait_event_timeout(dhd->dhd_bus_busy_state_wait, !(*condition), timeout); in dhd_os_busbusy_wait_negation()
18218 dhd_info_t * dhd = (dhd_info_t *)(pub->info); in dhd_os_busbusy_wait_condition()
18224 timeout = wait_event_timeout(dhd->dhd_bus_busy_state_wait, (*var == condition), timeout); in dhd_os_busbusy_wait_condition()
18238 dhd_info_t * dhd = (dhd_info_t *)(pub->info); in dhd_os_busbusy_wait_bitmask()
18244 timeout = wait_event_timeout(dhd->dhd_bus_busy_state_wait, in dhd_os_busbusy_wait_bitmask()
18254 dhd_info_t * dhd = (dhd_info_t *)(pub->info); in dhd_os_dmaxfer_wait()
18259 ret = wait_event_timeout(dhd->dmaxfer_wait, (*condition), timeout); in dhd_os_dmaxfer_wait()
18268 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_dmaxfer_wake()
18270 wake_up(&dhd->dmaxfer_wait); in dhd_os_dmaxfer_wake()
18279 wake_up(&dhd->tx_completion_wait); in dhd_os_tx_completion_wake()
18286 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_busbusy_wake()
18289 wake_up(&dhd->dhd_bus_busy_state_wait); in dhd_os_busbusy_wake()
18298 dhd_info_t *dhd = (dhd_info_t *)pub->info; in dhd_os_wd_timer_extend()
18303 dhd_os_wd_timer(bus, dhd->default_wd_interval); in dhd_os_wd_timer_extend()
18312 dhd_info_t *dhd = (dhd_info_t *)pub->info; in dhd_os_wd_timer()
18325 if (pub->busstate == DHD_BUS_DOWN) { in dhd_os_wd_timer()
18336 if (!wdtick && dhd->wd_timer_valid == TRUE) { in dhd_os_wd_timer()
18337 dhd->wd_timer_valid = FALSE; in dhd_os_wd_timer()
18339 del_timer_sync(&dhd->timer); in dhd_os_wd_timer()
18352 mod_timer(&dhd->timer, jiffies + msecs_to_jiffies(dhd_watchdog_ms)); in dhd_os_wd_timer()
18353 dhd->wd_timer_valid = TRUE; in dhd_os_wd_timer()
18364 dhd_info_t *dhd = (dhd_info_t *)pub->info; in dhd_os_runtimepm_timer()
18382 /* If tick is non-zero, the request is to start the timer */ in dhd_os_runtimepm_timer()
18385 if (dhd->rpm_timer_valid == FALSE) { in dhd_os_runtimepm_timer()
18386 mod_timer(&dhd->rpm_timer, jiffies + msecs_to_jiffies(dhd_runtimepm_ms)); in dhd_os_runtimepm_timer()
18387 dhd->rpm_timer_valid = TRUE; in dhd_os_runtimepm_timer()
18393 if (dhd->rpm_timer_valid == TRUE) { in dhd_os_runtimepm_timer()
18394 dhd->rpm_timer_valid = FALSE; in dhd_os_runtimepm_timer()
18396 del_timer_sync(&dhd->rpm_timer); in dhd_os_runtimepm_timer()
18417 ret = request_firmware(fw, file_path, dhd_bus_to_dev(g_dhd_pub->bus)); in dhd_os_get_img_fwreq()
18423 DHD_ERROR(("%s: %s (%zu bytes) open success\n", __FUNCTION__, file_path, (*fw)->size)); in dhd_os_get_img_fwreq()
18453 if (!S_ISREG(file_inode(fp)->i_mode)) { in dhd_os_open_image1()
18484 rdlen = dhd_kernel_read_compat(fp, fp->f_pos, buf, MIN(len, size)); in dhd_os_get_image_block()
18487 return -EIO; in dhd_os_get_image_block()
18491 fp->f_pos += rdlen; in dhd_os_get_image_block()
18509 rd_len = dhd_kernel_read_compat(fp, fp->f_pos, str, len); in dhd_os_gets_image()
18514 str_len = (uint)(str_end - str); in dhd_os_gets_image()
18517 fp->f_pos += str_len + 1; in dhd_os_gets_image()
18518 bzero(str_end, rd_len - str_len); in dhd_os_gets_image()
18552 dhd = (dhd_info_t *)(pub->info); in dhd_os_sdlock()
18555 spin_lock_bh(&dhd->sdlock); in dhd_os_sdlock()
18558 down(&dhd->sdsem); in dhd_os_sdlock()
18560 spin_lock_bh(&dhd->sdlock); in dhd_os_sdlock()
18569 dhd = (dhd_info_t *)(pub->info); in dhd_os_sdunlock()
18572 spin_unlock_bh(&dhd->sdlock); in dhd_os_sdunlock()
18575 up(&dhd->sdsem); in dhd_os_sdunlock()
18577 spin_unlock_bh(&dhd->sdlock); in dhd_os_sdunlock()
18586 dhd = (dhd_info_t *)(pub->info); in dhd_os_sdlock_txq()
18588 spin_lock_irqsave(&dhd->txqlock, dhd->txqlock_flags); in dhd_os_sdlock_txq()
18590 spin_lock_bh(&dhd->txqlock); in dhd_os_sdlock_txq()
18599 dhd = (dhd_info_t *)(pub->info); in dhd_os_sdunlock_txq()
18601 spin_unlock_irqrestore(&dhd->txqlock, dhd->txqlock_flags); in dhd_os_sdunlock_txq()
18603 spin_unlock_bh(&dhd->txqlock); in dhd_os_sdunlock_txq()
18613 dhd = (dhd_info_t *)(pub->info); in dhd_os_sdlock_txoff()
18614 spin_lock_irqsave(&dhd->txoff_lock, flags); in dhd_os_sdlock_txoff()
18624 dhd = (dhd_info_t *)(pub->info); in dhd_os_sdunlock_txoff()
18625 spin_unlock_irqrestore(&dhd->txoff_lock, flags); in dhd_os_sdunlock_txoff()
18643 dhd = (dhd_info_t *)(pub->info); in dhd_os_rxflock()
18644 spin_lock_bh(&dhd->rxf_lock); in dhd_os_rxflock()
18653 dhd = (dhd_info_t *)(pub->info); in dhd_os_rxfunlock()
18654 spin_unlock_bh(&dhd->rxf_lock); in dhd_os_rxfunlock()
18664 dhd = (dhd_info_t *)(pub->info); in dhd_os_tcpacklock()
18668 spin_lock_bh(&dhd->tcpack_lock); in dhd_os_tcpacklock()
18670 flags = osl_spin_lock(&dhd->tcpack_lock); in dhd_os_tcpacklock()
18686 dhd = (dhd_info_t *)(pub->info); in dhd_os_tcpackunlock()
18690 spin_unlock_bh(&dhd->tcpack_lock); in dhd_os_tcpackunlock()
18692 osl_spin_unlock(&dhd->tcpack_lock, flags); in dhd_os_tcpackunlock()
18703 buf = (uint8*)wifi_platform_prealloc(dhdpub->info->adapter, section, size); in dhd_os_prealloc()
18721 if (!dhd->pub.up) { in dhd_get_wireless_stats()
18725 if (!(dev->flags & IFF_UP)) { in dhd_get_wireless_stats()
18729 res = wl_iw_get_wireless_stats(dev, &dhd->iw.wstats); in dhd_get_wireless_stats()
18732 return &dhd->iw.wstats; in dhd_get_wireless_stats()
18749 bcmerror = wl_process_host_event(&dhd->pub, &ifidx, pktdata, pktlen, event, data, in dhd_wl_host_event()
18750 &dhd->event_data); in dhd_wl_host_event()
18752 bcmerror = wl_process_host_event(&dhd->pub, &ifidx, pktdata, pktlen, event, data, in dhd_wl_host_event()
18759 if (ntoh32(event->event_type) == WLC_E_IF) { in dhd_wl_host_event()
18768 wl_ext_event_send(dhd->pub.event_params, event, *data); in dhd_wl_host_event()
18772 if (dhd->iflist[ifidx]->net) { in dhd_wl_host_event()
18773 DHD_UP_LOCK(&dhd->pub.up_lock, flags); in dhd_wl_host_event()
18774 if (dhd->pub.up) { in dhd_wl_host_event()
18775 wl_cfg80211_event(dhd->iflist[ifidx]->net, event, *data); in dhd_wl_host_event()
18777 DHD_UP_UNLOCK(&dhd->pub.up_lock, flags); in dhd_wl_host_event()
18788 switch (ntoh32(event->event_type)) { in dhd_sendup_event()
18809 dhd = dhdp->info; in dhd_sendup_log()
18811 if ((p = PKTGET(dhdp->osh, pktlen, FALSE))) { in dhd_sendup_log()
18812 ASSERT(ISALIGNED((uintptr)PKTDATA(dhdp->osh, p), sizeof(uint32))); in dhd_sendup_log()
18814 bcopy(&dhdp->mac, ð.ether_dhost, ETHER_ADDR_LEN); in dhd_sendup_log()
18815 bcopy(&dhdp->mac, ð.ether_shost, ETHER_ADDR_LEN); in dhd_sendup_log()
18819 bcopy((void *)ð, PKTDATA(dhdp->osh, p), sizeof(eth)); in dhd_sendup_log()
18820 bcopy(data, PKTDATA(dhdp->osh, p) + sizeof(eth), data_len); in dhd_sendup_log()
18821 skb = PKTTONATIVE(dhdp->osh, p); in dhd_sendup_log()
18822 skb_data = skb->data; in dhd_sendup_log()
18823 len = skb->len; in dhd_sendup_log()
18826 ifp = dhd->iflist[ifidx]; in dhd_sendup_log()
18828 ifp = dhd->iflist[0]; in dhd_sendup_log()
18831 skb->dev = ifp->net; in dhd_sendup_log()
18832 skb->protocol = eth_type_trans(skb, skb->dev); in dhd_sendup_log()
18833 skb->data = skb_data; in dhd_sendup_log()
18834 skb->len = len; in dhd_sendup_log()
18857 struct dhd_info *dhdinfo = dhd->info; in dhd_wait_for_event()
18862 wait_event_timeout(dhdinfo->ctrl_wait, (*lockvar == FALSE), timeout); in dhd_wait_for_event()
18871 struct dhd_info *dhdinfo = dhd->info; in dhd_wait_event_wakeup()
18872 if (waitqueue_active(&dhdinfo->ctrl_wait)) in dhd_wait_event_wakeup()
18873 wake_up(&dhdinfo->ctrl_wait); in dhd_wait_event_wakeup()
18887 if (pm_runtime_get_sync(dhd_bus_to_dev(dhd->pub.bus)) < 0) in dhd_net_bus_devreset()
18893 /* Issue wl down command for non-cfg before resetting the chip */ in dhd_net_bus_devreset()
18894 if (dhd_wl_ioctl_cmd(&dhd->pub, WLC_DOWN, NULL, 0, TRUE, 0) < 0) { in dhd_net_bus_devreset()
18899 if (dhd->pub.wlfc_enabled) { in dhd_net_bus_devreset()
18900 dhd_wlfc_deinit(&dhd->pub); in dhd_net_bus_devreset()
18904 if (dhd->pub.pno_state) { in dhd_net_bus_devreset()
18905 dhd_pno_deinit(&dhd->pub); in dhd_net_bus_devreset()
18909 if (dhd->pub.rtt_state) { in dhd_net_bus_devreset()
18910 dhd_rtt_deinit(&dhd->pub); in dhd_net_bus_devreset()
18914 DHD_SSSR_DUMP_DEINIT(&dhd->pub); in dhd_net_bus_devreset()
18916 if (dhd->pub.sdtc_etb_inited) { in dhd_net_bus_devreset()
18917 dhd_sdtc_etb_deinit(&dhd->pub); in dhd_net_bus_devreset()
18926 dhd_os_dbg_detach_pkt_monitor(&dhd->pub); in dhd_net_bus_devreset()
18938 dhd_bus_update_fw_nv_path(dhd->pub.bus, in dhd_net_bus_devreset()
18939 dhd->fw_path, dhd->nv_path, dhd->clm_path, dhd->conf_path); in dhd_net_bus_devreset()
18944 /* XXX: JIRA SWWLAN-139454: Added L1ss enable in dhd_net_bus_devreset()
18946 * JIRA SWWLAN-142236: Amendment - Changed L1ss enable point in dhd_net_bus_devreset()
18949 if (flag == FALSE && dhd->pub.busstate == DHD_BUS_DOWN) { in dhd_net_bus_devreset()
18959 ret = dhd_bus_devreset(&dhd->pub, flag); in dhd_net_bus_devreset()
18962 pm_runtime_mark_last_busy(dhd_bus_to_dev(dhd->pub.bus)); in dhd_net_bus_devreset()
18963 pm_runtime_put_autosuspend(dhd_bus_to_dev(dhd->pub.bus)); in dhd_net_bus_devreset()
18968 dhd->pub.dongle_trap_occured = 0; in dhd_net_bus_devreset()
18970 dhd->pub.dongle_trap_due_to_bt = 0; in dhd_net_bus_devreset()
18972 dhd->pub.iovar_timeout_occured = 0; in dhd_net_bus_devreset()
18974 dhd->pub.d3ack_timeout_occured = 0; in dhd_net_bus_devreset()
18975 dhd->pub.livelock_occured = 0; in dhd_net_bus_devreset()
18976 dhd->pub.pktid_audit_failed = 0; in dhd_net_bus_devreset()
18978 dhd->pub.smmu_fault_occurred = 0; in dhd_net_bus_devreset()
18979 dhd->pub.iface_op_failed = 0; in dhd_net_bus_devreset()
18980 dhd->pub.scan_timeout_occurred = 0; in dhd_net_bus_devreset()
18981 dhd->pub.scan_busy_occurred = 0; in dhd_net_bus_devreset()
18996 return dhd_bus_suspend(&dhd->pub); in dhd_net_bus_suspend()
19003 return dhd_bus_resume(&dhd->pub, stage); in dhd_net_bus_resume()
19015 ret = dhd->pub.suspend_disable_flag; in net_os_set_suspend_disable()
19016 dhd->pub.suspend_disable_flag = val; in net_os_set_suspend_disable()
19026 if (dhd && (dhd->pub.conf->suspend_mode == EARLY_SUSPEND || in net_os_set_suspend()
19027 dhd->pub.conf->suspend_mode == SUSPEND_MODE_2)) { in net_os_set_suspend()
19028 if (dhd->pub.conf->suspend_mode == EARLY_SUSPEND && !val) in net_os_set_suspend()
19029 dhd_conf_set_suspend_resume(&dhd->pub, val); in net_os_set_suspend()
19031 ret = dhd_set_suspend(val, &dhd->pub); in net_os_set_suspend()
19038 if (dhd->pub.conf->suspend_mode == EARLY_SUSPEND && val) in net_os_set_suspend()
19039 dhd_conf_set_suspend_resume(&dhd->pub, val); in net_os_set_suspend()
19051 dhd->pub.suspend_bcn_li_dtim = val; in net_os_set_suspend_bcn_li_dtim()
19065 dhd->pub.max_dtim_enable = TRUE; in net_os_set_max_dtim_enable()
19067 dhd->pub.max_dtim_enable = FALSE; in net_os_set_max_dtim_enable()
19070 return -1; in net_os_set_max_dtim_enable()
19085 dhd->pub.disable_dtim_in_suspend = TRUE; in net_os_set_disable_dtim_in_suspend()
19087 dhd->pub.disable_dtim_in_suspend = FALSE; in net_os_set_disable_dtim_in_suspend()
19119 if (num >= dhd->pub.pktfilter_count) { in net_os_rxfilter_add_remove()
19120 return -EINVAL; in net_os_rxfilter_add_remove()
19123 ret = dhd_packet_filter_add_remove(&dhd->pub, add_remove, num); in net_os_rxfilter_add_remove()
19132 * - set : net_os_rxfilter_add_remove() -> dhd_set_packet_filter() -> dhd_pktfilter_offload_set()
19133 * - enable : net_os_enable_packet_filter() -> dhd_enable_packet_filter()
19134 * -> dhd_pktfilter_offload_enable()
19141 /* Packet filtering is set only if we still in early-suspend and in dhd_os_enable_packet_filter()
19143 * We can always turn it OFF in case of early-suspend, but we turn it in dhd_os_enable_packet_filter()
19146 if (dhdp && dhdp->up) { in dhd_os_enable_packet_filter()
19147 if (dhdp->in_suspend) { in dhd_os_enable_packet_filter()
19148 if (!val || (val && !dhdp->suspend_disable_flag)) in dhd_os_enable_packet_filter()
19161 return dhd_os_enable_packet_filter(&dhd->pub, val); in net_os_enable_packet_filter()
19171 if ((ret = dhd_sync_with_dongle(&dhd->pub)) < 0) in dhd_dev_init_ioctl()
19182 dhd_pub_t *dhd = (&ptr->pub); in dhd_dev_get_feature_set()
19196 if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) in dhd_dev_get_feature_set()
19209 if (dhd->rtt_supported) { in dhd_dev_get_feature_set()
19334 dhd->pub.dhd_cflags |= WLAN_PLAT_NODFS_FLAG; in dhd_dev_set_nodfs()
19336 dhd->pub.dhd_cflags &= ~WLAN_PLAT_NODFS_FLAG; in dhd_dev_set_nodfs()
19337 dhd->pub.force_country_change = TRUE; in dhd_dev_set_nodfs()
19347 dhd_pub_t *dhdp = &dhd->pub; in dhd_dev_ndo_cfg()
19352 dhdp->ndo_enable = TRUE; in dhd_dev_ndo_cfg()
19362 dhdp->ndo_enable = FALSE; in dhd_dev_ndo_cfg()
19381 read_lock_bh(&inet6->lock); in dhd_dev_ndo_get_valid_inet6addr_count()
19385 list_for_each_entry(ifa, &inet6->addr_list, if_list) { in dhd_dev_ndo_get_valid_inet6addr_count()
19387 if ((ifa->flags & IFA_F_DADFAILED) == 0) { in dhd_dev_ndo_get_valid_inet6addr_count()
19393 acaddr = inet6->ac_list; in dhd_dev_ndo_get_valid_inet6addr_count()
19396 acaddr = acaddr->aca_next; in dhd_dev_ndo_get_valid_inet6addr_count()
19400 read_unlock_bh(&inet6->lock); in dhd_dev_ndo_get_valid_inet6addr_count()
19419 * unicast addr in inet6_dev->addr_list in dhd_dev_ndo_update_inet6addr()
19420 * anycast addr in inet6_dev->ac_list in dhd_dev_ndo_update_inet6addr()
19426 inet6 = dev->ip6_ptr; in dhd_dev_ndo_update_inet6addr()
19437 dhdp = &dhd->pub; in dhd_dev_ndo_update_inet6addr()
19450 if (cnt > dhdp->ndo_max_host_ip) { in dhd_dev_ndo_update_inet6addr()
19451 if (!dhdp->ndo_host_ip_overflow) { in dhd_dev_ndo_update_inet6addr()
19452 dhdp->ndo_host_ip_overflow = TRUE; in dhd_dev_ndo_update_inet6addr()
19467 ipv6_addr = (struct in6_addr *)MALLOC(dhdp->osh, in dhd_dev_ndo_update_inet6addr()
19468 sizeof(struct in6_addr) * dhdp->ndo_max_host_ip); in dhd_dev_ndo_update_inet6addr()
19476 read_lock_bh(&inet6->lock); in dhd_dev_ndo_update_inet6addr()
19478 list_for_each_entry(ifa, &inet6->addr_list, if_list) { in dhd_dev_ndo_update_inet6addr()
19481 if ((ifa->flags & IFA_F_DADFAILED) && in dhd_dev_ndo_update_inet6addr()
19482 (cnt < dhdp->ndo_max_host_ip)) { in dhd_dev_ndo_update_inet6addr()
19483 memcpy(&ipv6_addr[cnt], &ifa->addr, sizeof(struct in6_addr)); in dhd_dev_ndo_update_inet6addr()
19487 read_unlock_bh(&inet6->lock); in dhd_dev_ndo_update_inet6addr()
19508 if (dhdp->ndo_host_ip_overflow) { in dhd_dev_ndo_update_inet6addr()
19511 read_lock_bh(&inet6->lock); in dhd_dev_ndo_update_inet6addr()
19513 list_for_each_entry(ifa, &inet6->addr_list, if_list) { in dhd_dev_ndo_update_inet6addr()
19516 if (!(ifa->flags & IFA_F_DADFAILED) && in dhd_dev_ndo_update_inet6addr()
19517 (cnt < dhdp->ndo_max_host_ip)) { in dhd_dev_ndo_update_inet6addr()
19518 memcpy(&ipv6_addr[cnt], &ifa->addr, in dhd_dev_ndo_update_inet6addr()
19523 read_unlock_bh(&inet6->lock); in dhd_dev_ndo_update_inet6addr()
19537 read_lock_bh(&inet6->lock); in dhd_dev_ndo_update_inet6addr()
19538 acaddr = inet6->ac_list; in dhd_dev_ndo_update_inet6addr()
19540 if (cnt < dhdp->ndo_max_host_ip) { in dhd_dev_ndo_update_inet6addr()
19541 memcpy(&ipv6_addr[cnt], &acaddr->aca_addr, sizeof(struct in6_addr)); in dhd_dev_ndo_update_inet6addr()
19544 acaddr = acaddr->aca_next; in dhd_dev_ndo_update_inet6addr()
19546 read_unlock_bh(&inet6->lock); in dhd_dev_ndo_update_inet6addr()
19558 if (dhdp->ndo_host_ip_overflow) { in dhd_dev_ndo_update_inet6addr()
19559 dhdp->ndo_host_ip_overflow = FALSE; in dhd_dev_ndo_update_inet6addr()
19560 if (dhdp->in_suspend) { in dhd_dev_ndo_update_inet6addr()
19569 MFREE(dhdp->osh, ipv6_addr, sizeof(struct in6_addr) * dhdp->ndo_max_host_ip); in dhd_dev_ndo_update_inet6addr()
19584 return (dhd_pno_stop_for_ssid(&dhd->pub)); in dhd_dev_pno_stop_for_ssid()
19593 return (dhd_pno_set_for_ssid(&dhd->pub, ssids_local, nssid, scan_fr, in dhd_dev_pno_set_for_ssid()
19603 return (dhd_pno_enable(&dhd->pub, enable)); in dhd_dev_pno_enable()
19612 return (dhd_pno_set_for_hotlist(&dhd->pub, p_pfn_bssid, hotlist_params)); in dhd_dev_pno_set_for_hotlist()
19619 return (dhd_pno_stop_for_batch(&dhd->pub)); in dhd_dev_pno_stop_for_batch()
19627 return (dhd_pno_set_for_batch(&dhd->pub, batch_params)); in dhd_dev_pno_set_for_batch()
19635 return (dhd_pno_get_for_batch(&dhd->pub, buf, bufsize, PNO_STATUS_NORMAL)); in dhd_dev_pno_get_for_batch()
19646 return (dhd_is_legacy_pno_enabled(&dhd->pub)); in dhd_dev_is_legacy_pno_enabled()
19656 return dhd_pno_set_epno(&dhd->pub); in dhd_dev_set_epno()
19665 return dhd_pno_flush_fw_epno(&dhd->pub); in dhd_dev_flush_fw_epno()
19675 return (dhd_pno_set_cfg_gscan(&dhd->pub, type, buf, flush)); in dhd_dev_pno_set_cfg_gscan()
19685 return (dhd_pno_get_gscan(&dhd->pub, type, info, len)); in dhd_dev_pno_get_gscan()
19694 return (dhd_wait_batch_results_complete(&dhd->pub)); in dhd_dev_wait_batch_results_complete()
19703 return (dhd_pno_lock_batch_results(&dhd->pub)); in dhd_dev_pno_lock_access_batch_results()
19711 return (dhd_pno_unlock_batch_results(&dhd->pub)); in dhd_dev_pno_unlock_access_batch_results()
19720 return (dhd_pno_initiate_gscan_request(&dhd->pub, run, flush)); in dhd_dev_pno_run_gscan()
19729 return (dhd_pno_enable_full_scan_result(&dhd->pub, real_time_flag)); in dhd_dev_pno_enable_full_scan_result()
19739 return (dhd_handle_hotlist_scan_evt(&dhd->pub, data, send_evt_bytes, type, buf_len)); in dhd_dev_hotlist_scan_event()
19749 return (dhd_process_full_gscan_result(&dhd->pub, data, len, send_evt_bytes)); in dhd_dev_process_full_gscan_result()
19757 dhd_gscan_hotlist_cache_cleanup(&dhd->pub, type); in dhd_dev_gscan_hotlist_cache_cleanup()
19767 return (dhd_gscan_batch_cache_cleanup(&dhd->pub)); in dhd_dev_gscan_batch_cache_cleanup()
19776 return (dhd_retreive_batch_scan_results(&dhd->pub)); in dhd_dev_retrieve_batch_scan()
19785 return (dhd_pno_process_epno_result(&dhd->pub, data, event, send_evt_bytes)); in dhd_dev_process_epno_result()
19801 roam_param->a_band_boost_threshold, roam_param->a_band_penalty_threshold)); in dhd_dev_set_lazy_roam_cfg()
19803 roam_param->a_band_boost_factor, roam_param->a_band_penalty_factor, in dhd_dev_set_lazy_roam_cfg()
19804 roam_param->cur_bssid_boost)); in dhd_dev_set_lazy_roam_cfg()
19806 roam_param->alert_roam_trigger_threshold, roam_param->a_band_max_boost)); in dhd_dev_set_lazy_roam_cfg()
19811 if (dhd->pub.lazy_roam_enable) { in dhd_dev_set_lazy_roam_cfg()
19814 err = dhd_iovar(&dhd->pub, 0, "roam_exp_params", in dhd_dev_set_lazy_roam_cfg()
19836 err = dhd_iovar(&dhd->pub, 0, "roam_exp_params", in dhd_dev_lazy_roam_enable()
19842 dhd->pub.lazy_roam_enable = (enable != 0); in dhd_dev_lazy_roam_enable()
19855 bssid_pref->version = BSSID_PREF_LIST_VERSION; in dhd_dev_set_lazy_roam_bssid_pref()
19857 bssid_pref->flags = (flush && !bssid_pref->count) ? ROAM_EXP_CLEAR_BSSID_PREF: 0; in dhd_dev_set_lazy_roam_bssid_pref()
19859 if (bssid_pref->count) { in dhd_dev_set_lazy_roam_bssid_pref()
19860 len += (bssid_pref->count - 1) * sizeof(wl_bssid_pref_list_t); in dhd_dev_set_lazy_roam_bssid_pref()
19862 err = dhd_iovar(&dhd->pub, 0, "roam_exp_bssid_pref", in dhd_dev_set_lazy_roam_bssid_pref()
19881 err = dhd_wl_ioctl_cmd(&(dhd->pub), WLC_SET_MACLIST, (char *)blacklist, in dhd_dev_set_blacklist_bssid()
19890 err = dhd_wl_ioctl_cmd(&(dhd->pub), WLC_SET_MACMODE, (char *)&macmode, in dhd_dev_set_blacklist_bssid()
19909 ssid_whitelist->ssid_count = 0; in dhd_dev_set_whitelist_ssid()
19915 ssid_whitelist->version = SSID_WHITELIST_VERSION; in dhd_dev_set_whitelist_ssid()
19916 ssid_whitelist->flags = flush ? ROAM_EXP_CLEAR_SSID_WHITELIST : 0; in dhd_dev_set_whitelist_ssid()
19917 err = dhd_iovar(&dhd->pub, 0, "roam_exp_ssid_whitelist", (char *)ssid_whitelist, len, NULL, in dhd_dev_set_whitelist_ssid()
19945 err = dhd_iovar(&dhd->pub, 0, "rssi_monitor", (char *)&rssi_monitor, sizeof(rssi_monitor), in dhd_dev_set_rssi_monitor_cfg()
19961 err = dhd_tcpack_suppress_set(&dhd->pub, enable); in dhd_dev_set_tcpack_sup_mode_cfg()
19973 dhd_pub_t *dhdp = &dhd->pub; in dhd_dev_cfg_rand_mac_oui()
19984 uint8 *rand_mac_oui = dhdp->rand_mac_oui; in dhd_dev_cfg_rand_mac_oui()
19986 DHD_ERROR(("Random MAC OUI to be used - "MACOUIDBG"\n", in dhd_dev_cfg_rand_mac_oui()
19997 uint8 *rand_mac_oui = dhd->rand_mac_oui; in dhd_set_rand_mac_oui()
20008 DHD_ERROR(("Setting rand mac oui to FW - "MACOUIDBG"\n", in dhd_set_rand_mac_oui()
20025 return (dhd_rtt_set_cfg(&dhd->pub, buf)); in dhd_dev_rtt_set_cfg()
20033 return (dhd_rtt_stop(&dhd->pub, mac_list, mac_cnt)); in dhd_dev_rtt_cancel_cfg()
20041 return (dhd_rtt_register_noti_callback(&dhd->pub, ctx, noti_fn)); in dhd_dev_rtt_register_noti_callback()
20049 return (dhd_rtt_unregister_noti_callback(&dhd->pub, noti_fn)); in dhd_dev_rtt_unregister_noti_callback()
20057 return (dhd_rtt_capability(&dhd->pub, capa)); in dhd_dev_rtt_capability()
20064 return (dhd_rtt_avail_channel(&dhd->pub, channel_info)); in dhd_dev_rtt_avail_channel()
20071 return (dhd_rtt_enable_responder(&dhd->pub, channel_info)); in dhd_dev_rtt_enable_responder()
20077 return (dhd_rtt_cancel_responder(&dhd->pub)); in dhd_dev_rtt_cancel_responder()
20085 mutex_lock(&dhd->dhd_apf_mutex); in _dhd_apf_lock_local()
20092 mutex_unlock(&dhd->dhd_apf_mutex); in _dhd_apf_unlock_local()
20101 dhd_pub_t *dhdp = &dhd->pub; in __dhd_apf_add_filter()
20112 return -ENODEV; in __dhd_apf_add_filter()
20123 return -EINVAL; in __dhd_apf_add_filter()
20128 buf = MALLOCZ(dhdp->osh, buf_len); in __dhd_apf_add_filter()
20131 return -ENOMEM; in __dhd_apf_add_filter()
20137 pkt_filterp->id = htod32(filter_id); in __dhd_apf_add_filter()
20138 pkt_filterp->negate_match = htod32(FALSE); in __dhd_apf_add_filter()
20139 pkt_filterp->type = htod32(WL_PKT_FILTER_TYPE_APF_MATCH); in __dhd_apf_add_filter()
20141 apf_program = &pkt_filterp->u.apf_program; in __dhd_apf_add_filter()
20142 apf_program->version = htod16(WL_APF_INTERNAL_VERSION); in __dhd_apf_add_filter()
20143 apf_program->instr_len = htod16(program_len); in __dhd_apf_add_filter()
20144 memcpy(apf_program->instrs, program, program_len); in __dhd_apf_add_filter()
20153 MFREE(dhdp->osh, buf, buf_len); in __dhd_apf_add_filter()
20163 dhd_pub_t *dhdp = &dhd->pub; in __dhd_apf_config_filter()
20173 return -ENODEV; in __dhd_apf_config_filter()
20179 buf = MALLOCZ(dhdp->osh, buf_len); in __dhd_apf_config_filter()
20182 return -ENOMEM; in __dhd_apf_config_filter()
20188 pkt_filterp->id = htod32(filter_id); in __dhd_apf_config_filter()
20189 pkt_filterp->enable = htod32(enable); in __dhd_apf_config_filter()
20207 MFREE(dhdp->osh, buf, buf_len); in __dhd_apf_config_filter()
20216 dhd_pub_t *dhdp = &dhd->pub; in __dhd_apf_delete_filter()
20222 return -ENODEV; in __dhd_apf_delete_filter()
20251 dhd_pub_t *dhdp = &dhd->pub; in dhd_dev_apf_get_version()
20268 return -ENODEV; in dhd_dev_apf_get_version()
20285 dhd_pub_t *dhdp = &dhd->pub; in dhd_dev_apf_get_max_len()
20297 return -ENODEV; in dhd_dev_apf_get_max_len()
20315 dhd_pub_t *dhdp = &dhd->pub; in dhd_dev_apf_add_filter()
20321 if (dhdp->apf_set) { in dhd_dev_apf_add_filter()
20326 dhdp->apf_set = FALSE; in dhd_dev_apf_add_filter()
20333 dhdp->apf_set = TRUE; in dhd_dev_apf_add_filter()
20335 if (dhdp->in_suspend && dhdp->apf_set && !(dhdp->op_mode & DHD_FLAG_HOSTAP_MODE)) { in dhd_dev_apf_add_filter()
20350 dhd_pub_t *dhdp = &dhd->pub; in dhd_dev_apf_enable_filter()
20358 if (dhdp->apf_set && (!(dhdp->op_mode & DHD_FLAG_HOSTAP_MODE) && in dhd_dev_apf_enable_filter()
20373 dhd_pub_t *dhdp = &dhd->pub; in dhd_dev_apf_disable_filter()
20378 if (dhdp->apf_set) { in dhd_dev_apf_disable_filter()
20392 dhd_pub_t *dhdp = &dhd->pub; in dhd_dev_apf_delete_filter()
20397 if (dhdp->apf_set) { in dhd_dev_apf_delete_filter()
20400 dhdp->apf_set = FALSE; in dhd_dev_apf_delete_filter()
20419 /* Ignore compiler warnings due to -Werror=cast-qual */ in dhd_hang_process()
20424 if (!dhd || !dhd->iflist[0]) in dhd_hang_process()
20426 dev = dhd->iflist[0]->net; in dhd_hang_process()
20447 ndev = dhd->iflist[i] ? dhd->iflist[i]->net : NULL; in dhd_hang_process()
20448 if (ndev && (ndev->flags & IFF_UP)) { in dhd_hang_process()
20449 DHD_ERROR(("ndev->name : %s dev close\n", in dhd_hang_process()
20450 ndev->name)); in dhd_hang_process()
20466 link_recovery->hang_reason = HANG_REASON_PCIE_LINK_DOWN_RC_DETECT; in dhd_host_recover_link()
20487 return -EINVAL; in dhd_os_send_hang_message()
20490 dhd_info = (dhd_info_t *)dhdp->info; in dhd_os_send_hang_message()
20494 if (!dhd_info->wl_accel_force_reg_on) { in dhd_os_send_hang_message()
20496 dhd_info->wl_accel_force_reg_on = TRUE; in dhd_os_send_hang_message()
20500 if (!dhdp->hang_report) { in dhd_os_send_hang_message()
20506 if (dhd_info->scheduled_memdump) { in dhd_os_send_hang_message()
20508 dhdp->hang_was_pending = 1; in dhd_os_send_hang_message()
20517 return -ENODEV; in dhd_os_send_hang_message()
20522 return -EINVAL; in dhd_os_send_hang_message()
20528 return -ENODEV; in dhd_os_send_hang_message()
20533 if (dhdp->req_hang_type) { in dhd_os_send_hang_message()
20535 __FUNCTION__, dhdp->req_hang_type)); in dhd_os_send_hang_message()
20536 dhdp->req_hang_type = 0; in dhd_os_send_hang_message()
20540 if (!dhdp->hang_was_sent) { in dhd_os_send_hang_message()
20542 if (dhdp->op_mode & DHD_FLAG_MFG_MODE) { in dhd_os_send_hang_message()
20543 dhdp->hang_count++; in dhd_os_send_hang_message()
20544 if (dhdp->hang_count >= MAX_CONSECUTIVE_MFG_HANG_COUNT) { in dhd_os_send_hang_message()
20546 __FUNCTION__, dhdp->hang_count)); in dhd_os_send_hang_message()
20555 if (!dhdp->info->duart_execute) { in dhd_os_send_hang_message()
20556 dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq, in dhd_os_send_hang_message()
20561 dhdp->hang_was_sent = 1; in dhd_os_send_hang_message()
20563 dhdp->is_bt_recovery_required = TRUE; in dhd_os_send_hang_message()
20565 schedule_work(&dhdp->info->dhd_hang_process_work); in dhd_os_send_hang_message()
20567 dhdp->rxcnt_timeout, dhdp->txcnt_timeout, dhdp->busstate)); in dhd_os_send_hang_message()
20569 printf("MAC %pM\n", &dhdp->mac); in dhd_os_send_hang_message()
20581 if (dhd->pub.hang_report) { in net_os_send_hang_message()
20585 ret = dhd_os_send_hang_message(&dhd->pub); in net_os_send_hang_message()
20588 DHD_ERROR(("%s: HANG -> Reset BT\n", __FUNCTION__)); in net_os_send_hang_message()
20607 dhdp = &dhd->pub; in net_os_send_hang_message_reason()
20621 dhdp->hang_reason = reason; in net_os_send_hang_message_reason()
20630 return wifi_platform_set_power(dhd->adapter, on, delay_msec); in dhd_net_wifi_platform_set_power()
20635 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_wifi_platform_set_power()
20637 return wifi_platform_set_power(dhd->adapter, on, delay_msec); in dhd_wifi_platform_set_power()
20644 if (dhd && dhd->pub.up) in dhd_force_country_change()
20645 return dhd->pub.force_country_change; in dhd_force_country_change()
20654 if (!dhd->pub.is_blob) in dhd_get_customized_country_code()
20658 get_customized_country_code(dhd->adapter, country_iso_code, cspec, in dhd_get_customized_country_code()
20659 dhd->pub.dhd_cflags); in dhd_get_customized_country_code()
20661 get_customized_country_code(dhd->adapter, country_iso_code, cspec); in dhd_get_customized_country_code()
20669 strlcpy(cspec->country_abbrev, country_iso_code, WLC_CNTRY_BUF_SZ); in dhd_get_customized_country_code()
20670 strlcpy(cspec->ccode, country_iso_code, WLC_CNTRY_BUF_SZ); in dhd_get_customized_country_code()
20680 if (dhd->pub.is_blob) { in dhd_get_customized_country_code()
20681 if (strncmp(dhd->pub.vars_ccode, "J1", 3) == 0) { in dhd_get_customized_country_code()
20682 memcpy(cspec->ccode, dhd->pub.vars_ccode, in dhd_get_customized_country_code()
20683 sizeof(dhd->pub.vars_ccode)); in dhd_get_customized_country_code()
20688 if (strncmp(dhd->pub.vars_ccode, "JP", 3) == 0) { in dhd_get_customized_country_code()
20689 cspec->rev = dhd->pub.vars_regrev; in dhd_get_customized_country_code()
20704 if (dhd && dhd->pub.up) { in dhd_bus_country_set()
20705 memcpy(&dhd->pub.dhd_cspec, cspec, sizeof(wl_country_t)); in dhd_bus_country_set()
20718 if (dhd && dhd->pub.up) { in dhd_bus_band_set()
20730 return -EINVAL; in dhd_net_set_fw_path()
20732 strlcpy(dhd->fw_path, fw, sizeof(dhd->fw_path)); in dhd_net_set_fw_path()
20762 mutex_lock(&dhd->dhd_net_if_mutex); in dhd_net_if_lock_local()
20770 mutex_unlock(&dhd->dhd_net_if_mutex); in dhd_net_if_unlock_local()
20777 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_suspend_lock()
20779 mutex_lock(&dhd->dhd_suspend_mutex); in dhd_suspend_lock()
20786 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_suspend_unlock()
20788 mutex_unlock(&dhd->dhd_suspend_mutex); in dhd_suspend_unlock()
20794 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_general_spin_lock()
20798 flags = osl_spin_lock(&dhd->dhd_lock); in dhd_os_general_spin_lock()
20806 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_general_spin_unlock()
20809 osl_spin_unlock(&dhd->dhd_lock, flags); in dhd_os_general_spin_unlock()
20839 return (atomic_read(&dhd->pend_8021x_cnt)); in dhd_get_pend_8021x_cnt()
20857 ntimes--; in dhd_wait_pend8021x()
20863 atomic_set(&dhd->pend_8021x_cnt, 0); in dhd_wait_pend8021x()
20864 WL_MSG(dev->name, "TIMEOUT\n"); in dhd_wait_pend8021x()
20903 ret = vfs_fsync(fp, fp->f_path.dentry, 0); in write_file()
20914 dhd_filp_close(fp, current->files); in write_file()
21053 dhd_pub_t *dhdp = &dhd->pub; in dhd_get_memdump_filename()
21058 dhd_convert_memdump_type_to_str(dhdp->memdump_type, memdump_type, DHD_MEMDUMP_TYPE_STR_LEN, in dhd_get_memdump_filename()
21059 dhdp->debug_dump_subcmd); in dhd_get_memdump_filename()
21060 clear_debug_dump_time(dhdp->debug_dump_time_str); in dhd_get_memdump_filename()
21061 get_debug_dump_time(dhdp->debug_dump_time_str); in dhd_get_memdump_filename()
21063 DHD_COMMON_DUMP_PATH, fname, memdump_type, dhdp->debug_dump_time_str); in dhd_get_memdump_filename()
21084 dhd_convert_memdump_type_to_str(dhd->memdump_type, memdump_type, DHD_MEMDUMP_TYPE_STR_LEN, in write_dump_to_file()
21085 dhd->debug_dump_subcmd); in write_dump_to_file()
21086 clear_debug_dump_time(dhd->debug_dump_time_str); in write_dump_to_file()
21087 get_debug_dump_time(dhd->debug_dump_time_str); in write_dump_to_file()
21090 DHD_COMMON_DUMP_PATH, fname, memdump_type, dhd->debug_dump_time_str); in write_dump_to_file()
21101 * file instead of caching it. O_TRUNC flag ensures that file will be re-written in write_dump_to_file()
21111 "/data/", fname, memdump_type, dhd->debug_dump_time_str); in write_dump_to_file()
21142 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_wake_lock_timeout()
21146 if (dhd && (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT)) { in dhd_os_wake_lock_timeout()
21147 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_timeout()
21148 ret = dhd->wakelock_rx_timeout_enable > dhd->wakelock_ctrl_timeout_enable ? in dhd_os_wake_lock_timeout()
21149 dhd->wakelock_rx_timeout_enable : dhd->wakelock_ctrl_timeout_enable; in dhd_os_wake_lock_timeout()
21151 if (dhd->wakelock_rx_timeout_enable) in dhd_os_wake_lock_timeout()
21152 dhd_wake_lock_timeout(dhd->wl_rxwake, in dhd_os_wake_lock_timeout()
21153 msecs_to_jiffies(dhd->wakelock_rx_timeout_enable)); in dhd_os_wake_lock_timeout()
21154 if (dhd->wakelock_ctrl_timeout_enable) in dhd_os_wake_lock_timeout()
21155 dhd_wake_lock_timeout(dhd->wl_ctrlwake, in dhd_os_wake_lock_timeout()
21156 msecs_to_jiffies(dhd->wakelock_ctrl_timeout_enable)); in dhd_os_wake_lock_timeout()
21158 dhd->wakelock_rx_timeout_enable = 0; in dhd_os_wake_lock_timeout()
21159 dhd->wakelock_ctrl_timeout_enable = 0; in dhd_os_wake_lock_timeout()
21160 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_timeout()
21171 ret = dhd_os_wake_lock_timeout(&dhd->pub); in net_os_wake_lock_timeout()
21177 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_wake_lock_rx_timeout_enable()
21180 if (dhd && (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT)) { in dhd_os_wake_lock_rx_timeout_enable()
21181 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_rx_timeout_enable()
21182 if (val > dhd->wakelock_rx_timeout_enable) in dhd_os_wake_lock_rx_timeout_enable()
21183 dhd->wakelock_rx_timeout_enable = val; in dhd_os_wake_lock_rx_timeout_enable()
21184 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_rx_timeout_enable()
21191 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_wake_lock_ctrl_timeout_enable()
21194 if (dhd && (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT)) { in dhd_os_wake_lock_ctrl_timeout_enable()
21195 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_ctrl_timeout_enable()
21196 if (val > dhd->wakelock_ctrl_timeout_enable) in dhd_os_wake_lock_ctrl_timeout_enable()
21197 dhd->wakelock_ctrl_timeout_enable = val; in dhd_os_wake_lock_ctrl_timeout_enable()
21198 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_ctrl_timeout_enable()
21205 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_wake_lock_ctrl_timeout_cancel()
21208 if (dhd && (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT)) { in dhd_os_wake_lock_ctrl_timeout_cancel()
21209 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_ctrl_timeout_cancel()
21210 dhd->wakelock_ctrl_timeout_enable = 0; in dhd_os_wake_lock_ctrl_timeout_cancel()
21212 if (dhd_wake_lock_active(dhd->wl_ctrlwake)) in dhd_os_wake_lock_ctrl_timeout_cancel()
21213 dhd_wake_unlock(dhd->wl_ctrlwake); in dhd_os_wake_lock_ctrl_timeout_cancel()
21215 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_ctrl_timeout_cancel()
21226 ret = dhd_os_wake_lock_rx_timeout_enable(&dhd->pub, val); in net_os_wake_lock_rx_timeout_enable()
21236 ret = dhd_os_wake_lock_ctrl_timeout_enable(&dhd->pub, val); in net_os_wake_lock_ctrl_timeout_enable()
21284 if (wklock_info->addr == addr) { in find_wklock_entry()
21311 wklock_info->counter = dhd->wakelock_counter; \
21313 wklock_info->counter++; \
21320 wklock_info->addr = func_addr; \
21321 wklock_info->lock_type = wklock_type; \
21324 wklock_info->counter = dhd->wakelock_counter; \
21326 wklock_info->counter++; \
21328 HASH_ADD(wklock_history, &wklock_info->wklock_node, func_addr); \
21350 switch (wklock_info->lock_type) { in dhd_wk_lock_rec_dump()
21353 (void *)wklock_info->addr, wklock_info->counter)); in dhd_wk_lock_rec_dump()
21358 (void *)wklock_info->addr, wklock_info->counter)); in dhd_wk_lock_rec_dump()
21362 (void *)wklock_info->addr, wklock_info->counter)); in dhd_wk_lock_rec_dump()
21366 (void *)wklock_info->addr, wklock_info->counter)); in dhd_wk_lock_rec_dump()
21379 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_wk_lock_trace_init()
21386 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_wk_lock_trace_init()
21401 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_wk_lock_trace_deinit()
21413 hash_del(&wklock_info->wklock_node); in dhd_wk_lock_trace_deinit()
21415 hlist_del_init(&wklock_info->wklock_node); in dhd_wk_lock_trace_deinit()
21419 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_wk_lock_trace_deinit()
21424 dhd_info_t *dhd = (dhd_info_t *)(dhdp->info); in dhd_wk_lock_stats_dump()
21428 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_wk_lock_stats_dump()
21430 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_wk_lock_stats_dump()
21439 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_wake_lock()
21443 if (dhd && (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT)) { in dhd_os_wake_lock()
21444 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock()
21445 if (dhd->wakelock_counter == 0 && !dhd->waive_wakelock) { in dhd_os_wake_lock()
21447 dhd_wake_lock(dhd->wl_wifi); in dhd_os_wake_lock()
21457 dhd->wakelock_counter++; in dhd_os_wake_lock()
21458 ret = dhd->wakelock_counter; in dhd_os_wake_lock()
21459 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock()
21467 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_event_wake_lock()
21471 dhd_wake_lock(dhd->wl_evtwake); in dhd_event_wake_lock()
21482 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_pm_wake_lock_timeout()
21485 dhd_wake_lock_timeout(dhd->wl_pmwake, msecs_to_jiffies(val)); in dhd_pm_wake_lock_timeout()
21494 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_txfl_wake_lock_timeout()
21497 dhd_wake_lock_timeout(dhd->wl_txflwake, msecs_to_jiffies(val)); in dhd_txfl_wake_lock_timeout()
21506 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_nan_wake_lock_timeout()
21509 dhd_wake_lock_timeout(dhd->wl_nanwake, msecs_to_jiffies(val)); in dhd_nan_wake_lock_timeout()
21520 ret = dhd_os_wake_lock(&dhd->pub); in net_os_wake_lock()
21526 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_wake_unlock()
21531 if (dhd && (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT)) { in dhd_os_wake_unlock()
21532 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_unlock()
21534 if (dhd->wakelock_counter > 0) { in dhd_os_wake_unlock()
21535 dhd->wakelock_counter--; in dhd_os_wake_unlock()
21541 if (dhd->wakelock_counter == 0 && !dhd->waive_wakelock) { in dhd_os_wake_unlock()
21543 dhd_wake_unlock(dhd->wl_wifi); in dhd_os_wake_unlock()
21548 ret = dhd->wakelock_counter; in dhd_os_wake_unlock()
21550 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_unlock()
21557 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_event_wake_unlock()
21561 dhd_wake_unlock(dhd->wl_evtwake); in dhd_event_wake_unlock()
21571 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_pm_wake_unlock()
21575 if (dhd_wake_lock_active(dhd->wl_pmwake)) { in dhd_pm_wake_unlock()
21576 dhd_wake_unlock(dhd->wl_pmwake); in dhd_pm_wake_unlock()
21585 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_txfl_wake_unlock()
21589 if (dhd_wake_lock_active(dhd->wl_txflwake)) { in dhd_txfl_wake_unlock()
21590 dhd_wake_unlock(dhd->wl_txflwake); in dhd_txfl_wake_unlock()
21599 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_nan_wake_unlock()
21603 if (dhd_wake_lock_active(dhd->wl_nanwake)) { in dhd_nan_wake_unlock()
21604 dhd_wake_unlock(dhd->wl_nanwake); in dhd_nan_wake_unlock()
21621 dhd = (dhd_info_t *)(pub->info); in dhd_os_check_wakelock()
21628 c = dhd->wakelock_counter; in dhd_os_check_wakelock()
21629 l1 = dhd_wake_lock_active(dhd->wl_wifi); in dhd_os_check_wakelock()
21630 l2 = dhd_wake_lock_active(dhd->wl_wdwake); in dhd_os_check_wakelock()
21634 DHD_ERROR(("%s wakelock c-%d wl-%d wd-%d\n", in dhd_os_check_wakelock()
21639 if (dhd && (dhd->wakelock_counter > 0) && dhd_bus_dev_pm_enabled(pub)) { in dhd_os_check_wakelock()
21640 DHD_ERROR(("%s wakelock c-%d\n", __FUNCTION__, dhd->wakelock_counter)); in dhd_os_check_wakelock()
21661 if (pub->up == 0) { in dhd_os_check_wakelock_all()
21665 dhd = (dhd_info_t *)(pub->info); in dhd_os_check_wakelock_all()
21672 c = dhd->wakelock_counter; in dhd_os_check_wakelock_all()
21673 l1 = dhd_wake_lock_active(dhd->wl_wifi); in dhd_os_check_wakelock_all()
21674 l2 = dhd_wake_lock_active(dhd->wl_wdwake); in dhd_os_check_wakelock_all()
21675 l3 = dhd_wake_lock_active(dhd->wl_rxwake); in dhd_os_check_wakelock_all()
21676 l4 = dhd_wake_lock_active(dhd->wl_ctrlwake); in dhd_os_check_wakelock_all()
21677 l7 = dhd_wake_lock_active(dhd->wl_evtwake); in dhd_os_check_wakelock_all()
21679 l5 = dhd_wake_lock_active(dhd->wl_intrwake); in dhd_os_check_wakelock_all()
21682 l6 = dhd_wake_lock_active(dhd->wl_scanwake); in dhd_os_check_wakelock_all()
21684 l8 = dhd_wake_lock_active(dhd->wl_pmwake); in dhd_os_check_wakelock_all()
21685 l9 = dhd_wake_lock_active(dhd->wl_txflwake); in dhd_os_check_wakelock_all()
21686 l10 = dhd_wake_lock_active(dhd->wl_nanwake); in dhd_os_check_wakelock_all()
21691 DHD_ERROR(("%s wakelock c-%d wl-%d wd-%d rx-%d " in dhd_os_check_wakelock_all()
21692 "ctl-%d intr-%d scan-%d evt-%d, pm-%d, txfl-%d nan-%d\n", in dhd_os_check_wakelock_all()
21697 if (dhd && (dhd->wakelock_counter > 0) && dhd_bus_dev_pm_enabled(pub)) { in dhd_os_check_wakelock_all()
21698 DHD_ERROR(("%s wakelock c-%d\n", __FUNCTION__, dhd->wakelock_counter)); in dhd_os_check_wakelock_all()
21711 ret = dhd_os_wake_unlock(&dhd->pub); in net_os_wake_unlock()
21717 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_wd_wake_lock()
21722 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wd_wake_lock()
21723 if (dhd->wakelock_wd_counter == 0 && !dhd->waive_wakelock) { in dhd_os_wd_wake_lock()
21726 dhd_wake_lock(dhd->wl_wdwake); in dhd_os_wd_wake_lock()
21729 dhd->wakelock_wd_counter++; in dhd_os_wd_wake_lock()
21730 ret = dhd->wakelock_wd_counter; in dhd_os_wd_wake_lock()
21731 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wd_wake_lock()
21738 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_wd_wake_unlock()
21743 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wd_wake_unlock()
21744 if (dhd->wakelock_wd_counter > 0) { in dhd_os_wd_wake_unlock()
21745 dhd->wakelock_wd_counter = 0; in dhd_os_wd_wake_unlock()
21746 if (!dhd->waive_wakelock) { in dhd_os_wd_wake_unlock()
21748 dhd_wake_unlock(dhd->wl_wdwake); in dhd_os_wd_wake_unlock()
21752 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wd_wake_unlock()
21762 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_oob_irq_wake_lock_timeout()
21765 dhd_wake_lock_timeout(dhd->wl_intrwake, msecs_to_jiffies(val)); in dhd_os_oob_irq_wake_lock_timeout()
21774 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_oob_irq_wake_unlock()
21778 if (dhd_wake_lock_active(dhd->wl_intrwake)) { in dhd_os_oob_irq_wake_unlock()
21779 dhd_wake_unlock(dhd->wl_intrwake); in dhd_os_oob_irq_wake_unlock()
21791 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_scan_wake_lock_timeout()
21794 dhd_wake_lock_timeout(dhd->wl_scanwake, msecs_to_jiffies(val)); in dhd_os_scan_wake_lock_timeout()
21803 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_scan_wake_unlock()
21807 if (dhd_wake_lock_active(dhd->wl_scanwake)) { in dhd_os_scan_wake_unlock()
21808 dhd_wake_unlock(dhd->wl_scanwake); in dhd_os_scan_wake_unlock()
21820 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_wake_lock_waive()
21824 if (dhd && (dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT)) { in dhd_os_wake_lock_waive()
21825 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_waive()
21828 if (dhd->waive_wakelock == FALSE) { in dhd_os_wake_lock_waive()
21835 dhd->wakelock_before_waive = dhd->wakelock_counter; in dhd_os_wake_lock_waive()
21836 dhd->waive_wakelock = TRUE; in dhd_os_wake_lock_waive()
21838 ret = dhd->wakelock_wd_counter; in dhd_os_wake_lock_waive()
21839 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_waive()
21846 dhd_info_t *dhd = (dhd_info_t *)(pub->info); in dhd_os_wake_lock_restore()
21852 if ((dhd->dhd_state & DHD_ATTACH_STATE_WAKELOCKS_INIT) == 0) in dhd_os_wake_lock_restore()
21855 DHD_WAKE_SPIN_LOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_restore()
21858 if (!dhd->waive_wakelock) in dhd_os_wake_lock_restore()
21861 dhd->waive_wakelock = FALSE; in dhd_os_wake_lock_restore()
21872 if (dhd->wakelock_before_waive == 0 && dhd->wakelock_counter > 0) { in dhd_os_wake_lock_restore()
21874 dhd_wake_lock(dhd->wl_wifi); in dhd_os_wake_lock_restore()
21876 dhd_bus_dev_pm_stay_awake(&dhd->pub); in dhd_os_wake_lock_restore()
21878 } else if (dhd->wakelock_before_waive > 0 && dhd->wakelock_counter == 0) { in dhd_os_wake_lock_restore()
21880 dhd_wake_unlock(dhd->wl_wifi); in dhd_os_wake_lock_restore()
21882 dhd_bus_dev_pm_relax(&dhd->pub); in dhd_os_wake_lock_restore()
21885 dhd->wakelock_before_waive = 0; in dhd_os_wake_lock_restore()
21887 ret = dhd->wakelock_wd_counter; in dhd_os_wake_lock_restore()
21888 DHD_WAKE_SPIN_UNLOCK(&dhd->wakelock_spinlock, flags); in dhd_os_wake_lock_restore()
21895 dhd->wakelock_counter = 0; in dhd_os_wake_lock_init()
21896 dhd->wakelock_rx_timeout_enable = 0; in dhd_os_wake_lock_init()
21897 dhd->wakelock_ctrl_timeout_enable = 0; in dhd_os_wake_lock_init()
21900 dhd_wake_lock_init(dhd->wl_wifi, dhd_bus_to_dev(dhd->pub.bus), "wlan_wake"); in dhd_os_wake_lock_init()
21901 dhd_wake_lock_init(dhd->wl_rxwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_rx_wake"); in dhd_os_wake_lock_init()
21902 dhd_wake_lock_init(dhd->wl_ctrlwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_ctrl_wake"); in dhd_os_wake_lock_init()
21903 dhd_wake_lock_init(dhd->wl_evtwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_evt_wake"); in dhd_os_wake_lock_init()
21904 dhd_wake_lock_init(dhd->wl_pmwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_pm_wake"); in dhd_os_wake_lock_init()
21905 dhd_wake_lock_init(dhd->wl_txflwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_txfl_wake"); in dhd_os_wake_lock_init()
21907 dhd_wake_lock_init(dhd->wl_intrwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_oob_irq_wake"); in dhd_os_wake_lock_init()
21910 dhd_wake_lock_init(dhd->wl_scanwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_scan_wake"); in dhd_os_wake_lock_init()
21912 dhd_wake_lock_init(dhd->wl_nanwake, dhd_bus_to_dev(dhd->pub.bus), "wlan_nan_wake"); in dhd_os_wake_lock_init()
21923 dhd->wakelock_counter = 0; in dhd_os_wake_lock_destroy()
21924 dhd->wakelock_rx_timeout_enable = 0; in dhd_os_wake_lock_destroy()
21925 dhd->wakelock_ctrl_timeout_enable = 0; in dhd_os_wake_lock_destroy()
21926 dhd_wake_lock_destroy(dhd->wl_wifi); in dhd_os_wake_lock_destroy()
21927 dhd_wake_lock_destroy(dhd->wl_rxwake); in dhd_os_wake_lock_destroy()
21928 dhd_wake_lock_destroy(dhd->wl_ctrlwake); in dhd_os_wake_lock_destroy()
21929 dhd_wake_lock_destroy(dhd->wl_evtwake); in dhd_os_wake_lock_destroy()
21930 dhd_wake_lock_destroy(dhd->wl_pmwake); in dhd_os_wake_lock_destroy()
21931 dhd_wake_lock_destroy(dhd->wl_txflwake); in dhd_os_wake_lock_destroy()
21933 dhd_wake_lock_destroy(dhd->wl_intrwake); in dhd_os_wake_lock_destroy()
21936 dhd_wake_lock_destroy(dhd->wl_scanwake); in dhd_os_wake_lock_destroy()
21938 dhd_wake_lock_destroy(dhd->wl_nanwake); in dhd_os_wake_lock_destroy()
21943 if (dhd->wakelock_counter > 0) { in dhd_os_wake_lock_destroy()
21945 __FUNCTION__, dhd->wakelock_counter)); in dhd_os_wake_lock_destroy()
21946 while (dhd_os_wake_unlock(&dhd->pub)); in dhd_os_wake_lock_destroy()
21955 return pub->up; in dhd_os_check_if_up()
21973 i = snprintf(&info_string[i], sizeof(info_string) - i, in dhd_set_version_info()
21987 return -EINVAL; in dhd_ioctl_entry_local()
21992 return -EINVAL; in dhd_ioctl_entry_local()
21997 return -ENODEV; in dhd_ioctl_entry_local()
22000 DHD_OS_WAKE_LOCK(&dhd->pub); in dhd_ioctl_entry_local()
22002 ret = dhd_wl_ioctl(&dhd->pub, ifidx, ioc, ioc->buf, ioc->len); in dhd_ioctl_entry_local()
22003 dhd_check_hang(net, &dhd->pub, ret); in dhd_ioctl_entry_local()
22005 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_ioctl_entry_local()
22017 return -EINVAL; in dhd_os_check_hang()
22026 return dhdp->info->unit; in dhd_get_instance()
22041 dhdp = &dhd->pub; in dhd_deepsleep()
22164 file->private_data = inode->i_private; in dhd_dbg_state_open()
22178 return -EINVAL; in dhd_dbg_state_read()
22181 if (count > g_dbgfs.size - pos) in dhd_dbg_state_read()
22182 count = g_dbgfs.size - pos; in dhd_dbg_state_read()
22186 tmp = dhd_readregl(g_dbgfs.dhdp->bus, file->f_pos & (~3)); in dhd_dbg_state_read()
22190 return -EFAULT; in dhd_dbg_state_read()
22192 count -= ret; in dhd_dbg_state_read()
22207 return -EINVAL; in dhd_debugfs_write()
22210 if (count > g_dbgfs.size - pos) in dhd_debugfs_write()
22211 count = g_dbgfs.size - pos; in dhd_debugfs_write()
22215 return -EFAULT; in dhd_debugfs_write()
22219 dhd_writeregl(g_dbgfs.dhdp->bus, file->f_pos & (~3), buf); in dhd_debugfs_write()
22227 loff_t pos = -1; in dhd_debugfs_lseek()
22234 pos = file->f_pos + off; in dhd_debugfs_lseek()
22237 pos = g_dbgfs.size - off; in dhd_debugfs_lseek()
22239 return (pos < 0 || pos > g_dbgfs.size) ? -EINVAL : (file->f_pos = pos); in dhd_debugfs_lseek()
22287 if (!(dhd->chan_isvht80)) { in dhd_set_cpucore()
22288 DHD_ERROR(("%s: chan_status(%d) cpucore!!!\n", __FUNCTION__, dhd->chan_isvht80)); in dhd_set_cpucore()
22295 e_dpc = set_cpus_allowed_ptr(dhd->current_dpc, in dhd_set_cpucore()
22298 e_dpc = set_cpus_allowed_ptr(dhd->current_dpc, in dhd_set_cpucore()
22312 e_rxf = set_cpus_allowed_ptr(dhd->current_rxf, in dhd_set_cpucore()
22315 e_rxf = set_cpus_allowed_ptr(dhd->current_rxf, in dhd_set_cpucore()
22350 if (skb == NULL || skb->data == NULL) in dhd_adjust_tcp_winsize()
22353 ipheader = (struct iphdr*)(skb->data); in dhd_adjust_tcp_winsize()
22355 if (ipheader->protocol == IPPROTO_TCP) { in dhd_adjust_tcp_winsize()
22356 tcpheader = (struct tcphdr*) skb_pull(skb, (ipheader->ihl)<<2); in dhd_adjust_tcp_winsize()
22358 win_size = ntoh16(tcpheader->window); in dhd_adjust_tcp_winsize()
22360 dhd_port_list_match(ntoh16(tcpheader->dest))) { in dhd_adjust_tcp_winsize()
22361 incremental_checksum = ntoh16(tcpheader->check); in dhd_adjust_tcp_winsize()
22362 incremental_checksum += win_size - win_size*WIN_SIZE_SCALE_FACTOR; in dhd_adjust_tcp_winsize()
22364 --incremental_checksum; in dhd_adjust_tcp_winsize()
22365 tcpheader->window = hton16(win_size*WIN_SIZE_SCALE_FACTOR); in dhd_adjust_tcp_winsize()
22366 tcpheader->check = hton16((unsigned short)incremental_checksum); in dhd_adjust_tcp_winsize()
22369 skb_push(skb, (ipheader->ihl)<<2); in dhd_adjust_tcp_winsize()
22378 dhd_info_t *dhd = dhdp->info; in dhd_get_mcast_regen_bss_enable()
22383 ifp = dhd->iflist[idx]; in dhd_get_mcast_regen_bss_enable()
22385 return ifp->mcast_regen_bss_enable; in dhd_get_mcast_regen_bss_enable()
22391 dhd_info_t *dhd = dhdp->info; in dhd_set_mcast_regen_bss_enable()
22396 ifp = dhd->iflist[idx]; in dhd_set_mcast_regen_bss_enable()
22398 ifp->mcast_regen_bss_enable = val; in dhd_set_mcast_regen_bss_enable()
22411 dhd_info_t *dhd = dhdp->info; in dhd_get_ap_isolate()
22416 ifp = dhd->iflist[idx]; in dhd_get_ap_isolate()
22418 return ifp->ap_isolate; in dhd_get_ap_isolate()
22424 dhd_info_t *dhd = dhdp->info; in dhd_set_ap_isolate()
22429 ifp = dhd->iflist[idx]; in dhd_set_ap_isolate()
22432 ifp->ap_isolate = val; in dhd_set_ap_isolate()
22440 * - The default path of CUSTOMER_HW4 device is "PLATFORM_PATH/.memdump.info"
22441 * - Brix platform will take default path "/installmedia/.memdump.info"
22498 ret = dhd_vfs_read(fp, (char *)&dhd->rnd_len, sizeof(dhd->rnd_len), &pos); in dhd_get_rnd_info()
22504 dhd->rnd_buf = MALLOCZ(dhd->osh, dhd->rnd_len); in dhd_get_rnd_info()
22505 if (!dhd->rnd_buf) { in dhd_get_rnd_info()
22510 ret = dhd_vfs_read(fp, (char *)dhd->rnd_buf, dhd->rnd_len, &pos); in dhd_get_rnd_info()
22523 MFREE(dhd->osh, dhd->rnd_buf, dhd->rnd_len); in dhd_get_rnd_info()
22524 dhd->rnd_buf = NULL; in dhd_get_rnd_info()
22604 dhd_info = (dhd_info_t *)dhdp->info; in dhd_schedule_memdump()
22605 dump = (dhd_dump_t *)MALLOC(dhdp->osh, sizeof(dhd_dump_t)); in dhd_schedule_memdump()
22610 dump->buf = buf; in dhd_schedule_memdump()
22611 dump->bufsize = size; in dhd_schedule_memdump()
22613 dhd_get_hscb_info(dhdp, (void*)(&dump->hscb_buf), in dhd_schedule_memdump()
22614 (uint32 *)(&dump->hscb_bufsize)); in dhd_schedule_memdump()
22616 dump->hscb_bufsize = 0; in dhd_schedule_memdump()
22627 if (dhdp->memdump_enabled == DUMP_MEMONLY) { in dhd_schedule_memdump()
22631 if ((dhdp->memdump_type == DUMP_TYPE_DONGLE_INIT_FAILURE) || in dhd_schedule_memdump()
22632 (dhdp->memdump_type == DUMP_TYPE_DUE_TO_BT) || in dhd_schedule_memdump()
22633 (dhdp->memdump_type == DUMP_TYPE_SMMU_FAULT)) in dhd_schedule_memdump()
22635 dhd_info->scheduled_memdump = FALSE; in dhd_schedule_memdump()
22636 dhd_mem_dump((void *)dhdp->info, (void *)dump, 0); in dhd_schedule_memdump()
22638 if (dhdp->memdump_type == DUMP_TYPE_DONGLE_INIT_FAILURE) { in dhd_schedule_memdump()
22647 flush_type = MALLOCZ(dhdp->osh, in dhd_schedule_memdump()
22652 dhd_log_dump(dhdp->info, flush_type, 0); in dhd_schedule_memdump()
22659 dhd_info->scheduled_memdump = TRUE; in dhd_schedule_memdump()
22668 dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq, (void *)dump, in dhd_schedule_memdump()
22697 dhdp = &dhd->pub; in dhd_mem_dump()
22718 if (dhdp->collect_sdtc) { in dhd_mem_dump()
22720 dhdp->collect_sdtc = FALSE; in dhd_mem_dump()
22725 DHD_ERROR(("%s: sssr_enab=%d dhdp->sssr_inited=%d dhdp->collect_sssr=%d\n", in dhd_mem_dump()
22726 __FUNCTION__, sssr_enab, dhdp->sssr_inited, dhdp->collect_sssr)); in dhd_mem_dump()
22727 if (sssr_enab && dhdp->sssr_inited && dhdp->collect_sssr) { in dhd_mem_dump()
22728 if (fis_enab && dhdp->sssr_reg_info->rev3.fis_enab) { in dhd_mem_dump()
22739 __FUNCTION__, fis_enab, dhdp->sssr_reg_info->rev3.fis_enab)); in dhd_mem_dump()
22743 dhdp->collect_sssr = FALSE; in dhd_mem_dump()
22751 if (write_dump_to_file(&dhd->pub, dump->buf, dump->bufsize, "mem_dump")) { in dhd_mem_dump()
22759 memset_s(dhdp->memdump_str, DHD_MEMDUMP_LONGSTR_LEN, 0, DHD_MEMDUMP_LONGSTR_LEN); in dhd_mem_dump()
22760 dhd_convert_memdump_type_to_str(dhdp->memdump_type, dhdp->memdump_str, in dhd_mem_dump()
22761 DHD_MEMDUMP_LONGSTR_LEN, dhdp->debug_dump_subcmd); in dhd_mem_dump()
22762 if (dhdp->memdump_type == DUMP_TYPE_DONGLE_TRAP && in dhd_mem_dump()
22763 dhdp->dongle_trap_occured == TRUE) { in dhd_mem_dump()
22764 tr = &dhdp->last_trap_info; in dhd_mem_dump()
22765 dhd_lookup_map(dhdp->osh, map_path, in dhd_mem_dump()
22766 ltoh32(tr->epc), pc_fn, ltoh32(tr->r14), lr_fn); in dhd_mem_dump()
22767 sprintf(&dhdp->memdump_str[strlen(dhdp->memdump_str)], "_%.79s_%.79s", in dhd_mem_dump()
22770 DHD_ERROR(("%s: dump reason: %s\n", __FUNCTION__, dhdp->memdump_str)); in dhd_mem_dump()
22771 if (wifi_platform_set_coredump(dhd->adapter, dump->buf, dump->bufsize, dhdp->memdump_str)) { in dhd_mem_dump()
22774 dhd->pub.memdump_success = FALSE; in dhd_mem_dump()
22790 dhd_d2h_minidump(&dhd->pub); in dhd_mem_dump()
22796 if (write_dump_to_file(&dhd->pub, dump->buf, dump->bufsize, "mem_dump")) { in dhd_mem_dump()
22799 dhd->pub.memdump_success = FALSE; in dhd_mem_dump()
22803 if (dump->hscb_buf && dump->hscb_bufsize) { in dhd_mem_dump()
22804 if (write_dump_to_file(&dhd->pub, dump->hscb_buf, in dhd_mem_dump()
22805 dump->hscb_bufsize, "mem_dump_hscb")) { in dhd_mem_dump()
22808 dhd->pub.memdump_success = FALSE; in dhd_mem_dump()
22814 clear_debug_dump_time(dhdp->debug_dump_time_str); in dhd_mem_dump()
22822 * collect debug_dump as it may be called from non-sleepable context. in dhd_mem_dump()
22825 if (dhd->scheduled_memdump && in dhd_mem_dump()
22826 dhdp->memdump_type != DUMP_TYPE_BY_SYSDUMP) { in dhd_mem_dump()
22827 log_dump_type_t *flush_type = MALLOCZ(dhdp->osh, in dhd_mem_dump()
22841 if (dhd->scheduled_memdump) { in dhd_mem_dump()
22849 __FUNCTION__, dhdp->dhd_bus_busy_state)); in dhd_mem_dump()
22851 &dhdp->dhd_bus_busy_state, bitmask, 0); in dhd_mem_dump()
22854 __FUNCTION__, dhdp->dhd_bus_busy_state)); in dhd_mem_dump()
22860 if (dhd->pub.memdump_enabled == DUMP_MEMFILE_BUGON && in dhd_mem_dump()
22863 dhd->wl_accel_boot_on_done == TRUE && in dhd_mem_dump()
22866 dhd->pub.memdump_type != DUMP_TYPE_BY_SYSDUMP && in dhd_mem_dump()
22868 dhd->pub.memdump_type != DUMP_TYPE_BY_USER && in dhd_mem_dump()
22870 dhd->pub.memdump_success == TRUE && in dhd_mem_dump()
22873 dhd->pub.memdump_type != DUMP_TYPE_DONGLE_HOST_EVENT && in dhd_mem_dump()
22875 dhd->pub.memdump_type != DUMP_TYPE_CFG_VENDOR_TRIGGERED) { in dhd_mem_dump()
22883 cancel_work_sync(&dhd->bt_log_dispatcher_work); in dhd_mem_dump()
22887 cancel_delayed_work_sync(&dhd->edl_dispatcher_work); in dhd_mem_dump()
22891 printf("MAC %pM\n", &dhdp->mac); in dhd_mem_dump()
22898 MFREE(dhd->pub.osh, dump, sizeof(dhd_dump_t)); in dhd_mem_dump()
22901 DHD_BUS_BUSY_CLEAR_IN_MEMDUMP(&dhd->pub); in dhd_mem_dump()
22904 dhd->scheduled_memdump = FALSE; in dhd_mem_dump()
22907 if (dhdp->hang_was_pending) { in dhd_mem_dump()
22910 dhdp->hang_was_pending = 0; in dhd_mem_dump()
22927 if (minidump_buf->va == NULL) { in dhd_d2h_minidump()
22936 if (write_dump_to_file(dhdp, (uint8 *)minidump_buf->va, minidump_buf->len, d2h_minidump)) { in dhd_d2h_minidump()
22949 switch (dhdp->sssr_reg_info->rev2.version) { in dhd_sssr_dig_buf_size()
22953 if ((dhdp->sssr_reg_info->rev2.length > in dhd_sssr_dig_buf_size()
22955 dhdp->sssr_reg_info->rev2.dig_mem_info.dig_sr_size) { in dhd_sssr_dig_buf_size()
22956 dig_buf_size = dhdp->sssr_reg_info->rev2.dig_mem_info.dig_sr_size; in dhd_sssr_dig_buf_size()
22960 if (dhdp->sssr_reg_info->rev1.vasip_regs.vasip_sr_size) { in dhd_sssr_dig_buf_size()
22961 dig_buf_size = dhdp->sssr_reg_info->rev1.vasip_regs.vasip_sr_size; in dhd_sssr_dig_buf_size()
22962 } else if ((dhdp->sssr_reg_info->rev1.length > in dhd_sssr_dig_buf_size()
22964 dhdp->sssr_reg_info->rev1.dig_mem_info.dig_sr_size) { in dhd_sssr_dig_buf_size()
22965 dig_buf_size = dhdp->sssr_reg_info->rev1.dig_mem_info.dig_sr_size; in dhd_sssr_dig_buf_size()
22969 if (dhdp->sssr_reg_info->rev0.vasip_regs.vasip_sr_size) { in dhd_sssr_dig_buf_size()
22970 dig_buf_size = dhdp->sssr_reg_info->rev0.vasip_regs.vasip_sr_size; in dhd_sssr_dig_buf_size()
22987 switch (dhdp->sssr_reg_info->rev2.version) { in dhd_sssr_dig_buf_addr()
22991 if ((dhdp->sssr_reg_info->rev2.length > in dhd_sssr_dig_buf_addr()
22993 dhdp->sssr_reg_info->rev2.dig_mem_info.dig_sr_size) { in dhd_sssr_dig_buf_addr()
22994 dig_buf_addr = dhdp->sssr_reg_info->rev2.dig_mem_info.dig_sr_addr; in dhd_sssr_dig_buf_addr()
22998 if (dhdp->sssr_reg_info->rev1.vasip_regs.vasip_sr_size) { in dhd_sssr_dig_buf_addr()
22999 dig_buf_addr = dhdp->sssr_reg_info->rev1.vasip_regs.vasip_sr_addr; in dhd_sssr_dig_buf_addr()
23000 } else if ((dhdp->sssr_reg_info->rev1.length > in dhd_sssr_dig_buf_addr()
23002 dhdp->sssr_reg_info->rev1.dig_mem_info.dig_sr_size) { in dhd_sssr_dig_buf_addr()
23003 dig_buf_addr = dhdp->sssr_reg_info->rev1.dig_mem_info.dig_sr_addr; in dhd_sssr_dig_buf_addr()
23007 if (dhdp->sssr_reg_info->rev0.vasip_regs.vasip_sr_size) { in dhd_sssr_dig_buf_addr()
23008 dig_buf_addr = dhdp->sssr_reg_info->rev0.vasip_regs.vasip_sr_addr; in dhd_sssr_dig_buf_addr()
23029 switch (dhdp->sssr_reg_info->rev2.version) { in dhd_sssr_mac_buf_size()
23033 mac_buf_size = dhdp->sssr_reg_info->rev2.mac_regs[core_idx].sr_size; in dhd_sssr_mac_buf_size()
23036 mac_buf_size = dhdp->sssr_reg_info->rev1.mac_regs[core_idx].sr_size; in dhd_sssr_mac_buf_size()
23039 mac_buf_size = dhdp->sssr_reg_info->rev0.mac_regs[core_idx].sr_size; in dhd_sssr_mac_buf_size()
23060 switch (dhdp->sssr_reg_info->rev2.version) { in dhd_sssr_mac_xmtaddress()
23064 xmtaddress = dhdp->sssr_reg_info->rev2. in dhd_sssr_mac_xmtaddress()
23068 xmtaddress = dhdp->sssr_reg_info->rev1. in dhd_sssr_mac_xmtaddress()
23072 xmtaddress = dhdp->sssr_reg_info->rev0. in dhd_sssr_mac_xmtaddress()
23094 switch (dhdp->sssr_reg_info->rev2.version) { in dhd_sssr_mac_xmtdata()
23098 xmtdata = dhdp->sssr_reg_info->rev2. in dhd_sssr_mac_xmtdata()
23102 xmtdata = dhdp->sssr_reg_info->rev1. in dhd_sssr_mac_xmtdata()
23106 xmtdata = dhdp->sssr_reg_info->rev0. in dhd_sssr_mac_xmtdata()
23123 dhd_pub_t *dhdp = &dhd_info->pub; in dhd_sssr_dump_dig_buf_before()
23129 if (dhdp->sssr_dig_buf_before && (dhdp->sssr_dump_mode == SSSR_DUMP_MODE_SSSR)) { in dhd_sssr_dump_dig_buf_before()
23130 ret = dhd_export_debug_data((char *)dhdp->sssr_dig_buf_before, in dhd_sssr_dump_dig_buf_before()
23140 dhd_pub_t *dhdp = &dhd_info->pub; in dhd_sssr_dump_d11_buf_before()
23143 if (dhdp->sssr_d11_before[core] && in dhd_sssr_dump_d11_buf_before()
23144 dhdp->sssr_d11_outofreset[core] && in dhd_sssr_dump_d11_buf_before()
23145 (dhdp->sssr_dump_mode == SSSR_DUMP_MODE_SSSR)) { in dhd_sssr_dump_d11_buf_before()
23146 ret = dhd_export_debug_data((char *)dhdp->sssr_d11_before[core], in dhd_sssr_dump_d11_buf_before()
23157 dhd_pub_t *dhdp = &dhd_info->pub; in dhd_sssr_dump_dig_buf_after()
23163 if (dhdp->sssr_dig_buf_after) { in dhd_sssr_dump_dig_buf_after()
23164 ret = dhd_export_debug_data((char *)dhdp->sssr_dig_buf_after, in dhd_sssr_dump_dig_buf_after()
23174 dhd_pub_t *dhdp = &dhd_info->pub; in dhd_sssr_dump_d11_buf_after()
23177 if (dhdp->sssr_d11_after[core] && in dhd_sssr_dump_d11_buf_after()
23178 dhdp->sssr_d11_outofreset[core]) { in dhd_sssr_dump_d11_buf_after()
23179 ret = dhd_export_debug_data((char *)dhdp->sssr_d11_after[core], in dhd_sssr_dump_d11_buf_after()
23207 dhdp = &dhd->pub; in dhd_sssr_dump_to_file()
23237 if (dhdp->sssr_d11_before[i] && dhdp->sssr_d11_outofreset[i] && in dhd_sssr_dump_to_file()
23238 (dhdp->sssr_dump_mode == SSSR_DUMP_MODE_SSSR)) { in dhd_sssr_dump_to_file()
23239 if (write_dump_to_file(dhdp, (uint8 *)dhdp->sssr_d11_before[i], in dhd_sssr_dump_to_file()
23247 if (dhdp->sssr_d11_after[i] && dhdp->sssr_d11_outofreset[i]) { in dhd_sssr_dump_to_file()
23248 if (write_dump_to_file(dhdp, (uint8 *)dhdp->sssr_d11_after[i], in dhd_sssr_dump_to_file()
23259 if (dhdp->sssr_dig_buf_before && (dhdp->sssr_dump_mode == SSSR_DUMP_MODE_SSSR)) { in dhd_sssr_dump_to_file()
23260 if (write_dump_to_file(dhdp, (uint8 *)dhdp->sssr_dig_buf_before, in dhd_sssr_dump_to_file()
23262 DHD_ERROR(("%s: writing SSSR Dig dump before to the file failed\n", in dhd_sssr_dump_to_file()
23268 if (dhdp->sssr_dig_buf_after) { in dhd_sssr_dump_to_file()
23269 if (write_dump_to_file(dhdp, (uint8 *)dhdp->sssr_dig_buf_after, in dhd_sssr_dump_to_file()
23271 DHD_ERROR(("%s: writing SSSR Dig VASIP dump after to the file failed\n", in dhd_sssr_dump_to_file()
23287 dhdp->sssr_dump_mode = dump_mode; in dhd_write_sssr_dump()
23300 * dhd_mem_dump -> dhd_sssr_dump -> dhd_write_sssr_dump in dhd_write_sssr_dump()
23301 * Without workqueue - in dhd_write_sssr_dump()
23304 * With workqueue - all other DUMP_TYPEs : dhd_mem_dump is called in workqueue in dhd_write_sssr_dump()
23308 dhd_sssr_dump_to_file(dhdp->info); in dhd_write_sssr_dump()
23323 if (!dhd->sdtc_etb_inited) { in dhd_sdtc_etb_dump()
23330 if ((ret = dhd_bus_get_etb_info(dhd, dhd->etb_addr_info.etbinfo_addr, &etb_info))) { in dhd_sdtc_etb_dump()
23354 sdtc_etb_mempool = dhd->sdtc_etb_mempool; in dhd_sdtc_etb_dump()
23384 wl_flush_fw_log_buffer(dhd_linux_get_primary_netdev(&dhd->pub), in dhd_log_dump()
23389 * log dump can be scheduled - in dhd_log_dump()
23399 dhd_os_logdump_lock(&dhd->pub); in dhd_log_dump()
23400 DHD_OS_WAKE_LOCK(&dhd->pub); in dhd_log_dump()
23401 if (do_dhd_log_dump(&dhd->pub, type) != BCME_OK) { in dhd_log_dump()
23404 DHD_OS_WAKE_UNLOCK(&dhd->pub); in dhd_log_dump()
23405 dhd_os_logdump_unlock(&dhd->pub); in dhd_log_dump()
23412 dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq, in dhd_schedule_log_dump()
23421 if ((dhdp->memdump_enabled == DUMP_MEMONLY) || in dhd_print_buf_addr()
23422 (dhdp->memdump_enabled == DUMP_MEMFILE_BUGON) || in dhd_print_buf_addr()
23423 (dhdp->memdump_type == DUMP_TYPE_SMMU_FAULT) || in dhd_print_buf_addr()
23425 (dhdp->op_mode & DHD_FLAG_MFG_MODE && in dhd_print_buf_addr()
23426 (dhdp->hang_count >= MAX_CONSECUTIVE_MFG_HANG_COUNT-1)) || in dhd_print_buf_addr()
23430 if (dhdp->memdump_type == DUMP_TYPE_SMMU_FAULT) in dhd_print_buf_addr()
23434 DHD_ERROR(("-------- %s: buf(va)=%llx, buf(pa)=%llx, bufsize=%d\n", in dhd_print_buf_addr()
23437 DHD_ERROR(("-------- %s: buf(va)=%x, buf(pa)=%x, bufsize=%d\n", in dhd_print_buf_addr()
23457 log_size = (unsigned long)dld_buf->max - in dhd_log_dump_buf_addr()
23458 (unsigned long)dld_buf->buffer; in dhd_log_dump_buf_addr()
23459 if (dld_buf->wraparound) { in dhd_log_dump_buf_addr()
23462 wr_size = (unsigned long)dld_buf->present - in dhd_log_dump_buf_addr()
23463 (unsigned long)dld_buf->front; in dhd_log_dump_buf_addr()
23468 dhd_print_buf_addr(dhdp, buf_name, dld_buf->buffer, wr_size); in dhd_log_dump_buf_addr()
23470 dhd_print_buf_addr(dhdp, buf_name, dld_buf->present, wr_size); in dhd_log_dump_buf_addr()
23472 dhd_print_buf_addr(dhdp, buf_name, dld_buf->front, wr_size); in dhd_log_dump_buf_addr()
23479 dhdp->ecntr_dbg_ring) { in dhd_log_dump_buf_addr()
23481 ring = (dhd_dbg_ring_t *)dhdp->ecntr_dbg_ring; in dhd_log_dump_buf_addr()
23483 dhd_print_buf_addr(dhdp, "ecntr_dbg_ring ring_buf", ring->ring_buf, in dhd_log_dump_buf_addr()
23489 if (dhdp->dongle_trap_occured && dhdp->extended_trap_data) { in dhd_log_dump_buf_addr()
23490 dhd_print_buf_addr(dhdp, "extended_trap_data", dhdp->extended_trap_data, in dhd_log_dump_buf_addr()
23497 if (dhdp->memdump_type == DUMP_TYPE_DONGLE_HOST_EVENT) { in dhd_log_dump_buf_addr()
23498 dhd_print_buf_addr(dhdp, "health_chk_event_data", dhdp->health_chk_event_data, in dhd_log_dump_buf_addr()
23504 if (dhdp->concise_dbg_buf) { in dhd_log_dump_buf_addr()
23505 dhd_print_buf_addr(dhdp, "concise_dbg_buf", dhdp->concise_dbg_buf, in dhd_log_dump_buf_addr()
23530 plen = (unsigned long)end - (unsigned long)bufptr; in dhd_log_dump_print_to_kmsg()
23549 DHD_LOG_DUMP_BUF_LOCK(&dld_buf->lock, flags); in dhd_log_dump_print_tail()
23550 flush_ptr1 = dld_buf->present - tail_len; in dhd_log_dump_print_tail()
23551 if (flush_ptr1 >= dld_buf->front) { in dhd_log_dump_print_tail()
23555 } else if (dld_buf->wraparound) { in dhd_log_dump_print_tail()
23557 flush_ptr1 = dld_buf->front; in dhd_log_dump_print_tail()
23558 len_flush1 = (unsigned long)dld_buf->present - (unsigned long)flush_ptr1; in dhd_log_dump_print_tail()
23559 len_flush2 = (unsigned long)tail_len - len_flush1; in dhd_log_dump_print_tail()
23560 flush_ptr2 = (char *)((unsigned long)dld_buf->max - in dhd_log_dump_print_tail()
23564 flush_ptr1 = dld_buf->front; in dhd_log_dump_print_tail()
23566 len_flush1 = (unsigned long)dld_buf->present - (unsigned long)dld_buf->front; in dhd_log_dump_print_tail()
23568 DHD_LOG_DUMP_BUF_UNLOCK(&dld_buf->lock, flags); in dhd_log_dump_print_tail()
23591 if (dhd->sssr_d11_before[i] && dhd->sssr_d11_outofreset[i] && in dhdpcie_sssr_dump_get_before_after_len()
23592 (dhd->sssr_dump_mode == SSSR_DUMP_MODE_SSSR)) { in dhdpcie_sssr_dump_get_before_after_len()
23599 dhd->sssr_d11_before[i], arr_len[SSSR_C0_D11_BEFORE]); in dhdpcie_sssr_dump_get_before_after_len()
23603 if (dhd->sssr_d11_after[i] && dhd->sssr_d11_outofreset[i]) { in dhdpcie_sssr_dump_get_before_after_len()
23609 dhd->sssr_d11_after[i], arr_len[SSSR_C0_D11_AFTER]); in dhdpcie_sssr_dump_get_before_after_len()
23616 if (dhd->sssr_d11_before[i] && dhd->sssr_d11_outofreset[i] && in dhdpcie_sssr_dump_get_before_after_len()
23617 (dhd->sssr_dump_mode == SSSR_DUMP_MODE_SSSR)) { in dhdpcie_sssr_dump_get_before_after_len()
23623 dhd->sssr_d11_before[i], arr_len[SSSR_C1_D11_BEFORE]); in dhdpcie_sssr_dump_get_before_after_len()
23627 if (dhd->sssr_d11_after[i] && dhd->sssr_d11_outofreset[i]) { in dhdpcie_sssr_dump_get_before_after_len()
23633 dhd->sssr_d11_after[i], arr_len[SSSR_C1_D11_AFTER]); in dhdpcie_sssr_dump_get_before_after_len()
23638 if (dhd->sssr_reg_info->rev2.version >= SSSR_REG_INFO_VER_2) { in dhdpcie_sssr_dump_get_before_after_len()
23641 if (dhd->sssr_d11_before[i] && dhd->sssr_d11_outofreset[i] && in dhdpcie_sssr_dump_get_before_after_len()
23642 (dhd->sssr_dump_mode == SSSR_DUMP_MODE_SSSR)) { in dhdpcie_sssr_dump_get_before_after_len()
23648 dhd->sssr_d11_before[i], arr_len[SSSR_C2_D11_BEFORE]); in dhdpcie_sssr_dump_get_before_after_len()
23652 if (dhd->sssr_d11_after[i] && dhd->sssr_d11_outofreset[i]) { in dhdpcie_sssr_dump_get_before_after_len()
23658 dhd->sssr_d11_after[i], arr_len[SSSR_C2_D11_AFTER]); in dhdpcie_sssr_dump_get_before_after_len()
23663 /* DIG core or VASIP */ in dhdpcie_sssr_dump_get_before_after_len()
23666 arr_len[SSSR_DIG_BEFORE] = (dhd->sssr_dig_buf_before) ? dig_buf_size : 0; in dhdpcie_sssr_dump_get_before_after_len()
23670 if (dhd->sssr_dig_buf_before) { in dhdpcie_sssr_dump_get_before_after_len()
23672 dhd->sssr_dig_buf_before, arr_len[SSSR_DIG_BEFORE]); in dhdpcie_sssr_dump_get_before_after_len()
23677 arr_len[SSSR_DIG_AFTER] = (dhd->sssr_dig_buf_after) ? dig_buf_size : 0; in dhdpcie_sssr_dump_get_before_after_len()
23681 if (dhd->sssr_dig_buf_after) { in dhdpcie_sssr_dump_get_before_after_len()
23683 dhd->sssr_dig_buf_after, arr_len[SSSR_DIG_AFTER]); in dhdpcie_sssr_dump_get_before_after_len()
23694 dhd_pub_t *dhdp = &dhd_info->pub; in dhd_nla_put_sssr_dump_len()
23696 if (dhdp->sssr_dump_collected) { in dhd_nla_put_sssr_dump_len()
23723 dhdp = &dhd_info->pub; in dhd_get_ext_trap_len()
23729 if (dhdp->extended_trap_data) { in dhd_get_ext_trap_len()
23747 dhdp = &dhd_info->pub; in dhd_get_health_chk_len()
23753 if (dhdp->memdump_type == DUMP_TYPE_DONGLE_HOST_EVENT) { in dhd_get_health_chk_len()
23771 dhdp = &dhd_info->pub; in dhd_get_dhd_dump_len()
23777 if (dhdp->concise_dbg_buf) { in dhd_get_dhd_dump_len()
23778 remain_len = dhd_dump(dhdp, (char *)dhdp->concise_dbg_buf, CONCISE_DUMP_BUFLEN); in dhd_get_dhd_dump_len()
23785 length += (uint32)(CONCISE_DUMP_BUFLEN - remain_len); in dhd_get_dhd_dump_len()
23800 dhdp = &dhd_info->pub; in dhd_get_cookie_log_len()
23806 if (dhdp->logdump_cookie && dhd_logdump_cookie_count(dhdp) > 0) { in dhd_get_cookie_log_len()
23825 dhdp = &dhd_info->pub; in dhd_get_flowring_len()
23831 if (dhdp->concise_dbg_buf) { in dhd_get_flowring_len()
23832 remain_len = dhd_dump(dhdp, (char *)dhdp->concise_dbg_buf, CONCISE_DUMP_BUFLEN); in dhd_get_flowring_len()
23839 length += (uint32)(CONCISE_DUMP_BUFLEN - remain_len); in dhd_get_flowring_len()
23862 (h2d_flowrings_total - HTPUT_TOTAL_FLOW_RINGS))); in dhd_get_flowring_len()
23883 dhdp = &dhd_info->pub; in dhd_get_ecntrs_len()
23889 if (logdump_ecntr_enable && dhdp->ecntr_dbg_ring) { in dhd_get_ecntrs_len()
23890 ring = (dhd_dbg_ring_t *)dhdp->ecntr_dbg_ring; in dhd_get_ecntrs_len()
23891 length = ring->ring_size + strlen(ECNTRS_LOG_HDR) + sizeof(sec_hdr); in dhd_get_ecntrs_len()
23910 dhdp = &dhd_info->pub; in dhd_get_dld_log_dump()
23924 len -= (uint32)strlen(dld_hdrs[type].hdr_str); in dhd_get_dld_log_dump()
23925 len -= (uint32)sizeof(sec_hdr); in dhd_get_dld_log_dump()
23931 ret = dhd_export_debug_data(dld_buf->buffer, fp, user_buf, len, pos); in dhd_get_dld_log_dump()
23952 * we cannot do so, since 'dhdp->osh' is unavailable in dhd_log_flush()
23975 dhd_info = (dhd_info_t *)dhdp->info; in dhd_log_flush()
23978 if (dhdp->dongle_trap_occured && in dhd_log_flush()
23979 dhdp->extended_trap_data) { in dhd_log_flush()
23980 dhdpcie_get_etd_preserve_logs(dhdp, (uint8 *)dhdp->extended_trap_data, in dhd_log_flush()
23981 &dhd_info->event_data); in dhd_log_flush()
23990 if (dhd_info->pub.dongle_edl_support) { in dhd_log_flush()
23995 * wrapped around, only the work items from rd to ring-end are processed. in dhd_log_flush()
24032 dhdp = &dhd_info->pub; in dhd_get_debug_dump_file_name()
24045 if (!dhdp->logdump_periodic_flush) { in dhd_get_debug_dump_file_name()
24047 clear_debug_dump_time(dhdp->debug_dump_time_str); in dhd_get_debug_dump_file_name()
24048 get_debug_dump_time(dhdp->debug_dump_time_str); in dhd_get_debug_dump_file_name()
24049 sscanf(dhdp->debug_dump_time_str, DHD_LOG_DUMP_TS_FMT_YYMMDDHHMMSS, in dhd_get_debug_dump_file_name()
24052 ret = snprintf(dump_path + len, size - len, "_" DHD_LOG_DUMP_TS_FMT_YYMMDDHHMMSS, in dhd_get_debug_dump_file_name()
24059 switch (dhdp->debug_dump_subcmd) { in dhd_get_debug_dump_file_name()
24061 ret = snprintf(dump_path + len, size - len, "%s", DHD_DUMP_SUBSTR_UNWANTED); in dhd_get_debug_dump_file_name()
24064 ret = snprintf(dump_path + len, size - len, "%s", DHD_DUMP_SUBSTR_DISCONNECTED); in dhd_get_debug_dump_file_name()
24085 buf_size = (unsigned long)dld_buf->max - in dhd_get_dld_len()
24086 (unsigned long)dld_buf->buffer; in dhd_get_dld_len()
24088 if (dld_buf->wraparound) { in dhd_get_dld_len()
24092 DHD_LOG_DUMP_BUF_LOCK(&dld_buf->lock, flags); in dhd_get_dld_len()
24093 wr_size = (unsigned long)dld_buf->present - in dhd_get_dld_len()
24094 (unsigned long)dld_buf->front; in dhd_get_dld_len()
24095 DHD_LOG_DUMP_BUF_UNLOCK(&dld_buf->lock, flags); in dhd_get_dld_len()
24141 dhdp = &dhd_info->pub; in dhd_print_health_chk_data()
24149 if (dhdp->memdump_type == DUMP_TYPE_DONGLE_HOST_EVENT) { in dhd_print_health_chk_data()
24156 len -= (uint32)strlen(HEALTH_CHK_LOG_HDR); in dhd_print_health_chk_data()
24163 len -= (uint32)sizeof(sec_hdr); in dhd_print_health_chk_data()
24165 ret = dhd_export_debug_data((char *)dhdp->health_chk_event_data, fp, in dhd_print_health_chk_data()
24186 dhdp = &dhd_info->pub; in dhd_print_ext_trap_data()
24195 if (dhdp->dongle_trap_occured && in dhd_print_ext_trap_data()
24196 dhdp->extended_trap_data) { in dhd_print_ext_trap_data()
24203 len -= (uint32)strlen(EXT_TRAP_LOG_HDR); in dhd_print_ext_trap_data()
24210 len -= (uint32)sizeof(sec_hdr); in dhd_print_ext_trap_data()
24212 ret = dhd_export_debug_data((uint8 *)dhdp->extended_trap_data, fp, in dhd_print_ext_trap_data()
24232 dhdp = &dhd_info->pub; in dhd_print_dump_data()
24244 len -= (uint32)strlen(DHD_DUMP_LOG_HDR); in dhd_print_dump_data()
24251 len -= (uint32)sizeof(sec_hdr); in dhd_print_dump_data()
24253 if (dhdp->concise_dbg_buf) { in dhd_print_dump_data()
24254 dhd_dump(dhdp, (char *)dhdp->concise_dbg_buf, CONCISE_DUMP_BUFLEN); in dhd_print_dump_data()
24255 ret = dhd_export_debug_data(dhdp->concise_dbg_buf, fp, user_buf, len, pos); in dhd_print_dump_data()
24273 dhdp = &dhd_info->pub; in dhd_print_cookie_data()
24279 if (dhdp->logdump_cookie && dhd_logdump_cookie_count(dhdp) > 0) { in dhd_print_cookie_data()
24297 dhdp = &dhd_info->pub; in dhd_print_flowring_data()
24305 remain_len = dhd_dump(dhdp, (char *)dhdp->concise_dbg_buf, CONCISE_DUMP_BUFLEN); in dhd_print_flowring_data()
24311 memset(dhdp->concise_dbg_buf, 0, CONCISE_DUMP_BUFLEN); in dhd_print_flowring_data()
24320 ret = dhd_export_debug_data(dhdp->concise_dbg_buf, fp, user_buf, in dhd_print_flowring_data()
24321 (CONCISE_DUMP_BUFLEN - remain_len), pos); in dhd_print_flowring_data()
24352 dhdp = &dhd_info->pub; in dhd_print_ecntrs_data()
24361 dhdp->ecntr_dbg_ring) { in dhd_print_ecntrs_data()
24363 ret = dhd_dump_debug_ring(dhdp, dhdp->ecntr_dbg_ring, in dhd_print_ecntrs_data()
24382 dhdp = &dhd_info->pub; in dhd_print_rtt_data()
24390 if (logdump_rtt_enable && dhdp->rtt_dbg_ring) { in dhd_print_rtt_data()
24391 ret = dhd_dump_debug_ring(dhdp, dhdp->rtt_dbg_ring, in dhd_print_rtt_data()
24408 dhdp = &dhd_info->pub; in dhd_print_status_log_data()
24426 dhdp = &dhd_info->pub; in dhd_get_status_log_len()
24442 sec_hdr->magic = LOG_DUMP_MAGIC; in dhd_init_sec_hdr()
24443 sec_hdr->timestamp = local_clock(); in dhd_init_sec_hdr()
24500 if (!dhdp->logdump_periodic_flush || dhdp->last_file_posn == 0) in do_dhd_log_dump()
24512 if (!dhdp->logdump_periodic_flush) { in do_dhd_log_dump()
24514 sizeof(dump_path) - strlen(dump_path), in do_dhd_log_dump()
24515 "_%s", dhdp->debug_dump_time_str); in do_dhd_log_dump()
24547 if (dhdp->last_file_posn != 0 && in do_dhd_log_dump()
24548 file_size < dhdp->last_file_posn) { in do_dhd_log_dump()
24549 dhdp->last_file_posn = 0; in do_dhd_log_dump()
24557 if (dhdp->logdump_periodic_flush) { in do_dhd_log_dump()
24566 - (unsigned long)g_dld_buf[i].buffer; in do_dhd_log_dump()
24569 log_size += (unsigned long)g_dld_buf[i].present - in do_dhd_log_dump()
24579 ret = generic_file_llseek(fp, dhdp->last_file_posn, SEEK_CUR); in do_dhd_log_dump()
24584 pos = fp->f_pos; in do_dhd_log_dump()
24589 fspace_remain = logdump_max_filesize - pos; in do_dhd_log_dump()
24591 fp->f_pos -= pos; in do_dhd_log_dump()
24592 pos = fp->f_pos; in do_dhd_log_dump()
24612 dhdp->ecntr_dbg_ring) { in do_dhd_log_dump()
24613 dhd_log_dump_ring_to_file(dhdp, dhdp->ecntr_dbg_ring, in do_dhd_log_dump()
24620 if (dhdp->statlog) { in do_dhd_log_dump()
24633 if (dhdp->statlog) { in do_dhd_log_dump()
24642 dhdp->rtt_dbg_ring) { in do_dhd_log_dump()
24643 dhd_log_dump_ring_to_file(dhdp, dhdp->rtt_dbg_ring, in do_dhd_log_dump()
24651 dhdp->bcm_trace_dbg_ring) { in do_dhd_log_dump()
24652 dhd_log_dump_ring_to_file(dhdp, dhdp->bcm_trace_dbg_ring, in do_dhd_log_dump()
24694 if (dhdp->logdump_periodic_flush) { in do_dhd_log_dump()
24696 dhdp->last_file_posn = pos; in do_dhd_log_dump()
24702 DHD_ERROR(("%s: Finished writing log dump to file - '%s' \n", in do_dhd_log_dump()
24710 MFREE(dhdp->osh, type, sizeof(*type)); in do_dhd_log_dump()
24778 wf = (dhd_write_file_t *)MALLOC(dhdp->osh, sizeof(dhd_write_file_t)); in dhd_schedule_trap_log_dump()
24783 snprintf(wf->file_path, sizeof(wf->file_path), "%s", "/tmp/failed_if.txt"); in dhd_schedule_trap_log_dump()
24784 wf->file_flags = O_CREAT | O_WRONLY | O_SYNC; in dhd_schedule_trap_log_dump()
24785 wf->buf = buf; in dhd_schedule_trap_log_dump()
24786 wf->bufsize = size; in dhd_schedule_trap_log_dump()
24787 dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq, (void *)wf, in dhd_schedule_trap_log_dump()
24801 if (strcmp(pname, task->comm) == 0) in _get_task_info()
24825 if (!wf->buf) { in dhd_inform_dhd_monitor_handler()
24829 if (write_file(wf->file_path, wf->file_flags, wf->buf, wf->bufsize)) { in dhd_inform_dhd_monitor_handler()
24833 MFREE(dhd->pub.osh, wf, sizeof(dhd_write_file_t)); in dhd_inform_dhd_monitor_handler()
24844 __FUNCTION__, dhd->unit)); in dhd_inform_dhd_monitor_handler()
24852 __FUNCTION__, dhd->unit)); in dhd_inform_dhd_monitor_handler()
24860 __FUNCTION__, dhd->unit)); in dhd_inform_dhd_monitor_handler()
24874 dhd_pub_t *dhdp = &dhd->pub; in _dhd_schedule_macdbg_dump()
24886 __FUNCTION__, dhd->unit)); in _dhd_schedule_macdbg_dump()
24895 dumpbuf = (char *)MALLOCZ(dhdp->osh, DUMPMAC_BUF_SZ); in _dhd_schedule_macdbg_dump()
24953 MFREE(dhdp->osh, dumpbuf, DUMPMAC_BUF_SZ); in _dhd_schedule_macdbg_dump()
24964 dhd_deferred_work_set_skip(dhd->dhd_deferred_wq, in _dhd_schedule_macdbg_dump()
24972 __FUNCTION__, dhdp->info->unit)); in dhd_schedule_macdbg_dump()
24974 dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq, NULL, in dhd_schedule_macdbg_dump()
24976 dhd_deferred_work_set_skip(dhdp->info->dhd_deferred_wq, in dhd_schedule_macdbg_dump()
24990 dhd_pub_t *dhdp = &dhd->pub; in dhd_os_socram_dump()
24992 if (dhdp->busstate == DHD_BUS_DOWN) { in dhd_os_socram_dump()
24999 __FUNCTION__, dhdp->busstate, dhdp->dhd_bus_busy_state)); in dhd_os_socram_dump()
25007 *dump_size = dhdp->soc_ram_length; in dhd_os_socram_dump()
25021 dhd_pub_t *dhdp = &dhd->pub; in dhd_os_get_socram_dump()
25025 if (dhdp->soc_ram) { in dhd_os_get_socram_dump()
25026 if (orig_len >= dhdp->soc_ram_length) { in dhd_os_get_socram_dump()
25027 *buf = dhdp->soc_ram; in dhd_os_get_socram_dump()
25028 *size = dhdp->soc_ram_length; in dhd_os_get_socram_dump()
25032 " to save the memory dump with %d\n", dhdp->soc_ram_length)); in dhd_os_get_socram_dump()
25052 dhdp = &dhd_info->pub; in dhd_get_rtt_len()
25058 if (logdump_rtt_enable && dhdp->rtt_dbg_ring) { in dhd_get_rtt_len()
25059 ring = (dhd_dbg_ring_t *)dhdp->rtt_dbg_ring; in dhd_get_rtt_len()
25060 length = ring->ring_size + strlen(RTT_LOG_HDR) + sizeof(sec_hdr); in dhd_get_rtt_len()
25094 dhd_pub_t *dhdp = &dhd->pub; in dhd_os_get_pktlog_dump()
25113 dhd_pub_t *dhdp = &dhd->pub; in dhd_os_get_pktlog_dump_size()
25126 dhd_pub_t *dhdp = &dhd->pub; in dhd_os_get_pktlogdump_filename()
25137 dhd_pub_t *dhdp = &dhd->pub; in dhd_os_get_axi_error_dump()
25144 ret = dhd_export_debug_data((char *)dhdp->axi_err_dump, in dhd_os_get_axi_error_dump()
25157 int size = -1; in dhd_os_get_axi_error_dump_size()
25177 dhd_info_t *dhd = dhdp->info; in dhd_wmf_conf()
25182 ifp = dhd->iflist[idx]; in dhd_wmf_conf()
25183 return &ifp->wmf; in dhd_wmf_conf()
25196 pktdata = (uint8 *)PKTDATA(dhdp->osh, pktbuf); in traffic_mgmt_pkt_set_prio()
25200 if (dhdp->dhd_tm_dwm_tbl.dhd_dwm_enabled) { in traffic_mgmt_pkt_set_prio()
25201 if (eh->ether_type == hton16(ETHER_TYPE_8021Q)) { in traffic_mgmt_pkt_set_prio()
25203 if ((evh->ether_type == hton16(ETHER_TYPE_IP)) || in traffic_mgmt_pkt_set_prio()
25204 (evh->ether_type == hton16(ETHER_TYPE_IPV6))) { in traffic_mgmt_pkt_set_prio()
25207 } else if ((eh->ether_type == hton16(ETHER_TYPE_IP)) || in traffic_mgmt_pkt_set_prio()
25208 (eh->ether_type == hton16(ETHER_TYPE_IPV6))) { in traffic_mgmt_pkt_set_prio()
25217 dwm_filter = dhdp->dhd_tm_dwm_tbl.dhd_dwm_tbl[dscp]; in traffic_mgmt_pkt_set_prio()
25235 dhd_info_t *dhd = dhdp->info; in dhd_get_ifp_arp_table_handle()
25240 ifp = dhd->iflist[bssidx]; in dhd_get_ifp_arp_table_handle()
25241 return ifp->phnd_arp_table; in dhd_get_ifp_arp_table_handle()
25246 dhd_info_t *dhd = dhdp->info; in dhd_get_parp_status()
25251 ifp = dhd->iflist[idx]; in dhd_get_parp_status()
25254 return ifp->parp_enable; in dhd_get_parp_status()
25262 dhd_info_t *dhd = dhdp->info; in dhd_set_parp_status()
25265 ifp = dhd->iflist[idx]; in dhd_set_parp_status()
25273 ifp->parp_enable = val; in dhd_set_parp_status()
25274 ifp->parp_discard = val; in dhd_set_parp_status()
25275 ifp->parp_allnode = val; in dhd_set_parp_status()
25279 bcm_l2_filter_arp_table_update(dhdp->osh, ifp->phnd_arp_table, TRUE, NULL, in dhd_set_parp_status()
25280 FALSE, dhdp->tickcnt); in dhd_set_parp_status()
25287 dhd_info_t *dhd = dhdp->info; in dhd_parp_discard_is_enabled()
25292 ifp = dhd->iflist[idx]; in dhd_parp_discard_is_enabled()
25295 return ifp->parp_discard; in dhd_parp_discard_is_enabled()
25301 dhd_info_t *dhd = dhdp->info; in dhd_parp_allnode_is_enabled()
25306 ifp = dhd->iflist[idx]; in dhd_parp_allnode_is_enabled()
25310 return ifp->parp_allnode; in dhd_parp_allnode_is_enabled()
25315 dhd_info_t *dhd = dhdp->info; in dhd_get_dhcp_unicast_status()
25320 ifp = dhd->iflist[idx]; in dhd_get_dhcp_unicast_status()
25324 return ifp->dhcp_unicast; in dhd_get_dhcp_unicast_status()
25329 dhd_info_t *dhd = dhdp->info; in dhd_set_dhcp_unicast_status()
25332 ifp = dhd->iflist[idx]; in dhd_set_dhcp_unicast_status()
25336 ifp->dhcp_unicast = val; in dhd_set_dhcp_unicast_status()
25342 dhd_info_t *dhd = dhdp->info; in dhd_get_block_ping_status()
25347 ifp = dhd->iflist[idx]; in dhd_get_block_ping_status()
25351 return ifp->block_ping; in dhd_get_block_ping_status()
25356 dhd_info_t *dhd = dhdp->info; in dhd_set_block_ping_status()
25359 ifp = dhd->iflist[idx]; in dhd_set_block_ping_status()
25363 ifp->block_ping = val; in dhd_set_block_ping_status()
25373 dhd_info_t *dhd = dhdp->info; in dhd_get_grat_arp_status()
25378 ifp = dhd->iflist[idx]; in dhd_get_grat_arp_status()
25382 return ifp->grat_arp; in dhd_get_grat_arp_status()
25387 dhd_info_t *dhd = dhdp->info; in dhd_set_grat_arp_status()
25390 ifp = dhd->iflist[idx]; in dhd_set_grat_arp_status()
25394 ifp->grat_arp = val; in dhd_set_grat_arp_status()
25401 dhd_info_t *dhd = dhdp->info; in dhd_get_block_tdls_status()
25406 ifp = dhd->iflist[idx]; in dhd_get_block_tdls_status()
25410 return ifp->block_tdls; in dhd_get_block_tdls_status()
25415 dhd_info_t *dhd = dhdp->info; in dhd_set_block_tdls_status()
25418 ifp = dhd->iflist[idx]; in dhd_set_block_tdls_status()
25422 ifp->block_tdls = val; in dhd_set_block_tdls_status()
25439 return -ENODEV; in dhd_xps_cpus_enable()
25442 if (!dhd->pub.conf->xps_cpus) in dhd_xps_cpus_enable()
25443 return -ENODEV; in dhd_xps_cpus_enable()
25446 if (dhd->pub.op_mode == DHD_FLAG_IBSS_MODE) { in dhd_xps_cpus_enable()
25458 return -EINVAL; in dhd_xps_cpus_enable()
25461 ifp = dhd->iflist[ifidx]; in dhd_xps_cpus_enable()
25465 custom_xps_map_set(ifp->net, XPS_CPU_SETBUF, strlen(XPS_CPU_SETBUF)); in dhd_xps_cpus_enable()
25467 custom_xps_map_clear(ifp->net); in dhd_xps_cpus_enable()
25471 return -ENODEV; in dhd_xps_cpus_enable()
25485 return -ENOMEM; in custom_xps_map_set()
25500 WL_MSG(net->name, "Done. mapping cpu\n"); in custom_xps_map_set()
25513 dev_maps = rcu_dereference(net->xps_cpus_map); in custom_xps_map_clear()
25515 dev_maps = rcu_dereference(net->xps_maps); in custom_xps_map_clear()
25521 RCU_INIT_POINTER(net->xps_cpus_map, NULL); in custom_xps_map_clear()
25523 RCU_INIT_POINTER(net->xps_maps, NULL); in custom_xps_map_clear()
25542 return -ENODEV; in dhd_rps_cpus_enable()
25545 if (!dhd->pub.conf->rps_cpus) in dhd_rps_cpus_enable()
25546 return -ENODEV; in dhd_rps_cpus_enable()
25549 if (dhd->pub.op_mode == DHD_FLAG_IBSS_MODE) { in dhd_rps_cpus_enable()
25561 return -EINVAL; in dhd_rps_cpus_enable()
25564 ifp = dhd->iflist[ifidx]; in dhd_rps_cpus_enable()
25568 custom_rps_map_set(ifp->net->_rx, RPS_CPU_SETBUF, strlen(RPS_CPU_SETBUF)); in dhd_rps_cpus_enable()
25570 custom_rps_map_clear(ifp->net->_rx); in dhd_rps_cpus_enable()
25574 return -ENODEV; in dhd_rps_cpus_enable()
25590 return -ENOMEM; in custom_rps_map_set()
25606 return -ENOMEM; in custom_rps_map_set()
25611 map->cpus[i++] = cpu; in custom_rps_map_set()
25615 map->len = i; in custom_rps_map_set()
25621 return -1; in custom_rps_map_set()
25625 old_map = rcu_dereference_protected(queue->rps_map, in custom_rps_map_set()
25627 rcu_assign_pointer(queue->rps_map, map); in custom_rps_map_set()
25647 DHD_INFO(("%s : Done. mapping cpu nummber : %d\n", __FUNCTION__, map->len)); in custom_rps_map_set()
25648 return map->len; in custom_rps_map_set()
25657 map = rcu_dereference_protected(queue->rps_map, 1); in custom_rps_map_clear()
25659 RCU_INIT_POINTER(queue->rps_map, NULL); in custom_rps_map_clear()
25676 complete(&tsk->completed); in dhd_buzzz_thread()
25680 if (down_interruptible(&tsk->sema) == 0) { in dhd_buzzz_thread()
25681 if (tsk->terminated) { in dhd_buzzz_thread()
25690 complete_and_exit(&tsk->completed, 0); in dhd_buzzz_thread()
25727 if (thr_buzzz_ctl->thr_pid >= 0) { in dhd_os_sched_buzzz_thread()
25728 up(&thr_buzzz_ctl->sema); in dhd_os_sched_buzzz_thread()
25735 * the top of the check_poison_mem() function in mm/debug-pagealloc.c file.
25738 * - mm/debug-pagealloc.c
25766 * end - start + 1, 1);
25769 * dhd_page_corrupt_cb(corrupt_cb_handle, start, end - start + 1);
25789 dhdp->memdump_enabled = DUMP_MEMONLY; in dhd_page_corrupt_cb()
25790 dhdp->memdump_type = DUMP_TYPE_MEMORY_CORRUPTION; in dhd_page_corrupt_cb()
25807 if (dhdp->memdump_enabled == DUMP_DISABLED) { in dhd_pktid_error_handler()
25808 dhdp->memdump_enabled = DUMP_MEMFILE; in dhd_pktid_error_handler()
25810 dhdp->memdump_type = DUMP_TYPE_PKTID_AUDIT_FAILURE; in dhd_pktid_error_handler()
25815 dhdp->hang_reason = HANG_REASON_PCIE_PKTID_ERROR; in dhd_pktid_error_handler()
25816 dhd_os_check_hang(dhdp, 0, -EREMOTEIO); in dhd_pktid_error_handler()
25825 dhd_info_t *dhd = dhdp->info; in dhd_linux_get_primary_netdev()
25827 if (dhd->iflist[0] && dhd->iflist[0]->net) in dhd_linux_get_primary_netdev()
25828 return dhd->iflist[0]->net; in dhd_linux_get_primary_netdev()
25835 * dhd_msgbuf_get_ipv6_id - return ipv6 identification number
25860 return ntohl(fh->identification); in dhd_msgbuf_get_ipv6_id()
25864 * dhd_create_to_notifier_ts - create BCM_NL_TS netlink socket
25877 return -1; in dhd_create_to_notifier_ts()
25884 * dhd_destroy_to_notifier_ts - destroy BCM_NL_TS netlink socket
25900 * dhd_recv_msg_from_ts - this is called on BCM_NL_TS netlink recv message
25908 sender_pid_ts = ((struct nlmsghdr *)(skb->data))->nlmsg_pid; in dhd_recv_msg_from_ts()
25914 * dhd_send_msg_to_ts - send data to BCM_NL_TS netlink socket
25981 return -1; in dhd_create_to_notifier_skt()
26000 nlh = (struct nlmsghdr *)skb->data; in dhd_recv_msg_from_daemon()
26002 if ((cmd->magic == BCM_TO_MAGIC) && (cmd->reason == REASON_DAEMON_STARTED)) { in dhd_recv_msg_from_daemon()
26003 sender_pid = ((struct nlmsghdr *)(skb->data))->nlmsg_pid; in dhd_recv_msg_from_daemon()
26116 local_time = (u32)(tv.tv_sec - (sys_tz.tz_minuteswest * 60)); in dhd_dbg_get_system_timestamp()
26164 dhd_info_t *dhd_info = dhd->info; in dhd_log_dump_init()
26195 mutex_init(&dhd_info->logdump_lock); in dhd_log_dump_init()
26206 /* pre-alloc the memory for the log buffers & 'special' buffer */ in dhd_log_dump_init()
26210 dld_buf_special->buffer = DHD_OS_PREALLOC(dhd, prealloc_idx++, in dhd_log_dump_init()
26213 prealloc_buf = MALLOCZ(dhd->osh, LOG_DUMP_TOTAL_BUFSIZE); in dhd_log_dump_init()
26214 dld_buf_special->buffer = MALLOCZ(dhd->osh, dld_buf_size[DLD_BUF_TYPE_SPECIAL]); in dhd_log_dump_init()
26221 if (!dld_buf_special->buffer) { in dhd_log_dump_init()
26226 DHD_ERROR(("prealloc_buf:%p dld_buf_special->buffer:%p\n", in dhd_log_dump_init()
26227 prealloc_buf, dld_buf_special->buffer)); in dhd_log_dump_init()
26233 dld_buf->dhd_pub = dhd; in dhd_log_dump_init()
26234 spin_lock_init(&dld_buf->lock); in dhd_log_dump_init()
26235 dld_buf->wraparound = 0; in dhd_log_dump_init()
26237 dld_buf->buffer = bufptr; in dhd_log_dump_init()
26238 dld_buf->max = (unsigned long)dld_buf->buffer + dld_buf_size[i]; in dhd_log_dump_init()
26239 bufptr = (uint8 *)dld_buf->max; in dhd_log_dump_init()
26241 dld_buf->max = (unsigned long)dld_buf->buffer + dld_buf_size[i]; in dhd_log_dump_init()
26243 dld_buf->present = dld_buf->front = dld_buf->buffer; in dhd_log_dump_init()
26244 dld_buf->remain = dld_buf_size[i]; in dhd_log_dump_init()
26245 dld_buf->enable = 1; in dhd_log_dump_init()
26248 /* now use the rest of the pre-alloc'd memory for other rings */ in dhd_log_dump_init()
26250 dhd->ecntr_dbg_ring = dhd_dbg_ring_alloc_init(dhd, in dhd_log_dump_init()
26254 if (!dhd->ecntr_dbg_ring) { in dhd_log_dump_init()
26263 dhd->rtt_dbg_ring = dhd_dbg_ring_alloc_init(dhd, in dhd_log_dump_init()
26267 if (!dhd->rtt_dbg_ring) { in dhd_log_dump_init()
26276 dhd->bcm_trace_dbg_ring = dhd_dbg_ring_alloc_init(dhd, in dhd_log_dump_init()
26280 if (!dhd->bcm_trace_dbg_ring) { in dhd_log_dump_init()
26295 dhd->concise_dbg_buf = MALLOC(dhd->osh, CONCISE_DUMP_BUFLEN); in dhd_log_dump_init()
26296 if (!dhd->concise_dbg_buf) { in dhd_log_dump_init()
26313 cookie_buf = MALLOC(dhd->osh, LOG_DUMP_COOKIE_BUFSIZE); in dhd_log_dump_init()
26322 MFREE(dhd->osh, cookie_buf, LOG_DUMP_COOKIE_BUFSIZE); in dhd_log_dump_init()
26332 if (dhd->event_log_filter) { in dhd_log_dump_init()
26337 if (dhd->concise_dbg_buf) { in dhd_log_dump_init()
26338 MFREE(dhd->osh, dhd->concise_dbg_buf, CONCISE_DUMP_BUFLEN); in dhd_log_dump_init()
26342 if (dhd->logdump_cookie) { in dhd_log_dump_init()
26344 MFREE(dhd->osh, dhd->logdump_cookie, LOG_DUMP_COOKIE_BUFSIZE); in dhd_log_dump_init()
26345 dhd->logdump_cookie = NULL; in dhd_log_dump_init()
26353 if (dld_buf_special->buffer) { in dhd_log_dump_init()
26354 DHD_OS_PREFREE(dhd, dld_buf_special->buffer, in dhd_log_dump_init()
26359 MFREE(dhd->osh, prealloc_buf, LOG_DUMP_TOTAL_BUFSIZE); in dhd_log_dump_init()
26361 if (dld_buf_special->buffer) { in dhd_log_dump_init()
26362 MFREE(dhd->osh, dld_buf_special->buffer, in dhd_log_dump_init()
26368 dld_buf->enable = 0; in dhd_log_dump_init()
26369 dld_buf->buffer = NULL; in dhd_log_dump_init()
26371 mutex_destroy(&dhd_info->logdump_lock); in dhd_log_dump_init()
26379 dhd_info_t *dhd_info = dhd->info;
26384 if (dhd->concise_dbg_buf) {
26385 MFREE(dhd->osh, dhd->concise_dbg_buf, CONCISE_DUMP_BUFLEN);
26386 dhd->concise_dbg_buf = NULL;
26390 if (dhd->logdump_cookie) {
26392 MFREE(dhd->osh, dhd->logdump_cookie, LOG_DUMP_COOKIE_BUFSIZE);
26393 dhd->logdump_cookie = NULL;
26396 if (dhd->ecntr_dbg_ring) {
26397 dhd_dbg_ring_dealloc_deinit(&dhd->ecntr_dbg_ring, dhd);
26402 if (dhd->rtt_dbg_ring) {
26403 dhd_dbg_ring_dealloc_deinit(&dhd->rtt_dbg_ring, dhd);
26408 if (dhd->bcm_trace_dbg_ring) {
26409 dhd_dbg_ring_dealloc_deinit(&dhd->bcm_trace_dbg_ring, dhd);
26413 /* 'general' buffer points to start of the pre-alloc'd memory */
26417 if (dld_buf->buffer) {
26418 DHD_OS_PREFREE(dhd, dld_buf->buffer, LOG_DUMP_TOTAL_BUFSIZE);
26420 if (dld_buf_special->buffer) {
26421 DHD_OS_PREFREE(dhd, dld_buf_special->buffer,
26425 if (dld_buf->buffer) {
26426 MFREE(dhd->osh, dld_buf->buffer, LOG_DUMP_TOTAL_BUFSIZE);
26428 if (dld_buf_special->buffer) {
26429 MFREE(dhd->osh, dld_buf_special->buffer,
26435 dld_buf->enable = 0;
26436 dld_buf->buffer = NULL;
26438 mutex_destroy(&dhd_info->logdump_lock);
26459 if (dld_buf->enable != 1) {
26465 /* Non ANSI C99 compliant returns -1,
26474 len = DHD_LOG_DUMP_MAX_TEMP_BUFFER_SIZE - 1;
26479 DHD_LOG_DUMP_BUF_LOCK(&dld_buf->lock, flags);
26480 if (dld_buf->remain < len) {
26481 dld_buf->wraparound = 1;
26482 dld_buf->present = dld_buf->front;
26483 dld_buf->remain = dld_buf_size[type];
26488 memcpy(dld_buf->present, tmp_buf, len);
26489 dld_buf->remain -= len;
26490 dld_buf->present += len;
26491 DHD_LOG_DUMP_BUF_UNLOCK(&dld_buf->lock, flags);
26494 ASSERT((unsigned long)dld_buf->present <= dld_buf->max);
26496 if (dld_buf->dhd_pub) {
26497 dhd_pub_t *dhdp = (dhd_pub_t *)dld_buf->dhd_pub;
26498 dhdp->logdump_periodic_flush =
26501 log_dump_type_t *flush_type = MALLOCZ(dhdp->osh,
26505 dhd_schedule_log_dump(dld_buf->dhd_pub, flush_type);
26526 /* Non ANSI C99 compliant returns -1,
26535 len = DHD_LOG_DUMP_MAX_TEMP_BUFFER_SIZE - 1;
26539 if (ring_buf->dhd_pub) {
26540 dhd_pub_t *dhdp = (dhd_pub_t *)ring_buf->dhd_pub;
26562 dhd = dhdp->info;
26564 flush_workqueue(dhd->tx_wq);
26565 flush_workqueue(dhd->rx_wq);
26579 if (dhd->duart_execute) {
26602 if (dhdp->memdump_enabled == DUMP_MEMFILE_BUGON)
26605 if (dhdp->hang_reason == HANG_REASON_PCIE_LINK_DOWN_RC_DETECT ||
26606 dhdp->hang_reason == HANG_REASON_PCIE_LINK_DOWN_EP_DETECT ||
26608 dhdp->memdump_success == FALSE ||
26611 dhdp->info->duart_execute = TRUE;
26612 DHD_ERROR(("DHD: %s - execute %s %s\n",
26615 DHD_ERROR(("DHD: %s - %s %s ret = %d\n",
26617 dhdp->info->duart_execute = FALSE;
26620 if (dhdp->memdump_type != DUMP_TYPE_BY_SYSDUMP)
26639 DHD_ERROR(("%s: ----- blob file doesn't exist (%s) -----\n", __FUNCTION__,
26641 dhdp->is_blob = FALSE;
26643 DHD_ERROR(("%s: ----- blob file exists (%s) -----\n", __FUNCTION__, filepath));
26644 dhdp->is_blob = TRUE;
26675 dmaxfer_free_prev_dmaaddr(&dhd_info->pub, dmmap);
26681 dhd_info_t *dhd_info = dhdp->info;
26683 dhd_deferred_schedule_work(dhd_info->dhd_deferred_wq, (void *)dmmap,
26687 /* ---------------------------- End of sysfs implementation ------------------------------------- */
26702 if (!dhdp->bus) {
26703 DHD_ERROR(("%s : dhd->bus is NULL\n", __FUNCTION__));
26714 if (dhdpcie_get_pcieirq(dhdp->bus, &pcie_irq)) {
26720 dhd = dhdp->info;
26723 dhd->permitted_primary_cpu = FALSE;
26726 dhd->permitted_primary_cpu = TRUE;
26730 * It needs to NAPI disable -> enable to raise NET_RX napi CPU core
26735 napi_disable(&dhd->rx_napi_struct);
26736 napi_enable(&dhd->rx_napi_struct);
26741 If dedicated CPU core is not on-line,
26749 irq_set_affinity_hint(pcie_irq, dhdp->info->cpumask_secondary);
26750 irq_set_affinity(pcie_irq, dhdp->info->cpumask_secondary);
26755 irq_set_affinity_hint(pcie_irq, dhdp->info->cpumask_primary);
26756 irq_set_affinity(pcie_irq, dhdp->info->cpumask_primary);
26768 irq_set_affinity(pcie_irq, dhdp->info->cpumask_secondary);
26772 irq_set_affinity(pcie_irq, dhdp->info->cpumask_primary);
26813 if (fp->f_mode & FMODE_WRITE) {
26814 ret = dhd_vfs_write(fp, buf, buf_len, &fp->f_pos);
26904 buf = MALLOCZ(dhd->osh, FILE_BLOCK_READ_SIZE);
26917 nread = dhd_os_get_image_block(buf, (FILE_BLOCK_READ_SIZE - 1), fd);
26930 MFREE(dhd->osh, buf, FILE_BLOCK_READ_SIZE);
26981 msb = inbuf[i] > '9' ? bcm_toupper(inbuf[i]) - 'A' + 10 : inbuf[i] - '0';
26982 lsb = inbuf[i + 1] > '9' ? bcm_toupper(inbuf[i + 1]) -
26983 'A' + 10 : inbuf[i + 1] - '0';
27025 p_filter_iov = MALLOCZ(dhd->osh, filter_iovsize);
27033 p_filter_iov->version = WL_FILTER_IE_VERSION;
27034 p_filter_iov->len = filter_iovsize;
27035 p_filter_iov->fixed_length = p_filter_iov->len - FILTER_IE_BUFSZ;
27036 p_filter_iov->pktflag = FC_PROBE_REQ;
27037 p_filter_iov->option = WL_FILTER_IE_CHECK_SUB_OPTION;
27039 bufsize = filter_iovsize - WL_FILTER_IE_IOV_HDR_SIZE; /* adjust available size for TLVs */
27040 p_ie_tlv = (wl_filter_ie_tlv_t *)&p_filter_iov->tlvs[0];
27135 all_tlvsize = (bufsize - buf_space_left);
27136 p_filter_iov->len = htol16(all_tlvsize + WL_FILTER_IE_IOV_HDR_SIZE);
27138 p_filter_iov->len, NULL, 0, TRUE);
27145 MFREE(dhd->osh, p_filter_iov, filter_iovsize);
27182 dhdp = &dhd->pub;
27193 if (dhdp->req_hang_type) {
27195 __FUNCTION__, dhdp->req_hang_type));
27196 dhdp->req_hang_type = 0;
27207 if (dhdp->req_hang_type != 0) {
27215 dhdp->req_hang_type = reason;
27222 dhdp->req_hang_type = reason;
27229 dhdp->req_hang_type = reason;
27233 dhdp->req_hang_type = reason;
27238 dhdp->req_hang_type = 0;
27242 dhdp->req_hang_type = 0;
27246 dhdp->req_hang_type = 0;
27251 dhdp->req_hang_type = reason;
27254 dhdp->req_hang_type = 0;
27269 dhd_info_t * dhd = (dhd_info_t *)(dhdp->info);
27277 mutex_lock(&dhd->quiesce_lock);
27278 DHD_ERROR(("%s: start quiesce_state = %d\n", __FUNCTION__, dhd->dhd_quiesce_state));
27279 if (dhd->dhd_quiesce_state != DHD_QUIESCE_INIT) {
27280 DHD_ERROR(("%s: start quiesce_state = %d\n", __FUNCTION__, dhd->dhd_quiesce_state));
27281 mutex_unlock(&dhd->quiesce_lock);
27284 dhd->dhd_quiesce_state = REQUEST_BT_QUIESCE;
27287 timeout = wait_event_timeout(dhd->quiesce_wait,
27288 (dhd->dhd_quiesce_state == RESPONSE_BT_QUIESCE), timeout);
27290 DHD_ERROR(("%s: after wait quiesce_state = %d\n", __FUNCTION__, dhd->dhd_quiesce_state));
27292 mutex_unlock(&dhd->quiesce_lock);
27295 __FUNCTION__, dhd->dhd_quiesce_state));
27304 dhd_info_t * dhd = (dhd_info_t *)(dhdp->info);
27312 DHD_ERROR(("%s: start quiesce_state = %d\n", __FUNCTION__, dhd->dhd_quiesce_state));
27313 mutex_lock(&dhd->quiesce_lock);
27314 if (dhd->dhd_quiesce_state != RESPONSE_BT_QUIESCE) {
27315 mutex_unlock(&dhd->quiesce_lock);
27318 dhd->dhd_quiesce_state = REQUEST_BT_RESUME;
27321 timeout = wait_event_timeout(dhd->quiesce_wait,
27322 (dhd->dhd_quiesce_state == RESPONSE_BT_RESUME), timeout);
27324 DHD_ERROR(("%s: after wait quiesce_state = %d\n", __FUNCTION__, dhd->dhd_quiesce_state));
27326 dhd->dhd_quiesce_state = DHD_QUIESCE_INIT;
27327 mutex_unlock(&dhd->quiesce_lock);
27330 __FUNCTION__, dhd->dhd_quiesce_state));
27340 dhd_info_t * dhd = (dhd_info_t *)(dhdp->info);
27342 if (dhd->dhd_quiesce_state == REQUEST_BT_QUIESCE) {
27343 dhd->dhd_quiesce_state = RESPONSE_BT_QUIESCE;
27344 wake_up(&dhd->quiesce_wait);
27348 if (dhd->dhd_quiesce_state == REQUEST_BT_RESUME) {
27349 dhd->dhd_quiesce_state = RESPONSE_BT_RESUME;
27350 wake_up(&dhd->quiesce_wait);
27355 __FUNCTION__, quiesce, dhd->dhd_quiesce_state));
27364 dhd_info_t * dhd = (dhd_info_t *)(dhdp->info);
27365 bool dongle_isolation = dhdp->dongle_isolation;
27366 mutex_lock(&dhd->quiesce_flr_lock);
27367 dhd->dhd_quiesce_state = DHD_QUIESCE_INIT;
27370 dhd_bus_stop_queue(dhdp->bus);
27381 dhd_bus_l1ss_enable_rc_ep(dhdp->bus, FALSE);
27384 if (dhd_bus_force_bt_quiesce_enabled(dhdp->bus)) {
27391 mutex_unlock(&dhd->quiesce_flr_lock);
27396 dhd_bus_pcie_pwr_req_reload_war(dhdp->bus);
27400 ret = dhd_bus_perform_flr(dhdp->bus, dhd_bus_get_flr_force_fail(dhdp->bus));
27407 mutex_unlock(&dhd->quiesce_flr_lock);
27411 if (dhd_bus_force_bt_quiesce_enabled(dhdp->bus)) {
27418 mutex_unlock(&dhd->quiesce_flr_lock);
27424 dhdp->dongle_isolation = TRUE;
27430 dhd_bus_devreset(dhdp, 0); /* DHD structure re-init */
27432 dhdp->dongle_isolation = dongle_isolation; /* Restore the old value */
27435 dhd_bus_start_queue(dhdp->bus);
27436 mutex_unlock(&dhd->quiesce_flr_lock);
27452 if (bcmp(&sh->dsap, llc_snap_hdr, SNAP_HDR_LEN) == 0) {
27453 *type = ntoh16(sh->type);
27457 if ((*plen -= sizeof(struct dot3_mac_llc_snap_header)) <= 0) {
27465 *type = ntoh16(svh->ether_type);
27467 if ((*plen -= sizeof(struct dot3_mac_llc_snapvlan_header)) <= 0) {
27480 *type = ntoh16(evh->ether_type);
27482 if ((*plen -= ETHERVLAN_HDR_LEN) <= 0) {
27488 if ((*plen -= ETHER_HDR_LEN) <= 0) {
27505 if ((plen -= len) <= 0) {
27515 if ((plen -= IPV6_MIN_HLEN) <= 0) {
27523 if (exth_len < 0 || ((plen -= exth_len) <= 0)) {
27553 type = ntoh16(eh->ether_type);
27557 ether_type = ntoh16(dot3->type);
27562 if (proto->layer == DHD_TX_PROFILE_DATA_LINK_LAYER &&
27563 proto->protocol_number == ether_type) {
27572 } else if (proto->layer == DHD_TX_PROFILE_DATA_LINK_LAYER) {
27573 result = proto->protocol_number == type;
27574 } else if (proto->layer != DHD_TX_PROFILE_NETWORK_LAYER) {
27578 } else if (proto->protocol_number == type) {
27588 result = ((proto->src_port == 0) || (proto->src_port ==
27589 ntoh16(hdr->src_port))) && ((proto->dest_port == 0) ||
27590 (proto->dest_port == ntoh16(hdr->dst_port)));
27613 if (ntoh16(eh->ether_type) < ETHER_TYPE_MIN) {
27621 parse->proto = IP_PROT_RESERVED;
27622 parse->t1 = 0;
27623 parse->t2 = 0;
27630 if (iph->protocol == IP_PROT_ICMP) {
27633 parse->proto = iph->protocol;
27636 if ((icmph->type == ICMP_ECHO) || (icmph->type == ICMP_ECHOREPLY)) {
27637 parse->t1 = icmph->type;
27638 parse->t2 = ntoh16(icmph->un.echo.sequence);
27640 parse->t1 = icmph->type;
27641 parse->t2 = icmph->code;
27644 parse->proto = iph->protocol;
27674 raw_spin_lock_irqsave(&desc->lock, flags);
27678 desc->kstat_irqs ? *per_cpu_ptr(desc->kstat_irqs, i) : 0);
27679 if (desc->irq_data.chip) {
27680 if (desc->irq_data.chip->name)
27681 bcm_bprintf(&strbuf, " %8s", desc->irq_data.chip->name);
27683 bcm_bprintf(&strbuf, " %8s", "-");
27688 if (desc->irq_data.domain)
27689 bcm_bprintf(&strbuf, " %d", (int)desc->irq_data.hwirq);
27691 bcm_bprintf(&strbuf, " %-8s", irqd_is_level_type(&desc->irq_data) ? "Level" : "Edge");
27695 if (desc->name)
27696 bcm_bprintf(&strbuf, "-%-8s", desc->name);
27699 raw_spin_unlock_irqrestore(&desc->lock, flags);
27707 unsigned int irq = -1;
27709 dhdpcie_get_pcieirq(dhd->bus, &irq);
27712 irq = ((wifi_adapter_info_t *)dhd->info->adapter)->irq_num;
27714 if (irq != -1) {
27742 dhdinfo = dhd->info;
27749 DHD_ERROR(("DHD Tasklet status : 0x%lx\n", dhdinfo->tasklet.state));
27762 dhd = dhdp->info;
27767 bcm_bprintf(strbuf, "----- \t----- \t----- \t-----\n");
27769 bcm_bprintf(strbuf, "%-10d\t", dhd->pktcnt_per_ac[i]);
27771 bcm_bprintf(strbuf, "\n\nTx packet arrival Q-AC histogram:\n");
27773 bcm_bprintf(strbuf, "\t----- \t----- \t----- \t-----");
27777 bcm_bprintf(strbuf, "%-8d\t", dhd->pktcnt_qac_histo[i][j]);
27780 bcm_bprintf(strbuf, "\n\nTx Q-CPU scheduling histogram:\n");
27787 bcm_bprintf(strbuf, "%-8d\t", dhd->cpu_qstats[i][j]);
27806 * bytes - this may be expanded later.
27818 loff_t pos = -1;
27825 pos = fp->f_pos + off;
27828 pos = file_len - off;
27832 return -EINVAL;
27834 fp->f_pos = pos;
27865 /* If position out of data length - read nothing */
27869 /* If buffer end is past structure lenght - truncate it */
27871 count = (size_t)((loff_t)iovar_data_len - *position);
27875 /* Read/modify/write if not whole-buffer-operation */
27877 err = dhd_bus_iovar_op(&(dhd->pub), iovar,
27881 return -EPERM;
27886 return -EPERM;
27890 * assert, arg/arglen is copied to params/plen - and even used
27893 err = dhd_bus_iovar_op(&(dhd->pub), iovar, NULL, 0,
27897 err = dhd_bus_iovar_op(&(dhd->pub), iovar, (char *)read_params, (uint)read_plen,
27901 return -EPERM;
27906 return -EPERM;
27998 if ((count > sizeof(uint32)) || (count & (count - 1))) {
27999 return -EINVAL;
28006 return -EPERM;
28010 * assert, arg/arglen is copied to params/plen - and even used
28013 err = dhd_bus_iovar_op(&(dhd->pub), iovar, NULL, 0, (char *)buf, sizeof(*buf) * 3,
28021 err = dhd_bus_iovar_op(&(dhd->pub), iovar, (char *)buf, sizeof(*buf) * 2,
28025 return -EPERM;
28030 return -EPERM;
28090 /* If GDB Proxy procfs files set not yet created for given dhd instance - creates it */
28094 char dir_name[sizeof(dhd->gdb_proxy_fs_root_name)] = "dhd_gdb_proxy_";
28106 if (!dev_name || !*dev_name || dhd->gdb_proxy_fs_root) {
28110 dir_name[sizeof(dir_name) - 1] = 0;
28117 S_IRUGO | (fileinfos[i].fops->write ? S_IWUGO : 0), root_dentry,
28123 dhd->gdb_proxy_fs_root = root_dentry;
28124 memcpy_s(dhd->gdb_proxy_fs_root_name, sizeof(dhd->gdb_proxy_fs_root_name),
28125 dir_name, sizeof(dhd->gdb_proxy_fs_root_name));
28133 /* If GDB Proxy procfs files set created for given dhd instance - removes it */
28137 if (dhd->gdb_proxy_fs_root) {
28138 remove_proc_subtree(dhd->gdb_proxy_fs_root_name, NULL);
28139 dhd->gdb_proxy_fs_root = NULL;
28140 bzero(dhd->gdb_proxy_fs_root_name, sizeof(dhd->gdb_proxy_fs_root_name));
28151 uint32 irq = (uint32)-1;
28155 dhdp->smmu_fault_occurred = TRUE;
28157 dhdp->axi_error = TRUE;
28158 dhdp->axi_err_dump->axid = axid;
28159 dhdp->axi_err_dump->fault_address = fault_addr;
28163 dhdpcie_get_pcieirq(dhdp->bus, &irq);
28164 if (irq != (uint32)-1) {
28190 dhd_info_t *dhd = dhdp->info;
28196 return memcpy_s(arg, len, &dhd->config[0], sizeof(dhd->config));
28203 dhd_info_t *dhd = dhdp->info;
28218 temp = htonl(config->src_ip);
28221 temp = htonl(config->dst_ip);
28225 temp = (hton16(config->dst_port) << 16) | hton16(config->src_port);
28228 temp = config->proto;
28237 if (config->pkt_offset == PKTTS_OFFSET_INVALID) {
28244 if (dhd->config[idx].chksum == 0) {
28255 if (config->pkt_offset == PKTTS_OFFSET_INVALID) {
28257 memset(&dhd->config[idx], 0, sizeof(dhd->config[idx]));
28259 ret = memcpy_s(&dhd->config[idx], sizeof(dhd->config[idx]),
28262 dhd->config[idx].chksum = checksum;
28270 * dhd_match_pktts_flow - this api returns matching pktts config against checksum
28280 dhd_info_t *dhd = dhdp->info;
28285 if (dhd->config[i].chksum) {
28289 if (checksum && (dhd->config[i].chksum == checksum)) {
28290 flow = &dhd->config[i];
28302 if (dhd->config[i].chksum) {
28313 dhd_info_t *dhd = dhdp->info;
28315 return dhd->latency;
28321 dhd_info_t *dhd = dhdp->info;
28353 dhd->latency = val;
28372 dhdp = &dhd->pub;
28374 if (!(dhd->dhd_state & DHD_ATTACH_STATE_DONE)) {
28381 if (dhdp->dongle_trap_due_to_bt) {
28384 dhdp->pom_toggle_reg_on(WLAN_FUNC_ID, BY_WLAN_DUE_TO_BT);
28389 ret = dhd_bus_perform_flr_with_quiesce(dhdp, dhdp->bus, FALSE);
28394 dhdp->pom_toggle_reg_on(WLAN_FUNC_ID, BY_WLAN_DUE_TO_WLAN);
28402 if (dhdp->enable_erpom) {
28403 dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq, NULL,
28441 dhdp->pktlog_debug = TRUE;
28468 if (dhd_pktlog_dump_write_file(&dhd->pub)) {
28477 dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq,
28488 /* Ignore compiler warnings due to -Werror=cast-qual */
28494 dhdp = &ifp->info->pub;
28496 if ((dhdp->op_mode & DHD_FLAG_P2P_GO_MODE)||
28497 (dhdp->op_mode & DHD_FLAG_HOSTAP_MODE)) {
28499 wl_cfg80211_del_all_sta(ifp->net, WLAN_REASON_UNSPECIFIED);
28500 } else if ((dhdp->op_mode & DHD_FLAG_P2P_GC_MODE)||
28501 (dhdp->op_mode & DHD_FLAG_STA_MODE)) {
28503 wl_cfg80211_disassoc(ifp->net, WLAN_REASON_UNSPECIFIED);
28505 ifp->disconnect_tsync_flood = TRUE;
28511 ifp->tsync_rcvd = 0;
28512 ifp->tsyncack_txed = 0;
28513 ifp->last_sync = DIV_U64_BY_U32(OSL_LOCALTIME_NS(), NSEC_PER_SEC);
28522 ifp->tsync_rcvd = 0;
28523 ifp->tsyncack_txed = 0;
28524 ifp->last_sync = DIV_U64_BY_U32(OSL_LOCALTIME_NS(), NSEC_PER_SEC);
28525 ifp->tsync_per_sec = 0;
28526 ifp->disconnect_tsync_flood = FALSE;
28535 /* Ignore compiler warnings due to -Werror=cast-qual */
28541 if (ifp && ifp->net &&
28542 (OSL_ATOMIC_READ(ifp->info->pub->osh, &ifp->m4state) == M4_TXFAILED)) {
28544 ifp->net->name));
28545 wl_cfg80211_disassoc(ifp->net, WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT);
28552 dhd_info_t *dhd = (dhd_info_t *)(dhdp->info);
28561 eh = (struct ether_header *)PKTDATA(dhdp->osh, txp);
28562 type = ntoh16(eh->ether_type);
28566 ifp = dhd->iflist[ifidx];
28567 if (!ifp || !ifp->net) {
28574 OSL_ATOMIC_SET(dhdp->osh, &ifp->m4state, M4_TXFAILED);
28575 schedule_delayed_work(&ifp->m4state_work,
28593 dhdinfo = (dhd_info_t *)(dhdp->info);
28599 ifp = dhdinfo->iflist[ifidx];
28601 cancel_delayed_work_sync(&ifp->m4state_work);
28619 dhdp = (dhd_pub_t *)cfg->pub;
28621 if (!dhdp || !cfg->ap_sta_info) {
28622 WL_ERR(("dhdp=%p ap_sta_info=%p\n", dhdp, cfg->ap_sta_info));
28626 p_wq_data = (ap_sta_wq_data_t *)MALLOCZ(dhdp->osh, sizeof(ap_sta_wq_data_t));
28628 DHD_ERROR(("%s(): could not allocate memory for - "
28633 mutex_lock(&cfg->ap_sta_info->wq_data_sync);
28635 memcpy(&p_wq_data->e, e, sizeof(wl_event_msg_t));
28636 p_wq_data->dhdp = dhdp;
28637 p_wq_data->bcm_cfg = cfg;
28638 p_wq_data->ndev = (struct net_device *)ndev;
28640 mutex_unlock(&cfg->ap_sta_info->wq_data_sync);
28642 dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq,
28658 local_time = (u32)(curtime.tv_sec -
28662 tm.tm_year - 100, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
28683 #define DHD_RING_ERR_INTERNAL(fmt, ...) DHD_ERROR(("EWPF-" fmt, ##__VA_ARGS__))
28684 #define DHD_RING_TRACE_INTERNAL(fmt, ...) DHD_INFO(("EWPF-" fmt, ##__VA_ARGS__))
28700 uint32 write_idx; /* next write index, -1 : not started */
28701 uint32 read_idx; /* next read index, -1 : not start */
28714 uint32 idx; /* -1 : not started */
28764 ret_ring->type = type;
28765 ret_ring->ring_sync = (void *)DHD_RING_SYNC_LOCK_INIT(dhdp->osh);
28766 ret_ring->magic = DHD_RING_MAGIC;
28769 ret_ring->fixed.read_idx = DHD_RING_IDX_INVALID;
28770 ret_ring->fixed.write_idx = DHD_RING_IDX_INVALID;
28771 ret_ring->fixed.lock_idx = DHD_RING_IDX_INVALID;
28772 ret_ring->fixed.elem = buf + sizeof(dhd_ring_info_t);
28773 ret_ring->fixed.elem_size = elem_size;
28774 ret_ring->fixed.elem_cnt = elem_cnt;
28776 ret_ring->single.idx = DHD_RING_IDX_INVALID;
28777 atomic_set(&ret_ring->single.ring_locked, 0);
28778 ret_ring->single.ring_overwrited = 0;
28779 ret_ring->single.rsvd = 0;
28780 ret_ring->single.elem = buf + sizeof(dhd_ring_info_t);
28781 ret_ring->single.elem_size = elem_size;
28782 ret_ring->single.elem_cnt = elem_cnt;
28796 if (ring->magic != DHD_RING_MAGIC) {
28800 if (ring->type != DHD_RING_TYPE_FIXED &&
28801 ring->type != DHD_RING_TYPE_SINGLE_IDX) {
28805 DHD_RING_SYNC_LOCK_DEINIT(dhdp->osh, ring->ring_sync);
28806 ring->ring_sync = NULL;
28807 if (ring->type == DHD_RING_TYPE_FIXED) {
28808 dhd_fixed_ring_info_t *fixed = &ring->fixed;
28809 memset(fixed->elem, 0, fixed->elem_size * fixed->elem_cnt);
28810 fixed->elem_size = fixed->elem_cnt = 0;
28812 dhd_singleidx_ring_info_t *single = &ring->single;
28813 memset(single->elem, 0, single->elem_size * single->elem_cnt);
28814 single->elem_size = single->elem_cnt = 0;
28816 ring->type = 0;
28817 ring->magic = 0;
28830 elem_size = fixed->elem_size;
28831 elem_cnt = fixed->elem_cnt;
28832 elem = fixed->elem;
28835 elem_size = single->elem_size;
28836 elem_cnt = single->elem_cnt;
28837 elem = single->elem;
28844 DHD_RING_ERR(("INVALID POINTER %s:%p, ring->elem:%p\n", sig, ptr, elem));
28847 diff = (uint32)((uint8 *)ptr - (uint8 *)elem);
28849 DHD_RING_ERR(("INVALID POINTER %s:%p, ring->elem:%p\n", sig, ptr, elem));
28868 return (ring->elem_cnt + end - start) % ring->elem_cnt + 1;
28874 return __dhd_fixed_ring_get_count(ring, ring->read_idx, ring->write_idx);
28880 if (ring->read_idx == DHD_RING_IDX_INVALID) {
28883 return (uint8 *)ring->elem + (ring->elem_size * ring->read_idx);
28891 if (ring->read_idx == DHD_RING_IDX_INVALID) {
28896 next_idx = (ring->read_idx + 1) % ring->elem_cnt;
28897 if (ring->read_idx == ring->write_idx) {
28899 ring->read_idx = ring->write_idx = DHD_RING_IDX_INVALID;
28903 ring->read_idx = next_idx;
28910 if (ring->read_idx == DHD_RING_IDX_INVALID) {
28913 return (uint8 *)ring->elem + (ring->elem_size * ring->write_idx);
28921 if (ring->read_idx == DHD_RING_IDX_INVALID) {
28922 ring->read_idx = ring->write_idx = 0;
28923 return (uint8 *)ring->elem;
28927 tmp_idx = (ring->write_idx + 1) % ring->elem_cnt;
28928 if (ring->lock_idx == tmp_idx) {
28932 ring->write_idx = tmp_idx;
28933 if (ring->write_idx == ring->read_idx) {
28935 ring->read_idx = (ring->read_idx + 1) % ring->elem_cnt;
28938 return (uint8 *)ring->elem + (ring->elem_size * ring->write_idx);
28946 if (ring->read_idx == DHD_RING_IDX_INVALID) {
28952 if (cur_idx >= ring->elem_cnt) {
28956 if (cur_idx == ring->write_idx) {
28961 cur_idx = (cur_idx + 1) % ring->elem_cnt;
28962 return (uint8 *)ring->elem + ring->elem_size * cur_idx;
28970 if (ring->read_idx == DHD_RING_IDX_INVALID) {
28975 if (cur_idx >= ring->elem_cnt) {
28978 if (cur_idx == ring->read_idx) {
28983 cur_idx = (cur_idx + ring->elem_cnt - 1) % ring->elem_cnt;
28984 return (uint8 *)ring->elem + ring->elem_size * cur_idx;
28995 if (ring->read_idx == DHD_RING_IDX_INVALID) {
29002 if (first_idx >= ring->elem_cnt) {
29006 first_idx = ring->read_idx;
29011 if (last_idx >= ring->elem_cnt) {
29015 last_idx = ring->write_idx;
29018 ring_filled_cnt = __dhd_fixed_ring_get_count(ring, ring->read_idx, ring->write_idx);
29019 tmp_cnt = __dhd_fixed_ring_get_count(ring, ring->read_idx, first_idx);
29022 ring->write_idx, ring->read_idx, first_idx));
29026 tmp_cnt = __dhd_fixed_ring_get_count(ring, ring->read_idx, last_idx);
29029 ring->write_idx, ring->read_idx, last_idx));
29033 ring->lock_idx = first_idx;
29034 ring->lock_count = __dhd_fixed_ring_get_count(ring, first_idx, last_idx);
29041 if (ring->read_idx == DHD_RING_IDX_INVALID) {
29046 ring->lock_idx = DHD_RING_IDX_INVALID;
29047 ring->lock_count = 0;
29053 if (ring->read_idx == DHD_RING_IDX_INVALID) {
29057 if (ring->lock_idx == DHD_RING_IDX_INVALID) {
29061 return (uint8 *)ring->elem + ring->elem_size * ring->lock_idx;
29068 if (ring->read_idx == DHD_RING_IDX_INVALID) {
29072 if (ring->lock_idx == DHD_RING_IDX_INVALID) {
29077 lock_last_idx = (ring->lock_idx + ring->lock_count - 1) % ring->elem_cnt;
29078 return (uint8 *)ring->elem + ring->elem_size * lock_last_idx;
29084 if (ring->read_idx == DHD_RING_IDX_INVALID) {
29088 if (ring->lock_idx == DHD_RING_IDX_INVALID) {
29092 return ring->lock_count;
29098 if (ring->read_idx == DHD_RING_IDX_INVALID) {
29102 if (ring->lock_idx == DHD_RING_IDX_INVALID) {
29107 ring->lock_count--;
29108 if (ring->lock_count <= 0) {
29109 ring->lock_idx = DHD_RING_IDX_INVALID;
29111 ring->lock_idx = (ring->lock_idx + 1) % ring->elem_cnt;
29119 ring->read_idx = idx;
29125 ring->write_idx = idx;
29131 return ring->read_idx;
29137 return ring->write_idx;
29146 if (ring->idx == DHD_RING_IDX_INVALID) {
29150 if (ring->ring_overwrited) {
29151 tmp_idx = (ring->idx + 1) % ring->elem_cnt;
29154 return (uint8 *)ring->elem + (ring->elem_size * tmp_idx);
29160 if (ring->idx == DHD_RING_IDX_INVALID) {
29164 return (uint8 *)ring->elem + (ring->elem_size * ring->idx);
29170 if (ring->idx == DHD_RING_IDX_INVALID) {
29171 ring->idx = 0;
29172 return (uint8 *)ring->elem;
29176 if (atomic_read(&ring->ring_locked)) {
29181 if (!ring->ring_overwrited && ring->idx == (ring->elem_cnt - 1)) {
29182 ring->ring_overwrited = 1;
29185 ring->idx = (ring->idx + 1) % ring->elem_cnt;
29187 return (uint8 *)ring->elem + (ring->elem_size * ring->idx);
29195 if (ring->idx == DHD_RING_IDX_INVALID) {
29201 if (cur_idx >= ring->elem_cnt) {
29205 if (cur_idx == ring->idx) {
29210 cur_idx = (cur_idx + 1) % ring->elem_cnt;
29212 return (uint8 *)ring->elem + ring->elem_size * cur_idx;
29220 if (ring->idx == DHD_RING_IDX_INVALID) {
29225 if (cur_idx >= ring->elem_cnt) {
29229 if (!ring->ring_overwrited && cur_idx == 0) {
29234 cur_idx = (cur_idx + ring->elem_cnt - 1) % ring->elem_cnt;
29235 if (ring->ring_overwrited && cur_idx == ring->idx) {
29240 return (uint8 *)ring->elem + ring->elem_size * cur_idx;
29246 if (!atomic_read(&ring->ring_locked)) {
29247 atomic_set(&ring->ring_locked, 1);
29254 if (atomic_read(&ring->ring_locked)) {
29255 atomic_set(&ring->ring_locked, 0);
29267 if (!ring || ring->magic != DHD_RING_MAGIC) {
29272 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29273 if (ring->type == DHD_RING_TYPE_FIXED) {
29274 ret = __dhd_fixed_ring_get_first(&ring->fixed);
29276 if (ring->type == DHD_RING_TYPE_SINGLE_IDX) {
29277 ret = __dhd_singleidx_ring_get_first(&ring->single);
29279 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29290 if (!ring || ring->magic != DHD_RING_MAGIC) {
29295 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29296 if (ring->type == DHD_RING_TYPE_FIXED) {
29297 __dhd_fixed_ring_free_first(&ring->fixed);
29299 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29308 if (!ring || ring->magic != DHD_RING_MAGIC) {
29313 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29314 if (ring->type == DHD_RING_TYPE_FIXED) {
29315 __dhd_fixed_ring_set_read_idx(&ring->fixed, read_idx);
29317 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29326 if (!ring || ring->magic != DHD_RING_MAGIC) {
29331 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29332 if (ring->type == DHD_RING_TYPE_FIXED) {
29333 __dhd_fixed_ring_set_write_idx(&ring->fixed, write_idx);
29335 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29345 if (!ring || ring->magic != DHD_RING_MAGIC) {
29350 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29351 if (ring->type == DHD_RING_TYPE_FIXED) {
29352 read_idx = __dhd_fixed_ring_get_read_idx(&ring->fixed);
29354 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29366 if (!ring || ring->magic != DHD_RING_MAGIC) {
29371 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29372 if (ring->type == DHD_RING_TYPE_FIXED) {
29373 write_idx = __dhd_fixed_ring_get_write_idx(&ring->fixed);
29375 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29388 if (!ring || ring->magic != DHD_RING_MAGIC) {
29393 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29394 if (ring->type == DHD_RING_TYPE_FIXED) {
29395 ret = __dhd_fixed_ring_get_last(&ring->fixed);
29397 if (ring->type == DHD_RING_TYPE_SINGLE_IDX) {
29398 ret = __dhd_singleidx_ring_get_last(&ring->single);
29400 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29415 if (!ring || ring->magic != DHD_RING_MAGIC) {
29420 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29421 if (ring->type == DHD_RING_TYPE_FIXED) {
29422 ret = __dhd_fixed_ring_get_empty(&ring->fixed);
29424 if (ring->type == DHD_RING_TYPE_SINGLE_IDX) {
29425 ret = __dhd_singleidx_ring_get_empty(&ring->single);
29427 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29438 if (!ring || ring->magic != DHD_RING_MAGIC) {
29443 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29444 if (ring->type == DHD_RING_TYPE_FIXED) {
29445 ret = __dhd_fixed_ring_get_next(&ring->fixed, cur, ring->type);
29447 if (ring->type == DHD_RING_TYPE_SINGLE_IDX) {
29448 ret = __dhd_singleidx_ring_get_next(&ring->single, cur, ring->type);
29450 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29461 if (!ring || ring->magic != DHD_RING_MAGIC) {
29466 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29467 if (ring->type == DHD_RING_TYPE_FIXED) {
29468 ret = __dhd_fixed_ring_get_prev(&ring->fixed, cur, ring->type);
29470 if (ring->type == DHD_RING_TYPE_SINGLE_IDX) {
29471 ret = __dhd_singleidx_ring_get_prev(&ring->single, cur, ring->type);
29473 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29484 if (!ring || ring->magic != DHD_RING_MAGIC) {
29489 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29490 if (ring->type == DHD_RING_TYPE_FIXED) {
29491 cnt = __dhd_fixed_ring_get_cur_size(&ring->fixed);
29493 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29504 if (!ring || ring->magic != DHD_RING_MAGIC) {
29509 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29510 if (ring->type == DHD_RING_TYPE_FIXED) {
29511 __dhd_fixed_ring_lock(&ring->fixed, first_ptr, last_ptr, ring->type);
29513 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29523 if (!ring || ring->magic != DHD_RING_MAGIC) {
29528 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29529 if (ring->type == DHD_RING_TYPE_FIXED) {
29530 __dhd_fixed_ring_lock_free(&ring->fixed);
29532 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29542 if (!ring || ring->magic != DHD_RING_MAGIC) {
29547 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29548 if (ring->type == DHD_RING_TYPE_FIXED) {
29549 ret = __dhd_fixed_ring_lock_get_first(&ring->fixed);
29551 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29562 if (!ring || ring->magic != DHD_RING_MAGIC) {
29567 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29568 if (ring->type == DHD_RING_TYPE_FIXED) {
29569 ret = __dhd_fixed_ring_lock_get_last(&ring->fixed);
29571 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29582 if (!ring || ring->magic != DHD_RING_MAGIC) {
29587 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29588 if (ring->type == DHD_RING_TYPE_FIXED) {
29589 ret = __dhd_fixed_ring_lock_get_count(&ring->fixed);
29591 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29602 if (!ring || ring->magic != DHD_RING_MAGIC) {
29607 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29608 if (ring->type == DHD_RING_TYPE_FIXED) {
29609 __dhd_fixed_ring_lock_free_first(&ring->fixed);
29611 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29620 if (!ring || ring->magic != DHD_RING_MAGIC) {
29625 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29626 if (ring->type == DHD_RING_TYPE_SINGLE_IDX) {
29627 __dhd_singleidx_ring_whole_lock(&ring->single);
29629 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29638 if (!ring || ring->magic != DHD_RING_MAGIC) {
29643 DHD_RING_SYNC_LOCK(ring->ring_sync, flags);
29644 if (ring->type == DHD_RING_TYPE_SINGLE_IDX) {
29645 __dhd_singleidx_ring_whole_unlock(&ring->single);
29647 DHD_RING_SYNC_UNLOCK(ring->ring_sync, flags);
29662 DHD_ERROR(("Failed to get kern-path delete file: %s error: %d\n", path, err));
29674 err = -EINVAL;
29701 int fm_idx = -1;
29707 if (strlen(fm_ptr->elems[i].type_name) == 0) {
29711 if (!(strncmp(fname, fm_ptr->elems[i].type_name, strlen(fname)))) {
29717 if (fm_idx == -1) {
29721 if (strlen(fm_ptr->elems[fm_idx].type_name) == 0) {
29722 strncpy(fm_ptr->elems[fm_idx].type_name, fname, DHD_DUMP_TYPE_NAME_SIZE);
29723 fm_ptr->elems[fm_idx].type_name[DHD_DUMP_TYPE_NAME_SIZE - 1] = '\0';
29724 fm_ptr->elems[fm_idx].file_idx = 0;
29731 * dhd_dump_file_manage_enqueue - enqueue dump file path
29742 if (!dhd || !dhd->dump_file_manage) {
29744 __FUNCTION__, dhd, (dhd ? dhd->dump_file_manage : NULL)));
29748 fm_ptr = dhd->dump_file_manage;
29758 elem = &fm_ptr->elems[fm_idx];
29759 fp_idx = elem->file_idx;
29761 __FUNCTION__, fm_idx, fp_idx, elem->file_path[fp_idx]));
29764 if (strlen(elem->file_path[fp_idx]) != 0) {
29765 if (dhd_file_delete(elem->file_path[fp_idx]) < 0) {
29767 __FUNCTION__, elem->file_path[fp_idx]));
29770 __FUNCTION__, elem->file_path[fp_idx]));
29775 strncpy(elem->file_path[fp_idx], dump_path, DHD_DUMP_FILE_PATH_SIZE);
29776 elem->file_path[fp_idx][DHD_DUMP_FILE_PATH_SIZE - 1] = '\0';
29779 elem->file_idx = (elem->file_idx + 1) % DHD_DUMP_FILE_COUNT_MAX;
29790 dhd = (dhd_info_t *)(pub->info);
29793 flags = osl_spin_lock(&dhd->hp2p_lock);
29804 dhd = (dhd_info_t *)(pub->info);
29807 osl_spin_unlock(&dhd->hp2p_lock, flags);
29823 dhdp = &dhd->pub;
29835 if (dhdp->axi_err_dump->etd_axi_error_v1.version != HND_EXT_TRAP_AXIERROR_VERSION_1) {
29837 __FUNCTION__, dhdp->axi_err_dump->etd_axi_error_v1.version));
29844 dhdp->collect_sssr = TRUE;
29847 dhd_schedule_memdump(dhdp, dhdp->soc_ram, dhdp->soc_ram_length);
29859 dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq,
29885 if (dhdp->tid_mode == SET_TID_OFF) {
29889 pktdata = (uint8 *)PKTDATA(dhdp->osh, pkt);
29898 prio = dhdp->target_tid;
29899 uid = dhdp->target_uid;
29906 sk = ((struct sk_buff*)(pkt))->sk;
29908 if ((dhdp->tid_mode == SET_TID_ALL_UDP) ||
29928 dhdp = &dhd->pub;
29929 if (dhdp->dhd_induce_error == DHD_INDUCE_BH_CBP_HANG) {
29941 dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq,
29958 dhd_info = (dhd_info_t *)dhd_pub->info;
29959 dhd_if = dhd_info->iflist[0];
29961 ASSERT(dhd_if->net);
29962 if (dhd_if && dhd_if->net) {
29963 dhd_stop(dhd_if->net);
29972 dhd_sock_qos_set_status(dhdp->info, on_off);
29997 RANDOM_BYTES(ea_addr->octet, ETHER_ADDR_LEN);
29999 ETHER_SET_UNICAST(ea_addr->octet);
30000 ETHER_SET_LOCALADDR(ea_addr->octet);
30002 __FUNCTION__, MAC2STRDBG(ea_addr->octet)));
30010 return (void *)&(dhdp->roam_evt);
30047 DHD_ERROR(("DHD Iface Info corresponding to %s not found\n", ndev->name));
30055 __FUNCTION__, ifp->idx));
30057 dhd_del_all_sta(dhd, ifp->idx);
30058 dhd_flow_rings_delete(dhd, ifp->idx);
30068 dhd_socram_dump(dhdp->bus);
30075 ret = dhd_deferred_schedule_work(dhdp->info->dhd_deferred_wq, (void *)dhdp,
30085 return (void *)&dhdinfo->pub;
30096 return (void *)dhdinfo->pub.conf;
30106 dhd_info_t *dhd = (dhd_info_t *)pub->info;
30113 return dhd->wd_timer_valid;
30127 if (dhd->iflist[i]->bssidx == dhd->iflist[ifidx]->bssidx) {
30128 pdev = dhd->pub.info->iflist[i]->net;
30129 WL_MSG(sdev->name, "found primary dev %s\n", pdev->name);
30134 WL_MSG(sdev->name, "can not find primary dev\n");
30138 pdev = dhd->iflist[ifidx]->net;
30142 if (pdev->priv_flags & IFF_BRIDGE_PORT) {
30147 const struct net_device_ops *ops = br_dev->netdev_ops;
30151 err = ops->ndo_add_slave(br_dev, sdev, NULL);
30153 err = ops->ndo_add_slave(br_dev, sdev);
30156 WL_MSG(sdev->name, "add to %s failed %d\n", br_dev->name, err);
30158 WL_MSG(sdev->name, "slave added to %s\n", br_dev->name);
30161 dev_change_flags(sdev, sdev->flags | IFF_UP, NULL);
30163 dev_change_flags(sdev, sdev->flags | IFF_UP);
30166 err = ops->ndo_del_slave(br_dev, pdev);
30168 WL_MSG(pdev->name, "del from %s failed %d\n", br_dev->name, err);
30170 WL_MSG(pdev->name, "slave deleted from %s\n", br_dev->name);
30175 WL_MSG(pdev->name, "not bridged\n");
30180 WL_MSG(pdev->name, "not bridged\n");