From 878adea0f7ce072bdc9afc64de4cc9f8547ec2a6 Mon Sep 17 00:00:00 2001 From: Jan Altensen Date: Tue, 14 Sep 2021 20:39:30 +0200 Subject: [PATCH] dhd: rename 100.10.315.x to 100.10.545.x * in include/epivers.h its clearly version 100.10.545.x and history shows it got updated Change-Id: Ie26b14f16d1caa92e5a65c8d69e3ce7f9f613e15 --- .../Kconfig | 0 .../Makefile | 0 .../aiutils.c | 0 .../bcm_app_utils.c | 0 .../bcmbloom.c | 0 .../bcmevent.c | 0 .../bcmsdh.c | 0 .../bcmsdh_linux.c | 0 .../bcmsdh_sdmmc.c | 0 .../bcmsdh_sdmmc_linux.c | 0 .../bcmsdspi_linux.c | 0 .../bcmspibrcm.c | 0 .../bcmstdlib_s.c | 0 .../bcmutils.c | 0 .../bcmwifi_channels.c | 0 .../bcmwifi_channels.h | 0 .../bcmwifi_rates.h | 0 .../bcmwifi_rspec.h | 0 .../bcmxtlv.c | 0 .../dbus.c | 0 .../dbus_usb.c | 0 .../dbus_usb_linux.c | 0 .../dhd.h | 0 .../dhd_bus.h | 0 .../dhd_buzzz.h | 0 .../dhd_ccode.c | 468 +- .../dhd_cdc.c | 0 .../dhd_cfg80211.c | 0 .../dhd_cfg80211.h | 0 .../dhd_common.c | 0 .../dhd_config.c | 8592 ++++++++--------- .../dhd_config.h | 0 .../dhd_csi.c | 440 +- .../dhd_csi.h | 154 +- .../dhd_custom_gpio.c | 0 .../dhd_custom_hikey.c | 0 .../dhd_custom_memprealloc.c | 0 .../dhd_dbg.h | 0 .../dhd_dbg_ring.c | 0 .../dhd_dbg_ring.h | 0 .../dhd_debug.c | 0 .../dhd_debug.h | 0 .../dhd_debug_linux.c | 0 .../dhd_flowring.c | 0 .../dhd_flowring.h | 0 .../dhd_gpio.c | 0 .../dhd_ip.c | 0 .../dhd_ip.h | 0 .../dhd_linux.c | 0 .../dhd_linux.h | 0 .../dhd_linux_exportfs.c | 0 .../dhd_linux_lb.c | 0 .../dhd_linux_pktdump.c | 0 .../dhd_linux_pktdump.h | 0 .../dhd_linux_platdev.c | 0 .../dhd_linux_priv.h | 0 .../dhd_linux_sched.c | 0 .../dhd_linux_wq.c | 0 .../dhd_linux_wq.h | 0 .../dhd_mschdbg.c | 0 .../dhd_mschdbg.h | 0 .../dhd_msgbuf.c | 0 .../dhd_pcie.c | 0 .../dhd_pcie.h | 0 .../dhd_pcie_linux.c | 0 .../dhd_pno.c | 0 .../dhd_pno.h | 0 .../dhd_proto.h | 0 .../dhd_rtt.c | 0 .../dhd_rtt.h | 0 .../dhd_sdio.c | 0 .../dhd_static_buf.c | 1170 +-- .../dhd_wlfc.c | 0 .../dhd_wlfc.h | 0 .../dngl_stats.h | 0 .../dngl_wlhdr.h | 0 .../frag.c | 0 .../frag.h | 0 .../hnd_pktpool.c | 0 .../hnd_pktq.c | 0 .../hndlhl.c | 0 .../hndmem.c | 0 .../hndpmu.c | 0 .../include/802.11.h | 0 .../include/802.11e.h | 0 .../include/802.11s.h | 0 .../include/802.1d.h | 0 .../include/802.3.h | 0 .../include/aidmp.h | 0 .../include/bcm_cfg.h | 0 .../include/bcm_mpool_pub.h | 0 .../include/bcm_ring.h | 0 .../include/bcmarp.h | 0 .../include/bcmbloom.h | 0 .../include/bcmcdc.h | 0 .../include/bcmdefs.h | 0 .../include/bcmdevs.h | 0 .../include/bcmdhcp.h | 0 .../include/bcmendian.h | 0 .../include/bcmeth.h | 0 .../include/bcmevent.h | 0 .../include/bcmicmp.h | 0 .../include/bcmiov.h | 0 .../include/bcmip.h | 0 .../include/bcmipv6.h | 0 .../include/bcmmsgbuf.h | 0 .../include/bcmnvram.h | 0 .../include/bcmpcie.h | 0 .../include/bcmpcispi.h | 0 .../include/bcmperf.h | 0 .../include/bcmsdbus.h | 0 .../include/bcmsdh.h | 0 .../include/bcmsdh_sdmmc.h | 0 .../include/bcmsdpcm.h | 0 .../include/bcmsdspi.h | 0 .../include/bcmsdstd.h | 0 .../include/bcmspi.h | 0 .../include/bcmspibrcm.h | 0 .../include/bcmsrom_fmt.h | 0 .../include/bcmsrom_tbl.h | 0 .../include/bcmstdlib_s.h | 0 .../include/bcmtcp.h | 0 .../include/bcmtlv.h | 0 .../include/bcmudp.h | 0 .../include/bcmutils.h | 0 .../include/brcm_nl80211.h | 0 .../include/dbus.h | 0 .../include/dhd_daemon.h | 0 .../include/dhdioctl.h | 0 .../include/dnglevent.h | 0 .../include/eapol.h | 0 .../include/epivers.h | 0 .../include/etd.h | 0 .../include/ethernet.h | 0 .../include/event_log.h | 0 .../include/event_log_payload.h | 0 .../include/event_log_set.h | 0 .../include/event_log_tag.h | 0 .../include/event_trace.h | 0 .../include/fils.h | 0 .../include/hnd_armtrap.h | 0 .../include/hnd_cons.h | 0 .../include/hnd_debug.h | 0 .../include/hnd_pktpool.h | 0 .../include/hnd_pktq.h | 0 .../include/hnd_trap.h | 0 .../include/hndchipc.h | 0 .../include/hndlhl.h | 0 .../include/hndmem.h | 0 .../include/hndoobr.h | 0 .../include/hndpmu.h | 0 .../include/hndsoc.h | 0 .../include/linux_osl.h | 0 .../include/linux_pkt.h | 0 .../include/linuxver.h | 0 .../include/lpflags.h | 0 .../include/mbo.h | 0 .../include/miniopt.h | 0 .../include/msf.h | 0 .../include/msgtrace.h | 0 .../include/nan.h | 0 .../include/osl.h | 0 .../include/osl_decl.h | 0 .../include/osl_ext.h | 0 .../include/p2p.h | 0 .../include/packed_section_end.h | 0 .../include/packed_section_start.h | 0 .../include/pcicfg.h | 0 .../include/pcie_core.h | 0 .../include/rte_ioctl.h | 0 .../include/sbchipc.h | 0 .../include/sbconfig.h | 0 .../include/sbgci.h | 0 .../include/sbhndarm.h | 0 .../include/sbhnddma.h | 0 .../include/sbpcmcia.h | 0 .../include/sbsdio.h | 0 .../include/sbsdpcmdev.h | 0 .../include/sbsocram.h | 0 .../include/sbsysmem.h | 0 .../include/sdio.h | 0 .../include/sdioh.h | 0 .../include/sdiovar.h | 0 .../include/sdspi.h | 0 .../include/siutils.h | 0 .../include/spid.h | 0 .../include/trxhdr.h | 0 .../include/typedefs.h | 0 .../include/usbrdl.h | 0 .../include/vlan.h | 0 .../include/wlfc_proto.h | 0 .../include/wlioctl.h | 0 .../include/wlioctl_defs.h | 0 .../include/wlioctl_utils.h | 0 .../include/wpa.h | 0 .../include/wps.h | 0 .../linux_osl.c | 0 .../linux_osl_priv.h | 0 .../linux_pkt.c | 0 .../otpdefs.h | 0 .../pcie_core.c | 0 .../sbutils.c | 0 .../siutils.c | 0 .../siutils_priv.h | 0 .../wl_android.c | 0 .../wl_android.h | 0 .../wl_android_ext.c | 0 .../wl_cfg80211.c | 0 .../wl_cfg80211.h | 0 .../wl_cfg_btcoex.c | 0 .../wl_cfgnan.c | 0 .../wl_cfgnan.h | 0 .../wl_cfgp2p.c | 0 .../wl_cfgp2p.h | 0 .../wl_cfgscan.c | 0 .../wl_cfgscan.h | 0 .../wl_cfgvendor.c | 0 .../wl_cfgvendor.h | 0 .../wl_dbg.h | 0 .../wl_escan.c | 0 .../wl_escan.h | 154 +- .../wl_event.c | 0 .../wl_iw.c | 0 .../wl_iw.h | 0 .../wl_linux_mon.c | 0 .../wl_roam.c | 0 .../wldev_common.c | 0 .../wldev_common.h | 0 228 files changed, 5489 insertions(+), 5489 deletions(-) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/Kconfig (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/Makefile (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/aiutils.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcm_app_utils.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmbloom.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmevent.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmsdh.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmsdh_linux.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmsdh_sdmmc.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmsdh_sdmmc_linux.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmsdspi_linux.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmspibrcm.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmstdlib_s.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmutils.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmwifi_channels.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmwifi_channels.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmwifi_rates.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmwifi_rspec.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/bcmxtlv.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dbus.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dbus_usb.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dbus_usb_linux.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_bus.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_buzzz.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_ccode.c (96%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_cdc.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_cfg80211.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_cfg80211.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_common.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_config.c (96%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_config.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_csi.c (96%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_csi.h (96%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_custom_gpio.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_custom_hikey.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_custom_memprealloc.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_dbg.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_dbg_ring.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_dbg_ring.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_debug.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_debug.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_debug_linux.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_flowring.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_flowring.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_gpio.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_ip.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_ip.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_linux.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_linux.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_linux_exportfs.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_linux_lb.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_linux_pktdump.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_linux_pktdump.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_linux_platdev.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_linux_priv.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_linux_sched.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_linux_wq.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_linux_wq.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_mschdbg.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_mschdbg.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_msgbuf.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_pcie.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_pcie.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_pcie_linux.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_pno.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_pno.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_proto.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_rtt.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_rtt.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_sdio.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_static_buf.c (96%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_wlfc.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dhd_wlfc.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dngl_stats.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/dngl_wlhdr.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/frag.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/frag.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/hnd_pktpool.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/hnd_pktq.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/hndlhl.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/hndmem.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/hndpmu.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/802.11.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/802.11e.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/802.11s.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/802.1d.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/802.3.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/aidmp.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcm_cfg.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcm_mpool_pub.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcm_ring.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmarp.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmbloom.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmcdc.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmdefs.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmdevs.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmdhcp.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmendian.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmeth.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmevent.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmicmp.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmiov.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmip.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmipv6.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmmsgbuf.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmnvram.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmpcie.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmpcispi.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmperf.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmsdbus.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmsdh.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmsdh_sdmmc.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmsdpcm.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmsdspi.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmsdstd.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmspi.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmspibrcm.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmsrom_fmt.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmsrom_tbl.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmstdlib_s.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmtcp.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmtlv.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmudp.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/bcmutils.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/brcm_nl80211.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/dbus.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/dhd_daemon.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/dhdioctl.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/dnglevent.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/eapol.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/epivers.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/etd.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/ethernet.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/event_log.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/event_log_payload.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/event_log_set.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/event_log_tag.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/event_trace.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/fils.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hnd_armtrap.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hnd_cons.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hnd_debug.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hnd_pktpool.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hnd_pktq.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hnd_trap.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hndchipc.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hndlhl.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hndmem.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hndoobr.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hndpmu.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/hndsoc.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/linux_osl.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/linux_pkt.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/linuxver.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/lpflags.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/mbo.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/miniopt.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/msf.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/msgtrace.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/nan.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/osl.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/osl_decl.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/osl_ext.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/p2p.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/packed_section_end.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/packed_section_start.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/pcicfg.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/pcie_core.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/rte_ioctl.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sbchipc.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sbconfig.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sbgci.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sbhndarm.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sbhnddma.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sbpcmcia.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sbsdio.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sbsdpcmdev.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sbsocram.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sbsysmem.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sdio.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sdioh.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sdiovar.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/sdspi.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/siutils.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/spid.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/trxhdr.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/typedefs.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/usbrdl.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/vlan.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/wlfc_proto.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/wlioctl.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/wlioctl_defs.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/wlioctl_utils.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/wpa.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/include/wps.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/linux_osl.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/linux_osl_priv.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/linux_pkt.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/otpdefs.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/pcie_core.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/sbutils.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/siutils.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/siutils_priv.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_android.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_android.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_android_ext.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_cfg80211.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_cfg80211.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_cfg_btcoex.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_cfgnan.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_cfgnan.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_cfgp2p.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_cfgp2p.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_cfgscan.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_cfgscan.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_cfgvendor.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_cfgvendor.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_dbg.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_escan.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_escan.h (96%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_event.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_iw.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_iw.h (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_linux_mon.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wl_roam.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wldev_common.c (100%) rename {bcmdhd.100.10.315.x => bcmdhd.100.10.545.x}/wldev_common.h (100%) diff --git a/bcmdhd.100.10.315.x/Kconfig b/bcmdhd.100.10.545.x/Kconfig similarity index 100% rename from bcmdhd.100.10.315.x/Kconfig rename to bcmdhd.100.10.545.x/Kconfig diff --git a/bcmdhd.100.10.315.x/Makefile b/bcmdhd.100.10.545.x/Makefile similarity index 100% rename from bcmdhd.100.10.315.x/Makefile rename to bcmdhd.100.10.545.x/Makefile diff --git a/bcmdhd.100.10.315.x/aiutils.c b/bcmdhd.100.10.545.x/aiutils.c similarity index 100% rename from bcmdhd.100.10.315.x/aiutils.c rename to bcmdhd.100.10.545.x/aiutils.c diff --git a/bcmdhd.100.10.315.x/bcm_app_utils.c b/bcmdhd.100.10.545.x/bcm_app_utils.c similarity index 100% rename from bcmdhd.100.10.315.x/bcm_app_utils.c rename to bcmdhd.100.10.545.x/bcm_app_utils.c diff --git a/bcmdhd.100.10.315.x/bcmbloom.c b/bcmdhd.100.10.545.x/bcmbloom.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmbloom.c rename to bcmdhd.100.10.545.x/bcmbloom.c diff --git a/bcmdhd.100.10.315.x/bcmevent.c b/bcmdhd.100.10.545.x/bcmevent.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmevent.c rename to bcmdhd.100.10.545.x/bcmevent.c diff --git a/bcmdhd.100.10.315.x/bcmsdh.c b/bcmdhd.100.10.545.x/bcmsdh.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmsdh.c rename to bcmdhd.100.10.545.x/bcmsdh.c diff --git a/bcmdhd.100.10.315.x/bcmsdh_linux.c b/bcmdhd.100.10.545.x/bcmsdh_linux.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmsdh_linux.c rename to bcmdhd.100.10.545.x/bcmsdh_linux.c diff --git a/bcmdhd.100.10.315.x/bcmsdh_sdmmc.c b/bcmdhd.100.10.545.x/bcmsdh_sdmmc.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmsdh_sdmmc.c rename to bcmdhd.100.10.545.x/bcmsdh_sdmmc.c diff --git a/bcmdhd.100.10.315.x/bcmsdh_sdmmc_linux.c b/bcmdhd.100.10.545.x/bcmsdh_sdmmc_linux.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmsdh_sdmmc_linux.c rename to bcmdhd.100.10.545.x/bcmsdh_sdmmc_linux.c diff --git a/bcmdhd.100.10.315.x/bcmsdspi_linux.c b/bcmdhd.100.10.545.x/bcmsdspi_linux.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmsdspi_linux.c rename to bcmdhd.100.10.545.x/bcmsdspi_linux.c diff --git a/bcmdhd.100.10.315.x/bcmspibrcm.c b/bcmdhd.100.10.545.x/bcmspibrcm.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmspibrcm.c rename to bcmdhd.100.10.545.x/bcmspibrcm.c diff --git a/bcmdhd.100.10.315.x/bcmstdlib_s.c b/bcmdhd.100.10.545.x/bcmstdlib_s.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmstdlib_s.c rename to bcmdhd.100.10.545.x/bcmstdlib_s.c diff --git a/bcmdhd.100.10.315.x/bcmutils.c b/bcmdhd.100.10.545.x/bcmutils.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmutils.c rename to bcmdhd.100.10.545.x/bcmutils.c diff --git a/bcmdhd.100.10.315.x/bcmwifi_channels.c b/bcmdhd.100.10.545.x/bcmwifi_channels.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmwifi_channels.c rename to bcmdhd.100.10.545.x/bcmwifi_channels.c diff --git a/bcmdhd.100.10.315.x/bcmwifi_channels.h b/bcmdhd.100.10.545.x/bcmwifi_channels.h similarity index 100% rename from bcmdhd.100.10.315.x/bcmwifi_channels.h rename to bcmdhd.100.10.545.x/bcmwifi_channels.h diff --git a/bcmdhd.100.10.315.x/bcmwifi_rates.h b/bcmdhd.100.10.545.x/bcmwifi_rates.h similarity index 100% rename from bcmdhd.100.10.315.x/bcmwifi_rates.h rename to bcmdhd.100.10.545.x/bcmwifi_rates.h diff --git a/bcmdhd.100.10.315.x/bcmwifi_rspec.h b/bcmdhd.100.10.545.x/bcmwifi_rspec.h similarity index 100% rename from bcmdhd.100.10.315.x/bcmwifi_rspec.h rename to bcmdhd.100.10.545.x/bcmwifi_rspec.h diff --git a/bcmdhd.100.10.315.x/bcmxtlv.c b/bcmdhd.100.10.545.x/bcmxtlv.c similarity index 100% rename from bcmdhd.100.10.315.x/bcmxtlv.c rename to bcmdhd.100.10.545.x/bcmxtlv.c diff --git a/bcmdhd.100.10.315.x/dbus.c b/bcmdhd.100.10.545.x/dbus.c similarity index 100% rename from bcmdhd.100.10.315.x/dbus.c rename to bcmdhd.100.10.545.x/dbus.c diff --git a/bcmdhd.100.10.315.x/dbus_usb.c b/bcmdhd.100.10.545.x/dbus_usb.c similarity index 100% rename from bcmdhd.100.10.315.x/dbus_usb.c rename to bcmdhd.100.10.545.x/dbus_usb.c diff --git a/bcmdhd.100.10.315.x/dbus_usb_linux.c b/bcmdhd.100.10.545.x/dbus_usb_linux.c similarity index 100% rename from bcmdhd.100.10.315.x/dbus_usb_linux.c rename to bcmdhd.100.10.545.x/dbus_usb_linux.c diff --git a/bcmdhd.100.10.315.x/dhd.h b/bcmdhd.100.10.545.x/dhd.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd.h rename to bcmdhd.100.10.545.x/dhd.h diff --git a/bcmdhd.100.10.315.x/dhd_bus.h b/bcmdhd.100.10.545.x/dhd_bus.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_bus.h rename to bcmdhd.100.10.545.x/dhd_bus.h diff --git a/bcmdhd.100.10.315.x/dhd_buzzz.h b/bcmdhd.100.10.545.x/dhd_buzzz.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_buzzz.h rename to bcmdhd.100.10.545.x/dhd_buzzz.h diff --git a/bcmdhd.100.10.315.x/dhd_ccode.c b/bcmdhd.100.10.545.x/dhd_ccode.c similarity index 96% rename from bcmdhd.100.10.315.x/dhd_ccode.c rename to bcmdhd.100.10.545.x/dhd_ccode.c index 763e92d..abf71cc 100644 --- a/bcmdhd.100.10.315.x/dhd_ccode.c +++ b/bcmdhd.100.10.545.x/dhd_ccode.c @@ -1,234 +1,234 @@ - -#ifdef CCODE_LIST -#ifdef CONFIG_COMPAT -#include -#endif /* COMFIG_COMPAT */ -#include -#include - -#ifdef BCMSDIO -#define CCODE_43438 -#define CCODE_43455C0 -#define CCODE_43456C5 -#endif -#if defined(BCMSDIO) || defined(BCMPCIE) -#define CCODE_4356A2 -#define CCODE_4359C0 -#endif -#ifdef BCMDBUS -#define CCODE_4358U -#endif - -#ifdef BCMSDIO -#ifdef CCODE_43438 -const char ccode_43438[] = "RU/13"; -#else -const char ccode_43438 = ""; -#endif - -#ifdef CCODE_43455C0 -const char ccode_43455c0[] = \ -"AE/6 AG/2 AI/1 AL/2 AS/12 AT/4 AU/6 AW/2 AZ/2 "\ -"BA/2 BD/1 BE/4 BG/4 BH/4 BM/12 BN/4 BR/2 BS/2 BY/3 "\ -"CA/2 CA/31 CH/4 CN/38 CO/17 CR/17 CY/4 CZ/4 "\ -"DE/3 DE/7 DK/4 "\ -"EC/21 EE/4 EG/13 ES/4 ET/2 "\ -"FI/4 FR/5 "\ -"GB/1 GB/6 GD/2 GF/2 GP/2 GR/4 GT/1 GU/30 "\ -"HK/2 HR/4 HU/4 "\ -"ID/1 IE/5 IL/14 IN/3 IS/4 IT/4 "\ -"JO/3 JP/45 JP/58 "\ -"KH/2 KR/45 KR/48 KR/49 KR/70 KR/71 KR/96 KW/5 KY/3 "\ -"LA/2 LB/5 LI/4 LK/1 LS/2 LT/4 LU/3 LV/4 "\ -"MA/2 MC/1 MD/2 ME/2 MK/2 MN/1 MQ/2 MR/2 MT/4 MU/2 MV/3 MW/1 MX/44 MY/3 "\ -"NI/2 NL/4 NO/4 NZ/4 "\ -"OM/4 "\ -"PA/17 PE/20 PH/5 PL/4 PR/38 PT/4 PY/2 "\ -"Q2/993 "\ -"RE/2 RO/4 RS/2 RU/13 "\ -"SE/4 SI/4 SK/4 SV/25 "\ -"TH/5 TN/1 TR/7 TT/3 TW/1 "\ -"UA/8 US/988 "\ -"VA/2 VE/3 VG/2 VN/4 "\ -"XZ/11 "\ -"YT/2 "\ -"ZA/6"; -#else -const char ccode_43455c0[] = ""; -#endif - -#ifdef CCODE_43456C5 -const char ccode_43456c5[] = \ -"AE/6 AG/2 AI/1 AL/2 AS/12 AT/4 AU/6 AW/2 AZ/2 "\ -"BA/2 BD/1 BE/4 BG/4 BH/4 BM/12 BN/4 BR/4 BS/2 BY/3 "\ -"CA/2 CH/4 CN/38 CO/17 CR/17 CY/4 CZ/4 "\ -"DE/7 DK/4 "\ -"EC/21 EE/4 EG/13 ES/4 ET/2 "\ -"FI/4 FR/5 "\ -"GB/6 GD/2 GF/2 GP/2 GR/4 GT/1 GU/30 "\ -"HK/2 HR/4 HU/4 "\ -"ID/1 IE/5 IL/14 IN/3 IS/4 IT/4 "\ -"JO/3 JP/58 "\ -"KH/2 KR/96 KW/5 KY/3 "\ -"LA/2 LB/5 LI/4 LK/1 LS/2 LT/4 LU/3 LV/4 "\ -"MA/2 MC/1 MD/2 ME/2 MK/2 MN/1 MQ/2 MR/2 MT/4 MU/2 MV/3 MW/1 MX/44 MY/3 "\ -"NI/2 NL/4 NO/4 NZ/4 "\ -"OM/4 "\ -"PA/17 PE/20 PH/5 PL/4 PR/38 PT/4 PY/2 "\ -"Q2/993 "\ -"RE/2 RO/4 RS/2 RU/13 "\ -"SE/4 SI/4 SK/4 SV/25 "\ -"TH/5 TN/1 TR/7 TT/3 TW/65 "\ -"UA/8 US/988 "\ -"VA/2 VE/3 VG/2 VN/4 "\ -"XZ/11 "\ -"YT/2 "\ -"ZA/6"; -#else -const char ccode_43456c5[] = ""; -#endif -#endif - -#ifdef CCODE_4356A2 -const char ccode_4356a2[] = \ -"AE/6 AG/2 AI/1 AL/2 AN/2 AR/21 AS/12 AT/4 AU/6 AW/2 AZ/2 "\ -"BA/2 BD/2 BE/4 BG/4 BH/4 BM/12 BN/4 BR/4 BS/2 BY/3 "\ -"CA/31 CH/4 CN/38 CO/17 CR/17 CY/4 CZ/4 "\ -"DE/7 DK/4 DZ/1 "\ -"EC/21 EE/4 ES/4 ET/2 "\ -"FI/4 FR/5 "\ -"GB/6 GD/2 GF/2 GP/2 GR/4 GT/1 GU/12 "\ -"HK/2 HR/4 HU/4 "\ -"ID/13 IE/5 IL/7 IN/28 IS/4 IT/4 "\ -"JO/3 JP/58 "\ -"KH/2 KR/57 KW/5 KY/3 "\ -"LA/2 LB/5 LI/4 LK/1 LS/2 LT/4 LU/3 LV/4 "\ -"MA/2 MC/1 MD/2 ME/2 MK/2 MN/1 MO/2 MR/2 MT/4 MQ/2 MU/2 MV/3 MW/1 MX/20 MY/16 "\ -"NI/2 NL/4 NO/4 NP/3 NZ/4 "\ -"OM/4 "\ -"PA/17 PE/20 PG/2 PH/5 PL/4 PR/20 PT/4 PY/2 "\ -"RE/2 RO/4 RS/2 RU/986 "\ -"SE/4 SG/4 SG/19 SI/4 SK/4 SN/2 SV/19 "\ -"TH/9 TN/1 TR/7 TT/3 TW/1 "\ -"UA/8 UG/2 US/1 UY/1 "\ -"VA/2 UA/16 VE/3 VG/2 VI/13 VN/4 "\ -"XZ/11 "\ -"YT/2 "\ -"ZM/2 "\ -"E0/32"; -#else -const char ccode_4356a2[] = ""; -#endif - -#ifdef CCODE_4359C0 -const char ccode_4359c0[] = \ -"AD/1 AE/6 AG/2 AI/1 AL/3 AS/12 AT/21 AU/6 AW/2 AZ/8 "\ -"BA/4 BD/1 BE/19 BG/18 BH/4 BM/12 BN/4 BR/2 BS/2 BY/3 "\ -"CN/38 CO/17 CR/17 CY/18 CZ/18 "\ -"DE/30 DK/19 "\ -"E0/32 EC/21 EE/18 EG/13 ES/21 ET/2 "\ -"FI/19 FR/21 "\ -"GB/996 GD/2 GE/1 GF/2 GP/2 GR/18 GT/1 GU/30 "\ -"HK/2 HR/18 HU/18 "\ -"ID/1 IE/21 IL/14 IN/3 IS/17 IT/20 "\ -"JO/3 JP/967 "\ -"KH/2 KR/70 KW/5 KY/3 "\ -"LA/2 LB/5 LI/17 LI/4 LK/1 LS/2 LT/18 LU/18 LV/18 "\ -"MA/2 MC/2 MD/3 ME/5 MK/4 MN/1 MQ/2 MR/2 MT/18 MU/2 MV/3 MW/1 MX/44 MY/3 "\ -"NI/2 NL/19 NO/18 NZ/4 "\ -"OM/4 "\ -"PA/17 PE/20 PH/5 PL/18 PR/38 PT/20 PY/2 "\ -"Q1/947 Q2/993 "\ -"RE/2 RO/18 RS/4 RU/986 "\ -"SE/19 SI/18 SK/18 SM/1 SV/25 "\ -"TH/5 TN/1 TR/18 TT/3 TW/1 "\ -"UA/16 US/988 "\ -"VA/3 VE/3 VG/2 VN/4 "\ -"XZ/11 "\ -"YT/2 "\ -"ZA/6"; -#else -const char ccode_4359c0[] = ""; -#endif - -#ifdef CCODE_4358U -const char ccode_4358u[] = \ -"BE/4 BR/4 CA/2 CH/4 CN/38 CY/4 DE/7 DK/4 ES/4 "\ -"FI/4 FR/5 GB/6 GR/4 HK/2 HU/4 IE/5 IL/7 IS/4 "\ -"IT/4 JP/72 KE/0 MY/3 NL/4 PT/4 SA/5 SE/4 SG/0 "\ -"SZ/0 TH/5 TR/7 TW/230 US/0 VN/4"; -#else -const char ccode_4358u[] = ""; -#endif - -typedef struct ccode_list_map_t { - uint chip; - uint chiprev; - const char *ccode_list; - const char *ccode_ww; -} ccode_list_map_t; - -extern const char ccode_43438[]; -extern const char ccode_43455c0[]; -extern const char ccode_43456c5[]; -extern const char ccode_4356a2[]; -extern const char ccode_4359c0[]; -extern const char ccode_4358u[]; - -const ccode_list_map_t ccode_list_map[] = { - /* ChipID Chiprev ccode */ -#ifdef BCMSDIO - {BCM43430_CHIP_ID, 0, ccode_43438, ""}, - {BCM43430_CHIP_ID, 1, ccode_43438, ""}, - {BCM4345_CHIP_ID, 6, ccode_43455c0, "XZ/11"}, - {BCM43454_CHIP_ID, 6, ccode_43455c0, "XZ/11"}, - {BCM4345_CHIP_ID, 9, ccode_43456c5, "XZ/11"}, - {BCM43454_CHIP_ID, 9, ccode_43456c5, "XZ/11"}, - {BCM4354_CHIP_ID, 2, ccode_4356a2, "XZ/11"}, - {BCM4356_CHIP_ID, 2, ccode_4356a2, "XZ/11"}, - {BCM4371_CHIP_ID, 2, ccode_4356a2, "XZ/11"}, - {BCM4359_CHIP_ID, 9, ccode_4359c0, "XZ/11"}, -#endif -#ifdef BCMPCIE - {BCM4354_CHIP_ID, 2, ccode_4356a2, "XZ/11"}, - {BCM4356_CHIP_ID, 2, ccode_4356a2, "XZ/11"}, - {BCM4359_CHIP_ID, 9, ccode_4359c0, "XZ/11"}, -#endif -#ifdef BCMDBUS - {BCM43569_CHIP_ID, 2, ccode_4358u, "XW/0"}, -#endif -}; - -int -dhd_ccode_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec) -{ - int bcmerror = -1, i; - uint chip = dhd->conf->chip, chiprev = dhd->conf->chiprev; - const char *ccode_list = NULL, *ccode_ww = NULL; - char *pch; - - for (i=0; ichip == chip && row->chiprev == chiprev) { - ccode_list = row->ccode_list; - ccode_ww = row->ccode_ww; - break; - } - } - - if (ccode_list) { - pch = strstr(ccode_list, cspec->ccode); - if (pch) { - cspec->rev = (int)simple_strtol(pch+strlen(cspec->ccode)+1, NULL, 0); - bcmerror = 0; - } - } - - if (bcmerror && ccode_ww && strlen(ccode_ww)>=4) { - memcpy(cspec->ccode, ccode_ww, 2); - cspec->rev = (int)simple_strtol(ccode_ww+3, NULL, 0); - } - - return bcmerror; -} -#endif + +#ifdef CCODE_LIST +#ifdef CONFIG_COMPAT +#include +#endif /* COMFIG_COMPAT */ +#include +#include + +#ifdef BCMSDIO +#define CCODE_43438 +#define CCODE_43455C0 +#define CCODE_43456C5 +#endif +#if defined(BCMSDIO) || defined(BCMPCIE) +#define CCODE_4356A2 +#define CCODE_4359C0 +#endif +#ifdef BCMDBUS +#define CCODE_4358U +#endif + +#ifdef BCMSDIO +#ifdef CCODE_43438 +const char ccode_43438[] = "RU/13"; +#else +const char ccode_43438 = ""; +#endif + +#ifdef CCODE_43455C0 +const char ccode_43455c0[] = \ +"AE/6 AG/2 AI/1 AL/2 AS/12 AT/4 AU/6 AW/2 AZ/2 "\ +"BA/2 BD/1 BE/4 BG/4 BH/4 BM/12 BN/4 BR/2 BS/2 BY/3 "\ +"CA/2 CA/31 CH/4 CN/38 CO/17 CR/17 CY/4 CZ/4 "\ +"DE/3 DE/7 DK/4 "\ +"EC/21 EE/4 EG/13 ES/4 ET/2 "\ +"FI/4 FR/5 "\ +"GB/1 GB/6 GD/2 GF/2 GP/2 GR/4 GT/1 GU/30 "\ +"HK/2 HR/4 HU/4 "\ +"ID/1 IE/5 IL/14 IN/3 IS/4 IT/4 "\ +"JO/3 JP/45 JP/58 "\ +"KH/2 KR/45 KR/48 KR/49 KR/70 KR/71 KR/96 KW/5 KY/3 "\ +"LA/2 LB/5 LI/4 LK/1 LS/2 LT/4 LU/3 LV/4 "\ +"MA/2 MC/1 MD/2 ME/2 MK/2 MN/1 MQ/2 MR/2 MT/4 MU/2 MV/3 MW/1 MX/44 MY/3 "\ +"NI/2 NL/4 NO/4 NZ/4 "\ +"OM/4 "\ +"PA/17 PE/20 PH/5 PL/4 PR/38 PT/4 PY/2 "\ +"Q2/993 "\ +"RE/2 RO/4 RS/2 RU/13 "\ +"SE/4 SI/4 SK/4 SV/25 "\ +"TH/5 TN/1 TR/7 TT/3 TW/1 "\ +"UA/8 US/988 "\ +"VA/2 VE/3 VG/2 VN/4 "\ +"XZ/11 "\ +"YT/2 "\ +"ZA/6"; +#else +const char ccode_43455c0[] = ""; +#endif + +#ifdef CCODE_43456C5 +const char ccode_43456c5[] = \ +"AE/6 AG/2 AI/1 AL/2 AS/12 AT/4 AU/6 AW/2 AZ/2 "\ +"BA/2 BD/1 BE/4 BG/4 BH/4 BM/12 BN/4 BR/4 BS/2 BY/3 "\ +"CA/2 CH/4 CN/38 CO/17 CR/17 CY/4 CZ/4 "\ +"DE/7 DK/4 "\ +"EC/21 EE/4 EG/13 ES/4 ET/2 "\ +"FI/4 FR/5 "\ +"GB/6 GD/2 GF/2 GP/2 GR/4 GT/1 GU/30 "\ +"HK/2 HR/4 HU/4 "\ +"ID/1 IE/5 IL/14 IN/3 IS/4 IT/4 "\ +"JO/3 JP/58 "\ +"KH/2 KR/96 KW/5 KY/3 "\ +"LA/2 LB/5 LI/4 LK/1 LS/2 LT/4 LU/3 LV/4 "\ +"MA/2 MC/1 MD/2 ME/2 MK/2 MN/1 MQ/2 MR/2 MT/4 MU/2 MV/3 MW/1 MX/44 MY/3 "\ +"NI/2 NL/4 NO/4 NZ/4 "\ +"OM/4 "\ +"PA/17 PE/20 PH/5 PL/4 PR/38 PT/4 PY/2 "\ +"Q2/993 "\ +"RE/2 RO/4 RS/2 RU/13 "\ +"SE/4 SI/4 SK/4 SV/25 "\ +"TH/5 TN/1 TR/7 TT/3 TW/65 "\ +"UA/8 US/988 "\ +"VA/2 VE/3 VG/2 VN/4 "\ +"XZ/11 "\ +"YT/2 "\ +"ZA/6"; +#else +const char ccode_43456c5[] = ""; +#endif +#endif + +#ifdef CCODE_4356A2 +const char ccode_4356a2[] = \ +"AE/6 AG/2 AI/1 AL/2 AN/2 AR/21 AS/12 AT/4 AU/6 AW/2 AZ/2 "\ +"BA/2 BD/2 BE/4 BG/4 BH/4 BM/12 BN/4 BR/4 BS/2 BY/3 "\ +"CA/31 CH/4 CN/38 CO/17 CR/17 CY/4 CZ/4 "\ +"DE/7 DK/4 DZ/1 "\ +"EC/21 EE/4 ES/4 ET/2 "\ +"FI/4 FR/5 "\ +"GB/6 GD/2 GF/2 GP/2 GR/4 GT/1 GU/12 "\ +"HK/2 HR/4 HU/4 "\ +"ID/13 IE/5 IL/7 IN/28 IS/4 IT/4 "\ +"JO/3 JP/58 "\ +"KH/2 KR/57 KW/5 KY/3 "\ +"LA/2 LB/5 LI/4 LK/1 LS/2 LT/4 LU/3 LV/4 "\ +"MA/2 MC/1 MD/2 ME/2 MK/2 MN/1 MO/2 MR/2 MT/4 MQ/2 MU/2 MV/3 MW/1 MX/20 MY/16 "\ +"NI/2 NL/4 NO/4 NP/3 NZ/4 "\ +"OM/4 "\ +"PA/17 PE/20 PG/2 PH/5 PL/4 PR/20 PT/4 PY/2 "\ +"RE/2 RO/4 RS/2 RU/986 "\ +"SE/4 SG/4 SG/19 SI/4 SK/4 SN/2 SV/19 "\ +"TH/9 TN/1 TR/7 TT/3 TW/1 "\ +"UA/8 UG/2 US/1 UY/1 "\ +"VA/2 UA/16 VE/3 VG/2 VI/13 VN/4 "\ +"XZ/11 "\ +"YT/2 "\ +"ZM/2 "\ +"E0/32"; +#else +const char ccode_4356a2[] = ""; +#endif + +#ifdef CCODE_4359C0 +const char ccode_4359c0[] = \ +"AD/1 AE/6 AG/2 AI/1 AL/3 AS/12 AT/21 AU/6 AW/2 AZ/8 "\ +"BA/4 BD/1 BE/19 BG/18 BH/4 BM/12 BN/4 BR/2 BS/2 BY/3 "\ +"CN/38 CO/17 CR/17 CY/18 CZ/18 "\ +"DE/30 DK/19 "\ +"E0/32 EC/21 EE/18 EG/13 ES/21 ET/2 "\ +"FI/19 FR/21 "\ +"GB/996 GD/2 GE/1 GF/2 GP/2 GR/18 GT/1 GU/30 "\ +"HK/2 HR/18 HU/18 "\ +"ID/1 IE/21 IL/14 IN/3 IS/17 IT/20 "\ +"JO/3 JP/967 "\ +"KH/2 KR/70 KW/5 KY/3 "\ +"LA/2 LB/5 LI/17 LI/4 LK/1 LS/2 LT/18 LU/18 LV/18 "\ +"MA/2 MC/2 MD/3 ME/5 MK/4 MN/1 MQ/2 MR/2 MT/18 MU/2 MV/3 MW/1 MX/44 MY/3 "\ +"NI/2 NL/19 NO/18 NZ/4 "\ +"OM/4 "\ +"PA/17 PE/20 PH/5 PL/18 PR/38 PT/20 PY/2 "\ +"Q1/947 Q2/993 "\ +"RE/2 RO/18 RS/4 RU/986 "\ +"SE/19 SI/18 SK/18 SM/1 SV/25 "\ +"TH/5 TN/1 TR/18 TT/3 TW/1 "\ +"UA/16 US/988 "\ +"VA/3 VE/3 VG/2 VN/4 "\ +"XZ/11 "\ +"YT/2 "\ +"ZA/6"; +#else +const char ccode_4359c0[] = ""; +#endif + +#ifdef CCODE_4358U +const char ccode_4358u[] = \ +"BE/4 BR/4 CA/2 CH/4 CN/38 CY/4 DE/7 DK/4 ES/4 "\ +"FI/4 FR/5 GB/6 GR/4 HK/2 HU/4 IE/5 IL/7 IS/4 "\ +"IT/4 JP/72 KE/0 MY/3 NL/4 PT/4 SA/5 SE/4 SG/0 "\ +"SZ/0 TH/5 TR/7 TW/230 US/0 VN/4"; +#else +const char ccode_4358u[] = ""; +#endif + +typedef struct ccode_list_map_t { + uint chip; + uint chiprev; + const char *ccode_list; + const char *ccode_ww; +} ccode_list_map_t; + +extern const char ccode_43438[]; +extern const char ccode_43455c0[]; +extern const char ccode_43456c5[]; +extern const char ccode_4356a2[]; +extern const char ccode_4359c0[]; +extern const char ccode_4358u[]; + +const ccode_list_map_t ccode_list_map[] = { + /* ChipID Chiprev ccode */ +#ifdef BCMSDIO + {BCM43430_CHIP_ID, 0, ccode_43438, ""}, + {BCM43430_CHIP_ID, 1, ccode_43438, ""}, + {BCM4345_CHIP_ID, 6, ccode_43455c0, "XZ/11"}, + {BCM43454_CHIP_ID, 6, ccode_43455c0, "XZ/11"}, + {BCM4345_CHIP_ID, 9, ccode_43456c5, "XZ/11"}, + {BCM43454_CHIP_ID, 9, ccode_43456c5, "XZ/11"}, + {BCM4354_CHIP_ID, 2, ccode_4356a2, "XZ/11"}, + {BCM4356_CHIP_ID, 2, ccode_4356a2, "XZ/11"}, + {BCM4371_CHIP_ID, 2, ccode_4356a2, "XZ/11"}, + {BCM4359_CHIP_ID, 9, ccode_4359c0, "XZ/11"}, +#endif +#ifdef BCMPCIE + {BCM4354_CHIP_ID, 2, ccode_4356a2, "XZ/11"}, + {BCM4356_CHIP_ID, 2, ccode_4356a2, "XZ/11"}, + {BCM4359_CHIP_ID, 9, ccode_4359c0, "XZ/11"}, +#endif +#ifdef BCMDBUS + {BCM43569_CHIP_ID, 2, ccode_4358u, "XW/0"}, +#endif +}; + +int +dhd_ccode_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec) +{ + int bcmerror = -1, i; + uint chip = dhd->conf->chip, chiprev = dhd->conf->chiprev; + const char *ccode_list = NULL, *ccode_ww = NULL; + char *pch; + + for (i=0; ichip == chip && row->chiprev == chiprev) { + ccode_list = row->ccode_list; + ccode_ww = row->ccode_ww; + break; + } + } + + if (ccode_list) { + pch = strstr(ccode_list, cspec->ccode); + if (pch) { + cspec->rev = (int)simple_strtol(pch+strlen(cspec->ccode)+1, NULL, 0); + bcmerror = 0; + } + } + + if (bcmerror && ccode_ww && strlen(ccode_ww)>=4) { + memcpy(cspec->ccode, ccode_ww, 2); + cspec->rev = (int)simple_strtol(ccode_ww+3, NULL, 0); + } + + return bcmerror; +} +#endif diff --git a/bcmdhd.100.10.315.x/dhd_cdc.c b/bcmdhd.100.10.545.x/dhd_cdc.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_cdc.c rename to bcmdhd.100.10.545.x/dhd_cdc.c diff --git a/bcmdhd.100.10.315.x/dhd_cfg80211.c b/bcmdhd.100.10.545.x/dhd_cfg80211.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_cfg80211.c rename to bcmdhd.100.10.545.x/dhd_cfg80211.c diff --git a/bcmdhd.100.10.315.x/dhd_cfg80211.h b/bcmdhd.100.10.545.x/dhd_cfg80211.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_cfg80211.h rename to bcmdhd.100.10.545.x/dhd_cfg80211.h diff --git a/bcmdhd.100.10.315.x/dhd_common.c b/bcmdhd.100.10.545.x/dhd_common.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_common.c rename to bcmdhd.100.10.545.x/dhd_common.c diff --git a/bcmdhd.100.10.315.x/dhd_config.c b/bcmdhd.100.10.545.x/dhd_config.c similarity index 96% rename from bcmdhd.100.10.315.x/dhd_config.c rename to bcmdhd.100.10.545.x/dhd_config.c index 9205ef8..73918ec 100644 --- a/bcmdhd.100.10.315.x/dhd_config.c +++ b/bcmdhd.100.10.545.x/dhd_config.c @@ -1,4296 +1,4296 @@ -extern void *get_ukdev(void); -extern int key_unify_read(void *ukdev, char *keyname, unsigned char *keydata, - unsigned int datalen, unsigned int *reallen); -extern int key_unify_size(void *ukdev, char *keyname, unsigned int *reallen); - -#include -#include - -#include -#include -#include -#include -#if defined(HW_OOB) || defined(FORCE_WOWLAN) -#include -#include -#include -#include -#endif -#ifdef WL_CFG80211 -#include -#endif - -#include -#include -#include - -static int getUnifyKey(char * inKeyName, unsigned char * outValueBuf, unsigned int inValueBufSize); -static int askey_dhd_conf_preinit(struct dhd_conf *conf); -static int askey_dhd_conf_read_unifykeys_wifi_disable_5g_band(dhd_pub_t *dhd); - -// kzalloc2getUnifyKey() will return a pointer to a memory allocated by kzalloc(). -// If the returned pointer is not NULL, remember to kfree the memory. -static char * kzalloc2getUnifyKey(char * inKeyName); -static int askey_dhd_conf_preinit_by_sn(struct dhd_conf *conf); - -/* message levels */ -#define CONFIG_ERROR_LEVEL (1 << 0) -#define CONFIG_TRACE_LEVEL (1 << 1) -#define CONFIG_MSG_LEVEL (1 << 0) - -uint config_msg_level = CONFIG_ERROR_LEVEL | CONFIG_MSG_LEVEL; -uint dump_msg_level = 0; - -#define CONFIG_MSG(x, args...) \ - do { \ - if (config_msg_level & CONFIG_MSG_LEVEL) { \ - printk(KERN_ERR "[dhd] %s : " x, __func__, ## args); \ - } \ - } while (0) -#define CONFIG_ERROR(x, args...) \ - do { \ - if (config_msg_level & CONFIG_ERROR_LEVEL) { \ - printk(KERN_ERR "[dhd] CONFIG-ERROR) %s : " x, __func__, ## args); \ - } \ - } while (0) -#define CONFIG_TRACE(x, args...) \ - do { \ - if (config_msg_level & CONFIG_TRACE_LEVEL) { \ - printk(KERN_INFO "[dhd] CONFIG-TRACE) %s : " x, __func__, ## args); \ - } \ - } while (0) - -#define MAXSZ_BUF 4096 -#define MAXSZ_CONFIG 8192 - -#ifndef WL_CFG80211 -#define htod32(i) i -#define htod16(i) i -#define dtoh32(i) i -#define dtoh16(i) i -#define htodchanspec(i) i -#define dtohchanspec(i) i -#endif - -#if defined(PROP_TXSTATUS) -#include -#endif /* PROP_TXSTATUS */ - -#define MAX_EVENT_BUF_NUM 16 -typedef struct eventmsg_buf { - u16 num; - struct { - u16 type; - bool set; - } event [MAX_EVENT_BUF_NUM]; -} eventmsg_buf_t; - -typedef struct cihp_name_map_t { - uint chip; - uint chiprev; - uint ag_type; - char *chip_name; - char *module_name; -} cihp_name_map_t; - -/* Map of WLC_E events to connection failure strings */ -#define DONT_CARE 9999 -const cihp_name_map_t chip_name_map[] = { - /* ChipID Chiprev AG ChipName ModuleName */ -#ifdef BCMSDIO - {BCM43362_CHIP_ID, 0, DONT_CARE, "bcm40181a0", ""}, - {BCM43362_CHIP_ID, 1, DONT_CARE, "bcm40181a2", ""}, - {BCM4330_CHIP_ID, 4, FW_TYPE_G, "bcm40183b2", ""}, - {BCM4330_CHIP_ID, 4, FW_TYPE_AG, "bcm40183b2_ag", ""}, - {BCM43430_CHIP_ID, 0, DONT_CARE, "bcm43438a0", "ap6212"}, - {BCM43430_CHIP_ID, 1, DONT_CARE, "bcm43438a1", "ap6212a"}, - {BCM43430_CHIP_ID, 2, DONT_CARE, "bcm43436b0", "ap6236"}, - {BCM43012_CHIP_ID, 1, FW_TYPE_G, "bcm43013b0", ""}, - {BCM43012_CHIP_ID, 1, FW_TYPE_AG, "bcm43013c0_ag", ""}, - {BCM43012_CHIP_ID, 2, DONT_CARE, "bcm43013c1_ag", ""}, - {BCM4334_CHIP_ID, 3, DONT_CARE, "bcm4334b1_ag", ""}, - {BCM43340_CHIP_ID, 2, DONT_CARE, "bcm43341b0_ag", ""}, - {BCM43341_CHIP_ID, 2, DONT_CARE, "bcm43341b0_ag", ""}, - {BCM4324_CHIP_ID, 5, DONT_CARE, "bcm43241b4_ag", ""}, - {BCM4335_CHIP_ID, 2, DONT_CARE, "bcm4339a0_ag", ""}, - {BCM4339_CHIP_ID, 1, DONT_CARE, "bcm4339a0_ag", "ap6335"}, - {BCM4345_CHIP_ID, 6, DONT_CARE, "bcm43455c0_ag", "ap6255"}, - {BCM43454_CHIP_ID, 6, DONT_CARE, "bcm43455c0_ag", ""}, - {BCM4345_CHIP_ID, 9, DONT_CARE, "bcm43456c5_ag", "ap6256"}, - {BCM43454_CHIP_ID, 9, DONT_CARE, "bcm43456c5_ag", ""}, - {BCM4354_CHIP_ID, 1, DONT_CARE, "bcm4354a1_ag", ""}, - {BCM4354_CHIP_ID, 2, DONT_CARE, "bcm4356a2_ag", "ap6356"}, - {BCM4356_CHIP_ID, 2, DONT_CARE, "bcm4356a2_ag", ""}, - {BCM4371_CHIP_ID, 2, DONT_CARE, "bcm4356a2_ag", ""}, - {BCM43569_CHIP_ID, 3, DONT_CARE, "bcm4358a3_ag", ""}, - {BCM4359_CHIP_ID, 5, DONT_CARE, "bcm4359b1_ag", ""}, - {BCM4359_CHIP_ID, 9, DONT_CARE, "bcm4359c0_ag", "ap6398s"}, - {BCM43751_CHIP_ID, 1, DONT_CARE, "bcm43751a1_ag", ""}, - {BCM43751_CHIP_ID, 2, DONT_CARE, "bcm43751a2_ag", ""}, - {BCM43752_CHIP_ID, 1, DONT_CARE, "bcm43752a1_ag", ""}, - {BCM43752_CHIP_ID, 2, DONT_CARE, "bcm43752a2_ag", ""}, -#endif -#ifdef BCMPCIE - {BCM4354_CHIP_ID, 2, DONT_CARE, "bcm4356a2_pcie_ag", ""}, - {BCM4356_CHIP_ID, 2, DONT_CARE, "bcm4356a2_pcie_ag", ""}, - {BCM4359_CHIP_ID, 9, DONT_CARE, "bcm4359c0_pcie_ag", ""}, - {BCM43751_CHIP_ID, 1, DONT_CARE, "bcm43751a1_pcie_ag", ""}, - {BCM43751_CHIP_ID, 2, DONT_CARE, "bcm43751a2_pcie_ag", ""}, - {BCM43752_CHIP_ID, 1, DONT_CARE, "bcm43752a1_pcie_ag", ""}, - {BCM43752_CHIP_ID, 2, DONT_CARE, "bcm43752a2_pcie_ag", ""}, -#endif -#ifdef BCMDBUS - {BCM43143_CHIP_ID, 2, DONT_CARE, "bcm43143b0", ""}, - {BCM43242_CHIP_ID, 1, DONT_CARE, "bcm43242a1_ag", ""}, - {BCM43569_CHIP_ID, 2, DONT_CARE, "bcm4358u_ag", "ap62x8"}, -#endif -}; - -void -dhd_conf_free_chip_nv_path_list(wl_chip_nv_path_list_ctrl_t *chip_nv_list) -{ - CONFIG_TRACE("called\n"); - - if (chip_nv_list->m_chip_nv_path_head) { - CONFIG_TRACE("Free %p\n", chip_nv_list->m_chip_nv_path_head); - kfree(chip_nv_list->m_chip_nv_path_head); - } - chip_nv_list->count = 0; -} - -#ifdef BCMSDIO -void -dhd_conf_free_mac_list(wl_mac_list_ctrl_t *mac_list) -{ - int i; - - CONFIG_TRACE("called\n"); - if (mac_list->m_mac_list_head) { - for (i=0; icount; i++) { - if (mac_list->m_mac_list_head[i].mac) { - CONFIG_TRACE("Free mac %p\n", mac_list->m_mac_list_head[i].mac); - kfree(mac_list->m_mac_list_head[i].mac); - } - } - CONFIG_TRACE("Free m_mac_list_head %p\n", mac_list->m_mac_list_head); - kfree(mac_list->m_mac_list_head); - } - mac_list->count = 0; -} - -#if defined(HW_OOB) || defined(FORCE_WOWLAN) -void -dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, struct si_pub *sih) -{ - uint32 gpiocontrol, addr; - - if (CHIPID(sih->chip) == BCM43362_CHIP_ID) { - CONFIG_MSG("Enable HW OOB for 43362\n"); - addr = SI_ENUM_BASE(sih) + OFFSETOF(chipcregs_t, gpiocontrol); - gpiocontrol = bcmsdh_reg_read(sdh, addr, 4); - gpiocontrol |= 0x2; - bcmsdh_reg_write(sdh, addr, 4, gpiocontrol); - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, 0x10005, 0xf, NULL); - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, 0x10006, 0x0, NULL); - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, 0x10007, 0x2, NULL); - } -} -#endif - -#define SBSDIO_CIS_SIZE_LIMIT 0x200 -void -dhd_conf_get_otp(dhd_pub_t *dhd, bcmsdh_info_t *sdh, si_t *sih) -{ - int i, err = -1; - uint8 *ptr = 0, *ptpl_code = NULL; - unsigned char tpl_code, tpl_link='\0'; - uint8 mac_header[3] = {0x80, 0x07, 0x19}; - uint8 *cis; - - if (!(cis = MALLOC(dhd->osh, SBSDIO_CIS_SIZE_LIMIT))) { - CONFIG_ERROR("cis malloc failed\n"); - } - bzero(cis, SBSDIO_CIS_SIZE_LIMIT); - - if ((err = bcmsdh_cis_read(sdh, 0, cis, SBSDIO_CIS_SIZE_LIMIT))) { - CONFIG_ERROR("cis read err %d\n", err); - MFREE(dhd->osh, cis, SBSDIO_CIS_SIZE_LIMIT); - return; - } - ptr = cis; - do { - /* 0xff means we're done */ - tpl_code = *ptr; - ptpl_code = ptr; - ptr++; - if (tpl_code == 0xff) - break; - - /* null entries have no link field or data */ - if (tpl_code == 0x00) - continue; - - tpl_link = *ptr; - ptr++; - /* a size of 0xff also means we're done */ - if (tpl_link == 0xff) - break; - if (config_msg_level & CONFIG_TRACE_LEVEL) { - prhex("TPL", ptpl_code, tpl_link+2); - } - - if (tpl_code == 0x80 && tpl_link == 0x07 && *ptr == 0x19) { - memcpy(&dhd->conf->otp_mac, ptr+1, 6); - } -#ifdef GET_OTP_MODULE_NAME - else if (tpl_code == 0x8e && *ptr == 0x41) { - int len = tpl_link - 1; - if (len <= sizeof(dhd->conf->module_name) - 1) { - strncpy(dhd->conf->module_name, ptr+1, len); - CONFIG_MSG("module_name=%s\n", dhd->conf->module_name); - } else { - CONFIG_ERROR("len is too long %d >= %d\n", - len, (int)sizeof(dhd->conf->module_name) - 1); - } - } -#endif - - ptr += tpl_link; - } while (1); - - if (!memcmp(ðer_null, &dhd->conf->otp_mac, ETHER_ADDR_LEN)) { - ptr = cis; - /* Special OTP */ - if (bcmsdh_reg_read(sdh, SI_ENUM_BASE(sih), 4) == 0x16044330) { - for (i=0; iconf->otp_mac, ptr+3, 6); - break; - } - ptr++; - } - } - } - - ASSERT(cis); - MFREE(dhd->osh, cis, SBSDIO_CIS_SIZE_LIMIT); -} - -void -dhd_conf_set_fw_name_by_mac(dhd_pub_t *dhd, char *fw_path) -{ - int i, j; - uint8 *mac = (uint8 *)&dhd->conf->otp_mac; - int fw_num=0, mac_num=0; - uint32 oui, nic; - wl_mac_list_t *mac_list; - wl_mac_range_t *mac_range; - int fw_type, fw_type_new; - char *name_ptr; - - mac_list = dhd->conf->fw_by_mac.m_mac_list_head; - fw_num = dhd->conf->fw_by_mac.count; - if (!mac_list || !fw_num) - return; - - oui = (mac[0] << 16) | (mac[1] << 8) | (mac[2]); - nic = (mac[3] << 16) | (mac[4] << 8) | (mac[5]); - - /* find out the last '/' */ - i = strlen(fw_path); - while (i > 0) { - if (fw_path[i] == '/') { - i++; - break; - } - i--; - } - name_ptr = &fw_path[i]; - - if (strstr(name_ptr, "_apsta")) - fw_type = FW_TYPE_APSTA; - else if (strstr(name_ptr, "_p2p")) - fw_type = FW_TYPE_P2P; - else if (strstr(name_ptr, "_mesh")) - fw_type = FW_TYPE_MESH; - else if (strstr(name_ptr, "_es")) - fw_type = FW_TYPE_ES; - else if (strstr(name_ptr, "_mfg")) - fw_type = FW_TYPE_MFG; - else - fw_type = FW_TYPE_STA; - - for (i=0; i= mac_range[j].nic_start && nic <= mac_range[j].nic_end) { - strcpy(name_ptr, mac_list[i].name); - CONFIG_MSG("matched oui=0x%06X, nic=0x%06X\n", oui, nic); - CONFIG_MSG("fw_path=%s\n", fw_path); - return; - } - } - } - } -} - -void -dhd_conf_set_nv_name_by_mac(dhd_pub_t *dhd, char *nv_path) -{ - int i, j; - uint8 *mac = (uint8 *)&dhd->conf->otp_mac; - int nv_num=0, mac_num=0; - uint32 oui, nic; - wl_mac_list_t *mac_list; - wl_mac_range_t *mac_range; - char *pnv_name; - - mac_list = dhd->conf->nv_by_mac.m_mac_list_head; - nv_num = dhd->conf->nv_by_mac.count; - if (!mac_list || !nv_num) - return; - - oui = (mac[0] << 16) | (mac[1] << 8) | (mac[2]); - nic = (mac[3] << 16) | (mac[4] << 8) | (mac[5]); - - /* find out the last '/' */ - i = strlen(nv_path); - while (i > 0) { - if (nv_path[i] == '/') break; - i--; - } - pnv_name = &nv_path[i+1]; - - for (i=0; i= mac_range[j].nic_start && nic <= mac_range[j].nic_end) { - strcpy(pnv_name, mac_list[i].name); - CONFIG_MSG("matched oui=0x%06X, nic=0x%06X\n", oui, nic); - CONFIG_MSG("nv_path=%s\n", nv_path); - return; - } - } - } - } -} -#endif - -void -dhd_conf_free_country_list(struct dhd_conf *conf) -{ - country_list_t *country = conf->country_head; - int count = 0; - - CONFIG_TRACE("called\n"); - while (country) { - CONFIG_TRACE("Free cspec %s\n", country->cspec.country_abbrev); - conf->country_head = country->next; - kfree(country); - country = conf->country_head; - count++; - } - CONFIG_TRACE("%d country released\n", count); -} - -void -dhd_conf_free_mchan_list(struct dhd_conf *conf) -{ - mchan_params_t *mchan = conf->mchan; - int count = 0; - - CONFIG_TRACE("called\n"); - while (mchan) { - CONFIG_TRACE("Free cspec %p\n", mchan); - conf->mchan = mchan->next; - kfree(mchan); - mchan = conf->mchan; - count++; - } - CONFIG_TRACE("%d mchan released\n", count); -} - -int -dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path) -{ - int fw_type, ag_type; - uint chip, chiprev; - int i; - char *name_ptr; - - chip = dhd->conf->chip; - chiprev = dhd->conf->chiprev; - - if (fw_path[0] == '\0') { -#ifdef CONFIG_BCMDHD_FW_PATH - bcm_strncpy_s(fw_path, MOD_PARAM_PATHLEN-1, CONFIG_BCMDHD_FW_PATH, MOD_PARAM_PATHLEN-1); - if (fw_path[0] == '\0') -#endif - { - CONFIG_MSG("firmware path is null\n"); - return 0; - } - } -#ifndef FW_PATH_AUTO_SELECT - return DONT_CARE; -#endif - - /* find out the last '/' */ - i = strlen(fw_path); - while (i > 0) { - if (fw_path[i] == '/') { - i++; - break; - } - i--; - } - name_ptr = &fw_path[i]; -#ifdef BAND_AG - ag_type = FW_TYPE_AG; -#else - ag_type = strstr(name_ptr, "_ag") ? FW_TYPE_AG : FW_TYPE_G; -#endif - if (strstr(name_ptr, "_apsta")) - fw_type = FW_TYPE_APSTA; - else if (strstr(name_ptr, "_p2p")) - fw_type = FW_TYPE_P2P; - else if (strstr(name_ptr, "_mesh")) - fw_type = FW_TYPE_MESH; - else if (strstr(name_ptr, "_es")) - fw_type = FW_TYPE_ES; - else if (strstr(name_ptr, "_mfg")) - fw_type = FW_TYPE_MFG; - else - fw_type = FW_TYPE_STA; - - for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { - const cihp_name_map_t* row = &chip_name_map[i]; - if (row->chip == chip && row->chiprev == chiprev && - (row->ag_type == ag_type || row->ag_type == DONT_CARE)) { - strcpy(name_ptr, "fw_"); - strcat(fw_path, row->chip_name); -#ifdef BCMUSBDEV_COMPOSITE - strcat(fw_path, "_cusb"); -#endif - if (fw_type == FW_TYPE_APSTA) - strcat(fw_path, "_apsta.bin"); - else if (fw_type == FW_TYPE_P2P) - strcat(fw_path, "_p2p.bin"); - else if (fw_type == FW_TYPE_MESH) - strcat(fw_path, "_mesh.bin"); - else if (fw_type == FW_TYPE_ES) - strcat(fw_path, "_es.bin"); - else if (fw_type == FW_TYPE_MFG) - strcat(fw_path, "_mfg.bin"); - else - strcat(fw_path, ".bin"); - } - } - - dhd->conf->fw_type = fw_type; - - CONFIG_TRACE("firmware_path=%s\n", fw_path); - return ag_type; -} - -void -dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path, int ag_type) -{ - uint chip, chiprev; - int i; - char *name_ptr; - - chip = dhd->conf->chip; - chiprev = dhd->conf->chiprev; - - if (clm_path[0] == '\0') { - CONFIG_MSG("clm path is null\n"); - return; - } - - /* find out the last '/' */ - i = strlen(clm_path); - while (i > 0) { - if (clm_path[i] == '/') { - i++; - break; - } - i--; - } - name_ptr = &clm_path[i]; - - for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { - const cihp_name_map_t* row = &chip_name_map[i]; - if (row->chip == chip && row->chiprev == chiprev && - (row->ag_type == ag_type || row->ag_type == DONT_CARE)) { - strcpy(name_ptr, "clm_"); - strcat(clm_path, row->chip_name); - strcat(clm_path, ".blob"); - } - } - - CONFIG_TRACE("clm_path=%s\n", clm_path); -} - -void -dhd_conf_set_nv_name_by_chip(dhd_pub_t *dhd, char *nv_path, int ag_type) -{ - uint chip, chiprev; - int i; - char *name_ptr; - - chip = dhd->conf->chip; - chiprev = dhd->conf->chiprev; - - if (nv_path[0] == '\0') { -#ifdef CONFIG_BCMDHD_NVRAM_PATH - bcm_strncpy_s(nv_path, MOD_PARAM_PATHLEN-1, CONFIG_BCMDHD_NVRAM_PATH, MOD_PARAM_PATHLEN-1); - if (nv_path[0] == '\0') -#endif - { - CONFIG_MSG("nvram path is null\n"); - return; - } - } - - /* find out the last '/' */ - i = strlen(nv_path); - while (i > 0) { - if (nv_path[i] == '/') { - i++; - break; - } - i--; - } - name_ptr = &nv_path[i]; - - for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { - const cihp_name_map_t* row = &chip_name_map[i]; - if (row->chip == chip && row->chiprev == chiprev && - (row->ag_type == ag_type || row->ag_type == DONT_CARE)) { -#ifdef GET_OTP_MODULE_NAME - if (strlen(dhd->conf->module_name)) { - strcpy(name_ptr, "nvram_"); - strcat(name_ptr, dhd->conf->module_name); - } else -#endif - if (strlen(row->module_name)){ - strcpy(name_ptr, "nvram_"); - strcat(name_ptr, row->module_name); - } else - continue; -#ifdef BCMUSBDEV_COMPOSITE - strcat(name_ptr, "_cusb"); -#endif - strcat(name_ptr, ".txt"); - } - } - - for (i=0; iconf->nv_by_chip.count; i++) { - if (chip==dhd->conf->nv_by_chip.m_chip_nv_path_head[i].chip && - chiprev==dhd->conf->nv_by_chip.m_chip_nv_path_head[i].chiprev) { - strcpy(name_ptr, dhd->conf->nv_by_chip.m_chip_nv_path_head[i].name); - break; - } - } - - CONFIG_TRACE("nvram_path=%s\n", nv_path); -} - -void -dhd_conf_copy_path(dhd_pub_t *dhd, char *dst_name, char *dst_path, char *src_path) -{ - int i; - - if (src_path[0] == '\0') { - CONFIG_MSG("src_path is null\n"); - return; - } else - strcpy(dst_path, src_path); - - /* find out the last '/' */ - i = strlen(dst_path); - while (i > 0) { - if (dst_path[i] == '/') { - i++; - break; - } - i--; - } - strcpy(&dst_path[i], dst_name); - - CONFIG_TRACE("dst_path=%s\n", dst_path); -} - -#ifdef CONFIG_PATH_AUTO_SELECT -void -dhd_conf_set_conf_name_by_chip(dhd_pub_t *dhd, char *conf_path) -{ - uint chip, chiprev; - int i; - char *name_ptr; - - chip = dhd->conf->chip; - chiprev = dhd->conf->chiprev; - - if (conf_path[0] == '\0') { - CONFIG_MSG("config path is null\n"); - return; - } - - /* find out the last '/' */ - i = strlen(conf_path); - while (i > 0) { - if (conf_path[i] == '/') { - i++; - break; - } - i--; - } - name_ptr = &conf_path[i]; - - for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { - const cihp_name_map_t* row = &chip_name_map[i]; - if (row->chip == chip && row->chiprev == chiprev) { - strcpy(name_ptr, "config_"); - strcat(conf_path, row->chip_name); - strcat(conf_path, ".txt"); - } - } - - CONFIG_TRACE("config_path=%s\n", conf_path); -} -#endif - -void -dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path) -{ - int ag_type; - - /* External conf takes precedence if specified */ - dhd_conf_preinit(dhd); - - if (dhd->conf_path[0] == '\0') { - dhd_conf_copy_path(dhd, "config.txt", dhd->conf_path, nv_path); - } - if (dhd->clm_path[0] == '\0') { - dhd_conf_copy_path(dhd, "clm.blob", dhd->clm_path, fw_path); - } -#ifdef CONFIG_PATH_AUTO_SELECT - dhd_conf_set_conf_name_by_chip(dhd, dhd->conf_path); -#endif - - dhd_conf_read_config(dhd, dhd->conf_path); - - ag_type = dhd_conf_set_fw_name_by_chip(dhd, fw_path); - dhd_conf_set_nv_name_by_chip(dhd, nv_path, ag_type); - dhd_conf_set_clm_name_by_chip(dhd, dhd->clm_path, ag_type); -#ifdef BCMSDIO - dhd_conf_set_fw_name_by_mac(dhd, fw_path); - dhd_conf_set_nv_name_by_mac(dhd, nv_path); -#endif - - CONFIG_MSG("Final fw_path=%s\n", fw_path); - CONFIG_MSG("Final nv_path=%s\n", nv_path); - CONFIG_MSG("Final clm_path=%s\n", dhd->clm_path); - CONFIG_MSG("Final conf_path=%s\n", dhd->conf_path); -} - -int -dhd_conf_set_intiovar(dhd_pub_t *dhd, uint cmd, char *name, int val, - int def, bool down) -{ - int ret = -1; - char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - - if (val >= def) { - if (down) { - if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, 0)) < 0) - CONFIG_ERROR("WLC_DOWN setting failed %d\n", ret); - } - if (cmd == WLC_SET_VAR) { - CONFIG_TRACE("set %s %d\n", name, val); - bcm_mkiovar(name, (char *)&val, sizeof(val), iovbuf, sizeof(iovbuf)); - if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) - CONFIG_ERROR("%s setting failed %d\n", name, ret); - } else { - CONFIG_TRACE("set %s %d %d\n", name, cmd, val); - if ((ret = dhd_wl_ioctl_cmd(dhd, cmd, &val, sizeof(val), TRUE, 0)) < 0) - CONFIG_ERROR("%s setting failed %d\n", name, ret); - } - } - - return ret; -} - -int -dhd_conf_set_bufiovar(dhd_pub_t *dhd, int ifidx, uint cmd, char *name, - char *buf, int len, bool down) -{ - char iovbuf[WLC_IOCTL_SMLEN]; - s32 iovar_len; - int ret = -1; - - if (down) { - if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, ifidx)) < 0) - CONFIG_ERROR("WLC_DOWN setting failed %d\n", ret); - } - - if (cmd == WLC_SET_VAR) { - iovar_len = bcm_mkiovar(name, buf, len, iovbuf, sizeof(iovbuf)); - if (iovar_len > 0) - ret = dhd_wl_ioctl_cmd(dhd, cmd, iovbuf, iovar_len, TRUE, ifidx); - else - ret = BCME_BUFTOOSHORT; - if (ret < 0) - CONFIG_ERROR("%s setting failed %d, len=%d\n", name, ret, len); - } else { - if ((ret = dhd_wl_ioctl_cmd(dhd, cmd, buf, len, TRUE, ifidx)) < 0) - CONFIG_ERROR("%s setting failed %d\n", name, ret); - } - - return ret; -} - -int -dhd_conf_get_iovar(dhd_pub_t *dhd, int ifidx, int cmd, char *name, - char *buf, int len) -{ - char iovbuf[WLC_IOCTL_SMLEN]; - int ret = -1; - - if (cmd == WLC_GET_VAR) { - if (bcm_mkiovar(name, NULL, 0, iovbuf, sizeof(iovbuf))) { - ret = dhd_wl_ioctl_cmd(dhd, cmd, iovbuf, sizeof(iovbuf), FALSE, ifidx); - if (!ret) { - memcpy(buf, iovbuf, len); - } else { - CONFIG_ERROR("get iovar %s failed %d\n", name, ret); - } - } else { - CONFIG_ERROR("mkiovar %s failed\n", name); - } - } else { - ret = dhd_wl_ioctl_cmd(dhd, cmd, buf, len, FALSE, 0); - if (ret < 0) - CONFIG_ERROR("get iovar %s failed %d\n", name, ret); - } - - return ret; -} - -static int -dhd_conf_rsdb_mode(dhd_pub_t *dhd, char *buf) -{ - wl_config_t rsdb_mode_cfg = {1, 0}; - - if (buf) { - rsdb_mode_cfg.config = (int)simple_strtol(buf, NULL, 0); - CONFIG_MSG("rsdb_mode %d\n", rsdb_mode_cfg.config); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "rsdb_mode", (char *)&rsdb_mode_cfg, - sizeof(rsdb_mode_cfg), TRUE); - } - - return 0; -} - -typedef struct sub_cmd_t { - char *name; - uint16 id; /* id for the dongle f/w switch/case */ - uint16 type; /* base type of argument IOVT_XXXX */ -} sub_cmd_t; - -/* wl he sub cmd list */ -static const sub_cmd_t he_cmd_list[] = { - {"enab", WL_HE_CMD_ENAB, IOVT_UINT8}, - {"features", WL_HE_CMD_FEATURES, IOVT_UINT32}, - {"bsscolor", WL_HE_CMD_BSSCOLOR, IOVT_UINT8}, - {"partialbsscolor", WL_HE_CMD_PARTIAL_BSSCOLOR, IOVT_UINT8}, - {"cap", WL_HE_CMD_CAP, IOVT_UINT8}, - {"staid", WL_HE_CMD_STAID, IOVT_UINT16}, - {"rtsdurthresh", WL_HE_CMD_RTSDURTHRESH, IOVT_UINT16}, - {"peduration", WL_HE_CMD_PEDURATION, IOVT_UINT8}, - {"testbed_mode", WL_HE_CMD_TESTBED_MODE, IOVT_UINT32}, - {"omi_ulmu_throttle", WL_HE_CMD_OMI_ULMU_THROTTLE, IOVT_UINT16}, - {"omi_dlmu_rr_mpf_map", WL_HE_CMD_OMI_DLMU_RSD_RCM_MPF_MAP, IOVT_UINT32}, - {"ulmu_disable_policy", WL_HE_CMD_ULMU_DISABLE_POLICY, IOVT_UINT8}, - {"sr_prohibit", WL_HE_CMD_SR_PROHIBIT, IOVT_UINT8}, -}; - -static uint -wl_he_iovt2len(uint iovt) -{ - switch (iovt) { - case IOVT_BOOL: - case IOVT_INT8: - case IOVT_UINT8: - return sizeof(uint8); - case IOVT_INT16: - case IOVT_UINT16: - return sizeof(uint16); - case IOVT_INT32: - case IOVT_UINT32: - return sizeof(uint32); - default: - /* ASSERT(0); */ - return 0; - } -} - -static int -dhd_conf_he_cmd(dhd_pub_t * dhd, char *buf) -{ - int ret = BCME_OK, i; - bcm_xtlv_t *pxtlv = NULL; - uint8 mybuf[128]; - uint16 he_id = -1, he_len = 0, mybuf_len = sizeof(mybuf); - uint32 he_val; - const sub_cmd_t *tpl = he_cmd_list; - char sub_cmd[32], he_val_str[10]; - - if (buf) { - sscanf(buf, "%s %s", sub_cmd, he_val_str); - } - - for (i=0; iname, sub_cmd)) { - he_id = tpl->id; - he_len = wl_he_iovt2len(tpl->type); - break; - } - } - if (he_id < 0) { - CONFIG_ERROR("No he id found for %s\n", sub_cmd); - return 0; - } - - pxtlv = (bcm_xtlv_t *)mybuf; - - if (strlen(he_val_str)) { - he_val = simple_strtol(he_val_str, NULL, 0); - ret = bcm_pack_xtlv_entry((uint8**)&pxtlv, &mybuf_len, he_id, - he_len, (uint8 *)&he_val, BCM_XTLV_OPTION_ALIGN32); - if (ret != BCME_OK) { - CONFIG_ERROR("failed to pack he enab, err: %s\n", bcmerrorstr(ret)); - return 0; - } - CONFIG_MSG("he %s 0x%x\n", sub_cmd, he_val); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "he", (char *)&mybuf, - sizeof(mybuf), TRUE); - } - - return 0; -} - -typedef int (tpl_parse_t)(dhd_pub_t *dhd, char *buf); - -typedef struct iovar_tpl_t { - int cmd; - char *name; - tpl_parse_t *parse; -} iovar_tpl_t; - -const iovar_tpl_t iovar_tpl_list[] = { - {WLC_SET_VAR, "rsdb_mode", dhd_conf_rsdb_mode}, - {WLC_SET_VAR, "he", dhd_conf_he_cmd}, -}; - -static int iovar_tpl_parse(const iovar_tpl_t *tpl, int tpl_count, - dhd_pub_t *dhd, int cmd, char *name, char *buf) -{ - int i, ret = 0; - - /* look for a matching code in the table */ - for (i = 0; i < tpl_count; i++, tpl++) { - if (tpl->cmd == cmd && !strcmp(tpl->name, name)) - break; - } - if (i < tpl_count && tpl->parse) { - ret = tpl->parse(dhd, buf); - } else { - ret = -1; - } - - return ret; -} - -bool -dhd_conf_set_wl_cmd(dhd_pub_t *dhd, char *data, bool down) -{ - int cmd, val, ret = 0, len; - char name[32], *pch, *pick_tmp, *pick_tmp2, *pdata = NULL; - - /* Process wl_preinit: - * wl_preinit=[cmd]=[val], [cmd]=[val] - * Ex: wl_preinit=86=0, mpc=0 - */ - - if (data == NULL) - return FALSE; - - len = strlen(data); - pdata = kmalloc(len+1, GFP_KERNEL); - if (pdata == NULL) { - CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", len+1); - goto exit; - } - memset(pdata, 0, len+1); - strcpy(pdata, data); - - pick_tmp = pdata; - while (pick_tmp && (pick_tmp2 = bcmstrtok(&pick_tmp, ",", 0)) != NULL) { - pch = bcmstrtok(&pick_tmp2, "=", 0); - if (!pch) - break; - if (*pch == ' ') { - pch++; - } - memset(name, 0 , sizeof (name)); - cmd = (int)simple_strtol(pch, NULL, 0); - if (cmd == 0) { - cmd = WLC_SET_VAR; - strcpy(name, pch); - } - pch = bcmstrtok(&pick_tmp2, ",", 0); - if (!pch) { - break; - } - ret = iovar_tpl_parse(iovar_tpl_list, ARRAY_SIZE(iovar_tpl_list), - dhd, cmd, name, pch); - if (ret) { - val = (int)simple_strtol(pch, NULL, 0); - dhd_conf_set_intiovar(dhd, cmd, name, val, -1, down); - } - } - -exit: - if (pdata) - kfree(pdata); - return true; -} - -int -dhd_conf_get_band(dhd_pub_t *dhd) -{ - int band = -1; - - if (dhd && dhd->conf) - band = dhd->conf->band; - else - CONFIG_ERROR("dhd or conf is NULL\n"); - - return band; -} - -int -dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec) -{ - int bcmerror = -1; - - memset(cspec, 0, sizeof(wl_country_t)); - bcm_mkiovar("country", NULL, 0, (char*)cspec, sizeof(wl_country_t)); - if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, cspec, sizeof(wl_country_t), - FALSE, 0)) < 0) - CONFIG_ERROR("country code getting failed %d\n", bcmerror); - - return bcmerror; -} - -int -dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec) -{ - int bcmerror = -1; - struct dhd_conf *conf = dhd->conf; - country_list_t *country = conf->country_head; - -#ifdef CCODE_LIST - bcmerror = dhd_ccode_map_country_list(dhd, cspec); -#endif - - while (country != NULL) { - if (!strncmp("**", country->cspec.country_abbrev, 2)) { - memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); - cspec->rev = country->cspec.rev; - bcmerror = 0; - break; - } else if (!strncmp(cspec->country_abbrev, - country->cspec.country_abbrev, 2)) { - memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); - cspec->rev = country->cspec.rev; - bcmerror = 0; - break; - } - country = country->next; - } - - if (!bcmerror) - CONFIG_MSG("%s/%d\n", cspec->ccode, cspec->rev); - - return bcmerror; -} - -int -dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec) -{ - int bcmerror = -1; - - memset(&dhd->dhd_cspec, 0, sizeof(wl_country_t)); - - CONFIG_MSG("set country %s, revision %d\n", cspec->ccode, cspec->rev); - bcmerror = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "country", (char *)cspec, - sizeof(wl_country_t), FALSE); - dhd_conf_get_country(dhd, cspec); - CONFIG_MSG("Country code: %s (%s/%d)\n", - cspec->country_abbrev, cspec->ccode, cspec->rev); - - return bcmerror; -} - -int -dhd_conf_fix_country(dhd_pub_t *dhd) -{ - int bcmerror = -1; - int band; - wl_uint32_list_t *list; - u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)]; - wl_country_t cspec; - - if (!(dhd && dhd->conf)) { - return bcmerror; - } - - memset(valid_chan_list, 0, sizeof(valid_chan_list)); - list = (wl_uint32_list_t *)(void *) valid_chan_list; - list->count = htod32(WL_NUMCHANNELS); - if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VALID_CHANNELS, valid_chan_list, - sizeof(valid_chan_list), FALSE, 0)) < 0) { - CONFIG_ERROR("get channels failed with %d\n", bcmerror); - } - - band = dhd_conf_get_band(dhd); - - if (bcmerror || ((band==WLC_BAND_AUTO || band==WLC_BAND_2G || band==-1) && - dtoh32(list->count)<11)) { - CONFIG_ERROR("bcmerror=%d, # of channels %d\n", - bcmerror, dtoh32(list->count)); - dhd_conf_map_country_list(dhd, &dhd->conf->cspec); - if ((bcmerror = dhd_conf_set_country(dhd, &dhd->conf->cspec)) < 0) { - strcpy(cspec.country_abbrev, "US"); - cspec.rev = 0; - strcpy(cspec.ccode, "US"); - dhd_conf_map_country_list(dhd, &cspec); - dhd_conf_set_country(dhd, &cspec); - } - } - - return bcmerror; -} - -bool -dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel) -{ - int i; - bool match = false; - - if (dhd && dhd->conf) { - if (dhd->conf->channels.count == 0) - return true; - for (i=0; iconf->channels.count; i++) { - if (channel == dhd->conf->channels.channel[i]) - match = true; - } - } else { - match = true; - CONFIG_ERROR("dhd or conf is NULL\n"); - } - - return match; -} - -int -dhd_conf_set_roam(dhd_pub_t *dhd) -{ - int bcmerror = -1; - struct dhd_conf *conf = dhd->conf; - - dhd_roam_disable = conf->roam_off; - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "roam_off", dhd->conf->roam_off, 0, FALSE); - - if (!conf->roam_off || !conf->roam_off_suspend) { - CONFIG_MSG("set roam_trigger %d\n", conf->roam_trigger[0]); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_TRIGGER, "WLC_SET_ROAM_TRIGGER", - (char *)conf->roam_trigger, sizeof(conf->roam_trigger), FALSE); - - CONFIG_MSG("set roam_scan_period %d\n", conf->roam_scan_period[0]); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_SCAN_PERIOD, "WLC_SET_ROAM_SCAN_PERIOD", - (char *)conf->roam_scan_period, sizeof(conf->roam_scan_period), FALSE); - - CONFIG_MSG("set roam_delta %d\n", conf->roam_delta[0]); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_DELTA, "WLC_SET_ROAM_DELTA", - (char *)conf->roam_delta, sizeof(conf->roam_delta), FALSE); - - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "fullroamperiod", - dhd->conf->fullroamperiod, 1, FALSE); - } - - return bcmerror; -} - -void -dhd_conf_add_to_eventbuffer(struct eventmsg_buf *ev, u16 event, bool set) -{ - if (!ev || (event > WLC_E_LAST)) - return; - - if (ev->num < MAX_EVENT_BUF_NUM) { - ev->event[ev->num].type = event; - ev->event[ev->num].set = set; - ev->num++; - } else { - CONFIG_ERROR("evenbuffer doesn't support > %u events. Update" - " the define MAX_EVENT_BUF_NUM \n", MAX_EVENT_BUF_NUM); - ASSERT(0); - } -} - -s32 -dhd_conf_apply_eventbuffer(dhd_pub_t *dhd, eventmsg_buf_t *ev) -{ - char eventmask[WL_EVENTING_MASK_LEN]; - int i, ret = 0; - - if (!ev || (!ev->num)) - return -EINVAL; - - /* Read event_msgs mask */ - ret = dhd_conf_get_iovar(dhd, 0, WLC_GET_VAR, "event_msgs", eventmask, - sizeof(eventmask)); - if (unlikely(ret)) { - CONFIG_ERROR("Get event_msgs error (%d)\n", ret); - goto exit; - } - - /* apply the set bits */ - for (i = 0; i < ev->num; i++) { - if (ev->event[i].set) - setbit(eventmask, ev->event[i].type); - else - clrbit(eventmask, ev->event[i].type); - } - - /* Write updated Event mask */ - ret = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "event_msgs", eventmask, - sizeof(eventmask), FALSE); - if (unlikely(ret)) { - CONFIG_ERROR("Set event_msgs error (%d)\n", ret); - } - -exit: - return ret; -} - -int -dhd_conf_enable_roam_offload(dhd_pub_t *dhd, int enable) -{ - int err; - eventmsg_buf_t ev_buf; - - if (dhd->conf->roam_off_suspend) - return 0; - - err = dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "roam_offload", enable, 0, FALSE); - if (err) - return err; - - bzero(&ev_buf, sizeof(eventmsg_buf_t)); - dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_PSK_SUP, !enable); - dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_ASSOC_REQ_IE, !enable); - dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_ASSOC_RESP_IE, !enable); - dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_REASSOC, !enable); - dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_JOIN, !enable); - dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_ROAM, !enable); - err = dhd_conf_apply_eventbuffer(dhd, &ev_buf); - - CONFIG_TRACE("roam_offload %d\n", enable); - - return err; -} - -void -dhd_conf_set_bw_cap(dhd_pub_t *dhd) -{ - struct { - u32 band; - u32 bw_cap; - } param = {0, 0}; - - if (dhd->conf->bw_cap[0] >= 0) { - memset(¶m, 0, sizeof(param)); - param.band = WLC_BAND_2G; - param.bw_cap = (uint)dhd->conf->bw_cap[0]; - CONFIG_MSG("set bw_cap 2g 0x%x\n", param.bw_cap); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "bw_cap", (char *)¶m, - sizeof(param), TRUE); - } - - if (dhd->conf->bw_cap[1] >= 0) { - memset(¶m, 0, sizeof(param)); - param.band = WLC_BAND_5G; - param.bw_cap = (uint)dhd->conf->bw_cap[1]; - CONFIG_MSG("set bw_cap 5g 0x%x\n", param.bw_cap); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "bw_cap", (char *)¶m, - sizeof(param), TRUE); - } -} - -void -dhd_conf_get_wme(dhd_pub_t *dhd, int ifidx, int mode, edcf_acparam_t *acp) -{ - int bcmerror = -1; - char iovbuf[WLC_IOCTL_SMLEN]; - edcf_acparam_t *acparam; - - bzero(iovbuf, sizeof(iovbuf)); - - /* - * Get current acparams, using buf as an input buffer. - * Return data is array of 4 ACs of wme params. - */ - if (mode == 0) - bcm_mkiovar("wme_ac_sta", NULL, 0, iovbuf, sizeof(iovbuf)); - else - bcm_mkiovar("wme_ac_ap", NULL, 0, iovbuf, sizeof(iovbuf)); - if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, iovbuf, sizeof(iovbuf), - FALSE, ifidx)) < 0) { - CONFIG_ERROR("wme_ac_sta getting failed %d\n", bcmerror); - return; - } - memcpy((char*)acp, iovbuf, sizeof(edcf_acparam_t)*AC_COUNT); - - acparam = &acp[AC_BK]; - CONFIG_TRACE("BK: aci %d aifsn %d ecwmin %d ecwmax %d txop 0x%x\n", - acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, - acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, - acparam->TXOP); - acparam = &acp[AC_BE]; - CONFIG_TRACE("BE: aci %d aifsn %d ecwmin %d ecwmax %d txop 0x%x\n", - acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, - acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, - acparam->TXOP); - acparam = &acp[AC_VI]; - CONFIG_TRACE("VI: aci %d aifsn %d ecwmin %d ecwmax %d txop 0x%x\n", - acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, - acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, - acparam->TXOP); - acparam = &acp[AC_VO]; - CONFIG_TRACE("VO: aci %d aifsn %d ecwmin %d ecwmax %d txop 0x%x\n", - acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, - acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, - acparam->TXOP); - - return; -} - -void -dhd_conf_update_wme(dhd_pub_t *dhd, int ifidx, int mode, - edcf_acparam_t *acparam_cur, int aci) -{ - int aifsn, ecwmin, ecwmax, txop; - edcf_acparam_t *acp; - struct dhd_conf *conf = dhd->conf; - wme_param_t *wme; - - if (mode == 0) - wme = &conf->wme_sta; - else - wme = &conf->wme_ap; - - /* Default value */ - aifsn = acparam_cur->ACI&EDCF_AIFSN_MASK; - ecwmin = acparam_cur->ECW&EDCF_ECWMIN_MASK; - ecwmax = (acparam_cur->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT; - txop = acparam_cur->TXOP; - - /* Modified value */ - if (wme->aifsn[aci] > 0) - aifsn = wme->aifsn[aci]; - if (wme->ecwmin[aci] > 0) - ecwmin = wme->ecwmin[aci]; - if (wme->ecwmax[aci] > 0) - ecwmax = wme->ecwmax[aci]; - if (wme->txop[aci] > 0) - txop = wme->txop[aci]; - - if (!(wme->aifsn[aci] || wme->ecwmin[aci] || - wme->ecwmax[aci] || wme->txop[aci])) - return; - - /* Update */ - acp = acparam_cur; - acp->ACI = (acp->ACI & ~EDCF_AIFSN_MASK) | (aifsn & EDCF_AIFSN_MASK); - acp->ECW = ((ecwmax << EDCF_ECWMAX_SHIFT) & EDCF_ECWMAX_MASK) | (acp->ECW & EDCF_ECWMIN_MASK); - acp->ECW = ((acp->ECW & EDCF_ECWMAX_MASK) | (ecwmin & EDCF_ECWMIN_MASK)); - acp->TXOP = txop; - - CONFIG_MSG("wme_ac %s aci %d aifsn %d ecwmin %d ecwmax %d txop 0x%x\n", - mode?"ap":"sta", acp->ACI, acp->ACI&EDCF_AIFSN_MASK, - acp->ECW&EDCF_ECWMIN_MASK, (acp->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, - acp->TXOP); - - /* - * Now use buf as an output buffer. - * Put WME acparams after "wme_ac\0" in buf. - * NOTE: only one of the four ACs can be set at a time. - */ - if (mode == 0) - dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_VAR, "wme_ac_sta", (char *)acp, - sizeof(edcf_acparam_t), FALSE); - else - dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_VAR, "wme_ac_ap", (char *)acp, - sizeof(edcf_acparam_t), FALSE); - -} - -void -dhd_conf_set_wme(dhd_pub_t *dhd, int ifidx, int mode) -{ - edcf_acparam_t acparam_cur[AC_COUNT]; - - if (dhd && dhd->conf) { - if (!dhd->conf->force_wme_ac) { - CONFIG_TRACE("force_wme_ac is not enabled %d\n", - dhd->conf->force_wme_ac); - return; - } - - CONFIG_TRACE("Before change:\n"); - dhd_conf_get_wme(dhd, ifidx, mode, acparam_cur); - - dhd_conf_update_wme(dhd, ifidx, mode, &acparam_cur[AC_BK], AC_BK); - dhd_conf_update_wme(dhd, ifidx, mode, &acparam_cur[AC_BE], AC_BE); - dhd_conf_update_wme(dhd, ifidx, mode, &acparam_cur[AC_VI], AC_VI); - dhd_conf_update_wme(dhd, ifidx, mode, &acparam_cur[AC_VO], AC_VO); - - CONFIG_TRACE("After change:\n"); - dhd_conf_get_wme(dhd, ifidx, mode, acparam_cur); - } else { - CONFIG_ERROR("dhd or conf is NULL\n"); - } - - return; -} - -void -dhd_conf_set_mchan_bw(dhd_pub_t *dhd, int p2p_mode, int miracast_mode) -{ - struct dhd_conf *conf = dhd->conf; - mchan_params_t *mchan = conf->mchan; - bool set = true; - - while (mchan != NULL) { - set = true; - set &= (mchan->bw >= 0); - set &= ((mchan->p2p_mode == -1) | (mchan->p2p_mode == p2p_mode)); - set &= ((mchan->miracast_mode == -1) | (mchan->miracast_mode == miracast_mode)); - if (set) { - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "mchan_bw", mchan->bw, 0, FALSE); - } - mchan = mchan->next; - } - - return; -} - -#ifdef PKT_FILTER_SUPPORT -void -dhd_conf_add_pkt_filter(dhd_pub_t *dhd) -{ - int i, j; - char str[16]; -#define MACS "%02x%02x%02x%02x%02x%02x" - - /* - * Filter in less pkt: ARP(0x0806, ID is 105), BRCM(0x886C), 802.1X(0x888E) - * 1) dhd_master_mode=1 - * 2) pkt_filter_delete=100, 102, 103, 104, 105, 106, 107 - * 3) pkt_filter_add=131 0 0 12 0xFFFF 0x886C, 132 0 0 12 0xFFFF 0x888E - * 4) magic_pkt_filter_add=141 0 1 12 - */ - for(i=0; iconf->pkt_filter_add.count; i++) { - dhd->pktfilter[i+dhd->pktfilter_count] = dhd->conf->pkt_filter_add.filter[i]; - CONFIG_MSG("%s\n", dhd->pktfilter[i+dhd->pktfilter_count]); - } - dhd->pktfilter_count += i; - - if (dhd->conf->magic_pkt_filter_add) { - strcat(dhd->conf->magic_pkt_filter_add, " 0x"); - strcat(dhd->conf->magic_pkt_filter_add, "FFFFFFFFFFFF"); - for (j=0; j<16; j++) - strcat(dhd->conf->magic_pkt_filter_add, "FFFFFFFFFFFF"); - strcat(dhd->conf->magic_pkt_filter_add, " 0x"); - strcat(dhd->conf->magic_pkt_filter_add, "FFFFFFFFFFFF"); - sprintf(str, MACS, MAC2STRDBG(dhd->mac.octet)); - for (j=0; j<16; j++) - strncat(dhd->conf->magic_pkt_filter_add, str, 12); - dhd->pktfilter[dhd->pktfilter_count] = dhd->conf->magic_pkt_filter_add; - dhd->pktfilter_count += 1; - } -} - -bool -dhd_conf_del_pkt_filter(dhd_pub_t *dhd, uint32 id) -{ - int i; - - if (dhd && dhd->conf) { - for (i=0; iconf->pkt_filter_del.count; i++) { - if (id == dhd->conf->pkt_filter_del.id[i]) { - CONFIG_MSG("%d\n", dhd->conf->pkt_filter_del.id[i]); - return true; - } - } - return false; - } - return false; -} - -void -dhd_conf_discard_pkt_filter(dhd_pub_t *dhd) -{ - dhd->pktfilter_count = 6; - dhd->pktfilter[DHD_UNICAST_FILTER_NUM] = NULL; - dhd->pktfilter[DHD_BROADCAST_FILTER_NUM] = "101 0 0 0 0xFFFFFFFFFFFF 0xFFFFFFFFFFFF"; - dhd->pktfilter[DHD_MULTICAST4_FILTER_NUM] = "102 0 0 0 0xFFFFFF 0x01005E"; - dhd->pktfilter[DHD_MULTICAST6_FILTER_NUM] = "103 0 0 0 0xFFFF 0x3333"; - dhd->pktfilter[DHD_MDNS_FILTER_NUM] = NULL; - /* Do not enable ARP to pkt filter if dhd_master_mode is false.*/ - dhd->pktfilter[DHD_ARP_FILTER_NUM] = NULL; - - /* IPv4 broadcast address XXX.XXX.XXX.255 */ - dhd->pktfilter[dhd->pktfilter_count] = "110 0 0 12 0xFFFF00000000000000000000000000000000000000FF 0x080000000000000000000000000000000000000000FF"; - dhd->pktfilter_count++; - /* discard IPv4 multicast address 224.0.0.0/4 */ - dhd->pktfilter[dhd->pktfilter_count] = "111 0 0 12 0xFFFF00000000000000000000000000000000F0 0x080000000000000000000000000000000000E0"; - dhd->pktfilter_count++; - /* discard IPv6 multicast address FF00::/8 */ - dhd->pktfilter[dhd->pktfilter_count] = "112 0 0 12 0xFFFF000000000000000000000000000000000000000000000000FF 0x86DD000000000000000000000000000000000000000000000000FF"; - dhd->pktfilter_count++; - /* discard Netbios pkt */ - dhd->pktfilter[dhd->pktfilter_count] = "121 0 0 12 0xFFFF000000000000000000FF000000000000000000000000FFFF 0x0800000000000000000000110000000000000000000000000089"; - dhd->pktfilter_count++; - -} -#endif /* PKT_FILTER_SUPPORT */ - -int -dhd_conf_get_pm(dhd_pub_t *dhd) -{ - if (dhd && dhd->conf) { - return dhd->conf->pm; - } - return -1; -} - -int -dhd_conf_check_hostsleep(dhd_pub_t *dhd, int cmd, void *buf, int len, - int *hostsleep_set, int *hostsleep_val, int *ret) -{ - if (dhd->conf->insuspend & (NO_TXCTL_IN_SUSPEND | WOWL_IN_SUSPEND)) { - if (cmd == WLC_SET_VAR) { - char *psleep = NULL; - psleep = strstr(buf, "hostsleep"); - if (psleep) { - *hostsleep_set = 1; - memcpy(hostsleep_val, psleep+strlen("hostsleep")+1, sizeof(int)); - } - } - if (dhd->hostsleep && (!*hostsleep_set || *hostsleep_val)) { - CONFIG_TRACE("block all none hostsleep clr cmd\n"); - *ret = BCME_EPERM; - goto exit; - } else if (*hostsleep_set && *hostsleep_val) { - CONFIG_TRACE("hostsleep %d => %d\n", dhd->hostsleep, *hostsleep_val); - dhd->hostsleep = *hostsleep_val; - if (dhd->conf->insuspend & NO_TXDATA_IN_SUSPEND) { - dhd_txflowcontrol(dhd, ALL_INTERFACES, ON); - } - if (dhd->hostsleep == 2) { - *ret = 0; - goto exit; - } - } else if (dhd->hostsleep == 2 && !*hostsleep_val) { - CONFIG_TRACE("hostsleep %d => %d\n", dhd->hostsleep, *hostsleep_val); - dhd->hostsleep = *hostsleep_val; - if (dhd->conf->insuspend & NO_TXDATA_IN_SUSPEND) { - dhd_txflowcontrol(dhd, ALL_INTERFACES, OFF); - } - *ret = 0; - goto exit; - } - } -#ifdef NO_POWER_SAVE - if (cmd == WLC_SET_PM) { - if (*(const u32*)buf != 0) { - CONFIG_TRACE("skip PM\n"); - *ret = BCME_OK; - goto exit; - } - } else if (cmd == WLC_SET_VAR) { - int cmd_len = strlen("mpc"); - if (!strncmp(buf, "mpc", cmd_len)) { - if (*((u32 *)((u8*)buf+cmd_len+1)) != 0) { - CONFIG_TRACE("skip mpc\n"); - *ret = BCME_OK; - goto exit; - } - } - } -#endif - - return 0; -exit: - return -1; -} - -void -dhd_conf_get_hostsleep(dhd_pub_t *dhd, - int hostsleep_set, int hostsleep_val, int ret) -{ - if (dhd->conf->insuspend & (NO_TXCTL_IN_SUSPEND | WOWL_IN_SUSPEND)) { - if (hostsleep_set) { - if (hostsleep_val && ret) { - CONFIG_TRACE("reset hostsleep %d => 0\n", dhd->hostsleep); - dhd->hostsleep = 0; - if (dhd->conf->insuspend & NO_TXDATA_IN_SUSPEND) { - dhd_txflowcontrol(dhd, ALL_INTERFACES, OFF); - } - } else if (!hostsleep_val && !ret) { - CONFIG_TRACE("set hostsleep %d => 0\n", dhd->hostsleep); - dhd->hostsleep = 0; - if (dhd->conf->insuspend & NO_TXDATA_IN_SUSPEND) { - dhd_txflowcontrol(dhd, ALL_INTERFACES, OFF); - } - } - } - } -} - -#ifdef WL_EXT_WOWL -#define WL_WOWL_TCPFIN (1 << 26) -typedef struct wl_wowl_pattern2 { - char cmd[4]; - wl_wowl_pattern_t wowl_pattern; -} wl_wowl_pattern2_t; -static int -dhd_conf_wowl_pattern(dhd_pub_t *dhd, bool add, char *data) -{ - uint buf_len = 0; - int id, type, polarity, offset; - char cmd[4]="\0", mask[128]="\0", pattern[128]="\0", mask_tmp[128]="\0", *pmask_tmp; - uint32 masksize, patternsize, pad_len = 0; - wl_wowl_pattern2_t *wowl_pattern2 = NULL; - char *mask_and_pattern; - int ret = 0, i, j, v; - - if (data) { - if (add) - strcpy(cmd, "add"); - else - strcpy(cmd, "clr"); - if (!strcmp(cmd, "clr")) { - CONFIG_TRACE("wowl_pattern clr\n"); - ret = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "wowl_pattern", cmd, - sizeof(cmd), FALSE); - goto exit; - } - sscanf(data, "%d %d %d %d %s %s", &id, &type, &polarity, &offset, - mask_tmp, pattern); - masksize = strlen(mask_tmp) -2; - CONFIG_TRACE("0 mask_tmp=%s, masksize=%d\n", mask_tmp, masksize); - - // add pading - if (masksize % 16) - pad_len = (16 - masksize % 16); - for (i=0; icmd, cmd, sizeof(cmd)); - wowl_pattern2->wowl_pattern.id = id; - wowl_pattern2->wowl_pattern.type = 0; - wowl_pattern2->wowl_pattern.offset = offset; - mask_and_pattern = (char*)wowl_pattern2 + sizeof(wl_wowl_pattern2_t); - - wowl_pattern2->wowl_pattern.masksize = masksize; - ret = wl_pattern_atoh(mask, mask_and_pattern); - if (ret == -1) { - CONFIG_ERROR("rejecting mask=%s\n", mask); - goto exit; - } - - mask_and_pattern += wowl_pattern2->wowl_pattern.masksize; - wowl_pattern2->wowl_pattern.patternoffset = sizeof(wl_wowl_pattern_t) + - wowl_pattern2->wowl_pattern.masksize; - - wowl_pattern2->wowl_pattern.patternsize = patternsize; - ret = wl_pattern_atoh(pattern, mask_and_pattern); - if (ret == -1) { - CONFIG_ERROR("rejecting pattern=%s\n", pattern); - goto exit; - } - - CONFIG_TRACE("%s %d %s %s\n", cmd, offset, mask, pattern); - - ret = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "wowl_pattern", - (char *)wowl_pattern2, buf_len, FALSE); - } - -exit: - if (wowl_pattern2) - kfree(wowl_pattern2); - return ret; -} - -static int -dhd_conf_wowl_wakeind(dhd_pub_t *dhd, bool clear) -{ - s8 iovar_buf[WLC_IOCTL_SMLEN]; - wl_wowl_wakeind_t *wake = NULL; - int ret = -1; - char clr[6]="clear", wakeind_str[32]="\0"; - - if (clear) { - CONFIG_TRACE("wowl_wakeind clear\n"); - ret = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "wowl_wakeind", - clr, sizeof(clr), 0); - } else { - ret = dhd_conf_get_iovar(dhd, 0, WLC_GET_VAR, "wowl_wakeind", - iovar_buf, sizeof(iovar_buf)); - if (!ret) { - wake = (wl_wowl_wakeind_t *) iovar_buf; - if (wake->ucode_wakeind & WL_WOWL_MAGIC) - strcpy(wakeind_str, "(MAGIC packet)"); - if (wake->ucode_wakeind & WL_WOWL_NET) - strcpy(wakeind_str, "(Netpattern)"); - if (wake->ucode_wakeind & WL_WOWL_DIS) - strcpy(wakeind_str, "(Disassoc/Deauth)"); - if (wake->ucode_wakeind & WL_WOWL_BCN) - strcpy(wakeind_str, "(Loss of beacon)"); - if (wake->ucode_wakeind & WL_WOWL_TCPKEEP_TIME) - strcpy(wakeind_str, "(TCPKA timeout)"); - if (wake->ucode_wakeind & WL_WOWL_TCPKEEP_DATA) - strcpy(wakeind_str, "(TCPKA data)"); - if (wake->ucode_wakeind & WL_WOWL_TCPFIN) - strcpy(wakeind_str, "(TCP FIN)"); - CONFIG_MSG("wakeind=0x%x %s\n", wake->ucode_wakeind, wakeind_str); - } - } - - return ret; -} -#endif - -int -dhd_conf_mkeep_alive(dhd_pub_t *dhd, int ifidx, int id, int period, - char *packet, bool bcast) -{ - wl_mkeep_alive_pkt_t *mkeep_alive_pktp; - int ret = 0, len_bytes=0, buf_len=0; - char *buf = NULL, *iovar_buf = NULL; - uint8 *pdata; - - CONFIG_TRACE("id=%d, period=%d, packet=%s\n", id, period, packet); - if (period >= 0) { - buf = kmalloc(WLC_IOCTL_SMLEN, GFP_KERNEL); - if (buf == NULL) { - CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", WLC_IOCTL_SMLEN); - goto exit; - } - iovar_buf = kmalloc(WLC_IOCTL_SMLEN, GFP_KERNEL); - if (iovar_buf == NULL) { - CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", WLC_IOCTL_SMLEN); - goto exit; - } - mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *)buf; - mkeep_alive_pktp->version = htod16(WL_MKEEP_ALIVE_VERSION); - mkeep_alive_pktp->length = htod16(WL_MKEEP_ALIVE_FIXED_LEN); - mkeep_alive_pktp->keep_alive_id = id; - buf_len += WL_MKEEP_ALIVE_FIXED_LEN; - mkeep_alive_pktp->period_msec = period; - if (packet && strlen(packet)) { - len_bytes = wl_pattern_atoh(packet, (char *)mkeep_alive_pktp->data); - buf_len += len_bytes; - if (bcast) { - memcpy(mkeep_alive_pktp->data, ðer_bcast, ETHER_ADDR_LEN); - } - ret = dhd_conf_get_iovar(dhd, ifidx, WLC_GET_VAR, "cur_etheraddr", - iovar_buf, WLC_IOCTL_SMLEN); - if (!ret) { - pdata = mkeep_alive_pktp->data; - memcpy(pdata+6, iovar_buf, ETHER_ADDR_LEN); - } - } - mkeep_alive_pktp->len_bytes = htod16(len_bytes); - ret = dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_VAR, "mkeep_alive", - buf, buf_len, FALSE); - } - -exit: - if (buf) - kfree(buf); - if (iovar_buf) - kfree(iovar_buf); - return ret; -} - -#ifdef ARP_OFFLOAD_SUPPORT -void -dhd_conf_set_garp(dhd_pub_t *dhd, int ifidx, uint32 ipa, bool enable) -{ - int i, len = 0, total_len = WLC_IOCTL_SMLEN; - char *iovar_buf = NULL, *packet = NULL; - - if (!dhd->conf->garp || ifidx != 0 || !(dhd->op_mode & DHD_FLAG_STA_MODE)) - return; - - CONFIG_TRACE("enable=%d\n", enable); - - if (enable) { - iovar_buf = kmalloc(total_len, GFP_KERNEL); - if (iovar_buf == NULL) { - CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", total_len); - goto exit; - } - packet = kmalloc(total_len, GFP_KERNEL); - if (packet == NULL) { - CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", total_len); - goto exit; - } - dhd_conf_get_iovar(dhd, ifidx, WLC_GET_VAR, "cur_etheraddr", iovar_buf, total_len); - - len += snprintf(packet+len, total_len, "0xffffffffffff"); - for (i=0; i>8)&0xff, (ipa>>16)&0xff, (ipa>>24)&0xff); - // Target Hardware Addr. - len += snprintf(packet+len, total_len, "ffffffffffff"); - // Target IP Addr. - len += snprintf(packet+len, total_len, "%02x%02x%02x%02x", - ipa&0xff, (ipa>>8)&0xff, (ipa>>16)&0xff, (ipa>>24)&0xff); - len += snprintf(packet+len, total_len, "000000000000000000000000000000000000"); - } - - dhd_conf_mkeep_alive(dhd, ifidx, 0, dhd->conf->keep_alive_period, packet, TRUE); - -exit: - if (iovar_buf) - kfree(iovar_buf); - if (packet) - kfree(packet); - return; -} -#endif - -uint -dhd_conf_get_insuspend(dhd_pub_t *dhd, uint mask) -{ - uint insuspend = 0; - - if (dhd->op_mode & DHD_FLAG_STA_MODE) { - insuspend = dhd->conf->insuspend & - (NO_EVENT_IN_SUSPEND | NO_TXDATA_IN_SUSPEND | NO_TXCTL_IN_SUSPEND | - ROAM_OFFLOAD_IN_SUSPEND | WOWL_IN_SUSPEND); - } else if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) { - insuspend = dhd->conf->insuspend & - (NO_EVENT_IN_SUSPEND | NO_TXDATA_IN_SUSPEND | NO_TXCTL_IN_SUSPEND | - AP_DOWN_IN_SUSPEND | AP_FILTER_IN_SUSPEND); - } - - return (insuspend & mask); -} - -#ifdef SUSPEND_EVENT -void -dhd_conf_set_suspend_event(dhd_pub_t *dhd, int suspend) -{ - struct dhd_conf *conf = dhd->conf; - struct ether_addr bssid; - char suspend_eventmask[WL_EVENTING_MASK_LEN]; - wl_event_msg_t msg; - int pm; -#ifdef WL_CFG80211 - struct net_device *net; -#endif /* defined(WL_CFG80211) */ - - CONFIG_TRACE("Enter\n"); - if (suspend) { -#ifdef PROP_TXSTATUS -#if defined(BCMSDIO) || defined(BCMDBUS) - if (dhd->wlfc_enabled) { - dhd_wlfc_deinit(dhd); - conf->wlfc = TRUE; - } else { - conf->wlfc = FALSE; - } -#endif /* BCMSDIO || BCMDBUS */ -#endif /* PROP_TXSTATUS */ - dhd_conf_get_iovar(dhd, 0, WLC_GET_VAR, "event_msgs", - conf->resume_eventmask, sizeof(conf->resume_eventmask)); - memset(suspend_eventmask, 0, sizeof(suspend_eventmask)); - setbit(suspend_eventmask, WLC_E_ESCAN_RESULT); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "event_msgs", - suspend_eventmask, sizeof(suspend_eventmask), FALSE); - if (dhd->op_mode & DHD_FLAG_STA_MODE) { - memset(&bssid, 0, ETHER_ADDR_LEN); - dhd_wl_ioctl_cmd(dhd, WLC_GET_BSSID, &bssid, ETHER_ADDR_LEN, FALSE, 0); - if (memcmp(ðer_null, &bssid, ETHER_ADDR_LEN)) - memcpy(&conf->bssid_insuspend, &bssid, ETHER_ADDR_LEN); - else - memset(&conf->bssid_insuspend, 0, ETHER_ADDR_LEN); - } - } - else { - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "event_msgs", - conf->resume_eventmask, sizeof(conf->resume_eventmask), FALSE); - if (dhd->op_mode & DHD_FLAG_STA_MODE) { - if (memcmp(ðer_null, &conf->bssid_insuspend, ETHER_ADDR_LEN)) { - memset(&bssid, 0, ETHER_ADDR_LEN); - dhd_wl_ioctl_cmd(dhd, WLC_GET_BSSID, &bssid, ETHER_ADDR_LEN, - FALSE, 0); - if (memcmp(ðer_null, &bssid, ETHER_ADDR_LEN)) { - dhd_conf_set_intiovar(dhd, WLC_SET_PM, "WLC_SET_PM", 0, 0, FALSE); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "send_nulldata", - (char *)&bssid, ETHER_ADDR_LEN, FALSE); - OSL_SLEEP(100); - if (conf->pm >= 0) - pm = conf->pm; - else - pm = PM_FAST; - dhd_conf_set_intiovar(dhd, WLC_SET_PM, "WLC_SET_PM", pm, 0, FALSE); - } else { - CONFIG_TRACE("send WLC_E_DEAUTH_IND event\n"); - bzero(&msg, sizeof(wl_event_msg_t)); - memcpy(&msg.addr, &conf->bssid_insuspend, ETHER_ADDR_LEN); - msg.event_type = hton32(WLC_E_DEAUTH_IND); - msg.status = 0; - msg.reason = hton32(DOT11_RC_DEAUTH_LEAVING); -#if defined(WL_EXT_IAPSTA) || defined(USE_IW) - wl_ext_event_send(dhd->event_params, &msg, NULL); -#endif -#ifdef WL_CFG80211 - net = dhd_idx2net(dhd, 0); - if (net) { - wl_cfg80211_event(net, &msg, NULL); - } -#endif /* defined(WL_CFG80211) */ - } - } -#ifdef PROP_TXSTATUS -#if defined(BCMSDIO) || defined(BCMDBUS) - if (conf->wlfc) { - dhd_wlfc_init(dhd); - dhd_conf_set_intiovar(dhd, WLC_UP, "WLC_UP", 0, 0, FALSE); - } -#endif -#endif /* PROP_TXSTATUS */ - } - } - -} -#endif - -#if defined(WL_CFG80211) || defined(WL_ESCAN) -static void -dhd_conf_wait_event_complete(struct dhd_pub *dhd, int ifidx) -{ - s32 timeout = -1; - - timeout = wait_event_interruptible_timeout(dhd->conf->event_complete, - wl_ext_event_complete(dhd, ifidx), msecs_to_jiffies(10000)); - if (timeout <= 0 || !wl_ext_event_complete(dhd, ifidx)) { - wl_ext_event_complete(dhd, ifidx); - CONFIG_ERROR("timeout\n"); - } -} -#endif - -int -dhd_conf_set_suspend_resume(dhd_pub_t *dhd, int suspend) -{ - struct dhd_conf *conf = dhd->conf; - uint insuspend = 0; - int pm; -#ifdef BCMSDIO - uint32 intstatus = 0; - int ret = 0; -#endif -#ifdef WL_EXT_WOWL - int i; -#endif - - insuspend = dhd_conf_get_insuspend(dhd, ALL_IN_SUSPEND); - if (insuspend) - CONFIG_MSG("op_mode %d, suspend %d, suspended %d, insuspend 0x%x, suspend_mode=%d\n", - dhd->op_mode, suspend, conf->suspended, insuspend, conf->suspend_mode); - - if (conf->suspended == suspend || !dhd->up) { - return 0; - } - - if (suspend) { - if (dhd->op_mode & DHD_FLAG_STA_MODE) { - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "roam_off", - dhd->conf->roam_off_suspend, 0, FALSE); - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bcn_li_dtim", - dhd->conf->suspend_bcn_li_dtim, 0, FALSE); - if (insuspend & ROAM_OFFLOAD_IN_SUSPEND) - dhd_conf_enable_roam_offload(dhd, 2); - } else if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) { - if (insuspend & AP_DOWN_IN_SUSPEND) { - dhd_conf_set_intiovar(dhd, WLC_DOWN, "WLC_DOWN", 1, 0, FALSE); - } - } -#if defined(WL_CFG80211) || defined(WL_ESCAN) - if (insuspend & (NO_EVENT_IN_SUSPEND|NO_TXCTL_IN_SUSPEND|WOWL_IN_SUSPEND)) { - if (conf->suspend_mode == PM_NOTIFIER) - dhd_conf_wait_event_complete(dhd, 0); - } -#endif - if (insuspend & NO_TXDATA_IN_SUSPEND) { - dhd_txflowcontrol(dhd, ALL_INTERFACES, ON); - } -#if defined(WL_CFG80211) || defined(WL_ESCAN) - if (insuspend & (NO_EVENT_IN_SUSPEND|NO_TXCTL_IN_SUSPEND|WOWL_IN_SUSPEND)) { - if (conf->suspend_mode == PM_NOTIFIER) - wl_ext_user_sync(dhd, 0, TRUE); - } -#endif -#ifdef SUSPEND_EVENT - if (insuspend & NO_EVENT_IN_SUSPEND) { - dhd_conf_set_suspend_event(dhd, suspend); - } -#endif - if (dhd->op_mode & DHD_FLAG_STA_MODE) { - if (conf->pm_in_suspend >= 0) - pm = conf->pm_in_suspend; - else if (conf->pm >= 0) - pm = conf->pm; - else - pm = PM_FAST; - dhd_conf_set_intiovar(dhd, WLC_SET_PM, "WLC_SET_PM", pm, 0, FALSE); - } - dhd_conf_set_wl_cmd(dhd, conf->wl_suspend, FALSE); -#ifdef WL_EXT_WOWL - if ((insuspend & WOWL_IN_SUSPEND) && dhd_master_mode) { - dhd_conf_wowl_pattern(dhd, FALSE, "clr"); - for(i=0; ipkt_filter_add.count; i++) { - dhd_conf_wowl_pattern(dhd, TRUE, conf->pkt_filter_add.filter[i]); - } - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "wowl", conf->wowl, 0, FALSE); - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "wowl_activate", 1, 0, FALSE); - dhd_conf_wowl_wakeind(dhd, TRUE); - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "hostsleep", 1, 0, FALSE); -#ifdef BCMSDIO - ret = dhd_bus_sleep(dhd, TRUE, &intstatus); - CONFIG_TRACE("ret = %d, intstatus = 0x%x\n", ret, intstatus); -#endif - } else -#endif - if (insuspend & NO_TXCTL_IN_SUSPEND) { - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "hostsleep", 2, 0, FALSE); -#ifdef BCMSDIO - ret = dhd_bus_sleep(dhd, TRUE, &intstatus); - CONFIG_TRACE("ret = %d, intstatus = 0x%x\n", ret, intstatus); -#endif - } - conf->suspended = TRUE; - } else { - if (insuspend & (WOWL_IN_SUSPEND | NO_TXCTL_IN_SUSPEND)) { - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "hostsleep", 0, 0, FALSE); - } -#ifdef WL_EXT_WOWL - if (insuspend & WOWL_IN_SUSPEND) { - dhd_conf_wowl_wakeind(dhd, FALSE); - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "wowl_activate", 0, 0, FALSE); - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "wowl", 0, 0, FALSE); - dhd_conf_wowl_pattern(dhd, FALSE, "clr"); - } -#endif - dhd_conf_set_wl_cmd(dhd, conf->wl_resume, FALSE); - dhd_conf_get_iovar(dhd, 0, WLC_GET_PM, "WLC_GET_PM", (char *)&pm, sizeof(pm)); - CONFIG_TRACE("PM in suspend = %d\n", pm); -#ifdef SUSPEND_EVENT - if (insuspend & NO_EVENT_IN_SUSPEND) { - dhd_conf_set_suspend_event(dhd, suspend); - } -#endif -#if defined(WL_CFG80211) || defined(WL_ESCAN) - if (insuspend & (NO_EVENT_IN_SUSPEND|NO_TXCTL_IN_SUSPEND|WOWL_IN_SUSPEND)) { - if (conf->suspend_mode == PM_NOTIFIER) - wl_ext_user_sync(dhd, 0, FALSE); - } -#endif - if (insuspend & NO_TXDATA_IN_SUSPEND) { - dhd_txflowcontrol(dhd, ALL_INTERFACES, OFF); - } - if (dhd->op_mode & DHD_FLAG_STA_MODE) { - if (insuspend & ROAM_OFFLOAD_IN_SUSPEND) - dhd_conf_enable_roam_offload(dhd, 0); - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bcn_li_dtim", 0, 0, FALSE); - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "roam_off", - dhd->conf->roam_off, 0, FALSE); - } else if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) { - if (insuspend & AP_DOWN_IN_SUSPEND) { - dhd_conf_set_intiovar(dhd, WLC_UP, "WLC_UP", 0, 0, FALSE); - } - } - if (dhd->op_mode & DHD_FLAG_STA_MODE) { - if (conf->pm >= 0) - pm = conf->pm; - else - pm = PM_FAST; - dhd_conf_set_intiovar(dhd, WLC_SET_PM, "WLC_SET_PM", pm, 0, FALSE); - } - conf->suspended = FALSE; - } - - return 0; -} - -#ifdef PROP_TXSTATUS -int -dhd_conf_get_disable_proptx(dhd_pub_t *dhd) -{ - struct dhd_conf *conf = dhd->conf; - int disable_proptx = -1; - int fw_proptx = 0; - - /* check fw proptx priority: - * 1st: check fw support by wl cap - * 2nd: 4334/43340/43341/43241 support proptx but not show in wl cap, so enable it by default - * if you would like to disable it, please set disable_proptx=1 in config.txt - * 3th: disable when proptxstatus not support in wl cap - */ - if (FW_SUPPORTED(dhd, proptxstatus)) { - fw_proptx = 1; - } else if (conf->chip == BCM4334_CHIP_ID || conf->chip == BCM43340_CHIP_ID || - dhd->conf->chip == BCM43340_CHIP_ID || conf->chip == BCM4324_CHIP_ID) { - fw_proptx = 1; - } else { - fw_proptx = 0; - } - - /* returned disable_proptx value: - * -1: disable in STA and enable in P2P(follow original dhd settings when PROP_TXSTATUS_VSDB enabled) - * 0: depend on fw support - * 1: always disable proptx - */ - if (conf->disable_proptx == 0) { - // check fw support as well - if (fw_proptx) - disable_proptx = 0; - else - disable_proptx = 1; - } else if (conf->disable_proptx >= 1) { - disable_proptx = 1; - } else { - // check fw support as well - if (fw_proptx) - disable_proptx = -1; - else - disable_proptx = 1; - } - - CONFIG_MSG("fw_proptx=%d, disable_proptx=%d\n", fw_proptx, disable_proptx); - - return disable_proptx; -} -#endif - -uint -pick_config_vars(char *varbuf, uint len, uint start_pos, char *pickbuf, int picklen) -{ - bool findNewline, changenewline=FALSE, pick=FALSE; - int column; - uint n, pick_column=0; - - findNewline = FALSE; - column = 0; - - if (start_pos >= len) { - CONFIG_ERROR("wrong start pos\n"); - return 0; - } - - for (n = start_pos; n < len; n++) { - if (varbuf[n] == '\r') - continue; - if ((findNewline || changenewline) && varbuf[n] != '\n') - continue; - findNewline = FALSE; - if (varbuf[n] == '#') { - findNewline = TRUE; - continue; - } - if (varbuf[n] == '\\') { - changenewline = TRUE; - continue; - } - if (!changenewline && varbuf[n] == '\n') { - if (column == 0) - continue; - column = 0; - continue; - } - if (changenewline && varbuf[n] == '\n') { - changenewline = FALSE; - continue; - } - - if (column==0 && !pick) { // start to pick - pick = TRUE; - column++; - pick_column = 0; - } else { - if (pick && column==0) { // stop to pick - pick = FALSE; - break; - } else - column++; - } - if (pick) { - if (varbuf[n] == 0x9) - continue; - if (pick_column >= picklen) - break; - pickbuf[pick_column] = varbuf[n]; - pick_column++; - } - } - - return n; // return current position -} - -bool -dhd_conf_read_chiprev(dhd_pub_t *dhd, int *chip_match, - char *full_param, uint len_param) -{ - char *data = full_param+len_param, *pick_tmp, *pch; - uint chip = 0, rev = 0; - - /* Process chip, regrev: - * chip=[chipid], rev==[rev] - * Ex: chip=0x4359, rev=9 - */ - if (!strncmp("chip=", full_param, len_param)) { - chip = (int)simple_strtol(data, NULL, 0); - pick_tmp = data; - pch = bcmstrstr(pick_tmp, "rev="); - if (pch) { - rev = (int)simple_strtol(pch+strlen("rev="), NULL, 0); - } - if (chip == dhd->conf->chip && rev == dhd->conf->chiprev) - *chip_match = 1; - else - *chip_match = 0; - CONFIG_MSG("chip=0x%x, rev=%d, chip_match=%d\n", chip, rev, *chip_match); - } - - return TRUE; -} - -bool -dhd_conf_read_log_level(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - char *data = full_param+len_param; - - if (!strncmp("dhd_msg_level=", full_param, len_param)) { - dhd_msg_level = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("dhd_msg_level = 0x%X\n", dhd_msg_level); - } - else if (!strncmp("dump_msg_level=", full_param, len_param)) { - dump_msg_level = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("dump_msg_level = 0x%X\n", dump_msg_level); - } -#ifdef BCMSDIO - else if (!strncmp("sd_msglevel=", full_param, len_param)) { - sd_msglevel = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("sd_msglevel = 0x%X\n", sd_msglevel); - } -#endif -#ifdef BCMDBUS - else if (!strncmp("dbus_msglevel=", full_param, len_param)) { - dbus_msglevel = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("dbus_msglevel = 0x%X\n", dbus_msglevel); - } -#endif - else if (!strncmp("android_msg_level=", full_param, len_param)) { - android_msg_level = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("android_msg_level = 0x%X\n", android_msg_level); - } - else if (!strncmp("config_msg_level=", full_param, len_param)) { - config_msg_level = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("config_msg_level = 0x%X\n", config_msg_level); - } -#ifdef WL_CFG80211 - else if (!strncmp("wl_dbg_level=", full_param, len_param)) { - wl_dbg_level = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("wl_dbg_level = 0x%X\n", wl_dbg_level); - } -#endif -#if defined(WL_WIRELESS_EXT) - else if (!strncmp("iw_msg_level=", full_param, len_param)) { - iw_msg_level = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("iw_msg_level = 0x%X\n", iw_msg_level); - } -#endif -#if defined(DHD_DEBUG) - else if (!strncmp("dhd_console_ms=", full_param, len_param)) { - dhd->dhd_console_ms = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("dhd_console_ms = 0x%X\n", dhd->dhd_console_ms); - } -#endif - else - return false; - - return true; -} - -void -dhd_conf_read_wme_ac_value(wme_param_t *wme, char *pick, int ac_val) -{ - char *pick_tmp, *pch; - - pick_tmp = pick; - pch = bcmstrstr(pick_tmp, "aifsn "); - if (pch) { - wme->aifsn[ac_val] = (int)simple_strtol(pch+strlen("aifsn "), NULL, 0); - CONFIG_MSG("ac_val=%d, aifsn=%d\n", ac_val, wme->aifsn[ac_val]); - } - pick_tmp = pick; - pch = bcmstrstr(pick_tmp, "ecwmin "); - if (pch) { - wme->ecwmin[ac_val] = (int)simple_strtol(pch+strlen("ecwmin "), NULL, 0); - CONFIG_MSG("ac_val=%d, ecwmin=%d\n", ac_val, wme->ecwmin[ac_val]); - } - pick_tmp = pick; - pch = bcmstrstr(pick_tmp, "ecwmax "); - if (pch) { - wme->ecwmax[ac_val] = (int)simple_strtol(pch+strlen("ecwmax "), NULL, 0); - CONFIG_MSG("ac_val=%d, ecwmax=%d\n", ac_val, wme->ecwmax[ac_val]); - } - pick_tmp = pick; - pch = bcmstrstr(pick_tmp, "txop "); - if (pch) { - wme->txop[ac_val] = (int)simple_strtol(pch+strlen("txop "), NULL, 0); - CONFIG_MSG("ac_val=%d, txop=0x%x\n", ac_val, wme->txop[ac_val]); - } - -} - -bool -dhd_conf_read_wme_ac_params(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - struct dhd_conf *conf = dhd->conf; - char *data = full_param+len_param; - - // wme_ac_sta_be=aifsn 1 ecwmin 2 ecwmax 3 txop 0x5e - // wme_ac_sta_vo=aifsn 1 ecwmin 1 ecwmax 1 txop 0x5e - - if (!strncmp("force_wme_ac=", full_param, len_param)) { - conf->force_wme_ac = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("force_wme_ac = %d\n", conf->force_wme_ac); - } - else if (!strncmp("wme_ac_sta_be=", full_param, len_param)) { - dhd_conf_read_wme_ac_value(&conf->wme_sta, data, AC_BE); - } - else if (!strncmp("wme_ac_sta_bk=", full_param, len_param)) { - dhd_conf_read_wme_ac_value(&conf->wme_sta, data, AC_BK); - } - else if (!strncmp("wme_ac_sta_vi=", full_param, len_param)) { - dhd_conf_read_wme_ac_value(&conf->wme_sta, data, AC_VI); - } - else if (!strncmp("wme_ac_sta_vo=", full_param, len_param)) { - dhd_conf_read_wme_ac_value(&conf->wme_sta, data, AC_VO); - } - else if (!strncmp("wme_ac_ap_be=", full_param, len_param)) { - dhd_conf_read_wme_ac_value(&conf->wme_ap, data, AC_BE); - } - else if (!strncmp("wme_ac_ap_bk=", full_param, len_param)) { - dhd_conf_read_wme_ac_value(&conf->wme_ap, data, AC_BK); - } - else if (!strncmp("wme_ac_ap_vi=", full_param, len_param)) { - dhd_conf_read_wme_ac_value(&conf->wme_ap, data, AC_VI); - } - else if (!strncmp("wme_ac_ap_vo=", full_param, len_param)) { - dhd_conf_read_wme_ac_value(&conf->wme_ap, data, AC_VO); - } - else - return false; - - return true; -} - -#ifdef BCMSDIO -bool -dhd_conf_read_fw_by_mac(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - int i, j; - char *pch, *pick_tmp; - wl_mac_list_t *mac_list; - wl_mac_range_t *mac_range; - struct dhd_conf *conf = dhd->conf; - char *data = full_param+len_param; - - /* Process fw_by_mac: - * fw_by_mac=[fw_mac_num] \ - * [fw_name1] [mac_num1] [oui1-1] [nic_start1-1] [nic_end1-1] \ - * [oui1-1] [nic_start1-1] [nic_end1-1]... \ - * [oui1-n] [nic_start1-n] [nic_end1-n] \ - * [fw_name2] [mac_num2] [oui2-1] [nic_start2-1] [nic_end2-1] \ - * [oui2-1] [nic_start2-1] [nic_end2-1]... \ - * [oui2-n] [nic_start2-n] [nic_end2-n] \ - * Ex: fw_by_mac=2 \ - * fw_bcmdhd1.bin 2 0x0022F4 0xE85408 0xE8549D 0x983B16 0x3557A9 0x35582A \ - * fw_bcmdhd2.bin 3 0x0022F4 0xE85408 0xE8549D 0x983B16 0x3557A9 0x35582A \ - * 0x983B16 0x916157 0x916487 - */ - - if (!strncmp("fw_by_mac=", full_param, len_param)) { - dhd_conf_free_mac_list(&conf->fw_by_mac); - pick_tmp = data; - pch = bcmstrtok(&pick_tmp, " ", 0); - conf->fw_by_mac.count = (uint32)simple_strtol(pch, NULL, 0); - if (!(mac_list = kmalloc(sizeof(wl_mac_list_t)*conf->fw_by_mac.count, - GFP_KERNEL))) { - conf->fw_by_mac.count = 0; - CONFIG_ERROR("kmalloc failed\n"); - } - CONFIG_MSG("fw_count=%d\n", conf->fw_by_mac.count); - conf->fw_by_mac.m_mac_list_head = mac_list; - for (i=0; ifw_by_mac.count; i++) { - pch = bcmstrtok(&pick_tmp, " ", 0); - strcpy(mac_list[i].name, pch); - pch = bcmstrtok(&pick_tmp, " ", 0); - mac_list[i].count = (uint32)simple_strtol(pch, NULL, 0); - CONFIG_MSG("name=%s, mac_count=%d\n", - mac_list[i].name, mac_list[i].count); - if (!(mac_range = kmalloc(sizeof(wl_mac_range_t)*mac_list[i].count, - GFP_KERNEL))) { - mac_list[i].count = 0; - CONFIG_ERROR("kmalloc failed\n"); - break; - } - mac_list[i].mac = mac_range; - for (j=0; jconf; - char *data = full_param+len_param; - - /* Process nv_by_mac: - * [nv_by_mac]: The same format as fw_by_mac - */ - if (!strncmp("nv_by_mac=", full_param, len_param)) { - dhd_conf_free_mac_list(&conf->nv_by_mac); - pick_tmp = data; - pch = bcmstrtok(&pick_tmp, " ", 0); - conf->nv_by_mac.count = (uint32)simple_strtol(pch, NULL, 0); - if (!(mac_list = kmalloc(sizeof(wl_mac_list_t)*conf->nv_by_mac.count, - GFP_KERNEL))) { - conf->nv_by_mac.count = 0; - CONFIG_ERROR("kmalloc failed\n"); - } - CONFIG_MSG("nv_count=%d\n", conf->nv_by_mac.count); - conf->nv_by_mac.m_mac_list_head = mac_list; - for (i=0; inv_by_mac.count; i++) { - pch = bcmstrtok(&pick_tmp, " ", 0); - strcpy(mac_list[i].name, pch); - pch = bcmstrtok(&pick_tmp, " ", 0); - mac_list[i].count = (uint32)simple_strtol(pch, NULL, 0); - CONFIG_MSG("name=%s, mac_count=%d\n", - mac_list[i].name, mac_list[i].count); - if (!(mac_range = kmalloc(sizeof(wl_mac_range_t)*mac_list[i].count, - GFP_KERNEL))) { - mac_list[i].count = 0; - CONFIG_ERROR("kmalloc failed\n"); - break; - } - mac_list[i].mac = mac_range; - for (j=0; jconf; - char *data = full_param+len_param; - - /* Process nv_by_chip: - * nv_by_chip=[nv_chip_num] \ - * [chip1] [chiprev1] [nv_name1] [chip2] [chiprev2] [nv_name2] \ - * Ex: nv_by_chip=2 \ - * 43430 0 nvram_ap6212.txt 43430 1 nvram_ap6212a.txt \ - */ - if (!strncmp("nv_by_chip=", full_param, len_param)) { - dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); - pick_tmp = data; - pch = bcmstrtok(&pick_tmp, " ", 0); - conf->nv_by_chip.count = (uint32)simple_strtol(pch, NULL, 0); - if (!(chip_nv_path = kmalloc(sizeof(wl_mac_list_t)*conf->nv_by_chip.count, - GFP_KERNEL))) { - conf->nv_by_chip.count = 0; - CONFIG_ERROR("kmalloc failed\n"); - } - CONFIG_MSG("nv_by_chip_count=%d\n", conf->nv_by_chip.count); - conf->nv_by_chip.m_chip_nv_path_head = chip_nv_path; - for (i=0; inv_by_chip.count; i++) { - pch = bcmstrtok(&pick_tmp, " ", 0); - chip_nv_path[i].chip = (uint32)simple_strtol(pch, NULL, 0); - pch = bcmstrtok(&pick_tmp, " ", 0); - chip_nv_path[i].chiprev = (uint32)simple_strtol(pch, NULL, 0); - pch = bcmstrtok(&pick_tmp, " ", 0); - strcpy(chip_nv_path[i].name, pch); - CONFIG_MSG("chip=0x%x, chiprev=%d, name=%s\n", - chip_nv_path[i].chip, chip_nv_path[i].chiprev, chip_nv_path[i].name); - } - } - else - return false; - - return true; -} - -bool -dhd_conf_read_roam_params(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - struct dhd_conf *conf = dhd->conf; - char *data = full_param+len_param; - - if (!strncmp("roam_off=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->roam_off = 0; - else - conf->roam_off = 1; - CONFIG_MSG("roam_off = %d\n", conf->roam_off); - } - else if (!strncmp("roam_off_suspend=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->roam_off_suspend = 0; - else - conf->roam_off_suspend = 1; - CONFIG_MSG("roam_off_suspend = %d\n", conf->roam_off_suspend); - } - else if (!strncmp("roam_trigger=", full_param, len_param)) { - conf->roam_trigger[0] = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("roam_trigger = %d\n", conf->roam_trigger[0]); - } - else if (!strncmp("roam_scan_period=", full_param, len_param)) { - conf->roam_scan_period[0] = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("roam_scan_period = %d\n", conf->roam_scan_period[0]); - } - else if (!strncmp("roam_delta=", full_param, len_param)) { - conf->roam_delta[0] = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("roam_delta = %d\n", conf->roam_delta[0]); - } - else if (!strncmp("fullroamperiod=", full_param, len_param)) { - conf->fullroamperiod = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("fullroamperiod = %d\n", conf->fullroamperiod); - } else - return false; - - return true; -} - -bool -dhd_conf_read_country(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - struct dhd_conf *conf = dhd->conf; - country_list_t *country_next = NULL, *country; - int i, count = 0; - char *pch, *pick_tmp, *pick_tmp2; - char *data = full_param+len_param; - uint len_data = strlen(data); - - /* Process country_list: - * country_list=[country1]:[ccode1]/[regrev1], - * [country2]:[ccode2]/[regrev2] \ - * Ex: country_list=US:US/0, TW:TW/1 - */ - if (!strncmp("ccode=", full_param, len_param)) { - len_data = min((uint)WLC_CNTRY_BUF_SZ, len_data); - memset(&conf->cspec, 0, sizeof(wl_country_t)); - memcpy(conf->cspec.country_abbrev, data, len_data); - memcpy(conf->cspec.ccode, data, len_data); - CONFIG_MSG("ccode = %s\n", conf->cspec.ccode); - } - else if (!strncmp("regrev=", full_param, len_param)) { - conf->cspec.rev = (int32)simple_strtol(data, NULL, 10); - CONFIG_MSG("regrev = %d\n", conf->cspec.rev); - } - else if (!strncmp("country_list=", full_param, len_param)) { - dhd_conf_free_country_list(conf); - pick_tmp = data; - for (i=0; icspec.country_abbrev, pch, 2); - pch = bcmstrtok(&pick_tmp2, "/", 0); - if (!pch) { - kfree(country); - break; - } - memcpy(country->cspec.ccode, pch, 2); - pch = bcmstrtok(&pick_tmp2, "/", 0); - if (!pch) { - kfree(country); - break; - } - country->cspec.rev = (int32)simple_strtol(pch, NULL, 10); - count++; - if (!conf->country_head) { - conf->country_head = country; - country_next = country; - } else { - country_next->next = country; - country_next = country; - } - CONFIG_TRACE("abbrev=%s, ccode=%s, regrev=%d\n", - country->cspec.country_abbrev, country->cspec.ccode, country->cspec.rev); - } - CONFIG_MSG("%d country in list\n", count); - } - else - return false; - - return true; -} - -bool -dhd_conf_read_mchan_params(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - int i; - char *pch, *pick_tmp, *pick_tmp2; - struct dhd_conf *conf = dhd->conf; - mchan_params_t *mchan_next = NULL, *mchan; - char *data = full_param+len_param; - - /* Process mchan_bw: - * mchan_bw=[val]/[any/go/gc]/[any/source/sink] - * Ex: mchan_bw=80/go/source, 30/gc/sink - */ - if (!strncmp("mchan_bw=", full_param, len_param)) { - dhd_conf_free_mchan_list(conf); - pick_tmp = data; - for (i=0; ibw = (int)simple_strtol(pch, NULL, 0); - if (mchan->bw < 0 || mchan->bw > 100) { - CONFIG_ERROR("wrong bw %d\n", mchan->bw); - kfree(mchan); - break; - } - - pch = bcmstrtok(&pick_tmp2, "/", 0); - if (!pch) { - kfree(mchan); - break; - } else { - if (bcmstrstr(pch, "any")) { - mchan->p2p_mode = -1; - } else if (bcmstrstr(pch, "go")) { - mchan->p2p_mode = WL_P2P_IF_GO; - } else if (bcmstrstr(pch, "gc")) { - mchan->p2p_mode = WL_P2P_IF_CLIENT; - } - } - pch = bcmstrtok(&pick_tmp2, "/", 0); - if (!pch) { - kfree(mchan); - break; - } else { - if (bcmstrstr(pch, "any")) { - mchan->miracast_mode = -1; - } else if (bcmstrstr(pch, "source")) { - mchan->miracast_mode = MIRACAST_SOURCE; - } else if (bcmstrstr(pch, "sink")) { - mchan->miracast_mode = MIRACAST_SINK; - } - } - if (!conf->mchan) { - conf->mchan = mchan; - mchan_next = mchan; - } else { - mchan_next->next = mchan; - mchan_next = mchan; - } - CONFIG_TRACE("mchan_bw=%d/%d/%d\n", mchan->bw,mchan->p2p_mode, - mchan->miracast_mode); - } - } - else - return false; - - return true; -} - -#ifdef PKT_FILTER_SUPPORT -bool -dhd_conf_read_pkt_filter(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - struct dhd_conf *conf = dhd->conf; - char *data = full_param+len_param; - char *pch, *pick_tmp; - int i; - - /* Process pkt filter: - * 1) pkt_filter_add=99 0 0 0 0x000000000000 0x000000000000 - * 2) pkt_filter_delete=100, 102, 103, 104, 105 - * 3) magic_pkt_filter_add=141 0 1 12 - */ - if (!strncmp("dhd_master_mode=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - dhd_master_mode = FALSE; - else - dhd_master_mode = TRUE; - CONFIG_MSG("dhd_master_mode = %d\n", dhd_master_mode); - } - else if (!strncmp("pkt_filter_add=", full_param, len_param)) { - pick_tmp = data; - pch = bcmstrtok(&pick_tmp, ",.-", 0); - i=0; - while (pch != NULL && ipkt_filter_add.filter[i][0], pch); - CONFIG_MSG("pkt_filter_add[%d][] = %s\n", - i, &conf->pkt_filter_add.filter[i][0]); - pch = bcmstrtok(&pick_tmp, ",.-", 0); - i++; - } - conf->pkt_filter_add.count = i; - } - else if (!strncmp("pkt_filter_delete=", full_param, len_param) || - !strncmp("pkt_filter_del=", full_param, len_param)) { - pick_tmp = data; - pch = bcmstrtok(&pick_tmp, " ,.-", 0); - i=0; - while (pch != NULL && ipkt_filter_del.id[i] = (uint32)simple_strtol(pch, NULL, 10); - pch = bcmstrtok(&pick_tmp, " ,.-", 0); - i++; - } - conf->pkt_filter_del.count = i; - CONFIG_MSG("pkt_filter_del id = "); - for (i=0; ipkt_filter_del.count; i++) - printf("%d ", conf->pkt_filter_del.id[i]); - printf("\n"); - } - else if (!strncmp("magic_pkt_filter_add=", full_param, len_param)) { - if (conf->magic_pkt_filter_add) { - kfree(conf->magic_pkt_filter_add); - conf->magic_pkt_filter_add = NULL; - } - if (!(conf->magic_pkt_filter_add = kmalloc(MAGIC_PKT_FILTER_LEN, GFP_KERNEL))) { - CONFIG_ERROR("kmalloc failed\n"); - } else { - memset(conf->magic_pkt_filter_add, 0, MAGIC_PKT_FILTER_LEN); - strcpy(conf->magic_pkt_filter_add, data); - CONFIG_MSG("magic_pkt_filter_add = %s\n", conf->magic_pkt_filter_add); - } - } - else - return false; - - return true; -} -#endif - -#ifdef ISAM_PREINIT -#if !defined(WL_EXT_IAPSTA) -#error "WL_EXT_IAPSTA should be defined to enable ISAM_PREINIT" -#endif /* !WL_EXT_IAPSTA */ -/* - * isam_init=mode [sta|ap|apsta|dualap] vifname [wlan1] - * isam_config=ifname [wlan0|wlan1] ssid [xxx] chan [x] - hidden [y|n] maxassoc [x] - amode [open|shared|wpapsk|wpa2psk|wpawpa2psk] - emode [none|wep|tkip|aes|tkipaes] - key [xxxxx] - * isam_enable=ifname [wlan0|wlan1] -*/ -bool -dhd_conf_read_isam(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - struct dhd_conf *conf = dhd->conf; - char *data = full_param+len_param; - - if (!strncmp("isam_init=", full_param, len_param)) { - sprintf(conf->isam_init, "isam_init %s", data); - CONFIG_MSG("isam_init=%s\n", conf->isam_init); - } - else if (!strncmp("isam_config=", full_param, len_param)) { - sprintf(conf->isam_config, "isam_config %s", data); - CONFIG_MSG("isam_config=%s\n", conf->isam_config); - } - else if (!strncmp("isam_enable=", full_param, len_param)) { - sprintf(conf->isam_enable, "isam_enable %s", data); - CONFIG_MSG("isam_enable=%s\n", conf->isam_enable); - } - else - return false; - - return true; -} -#endif - -#ifdef IDHCP -bool -dhd_conf_read_dhcp_params(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - struct dhd_conf *conf = dhd->conf; - char *data = full_param+len_param; - struct ipv4_addr ipa_set; - - if (!strncmp("dhcpc_enable=", full_param, len_param)) { - conf->dhcpc_enable = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("dhcpc_enable = %d\n", conf->dhcpc_enable); - } - else if (!strncmp("dhcpd_enable=", full_param, len_param)) { - conf->dhcpd_enable = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("dhcpd_enable = %d\n", conf->dhcpd_enable); - } - else if (!strncmp("dhcpd_ip_addr=", full_param, len_param)) { - if (!bcm_atoipv4(data, &ipa_set)) { - CONFIG_ERROR("dhcpd_ip_addr adress setting failed.n"); - return false; - } - memcpy(&conf->dhcpd_ip_addr, &ipa_set, sizeof(struct ipv4_addr)); - CONFIG_MSG("dhcpd_ip_addr = %s\n", data); - } - else if (!strncmp("dhcpd_ip_mask=", full_param, len_param)) { - if (!bcm_atoipv4(data, &ipa_set)) { - CONFIG_ERROR("dhcpd_ip_mask adress setting failed\n"); - return false; - } - memcpy(&conf->dhcpd_ip_mask, &ipa_set, sizeof(struct ipv4_addr)); - CONFIG_MSG("dhcpd_ip_mask = %s\n", data); - } - else if (!strncmp("dhcpd_ip_start=", full_param, len_param)) { - if (!bcm_atoipv4(data, &ipa_set)) { - CONFIG_ERROR("dhcpd_ip_start adress setting failed\n"); - return false; - } - memcpy(&conf->dhcpd_ip_start, &ipa_set, sizeof(struct ipv4_addr)); - CONFIG_MSG("dhcpd_ip_start = %s\n", data); - } - else if (!strncmp("dhcpd_ip_end=", full_param, len_param)) { - if (!bcm_atoipv4(data, &ipa_set)) { - CONFIG_ERROR("dhcpd_ip_end adress setting failed\n"); - return false; - } - memcpy(&conf->dhcpd_ip_end, &ipa_set, sizeof(struct ipv4_addr)); - CONFIG_MSG("dhcpd_ip_end = %s\n", data); - } - else - return false; - - return true; -} -#endif - -#ifdef BCMSDIO -bool -dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - struct dhd_conf *conf = dhd->conf; - char *data = full_param+len_param; - - if (!strncmp("dhd_doflow=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - dhd_doflow = FALSE; - else - dhd_doflow = TRUE; - CONFIG_MSG("dhd_doflow = %d\n", dhd_doflow); - } - else if (!strncmp("dhd_slpauto=", full_param, len_param) || - !strncmp("kso_enable=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - dhd_slpauto = FALSE; - else - dhd_slpauto = TRUE; - CONFIG_MSG("dhd_slpauto = %d\n", dhd_slpauto); - } - else if (!strncmp("use_rxchain=", full_param, len_param)) { - conf->use_rxchain = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("use_rxchain = %d\n", conf->use_rxchain); - } - else if (!strncmp("dhd_txminmax=", full_param, len_param)) { - conf->dhd_txminmax = (uint)simple_strtol(data, NULL, 10); - CONFIG_MSG("dhd_txminmax = %d\n", conf->dhd_txminmax); - } - else if (!strncmp("txinrx_thres=", full_param, len_param)) { - conf->txinrx_thres = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("txinrx_thres = %d\n", conf->txinrx_thres); - } -#if defined(HW_OOB) - else if (!strncmp("oob_enabled_later=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->oob_enabled_later = FALSE; - else - conf->oob_enabled_later = TRUE; - CONFIG_MSG("oob_enabled_later = %d\n", conf->oob_enabled_later); - } -#endif - else if (!strncmp("dpc_cpucore=", full_param, len_param)) { - conf->dpc_cpucore = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("dpc_cpucore = %d\n", conf->dpc_cpucore); - } - else if (!strncmp("rxf_cpucore=", full_param, len_param)) { - conf->rxf_cpucore = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("rxf_cpucore = %d\n", conf->rxf_cpucore); - } -#if defined(BCMSDIOH_TXGLOM) - else if (!strncmp("txglomsize=", full_param, len_param)) { - conf->txglomsize = (uint)simple_strtol(data, NULL, 10); - if (conf->txglomsize > SDPCM_MAXGLOM_SIZE) - conf->txglomsize = SDPCM_MAXGLOM_SIZE; - CONFIG_MSG("txglomsize = %d\n", conf->txglomsize); - } - else if (!strncmp("txglom_ext=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->txglom_ext = FALSE; - else - conf->txglom_ext = TRUE; - CONFIG_MSG("txglom_ext = %d\n", conf->txglom_ext); - if (conf->txglom_ext) { - if ((conf->chip == BCM43362_CHIP_ID) || (conf->chip == BCM4330_CHIP_ID)) - conf->txglom_bucket_size = 1680; - else if (conf->chip == BCM43340_CHIP_ID || conf->chip == BCM43341_CHIP_ID || - conf->chip == BCM4334_CHIP_ID || conf->chip == BCM4324_CHIP_ID) - conf->txglom_bucket_size = 1684; - } - CONFIG_MSG("txglom_bucket_size = %d\n", conf->txglom_bucket_size); - } - else if (!strncmp("bus:rxglom=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->bus_rxglom = FALSE; - else - conf->bus_rxglom = TRUE; - CONFIG_MSG("bus:rxglom = %d\n", conf->bus_rxglom); - } - else if (!strncmp("deferred_tx_len=", full_param, len_param)) { - conf->deferred_tx_len = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("deferred_tx_len = %d\n", conf->deferred_tx_len); - } - else if (!strncmp("txctl_tmo_fix=", full_param, len_param)) { - conf->txctl_tmo_fix = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("txctl_tmo_fix = %d\n", conf->txctl_tmo_fix); - } - else if (!strncmp("tx_max_offset=", full_param, len_param)) { - conf->tx_max_offset = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("tx_max_offset = %d\n", conf->tx_max_offset); - } - else if (!strncmp("txglom_mode=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->txglom_mode = FALSE; - else - conf->txglom_mode = TRUE; - CONFIG_MSG("txglom_mode = %d\n", conf->txglom_mode); - } -#if defined(SDIO_ISR_THREAD) - else if (!strncmp("intr_extn=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->intr_extn = FALSE; - else - conf->intr_extn = TRUE; - CONFIG_MSG("intr_extn = %d\n", conf->intr_extn); - } -#endif -#ifdef BCMSDIO_RXLIM_POST - else if (!strncmp("rxlim_en=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->rxlim_en = FALSE; - else - conf->rxlim_en = TRUE; - CONFIG_MSG("rxlim_en = %d\n", conf->rxlim_en); - } -#endif -#endif - else - return false; - - return true; -} -#endif - -#ifdef BCMPCIE -bool -dhd_conf_read_pcie_params(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - struct dhd_conf *conf = dhd->conf; - char *data = full_param+len_param; - - if (!strncmp("bus:deepsleep_disable=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->bus_deepsleep_disable = 0; - else - conf->bus_deepsleep_disable = 1; - CONFIG_MSG("bus:deepsleep_disable = %d\n", conf->bus_deepsleep_disable); - } - else - return false; - - return true; -} -#endif - -bool -dhd_conf_read_pm_params(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - struct dhd_conf *conf = dhd->conf; - char *data = full_param+len_param; - - if (!strncmp("deepsleep=", full_param, len_param)) { - if (!strncmp(data, "1", 1)) - conf->deepsleep = TRUE; - else - conf->deepsleep = FALSE; - CONFIG_MSG("deepsleep = %d\n", conf->deepsleep); - } - else if (!strncmp("PM=", full_param, len_param)) { - conf->pm = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("PM = %d\n", conf->pm); - } - else if (!strncmp("pm_in_suspend=", full_param, len_param)) { - conf->pm_in_suspend = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("pm_in_suspend = %d\n", conf->pm_in_suspend); - } - else if (!strncmp("suspend_mode=", full_param, len_param)) { - conf->suspend_mode = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("suspend_mode = %d\n", conf->suspend_mode); - if (conf->suspend_mode == PM_NOTIFIER) - conf->insuspend |= (NO_TXDATA_IN_SUSPEND | NO_TXCTL_IN_SUSPEND); - } - else if (!strncmp("suspend_bcn_li_dtim=", full_param, len_param)) { - conf->suspend_bcn_li_dtim = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("suspend_bcn_li_dtim = %d\n", conf->suspend_bcn_li_dtim); - } - else if (!strncmp("xmit_in_suspend=", full_param, len_param)) { - if (!strncmp(data, "1", 1)) - conf->insuspend &= ~NO_TXDATA_IN_SUSPEND; - else - conf->insuspend |= NO_TXDATA_IN_SUSPEND; - CONFIG_MSG("insuspend = 0x%x\n", conf->insuspend); - } - else if (!strncmp("insuspend=", full_param, len_param)) { - conf->insuspend = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("insuspend = 0x%x\n", conf->insuspend); - } -#ifdef WL_EXT_WOWL - else if (!strncmp("wowl=", full_param, len_param)) { - conf->wowl = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("wowl = 0x%x\n", conf->wowl); - } -#endif - else - return false; - - return true; -} - -#ifdef GET_CUSTOM_MAC_FROM_CONFIG -int -bcm_str2hex(const char *p, char *ea, int size) -{ - int i = 0; - char *ep; - - for (;;) { - ea[i++] = (char) bcm_strtoul(p, &ep, 16); - p = ep; - if (!*p++ || i == size) - break; - } - - return (i == size); -} -#endif - -bool -dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) -{ - struct dhd_conf *conf = dhd->conf; - char *data = full_param+len_param; - char *pch, *pick_tmp; - int i; -#ifdef GET_CUSTOM_MAC_FROM_CONFIG - struct ether_addr ea_addr; - char macpad[56]; -#endif - - if (!strncmp("dhd_poll=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->dhd_poll = 0; - else - conf->dhd_poll = 1; - CONFIG_MSG("dhd_poll = %d\n", conf->dhd_poll); - } - else if (!strncmp("dhd_watchdog_ms=", full_param, len_param)) { - dhd_watchdog_ms = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("dhd_watchdog_ms = %d\n", dhd_watchdog_ms); - } - else if (!strncmp("band=", full_param, len_param)) { - /* Process band: - * band=a for 5GHz only and band=b for 2.4GHz only - */ - if (!strcmp(data, "b")) - conf->band = WLC_BAND_2G; - else if (!strcmp(data, "a")) - conf->band = WLC_BAND_5G; - else - conf->band = WLC_BAND_AUTO; - CONFIG_MSG("band = %d\n", conf->band); - } - else if (!strncmp("bw_cap_2g=", full_param, len_param)) { - conf->bw_cap[0] = (uint)simple_strtol(data, NULL, 0); - CONFIG_MSG("bw_cap_2g = %d\n", conf->bw_cap[0]); - } - else if (!strncmp("bw_cap_5g=", full_param, len_param)) { - conf->bw_cap[1] = (uint)simple_strtol(data, NULL, 0); - CONFIG_MSG("bw_cap_5g = %d\n", conf->bw_cap[1]); - } - else if (!strncmp("bw_cap=", full_param, len_param)) { - pick_tmp = data; - pch = bcmstrtok(&pick_tmp, " ,.-", 0); - if (pch != NULL) { - conf->bw_cap[0] = (uint32)simple_strtol(pch, NULL, 0); - CONFIG_MSG("bw_cap 2g = %d\n", conf->bw_cap[0]); - } - pch = bcmstrtok(&pick_tmp, " ,.-", 0); - if (pch != NULL) { - conf->bw_cap[1] = (uint32)simple_strtol(pch, NULL, 0); - CONFIG_MSG("bw_cap 5g = %d\n", conf->bw_cap[1]); - } - } - else if (!strncmp("channels=", full_param, len_param)) { - pick_tmp = data; - pch = bcmstrtok(&pick_tmp, " ,.-", 0); - i=0; - while (pch != NULL && ichannels.channel[i] = (uint32)simple_strtol(pch, NULL, 10); - pch = bcmstrtok(&pick_tmp, " ,.-", 0); - i++; - } - conf->channels.count = i; - CONFIG_MSG("channels = "); - for (i=0; ichannels.count; i++) - printf("%d ", conf->channels.channel[i]); - printf("\n"); - } - else if (!strncmp("keep_alive_period=", full_param, len_param)) { - conf->keep_alive_period = (uint)simple_strtol(data, NULL, 10); - CONFIG_MSG("keep_alive_period = %d\n", conf->keep_alive_period); - } -#ifdef ARP_OFFLOAD_SUPPORT - else if (!strncmp("garp=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - conf->garp = FALSE; - else - conf->garp = TRUE; - CONFIG_MSG("garp = %d\n", conf->garp); - } -#endif - else if (!strncmp("srl=", full_param, len_param)) { - conf->srl = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("srl = %d\n", conf->srl); - } - else if (!strncmp("lrl=", full_param, len_param)) { - conf->lrl = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("lrl = %d\n", conf->lrl); - } - else if (!strncmp("bcn_timeout=", full_param, len_param)) { - conf->bcn_timeout= (uint)simple_strtol(data, NULL, 10); - CONFIG_MSG("bcn_timeout = %d\n", conf->bcn_timeout); - } - else if (!strncmp("frameburst=", full_param, len_param)) { - conf->frameburst = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("frameburst = %d\n", conf->frameburst); - } - else if (!strncmp("disable_proptx=", full_param, len_param)) { - conf->disable_proptx = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("disable_proptx = %d\n", conf->disable_proptx); - } -#ifdef DHDTCPACK_SUPPRESS - else if (!strncmp("tcpack_sup_mode=", full_param, len_param)) { - conf->tcpack_sup_mode = (uint)simple_strtol(data, NULL, 10); - CONFIG_MSG("tcpack_sup_mode = %d\n", conf->tcpack_sup_mode); - } -#endif - else if (!strncmp("pktprio8021x=", full_param, len_param)) { - conf->pktprio8021x = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("pktprio8021x = %d\n", conf->pktprio8021x); - } -#if defined(BCMSDIO) || defined(BCMPCIE) - else if (!strncmp("dhd_txbound=", full_param, len_param)) { - dhd_txbound = (uint)simple_strtol(data, NULL, 10); - CONFIG_MSG("dhd_txbound = %d\n", dhd_txbound); - } - else if (!strncmp("dhd_rxbound=", full_param, len_param)) { - dhd_rxbound = (uint)simple_strtol(data, NULL, 10); - CONFIG_MSG("dhd_rxbound = %d\n", dhd_rxbound); - } -#endif - else if (!strncmp("orphan_move=", full_param, len_param)) { - conf->orphan_move = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("orphan_move = %d\n", conf->orphan_move); - } - else if (!strncmp("tsq=", full_param, len_param)) { - conf->tsq = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("tsq = %d\n", conf->tsq); - } - else if (!strncmp("ctrl_resched=", full_param, len_param)) { - conf->ctrl_resched = (int)simple_strtol(data, NULL, 10); - CONFIG_MSG("ctrl_resched = %d\n", conf->ctrl_resched); - } - else if (!strncmp("in4way=", full_param, len_param)) { - conf->in4way = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("in4way = 0x%x\n", conf->in4way); - } - else if (!strncmp("wl_preinit=", full_param, len_param)) { - if (conf->wl_preinit) { - kfree(conf->wl_preinit); - conf->wl_preinit = NULL; - } - if (!(conf->wl_preinit = kmalloc(len_param+1, GFP_KERNEL))) { - CONFIG_ERROR("kmalloc failed\n"); - } else { - memset(conf->wl_preinit, 0, len_param+1); - strcpy(conf->wl_preinit, data); - CONFIG_MSG("wl_preinit = %s\n", conf->wl_preinit); - } - } - else if (!strncmp("wl_suspend=", full_param, len_param)) { - if (conf->wl_suspend) { - kfree(conf->wl_suspend); - conf->wl_suspend = NULL; - } - if (!(conf->wl_suspend = kmalloc(len_param+1, GFP_KERNEL))) { - CONFIG_ERROR("kmalloc failed\n"); - } else { - memset(conf->wl_suspend, 0, len_param+1); - strcpy(conf->wl_suspend, data); - CONFIG_MSG("wl_suspend = %s\n", conf->wl_suspend); - } - } - else if (!strncmp("wl_resume=", full_param, len_param)) { - if (conf->wl_resume) { - kfree(conf->wl_resume); - conf->wl_resume = NULL; - } - if (!(conf->wl_resume = kmalloc(len_param+1, GFP_KERNEL))) { - CONFIG_ERROR("kmalloc failed\n"); - } else { - memset(conf->wl_resume, 0, len_param+1); - strcpy(conf->wl_resume, data); - CONFIG_MSG("wl_resume = %s\n", conf->wl_resume); - } - } -#ifdef GET_CUSTOM_MAC_FROM_CONFIG - else if (!strncmp("mac=", full_param, len_param)) { - if (!bcm_ether_atoe(data, &ea_addr)) { - CONFIG_ERROR("mac adress read error"); - return false; - } - memcpy(&conf->hw_ether, &ea_addr, ETHER_ADDR_LEN); - CONFIG_MSG("mac = %s\n", data); - } - else if (!strncmp("macpad=", full_param, len_param)) { - if (!bcm_str2hex(data, macpad, sizeof(macpad))) { - CONFIG_ERROR("macpad adress read error"); - return false; - } - memcpy(&conf->hw_ether[ETHER_ADDR_LEN], macpad, sizeof(macpad)); - if (config_msg_level & CONFIG_TRACE_LEVEL) { - printf("macpad =\n"); - for (i=0; ihw_ether[ETHER_ADDR_LEN+i]); - if ((i+1)%8 == 0) - printf("\n"); - } - } - } -#endif -#ifdef PROPTX_MAXCOUNT - else if (!strncmp("proptx_maxcnt_2g=", full_param, len_param)) { - conf->proptx_maxcnt_2g = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("proptx_maxcnt_2g = 0x%x\n", conf->proptx_maxcnt_2g); - } - else if (!strncmp("proptx_maxcnt_5g=", full_param, len_param)) { - conf->proptx_maxcnt_5g = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("proptx_maxcnt_5g = 0x%x\n", conf->proptx_maxcnt_5g); - } -#endif - else - return false; - - return true; -} - -static int askey_dhd_conf_read_unifykeys_wifi_disable_5g_band(dhd_pub_t *dhd) { - int state = 0; - char wifi_disable_5g_band[8] = {0}; - char * wl_preinit = NULL; - int size = 0; - struct dhd_conf *conf = dhd->conf; - - for (state = 1; state > 0;) { - switch (state) { - case 1: - if (0 != getUnifyKey("wifi_disable_5g_band", wifi_disable_5g_band, sizeof(wifi_disable_5g_band))) { - state = -1; - break; - } - - if (conf->wl_preinit) { - // There is a setting for wl_preinit in the config file. - if (NULL != strstr(conf->wl_preinit, "disable_5g_band=")) { - /* Skip wifi_disable_5g_band of unifykeys because there - * is a setting for disable_5g_band in wl_preinit in the - * config file. - */ - state = 0; - break; - } - // Backup conf->wl_preinit - size = strlen(conf->wl_preinit) + 1; - wl_preinit = kmalloc(size, GFP_KERNEL); - memset(wl_preinit, 0, size); - strcpy(wl_preinit, conf->wl_preinit); - kfree(conf->wl_preinit); - conf->wl_preinit = NULL; - } - - // Create new wl_preinit with disable_5g_band and the backup wl_preinit - size = strlen("disable_5g_band=") + strlen("wifi_disable_5g_band"); - if (wl_preinit) { - size += strlen(",") + strlen(wl_preinit); - } - size++; - conf->wl_preinit = kmalloc(size, GFP_KERNEL); - memset(conf->wl_preinit, 0, size); - strcpy(conf->wl_preinit, "disable_5g_band="); - strcat(conf->wl_preinit, wifi_disable_5g_band); - if (wl_preinit) { - strcat(conf->wl_preinit, ","); - strcat(conf->wl_preinit, wl_preinit); - kfree(wl_preinit); - wl_preinit = NULL; - } - state = 0; - break; - - } - } - - return state; -} - -int -dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path) -{ - int bcmerror = -1, chip_match = -1; - uint len = 0, start_pos=0, end_pos=0; - void *image = NULL; - char *memblock = NULL; - char *bufp, *pick = NULL, *pch; - bool conf_file_exists; - uint len_param; - - conf_file_exists = ((conf_path != NULL) && (conf_path[0] != '\0')); - if (!conf_file_exists) { - CONFIG_MSG("config path %s\n", conf_path); - askey_dhd_conf_read_unifykeys_wifi_disable_5g_band(dhd); - return (0); - } - - if (conf_file_exists) { - image = dhd_os_open_image1(dhd, conf_path); - if (image == NULL) { - CONFIG_MSG("Ignore config file %s\n", conf_path); - goto err; - } - } - - memblock = MALLOC(dhd->osh, MAXSZ_CONFIG); - if (memblock == NULL) { - CONFIG_ERROR("Failed to allocate memory %d bytes\n", MAXSZ_CONFIG); - goto err; - } - - pick = MALLOC(dhd->osh, MAXSZ_BUF); - if (!pick) { - CONFIG_ERROR("Failed to allocate memory %d bytes\n", MAXSZ_BUF); - goto err; - } - - /* Read variables */ - if (conf_file_exists) { - len = dhd_os_get_image_block(memblock, MAXSZ_CONFIG, image); - } - if (len > 0 && len < MAXSZ_CONFIG) { - bufp = (char *)memblock; - bufp[len] = 0; - - while (start_pos < len) { - memset(pick, 0, MAXSZ_BUF); - end_pos = pick_config_vars(bufp, len, start_pos, pick, MAXSZ_BUF); - if (end_pos - start_pos >= MAXSZ_BUF) - CONFIG_ERROR("out of buf to read MAXSIZ_BUF=%d\n", MAXSZ_BUF); - start_pos = end_pos; - pch = strchr(pick, '='); - if (pch != NULL) { - len_param = pch-pick+1; - if (len_param == strlen(pick)) { - CONFIG_ERROR("not a right parameter %s\n", pick); - continue; - } - } else { - CONFIG_ERROR("not a right parameter %s\n", pick); - continue; - } - - dhd_conf_read_chiprev(dhd, &chip_match, pick, len_param); - if (!chip_match) - continue; - - if (dhd_conf_read_log_level(dhd, pick, len_param)) - continue; - else if (dhd_conf_read_roam_params(dhd, pick, len_param)) - continue; - else if (dhd_conf_read_wme_ac_params(dhd, pick, len_param)) - continue; -#ifdef BCMSDIO - else if (dhd_conf_read_fw_by_mac(dhd, pick, len_param)) - continue; - else if (dhd_conf_read_nv_by_mac(dhd, pick, len_param)) - continue; -#endif - else if (dhd_conf_read_nv_by_chip(dhd, pick, len_param)) - continue; - else if (dhd_conf_read_country(dhd, pick, len_param)) - continue; - else if (dhd_conf_read_mchan_params(dhd, pick, len_param)) - continue; -#ifdef PKT_FILTER_SUPPORT - else if (dhd_conf_read_pkt_filter(dhd, pick, len_param)) - continue; -#endif /* PKT_FILTER_SUPPORT */ -#ifdef ISAM_PREINIT - else if (dhd_conf_read_isam(dhd, pick, len_param)) - continue; -#endif /* ISAM_PREINIT */ -#ifdef IDHCP - else if (dhd_conf_read_dhcp_params(dhd, pick, len_param)) - continue; -#endif /* IDHCP */ -#ifdef BCMSDIO - else if (dhd_conf_read_sdio_params(dhd, pick, len_param)) - continue; -#endif /* BCMSDIO */ -#ifdef BCMPCIE - else if (dhd_conf_read_pcie_params(dhd, pick, len_param)) - continue; -#endif /* BCMPCIE */ - else if (dhd_conf_read_pm_params(dhd, pick, len_param)) - continue; - else if (dhd_conf_read_others(dhd, pick, len_param)) - continue; - else - continue; - } - - bcmerror = 0; - } else { - CONFIG_ERROR("error reading config file: %d\n", len); - bcmerror = BCME_SDIO_ERROR; - } - -err: - if (pick) - MFREE(dhd->osh, pick, MAXSZ_BUF); - - if (memblock) - MFREE(dhd->osh, memblock, MAXSZ_CONFIG); - - if (image) - dhd_os_close_image1(dhd, image); - - askey_dhd_conf_read_unifykeys_wifi_disable_5g_band(dhd); - - return bcmerror; -} - -int -dhd_conf_set_chiprev(dhd_pub_t *dhd, uint chip, uint chiprev) -{ - CONFIG_MSG("chip=0x%x, chiprev=%d\n", chip, chiprev); - dhd->conf->chip = chip; - dhd->conf->chiprev = chiprev; - return 0; -} - -uint -dhd_conf_get_chip(void *context) -{ - dhd_pub_t *dhd = context; - - if (dhd && dhd->conf) - return dhd->conf->chip; - return 0; -} - -uint -dhd_conf_get_chiprev(void *context) -{ - dhd_pub_t *dhd = context; - - if (dhd && dhd->conf) - return dhd->conf->chiprev; - return 0; -} - -#ifdef BCMSDIO -void -dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable) -{ - struct dhd_conf *conf = dhd->conf; - - if (enable) { -#if defined(BCMSDIOH_TXGLOM_EXT) - if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID || - conf->chip == BCM43340_CHIP_ID || conf->chip == BCM43341_CHIP_ID || - conf->chip == BCM4334_CHIP_ID || conf->chip == BCM4324_CHIP_ID) { - conf->txglom_mode = SDPCM_TXGLOM_CPY; - } -#endif - // other parameters set in preinit or config.txt - if (conf->txglom_ext) - CONFIG_MSG("txglom_ext=%d, txglom_bucket_size=%d\n", - conf->txglom_ext, conf->txglom_bucket_size); - CONFIG_MSG("txglom_mode=%s\n", - conf->txglom_mode==SDPCM_TXGLOM_MDESC?"multi-desc":"copy"); - CONFIG_MSG("txglomsize=%d, deferred_tx_len=%d\n", - conf->txglomsize, conf->deferred_tx_len); - CONFIG_MSG("txinrx_thres=%d, dhd_txminmax=%d\n", - conf->txinrx_thres, conf->dhd_txminmax); - CONFIG_MSG("tx_max_offset=%d, txctl_tmo_fix=%d\n", - conf->tx_max_offset, conf->txctl_tmo_fix); - } else { - // clear txglom parameters - conf->txglom_ext = FALSE; - conf->txglom_bucket_size = 0; - conf->txglomsize = 0; - conf->deferred_tx_len = 0; - } - -} -#endif - -void -dhd_conf_postinit_ioctls(dhd_pub_t *dhd) -{ - struct dhd_conf *conf = dhd->conf; - char wl_preinit[] = "assoc_retry_max=20"; -#ifdef NO_POWER_SAVE - char wl_no_power_save[] = "mpc=0, 86=0"; - dhd_conf_set_wl_cmd(dhd, wl_no_power_save, FALSE); -#endif - - dhd_conf_set_intiovar(dhd, WLC_UP, "WLC_UP", 0, 0, FALSE); - dhd_conf_map_country_list(dhd, &conf->cspec); - dhd_conf_set_country(dhd, &conf->cspec); - dhd_conf_fix_country(dhd); - dhd_conf_get_country(dhd, &dhd->dhd_cspec); - - dhd_conf_set_intiovar(dhd, WLC_SET_BAND, "WLC_SET_BAND", conf->band, 0, FALSE); - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bcn_timeout", conf->bcn_timeout, 0, FALSE); - dhd_conf_set_intiovar(dhd, WLC_SET_PM, "WLC_SET_PM", conf->pm, 0, FALSE); - dhd_conf_set_intiovar(dhd, WLC_SET_SRL, "WLC_SET_SRL", conf->srl, 0, FALSE); - dhd_conf_set_intiovar(dhd, WLC_SET_LRL, "WLC_SET_LRL", conf->lrl, 0, FALSE); - dhd_conf_set_bw_cap(dhd); - dhd_conf_set_roam(dhd); - -#if defined(BCMPCIE) - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bus:deepsleep_disable", - conf->bus_deepsleep_disable, 0, FALSE); -#endif /* defined(BCMPCIE) */ - -#ifdef IDHCP - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "dhcpc_enable", conf->dhcpc_enable, - 0, FALSE); - if (conf->dhcpd_enable >= 0) { - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "dhcpd_ip_addr", - (char *)&conf->dhcpd_ip_addr, sizeof(conf->dhcpd_ip_addr), FALSE); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "dhcpd_ip_mask", - (char *)&conf->dhcpd_ip_mask, sizeof(conf->dhcpd_ip_mask), FALSE); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "dhcpd_ip_start", - (char *)&conf->dhcpd_ip_start, sizeof(conf->dhcpd_ip_start), FALSE); - dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "dhcpd_ip_end", - (char *)&conf->dhcpd_ip_end, sizeof(conf->dhcpd_ip_end), FALSE); - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "dhcpd_enable", - conf->dhcpd_enable, 0, FALSE); - } -#endif - dhd_conf_set_intiovar(dhd, WLC_SET_FAKEFRAG, "WLC_SET_FAKEFRAG", - conf->frameburst, 0, FALSE); - - dhd_conf_set_wl_cmd(dhd, wl_preinit, TRUE); -#if defined(BCMSDIO) - { - char ampdu_mpdu[] = "ampdu_mpdu=16"; - dhd_conf_set_wl_cmd(dhd, ampdu_mpdu, TRUE); - } -#endif - if (conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || - conf->chip == BCM4371_CHIP_ID || conf->chip == BCM4359_CHIP_ID || - conf->chip == BCM43569_CHIP_ID || - conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID) { - dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "txbf", 1, 0, FALSE); - } -#if defined(WLEASYMESH) - { - char ezmesh[] = "mbss=1, rsdb_mode=0"; - dhd_conf_set_wl_cmd(dhd, ezmesh, TRUE); - } -#endif - dhd_conf_set_wl_cmd(dhd, conf->wl_preinit, TRUE); - -#ifndef WL_CFG80211 - dhd_conf_set_intiovar(dhd, WLC_UP, "WLC_UP", 0, 0, FALSE); -#endif - -} - -static int getUnifyKey(char * inKeyName, unsigned char * outValueBuf, unsigned int inValueBufSize) { - unsigned int keyLen = 0; - unsigned char * buf = NULL; - - if (NULL == inKeyName || NULL == outValueBuf || 0 == inValueBufSize) { - return -1; - } - memset(outValueBuf, 0, inValueBufSize); - if (key_unify_size(get_ukdev(), inKeyName, &keyLen) < 0) { - return -1; - } - if (0 == keyLen) { - return -1; - } - if ((sizeof(unsigned char) * keyLen) > inValueBufSize) { - return -1; - } - - if (NULL == (buf = kzalloc((sizeof(unsigned char) * keyLen), GFP_KERNEL))) { - return -1; - } - - if (key_unify_read(get_ukdev(), inKeyName, buf, keyLen, &keyLen) < 0) { - kfree(buf); - buf = NULL; - return -1; - } - - strcpy(outValueBuf, buf); - - if (NULL != buf) { - kfree(buf); - buf = NULL; - } - - return 0; -} - -char * kzalloc2getUnifyKey(char * inKeyName) { - unsigned int keyLen = 0; - unsigned char * buf = NULL; - - if (NULL == inKeyName) { - return NULL; - } - - if (key_unify_size(get_ukdev(), inKeyName, &keyLen) < 0) { - return NULL; - } - - if (0 == keyLen) { - return NULL; - } - - if (NULL == (buf = kzalloc(((sizeof(unsigned char) * keyLen) + 1), GFP_KERNEL))) { - return NULL; - } - - if (key_unify_read(get_ukdev(), inKeyName, buf, keyLen, &keyLen) < 0) { - kfree(buf); - buf = NULL; - return NULL; - } - - buf[keyLen] = '\0'; - - return buf; -} - -int askey_dhd_conf_preinit_by_sn(struct dhd_conf *conf) { - char * usid = NULL; - int i = 0; - struct { - char * country; - char * ccode; - int regrev; - } tbl[] = { - {"USA", "US", 1}, // the default MUST be put at the first place of this table - {"JPN", "JP", 58}, - {"AUS", "AU", 6}, - {"NZL", "NZ", 4}, - {"HKG", "HK", 2}, - {"CAN", "CA", 2}, - {"TWN", "TW", 1}, - {"CHN", "CN", 38}, - {"DEU", "DE", 7}, - {"FRA", "FR", 5}, - {"NLD", "NL", 4}, - {"ITA", "IT", 4}, - {"BGR", "BG", 4}, - {"HUN", "HU", 4}, - {"AUT", "AT", 4}, - {"RUS", "RU", 986}, - {"GBR", "GB", 6}, - {"BRA", "BR", 4}, - {"MEX", "MX", 20}, - {"IND", "IN", 3}, - {"PHL", "PH", 5}, - {"SGP", "SG", 0}, - {"MYS", "MY", 3}, - {"AND", "AD", 0}, - {"ARE", "AE", 6}, - {"ATG", "AG", 2}, - {"AIA", "AI", 1}, - {"ALB", "AL", 2}, - {"ASM", "AS", 12}, - {"ABW", "AW", 2}, - {"AZE", "AZ", 2}, - {"BIH", "BA", 2}, - {"BGD", "BD", 2}, - {"BEL", "BE", 4}, - {"BHR", "BH", 4}, - {"BMU", "BM", 12}, - {"BRN", "BN", 4}, - {"BRA", "BR", 4}, - {"BHS", "BS", 2}, - {"BLR", "BY", 3}, - {"CAN", "CA", 2}, - {"CHE", "CH", 4}, - {"COL", "CO", 17}, - {"CRI", "CR", 17}, - {"CYP", "CY", 4}, - {"CZE", "CZ", 4}, - {"DEU", "DE", 7}, - {"DNK", "DK", 4}, - {"ECU", "EC", 21}, - {"EST", "EE", 4}, - {"EGY", "EG", 0}, - {"ESP", "ES", 4}, - {"ETH", "ET", 2}, - {"FIN", "FI", 4}, - {"GRD", "GD", 2}, - {"GEO", "GE", 0}, - {"PYF", "GF", 2}, - {"GRC", "GR", 4}, - {"GTM", "GT", 1}, - {"GUM", "GU", 12}, - {"HRV", "HR", 4}, - {"IDN", "ID", 13}, - {"IRL", "IE", 5}, - {"ISR", "IL", 7}, - {"ISL", "IS", 4}, - {"ITA", "IT", 4}, - {"JOR", "JO", 3}, - {"KHM", "KH", 2}, - {"KOR", "KR", 57}, - {"KWT", "KW", 5}, - {"CYM", "KY", 3}, - {"LAO", "LA", 2}, - {"LBN", "LB", 5}, - {"LIE", "LI", 4}, - {"LKA", "LK", 1}, - {"LSO", "LS", 2}, - {"LTU", "LT", 4}, - {"LUX", "LU", 3}, - {"LVA", "LV", 4}, - {"MAR", "MA", 2}, - {"MCO", "MC", 1}, - {"MDA", "MD", 2}, - {"MNE", "ME", 2}, - {"MKD", "MK", 2}, - {"MNG", "MN", 1}, - {"MRT", "MR", 2}, - {"MLT", "MT", 4}, - {"MUS", "MU", 2}, - {"MDV", "MV", 3}, - {"MWI", "MW", 1}, - {"NIC", "NI", 2}, - {"NLD", "NL", 4}, - {"NOR", "NO", 4}, - {"NZL", "NZ", 4}, - {"OMN", "OM", 4}, - {"PAN", "PA", 17}, - {"PER", "PE", 20}, - {"POL", "PL", 4}, - {"PRI", "PR", 20}, - {"PRT", "PT", 4}, - {"PRY", "PY", 2}, - {"REU", "RE", 2}, - {"ROU", "RO", 4}, - {"SRB", "RS", 2}, - {"SWE", "SE", 4}, - {"SVN", "SI", 4}, - {"SVK", "SK", 4}, - {"SMR", "SM", 0}, - {"SOM", "SV", 19}, - {"THA", "TH", 5}, - {"TUN", "TN", 999}, - {"TUR", "TR", 7}, - {"TTO", "TT", 3}, - {"UKR", "UA", 16}, - {"VAT", "VA", 2}, - {"VEN", "VE", 3}, - {"VGB", "VG", 2}, - {"VNM", "VN", 4}, - {"MYT", "YT", 2}, - {"ZAF", "ZA", 6}, - {NULL, NULL, -1} - }; - - if (NULL == (usid = kzalloc2getUnifyKey("usid")) || strlen(usid) < 4) { - i = 0; // for using tbl[0] as the default - }else { - for (i = 0; NULL != tbl[i].country; i++) { - if (0 == strncmp(tbl[i].country, &usid[1], 3)) { - break; - } - } - } - if (NULL == tbl[i].country) { - i = 0; // for using tbl[0] as the default - } - strcpy(conf->cspec.country_abbrev, tbl[i].ccode); - strcpy(conf->cspec.ccode, tbl[i].ccode); - conf->cspec.rev = tbl[i].regrev; - - if (usid) { - kfree(usid); - usid = NULL; - } - - return 0; -} - -static int askey_dhd_conf_preinit(struct dhd_conf *conf) { - char * wifi_country_abbrev_ptr = NULL; - char wifi_country_abbrev[4] = {0}; - char wifi_ccode[4] = {0}; - char wifi_regrev[4] = {0}; - long regrev = 0; - - if (NULL == conf) { - return -1; - } - if (0 == getUnifyKey("wifi_ccode", wifi_ccode, sizeof(wifi_ccode)) && - 0 == getUnifyKey("wifi_regrev", wifi_regrev, sizeof(wifi_regrev)) && - 0 == kstrtol(wifi_regrev, 10, ®rev)) { - if (0 == getUnifyKey("wifi_country_abbrev", wifi_country_abbrev, sizeof(wifi_country_abbrev))) { - wifi_country_abbrev_ptr = wifi_country_abbrev; - }else { - wifi_country_abbrev_ptr = wifi_ccode; - } - strcpy(conf->cspec.country_abbrev, wifi_country_abbrev_ptr); - strcpy(conf->cspec.ccode, wifi_ccode); - conf->cspec.rev = regrev; - }else { - strcpy(conf->cspec.country_abbrev, "CN"); - strcpy(conf->cspec.ccode, "CN"); - conf->cspec.rev = 38; - } - return 0; -} - -int -dhd_conf_preinit(dhd_pub_t *dhd) -{ - struct dhd_conf *conf = dhd->conf; - - CONFIG_TRACE("Enter\n"); - -#ifdef BCMSDIO - dhd_conf_free_mac_list(&conf->fw_by_mac); - dhd_conf_free_mac_list(&conf->nv_by_mac); -#endif - dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); - dhd_conf_free_country_list(conf); - dhd_conf_free_mchan_list(conf); - if (conf->magic_pkt_filter_add) { - kfree(conf->magic_pkt_filter_add); - conf->magic_pkt_filter_add = NULL; - } - if (conf->wl_preinit) { - kfree(conf->wl_preinit); - conf->wl_preinit = NULL; - } - if (conf->wl_suspend) { - kfree(conf->wl_suspend); - conf->wl_suspend = NULL; - } - if (conf->wl_resume) { - kfree(conf->wl_resume); - conf->wl_resume = NULL; - } - conf->band = -1; - memset(&conf->bw_cap, -1, sizeof(conf->bw_cap)); - if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID) { - strcpy(conf->cspec.country_abbrev, "ALL"); - strcpy(conf->cspec.ccode, "ALL"); - conf->cspec.rev = 0; - } else if (conf->chip == BCM4335_CHIP_ID || conf->chip == BCM4339_CHIP_ID || - conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || - conf->chip == BCM4345_CHIP_ID || conf->chip == BCM4371_CHIP_ID || - conf->chip == BCM43569_CHIP_ID || conf->chip == BCM4359_CHIP_ID || - conf->chip == BCM4362_CHIP_ID || conf->chip == BCM43751_CHIP_ID) { -#if 1 - askey_dhd_conf_preinit(conf); - askey_dhd_conf_preinit_by_sn(conf); -#else - strcpy(conf->cspec.country_abbrev, "CN"); - strcpy(conf->cspec.ccode, "CN"); - conf->cspec.rev = 38; -#endif - } else { - strcpy(conf->cspec.country_abbrev, "CN"); - strcpy(conf->cspec.ccode, "CN"); - conf->cspec.rev = 0; - } - memset(&conf->channels, 0, sizeof(wl_channel_list_t)); - conf->roam_off = 1; - conf->roam_off_suspend = 1; - conf->roam_trigger[0] = -65; - conf->roam_trigger[1] = WLC_BAND_ALL; - conf->roam_scan_period[0] = 10; - conf->roam_scan_period[1] = WLC_BAND_ALL; - conf->roam_delta[0] = 10; - conf->roam_delta[1] = WLC_BAND_ALL; - conf->fullroamperiod = 20; - conf->keep_alive_period = 30000; -#ifdef ARP_OFFLOAD_SUPPORT - conf->garp = FALSE; -#endif - conf->force_wme_ac = 0; - memset(&conf->wme_sta, 0, sizeof(wme_param_t)); - memset(&conf->wme_ap, 0, sizeof(wme_param_t)); -#ifdef PKT_FILTER_SUPPORT - memset(&conf->pkt_filter_add, 0, sizeof(conf_pkt_filter_add_t)); - memset(&conf->pkt_filter_del, 0, sizeof(conf_pkt_filter_del_t)); -#endif - conf->srl = -1; - conf->lrl = -1; - conf->bcn_timeout = 16; - conf->disable_proptx = -1; - conf->dhd_poll = -1; -#ifdef BCMSDIO - conf->use_rxchain = 0; - conf->bus_rxglom = TRUE; - conf->txglom_ext = FALSE; - conf->tx_max_offset = 0; - conf->txglomsize = SDPCM_DEFGLOM_SIZE; - conf->txctl_tmo_fix = 300; - conf->txglom_mode = SDPCM_TXGLOM_MDESC; - conf->deferred_tx_len = 0; - conf->dhd_txminmax = 1; - conf->txinrx_thres = -1; -#if defined(SDIO_ISR_THREAD) - conf->intr_extn = FALSE; -#endif -#ifdef BCMSDIO_RXLIM_POST - conf->rxlim_en = TRUE; -#endif -#if defined(HW_OOB) - conf->oob_enabled_later = FALSE; -#endif -#endif -#ifdef BCMPCIE - conf->bus_deepsleep_disable = 1; -#endif - conf->dpc_cpucore = -1; - conf->rxf_cpucore = -1; - conf->frameburst = -1; - conf->deepsleep = FALSE; - conf->pm = -1; - conf->pm_in_suspend = -1; - conf->insuspend = 0; - conf->suspend_mode = EARLY_SUSPEND; - conf->suspend_bcn_li_dtim = -1; -#ifdef WL_EXT_WOWL - dhd_master_mode = TRUE; - conf->wowl = WL_WOWL_NET|WL_WOWL_DIS|WL_WOWL_BCN; - conf->insuspend |= (WOWL_IN_SUSPEND | NO_TXDATA_IN_SUSPEND); -#endif - if (conf->suspend_mode == PM_NOTIFIER) - conf->insuspend |= (NO_TXDATA_IN_SUSPEND | NO_TXCTL_IN_SUSPEND); - conf->suspended = FALSE; -#ifdef SUSPEND_EVENT - memset(&conf->resume_eventmask, 0, sizeof(conf->resume_eventmask)); - memset(&conf->bssid_insuspend, 0, ETHER_ADDR_LEN); - conf->wlfc = FALSE; -#endif -#ifdef GET_CUSTOM_MAC_FROM_CONFIG - memset(&conf->hw_ether, 0, sizeof(conf->hw_ether)); -#endif -#ifdef IDHCP - conf->dhcpc_enable = -1; - conf->dhcpd_enable = -1; -#endif - conf->orphan_move = 0; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) - conf->tsq = 10; -#else - conf->tsq = 0; -#endif -#ifdef DHDTCPACK_SUPPRESS -#ifdef BCMPCIE - conf->tcpack_sup_mode = TCPACK_SUP_HOLD; -#else - conf->tcpack_sup_mode = TCPACK_SUP_OFF; -#endif -#endif - conf->pktprio8021x = -1; - conf->ctrl_resched = 2; - conf->in4way = NO_SCAN_IN4WAY | DONT_DELETE_GC_AFTER_WPS | WAIT_DISCONNECTED; -#ifdef PROPTX_MAXCOUNT - conf->proptx_maxcnt_2g = 46; - conf->proptx_maxcnt_5g = WL_TXSTATUS_FREERUNCTR_MASK; -#endif /* DYNAMIC_PROPTX_MAXCOUNT */ -#ifdef ISAM_PREINIT - memset(conf->isam_init, 0, sizeof(conf->isam_init)); - memset(conf->isam_config, 0, sizeof(conf->isam_config)); - memset(conf->isam_enable, 0, sizeof(conf->isam_enable)); -#endif -#ifdef CUSTOMER_HW_AMLOGIC - dhd_slpauto = FALSE; -#ifdef BCMSDIO - conf->txglom_mode = SDPCM_TXGLOM_CPY; -#endif -#endif -#if defined(SDIO_ISR_THREAD) - if (conf->chip == BCM43012_CHIP_ID || - conf->chip == BCM4335_CHIP_ID || conf->chip == BCM4339_CHIP_ID || - conf->chip == BCM43454_CHIP_ID || conf->chip == BCM4345_CHIP_ID || - conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || - conf->chip == BCM4345_CHIP_ID || conf->chip == BCM4371_CHIP_ID || - conf->chip == BCM4359_CHIP_ID || - conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID) { - conf->intr_extn = TRUE; - } -#endif - if ((conf->chip == BCM43430_CHIP_ID && conf->chiprev == 2) || - conf->chip == BCM43012_CHIP_ID || - conf->chip == BCM4335_CHIP_ID || conf->chip == BCM4339_CHIP_ID || - conf->chip == BCM43454_CHIP_ID || conf->chip == BCM4345_CHIP_ID || - conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || - conf->chip == BCM4345_CHIP_ID || conf->chip == BCM4371_CHIP_ID || - conf->chip == BCM43569_CHIP_ID || conf->chip == BCM4359_CHIP_ID || - conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID) { -#ifdef DHDTCPACK_SUPPRESS -#ifdef BCMSDIO - conf->tcpack_sup_mode = TCPACK_SUP_REPLACE; -#endif -#endif -#if defined(BCMSDIO) || defined(BCMPCIE) - dhd_rxbound = 128; - dhd_txbound = 64; -#endif - conf->frameburst = 1; -#ifdef BCMSDIO - conf->dhd_txminmax = -1; - conf->txinrx_thres = 128; -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) - conf->orphan_move = 1; -#else - conf->orphan_move = 0; -#endif - } - -#ifdef BCMSDIO -#if defined(BCMSDIOH_TXGLOM_EXT) - if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID || - conf->chip == BCM43340_CHIP_ID || conf->chip == BCM43341_CHIP_ID || - conf->chip == BCM4334_CHIP_ID || conf->chip == BCM4324_CHIP_ID) { - conf->txglom_ext = TRUE; - } else { - conf->txglom_ext = FALSE; - } - if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID) { - conf->txglom_bucket_size = 1680; // fixed value, don't change - conf->txglomsize = 6; - } - if (conf->chip == BCM4334_CHIP_ID || conf->chip == BCM43340_CHIP_ID || - conf->chip == BCM43341_CHIP_ID || conf->chip == BCM4324_CHIP_ID) { - conf->txglom_bucket_size = 1684; // fixed value, don't change - conf->txglomsize = 16; - } -#endif - if (conf->txglomsize > SDPCM_MAXGLOM_SIZE) - conf->txglomsize = SDPCM_MAXGLOM_SIZE; -#endif - init_waitqueue_head(&conf->event_complete); - - return 0; -} - -int -dhd_conf_reset(dhd_pub_t *dhd) -{ - struct dhd_conf *conf = dhd->conf; - -#ifdef BCMSDIO - dhd_conf_free_mac_list(&conf->fw_by_mac); - dhd_conf_free_mac_list(&conf->nv_by_mac); -#endif - dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); - dhd_conf_free_country_list(conf); - dhd_conf_free_mchan_list(conf); - if (conf->magic_pkt_filter_add) { - kfree(conf->magic_pkt_filter_add); - conf->magic_pkt_filter_add = NULL; - } - if (conf->wl_preinit) { - kfree(conf->wl_preinit); - conf->wl_preinit = NULL; - } - if (conf->wl_suspend) { - kfree(conf->wl_suspend); - conf->wl_suspend = NULL; - } - if (conf->wl_resume) { - kfree(conf->wl_resume); - conf->wl_resume = NULL; - } - memset(conf, 0, sizeof(dhd_conf_t)); - return 0; -} - -int -dhd_conf_attach(dhd_pub_t *dhd) -{ - dhd_conf_t *conf; - - CONFIG_TRACE("Enter\n"); - - if (dhd->conf != NULL) { - CONFIG_MSG("config is attached before!\n"); - return 0; - } - /* Allocate private bus interface state */ - if (!(conf = MALLOC(dhd->osh, sizeof(dhd_conf_t)))) { - CONFIG_ERROR("MALLOC failed\n"); - goto fail; - } - memset(conf, 0, sizeof(dhd_conf_t)); - - dhd->conf = conf; - - return 0; - -fail: - if (conf != NULL) - MFREE(dhd->osh, conf, sizeof(dhd_conf_t)); - return BCME_NOMEM; -} - -void -dhd_conf_detach(dhd_pub_t *dhd) -{ - struct dhd_conf *conf = dhd->conf; - - CONFIG_TRACE("Enter\n"); - if (dhd->conf) { -#ifdef BCMSDIO - dhd_conf_free_mac_list(&conf->fw_by_mac); - dhd_conf_free_mac_list(&conf->nv_by_mac); -#endif - dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); - dhd_conf_free_country_list(conf); - dhd_conf_free_mchan_list(conf); - if (conf->magic_pkt_filter_add) { - kfree(conf->magic_pkt_filter_add); - conf->magic_pkt_filter_add = NULL; - } - if (conf->wl_preinit) { - kfree(conf->wl_preinit); - conf->wl_preinit = NULL; - } - if (conf->wl_suspend) { - kfree(conf->wl_suspend); - conf->wl_suspend = NULL; - } - if (conf->wl_resume) { - kfree(conf->wl_resume); - conf->wl_resume = NULL; - } - MFREE(dhd->osh, conf, sizeof(dhd_conf_t)); - } - dhd->conf = NULL; -} +extern void *get_ukdev(void); +extern int key_unify_read(void *ukdev, char *keyname, unsigned char *keydata, + unsigned int datalen, unsigned int *reallen); +extern int key_unify_size(void *ukdev, char *keyname, unsigned int *reallen); + +#include +#include + +#include +#include +#include +#include +#if defined(HW_OOB) || defined(FORCE_WOWLAN) +#include +#include +#include +#include +#endif +#ifdef WL_CFG80211 +#include +#endif + +#include +#include +#include + +static int getUnifyKey(char * inKeyName, unsigned char * outValueBuf, unsigned int inValueBufSize); +static int askey_dhd_conf_preinit(struct dhd_conf *conf); +static int askey_dhd_conf_read_unifykeys_wifi_disable_5g_band(dhd_pub_t *dhd); + +// kzalloc2getUnifyKey() will return a pointer to a memory allocated by kzalloc(). +// If the returned pointer is not NULL, remember to kfree the memory. +static char * kzalloc2getUnifyKey(char * inKeyName); +static int askey_dhd_conf_preinit_by_sn(struct dhd_conf *conf); + +/* message levels */ +#define CONFIG_ERROR_LEVEL (1 << 0) +#define CONFIG_TRACE_LEVEL (1 << 1) +#define CONFIG_MSG_LEVEL (1 << 0) + +uint config_msg_level = CONFIG_ERROR_LEVEL | CONFIG_MSG_LEVEL; +uint dump_msg_level = 0; + +#define CONFIG_MSG(x, args...) \ + do { \ + if (config_msg_level & CONFIG_MSG_LEVEL) { \ + printk(KERN_ERR "[dhd] %s : " x, __func__, ## args); \ + } \ + } while (0) +#define CONFIG_ERROR(x, args...) \ + do { \ + if (config_msg_level & CONFIG_ERROR_LEVEL) { \ + printk(KERN_ERR "[dhd] CONFIG-ERROR) %s : " x, __func__, ## args); \ + } \ + } while (0) +#define CONFIG_TRACE(x, args...) \ + do { \ + if (config_msg_level & CONFIG_TRACE_LEVEL) { \ + printk(KERN_INFO "[dhd] CONFIG-TRACE) %s : " x, __func__, ## args); \ + } \ + } while (0) + +#define MAXSZ_BUF 4096 +#define MAXSZ_CONFIG 8192 + +#ifndef WL_CFG80211 +#define htod32(i) i +#define htod16(i) i +#define dtoh32(i) i +#define dtoh16(i) i +#define htodchanspec(i) i +#define dtohchanspec(i) i +#endif + +#if defined(PROP_TXSTATUS) +#include +#endif /* PROP_TXSTATUS */ + +#define MAX_EVENT_BUF_NUM 16 +typedef struct eventmsg_buf { + u16 num; + struct { + u16 type; + bool set; + } event [MAX_EVENT_BUF_NUM]; +} eventmsg_buf_t; + +typedef struct cihp_name_map_t { + uint chip; + uint chiprev; + uint ag_type; + char *chip_name; + char *module_name; +} cihp_name_map_t; + +/* Map of WLC_E events to connection failure strings */ +#define DONT_CARE 9999 +const cihp_name_map_t chip_name_map[] = { + /* ChipID Chiprev AG ChipName ModuleName */ +#ifdef BCMSDIO + {BCM43362_CHIP_ID, 0, DONT_CARE, "bcm40181a0", ""}, + {BCM43362_CHIP_ID, 1, DONT_CARE, "bcm40181a2", ""}, + {BCM4330_CHIP_ID, 4, FW_TYPE_G, "bcm40183b2", ""}, + {BCM4330_CHIP_ID, 4, FW_TYPE_AG, "bcm40183b2_ag", ""}, + {BCM43430_CHIP_ID, 0, DONT_CARE, "bcm43438a0", "ap6212"}, + {BCM43430_CHIP_ID, 1, DONT_CARE, "bcm43438a1", "ap6212a"}, + {BCM43430_CHIP_ID, 2, DONT_CARE, "bcm43436b0", "ap6236"}, + {BCM43012_CHIP_ID, 1, FW_TYPE_G, "bcm43013b0", ""}, + {BCM43012_CHIP_ID, 1, FW_TYPE_AG, "bcm43013c0_ag", ""}, + {BCM43012_CHIP_ID, 2, DONT_CARE, "bcm43013c1_ag", ""}, + {BCM4334_CHIP_ID, 3, DONT_CARE, "bcm4334b1_ag", ""}, + {BCM43340_CHIP_ID, 2, DONT_CARE, "bcm43341b0_ag", ""}, + {BCM43341_CHIP_ID, 2, DONT_CARE, "bcm43341b0_ag", ""}, + {BCM4324_CHIP_ID, 5, DONT_CARE, "bcm43241b4_ag", ""}, + {BCM4335_CHIP_ID, 2, DONT_CARE, "bcm4339a0_ag", ""}, + {BCM4339_CHIP_ID, 1, DONT_CARE, "bcm4339a0_ag", "ap6335"}, + {BCM4345_CHIP_ID, 6, DONT_CARE, "bcm43455c0_ag", "ap6255"}, + {BCM43454_CHIP_ID, 6, DONT_CARE, "bcm43455c0_ag", ""}, + {BCM4345_CHIP_ID, 9, DONT_CARE, "bcm43456c5_ag", "ap6256"}, + {BCM43454_CHIP_ID, 9, DONT_CARE, "bcm43456c5_ag", ""}, + {BCM4354_CHIP_ID, 1, DONT_CARE, "bcm4354a1_ag", ""}, + {BCM4354_CHIP_ID, 2, DONT_CARE, "bcm4356a2_ag", "ap6356"}, + {BCM4356_CHIP_ID, 2, DONT_CARE, "bcm4356a2_ag", ""}, + {BCM4371_CHIP_ID, 2, DONT_CARE, "bcm4356a2_ag", ""}, + {BCM43569_CHIP_ID, 3, DONT_CARE, "bcm4358a3_ag", ""}, + {BCM4359_CHIP_ID, 5, DONT_CARE, "bcm4359b1_ag", ""}, + {BCM4359_CHIP_ID, 9, DONT_CARE, "bcm4359c0_ag", "ap6398s"}, + {BCM43751_CHIP_ID, 1, DONT_CARE, "bcm43751a1_ag", ""}, + {BCM43751_CHIP_ID, 2, DONT_CARE, "bcm43751a2_ag", ""}, + {BCM43752_CHIP_ID, 1, DONT_CARE, "bcm43752a1_ag", ""}, + {BCM43752_CHIP_ID, 2, DONT_CARE, "bcm43752a2_ag", ""}, +#endif +#ifdef BCMPCIE + {BCM4354_CHIP_ID, 2, DONT_CARE, "bcm4356a2_pcie_ag", ""}, + {BCM4356_CHIP_ID, 2, DONT_CARE, "bcm4356a2_pcie_ag", ""}, + {BCM4359_CHIP_ID, 9, DONT_CARE, "bcm4359c0_pcie_ag", ""}, + {BCM43751_CHIP_ID, 1, DONT_CARE, "bcm43751a1_pcie_ag", ""}, + {BCM43751_CHIP_ID, 2, DONT_CARE, "bcm43751a2_pcie_ag", ""}, + {BCM43752_CHIP_ID, 1, DONT_CARE, "bcm43752a1_pcie_ag", ""}, + {BCM43752_CHIP_ID, 2, DONT_CARE, "bcm43752a2_pcie_ag", ""}, +#endif +#ifdef BCMDBUS + {BCM43143_CHIP_ID, 2, DONT_CARE, "bcm43143b0", ""}, + {BCM43242_CHIP_ID, 1, DONT_CARE, "bcm43242a1_ag", ""}, + {BCM43569_CHIP_ID, 2, DONT_CARE, "bcm4358u_ag", "ap62x8"}, +#endif +}; + +void +dhd_conf_free_chip_nv_path_list(wl_chip_nv_path_list_ctrl_t *chip_nv_list) +{ + CONFIG_TRACE("called\n"); + + if (chip_nv_list->m_chip_nv_path_head) { + CONFIG_TRACE("Free %p\n", chip_nv_list->m_chip_nv_path_head); + kfree(chip_nv_list->m_chip_nv_path_head); + } + chip_nv_list->count = 0; +} + +#ifdef BCMSDIO +void +dhd_conf_free_mac_list(wl_mac_list_ctrl_t *mac_list) +{ + int i; + + CONFIG_TRACE("called\n"); + if (mac_list->m_mac_list_head) { + for (i=0; icount; i++) { + if (mac_list->m_mac_list_head[i].mac) { + CONFIG_TRACE("Free mac %p\n", mac_list->m_mac_list_head[i].mac); + kfree(mac_list->m_mac_list_head[i].mac); + } + } + CONFIG_TRACE("Free m_mac_list_head %p\n", mac_list->m_mac_list_head); + kfree(mac_list->m_mac_list_head); + } + mac_list->count = 0; +} + +#if defined(HW_OOB) || defined(FORCE_WOWLAN) +void +dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, struct si_pub *sih) +{ + uint32 gpiocontrol, addr; + + if (CHIPID(sih->chip) == BCM43362_CHIP_ID) { + CONFIG_MSG("Enable HW OOB for 43362\n"); + addr = SI_ENUM_BASE(sih) + OFFSETOF(chipcregs_t, gpiocontrol); + gpiocontrol = bcmsdh_reg_read(sdh, addr, 4); + gpiocontrol |= 0x2; + bcmsdh_reg_write(sdh, addr, 4, gpiocontrol); + bcmsdh_cfg_write(sdh, SDIO_FUNC_1, 0x10005, 0xf, NULL); + bcmsdh_cfg_write(sdh, SDIO_FUNC_1, 0x10006, 0x0, NULL); + bcmsdh_cfg_write(sdh, SDIO_FUNC_1, 0x10007, 0x2, NULL); + } +} +#endif + +#define SBSDIO_CIS_SIZE_LIMIT 0x200 +void +dhd_conf_get_otp(dhd_pub_t *dhd, bcmsdh_info_t *sdh, si_t *sih) +{ + int i, err = -1; + uint8 *ptr = 0, *ptpl_code = NULL; + unsigned char tpl_code, tpl_link='\0'; + uint8 mac_header[3] = {0x80, 0x07, 0x19}; + uint8 *cis; + + if (!(cis = MALLOC(dhd->osh, SBSDIO_CIS_SIZE_LIMIT))) { + CONFIG_ERROR("cis malloc failed\n"); + } + bzero(cis, SBSDIO_CIS_SIZE_LIMIT); + + if ((err = bcmsdh_cis_read(sdh, 0, cis, SBSDIO_CIS_SIZE_LIMIT))) { + CONFIG_ERROR("cis read err %d\n", err); + MFREE(dhd->osh, cis, SBSDIO_CIS_SIZE_LIMIT); + return; + } + ptr = cis; + do { + /* 0xff means we're done */ + tpl_code = *ptr; + ptpl_code = ptr; + ptr++; + if (tpl_code == 0xff) + break; + + /* null entries have no link field or data */ + if (tpl_code == 0x00) + continue; + + tpl_link = *ptr; + ptr++; + /* a size of 0xff also means we're done */ + if (tpl_link == 0xff) + break; + if (config_msg_level & CONFIG_TRACE_LEVEL) { + prhex("TPL", ptpl_code, tpl_link+2); + } + + if (tpl_code == 0x80 && tpl_link == 0x07 && *ptr == 0x19) { + memcpy(&dhd->conf->otp_mac, ptr+1, 6); + } +#ifdef GET_OTP_MODULE_NAME + else if (tpl_code == 0x8e && *ptr == 0x41) { + int len = tpl_link - 1; + if (len <= sizeof(dhd->conf->module_name) - 1) { + strncpy(dhd->conf->module_name, ptr+1, len); + CONFIG_MSG("module_name=%s\n", dhd->conf->module_name); + } else { + CONFIG_ERROR("len is too long %d >= %d\n", + len, (int)sizeof(dhd->conf->module_name) - 1); + } + } +#endif + + ptr += tpl_link; + } while (1); + + if (!memcmp(ðer_null, &dhd->conf->otp_mac, ETHER_ADDR_LEN)) { + ptr = cis; + /* Special OTP */ + if (bcmsdh_reg_read(sdh, SI_ENUM_BASE(sih), 4) == 0x16044330) { + for (i=0; iconf->otp_mac, ptr+3, 6); + break; + } + ptr++; + } + } + } + + ASSERT(cis); + MFREE(dhd->osh, cis, SBSDIO_CIS_SIZE_LIMIT); +} + +void +dhd_conf_set_fw_name_by_mac(dhd_pub_t *dhd, char *fw_path) +{ + int i, j; + uint8 *mac = (uint8 *)&dhd->conf->otp_mac; + int fw_num=0, mac_num=0; + uint32 oui, nic; + wl_mac_list_t *mac_list; + wl_mac_range_t *mac_range; + int fw_type, fw_type_new; + char *name_ptr; + + mac_list = dhd->conf->fw_by_mac.m_mac_list_head; + fw_num = dhd->conf->fw_by_mac.count; + if (!mac_list || !fw_num) + return; + + oui = (mac[0] << 16) | (mac[1] << 8) | (mac[2]); + nic = (mac[3] << 16) | (mac[4] << 8) | (mac[5]); + + /* find out the last '/' */ + i = strlen(fw_path); + while (i > 0) { + if (fw_path[i] == '/') { + i++; + break; + } + i--; + } + name_ptr = &fw_path[i]; + + if (strstr(name_ptr, "_apsta")) + fw_type = FW_TYPE_APSTA; + else if (strstr(name_ptr, "_p2p")) + fw_type = FW_TYPE_P2P; + else if (strstr(name_ptr, "_mesh")) + fw_type = FW_TYPE_MESH; + else if (strstr(name_ptr, "_es")) + fw_type = FW_TYPE_ES; + else if (strstr(name_ptr, "_mfg")) + fw_type = FW_TYPE_MFG; + else + fw_type = FW_TYPE_STA; + + for (i=0; i= mac_range[j].nic_start && nic <= mac_range[j].nic_end) { + strcpy(name_ptr, mac_list[i].name); + CONFIG_MSG("matched oui=0x%06X, nic=0x%06X\n", oui, nic); + CONFIG_MSG("fw_path=%s\n", fw_path); + return; + } + } + } + } +} + +void +dhd_conf_set_nv_name_by_mac(dhd_pub_t *dhd, char *nv_path) +{ + int i, j; + uint8 *mac = (uint8 *)&dhd->conf->otp_mac; + int nv_num=0, mac_num=0; + uint32 oui, nic; + wl_mac_list_t *mac_list; + wl_mac_range_t *mac_range; + char *pnv_name; + + mac_list = dhd->conf->nv_by_mac.m_mac_list_head; + nv_num = dhd->conf->nv_by_mac.count; + if (!mac_list || !nv_num) + return; + + oui = (mac[0] << 16) | (mac[1] << 8) | (mac[2]); + nic = (mac[3] << 16) | (mac[4] << 8) | (mac[5]); + + /* find out the last '/' */ + i = strlen(nv_path); + while (i > 0) { + if (nv_path[i] == '/') break; + i--; + } + pnv_name = &nv_path[i+1]; + + for (i=0; i= mac_range[j].nic_start && nic <= mac_range[j].nic_end) { + strcpy(pnv_name, mac_list[i].name); + CONFIG_MSG("matched oui=0x%06X, nic=0x%06X\n", oui, nic); + CONFIG_MSG("nv_path=%s\n", nv_path); + return; + } + } + } + } +} +#endif + +void +dhd_conf_free_country_list(struct dhd_conf *conf) +{ + country_list_t *country = conf->country_head; + int count = 0; + + CONFIG_TRACE("called\n"); + while (country) { + CONFIG_TRACE("Free cspec %s\n", country->cspec.country_abbrev); + conf->country_head = country->next; + kfree(country); + country = conf->country_head; + count++; + } + CONFIG_TRACE("%d country released\n", count); +} + +void +dhd_conf_free_mchan_list(struct dhd_conf *conf) +{ + mchan_params_t *mchan = conf->mchan; + int count = 0; + + CONFIG_TRACE("called\n"); + while (mchan) { + CONFIG_TRACE("Free cspec %p\n", mchan); + conf->mchan = mchan->next; + kfree(mchan); + mchan = conf->mchan; + count++; + } + CONFIG_TRACE("%d mchan released\n", count); +} + +int +dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path) +{ + int fw_type, ag_type; + uint chip, chiprev; + int i; + char *name_ptr; + + chip = dhd->conf->chip; + chiprev = dhd->conf->chiprev; + + if (fw_path[0] == '\0') { +#ifdef CONFIG_BCMDHD_FW_PATH + bcm_strncpy_s(fw_path, MOD_PARAM_PATHLEN-1, CONFIG_BCMDHD_FW_PATH, MOD_PARAM_PATHLEN-1); + if (fw_path[0] == '\0') +#endif + { + CONFIG_MSG("firmware path is null\n"); + return 0; + } + } +#ifndef FW_PATH_AUTO_SELECT + return DONT_CARE; +#endif + + /* find out the last '/' */ + i = strlen(fw_path); + while (i > 0) { + if (fw_path[i] == '/') { + i++; + break; + } + i--; + } + name_ptr = &fw_path[i]; +#ifdef BAND_AG + ag_type = FW_TYPE_AG; +#else + ag_type = strstr(name_ptr, "_ag") ? FW_TYPE_AG : FW_TYPE_G; +#endif + if (strstr(name_ptr, "_apsta")) + fw_type = FW_TYPE_APSTA; + else if (strstr(name_ptr, "_p2p")) + fw_type = FW_TYPE_P2P; + else if (strstr(name_ptr, "_mesh")) + fw_type = FW_TYPE_MESH; + else if (strstr(name_ptr, "_es")) + fw_type = FW_TYPE_ES; + else if (strstr(name_ptr, "_mfg")) + fw_type = FW_TYPE_MFG; + else + fw_type = FW_TYPE_STA; + + for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { + const cihp_name_map_t* row = &chip_name_map[i]; + if (row->chip == chip && row->chiprev == chiprev && + (row->ag_type == ag_type || row->ag_type == DONT_CARE)) { + strcpy(name_ptr, "fw_"); + strcat(fw_path, row->chip_name); +#ifdef BCMUSBDEV_COMPOSITE + strcat(fw_path, "_cusb"); +#endif + if (fw_type == FW_TYPE_APSTA) + strcat(fw_path, "_apsta.bin"); + else if (fw_type == FW_TYPE_P2P) + strcat(fw_path, "_p2p.bin"); + else if (fw_type == FW_TYPE_MESH) + strcat(fw_path, "_mesh.bin"); + else if (fw_type == FW_TYPE_ES) + strcat(fw_path, "_es.bin"); + else if (fw_type == FW_TYPE_MFG) + strcat(fw_path, "_mfg.bin"); + else + strcat(fw_path, ".bin"); + } + } + + dhd->conf->fw_type = fw_type; + + CONFIG_TRACE("firmware_path=%s\n", fw_path); + return ag_type; +} + +void +dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path, int ag_type) +{ + uint chip, chiprev; + int i; + char *name_ptr; + + chip = dhd->conf->chip; + chiprev = dhd->conf->chiprev; + + if (clm_path[0] == '\0') { + CONFIG_MSG("clm path is null\n"); + return; + } + + /* find out the last '/' */ + i = strlen(clm_path); + while (i > 0) { + if (clm_path[i] == '/') { + i++; + break; + } + i--; + } + name_ptr = &clm_path[i]; + + for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { + const cihp_name_map_t* row = &chip_name_map[i]; + if (row->chip == chip && row->chiprev == chiprev && + (row->ag_type == ag_type || row->ag_type == DONT_CARE)) { + strcpy(name_ptr, "clm_"); + strcat(clm_path, row->chip_name); + strcat(clm_path, ".blob"); + } + } + + CONFIG_TRACE("clm_path=%s\n", clm_path); +} + +void +dhd_conf_set_nv_name_by_chip(dhd_pub_t *dhd, char *nv_path, int ag_type) +{ + uint chip, chiprev; + int i; + char *name_ptr; + + chip = dhd->conf->chip; + chiprev = dhd->conf->chiprev; + + if (nv_path[0] == '\0') { +#ifdef CONFIG_BCMDHD_NVRAM_PATH + bcm_strncpy_s(nv_path, MOD_PARAM_PATHLEN-1, CONFIG_BCMDHD_NVRAM_PATH, MOD_PARAM_PATHLEN-1); + if (nv_path[0] == '\0') +#endif + { + CONFIG_MSG("nvram path is null\n"); + return; + } + } + + /* find out the last '/' */ + i = strlen(nv_path); + while (i > 0) { + if (nv_path[i] == '/') { + i++; + break; + } + i--; + } + name_ptr = &nv_path[i]; + + for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { + const cihp_name_map_t* row = &chip_name_map[i]; + if (row->chip == chip && row->chiprev == chiprev && + (row->ag_type == ag_type || row->ag_type == DONT_CARE)) { +#ifdef GET_OTP_MODULE_NAME + if (strlen(dhd->conf->module_name)) { + strcpy(name_ptr, "nvram_"); + strcat(name_ptr, dhd->conf->module_name); + } else +#endif + if (strlen(row->module_name)){ + strcpy(name_ptr, "nvram_"); + strcat(name_ptr, row->module_name); + } else + continue; +#ifdef BCMUSBDEV_COMPOSITE + strcat(name_ptr, "_cusb"); +#endif + strcat(name_ptr, ".txt"); + } + } + + for (i=0; iconf->nv_by_chip.count; i++) { + if (chip==dhd->conf->nv_by_chip.m_chip_nv_path_head[i].chip && + chiprev==dhd->conf->nv_by_chip.m_chip_nv_path_head[i].chiprev) { + strcpy(name_ptr, dhd->conf->nv_by_chip.m_chip_nv_path_head[i].name); + break; + } + } + + CONFIG_TRACE("nvram_path=%s\n", nv_path); +} + +void +dhd_conf_copy_path(dhd_pub_t *dhd, char *dst_name, char *dst_path, char *src_path) +{ + int i; + + if (src_path[0] == '\0') { + CONFIG_MSG("src_path is null\n"); + return; + } else + strcpy(dst_path, src_path); + + /* find out the last '/' */ + i = strlen(dst_path); + while (i > 0) { + if (dst_path[i] == '/') { + i++; + break; + } + i--; + } + strcpy(&dst_path[i], dst_name); + + CONFIG_TRACE("dst_path=%s\n", dst_path); +} + +#ifdef CONFIG_PATH_AUTO_SELECT +void +dhd_conf_set_conf_name_by_chip(dhd_pub_t *dhd, char *conf_path) +{ + uint chip, chiprev; + int i; + char *name_ptr; + + chip = dhd->conf->chip; + chiprev = dhd->conf->chiprev; + + if (conf_path[0] == '\0') { + CONFIG_MSG("config path is null\n"); + return; + } + + /* find out the last '/' */ + i = strlen(conf_path); + while (i > 0) { + if (conf_path[i] == '/') { + i++; + break; + } + i--; + } + name_ptr = &conf_path[i]; + + for (i = 0; i < sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { + const cihp_name_map_t* row = &chip_name_map[i]; + if (row->chip == chip && row->chiprev == chiprev) { + strcpy(name_ptr, "config_"); + strcat(conf_path, row->chip_name); + strcat(conf_path, ".txt"); + } + } + + CONFIG_TRACE("config_path=%s\n", conf_path); +} +#endif + +void +dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path) +{ + int ag_type; + + /* External conf takes precedence if specified */ + dhd_conf_preinit(dhd); + + if (dhd->conf_path[0] == '\0') { + dhd_conf_copy_path(dhd, "config.txt", dhd->conf_path, nv_path); + } + if (dhd->clm_path[0] == '\0') { + dhd_conf_copy_path(dhd, "clm.blob", dhd->clm_path, fw_path); + } +#ifdef CONFIG_PATH_AUTO_SELECT + dhd_conf_set_conf_name_by_chip(dhd, dhd->conf_path); +#endif + + dhd_conf_read_config(dhd, dhd->conf_path); + + ag_type = dhd_conf_set_fw_name_by_chip(dhd, fw_path); + dhd_conf_set_nv_name_by_chip(dhd, nv_path, ag_type); + dhd_conf_set_clm_name_by_chip(dhd, dhd->clm_path, ag_type); +#ifdef BCMSDIO + dhd_conf_set_fw_name_by_mac(dhd, fw_path); + dhd_conf_set_nv_name_by_mac(dhd, nv_path); +#endif + + CONFIG_MSG("Final fw_path=%s\n", fw_path); + CONFIG_MSG("Final nv_path=%s\n", nv_path); + CONFIG_MSG("Final clm_path=%s\n", dhd->clm_path); + CONFIG_MSG("Final conf_path=%s\n", dhd->conf_path); +} + +int +dhd_conf_set_intiovar(dhd_pub_t *dhd, uint cmd, char *name, int val, + int def, bool down) +{ + int ret = -1; + char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ + + if (val >= def) { + if (down) { + if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, 0)) < 0) + CONFIG_ERROR("WLC_DOWN setting failed %d\n", ret); + } + if (cmd == WLC_SET_VAR) { + CONFIG_TRACE("set %s %d\n", name, val); + bcm_mkiovar(name, (char *)&val, sizeof(val), iovbuf, sizeof(iovbuf)); + if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) + CONFIG_ERROR("%s setting failed %d\n", name, ret); + } else { + CONFIG_TRACE("set %s %d %d\n", name, cmd, val); + if ((ret = dhd_wl_ioctl_cmd(dhd, cmd, &val, sizeof(val), TRUE, 0)) < 0) + CONFIG_ERROR("%s setting failed %d\n", name, ret); + } + } + + return ret; +} + +int +dhd_conf_set_bufiovar(dhd_pub_t *dhd, int ifidx, uint cmd, char *name, + char *buf, int len, bool down) +{ + char iovbuf[WLC_IOCTL_SMLEN]; + s32 iovar_len; + int ret = -1; + + if (down) { + if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, ifidx)) < 0) + CONFIG_ERROR("WLC_DOWN setting failed %d\n", ret); + } + + if (cmd == WLC_SET_VAR) { + iovar_len = bcm_mkiovar(name, buf, len, iovbuf, sizeof(iovbuf)); + if (iovar_len > 0) + ret = dhd_wl_ioctl_cmd(dhd, cmd, iovbuf, iovar_len, TRUE, ifidx); + else + ret = BCME_BUFTOOSHORT; + if (ret < 0) + CONFIG_ERROR("%s setting failed %d, len=%d\n", name, ret, len); + } else { + if ((ret = dhd_wl_ioctl_cmd(dhd, cmd, buf, len, TRUE, ifidx)) < 0) + CONFIG_ERROR("%s setting failed %d\n", name, ret); + } + + return ret; +} + +int +dhd_conf_get_iovar(dhd_pub_t *dhd, int ifidx, int cmd, char *name, + char *buf, int len) +{ + char iovbuf[WLC_IOCTL_SMLEN]; + int ret = -1; + + if (cmd == WLC_GET_VAR) { + if (bcm_mkiovar(name, NULL, 0, iovbuf, sizeof(iovbuf))) { + ret = dhd_wl_ioctl_cmd(dhd, cmd, iovbuf, sizeof(iovbuf), FALSE, ifidx); + if (!ret) { + memcpy(buf, iovbuf, len); + } else { + CONFIG_ERROR("get iovar %s failed %d\n", name, ret); + } + } else { + CONFIG_ERROR("mkiovar %s failed\n", name); + } + } else { + ret = dhd_wl_ioctl_cmd(dhd, cmd, buf, len, FALSE, 0); + if (ret < 0) + CONFIG_ERROR("get iovar %s failed %d\n", name, ret); + } + + return ret; +} + +static int +dhd_conf_rsdb_mode(dhd_pub_t *dhd, char *buf) +{ + wl_config_t rsdb_mode_cfg = {1, 0}; + + if (buf) { + rsdb_mode_cfg.config = (int)simple_strtol(buf, NULL, 0); + CONFIG_MSG("rsdb_mode %d\n", rsdb_mode_cfg.config); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "rsdb_mode", (char *)&rsdb_mode_cfg, + sizeof(rsdb_mode_cfg), TRUE); + } + + return 0; +} + +typedef struct sub_cmd_t { + char *name; + uint16 id; /* id for the dongle f/w switch/case */ + uint16 type; /* base type of argument IOVT_XXXX */ +} sub_cmd_t; + +/* wl he sub cmd list */ +static const sub_cmd_t he_cmd_list[] = { + {"enab", WL_HE_CMD_ENAB, IOVT_UINT8}, + {"features", WL_HE_CMD_FEATURES, IOVT_UINT32}, + {"bsscolor", WL_HE_CMD_BSSCOLOR, IOVT_UINT8}, + {"partialbsscolor", WL_HE_CMD_PARTIAL_BSSCOLOR, IOVT_UINT8}, + {"cap", WL_HE_CMD_CAP, IOVT_UINT8}, + {"staid", WL_HE_CMD_STAID, IOVT_UINT16}, + {"rtsdurthresh", WL_HE_CMD_RTSDURTHRESH, IOVT_UINT16}, + {"peduration", WL_HE_CMD_PEDURATION, IOVT_UINT8}, + {"testbed_mode", WL_HE_CMD_TESTBED_MODE, IOVT_UINT32}, + {"omi_ulmu_throttle", WL_HE_CMD_OMI_ULMU_THROTTLE, IOVT_UINT16}, + {"omi_dlmu_rr_mpf_map", WL_HE_CMD_OMI_DLMU_RSD_RCM_MPF_MAP, IOVT_UINT32}, + {"ulmu_disable_policy", WL_HE_CMD_ULMU_DISABLE_POLICY, IOVT_UINT8}, + {"sr_prohibit", WL_HE_CMD_SR_PROHIBIT, IOVT_UINT8}, +}; + +static uint +wl_he_iovt2len(uint iovt) +{ + switch (iovt) { + case IOVT_BOOL: + case IOVT_INT8: + case IOVT_UINT8: + return sizeof(uint8); + case IOVT_INT16: + case IOVT_UINT16: + return sizeof(uint16); + case IOVT_INT32: + case IOVT_UINT32: + return sizeof(uint32); + default: + /* ASSERT(0); */ + return 0; + } +} + +static int +dhd_conf_he_cmd(dhd_pub_t * dhd, char *buf) +{ + int ret = BCME_OK, i; + bcm_xtlv_t *pxtlv = NULL; + uint8 mybuf[128]; + uint16 he_id = -1, he_len = 0, mybuf_len = sizeof(mybuf); + uint32 he_val; + const sub_cmd_t *tpl = he_cmd_list; + char sub_cmd[32], he_val_str[10]; + + if (buf) { + sscanf(buf, "%s %s", sub_cmd, he_val_str); + } + + for (i=0; iname, sub_cmd)) { + he_id = tpl->id; + he_len = wl_he_iovt2len(tpl->type); + break; + } + } + if (he_id < 0) { + CONFIG_ERROR("No he id found for %s\n", sub_cmd); + return 0; + } + + pxtlv = (bcm_xtlv_t *)mybuf; + + if (strlen(he_val_str)) { + he_val = simple_strtol(he_val_str, NULL, 0); + ret = bcm_pack_xtlv_entry((uint8**)&pxtlv, &mybuf_len, he_id, + he_len, (uint8 *)&he_val, BCM_XTLV_OPTION_ALIGN32); + if (ret != BCME_OK) { + CONFIG_ERROR("failed to pack he enab, err: %s\n", bcmerrorstr(ret)); + return 0; + } + CONFIG_MSG("he %s 0x%x\n", sub_cmd, he_val); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "he", (char *)&mybuf, + sizeof(mybuf), TRUE); + } + + return 0; +} + +typedef int (tpl_parse_t)(dhd_pub_t *dhd, char *buf); + +typedef struct iovar_tpl_t { + int cmd; + char *name; + tpl_parse_t *parse; +} iovar_tpl_t; + +const iovar_tpl_t iovar_tpl_list[] = { + {WLC_SET_VAR, "rsdb_mode", dhd_conf_rsdb_mode}, + {WLC_SET_VAR, "he", dhd_conf_he_cmd}, +}; + +static int iovar_tpl_parse(const iovar_tpl_t *tpl, int tpl_count, + dhd_pub_t *dhd, int cmd, char *name, char *buf) +{ + int i, ret = 0; + + /* look for a matching code in the table */ + for (i = 0; i < tpl_count; i++, tpl++) { + if (tpl->cmd == cmd && !strcmp(tpl->name, name)) + break; + } + if (i < tpl_count && tpl->parse) { + ret = tpl->parse(dhd, buf); + } else { + ret = -1; + } + + return ret; +} + +bool +dhd_conf_set_wl_cmd(dhd_pub_t *dhd, char *data, bool down) +{ + int cmd, val, ret = 0, len; + char name[32], *pch, *pick_tmp, *pick_tmp2, *pdata = NULL; + + /* Process wl_preinit: + * wl_preinit=[cmd]=[val], [cmd]=[val] + * Ex: wl_preinit=86=0, mpc=0 + */ + + if (data == NULL) + return FALSE; + + len = strlen(data); + pdata = kmalloc(len+1, GFP_KERNEL); + if (pdata == NULL) { + CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", len+1); + goto exit; + } + memset(pdata, 0, len+1); + strcpy(pdata, data); + + pick_tmp = pdata; + while (pick_tmp && (pick_tmp2 = bcmstrtok(&pick_tmp, ",", 0)) != NULL) { + pch = bcmstrtok(&pick_tmp2, "=", 0); + if (!pch) + break; + if (*pch == ' ') { + pch++; + } + memset(name, 0 , sizeof (name)); + cmd = (int)simple_strtol(pch, NULL, 0); + if (cmd == 0) { + cmd = WLC_SET_VAR; + strcpy(name, pch); + } + pch = bcmstrtok(&pick_tmp2, ",", 0); + if (!pch) { + break; + } + ret = iovar_tpl_parse(iovar_tpl_list, ARRAY_SIZE(iovar_tpl_list), + dhd, cmd, name, pch); + if (ret) { + val = (int)simple_strtol(pch, NULL, 0); + dhd_conf_set_intiovar(dhd, cmd, name, val, -1, down); + } + } + +exit: + if (pdata) + kfree(pdata); + return true; +} + +int +dhd_conf_get_band(dhd_pub_t *dhd) +{ + int band = -1; + + if (dhd && dhd->conf) + band = dhd->conf->band; + else + CONFIG_ERROR("dhd or conf is NULL\n"); + + return band; +} + +int +dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec) +{ + int bcmerror = -1; + + memset(cspec, 0, sizeof(wl_country_t)); + bcm_mkiovar("country", NULL, 0, (char*)cspec, sizeof(wl_country_t)); + if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, cspec, sizeof(wl_country_t), + FALSE, 0)) < 0) + CONFIG_ERROR("country code getting failed %d\n", bcmerror); + + return bcmerror; +} + +int +dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec) +{ + int bcmerror = -1; + struct dhd_conf *conf = dhd->conf; + country_list_t *country = conf->country_head; + +#ifdef CCODE_LIST + bcmerror = dhd_ccode_map_country_list(dhd, cspec); +#endif + + while (country != NULL) { + if (!strncmp("**", country->cspec.country_abbrev, 2)) { + memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); + cspec->rev = country->cspec.rev; + bcmerror = 0; + break; + } else if (!strncmp(cspec->country_abbrev, + country->cspec.country_abbrev, 2)) { + memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); + cspec->rev = country->cspec.rev; + bcmerror = 0; + break; + } + country = country->next; + } + + if (!bcmerror) + CONFIG_MSG("%s/%d\n", cspec->ccode, cspec->rev); + + return bcmerror; +} + +int +dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec) +{ + int bcmerror = -1; + + memset(&dhd->dhd_cspec, 0, sizeof(wl_country_t)); + + CONFIG_MSG("set country %s, revision %d\n", cspec->ccode, cspec->rev); + bcmerror = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "country", (char *)cspec, + sizeof(wl_country_t), FALSE); + dhd_conf_get_country(dhd, cspec); + CONFIG_MSG("Country code: %s (%s/%d)\n", + cspec->country_abbrev, cspec->ccode, cspec->rev); + + return bcmerror; +} + +int +dhd_conf_fix_country(dhd_pub_t *dhd) +{ + int bcmerror = -1; + int band; + wl_uint32_list_t *list; + u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)]; + wl_country_t cspec; + + if (!(dhd && dhd->conf)) { + return bcmerror; + } + + memset(valid_chan_list, 0, sizeof(valid_chan_list)); + list = (wl_uint32_list_t *)(void *) valid_chan_list; + list->count = htod32(WL_NUMCHANNELS); + if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VALID_CHANNELS, valid_chan_list, + sizeof(valid_chan_list), FALSE, 0)) < 0) { + CONFIG_ERROR("get channels failed with %d\n", bcmerror); + } + + band = dhd_conf_get_band(dhd); + + if (bcmerror || ((band==WLC_BAND_AUTO || band==WLC_BAND_2G || band==-1) && + dtoh32(list->count)<11)) { + CONFIG_ERROR("bcmerror=%d, # of channels %d\n", + bcmerror, dtoh32(list->count)); + dhd_conf_map_country_list(dhd, &dhd->conf->cspec); + if ((bcmerror = dhd_conf_set_country(dhd, &dhd->conf->cspec)) < 0) { + strcpy(cspec.country_abbrev, "US"); + cspec.rev = 0; + strcpy(cspec.ccode, "US"); + dhd_conf_map_country_list(dhd, &cspec); + dhd_conf_set_country(dhd, &cspec); + } + } + + return bcmerror; +} + +bool +dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel) +{ + int i; + bool match = false; + + if (dhd && dhd->conf) { + if (dhd->conf->channels.count == 0) + return true; + for (i=0; iconf->channels.count; i++) { + if (channel == dhd->conf->channels.channel[i]) + match = true; + } + } else { + match = true; + CONFIG_ERROR("dhd or conf is NULL\n"); + } + + return match; +} + +int +dhd_conf_set_roam(dhd_pub_t *dhd) +{ + int bcmerror = -1; + struct dhd_conf *conf = dhd->conf; + + dhd_roam_disable = conf->roam_off; + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "roam_off", dhd->conf->roam_off, 0, FALSE); + + if (!conf->roam_off || !conf->roam_off_suspend) { + CONFIG_MSG("set roam_trigger %d\n", conf->roam_trigger[0]); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_TRIGGER, "WLC_SET_ROAM_TRIGGER", + (char *)conf->roam_trigger, sizeof(conf->roam_trigger), FALSE); + + CONFIG_MSG("set roam_scan_period %d\n", conf->roam_scan_period[0]); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_SCAN_PERIOD, "WLC_SET_ROAM_SCAN_PERIOD", + (char *)conf->roam_scan_period, sizeof(conf->roam_scan_period), FALSE); + + CONFIG_MSG("set roam_delta %d\n", conf->roam_delta[0]); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_DELTA, "WLC_SET_ROAM_DELTA", + (char *)conf->roam_delta, sizeof(conf->roam_delta), FALSE); + + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "fullroamperiod", + dhd->conf->fullroamperiod, 1, FALSE); + } + + return bcmerror; +} + +void +dhd_conf_add_to_eventbuffer(struct eventmsg_buf *ev, u16 event, bool set) +{ + if (!ev || (event > WLC_E_LAST)) + return; + + if (ev->num < MAX_EVENT_BUF_NUM) { + ev->event[ev->num].type = event; + ev->event[ev->num].set = set; + ev->num++; + } else { + CONFIG_ERROR("evenbuffer doesn't support > %u events. Update" + " the define MAX_EVENT_BUF_NUM \n", MAX_EVENT_BUF_NUM); + ASSERT(0); + } +} + +s32 +dhd_conf_apply_eventbuffer(dhd_pub_t *dhd, eventmsg_buf_t *ev) +{ + char eventmask[WL_EVENTING_MASK_LEN]; + int i, ret = 0; + + if (!ev || (!ev->num)) + return -EINVAL; + + /* Read event_msgs mask */ + ret = dhd_conf_get_iovar(dhd, 0, WLC_GET_VAR, "event_msgs", eventmask, + sizeof(eventmask)); + if (unlikely(ret)) { + CONFIG_ERROR("Get event_msgs error (%d)\n", ret); + goto exit; + } + + /* apply the set bits */ + for (i = 0; i < ev->num; i++) { + if (ev->event[i].set) + setbit(eventmask, ev->event[i].type); + else + clrbit(eventmask, ev->event[i].type); + } + + /* Write updated Event mask */ + ret = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "event_msgs", eventmask, + sizeof(eventmask), FALSE); + if (unlikely(ret)) { + CONFIG_ERROR("Set event_msgs error (%d)\n", ret); + } + +exit: + return ret; +} + +int +dhd_conf_enable_roam_offload(dhd_pub_t *dhd, int enable) +{ + int err; + eventmsg_buf_t ev_buf; + + if (dhd->conf->roam_off_suspend) + return 0; + + err = dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "roam_offload", enable, 0, FALSE); + if (err) + return err; + + bzero(&ev_buf, sizeof(eventmsg_buf_t)); + dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_PSK_SUP, !enable); + dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_ASSOC_REQ_IE, !enable); + dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_ASSOC_RESP_IE, !enable); + dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_REASSOC, !enable); + dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_JOIN, !enable); + dhd_conf_add_to_eventbuffer(&ev_buf, WLC_E_ROAM, !enable); + err = dhd_conf_apply_eventbuffer(dhd, &ev_buf); + + CONFIG_TRACE("roam_offload %d\n", enable); + + return err; +} + +void +dhd_conf_set_bw_cap(dhd_pub_t *dhd) +{ + struct { + u32 band; + u32 bw_cap; + } param = {0, 0}; + + if (dhd->conf->bw_cap[0] >= 0) { + memset(¶m, 0, sizeof(param)); + param.band = WLC_BAND_2G; + param.bw_cap = (uint)dhd->conf->bw_cap[0]; + CONFIG_MSG("set bw_cap 2g 0x%x\n", param.bw_cap); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "bw_cap", (char *)¶m, + sizeof(param), TRUE); + } + + if (dhd->conf->bw_cap[1] >= 0) { + memset(¶m, 0, sizeof(param)); + param.band = WLC_BAND_5G; + param.bw_cap = (uint)dhd->conf->bw_cap[1]; + CONFIG_MSG("set bw_cap 5g 0x%x\n", param.bw_cap); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "bw_cap", (char *)¶m, + sizeof(param), TRUE); + } +} + +void +dhd_conf_get_wme(dhd_pub_t *dhd, int ifidx, int mode, edcf_acparam_t *acp) +{ + int bcmerror = -1; + char iovbuf[WLC_IOCTL_SMLEN]; + edcf_acparam_t *acparam; + + bzero(iovbuf, sizeof(iovbuf)); + + /* + * Get current acparams, using buf as an input buffer. + * Return data is array of 4 ACs of wme params. + */ + if (mode == 0) + bcm_mkiovar("wme_ac_sta", NULL, 0, iovbuf, sizeof(iovbuf)); + else + bcm_mkiovar("wme_ac_ap", NULL, 0, iovbuf, sizeof(iovbuf)); + if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, iovbuf, sizeof(iovbuf), + FALSE, ifidx)) < 0) { + CONFIG_ERROR("wme_ac_sta getting failed %d\n", bcmerror); + return; + } + memcpy((char*)acp, iovbuf, sizeof(edcf_acparam_t)*AC_COUNT); + + acparam = &acp[AC_BK]; + CONFIG_TRACE("BK: aci %d aifsn %d ecwmin %d ecwmax %d txop 0x%x\n", + acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, + acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, + acparam->TXOP); + acparam = &acp[AC_BE]; + CONFIG_TRACE("BE: aci %d aifsn %d ecwmin %d ecwmax %d txop 0x%x\n", + acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, + acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, + acparam->TXOP); + acparam = &acp[AC_VI]; + CONFIG_TRACE("VI: aci %d aifsn %d ecwmin %d ecwmax %d txop 0x%x\n", + acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, + acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, + acparam->TXOP); + acparam = &acp[AC_VO]; + CONFIG_TRACE("VO: aci %d aifsn %d ecwmin %d ecwmax %d txop 0x%x\n", + acparam->ACI, acparam->ACI&EDCF_AIFSN_MASK, + acparam->ECW&EDCF_ECWMIN_MASK, (acparam->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, + acparam->TXOP); + + return; +} + +void +dhd_conf_update_wme(dhd_pub_t *dhd, int ifidx, int mode, + edcf_acparam_t *acparam_cur, int aci) +{ + int aifsn, ecwmin, ecwmax, txop; + edcf_acparam_t *acp; + struct dhd_conf *conf = dhd->conf; + wme_param_t *wme; + + if (mode == 0) + wme = &conf->wme_sta; + else + wme = &conf->wme_ap; + + /* Default value */ + aifsn = acparam_cur->ACI&EDCF_AIFSN_MASK; + ecwmin = acparam_cur->ECW&EDCF_ECWMIN_MASK; + ecwmax = (acparam_cur->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT; + txop = acparam_cur->TXOP; + + /* Modified value */ + if (wme->aifsn[aci] > 0) + aifsn = wme->aifsn[aci]; + if (wme->ecwmin[aci] > 0) + ecwmin = wme->ecwmin[aci]; + if (wme->ecwmax[aci] > 0) + ecwmax = wme->ecwmax[aci]; + if (wme->txop[aci] > 0) + txop = wme->txop[aci]; + + if (!(wme->aifsn[aci] || wme->ecwmin[aci] || + wme->ecwmax[aci] || wme->txop[aci])) + return; + + /* Update */ + acp = acparam_cur; + acp->ACI = (acp->ACI & ~EDCF_AIFSN_MASK) | (aifsn & EDCF_AIFSN_MASK); + acp->ECW = ((ecwmax << EDCF_ECWMAX_SHIFT) & EDCF_ECWMAX_MASK) | (acp->ECW & EDCF_ECWMIN_MASK); + acp->ECW = ((acp->ECW & EDCF_ECWMAX_MASK) | (ecwmin & EDCF_ECWMIN_MASK)); + acp->TXOP = txop; + + CONFIG_MSG("wme_ac %s aci %d aifsn %d ecwmin %d ecwmax %d txop 0x%x\n", + mode?"ap":"sta", acp->ACI, acp->ACI&EDCF_AIFSN_MASK, + acp->ECW&EDCF_ECWMIN_MASK, (acp->ECW&EDCF_ECWMAX_MASK)>>EDCF_ECWMAX_SHIFT, + acp->TXOP); + + /* + * Now use buf as an output buffer. + * Put WME acparams after "wme_ac\0" in buf. + * NOTE: only one of the four ACs can be set at a time. + */ + if (mode == 0) + dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_VAR, "wme_ac_sta", (char *)acp, + sizeof(edcf_acparam_t), FALSE); + else + dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_VAR, "wme_ac_ap", (char *)acp, + sizeof(edcf_acparam_t), FALSE); + +} + +void +dhd_conf_set_wme(dhd_pub_t *dhd, int ifidx, int mode) +{ + edcf_acparam_t acparam_cur[AC_COUNT]; + + if (dhd && dhd->conf) { + if (!dhd->conf->force_wme_ac) { + CONFIG_TRACE("force_wme_ac is not enabled %d\n", + dhd->conf->force_wme_ac); + return; + } + + CONFIG_TRACE("Before change:\n"); + dhd_conf_get_wme(dhd, ifidx, mode, acparam_cur); + + dhd_conf_update_wme(dhd, ifidx, mode, &acparam_cur[AC_BK], AC_BK); + dhd_conf_update_wme(dhd, ifidx, mode, &acparam_cur[AC_BE], AC_BE); + dhd_conf_update_wme(dhd, ifidx, mode, &acparam_cur[AC_VI], AC_VI); + dhd_conf_update_wme(dhd, ifidx, mode, &acparam_cur[AC_VO], AC_VO); + + CONFIG_TRACE("After change:\n"); + dhd_conf_get_wme(dhd, ifidx, mode, acparam_cur); + } else { + CONFIG_ERROR("dhd or conf is NULL\n"); + } + + return; +} + +void +dhd_conf_set_mchan_bw(dhd_pub_t *dhd, int p2p_mode, int miracast_mode) +{ + struct dhd_conf *conf = dhd->conf; + mchan_params_t *mchan = conf->mchan; + bool set = true; + + while (mchan != NULL) { + set = true; + set &= (mchan->bw >= 0); + set &= ((mchan->p2p_mode == -1) | (mchan->p2p_mode == p2p_mode)); + set &= ((mchan->miracast_mode == -1) | (mchan->miracast_mode == miracast_mode)); + if (set) { + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "mchan_bw", mchan->bw, 0, FALSE); + } + mchan = mchan->next; + } + + return; +} + +#ifdef PKT_FILTER_SUPPORT +void +dhd_conf_add_pkt_filter(dhd_pub_t *dhd) +{ + int i, j; + char str[16]; +#define MACS "%02x%02x%02x%02x%02x%02x" + + /* + * Filter in less pkt: ARP(0x0806, ID is 105), BRCM(0x886C), 802.1X(0x888E) + * 1) dhd_master_mode=1 + * 2) pkt_filter_delete=100, 102, 103, 104, 105, 106, 107 + * 3) pkt_filter_add=131 0 0 12 0xFFFF 0x886C, 132 0 0 12 0xFFFF 0x888E + * 4) magic_pkt_filter_add=141 0 1 12 + */ + for(i=0; iconf->pkt_filter_add.count; i++) { + dhd->pktfilter[i+dhd->pktfilter_count] = dhd->conf->pkt_filter_add.filter[i]; + CONFIG_MSG("%s\n", dhd->pktfilter[i+dhd->pktfilter_count]); + } + dhd->pktfilter_count += i; + + if (dhd->conf->magic_pkt_filter_add) { + strcat(dhd->conf->magic_pkt_filter_add, " 0x"); + strcat(dhd->conf->magic_pkt_filter_add, "FFFFFFFFFFFF"); + for (j=0; j<16; j++) + strcat(dhd->conf->magic_pkt_filter_add, "FFFFFFFFFFFF"); + strcat(dhd->conf->magic_pkt_filter_add, " 0x"); + strcat(dhd->conf->magic_pkt_filter_add, "FFFFFFFFFFFF"); + sprintf(str, MACS, MAC2STRDBG(dhd->mac.octet)); + for (j=0; j<16; j++) + strncat(dhd->conf->magic_pkt_filter_add, str, 12); + dhd->pktfilter[dhd->pktfilter_count] = dhd->conf->magic_pkt_filter_add; + dhd->pktfilter_count += 1; + } +} + +bool +dhd_conf_del_pkt_filter(dhd_pub_t *dhd, uint32 id) +{ + int i; + + if (dhd && dhd->conf) { + for (i=0; iconf->pkt_filter_del.count; i++) { + if (id == dhd->conf->pkt_filter_del.id[i]) { + CONFIG_MSG("%d\n", dhd->conf->pkt_filter_del.id[i]); + return true; + } + } + return false; + } + return false; +} + +void +dhd_conf_discard_pkt_filter(dhd_pub_t *dhd) +{ + dhd->pktfilter_count = 6; + dhd->pktfilter[DHD_UNICAST_FILTER_NUM] = NULL; + dhd->pktfilter[DHD_BROADCAST_FILTER_NUM] = "101 0 0 0 0xFFFFFFFFFFFF 0xFFFFFFFFFFFF"; + dhd->pktfilter[DHD_MULTICAST4_FILTER_NUM] = "102 0 0 0 0xFFFFFF 0x01005E"; + dhd->pktfilter[DHD_MULTICAST6_FILTER_NUM] = "103 0 0 0 0xFFFF 0x3333"; + dhd->pktfilter[DHD_MDNS_FILTER_NUM] = NULL; + /* Do not enable ARP to pkt filter if dhd_master_mode is false.*/ + dhd->pktfilter[DHD_ARP_FILTER_NUM] = NULL; + + /* IPv4 broadcast address XXX.XXX.XXX.255 */ + dhd->pktfilter[dhd->pktfilter_count] = "110 0 0 12 0xFFFF00000000000000000000000000000000000000FF 0x080000000000000000000000000000000000000000FF"; + dhd->pktfilter_count++; + /* discard IPv4 multicast address 224.0.0.0/4 */ + dhd->pktfilter[dhd->pktfilter_count] = "111 0 0 12 0xFFFF00000000000000000000000000000000F0 0x080000000000000000000000000000000000E0"; + dhd->pktfilter_count++; + /* discard IPv6 multicast address FF00::/8 */ + dhd->pktfilter[dhd->pktfilter_count] = "112 0 0 12 0xFFFF000000000000000000000000000000000000000000000000FF 0x86DD000000000000000000000000000000000000000000000000FF"; + dhd->pktfilter_count++; + /* discard Netbios pkt */ + dhd->pktfilter[dhd->pktfilter_count] = "121 0 0 12 0xFFFF000000000000000000FF000000000000000000000000FFFF 0x0800000000000000000000110000000000000000000000000089"; + dhd->pktfilter_count++; + +} +#endif /* PKT_FILTER_SUPPORT */ + +int +dhd_conf_get_pm(dhd_pub_t *dhd) +{ + if (dhd && dhd->conf) { + return dhd->conf->pm; + } + return -1; +} + +int +dhd_conf_check_hostsleep(dhd_pub_t *dhd, int cmd, void *buf, int len, + int *hostsleep_set, int *hostsleep_val, int *ret) +{ + if (dhd->conf->insuspend & (NO_TXCTL_IN_SUSPEND | WOWL_IN_SUSPEND)) { + if (cmd == WLC_SET_VAR) { + char *psleep = NULL; + psleep = strstr(buf, "hostsleep"); + if (psleep) { + *hostsleep_set = 1; + memcpy(hostsleep_val, psleep+strlen("hostsleep")+1, sizeof(int)); + } + } + if (dhd->hostsleep && (!*hostsleep_set || *hostsleep_val)) { + CONFIG_TRACE("block all none hostsleep clr cmd\n"); + *ret = BCME_EPERM; + goto exit; + } else if (*hostsleep_set && *hostsleep_val) { + CONFIG_TRACE("hostsleep %d => %d\n", dhd->hostsleep, *hostsleep_val); + dhd->hostsleep = *hostsleep_val; + if (dhd->conf->insuspend & NO_TXDATA_IN_SUSPEND) { + dhd_txflowcontrol(dhd, ALL_INTERFACES, ON); + } + if (dhd->hostsleep == 2) { + *ret = 0; + goto exit; + } + } else if (dhd->hostsleep == 2 && !*hostsleep_val) { + CONFIG_TRACE("hostsleep %d => %d\n", dhd->hostsleep, *hostsleep_val); + dhd->hostsleep = *hostsleep_val; + if (dhd->conf->insuspend & NO_TXDATA_IN_SUSPEND) { + dhd_txflowcontrol(dhd, ALL_INTERFACES, OFF); + } + *ret = 0; + goto exit; + } + } +#ifdef NO_POWER_SAVE + if (cmd == WLC_SET_PM) { + if (*(const u32*)buf != 0) { + CONFIG_TRACE("skip PM\n"); + *ret = BCME_OK; + goto exit; + } + } else if (cmd == WLC_SET_VAR) { + int cmd_len = strlen("mpc"); + if (!strncmp(buf, "mpc", cmd_len)) { + if (*((u32 *)((u8*)buf+cmd_len+1)) != 0) { + CONFIG_TRACE("skip mpc\n"); + *ret = BCME_OK; + goto exit; + } + } + } +#endif + + return 0; +exit: + return -1; +} + +void +dhd_conf_get_hostsleep(dhd_pub_t *dhd, + int hostsleep_set, int hostsleep_val, int ret) +{ + if (dhd->conf->insuspend & (NO_TXCTL_IN_SUSPEND | WOWL_IN_SUSPEND)) { + if (hostsleep_set) { + if (hostsleep_val && ret) { + CONFIG_TRACE("reset hostsleep %d => 0\n", dhd->hostsleep); + dhd->hostsleep = 0; + if (dhd->conf->insuspend & NO_TXDATA_IN_SUSPEND) { + dhd_txflowcontrol(dhd, ALL_INTERFACES, OFF); + } + } else if (!hostsleep_val && !ret) { + CONFIG_TRACE("set hostsleep %d => 0\n", dhd->hostsleep); + dhd->hostsleep = 0; + if (dhd->conf->insuspend & NO_TXDATA_IN_SUSPEND) { + dhd_txflowcontrol(dhd, ALL_INTERFACES, OFF); + } + } + } + } +} + +#ifdef WL_EXT_WOWL +#define WL_WOWL_TCPFIN (1 << 26) +typedef struct wl_wowl_pattern2 { + char cmd[4]; + wl_wowl_pattern_t wowl_pattern; +} wl_wowl_pattern2_t; +static int +dhd_conf_wowl_pattern(dhd_pub_t *dhd, bool add, char *data) +{ + uint buf_len = 0; + int id, type, polarity, offset; + char cmd[4]="\0", mask[128]="\0", pattern[128]="\0", mask_tmp[128]="\0", *pmask_tmp; + uint32 masksize, patternsize, pad_len = 0; + wl_wowl_pattern2_t *wowl_pattern2 = NULL; + char *mask_and_pattern; + int ret = 0, i, j, v; + + if (data) { + if (add) + strcpy(cmd, "add"); + else + strcpy(cmd, "clr"); + if (!strcmp(cmd, "clr")) { + CONFIG_TRACE("wowl_pattern clr\n"); + ret = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "wowl_pattern", cmd, + sizeof(cmd), FALSE); + goto exit; + } + sscanf(data, "%d %d %d %d %s %s", &id, &type, &polarity, &offset, + mask_tmp, pattern); + masksize = strlen(mask_tmp) -2; + CONFIG_TRACE("0 mask_tmp=%s, masksize=%d\n", mask_tmp, masksize); + + // add pading + if (masksize % 16) + pad_len = (16 - masksize % 16); + for (i=0; icmd, cmd, sizeof(cmd)); + wowl_pattern2->wowl_pattern.id = id; + wowl_pattern2->wowl_pattern.type = 0; + wowl_pattern2->wowl_pattern.offset = offset; + mask_and_pattern = (char*)wowl_pattern2 + sizeof(wl_wowl_pattern2_t); + + wowl_pattern2->wowl_pattern.masksize = masksize; + ret = wl_pattern_atoh(mask, mask_and_pattern); + if (ret == -1) { + CONFIG_ERROR("rejecting mask=%s\n", mask); + goto exit; + } + + mask_and_pattern += wowl_pattern2->wowl_pattern.masksize; + wowl_pattern2->wowl_pattern.patternoffset = sizeof(wl_wowl_pattern_t) + + wowl_pattern2->wowl_pattern.masksize; + + wowl_pattern2->wowl_pattern.patternsize = patternsize; + ret = wl_pattern_atoh(pattern, mask_and_pattern); + if (ret == -1) { + CONFIG_ERROR("rejecting pattern=%s\n", pattern); + goto exit; + } + + CONFIG_TRACE("%s %d %s %s\n", cmd, offset, mask, pattern); + + ret = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "wowl_pattern", + (char *)wowl_pattern2, buf_len, FALSE); + } + +exit: + if (wowl_pattern2) + kfree(wowl_pattern2); + return ret; +} + +static int +dhd_conf_wowl_wakeind(dhd_pub_t *dhd, bool clear) +{ + s8 iovar_buf[WLC_IOCTL_SMLEN]; + wl_wowl_wakeind_t *wake = NULL; + int ret = -1; + char clr[6]="clear", wakeind_str[32]="\0"; + + if (clear) { + CONFIG_TRACE("wowl_wakeind clear\n"); + ret = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "wowl_wakeind", + clr, sizeof(clr), 0); + } else { + ret = dhd_conf_get_iovar(dhd, 0, WLC_GET_VAR, "wowl_wakeind", + iovar_buf, sizeof(iovar_buf)); + if (!ret) { + wake = (wl_wowl_wakeind_t *) iovar_buf; + if (wake->ucode_wakeind & WL_WOWL_MAGIC) + strcpy(wakeind_str, "(MAGIC packet)"); + if (wake->ucode_wakeind & WL_WOWL_NET) + strcpy(wakeind_str, "(Netpattern)"); + if (wake->ucode_wakeind & WL_WOWL_DIS) + strcpy(wakeind_str, "(Disassoc/Deauth)"); + if (wake->ucode_wakeind & WL_WOWL_BCN) + strcpy(wakeind_str, "(Loss of beacon)"); + if (wake->ucode_wakeind & WL_WOWL_TCPKEEP_TIME) + strcpy(wakeind_str, "(TCPKA timeout)"); + if (wake->ucode_wakeind & WL_WOWL_TCPKEEP_DATA) + strcpy(wakeind_str, "(TCPKA data)"); + if (wake->ucode_wakeind & WL_WOWL_TCPFIN) + strcpy(wakeind_str, "(TCP FIN)"); + CONFIG_MSG("wakeind=0x%x %s\n", wake->ucode_wakeind, wakeind_str); + } + } + + return ret; +} +#endif + +int +dhd_conf_mkeep_alive(dhd_pub_t *dhd, int ifidx, int id, int period, + char *packet, bool bcast) +{ + wl_mkeep_alive_pkt_t *mkeep_alive_pktp; + int ret = 0, len_bytes=0, buf_len=0; + char *buf = NULL, *iovar_buf = NULL; + uint8 *pdata; + + CONFIG_TRACE("id=%d, period=%d, packet=%s\n", id, period, packet); + if (period >= 0) { + buf = kmalloc(WLC_IOCTL_SMLEN, GFP_KERNEL); + if (buf == NULL) { + CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", WLC_IOCTL_SMLEN); + goto exit; + } + iovar_buf = kmalloc(WLC_IOCTL_SMLEN, GFP_KERNEL); + if (iovar_buf == NULL) { + CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", WLC_IOCTL_SMLEN); + goto exit; + } + mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *)buf; + mkeep_alive_pktp->version = htod16(WL_MKEEP_ALIVE_VERSION); + mkeep_alive_pktp->length = htod16(WL_MKEEP_ALIVE_FIXED_LEN); + mkeep_alive_pktp->keep_alive_id = id; + buf_len += WL_MKEEP_ALIVE_FIXED_LEN; + mkeep_alive_pktp->period_msec = period; + if (packet && strlen(packet)) { + len_bytes = wl_pattern_atoh(packet, (char *)mkeep_alive_pktp->data); + buf_len += len_bytes; + if (bcast) { + memcpy(mkeep_alive_pktp->data, ðer_bcast, ETHER_ADDR_LEN); + } + ret = dhd_conf_get_iovar(dhd, ifidx, WLC_GET_VAR, "cur_etheraddr", + iovar_buf, WLC_IOCTL_SMLEN); + if (!ret) { + pdata = mkeep_alive_pktp->data; + memcpy(pdata+6, iovar_buf, ETHER_ADDR_LEN); + } + } + mkeep_alive_pktp->len_bytes = htod16(len_bytes); + ret = dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_VAR, "mkeep_alive", + buf, buf_len, FALSE); + } + +exit: + if (buf) + kfree(buf); + if (iovar_buf) + kfree(iovar_buf); + return ret; +} + +#ifdef ARP_OFFLOAD_SUPPORT +void +dhd_conf_set_garp(dhd_pub_t *dhd, int ifidx, uint32 ipa, bool enable) +{ + int i, len = 0, total_len = WLC_IOCTL_SMLEN; + char *iovar_buf = NULL, *packet = NULL; + + if (!dhd->conf->garp || ifidx != 0 || !(dhd->op_mode & DHD_FLAG_STA_MODE)) + return; + + CONFIG_TRACE("enable=%d\n", enable); + + if (enable) { + iovar_buf = kmalloc(total_len, GFP_KERNEL); + if (iovar_buf == NULL) { + CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", total_len); + goto exit; + } + packet = kmalloc(total_len, GFP_KERNEL); + if (packet == NULL) { + CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", total_len); + goto exit; + } + dhd_conf_get_iovar(dhd, ifidx, WLC_GET_VAR, "cur_etheraddr", iovar_buf, total_len); + + len += snprintf(packet+len, total_len, "0xffffffffffff"); + for (i=0; i>8)&0xff, (ipa>>16)&0xff, (ipa>>24)&0xff); + // Target Hardware Addr. + len += snprintf(packet+len, total_len, "ffffffffffff"); + // Target IP Addr. + len += snprintf(packet+len, total_len, "%02x%02x%02x%02x", + ipa&0xff, (ipa>>8)&0xff, (ipa>>16)&0xff, (ipa>>24)&0xff); + len += snprintf(packet+len, total_len, "000000000000000000000000000000000000"); + } + + dhd_conf_mkeep_alive(dhd, ifidx, 0, dhd->conf->keep_alive_period, packet, TRUE); + +exit: + if (iovar_buf) + kfree(iovar_buf); + if (packet) + kfree(packet); + return; +} +#endif + +uint +dhd_conf_get_insuspend(dhd_pub_t *dhd, uint mask) +{ + uint insuspend = 0; + + if (dhd->op_mode & DHD_FLAG_STA_MODE) { + insuspend = dhd->conf->insuspend & + (NO_EVENT_IN_SUSPEND | NO_TXDATA_IN_SUSPEND | NO_TXCTL_IN_SUSPEND | + ROAM_OFFLOAD_IN_SUSPEND | WOWL_IN_SUSPEND); + } else if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) { + insuspend = dhd->conf->insuspend & + (NO_EVENT_IN_SUSPEND | NO_TXDATA_IN_SUSPEND | NO_TXCTL_IN_SUSPEND | + AP_DOWN_IN_SUSPEND | AP_FILTER_IN_SUSPEND); + } + + return (insuspend & mask); +} + +#ifdef SUSPEND_EVENT +void +dhd_conf_set_suspend_event(dhd_pub_t *dhd, int suspend) +{ + struct dhd_conf *conf = dhd->conf; + struct ether_addr bssid; + char suspend_eventmask[WL_EVENTING_MASK_LEN]; + wl_event_msg_t msg; + int pm; +#ifdef WL_CFG80211 + struct net_device *net; +#endif /* defined(WL_CFG80211) */ + + CONFIG_TRACE("Enter\n"); + if (suspend) { +#ifdef PROP_TXSTATUS +#if defined(BCMSDIO) || defined(BCMDBUS) + if (dhd->wlfc_enabled) { + dhd_wlfc_deinit(dhd); + conf->wlfc = TRUE; + } else { + conf->wlfc = FALSE; + } +#endif /* BCMSDIO || BCMDBUS */ +#endif /* PROP_TXSTATUS */ + dhd_conf_get_iovar(dhd, 0, WLC_GET_VAR, "event_msgs", + conf->resume_eventmask, sizeof(conf->resume_eventmask)); + memset(suspend_eventmask, 0, sizeof(suspend_eventmask)); + setbit(suspend_eventmask, WLC_E_ESCAN_RESULT); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "event_msgs", + suspend_eventmask, sizeof(suspend_eventmask), FALSE); + if (dhd->op_mode & DHD_FLAG_STA_MODE) { + memset(&bssid, 0, ETHER_ADDR_LEN); + dhd_wl_ioctl_cmd(dhd, WLC_GET_BSSID, &bssid, ETHER_ADDR_LEN, FALSE, 0); + if (memcmp(ðer_null, &bssid, ETHER_ADDR_LEN)) + memcpy(&conf->bssid_insuspend, &bssid, ETHER_ADDR_LEN); + else + memset(&conf->bssid_insuspend, 0, ETHER_ADDR_LEN); + } + } + else { + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "event_msgs", + conf->resume_eventmask, sizeof(conf->resume_eventmask), FALSE); + if (dhd->op_mode & DHD_FLAG_STA_MODE) { + if (memcmp(ðer_null, &conf->bssid_insuspend, ETHER_ADDR_LEN)) { + memset(&bssid, 0, ETHER_ADDR_LEN); + dhd_wl_ioctl_cmd(dhd, WLC_GET_BSSID, &bssid, ETHER_ADDR_LEN, + FALSE, 0); + if (memcmp(ðer_null, &bssid, ETHER_ADDR_LEN)) { + dhd_conf_set_intiovar(dhd, WLC_SET_PM, "WLC_SET_PM", 0, 0, FALSE); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "send_nulldata", + (char *)&bssid, ETHER_ADDR_LEN, FALSE); + OSL_SLEEP(100); + if (conf->pm >= 0) + pm = conf->pm; + else + pm = PM_FAST; + dhd_conf_set_intiovar(dhd, WLC_SET_PM, "WLC_SET_PM", pm, 0, FALSE); + } else { + CONFIG_TRACE("send WLC_E_DEAUTH_IND event\n"); + bzero(&msg, sizeof(wl_event_msg_t)); + memcpy(&msg.addr, &conf->bssid_insuspend, ETHER_ADDR_LEN); + msg.event_type = hton32(WLC_E_DEAUTH_IND); + msg.status = 0; + msg.reason = hton32(DOT11_RC_DEAUTH_LEAVING); +#if defined(WL_EXT_IAPSTA) || defined(USE_IW) + wl_ext_event_send(dhd->event_params, &msg, NULL); +#endif +#ifdef WL_CFG80211 + net = dhd_idx2net(dhd, 0); + if (net) { + wl_cfg80211_event(net, &msg, NULL); + } +#endif /* defined(WL_CFG80211) */ + } + } +#ifdef PROP_TXSTATUS +#if defined(BCMSDIO) || defined(BCMDBUS) + if (conf->wlfc) { + dhd_wlfc_init(dhd); + dhd_conf_set_intiovar(dhd, WLC_UP, "WLC_UP", 0, 0, FALSE); + } +#endif +#endif /* PROP_TXSTATUS */ + } + } + +} +#endif + +#if defined(WL_CFG80211) || defined(WL_ESCAN) +static void +dhd_conf_wait_event_complete(struct dhd_pub *dhd, int ifidx) +{ + s32 timeout = -1; + + timeout = wait_event_interruptible_timeout(dhd->conf->event_complete, + wl_ext_event_complete(dhd, ifidx), msecs_to_jiffies(10000)); + if (timeout <= 0 || !wl_ext_event_complete(dhd, ifidx)) { + wl_ext_event_complete(dhd, ifidx); + CONFIG_ERROR("timeout\n"); + } +} +#endif + +int +dhd_conf_set_suspend_resume(dhd_pub_t *dhd, int suspend) +{ + struct dhd_conf *conf = dhd->conf; + uint insuspend = 0; + int pm; +#ifdef BCMSDIO + uint32 intstatus = 0; + int ret = 0; +#endif +#ifdef WL_EXT_WOWL + int i; +#endif + + insuspend = dhd_conf_get_insuspend(dhd, ALL_IN_SUSPEND); + if (insuspend) + CONFIG_MSG("op_mode %d, suspend %d, suspended %d, insuspend 0x%x, suspend_mode=%d\n", + dhd->op_mode, suspend, conf->suspended, insuspend, conf->suspend_mode); + + if (conf->suspended == suspend || !dhd->up) { + return 0; + } + + if (suspend) { + if (dhd->op_mode & DHD_FLAG_STA_MODE) { + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "roam_off", + dhd->conf->roam_off_suspend, 0, FALSE); + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bcn_li_dtim", + dhd->conf->suspend_bcn_li_dtim, 0, FALSE); + if (insuspend & ROAM_OFFLOAD_IN_SUSPEND) + dhd_conf_enable_roam_offload(dhd, 2); + } else if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) { + if (insuspend & AP_DOWN_IN_SUSPEND) { + dhd_conf_set_intiovar(dhd, WLC_DOWN, "WLC_DOWN", 1, 0, FALSE); + } + } +#if defined(WL_CFG80211) || defined(WL_ESCAN) + if (insuspend & (NO_EVENT_IN_SUSPEND|NO_TXCTL_IN_SUSPEND|WOWL_IN_SUSPEND)) { + if (conf->suspend_mode == PM_NOTIFIER) + dhd_conf_wait_event_complete(dhd, 0); + } +#endif + if (insuspend & NO_TXDATA_IN_SUSPEND) { + dhd_txflowcontrol(dhd, ALL_INTERFACES, ON); + } +#if defined(WL_CFG80211) || defined(WL_ESCAN) + if (insuspend & (NO_EVENT_IN_SUSPEND|NO_TXCTL_IN_SUSPEND|WOWL_IN_SUSPEND)) { + if (conf->suspend_mode == PM_NOTIFIER) + wl_ext_user_sync(dhd, 0, TRUE); + } +#endif +#ifdef SUSPEND_EVENT + if (insuspend & NO_EVENT_IN_SUSPEND) { + dhd_conf_set_suspend_event(dhd, suspend); + } +#endif + if (dhd->op_mode & DHD_FLAG_STA_MODE) { + if (conf->pm_in_suspend >= 0) + pm = conf->pm_in_suspend; + else if (conf->pm >= 0) + pm = conf->pm; + else + pm = PM_FAST; + dhd_conf_set_intiovar(dhd, WLC_SET_PM, "WLC_SET_PM", pm, 0, FALSE); + } + dhd_conf_set_wl_cmd(dhd, conf->wl_suspend, FALSE); +#ifdef WL_EXT_WOWL + if ((insuspend & WOWL_IN_SUSPEND) && dhd_master_mode) { + dhd_conf_wowl_pattern(dhd, FALSE, "clr"); + for(i=0; ipkt_filter_add.count; i++) { + dhd_conf_wowl_pattern(dhd, TRUE, conf->pkt_filter_add.filter[i]); + } + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "wowl", conf->wowl, 0, FALSE); + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "wowl_activate", 1, 0, FALSE); + dhd_conf_wowl_wakeind(dhd, TRUE); + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "hostsleep", 1, 0, FALSE); +#ifdef BCMSDIO + ret = dhd_bus_sleep(dhd, TRUE, &intstatus); + CONFIG_TRACE("ret = %d, intstatus = 0x%x\n", ret, intstatus); +#endif + } else +#endif + if (insuspend & NO_TXCTL_IN_SUSPEND) { + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "hostsleep", 2, 0, FALSE); +#ifdef BCMSDIO + ret = dhd_bus_sleep(dhd, TRUE, &intstatus); + CONFIG_TRACE("ret = %d, intstatus = 0x%x\n", ret, intstatus); +#endif + } + conf->suspended = TRUE; + } else { + if (insuspend & (WOWL_IN_SUSPEND | NO_TXCTL_IN_SUSPEND)) { + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "hostsleep", 0, 0, FALSE); + } +#ifdef WL_EXT_WOWL + if (insuspend & WOWL_IN_SUSPEND) { + dhd_conf_wowl_wakeind(dhd, FALSE); + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "wowl_activate", 0, 0, FALSE); + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "wowl", 0, 0, FALSE); + dhd_conf_wowl_pattern(dhd, FALSE, "clr"); + } +#endif + dhd_conf_set_wl_cmd(dhd, conf->wl_resume, FALSE); + dhd_conf_get_iovar(dhd, 0, WLC_GET_PM, "WLC_GET_PM", (char *)&pm, sizeof(pm)); + CONFIG_TRACE("PM in suspend = %d\n", pm); +#ifdef SUSPEND_EVENT + if (insuspend & NO_EVENT_IN_SUSPEND) { + dhd_conf_set_suspend_event(dhd, suspend); + } +#endif +#if defined(WL_CFG80211) || defined(WL_ESCAN) + if (insuspend & (NO_EVENT_IN_SUSPEND|NO_TXCTL_IN_SUSPEND|WOWL_IN_SUSPEND)) { + if (conf->suspend_mode == PM_NOTIFIER) + wl_ext_user_sync(dhd, 0, FALSE); + } +#endif + if (insuspend & NO_TXDATA_IN_SUSPEND) { + dhd_txflowcontrol(dhd, ALL_INTERFACES, OFF); + } + if (dhd->op_mode & DHD_FLAG_STA_MODE) { + if (insuspend & ROAM_OFFLOAD_IN_SUSPEND) + dhd_conf_enable_roam_offload(dhd, 0); + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bcn_li_dtim", 0, 0, FALSE); + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "roam_off", + dhd->conf->roam_off, 0, FALSE); + } else if (dhd->op_mode & DHD_FLAG_HOSTAP_MODE) { + if (insuspend & AP_DOWN_IN_SUSPEND) { + dhd_conf_set_intiovar(dhd, WLC_UP, "WLC_UP", 0, 0, FALSE); + } + } + if (dhd->op_mode & DHD_FLAG_STA_MODE) { + if (conf->pm >= 0) + pm = conf->pm; + else + pm = PM_FAST; + dhd_conf_set_intiovar(dhd, WLC_SET_PM, "WLC_SET_PM", pm, 0, FALSE); + } + conf->suspended = FALSE; + } + + return 0; +} + +#ifdef PROP_TXSTATUS +int +dhd_conf_get_disable_proptx(dhd_pub_t *dhd) +{ + struct dhd_conf *conf = dhd->conf; + int disable_proptx = -1; + int fw_proptx = 0; + + /* check fw proptx priority: + * 1st: check fw support by wl cap + * 2nd: 4334/43340/43341/43241 support proptx but not show in wl cap, so enable it by default + * if you would like to disable it, please set disable_proptx=1 in config.txt + * 3th: disable when proptxstatus not support in wl cap + */ + if (FW_SUPPORTED(dhd, proptxstatus)) { + fw_proptx = 1; + } else if (conf->chip == BCM4334_CHIP_ID || conf->chip == BCM43340_CHIP_ID || + dhd->conf->chip == BCM43340_CHIP_ID || conf->chip == BCM4324_CHIP_ID) { + fw_proptx = 1; + } else { + fw_proptx = 0; + } + + /* returned disable_proptx value: + * -1: disable in STA and enable in P2P(follow original dhd settings when PROP_TXSTATUS_VSDB enabled) + * 0: depend on fw support + * 1: always disable proptx + */ + if (conf->disable_proptx == 0) { + // check fw support as well + if (fw_proptx) + disable_proptx = 0; + else + disable_proptx = 1; + } else if (conf->disable_proptx >= 1) { + disable_proptx = 1; + } else { + // check fw support as well + if (fw_proptx) + disable_proptx = -1; + else + disable_proptx = 1; + } + + CONFIG_MSG("fw_proptx=%d, disable_proptx=%d\n", fw_proptx, disable_proptx); + + return disable_proptx; +} +#endif + +uint +pick_config_vars(char *varbuf, uint len, uint start_pos, char *pickbuf, int picklen) +{ + bool findNewline, changenewline=FALSE, pick=FALSE; + int column; + uint n, pick_column=0; + + findNewline = FALSE; + column = 0; + + if (start_pos >= len) { + CONFIG_ERROR("wrong start pos\n"); + return 0; + } + + for (n = start_pos; n < len; n++) { + if (varbuf[n] == '\r') + continue; + if ((findNewline || changenewline) && varbuf[n] != '\n') + continue; + findNewline = FALSE; + if (varbuf[n] == '#') { + findNewline = TRUE; + continue; + } + if (varbuf[n] == '\\') { + changenewline = TRUE; + continue; + } + if (!changenewline && varbuf[n] == '\n') { + if (column == 0) + continue; + column = 0; + continue; + } + if (changenewline && varbuf[n] == '\n') { + changenewline = FALSE; + continue; + } + + if (column==0 && !pick) { // start to pick + pick = TRUE; + column++; + pick_column = 0; + } else { + if (pick && column==0) { // stop to pick + pick = FALSE; + break; + } else + column++; + } + if (pick) { + if (varbuf[n] == 0x9) + continue; + if (pick_column >= picklen) + break; + pickbuf[pick_column] = varbuf[n]; + pick_column++; + } + } + + return n; // return current position +} + +bool +dhd_conf_read_chiprev(dhd_pub_t *dhd, int *chip_match, + char *full_param, uint len_param) +{ + char *data = full_param+len_param, *pick_tmp, *pch; + uint chip = 0, rev = 0; + + /* Process chip, regrev: + * chip=[chipid], rev==[rev] + * Ex: chip=0x4359, rev=9 + */ + if (!strncmp("chip=", full_param, len_param)) { + chip = (int)simple_strtol(data, NULL, 0); + pick_tmp = data; + pch = bcmstrstr(pick_tmp, "rev="); + if (pch) { + rev = (int)simple_strtol(pch+strlen("rev="), NULL, 0); + } + if (chip == dhd->conf->chip && rev == dhd->conf->chiprev) + *chip_match = 1; + else + *chip_match = 0; + CONFIG_MSG("chip=0x%x, rev=%d, chip_match=%d\n", chip, rev, *chip_match); + } + + return TRUE; +} + +bool +dhd_conf_read_log_level(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + char *data = full_param+len_param; + + if (!strncmp("dhd_msg_level=", full_param, len_param)) { + dhd_msg_level = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("dhd_msg_level = 0x%X\n", dhd_msg_level); + } + else if (!strncmp("dump_msg_level=", full_param, len_param)) { + dump_msg_level = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("dump_msg_level = 0x%X\n", dump_msg_level); + } +#ifdef BCMSDIO + else if (!strncmp("sd_msglevel=", full_param, len_param)) { + sd_msglevel = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("sd_msglevel = 0x%X\n", sd_msglevel); + } +#endif +#ifdef BCMDBUS + else if (!strncmp("dbus_msglevel=", full_param, len_param)) { + dbus_msglevel = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("dbus_msglevel = 0x%X\n", dbus_msglevel); + } +#endif + else if (!strncmp("android_msg_level=", full_param, len_param)) { + android_msg_level = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("android_msg_level = 0x%X\n", android_msg_level); + } + else if (!strncmp("config_msg_level=", full_param, len_param)) { + config_msg_level = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("config_msg_level = 0x%X\n", config_msg_level); + } +#ifdef WL_CFG80211 + else if (!strncmp("wl_dbg_level=", full_param, len_param)) { + wl_dbg_level = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("wl_dbg_level = 0x%X\n", wl_dbg_level); + } +#endif +#if defined(WL_WIRELESS_EXT) + else if (!strncmp("iw_msg_level=", full_param, len_param)) { + iw_msg_level = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("iw_msg_level = 0x%X\n", iw_msg_level); + } +#endif +#if defined(DHD_DEBUG) + else if (!strncmp("dhd_console_ms=", full_param, len_param)) { + dhd->dhd_console_ms = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("dhd_console_ms = 0x%X\n", dhd->dhd_console_ms); + } +#endif + else + return false; + + return true; +} + +void +dhd_conf_read_wme_ac_value(wme_param_t *wme, char *pick, int ac_val) +{ + char *pick_tmp, *pch; + + pick_tmp = pick; + pch = bcmstrstr(pick_tmp, "aifsn "); + if (pch) { + wme->aifsn[ac_val] = (int)simple_strtol(pch+strlen("aifsn "), NULL, 0); + CONFIG_MSG("ac_val=%d, aifsn=%d\n", ac_val, wme->aifsn[ac_val]); + } + pick_tmp = pick; + pch = bcmstrstr(pick_tmp, "ecwmin "); + if (pch) { + wme->ecwmin[ac_val] = (int)simple_strtol(pch+strlen("ecwmin "), NULL, 0); + CONFIG_MSG("ac_val=%d, ecwmin=%d\n", ac_val, wme->ecwmin[ac_val]); + } + pick_tmp = pick; + pch = bcmstrstr(pick_tmp, "ecwmax "); + if (pch) { + wme->ecwmax[ac_val] = (int)simple_strtol(pch+strlen("ecwmax "), NULL, 0); + CONFIG_MSG("ac_val=%d, ecwmax=%d\n", ac_val, wme->ecwmax[ac_val]); + } + pick_tmp = pick; + pch = bcmstrstr(pick_tmp, "txop "); + if (pch) { + wme->txop[ac_val] = (int)simple_strtol(pch+strlen("txop "), NULL, 0); + CONFIG_MSG("ac_val=%d, txop=0x%x\n", ac_val, wme->txop[ac_val]); + } + +} + +bool +dhd_conf_read_wme_ac_params(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + + // wme_ac_sta_be=aifsn 1 ecwmin 2 ecwmax 3 txop 0x5e + // wme_ac_sta_vo=aifsn 1 ecwmin 1 ecwmax 1 txop 0x5e + + if (!strncmp("force_wme_ac=", full_param, len_param)) { + conf->force_wme_ac = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("force_wme_ac = %d\n", conf->force_wme_ac); + } + else if (!strncmp("wme_ac_sta_be=", full_param, len_param)) { + dhd_conf_read_wme_ac_value(&conf->wme_sta, data, AC_BE); + } + else if (!strncmp("wme_ac_sta_bk=", full_param, len_param)) { + dhd_conf_read_wme_ac_value(&conf->wme_sta, data, AC_BK); + } + else if (!strncmp("wme_ac_sta_vi=", full_param, len_param)) { + dhd_conf_read_wme_ac_value(&conf->wme_sta, data, AC_VI); + } + else if (!strncmp("wme_ac_sta_vo=", full_param, len_param)) { + dhd_conf_read_wme_ac_value(&conf->wme_sta, data, AC_VO); + } + else if (!strncmp("wme_ac_ap_be=", full_param, len_param)) { + dhd_conf_read_wme_ac_value(&conf->wme_ap, data, AC_BE); + } + else if (!strncmp("wme_ac_ap_bk=", full_param, len_param)) { + dhd_conf_read_wme_ac_value(&conf->wme_ap, data, AC_BK); + } + else if (!strncmp("wme_ac_ap_vi=", full_param, len_param)) { + dhd_conf_read_wme_ac_value(&conf->wme_ap, data, AC_VI); + } + else if (!strncmp("wme_ac_ap_vo=", full_param, len_param)) { + dhd_conf_read_wme_ac_value(&conf->wme_ap, data, AC_VO); + } + else + return false; + + return true; +} + +#ifdef BCMSDIO +bool +dhd_conf_read_fw_by_mac(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + int i, j; + char *pch, *pick_tmp; + wl_mac_list_t *mac_list; + wl_mac_range_t *mac_range; + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + + /* Process fw_by_mac: + * fw_by_mac=[fw_mac_num] \ + * [fw_name1] [mac_num1] [oui1-1] [nic_start1-1] [nic_end1-1] \ + * [oui1-1] [nic_start1-1] [nic_end1-1]... \ + * [oui1-n] [nic_start1-n] [nic_end1-n] \ + * [fw_name2] [mac_num2] [oui2-1] [nic_start2-1] [nic_end2-1] \ + * [oui2-1] [nic_start2-1] [nic_end2-1]... \ + * [oui2-n] [nic_start2-n] [nic_end2-n] \ + * Ex: fw_by_mac=2 \ + * fw_bcmdhd1.bin 2 0x0022F4 0xE85408 0xE8549D 0x983B16 0x3557A9 0x35582A \ + * fw_bcmdhd2.bin 3 0x0022F4 0xE85408 0xE8549D 0x983B16 0x3557A9 0x35582A \ + * 0x983B16 0x916157 0x916487 + */ + + if (!strncmp("fw_by_mac=", full_param, len_param)) { + dhd_conf_free_mac_list(&conf->fw_by_mac); + pick_tmp = data; + pch = bcmstrtok(&pick_tmp, " ", 0); + conf->fw_by_mac.count = (uint32)simple_strtol(pch, NULL, 0); + if (!(mac_list = kmalloc(sizeof(wl_mac_list_t)*conf->fw_by_mac.count, + GFP_KERNEL))) { + conf->fw_by_mac.count = 0; + CONFIG_ERROR("kmalloc failed\n"); + } + CONFIG_MSG("fw_count=%d\n", conf->fw_by_mac.count); + conf->fw_by_mac.m_mac_list_head = mac_list; + for (i=0; ifw_by_mac.count; i++) { + pch = bcmstrtok(&pick_tmp, " ", 0); + strcpy(mac_list[i].name, pch); + pch = bcmstrtok(&pick_tmp, " ", 0); + mac_list[i].count = (uint32)simple_strtol(pch, NULL, 0); + CONFIG_MSG("name=%s, mac_count=%d\n", + mac_list[i].name, mac_list[i].count); + if (!(mac_range = kmalloc(sizeof(wl_mac_range_t)*mac_list[i].count, + GFP_KERNEL))) { + mac_list[i].count = 0; + CONFIG_ERROR("kmalloc failed\n"); + break; + } + mac_list[i].mac = mac_range; + for (j=0; jconf; + char *data = full_param+len_param; + + /* Process nv_by_mac: + * [nv_by_mac]: The same format as fw_by_mac + */ + if (!strncmp("nv_by_mac=", full_param, len_param)) { + dhd_conf_free_mac_list(&conf->nv_by_mac); + pick_tmp = data; + pch = bcmstrtok(&pick_tmp, " ", 0); + conf->nv_by_mac.count = (uint32)simple_strtol(pch, NULL, 0); + if (!(mac_list = kmalloc(sizeof(wl_mac_list_t)*conf->nv_by_mac.count, + GFP_KERNEL))) { + conf->nv_by_mac.count = 0; + CONFIG_ERROR("kmalloc failed\n"); + } + CONFIG_MSG("nv_count=%d\n", conf->nv_by_mac.count); + conf->nv_by_mac.m_mac_list_head = mac_list; + for (i=0; inv_by_mac.count; i++) { + pch = bcmstrtok(&pick_tmp, " ", 0); + strcpy(mac_list[i].name, pch); + pch = bcmstrtok(&pick_tmp, " ", 0); + mac_list[i].count = (uint32)simple_strtol(pch, NULL, 0); + CONFIG_MSG("name=%s, mac_count=%d\n", + mac_list[i].name, mac_list[i].count); + if (!(mac_range = kmalloc(sizeof(wl_mac_range_t)*mac_list[i].count, + GFP_KERNEL))) { + mac_list[i].count = 0; + CONFIG_ERROR("kmalloc failed\n"); + break; + } + mac_list[i].mac = mac_range; + for (j=0; jconf; + char *data = full_param+len_param; + + /* Process nv_by_chip: + * nv_by_chip=[nv_chip_num] \ + * [chip1] [chiprev1] [nv_name1] [chip2] [chiprev2] [nv_name2] \ + * Ex: nv_by_chip=2 \ + * 43430 0 nvram_ap6212.txt 43430 1 nvram_ap6212a.txt \ + */ + if (!strncmp("nv_by_chip=", full_param, len_param)) { + dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); + pick_tmp = data; + pch = bcmstrtok(&pick_tmp, " ", 0); + conf->nv_by_chip.count = (uint32)simple_strtol(pch, NULL, 0); + if (!(chip_nv_path = kmalloc(sizeof(wl_mac_list_t)*conf->nv_by_chip.count, + GFP_KERNEL))) { + conf->nv_by_chip.count = 0; + CONFIG_ERROR("kmalloc failed\n"); + } + CONFIG_MSG("nv_by_chip_count=%d\n", conf->nv_by_chip.count); + conf->nv_by_chip.m_chip_nv_path_head = chip_nv_path; + for (i=0; inv_by_chip.count; i++) { + pch = bcmstrtok(&pick_tmp, " ", 0); + chip_nv_path[i].chip = (uint32)simple_strtol(pch, NULL, 0); + pch = bcmstrtok(&pick_tmp, " ", 0); + chip_nv_path[i].chiprev = (uint32)simple_strtol(pch, NULL, 0); + pch = bcmstrtok(&pick_tmp, " ", 0); + strcpy(chip_nv_path[i].name, pch); + CONFIG_MSG("chip=0x%x, chiprev=%d, name=%s\n", + chip_nv_path[i].chip, chip_nv_path[i].chiprev, chip_nv_path[i].name); + } + } + else + return false; + + return true; +} + +bool +dhd_conf_read_roam_params(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + + if (!strncmp("roam_off=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->roam_off = 0; + else + conf->roam_off = 1; + CONFIG_MSG("roam_off = %d\n", conf->roam_off); + } + else if (!strncmp("roam_off_suspend=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->roam_off_suspend = 0; + else + conf->roam_off_suspend = 1; + CONFIG_MSG("roam_off_suspend = %d\n", conf->roam_off_suspend); + } + else if (!strncmp("roam_trigger=", full_param, len_param)) { + conf->roam_trigger[0] = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("roam_trigger = %d\n", conf->roam_trigger[0]); + } + else if (!strncmp("roam_scan_period=", full_param, len_param)) { + conf->roam_scan_period[0] = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("roam_scan_period = %d\n", conf->roam_scan_period[0]); + } + else if (!strncmp("roam_delta=", full_param, len_param)) { + conf->roam_delta[0] = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("roam_delta = %d\n", conf->roam_delta[0]); + } + else if (!strncmp("fullroamperiod=", full_param, len_param)) { + conf->fullroamperiod = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("fullroamperiod = %d\n", conf->fullroamperiod); + } else + return false; + + return true; +} + +bool +dhd_conf_read_country(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + country_list_t *country_next = NULL, *country; + int i, count = 0; + char *pch, *pick_tmp, *pick_tmp2; + char *data = full_param+len_param; + uint len_data = strlen(data); + + /* Process country_list: + * country_list=[country1]:[ccode1]/[regrev1], + * [country2]:[ccode2]/[regrev2] \ + * Ex: country_list=US:US/0, TW:TW/1 + */ + if (!strncmp("ccode=", full_param, len_param)) { + len_data = min((uint)WLC_CNTRY_BUF_SZ, len_data); + memset(&conf->cspec, 0, sizeof(wl_country_t)); + memcpy(conf->cspec.country_abbrev, data, len_data); + memcpy(conf->cspec.ccode, data, len_data); + CONFIG_MSG("ccode = %s\n", conf->cspec.ccode); + } + else if (!strncmp("regrev=", full_param, len_param)) { + conf->cspec.rev = (int32)simple_strtol(data, NULL, 10); + CONFIG_MSG("regrev = %d\n", conf->cspec.rev); + } + else if (!strncmp("country_list=", full_param, len_param)) { + dhd_conf_free_country_list(conf); + pick_tmp = data; + for (i=0; icspec.country_abbrev, pch, 2); + pch = bcmstrtok(&pick_tmp2, "/", 0); + if (!pch) { + kfree(country); + break; + } + memcpy(country->cspec.ccode, pch, 2); + pch = bcmstrtok(&pick_tmp2, "/", 0); + if (!pch) { + kfree(country); + break; + } + country->cspec.rev = (int32)simple_strtol(pch, NULL, 10); + count++; + if (!conf->country_head) { + conf->country_head = country; + country_next = country; + } else { + country_next->next = country; + country_next = country; + } + CONFIG_TRACE("abbrev=%s, ccode=%s, regrev=%d\n", + country->cspec.country_abbrev, country->cspec.ccode, country->cspec.rev); + } + CONFIG_MSG("%d country in list\n", count); + } + else + return false; + + return true; +} + +bool +dhd_conf_read_mchan_params(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + int i; + char *pch, *pick_tmp, *pick_tmp2; + struct dhd_conf *conf = dhd->conf; + mchan_params_t *mchan_next = NULL, *mchan; + char *data = full_param+len_param; + + /* Process mchan_bw: + * mchan_bw=[val]/[any/go/gc]/[any/source/sink] + * Ex: mchan_bw=80/go/source, 30/gc/sink + */ + if (!strncmp("mchan_bw=", full_param, len_param)) { + dhd_conf_free_mchan_list(conf); + pick_tmp = data; + for (i=0; ibw = (int)simple_strtol(pch, NULL, 0); + if (mchan->bw < 0 || mchan->bw > 100) { + CONFIG_ERROR("wrong bw %d\n", mchan->bw); + kfree(mchan); + break; + } + + pch = bcmstrtok(&pick_tmp2, "/", 0); + if (!pch) { + kfree(mchan); + break; + } else { + if (bcmstrstr(pch, "any")) { + mchan->p2p_mode = -1; + } else if (bcmstrstr(pch, "go")) { + mchan->p2p_mode = WL_P2P_IF_GO; + } else if (bcmstrstr(pch, "gc")) { + mchan->p2p_mode = WL_P2P_IF_CLIENT; + } + } + pch = bcmstrtok(&pick_tmp2, "/", 0); + if (!pch) { + kfree(mchan); + break; + } else { + if (bcmstrstr(pch, "any")) { + mchan->miracast_mode = -1; + } else if (bcmstrstr(pch, "source")) { + mchan->miracast_mode = MIRACAST_SOURCE; + } else if (bcmstrstr(pch, "sink")) { + mchan->miracast_mode = MIRACAST_SINK; + } + } + if (!conf->mchan) { + conf->mchan = mchan; + mchan_next = mchan; + } else { + mchan_next->next = mchan; + mchan_next = mchan; + } + CONFIG_TRACE("mchan_bw=%d/%d/%d\n", mchan->bw,mchan->p2p_mode, + mchan->miracast_mode); + } + } + else + return false; + + return true; +} + +#ifdef PKT_FILTER_SUPPORT +bool +dhd_conf_read_pkt_filter(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + char *pch, *pick_tmp; + int i; + + /* Process pkt filter: + * 1) pkt_filter_add=99 0 0 0 0x000000000000 0x000000000000 + * 2) pkt_filter_delete=100, 102, 103, 104, 105 + * 3) magic_pkt_filter_add=141 0 1 12 + */ + if (!strncmp("dhd_master_mode=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + dhd_master_mode = FALSE; + else + dhd_master_mode = TRUE; + CONFIG_MSG("dhd_master_mode = %d\n", dhd_master_mode); + } + else if (!strncmp("pkt_filter_add=", full_param, len_param)) { + pick_tmp = data; + pch = bcmstrtok(&pick_tmp, ",.-", 0); + i=0; + while (pch != NULL && ipkt_filter_add.filter[i][0], pch); + CONFIG_MSG("pkt_filter_add[%d][] = %s\n", + i, &conf->pkt_filter_add.filter[i][0]); + pch = bcmstrtok(&pick_tmp, ",.-", 0); + i++; + } + conf->pkt_filter_add.count = i; + } + else if (!strncmp("pkt_filter_delete=", full_param, len_param) || + !strncmp("pkt_filter_del=", full_param, len_param)) { + pick_tmp = data; + pch = bcmstrtok(&pick_tmp, " ,.-", 0); + i=0; + while (pch != NULL && ipkt_filter_del.id[i] = (uint32)simple_strtol(pch, NULL, 10); + pch = bcmstrtok(&pick_tmp, " ,.-", 0); + i++; + } + conf->pkt_filter_del.count = i; + CONFIG_MSG("pkt_filter_del id = "); + for (i=0; ipkt_filter_del.count; i++) + printf("%d ", conf->pkt_filter_del.id[i]); + printf("\n"); + } + else if (!strncmp("magic_pkt_filter_add=", full_param, len_param)) { + if (conf->magic_pkt_filter_add) { + kfree(conf->magic_pkt_filter_add); + conf->magic_pkt_filter_add = NULL; + } + if (!(conf->magic_pkt_filter_add = kmalloc(MAGIC_PKT_FILTER_LEN, GFP_KERNEL))) { + CONFIG_ERROR("kmalloc failed\n"); + } else { + memset(conf->magic_pkt_filter_add, 0, MAGIC_PKT_FILTER_LEN); + strcpy(conf->magic_pkt_filter_add, data); + CONFIG_MSG("magic_pkt_filter_add = %s\n", conf->magic_pkt_filter_add); + } + } + else + return false; + + return true; +} +#endif + +#ifdef ISAM_PREINIT +#if !defined(WL_EXT_IAPSTA) +#error "WL_EXT_IAPSTA should be defined to enable ISAM_PREINIT" +#endif /* !WL_EXT_IAPSTA */ +/* + * isam_init=mode [sta|ap|apsta|dualap] vifname [wlan1] + * isam_config=ifname [wlan0|wlan1] ssid [xxx] chan [x] + hidden [y|n] maxassoc [x] + amode [open|shared|wpapsk|wpa2psk|wpawpa2psk] + emode [none|wep|tkip|aes|tkipaes] + key [xxxxx] + * isam_enable=ifname [wlan0|wlan1] +*/ +bool +dhd_conf_read_isam(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + + if (!strncmp("isam_init=", full_param, len_param)) { + sprintf(conf->isam_init, "isam_init %s", data); + CONFIG_MSG("isam_init=%s\n", conf->isam_init); + } + else if (!strncmp("isam_config=", full_param, len_param)) { + sprintf(conf->isam_config, "isam_config %s", data); + CONFIG_MSG("isam_config=%s\n", conf->isam_config); + } + else if (!strncmp("isam_enable=", full_param, len_param)) { + sprintf(conf->isam_enable, "isam_enable %s", data); + CONFIG_MSG("isam_enable=%s\n", conf->isam_enable); + } + else + return false; + + return true; +} +#endif + +#ifdef IDHCP +bool +dhd_conf_read_dhcp_params(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + struct ipv4_addr ipa_set; + + if (!strncmp("dhcpc_enable=", full_param, len_param)) { + conf->dhcpc_enable = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("dhcpc_enable = %d\n", conf->dhcpc_enable); + } + else if (!strncmp("dhcpd_enable=", full_param, len_param)) { + conf->dhcpd_enable = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("dhcpd_enable = %d\n", conf->dhcpd_enable); + } + else if (!strncmp("dhcpd_ip_addr=", full_param, len_param)) { + if (!bcm_atoipv4(data, &ipa_set)) { + CONFIG_ERROR("dhcpd_ip_addr adress setting failed.n"); + return false; + } + memcpy(&conf->dhcpd_ip_addr, &ipa_set, sizeof(struct ipv4_addr)); + CONFIG_MSG("dhcpd_ip_addr = %s\n", data); + } + else if (!strncmp("dhcpd_ip_mask=", full_param, len_param)) { + if (!bcm_atoipv4(data, &ipa_set)) { + CONFIG_ERROR("dhcpd_ip_mask adress setting failed\n"); + return false; + } + memcpy(&conf->dhcpd_ip_mask, &ipa_set, sizeof(struct ipv4_addr)); + CONFIG_MSG("dhcpd_ip_mask = %s\n", data); + } + else if (!strncmp("dhcpd_ip_start=", full_param, len_param)) { + if (!bcm_atoipv4(data, &ipa_set)) { + CONFIG_ERROR("dhcpd_ip_start adress setting failed\n"); + return false; + } + memcpy(&conf->dhcpd_ip_start, &ipa_set, sizeof(struct ipv4_addr)); + CONFIG_MSG("dhcpd_ip_start = %s\n", data); + } + else if (!strncmp("dhcpd_ip_end=", full_param, len_param)) { + if (!bcm_atoipv4(data, &ipa_set)) { + CONFIG_ERROR("dhcpd_ip_end adress setting failed\n"); + return false; + } + memcpy(&conf->dhcpd_ip_end, &ipa_set, sizeof(struct ipv4_addr)); + CONFIG_MSG("dhcpd_ip_end = %s\n", data); + } + else + return false; + + return true; +} +#endif + +#ifdef BCMSDIO +bool +dhd_conf_read_sdio_params(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + + if (!strncmp("dhd_doflow=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + dhd_doflow = FALSE; + else + dhd_doflow = TRUE; + CONFIG_MSG("dhd_doflow = %d\n", dhd_doflow); + } + else if (!strncmp("dhd_slpauto=", full_param, len_param) || + !strncmp("kso_enable=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + dhd_slpauto = FALSE; + else + dhd_slpauto = TRUE; + CONFIG_MSG("dhd_slpauto = %d\n", dhd_slpauto); + } + else if (!strncmp("use_rxchain=", full_param, len_param)) { + conf->use_rxchain = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("use_rxchain = %d\n", conf->use_rxchain); + } + else if (!strncmp("dhd_txminmax=", full_param, len_param)) { + conf->dhd_txminmax = (uint)simple_strtol(data, NULL, 10); + CONFIG_MSG("dhd_txminmax = %d\n", conf->dhd_txminmax); + } + else if (!strncmp("txinrx_thres=", full_param, len_param)) { + conf->txinrx_thres = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("txinrx_thres = %d\n", conf->txinrx_thres); + } +#if defined(HW_OOB) + else if (!strncmp("oob_enabled_later=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->oob_enabled_later = FALSE; + else + conf->oob_enabled_later = TRUE; + CONFIG_MSG("oob_enabled_later = %d\n", conf->oob_enabled_later); + } +#endif + else if (!strncmp("dpc_cpucore=", full_param, len_param)) { + conf->dpc_cpucore = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("dpc_cpucore = %d\n", conf->dpc_cpucore); + } + else if (!strncmp("rxf_cpucore=", full_param, len_param)) { + conf->rxf_cpucore = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("rxf_cpucore = %d\n", conf->rxf_cpucore); + } +#if defined(BCMSDIOH_TXGLOM) + else if (!strncmp("txglomsize=", full_param, len_param)) { + conf->txglomsize = (uint)simple_strtol(data, NULL, 10); + if (conf->txglomsize > SDPCM_MAXGLOM_SIZE) + conf->txglomsize = SDPCM_MAXGLOM_SIZE; + CONFIG_MSG("txglomsize = %d\n", conf->txglomsize); + } + else if (!strncmp("txglom_ext=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->txglom_ext = FALSE; + else + conf->txglom_ext = TRUE; + CONFIG_MSG("txglom_ext = %d\n", conf->txglom_ext); + if (conf->txglom_ext) { + if ((conf->chip == BCM43362_CHIP_ID) || (conf->chip == BCM4330_CHIP_ID)) + conf->txglom_bucket_size = 1680; + else if (conf->chip == BCM43340_CHIP_ID || conf->chip == BCM43341_CHIP_ID || + conf->chip == BCM4334_CHIP_ID || conf->chip == BCM4324_CHIP_ID) + conf->txglom_bucket_size = 1684; + } + CONFIG_MSG("txglom_bucket_size = %d\n", conf->txglom_bucket_size); + } + else if (!strncmp("bus:rxglom=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->bus_rxglom = FALSE; + else + conf->bus_rxglom = TRUE; + CONFIG_MSG("bus:rxglom = %d\n", conf->bus_rxglom); + } + else if (!strncmp("deferred_tx_len=", full_param, len_param)) { + conf->deferred_tx_len = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("deferred_tx_len = %d\n", conf->deferred_tx_len); + } + else if (!strncmp("txctl_tmo_fix=", full_param, len_param)) { + conf->txctl_tmo_fix = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("txctl_tmo_fix = %d\n", conf->txctl_tmo_fix); + } + else if (!strncmp("tx_max_offset=", full_param, len_param)) { + conf->tx_max_offset = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("tx_max_offset = %d\n", conf->tx_max_offset); + } + else if (!strncmp("txglom_mode=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->txglom_mode = FALSE; + else + conf->txglom_mode = TRUE; + CONFIG_MSG("txglom_mode = %d\n", conf->txglom_mode); + } +#if defined(SDIO_ISR_THREAD) + else if (!strncmp("intr_extn=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->intr_extn = FALSE; + else + conf->intr_extn = TRUE; + CONFIG_MSG("intr_extn = %d\n", conf->intr_extn); + } +#endif +#ifdef BCMSDIO_RXLIM_POST + else if (!strncmp("rxlim_en=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->rxlim_en = FALSE; + else + conf->rxlim_en = TRUE; + CONFIG_MSG("rxlim_en = %d\n", conf->rxlim_en); + } +#endif +#endif + else + return false; + + return true; +} +#endif + +#ifdef BCMPCIE +bool +dhd_conf_read_pcie_params(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + + if (!strncmp("bus:deepsleep_disable=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->bus_deepsleep_disable = 0; + else + conf->bus_deepsleep_disable = 1; + CONFIG_MSG("bus:deepsleep_disable = %d\n", conf->bus_deepsleep_disable); + } + else + return false; + + return true; +} +#endif + +bool +dhd_conf_read_pm_params(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + + if (!strncmp("deepsleep=", full_param, len_param)) { + if (!strncmp(data, "1", 1)) + conf->deepsleep = TRUE; + else + conf->deepsleep = FALSE; + CONFIG_MSG("deepsleep = %d\n", conf->deepsleep); + } + else if (!strncmp("PM=", full_param, len_param)) { + conf->pm = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("PM = %d\n", conf->pm); + } + else if (!strncmp("pm_in_suspend=", full_param, len_param)) { + conf->pm_in_suspend = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("pm_in_suspend = %d\n", conf->pm_in_suspend); + } + else if (!strncmp("suspend_mode=", full_param, len_param)) { + conf->suspend_mode = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("suspend_mode = %d\n", conf->suspend_mode); + if (conf->suspend_mode == PM_NOTIFIER) + conf->insuspend |= (NO_TXDATA_IN_SUSPEND | NO_TXCTL_IN_SUSPEND); + } + else if (!strncmp("suspend_bcn_li_dtim=", full_param, len_param)) { + conf->suspend_bcn_li_dtim = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("suspend_bcn_li_dtim = %d\n", conf->suspend_bcn_li_dtim); + } + else if (!strncmp("xmit_in_suspend=", full_param, len_param)) { + if (!strncmp(data, "1", 1)) + conf->insuspend &= ~NO_TXDATA_IN_SUSPEND; + else + conf->insuspend |= NO_TXDATA_IN_SUSPEND; + CONFIG_MSG("insuspend = 0x%x\n", conf->insuspend); + } + else if (!strncmp("insuspend=", full_param, len_param)) { + conf->insuspend = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("insuspend = 0x%x\n", conf->insuspend); + } +#ifdef WL_EXT_WOWL + else if (!strncmp("wowl=", full_param, len_param)) { + conf->wowl = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("wowl = 0x%x\n", conf->wowl); + } +#endif + else + return false; + + return true; +} + +#ifdef GET_CUSTOM_MAC_FROM_CONFIG +int +bcm_str2hex(const char *p, char *ea, int size) +{ + int i = 0; + char *ep; + + for (;;) { + ea[i++] = (char) bcm_strtoul(p, &ep, 16); + p = ep; + if (!*p++ || i == size) + break; + } + + return (i == size); +} +#endif + +bool +dhd_conf_read_others(dhd_pub_t *dhd, char *full_param, uint len_param) +{ + struct dhd_conf *conf = dhd->conf; + char *data = full_param+len_param; + char *pch, *pick_tmp; + int i; +#ifdef GET_CUSTOM_MAC_FROM_CONFIG + struct ether_addr ea_addr; + char macpad[56]; +#endif + + if (!strncmp("dhd_poll=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->dhd_poll = 0; + else + conf->dhd_poll = 1; + CONFIG_MSG("dhd_poll = %d\n", conf->dhd_poll); + } + else if (!strncmp("dhd_watchdog_ms=", full_param, len_param)) { + dhd_watchdog_ms = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("dhd_watchdog_ms = %d\n", dhd_watchdog_ms); + } + else if (!strncmp("band=", full_param, len_param)) { + /* Process band: + * band=a for 5GHz only and band=b for 2.4GHz only + */ + if (!strcmp(data, "b")) + conf->band = WLC_BAND_2G; + else if (!strcmp(data, "a")) + conf->band = WLC_BAND_5G; + else + conf->band = WLC_BAND_AUTO; + CONFIG_MSG("band = %d\n", conf->band); + } + else if (!strncmp("bw_cap_2g=", full_param, len_param)) { + conf->bw_cap[0] = (uint)simple_strtol(data, NULL, 0); + CONFIG_MSG("bw_cap_2g = %d\n", conf->bw_cap[0]); + } + else if (!strncmp("bw_cap_5g=", full_param, len_param)) { + conf->bw_cap[1] = (uint)simple_strtol(data, NULL, 0); + CONFIG_MSG("bw_cap_5g = %d\n", conf->bw_cap[1]); + } + else if (!strncmp("bw_cap=", full_param, len_param)) { + pick_tmp = data; + pch = bcmstrtok(&pick_tmp, " ,.-", 0); + if (pch != NULL) { + conf->bw_cap[0] = (uint32)simple_strtol(pch, NULL, 0); + CONFIG_MSG("bw_cap 2g = %d\n", conf->bw_cap[0]); + } + pch = bcmstrtok(&pick_tmp, " ,.-", 0); + if (pch != NULL) { + conf->bw_cap[1] = (uint32)simple_strtol(pch, NULL, 0); + CONFIG_MSG("bw_cap 5g = %d\n", conf->bw_cap[1]); + } + } + else if (!strncmp("channels=", full_param, len_param)) { + pick_tmp = data; + pch = bcmstrtok(&pick_tmp, " ,.-", 0); + i=0; + while (pch != NULL && ichannels.channel[i] = (uint32)simple_strtol(pch, NULL, 10); + pch = bcmstrtok(&pick_tmp, " ,.-", 0); + i++; + } + conf->channels.count = i; + CONFIG_MSG("channels = "); + for (i=0; ichannels.count; i++) + printf("%d ", conf->channels.channel[i]); + printf("\n"); + } + else if (!strncmp("keep_alive_period=", full_param, len_param)) { + conf->keep_alive_period = (uint)simple_strtol(data, NULL, 10); + CONFIG_MSG("keep_alive_period = %d\n", conf->keep_alive_period); + } +#ifdef ARP_OFFLOAD_SUPPORT + else if (!strncmp("garp=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + conf->garp = FALSE; + else + conf->garp = TRUE; + CONFIG_MSG("garp = %d\n", conf->garp); + } +#endif + else if (!strncmp("srl=", full_param, len_param)) { + conf->srl = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("srl = %d\n", conf->srl); + } + else if (!strncmp("lrl=", full_param, len_param)) { + conf->lrl = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("lrl = %d\n", conf->lrl); + } + else if (!strncmp("bcn_timeout=", full_param, len_param)) { + conf->bcn_timeout= (uint)simple_strtol(data, NULL, 10); + CONFIG_MSG("bcn_timeout = %d\n", conf->bcn_timeout); + } + else if (!strncmp("frameburst=", full_param, len_param)) { + conf->frameburst = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("frameburst = %d\n", conf->frameburst); + } + else if (!strncmp("disable_proptx=", full_param, len_param)) { + conf->disable_proptx = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("disable_proptx = %d\n", conf->disable_proptx); + } +#ifdef DHDTCPACK_SUPPRESS + else if (!strncmp("tcpack_sup_mode=", full_param, len_param)) { + conf->tcpack_sup_mode = (uint)simple_strtol(data, NULL, 10); + CONFIG_MSG("tcpack_sup_mode = %d\n", conf->tcpack_sup_mode); + } +#endif + else if (!strncmp("pktprio8021x=", full_param, len_param)) { + conf->pktprio8021x = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("pktprio8021x = %d\n", conf->pktprio8021x); + } +#if defined(BCMSDIO) || defined(BCMPCIE) + else if (!strncmp("dhd_txbound=", full_param, len_param)) { + dhd_txbound = (uint)simple_strtol(data, NULL, 10); + CONFIG_MSG("dhd_txbound = %d\n", dhd_txbound); + } + else if (!strncmp("dhd_rxbound=", full_param, len_param)) { + dhd_rxbound = (uint)simple_strtol(data, NULL, 10); + CONFIG_MSG("dhd_rxbound = %d\n", dhd_rxbound); + } +#endif + else if (!strncmp("orphan_move=", full_param, len_param)) { + conf->orphan_move = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("orphan_move = %d\n", conf->orphan_move); + } + else if (!strncmp("tsq=", full_param, len_param)) { + conf->tsq = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("tsq = %d\n", conf->tsq); + } + else if (!strncmp("ctrl_resched=", full_param, len_param)) { + conf->ctrl_resched = (int)simple_strtol(data, NULL, 10); + CONFIG_MSG("ctrl_resched = %d\n", conf->ctrl_resched); + } + else if (!strncmp("in4way=", full_param, len_param)) { + conf->in4way = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("in4way = 0x%x\n", conf->in4way); + } + else if (!strncmp("wl_preinit=", full_param, len_param)) { + if (conf->wl_preinit) { + kfree(conf->wl_preinit); + conf->wl_preinit = NULL; + } + if (!(conf->wl_preinit = kmalloc(len_param+1, GFP_KERNEL))) { + CONFIG_ERROR("kmalloc failed\n"); + } else { + memset(conf->wl_preinit, 0, len_param+1); + strcpy(conf->wl_preinit, data); + CONFIG_MSG("wl_preinit = %s\n", conf->wl_preinit); + } + } + else if (!strncmp("wl_suspend=", full_param, len_param)) { + if (conf->wl_suspend) { + kfree(conf->wl_suspend); + conf->wl_suspend = NULL; + } + if (!(conf->wl_suspend = kmalloc(len_param+1, GFP_KERNEL))) { + CONFIG_ERROR("kmalloc failed\n"); + } else { + memset(conf->wl_suspend, 0, len_param+1); + strcpy(conf->wl_suspend, data); + CONFIG_MSG("wl_suspend = %s\n", conf->wl_suspend); + } + } + else if (!strncmp("wl_resume=", full_param, len_param)) { + if (conf->wl_resume) { + kfree(conf->wl_resume); + conf->wl_resume = NULL; + } + if (!(conf->wl_resume = kmalloc(len_param+1, GFP_KERNEL))) { + CONFIG_ERROR("kmalloc failed\n"); + } else { + memset(conf->wl_resume, 0, len_param+1); + strcpy(conf->wl_resume, data); + CONFIG_MSG("wl_resume = %s\n", conf->wl_resume); + } + } +#ifdef GET_CUSTOM_MAC_FROM_CONFIG + else if (!strncmp("mac=", full_param, len_param)) { + if (!bcm_ether_atoe(data, &ea_addr)) { + CONFIG_ERROR("mac adress read error"); + return false; + } + memcpy(&conf->hw_ether, &ea_addr, ETHER_ADDR_LEN); + CONFIG_MSG("mac = %s\n", data); + } + else if (!strncmp("macpad=", full_param, len_param)) { + if (!bcm_str2hex(data, macpad, sizeof(macpad))) { + CONFIG_ERROR("macpad adress read error"); + return false; + } + memcpy(&conf->hw_ether[ETHER_ADDR_LEN], macpad, sizeof(macpad)); + if (config_msg_level & CONFIG_TRACE_LEVEL) { + printf("macpad =\n"); + for (i=0; ihw_ether[ETHER_ADDR_LEN+i]); + if ((i+1)%8 == 0) + printf("\n"); + } + } + } +#endif +#ifdef PROPTX_MAXCOUNT + else if (!strncmp("proptx_maxcnt_2g=", full_param, len_param)) { + conf->proptx_maxcnt_2g = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("proptx_maxcnt_2g = 0x%x\n", conf->proptx_maxcnt_2g); + } + else if (!strncmp("proptx_maxcnt_5g=", full_param, len_param)) { + conf->proptx_maxcnt_5g = (int)simple_strtol(data, NULL, 0); + CONFIG_MSG("proptx_maxcnt_5g = 0x%x\n", conf->proptx_maxcnt_5g); + } +#endif + else + return false; + + return true; +} + +static int askey_dhd_conf_read_unifykeys_wifi_disable_5g_band(dhd_pub_t *dhd) { + int state = 0; + char wifi_disable_5g_band[8] = {0}; + char * wl_preinit = NULL; + int size = 0; + struct dhd_conf *conf = dhd->conf; + + for (state = 1; state > 0;) { + switch (state) { + case 1: + if (0 != getUnifyKey("wifi_disable_5g_band", wifi_disable_5g_band, sizeof(wifi_disable_5g_band))) { + state = -1; + break; + } + + if (conf->wl_preinit) { + // There is a setting for wl_preinit in the config file. + if (NULL != strstr(conf->wl_preinit, "disable_5g_band=")) { + /* Skip wifi_disable_5g_band of unifykeys because there + * is a setting for disable_5g_band in wl_preinit in the + * config file. + */ + state = 0; + break; + } + // Backup conf->wl_preinit + size = strlen(conf->wl_preinit) + 1; + wl_preinit = kmalloc(size, GFP_KERNEL); + memset(wl_preinit, 0, size); + strcpy(wl_preinit, conf->wl_preinit); + kfree(conf->wl_preinit); + conf->wl_preinit = NULL; + } + + // Create new wl_preinit with disable_5g_band and the backup wl_preinit + size = strlen("disable_5g_band=") + strlen("wifi_disable_5g_band"); + if (wl_preinit) { + size += strlen(",") + strlen(wl_preinit); + } + size++; + conf->wl_preinit = kmalloc(size, GFP_KERNEL); + memset(conf->wl_preinit, 0, size); + strcpy(conf->wl_preinit, "disable_5g_band="); + strcat(conf->wl_preinit, wifi_disable_5g_band); + if (wl_preinit) { + strcat(conf->wl_preinit, ","); + strcat(conf->wl_preinit, wl_preinit); + kfree(wl_preinit); + wl_preinit = NULL; + } + state = 0; + break; + + } + } + + return state; +} + +int +dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path) +{ + int bcmerror = -1, chip_match = -1; + uint len = 0, start_pos=0, end_pos=0; + void *image = NULL; + char *memblock = NULL; + char *bufp, *pick = NULL, *pch; + bool conf_file_exists; + uint len_param; + + conf_file_exists = ((conf_path != NULL) && (conf_path[0] != '\0')); + if (!conf_file_exists) { + CONFIG_MSG("config path %s\n", conf_path); + askey_dhd_conf_read_unifykeys_wifi_disable_5g_band(dhd); + return (0); + } + + if (conf_file_exists) { + image = dhd_os_open_image1(dhd, conf_path); + if (image == NULL) { + CONFIG_MSG("Ignore config file %s\n", conf_path); + goto err; + } + } + + memblock = MALLOC(dhd->osh, MAXSZ_CONFIG); + if (memblock == NULL) { + CONFIG_ERROR("Failed to allocate memory %d bytes\n", MAXSZ_CONFIG); + goto err; + } + + pick = MALLOC(dhd->osh, MAXSZ_BUF); + if (!pick) { + CONFIG_ERROR("Failed to allocate memory %d bytes\n", MAXSZ_BUF); + goto err; + } + + /* Read variables */ + if (conf_file_exists) { + len = dhd_os_get_image_block(memblock, MAXSZ_CONFIG, image); + } + if (len > 0 && len < MAXSZ_CONFIG) { + bufp = (char *)memblock; + bufp[len] = 0; + + while (start_pos < len) { + memset(pick, 0, MAXSZ_BUF); + end_pos = pick_config_vars(bufp, len, start_pos, pick, MAXSZ_BUF); + if (end_pos - start_pos >= MAXSZ_BUF) + CONFIG_ERROR("out of buf to read MAXSIZ_BUF=%d\n", MAXSZ_BUF); + start_pos = end_pos; + pch = strchr(pick, '='); + if (pch != NULL) { + len_param = pch-pick+1; + if (len_param == strlen(pick)) { + CONFIG_ERROR("not a right parameter %s\n", pick); + continue; + } + } else { + CONFIG_ERROR("not a right parameter %s\n", pick); + continue; + } + + dhd_conf_read_chiprev(dhd, &chip_match, pick, len_param); + if (!chip_match) + continue; + + if (dhd_conf_read_log_level(dhd, pick, len_param)) + continue; + else if (dhd_conf_read_roam_params(dhd, pick, len_param)) + continue; + else if (dhd_conf_read_wme_ac_params(dhd, pick, len_param)) + continue; +#ifdef BCMSDIO + else if (dhd_conf_read_fw_by_mac(dhd, pick, len_param)) + continue; + else if (dhd_conf_read_nv_by_mac(dhd, pick, len_param)) + continue; +#endif + else if (dhd_conf_read_nv_by_chip(dhd, pick, len_param)) + continue; + else if (dhd_conf_read_country(dhd, pick, len_param)) + continue; + else if (dhd_conf_read_mchan_params(dhd, pick, len_param)) + continue; +#ifdef PKT_FILTER_SUPPORT + else if (dhd_conf_read_pkt_filter(dhd, pick, len_param)) + continue; +#endif /* PKT_FILTER_SUPPORT */ +#ifdef ISAM_PREINIT + else if (dhd_conf_read_isam(dhd, pick, len_param)) + continue; +#endif /* ISAM_PREINIT */ +#ifdef IDHCP + else if (dhd_conf_read_dhcp_params(dhd, pick, len_param)) + continue; +#endif /* IDHCP */ +#ifdef BCMSDIO + else if (dhd_conf_read_sdio_params(dhd, pick, len_param)) + continue; +#endif /* BCMSDIO */ +#ifdef BCMPCIE + else if (dhd_conf_read_pcie_params(dhd, pick, len_param)) + continue; +#endif /* BCMPCIE */ + else if (dhd_conf_read_pm_params(dhd, pick, len_param)) + continue; + else if (dhd_conf_read_others(dhd, pick, len_param)) + continue; + else + continue; + } + + bcmerror = 0; + } else { + CONFIG_ERROR("error reading config file: %d\n", len); + bcmerror = BCME_SDIO_ERROR; + } + +err: + if (pick) + MFREE(dhd->osh, pick, MAXSZ_BUF); + + if (memblock) + MFREE(dhd->osh, memblock, MAXSZ_CONFIG); + + if (image) + dhd_os_close_image1(dhd, image); + + askey_dhd_conf_read_unifykeys_wifi_disable_5g_band(dhd); + + return bcmerror; +} + +int +dhd_conf_set_chiprev(dhd_pub_t *dhd, uint chip, uint chiprev) +{ + CONFIG_MSG("chip=0x%x, chiprev=%d\n", chip, chiprev); + dhd->conf->chip = chip; + dhd->conf->chiprev = chiprev; + return 0; +} + +uint +dhd_conf_get_chip(void *context) +{ + dhd_pub_t *dhd = context; + + if (dhd && dhd->conf) + return dhd->conf->chip; + return 0; +} + +uint +dhd_conf_get_chiprev(void *context) +{ + dhd_pub_t *dhd = context; + + if (dhd && dhd->conf) + return dhd->conf->chiprev; + return 0; +} + +#ifdef BCMSDIO +void +dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable) +{ + struct dhd_conf *conf = dhd->conf; + + if (enable) { +#if defined(BCMSDIOH_TXGLOM_EXT) + if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID || + conf->chip == BCM43340_CHIP_ID || conf->chip == BCM43341_CHIP_ID || + conf->chip == BCM4334_CHIP_ID || conf->chip == BCM4324_CHIP_ID) { + conf->txglom_mode = SDPCM_TXGLOM_CPY; + } +#endif + // other parameters set in preinit or config.txt + if (conf->txglom_ext) + CONFIG_MSG("txglom_ext=%d, txglom_bucket_size=%d\n", + conf->txglom_ext, conf->txglom_bucket_size); + CONFIG_MSG("txglom_mode=%s\n", + conf->txglom_mode==SDPCM_TXGLOM_MDESC?"multi-desc":"copy"); + CONFIG_MSG("txglomsize=%d, deferred_tx_len=%d\n", + conf->txglomsize, conf->deferred_tx_len); + CONFIG_MSG("txinrx_thres=%d, dhd_txminmax=%d\n", + conf->txinrx_thres, conf->dhd_txminmax); + CONFIG_MSG("tx_max_offset=%d, txctl_tmo_fix=%d\n", + conf->tx_max_offset, conf->txctl_tmo_fix); + } else { + // clear txglom parameters + conf->txglom_ext = FALSE; + conf->txglom_bucket_size = 0; + conf->txglomsize = 0; + conf->deferred_tx_len = 0; + } + +} +#endif + +void +dhd_conf_postinit_ioctls(dhd_pub_t *dhd) +{ + struct dhd_conf *conf = dhd->conf; + char wl_preinit[] = "assoc_retry_max=20"; +#ifdef NO_POWER_SAVE + char wl_no_power_save[] = "mpc=0, 86=0"; + dhd_conf_set_wl_cmd(dhd, wl_no_power_save, FALSE); +#endif + + dhd_conf_set_intiovar(dhd, WLC_UP, "WLC_UP", 0, 0, FALSE); + dhd_conf_map_country_list(dhd, &conf->cspec); + dhd_conf_set_country(dhd, &conf->cspec); + dhd_conf_fix_country(dhd); + dhd_conf_get_country(dhd, &dhd->dhd_cspec); + + dhd_conf_set_intiovar(dhd, WLC_SET_BAND, "WLC_SET_BAND", conf->band, 0, FALSE); + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bcn_timeout", conf->bcn_timeout, 0, FALSE); + dhd_conf_set_intiovar(dhd, WLC_SET_PM, "WLC_SET_PM", conf->pm, 0, FALSE); + dhd_conf_set_intiovar(dhd, WLC_SET_SRL, "WLC_SET_SRL", conf->srl, 0, FALSE); + dhd_conf_set_intiovar(dhd, WLC_SET_LRL, "WLC_SET_LRL", conf->lrl, 0, FALSE); + dhd_conf_set_bw_cap(dhd); + dhd_conf_set_roam(dhd); + +#if defined(BCMPCIE) + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "bus:deepsleep_disable", + conf->bus_deepsleep_disable, 0, FALSE); +#endif /* defined(BCMPCIE) */ + +#ifdef IDHCP + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "dhcpc_enable", conf->dhcpc_enable, + 0, FALSE); + if (conf->dhcpd_enable >= 0) { + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "dhcpd_ip_addr", + (char *)&conf->dhcpd_ip_addr, sizeof(conf->dhcpd_ip_addr), FALSE); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "dhcpd_ip_mask", + (char *)&conf->dhcpd_ip_mask, sizeof(conf->dhcpd_ip_mask), FALSE); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "dhcpd_ip_start", + (char *)&conf->dhcpd_ip_start, sizeof(conf->dhcpd_ip_start), FALSE); + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "dhcpd_ip_end", + (char *)&conf->dhcpd_ip_end, sizeof(conf->dhcpd_ip_end), FALSE); + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "dhcpd_enable", + conf->dhcpd_enable, 0, FALSE); + } +#endif + dhd_conf_set_intiovar(dhd, WLC_SET_FAKEFRAG, "WLC_SET_FAKEFRAG", + conf->frameburst, 0, FALSE); + + dhd_conf_set_wl_cmd(dhd, wl_preinit, TRUE); +#if defined(BCMSDIO) + { + char ampdu_mpdu[] = "ampdu_mpdu=16"; + dhd_conf_set_wl_cmd(dhd, ampdu_mpdu, TRUE); + } +#endif + if (conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || + conf->chip == BCM4371_CHIP_ID || conf->chip == BCM4359_CHIP_ID || + conf->chip == BCM43569_CHIP_ID || + conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID) { + dhd_conf_set_intiovar(dhd, WLC_SET_VAR, "txbf", 1, 0, FALSE); + } +#if defined(WLEASYMESH) + { + char ezmesh[] = "mbss=1, rsdb_mode=0"; + dhd_conf_set_wl_cmd(dhd, ezmesh, TRUE); + } +#endif + dhd_conf_set_wl_cmd(dhd, conf->wl_preinit, TRUE); + +#ifndef WL_CFG80211 + dhd_conf_set_intiovar(dhd, WLC_UP, "WLC_UP", 0, 0, FALSE); +#endif + +} + +static int getUnifyKey(char * inKeyName, unsigned char * outValueBuf, unsigned int inValueBufSize) { + unsigned int keyLen = 0; + unsigned char * buf = NULL; + + if (NULL == inKeyName || NULL == outValueBuf || 0 == inValueBufSize) { + return -1; + } + memset(outValueBuf, 0, inValueBufSize); + if (key_unify_size(get_ukdev(), inKeyName, &keyLen) < 0) { + return -1; + } + if (0 == keyLen) { + return -1; + } + if ((sizeof(unsigned char) * keyLen) > inValueBufSize) { + return -1; + } + + if (NULL == (buf = kzalloc((sizeof(unsigned char) * keyLen), GFP_KERNEL))) { + return -1; + } + + if (key_unify_read(get_ukdev(), inKeyName, buf, keyLen, &keyLen) < 0) { + kfree(buf); + buf = NULL; + return -1; + } + + strcpy(outValueBuf, buf); + + if (NULL != buf) { + kfree(buf); + buf = NULL; + } + + return 0; +} + +char * kzalloc2getUnifyKey(char * inKeyName) { + unsigned int keyLen = 0; + unsigned char * buf = NULL; + + if (NULL == inKeyName) { + return NULL; + } + + if (key_unify_size(get_ukdev(), inKeyName, &keyLen) < 0) { + return NULL; + } + + if (0 == keyLen) { + return NULL; + } + + if (NULL == (buf = kzalloc(((sizeof(unsigned char) * keyLen) + 1), GFP_KERNEL))) { + return NULL; + } + + if (key_unify_read(get_ukdev(), inKeyName, buf, keyLen, &keyLen) < 0) { + kfree(buf); + buf = NULL; + return NULL; + } + + buf[keyLen] = '\0'; + + return buf; +} + +int askey_dhd_conf_preinit_by_sn(struct dhd_conf *conf) { + char * usid = NULL; + int i = 0; + struct { + char * country; + char * ccode; + int regrev; + } tbl[] = { + {"USA", "US", 1}, // the default MUST be put at the first place of this table + {"JPN", "JP", 58}, + {"AUS", "AU", 6}, + {"NZL", "NZ", 4}, + {"HKG", "HK", 2}, + {"CAN", "CA", 2}, + {"TWN", "TW", 1}, + {"CHN", "CN", 38}, + {"DEU", "DE", 7}, + {"FRA", "FR", 5}, + {"NLD", "NL", 4}, + {"ITA", "IT", 4}, + {"BGR", "BG", 4}, + {"HUN", "HU", 4}, + {"AUT", "AT", 4}, + {"RUS", "RU", 986}, + {"GBR", "GB", 6}, + {"BRA", "BR", 4}, + {"MEX", "MX", 20}, + {"IND", "IN", 3}, + {"PHL", "PH", 5}, + {"SGP", "SG", 0}, + {"MYS", "MY", 3}, + {"AND", "AD", 0}, + {"ARE", "AE", 6}, + {"ATG", "AG", 2}, + {"AIA", "AI", 1}, + {"ALB", "AL", 2}, + {"ASM", "AS", 12}, + {"ABW", "AW", 2}, + {"AZE", "AZ", 2}, + {"BIH", "BA", 2}, + {"BGD", "BD", 2}, + {"BEL", "BE", 4}, + {"BHR", "BH", 4}, + {"BMU", "BM", 12}, + {"BRN", "BN", 4}, + {"BRA", "BR", 4}, + {"BHS", "BS", 2}, + {"BLR", "BY", 3}, + {"CAN", "CA", 2}, + {"CHE", "CH", 4}, + {"COL", "CO", 17}, + {"CRI", "CR", 17}, + {"CYP", "CY", 4}, + {"CZE", "CZ", 4}, + {"DEU", "DE", 7}, + {"DNK", "DK", 4}, + {"ECU", "EC", 21}, + {"EST", "EE", 4}, + {"EGY", "EG", 0}, + {"ESP", "ES", 4}, + {"ETH", "ET", 2}, + {"FIN", "FI", 4}, + {"GRD", "GD", 2}, + {"GEO", "GE", 0}, + {"PYF", "GF", 2}, + {"GRC", "GR", 4}, + {"GTM", "GT", 1}, + {"GUM", "GU", 12}, + {"HRV", "HR", 4}, + {"IDN", "ID", 13}, + {"IRL", "IE", 5}, + {"ISR", "IL", 7}, + {"ISL", "IS", 4}, + {"ITA", "IT", 4}, + {"JOR", "JO", 3}, + {"KHM", "KH", 2}, + {"KOR", "KR", 57}, + {"KWT", "KW", 5}, + {"CYM", "KY", 3}, + {"LAO", "LA", 2}, + {"LBN", "LB", 5}, + {"LIE", "LI", 4}, + {"LKA", "LK", 1}, + {"LSO", "LS", 2}, + {"LTU", "LT", 4}, + {"LUX", "LU", 3}, + {"LVA", "LV", 4}, + {"MAR", "MA", 2}, + {"MCO", "MC", 1}, + {"MDA", "MD", 2}, + {"MNE", "ME", 2}, + {"MKD", "MK", 2}, + {"MNG", "MN", 1}, + {"MRT", "MR", 2}, + {"MLT", "MT", 4}, + {"MUS", "MU", 2}, + {"MDV", "MV", 3}, + {"MWI", "MW", 1}, + {"NIC", "NI", 2}, + {"NLD", "NL", 4}, + {"NOR", "NO", 4}, + {"NZL", "NZ", 4}, + {"OMN", "OM", 4}, + {"PAN", "PA", 17}, + {"PER", "PE", 20}, + {"POL", "PL", 4}, + {"PRI", "PR", 20}, + {"PRT", "PT", 4}, + {"PRY", "PY", 2}, + {"REU", "RE", 2}, + {"ROU", "RO", 4}, + {"SRB", "RS", 2}, + {"SWE", "SE", 4}, + {"SVN", "SI", 4}, + {"SVK", "SK", 4}, + {"SMR", "SM", 0}, + {"SOM", "SV", 19}, + {"THA", "TH", 5}, + {"TUN", "TN", 999}, + {"TUR", "TR", 7}, + {"TTO", "TT", 3}, + {"UKR", "UA", 16}, + {"VAT", "VA", 2}, + {"VEN", "VE", 3}, + {"VGB", "VG", 2}, + {"VNM", "VN", 4}, + {"MYT", "YT", 2}, + {"ZAF", "ZA", 6}, + {NULL, NULL, -1} + }; + + if (NULL == (usid = kzalloc2getUnifyKey("usid")) || strlen(usid) < 4) { + i = 0; // for using tbl[0] as the default + }else { + for (i = 0; NULL != tbl[i].country; i++) { + if (0 == strncmp(tbl[i].country, &usid[1], 3)) { + break; + } + } + } + if (NULL == tbl[i].country) { + i = 0; // for using tbl[0] as the default + } + strcpy(conf->cspec.country_abbrev, tbl[i].ccode); + strcpy(conf->cspec.ccode, tbl[i].ccode); + conf->cspec.rev = tbl[i].regrev; + + if (usid) { + kfree(usid); + usid = NULL; + } + + return 0; +} + +static int askey_dhd_conf_preinit(struct dhd_conf *conf) { + char * wifi_country_abbrev_ptr = NULL; + char wifi_country_abbrev[4] = {0}; + char wifi_ccode[4] = {0}; + char wifi_regrev[4] = {0}; + long regrev = 0; + + if (NULL == conf) { + return -1; + } + if (0 == getUnifyKey("wifi_ccode", wifi_ccode, sizeof(wifi_ccode)) && + 0 == getUnifyKey("wifi_regrev", wifi_regrev, sizeof(wifi_regrev)) && + 0 == kstrtol(wifi_regrev, 10, ®rev)) { + if (0 == getUnifyKey("wifi_country_abbrev", wifi_country_abbrev, sizeof(wifi_country_abbrev))) { + wifi_country_abbrev_ptr = wifi_country_abbrev; + }else { + wifi_country_abbrev_ptr = wifi_ccode; + } + strcpy(conf->cspec.country_abbrev, wifi_country_abbrev_ptr); + strcpy(conf->cspec.ccode, wifi_ccode); + conf->cspec.rev = regrev; + }else { + strcpy(conf->cspec.country_abbrev, "CN"); + strcpy(conf->cspec.ccode, "CN"); + conf->cspec.rev = 38; + } + return 0; +} + +int +dhd_conf_preinit(dhd_pub_t *dhd) +{ + struct dhd_conf *conf = dhd->conf; + + CONFIG_TRACE("Enter\n"); + +#ifdef BCMSDIO + dhd_conf_free_mac_list(&conf->fw_by_mac); + dhd_conf_free_mac_list(&conf->nv_by_mac); +#endif + dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); + dhd_conf_free_country_list(conf); + dhd_conf_free_mchan_list(conf); + if (conf->magic_pkt_filter_add) { + kfree(conf->magic_pkt_filter_add); + conf->magic_pkt_filter_add = NULL; + } + if (conf->wl_preinit) { + kfree(conf->wl_preinit); + conf->wl_preinit = NULL; + } + if (conf->wl_suspend) { + kfree(conf->wl_suspend); + conf->wl_suspend = NULL; + } + if (conf->wl_resume) { + kfree(conf->wl_resume); + conf->wl_resume = NULL; + } + conf->band = -1; + memset(&conf->bw_cap, -1, sizeof(conf->bw_cap)); + if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID) { + strcpy(conf->cspec.country_abbrev, "ALL"); + strcpy(conf->cspec.ccode, "ALL"); + conf->cspec.rev = 0; + } else if (conf->chip == BCM4335_CHIP_ID || conf->chip == BCM4339_CHIP_ID || + conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || + conf->chip == BCM4345_CHIP_ID || conf->chip == BCM4371_CHIP_ID || + conf->chip == BCM43569_CHIP_ID || conf->chip == BCM4359_CHIP_ID || + conf->chip == BCM4362_CHIP_ID || conf->chip == BCM43751_CHIP_ID) { +#if 1 + askey_dhd_conf_preinit(conf); + askey_dhd_conf_preinit_by_sn(conf); +#else + strcpy(conf->cspec.country_abbrev, "CN"); + strcpy(conf->cspec.ccode, "CN"); + conf->cspec.rev = 38; +#endif + } else { + strcpy(conf->cspec.country_abbrev, "CN"); + strcpy(conf->cspec.ccode, "CN"); + conf->cspec.rev = 0; + } + memset(&conf->channels, 0, sizeof(wl_channel_list_t)); + conf->roam_off = 1; + conf->roam_off_suspend = 1; + conf->roam_trigger[0] = -65; + conf->roam_trigger[1] = WLC_BAND_ALL; + conf->roam_scan_period[0] = 10; + conf->roam_scan_period[1] = WLC_BAND_ALL; + conf->roam_delta[0] = 10; + conf->roam_delta[1] = WLC_BAND_ALL; + conf->fullroamperiod = 20; + conf->keep_alive_period = 30000; +#ifdef ARP_OFFLOAD_SUPPORT + conf->garp = FALSE; +#endif + conf->force_wme_ac = 0; + memset(&conf->wme_sta, 0, sizeof(wme_param_t)); + memset(&conf->wme_ap, 0, sizeof(wme_param_t)); +#ifdef PKT_FILTER_SUPPORT + memset(&conf->pkt_filter_add, 0, sizeof(conf_pkt_filter_add_t)); + memset(&conf->pkt_filter_del, 0, sizeof(conf_pkt_filter_del_t)); +#endif + conf->srl = -1; + conf->lrl = -1; + conf->bcn_timeout = 16; + conf->disable_proptx = -1; + conf->dhd_poll = -1; +#ifdef BCMSDIO + conf->use_rxchain = 0; + conf->bus_rxglom = TRUE; + conf->txglom_ext = FALSE; + conf->tx_max_offset = 0; + conf->txglomsize = SDPCM_DEFGLOM_SIZE; + conf->txctl_tmo_fix = 300; + conf->txglom_mode = SDPCM_TXGLOM_MDESC; + conf->deferred_tx_len = 0; + conf->dhd_txminmax = 1; + conf->txinrx_thres = -1; +#if defined(SDIO_ISR_THREAD) + conf->intr_extn = FALSE; +#endif +#ifdef BCMSDIO_RXLIM_POST + conf->rxlim_en = TRUE; +#endif +#if defined(HW_OOB) + conf->oob_enabled_later = FALSE; +#endif +#endif +#ifdef BCMPCIE + conf->bus_deepsleep_disable = 1; +#endif + conf->dpc_cpucore = -1; + conf->rxf_cpucore = -1; + conf->frameburst = -1; + conf->deepsleep = FALSE; + conf->pm = -1; + conf->pm_in_suspend = -1; + conf->insuspend = 0; + conf->suspend_mode = EARLY_SUSPEND; + conf->suspend_bcn_li_dtim = -1; +#ifdef WL_EXT_WOWL + dhd_master_mode = TRUE; + conf->wowl = WL_WOWL_NET|WL_WOWL_DIS|WL_WOWL_BCN; + conf->insuspend |= (WOWL_IN_SUSPEND | NO_TXDATA_IN_SUSPEND); +#endif + if (conf->suspend_mode == PM_NOTIFIER) + conf->insuspend |= (NO_TXDATA_IN_SUSPEND | NO_TXCTL_IN_SUSPEND); + conf->suspended = FALSE; +#ifdef SUSPEND_EVENT + memset(&conf->resume_eventmask, 0, sizeof(conf->resume_eventmask)); + memset(&conf->bssid_insuspend, 0, ETHER_ADDR_LEN); + conf->wlfc = FALSE; +#endif +#ifdef GET_CUSTOM_MAC_FROM_CONFIG + memset(&conf->hw_ether, 0, sizeof(conf->hw_ether)); +#endif +#ifdef IDHCP + conf->dhcpc_enable = -1; + conf->dhcpd_enable = -1; +#endif + conf->orphan_move = 0; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) + conf->tsq = 10; +#else + conf->tsq = 0; +#endif +#ifdef DHDTCPACK_SUPPRESS +#ifdef BCMPCIE + conf->tcpack_sup_mode = TCPACK_SUP_HOLD; +#else + conf->tcpack_sup_mode = TCPACK_SUP_OFF; +#endif +#endif + conf->pktprio8021x = -1; + conf->ctrl_resched = 2; + conf->in4way = NO_SCAN_IN4WAY | DONT_DELETE_GC_AFTER_WPS | WAIT_DISCONNECTED; +#ifdef PROPTX_MAXCOUNT + conf->proptx_maxcnt_2g = 46; + conf->proptx_maxcnt_5g = WL_TXSTATUS_FREERUNCTR_MASK; +#endif /* DYNAMIC_PROPTX_MAXCOUNT */ +#ifdef ISAM_PREINIT + memset(conf->isam_init, 0, sizeof(conf->isam_init)); + memset(conf->isam_config, 0, sizeof(conf->isam_config)); + memset(conf->isam_enable, 0, sizeof(conf->isam_enable)); +#endif +#ifdef CUSTOMER_HW_AMLOGIC + dhd_slpauto = FALSE; +#ifdef BCMSDIO + conf->txglom_mode = SDPCM_TXGLOM_CPY; +#endif +#endif +#if defined(SDIO_ISR_THREAD) + if (conf->chip == BCM43012_CHIP_ID || + conf->chip == BCM4335_CHIP_ID || conf->chip == BCM4339_CHIP_ID || + conf->chip == BCM43454_CHIP_ID || conf->chip == BCM4345_CHIP_ID || + conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || + conf->chip == BCM4345_CHIP_ID || conf->chip == BCM4371_CHIP_ID || + conf->chip == BCM4359_CHIP_ID || + conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID) { + conf->intr_extn = TRUE; + } +#endif + if ((conf->chip == BCM43430_CHIP_ID && conf->chiprev == 2) || + conf->chip == BCM43012_CHIP_ID || + conf->chip == BCM4335_CHIP_ID || conf->chip == BCM4339_CHIP_ID || + conf->chip == BCM43454_CHIP_ID || conf->chip == BCM4345_CHIP_ID || + conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || + conf->chip == BCM4345_CHIP_ID || conf->chip == BCM4371_CHIP_ID || + conf->chip == BCM43569_CHIP_ID || conf->chip == BCM4359_CHIP_ID || + conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID) { +#ifdef DHDTCPACK_SUPPRESS +#ifdef BCMSDIO + conf->tcpack_sup_mode = TCPACK_SUP_REPLACE; +#endif +#endif +#if defined(BCMSDIO) || defined(BCMPCIE) + dhd_rxbound = 128; + dhd_txbound = 64; +#endif + conf->frameburst = 1; +#ifdef BCMSDIO + conf->dhd_txminmax = -1; + conf->txinrx_thres = 128; +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) + conf->orphan_move = 1; +#else + conf->orphan_move = 0; +#endif + } + +#ifdef BCMSDIO +#if defined(BCMSDIOH_TXGLOM_EXT) + if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID || + conf->chip == BCM43340_CHIP_ID || conf->chip == BCM43341_CHIP_ID || + conf->chip == BCM4334_CHIP_ID || conf->chip == BCM4324_CHIP_ID) { + conf->txglom_ext = TRUE; + } else { + conf->txglom_ext = FALSE; + } + if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID) { + conf->txglom_bucket_size = 1680; // fixed value, don't change + conf->txglomsize = 6; + } + if (conf->chip == BCM4334_CHIP_ID || conf->chip == BCM43340_CHIP_ID || + conf->chip == BCM43341_CHIP_ID || conf->chip == BCM4324_CHIP_ID) { + conf->txglom_bucket_size = 1684; // fixed value, don't change + conf->txglomsize = 16; + } +#endif + if (conf->txglomsize > SDPCM_MAXGLOM_SIZE) + conf->txglomsize = SDPCM_MAXGLOM_SIZE; +#endif + init_waitqueue_head(&conf->event_complete); + + return 0; +} + +int +dhd_conf_reset(dhd_pub_t *dhd) +{ + struct dhd_conf *conf = dhd->conf; + +#ifdef BCMSDIO + dhd_conf_free_mac_list(&conf->fw_by_mac); + dhd_conf_free_mac_list(&conf->nv_by_mac); +#endif + dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); + dhd_conf_free_country_list(conf); + dhd_conf_free_mchan_list(conf); + if (conf->magic_pkt_filter_add) { + kfree(conf->magic_pkt_filter_add); + conf->magic_pkt_filter_add = NULL; + } + if (conf->wl_preinit) { + kfree(conf->wl_preinit); + conf->wl_preinit = NULL; + } + if (conf->wl_suspend) { + kfree(conf->wl_suspend); + conf->wl_suspend = NULL; + } + if (conf->wl_resume) { + kfree(conf->wl_resume); + conf->wl_resume = NULL; + } + memset(conf, 0, sizeof(dhd_conf_t)); + return 0; +} + +int +dhd_conf_attach(dhd_pub_t *dhd) +{ + dhd_conf_t *conf; + + CONFIG_TRACE("Enter\n"); + + if (dhd->conf != NULL) { + CONFIG_MSG("config is attached before!\n"); + return 0; + } + /* Allocate private bus interface state */ + if (!(conf = MALLOC(dhd->osh, sizeof(dhd_conf_t)))) { + CONFIG_ERROR("MALLOC failed\n"); + goto fail; + } + memset(conf, 0, sizeof(dhd_conf_t)); + + dhd->conf = conf; + + return 0; + +fail: + if (conf != NULL) + MFREE(dhd->osh, conf, sizeof(dhd_conf_t)); + return BCME_NOMEM; +} + +void +dhd_conf_detach(dhd_pub_t *dhd) +{ + struct dhd_conf *conf = dhd->conf; + + CONFIG_TRACE("Enter\n"); + if (dhd->conf) { +#ifdef BCMSDIO + dhd_conf_free_mac_list(&conf->fw_by_mac); + dhd_conf_free_mac_list(&conf->nv_by_mac); +#endif + dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); + dhd_conf_free_country_list(conf); + dhd_conf_free_mchan_list(conf); + if (conf->magic_pkt_filter_add) { + kfree(conf->magic_pkt_filter_add); + conf->magic_pkt_filter_add = NULL; + } + if (conf->wl_preinit) { + kfree(conf->wl_preinit); + conf->wl_preinit = NULL; + } + if (conf->wl_suspend) { + kfree(conf->wl_suspend); + conf->wl_suspend = NULL; + } + if (conf->wl_resume) { + kfree(conf->wl_resume); + conf->wl_resume = NULL; + } + MFREE(dhd->osh, conf, sizeof(dhd_conf_t)); + } + dhd->conf = NULL; +} diff --git a/bcmdhd.100.10.315.x/dhd_config.h b/bcmdhd.100.10.545.x/dhd_config.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_config.h rename to bcmdhd.100.10.545.x/dhd_config.h diff --git a/bcmdhd.100.10.315.x/dhd_csi.c b/bcmdhd.100.10.545.x/dhd_csi.c similarity index 96% rename from bcmdhd.100.10.315.x/dhd_csi.c rename to bcmdhd.100.10.545.x/dhd_csi.c index dd1a068..f61cced 100644 --- a/bcmdhd.100.10.315.x/dhd_csi.c +++ b/bcmdhd.100.10.545.x/dhd_csi.c @@ -1,220 +1,220 @@ -/* - * Broadcom Dongle Host Driver (DHD) - * - * Copyright (C) 1999-2018, Broadcom. - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhd_csi.c 606280 2015-12-15 05:28:25Z $ - */ -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define NULL_CHECK(p, s, err) \ - do { \ - if (!(p)) { \ - printf("NULL POINTER (%s) : %s\n", __FUNCTION__, (s)); \ - err = BCME_ERROR; \ - return err; \ - } \ - } while (0) - -#define TIMESPEC_TO_US(ts) (((uint64)(ts).tv_sec * USEC_PER_SEC) + \ - (ts).tv_nsec / NSEC_PER_USEC) - -#define NULL_ADDR "\x00\x00\x00\x00\x00\x00" - -int -dhd_csi_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data) -{ - int ret = BCME_OK; - bool is_new = TRUE; - cfr_dump_data_t *p_event; - cfr_dump_list_t *ptr, *next, *new; - - NULL_CHECK(dhd, "dhd is NULL", ret); - - DHD_TRACE(("Enter %s\n", __FUNCTION__)); - - if (!event_data) { - DHD_ERROR(("%s: event_data is NULL\n", __FUNCTION__)); - return -EINVAL; - } - p_event = (cfr_dump_data_t *)event_data; - - /* check if this addr exist */ - if (!list_empty(&dhd->csi_list)) { - list_for_each_entry_safe(ptr, next, &dhd->csi_list, list) { - if (bcmp(&ptr->entry.header.peer_macaddr, &p_event->header.peer_macaddr, - ETHER_ADDR_LEN) == 0) { - int pos = 0, dump_len = 0, remain = 0; - is_new = FALSE; - DHD_INFO(("CSI data exist\n")); - if (p_event->header.status == 0) { - bcopy(&p_event->header, &ptr->entry.header, sizeof(cfr_dump_header_t)); - dump_len = p_event->header.cfr_dump_length; - if (dump_len < MAX_EVENT_SIZE) { - bcopy(&p_event->data, &ptr->entry.data, dump_len); - } else { - /* for big csi data */ - uint8 *p = (uint8 *)&ptr->entry.data; - remain = p_event->header.remain_length; - if (remain) { - pos = dump_len - remain - MAX_EVENT_SIZE; - p += pos; - bcopy(&p_event->data, p, MAX_EVENT_SIZE); - } - /* copy rest of csi data */ - else { - pos = dump_len - (dump_len % MAX_EVENT_SIZE); - p += pos; - bcopy(&p_event->data, p, (dump_len % MAX_EVENT_SIZE)); - } - } - return BCME_OK; - } - } - } - } - if (is_new) { - if (dhd->csi_count < MAX_CSI_NUM) { - new = (cfr_dump_list_t *)MALLOCZ(dhd->osh, sizeof(cfr_dump_list_t)); - if (!new){ - DHD_ERROR(("Malloc cfr dump list error\n")); - return BCME_NOMEM; - } - bcopy(&p_event->header, &new->entry.header, sizeof(cfr_dump_header_t)); - DHD_INFO(("New entry data size %d\n", p_event->header.cfr_dump_length)); - /* for big csi data */ - if (p_event->header.remain_length) { - DHD_TRACE(("remain %d\n", p_event->header.remain_length)); - bcopy(&p_event->data, &new->entry.data, MAX_EVENT_SIZE); - } - else - bcopy(&p_event->data, &new->entry.data, p_event->header.cfr_dump_length); - INIT_LIST_HEAD(&(new->list)); - list_add_tail(&(new->list), &dhd->csi_list); - dhd->csi_count++; - } - else { - DHD_TRACE(("Over maximum CSI Number 8. SKIP it.\n")); - } - } - return ret; -} - -int -dhd_csi_init(dhd_pub_t *dhd) -{ - int err = BCME_OK; - - NULL_CHECK(dhd, "dhd is NULL", err); - INIT_LIST_HEAD(&dhd->csi_list); - dhd->csi_count = 0; - - return err; -} - -int -dhd_csi_deinit(dhd_pub_t *dhd) -{ - int err = BCME_OK; - cfr_dump_list_t *ptr, *next; - - NULL_CHECK(dhd, "dhd is NULL", err); - - if (!list_empty(&dhd->csi_list)) { - list_for_each_entry_safe(ptr, next, &dhd->csi_list, list) { - list_del(&ptr->list); - MFREE(dhd->osh, ptr, sizeof(cfr_dump_list_t)); - } - } - return err; -} - -void -dhd_csi_clean_list(dhd_pub_t *dhd) -{ - cfr_dump_list_t *ptr, *next; - int num = 0; - - if (!dhd) { - DHD_ERROR(("NULL POINTER: %s\n", __FUNCTION__)); - return; - } - - if (!list_empty(&dhd->csi_list)) { - list_for_each_entry_safe(ptr, next, &dhd->csi_list, list) { - if (0 == ptr->entry.header.remain_length) { - list_del(&ptr->list); - num++; - MFREE(dhd->osh, ptr, sizeof(cfr_dump_list_t)); - } - } - } - dhd->csi_count = 0; - DHD_TRACE(("Clean up %d record\n", num)); -} - -int -dhd_csi_dump_list(dhd_pub_t *dhd, char *buf) -{ - int ret = BCME_OK; - cfr_dump_list_t *ptr, *next; - uint8 * pbuf = buf; - int num = 0; - int length = 0; - - NULL_CHECK(dhd, "dhd is NULL", ret); - - /* check if this addr exist */ - if (!list_empty(&dhd->csi_list)) { - list_for_each_entry_safe(ptr, next, &dhd->csi_list, list) { - if (ptr->entry.header.remain_length) { - DHD_ERROR(("data not ready %d\n", ptr->entry.header.remain_length)); - continue; - } - bcopy(&ptr->entry.header, pbuf, sizeof(cfr_dump_header_t)); - length += sizeof(cfr_dump_header_t); - pbuf += sizeof(cfr_dump_header_t); - DHD_TRACE(("Copy data size %d\n", ptr->entry.header.cfr_dump_length)); - bcopy(&ptr->entry.data, pbuf, ptr->entry.header.cfr_dump_length); - length += ptr->entry.header.cfr_dump_length; - pbuf += ptr->entry.header.cfr_dump_length; - num++; - } - } - DHD_TRACE(("dump %d record %d bytes\n", num, length)); - - return length; -} - +/* + * Broadcom Dongle Host Driver (DHD) + * + * Copyright (C) 1999-2018, Broadcom. + * + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to you + * under the terms of the GNU General Public License version 2 (the "GPL"), + * available at http://www.broadcom.com/licenses/GPLv2.php, with the + * following added to such license: + * + * As a special exception, the copyright holders of this software give you + * permission to link this software with independent modules, and to copy and + * distribute the resulting executable under terms of your choice, provided that + * you also meet, for each linked independent module, the terms and conditions of + * the license of that module. An independent module is a module which is not + * derived from this software. The special exception does not apply to any + * modifications of the software. + * + * Notwithstanding the above, under no circumstances may you combine this + * software in any way with any other Broadcom software provided under a license + * other than the GPL, without Broadcom's express prior written consent. + * + * $Id: dhd_csi.c 606280 2015-12-15 05:28:25Z $ + */ +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define NULL_CHECK(p, s, err) \ + do { \ + if (!(p)) { \ + printf("NULL POINTER (%s) : %s\n", __FUNCTION__, (s)); \ + err = BCME_ERROR; \ + return err; \ + } \ + } while (0) + +#define TIMESPEC_TO_US(ts) (((uint64)(ts).tv_sec * USEC_PER_SEC) + \ + (ts).tv_nsec / NSEC_PER_USEC) + +#define NULL_ADDR "\x00\x00\x00\x00\x00\x00" + +int +dhd_csi_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data) +{ + int ret = BCME_OK; + bool is_new = TRUE; + cfr_dump_data_t *p_event; + cfr_dump_list_t *ptr, *next, *new; + + NULL_CHECK(dhd, "dhd is NULL", ret); + + DHD_TRACE(("Enter %s\n", __FUNCTION__)); + + if (!event_data) { + DHD_ERROR(("%s: event_data is NULL\n", __FUNCTION__)); + return -EINVAL; + } + p_event = (cfr_dump_data_t *)event_data; + + /* check if this addr exist */ + if (!list_empty(&dhd->csi_list)) { + list_for_each_entry_safe(ptr, next, &dhd->csi_list, list) { + if (bcmp(&ptr->entry.header.peer_macaddr, &p_event->header.peer_macaddr, + ETHER_ADDR_LEN) == 0) { + int pos = 0, dump_len = 0, remain = 0; + is_new = FALSE; + DHD_INFO(("CSI data exist\n")); + if (p_event->header.status == 0) { + bcopy(&p_event->header, &ptr->entry.header, sizeof(cfr_dump_header_t)); + dump_len = p_event->header.cfr_dump_length; + if (dump_len < MAX_EVENT_SIZE) { + bcopy(&p_event->data, &ptr->entry.data, dump_len); + } else { + /* for big csi data */ + uint8 *p = (uint8 *)&ptr->entry.data; + remain = p_event->header.remain_length; + if (remain) { + pos = dump_len - remain - MAX_EVENT_SIZE; + p += pos; + bcopy(&p_event->data, p, MAX_EVENT_SIZE); + } + /* copy rest of csi data */ + else { + pos = dump_len - (dump_len % MAX_EVENT_SIZE); + p += pos; + bcopy(&p_event->data, p, (dump_len % MAX_EVENT_SIZE)); + } + } + return BCME_OK; + } + } + } + } + if (is_new) { + if (dhd->csi_count < MAX_CSI_NUM) { + new = (cfr_dump_list_t *)MALLOCZ(dhd->osh, sizeof(cfr_dump_list_t)); + if (!new){ + DHD_ERROR(("Malloc cfr dump list error\n")); + return BCME_NOMEM; + } + bcopy(&p_event->header, &new->entry.header, sizeof(cfr_dump_header_t)); + DHD_INFO(("New entry data size %d\n", p_event->header.cfr_dump_length)); + /* for big csi data */ + if (p_event->header.remain_length) { + DHD_TRACE(("remain %d\n", p_event->header.remain_length)); + bcopy(&p_event->data, &new->entry.data, MAX_EVENT_SIZE); + } + else + bcopy(&p_event->data, &new->entry.data, p_event->header.cfr_dump_length); + INIT_LIST_HEAD(&(new->list)); + list_add_tail(&(new->list), &dhd->csi_list); + dhd->csi_count++; + } + else { + DHD_TRACE(("Over maximum CSI Number 8. SKIP it.\n")); + } + } + return ret; +} + +int +dhd_csi_init(dhd_pub_t *dhd) +{ + int err = BCME_OK; + + NULL_CHECK(dhd, "dhd is NULL", err); + INIT_LIST_HEAD(&dhd->csi_list); + dhd->csi_count = 0; + + return err; +} + +int +dhd_csi_deinit(dhd_pub_t *dhd) +{ + int err = BCME_OK; + cfr_dump_list_t *ptr, *next; + + NULL_CHECK(dhd, "dhd is NULL", err); + + if (!list_empty(&dhd->csi_list)) { + list_for_each_entry_safe(ptr, next, &dhd->csi_list, list) { + list_del(&ptr->list); + MFREE(dhd->osh, ptr, sizeof(cfr_dump_list_t)); + } + } + return err; +} + +void +dhd_csi_clean_list(dhd_pub_t *dhd) +{ + cfr_dump_list_t *ptr, *next; + int num = 0; + + if (!dhd) { + DHD_ERROR(("NULL POINTER: %s\n", __FUNCTION__)); + return; + } + + if (!list_empty(&dhd->csi_list)) { + list_for_each_entry_safe(ptr, next, &dhd->csi_list, list) { + if (0 == ptr->entry.header.remain_length) { + list_del(&ptr->list); + num++; + MFREE(dhd->osh, ptr, sizeof(cfr_dump_list_t)); + } + } + } + dhd->csi_count = 0; + DHD_TRACE(("Clean up %d record\n", num)); +} + +int +dhd_csi_dump_list(dhd_pub_t *dhd, char *buf) +{ + int ret = BCME_OK; + cfr_dump_list_t *ptr, *next; + uint8 * pbuf = buf; + int num = 0; + int length = 0; + + NULL_CHECK(dhd, "dhd is NULL", ret); + + /* check if this addr exist */ + if (!list_empty(&dhd->csi_list)) { + list_for_each_entry_safe(ptr, next, &dhd->csi_list, list) { + if (ptr->entry.header.remain_length) { + DHD_ERROR(("data not ready %d\n", ptr->entry.header.remain_length)); + continue; + } + bcopy(&ptr->entry.header, pbuf, sizeof(cfr_dump_header_t)); + length += sizeof(cfr_dump_header_t); + pbuf += sizeof(cfr_dump_header_t); + DHD_TRACE(("Copy data size %d\n", ptr->entry.header.cfr_dump_length)); + bcopy(&ptr->entry.data, pbuf, ptr->entry.header.cfr_dump_length); + length += ptr->entry.header.cfr_dump_length; + pbuf += ptr->entry.header.cfr_dump_length; + num++; + } + } + DHD_TRACE(("dump %d record %d bytes\n", num, length)); + + return length; +} + diff --git a/bcmdhd.100.10.315.x/dhd_csi.h b/bcmdhd.100.10.545.x/dhd_csi.h similarity index 96% rename from bcmdhd.100.10.315.x/dhd_csi.h rename to bcmdhd.100.10.545.x/dhd_csi.h index bcc712c..448753c 100644 --- a/bcmdhd.100.10.315.x/dhd_csi.h +++ b/bcmdhd.100.10.545.x/dhd_csi.h @@ -1,77 +1,77 @@ -/* - * Broadcom Dongle Host Driver (DHD), CSI - * - * Copyright (C) 1999-2018, Broadcom. - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhd_csi.h 558438 2015-05-22 06:05:11Z $ - */ -#ifndef __DHD_CSI_H__ -#define __DHD_CSI_H__ - -/* Maxinum csi file dump size */ -#define MAX_CSI_FILESZ (32 * 1024) -/* Maxinum subcarrier number */ -#define MAXINUM_CFR_DATA 256 * 4 -#define CSI_DUMP_PATH "/sys/bcm-dhd/csi" -#define MAX_EVENT_SIZE 1400 -/* maximun csi number stored at dhd */ -#define MAX_CSI_NUM 8 - -typedef struct cfr_dump_header { - /* 0 - successful; 1 - Failed */ - uint8 status; - /* Peer MAC address */ - uint8 peer_macaddr[6]; - /* Number of Space Time Streams */ - uint8 sts; - /* Number of RX chain */ - uint8 num_rx; - /* Number of subcarrier */ - uint16 num_carrier; - /* Length of the CSI dump */ - uint32 cfr_dump_length; - /* remain unsend CSI data length */ - uint32 remain_length; - /* RSSI */ - int8 rssi; -} __attribute__((packed)) cfr_dump_header_t; - -typedef struct cfr_dump_data { - cfr_dump_header_t header; - uint32 data[MAXINUM_CFR_DATA]; -} cfr_dump_data_t; - -typedef struct { - struct list_head list; - cfr_dump_data_t entry; -} cfr_dump_list_t; - -int dhd_csi_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data); - -int dhd_csi_init(dhd_pub_t *dhd); - -int dhd_csi_deinit(dhd_pub_t *dhd); - -void dhd_csi_clean_list(dhd_pub_t *dhd); - -int dhd_csi_dump_list(dhd_pub_t *dhd, char *buf); -#endif /* __DHD_CSI_H__ */ - +/* + * Broadcom Dongle Host Driver (DHD), CSI + * + * Copyright (C) 1999-2018, Broadcom. + * + * Unless you and Broadcom execute a separate written software license + * agreement governing use of this software, this software is licensed to you + * under the terms of the GNU General Public License version 2 (the "GPL"), + * available at http://www.broadcom.com/licenses/GPLv2.php, with the + * following added to such license: + * + * As a special exception, the copyright holders of this software give you + * permission to link this software with independent modules, and to copy and + * distribute the resulting executable under terms of your choice, provided that + * you also meet, for each linked independent module, the terms and conditions of + * the license of that module. An independent module is a module which is not + * derived from this software. The special exception does not apply to any + * modifications of the software. + * + * Notwithstanding the above, under no circumstances may you combine this + * software in any way with any other Broadcom software provided under a license + * other than the GPL, without Broadcom's express prior written consent. + * + * $Id: dhd_csi.h 558438 2015-05-22 06:05:11Z $ + */ +#ifndef __DHD_CSI_H__ +#define __DHD_CSI_H__ + +/* Maxinum csi file dump size */ +#define MAX_CSI_FILESZ (32 * 1024) +/* Maxinum subcarrier number */ +#define MAXINUM_CFR_DATA 256 * 4 +#define CSI_DUMP_PATH "/sys/bcm-dhd/csi" +#define MAX_EVENT_SIZE 1400 +/* maximun csi number stored at dhd */ +#define MAX_CSI_NUM 8 + +typedef struct cfr_dump_header { + /* 0 - successful; 1 - Failed */ + uint8 status; + /* Peer MAC address */ + uint8 peer_macaddr[6]; + /* Number of Space Time Streams */ + uint8 sts; + /* Number of RX chain */ + uint8 num_rx; + /* Number of subcarrier */ + uint16 num_carrier; + /* Length of the CSI dump */ + uint32 cfr_dump_length; + /* remain unsend CSI data length */ + uint32 remain_length; + /* RSSI */ + int8 rssi; +} __attribute__((packed)) cfr_dump_header_t; + +typedef struct cfr_dump_data { + cfr_dump_header_t header; + uint32 data[MAXINUM_CFR_DATA]; +} cfr_dump_data_t; + +typedef struct { + struct list_head list; + cfr_dump_data_t entry; +} cfr_dump_list_t; + +int dhd_csi_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data); + +int dhd_csi_init(dhd_pub_t *dhd); + +int dhd_csi_deinit(dhd_pub_t *dhd); + +void dhd_csi_clean_list(dhd_pub_t *dhd); + +int dhd_csi_dump_list(dhd_pub_t *dhd, char *buf); +#endif /* __DHD_CSI_H__ */ + diff --git a/bcmdhd.100.10.315.x/dhd_custom_gpio.c b/bcmdhd.100.10.545.x/dhd_custom_gpio.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_custom_gpio.c rename to bcmdhd.100.10.545.x/dhd_custom_gpio.c diff --git a/bcmdhd.100.10.315.x/dhd_custom_hikey.c b/bcmdhd.100.10.545.x/dhd_custom_hikey.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_custom_hikey.c rename to bcmdhd.100.10.545.x/dhd_custom_hikey.c diff --git a/bcmdhd.100.10.315.x/dhd_custom_memprealloc.c b/bcmdhd.100.10.545.x/dhd_custom_memprealloc.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_custom_memprealloc.c rename to bcmdhd.100.10.545.x/dhd_custom_memprealloc.c diff --git a/bcmdhd.100.10.315.x/dhd_dbg.h b/bcmdhd.100.10.545.x/dhd_dbg.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_dbg.h rename to bcmdhd.100.10.545.x/dhd_dbg.h diff --git a/bcmdhd.100.10.315.x/dhd_dbg_ring.c b/bcmdhd.100.10.545.x/dhd_dbg_ring.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_dbg_ring.c rename to bcmdhd.100.10.545.x/dhd_dbg_ring.c diff --git a/bcmdhd.100.10.315.x/dhd_dbg_ring.h b/bcmdhd.100.10.545.x/dhd_dbg_ring.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_dbg_ring.h rename to bcmdhd.100.10.545.x/dhd_dbg_ring.h diff --git a/bcmdhd.100.10.315.x/dhd_debug.c b/bcmdhd.100.10.545.x/dhd_debug.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_debug.c rename to bcmdhd.100.10.545.x/dhd_debug.c diff --git a/bcmdhd.100.10.315.x/dhd_debug.h b/bcmdhd.100.10.545.x/dhd_debug.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_debug.h rename to bcmdhd.100.10.545.x/dhd_debug.h diff --git a/bcmdhd.100.10.315.x/dhd_debug_linux.c b/bcmdhd.100.10.545.x/dhd_debug_linux.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_debug_linux.c rename to bcmdhd.100.10.545.x/dhd_debug_linux.c diff --git a/bcmdhd.100.10.315.x/dhd_flowring.c b/bcmdhd.100.10.545.x/dhd_flowring.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_flowring.c rename to bcmdhd.100.10.545.x/dhd_flowring.c diff --git a/bcmdhd.100.10.315.x/dhd_flowring.h b/bcmdhd.100.10.545.x/dhd_flowring.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_flowring.h rename to bcmdhd.100.10.545.x/dhd_flowring.h diff --git a/bcmdhd.100.10.315.x/dhd_gpio.c b/bcmdhd.100.10.545.x/dhd_gpio.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_gpio.c rename to bcmdhd.100.10.545.x/dhd_gpio.c diff --git a/bcmdhd.100.10.315.x/dhd_ip.c b/bcmdhd.100.10.545.x/dhd_ip.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_ip.c rename to bcmdhd.100.10.545.x/dhd_ip.c diff --git a/bcmdhd.100.10.315.x/dhd_ip.h b/bcmdhd.100.10.545.x/dhd_ip.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_ip.h rename to bcmdhd.100.10.545.x/dhd_ip.h diff --git a/bcmdhd.100.10.315.x/dhd_linux.c b/bcmdhd.100.10.545.x/dhd_linux.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_linux.c rename to bcmdhd.100.10.545.x/dhd_linux.c diff --git a/bcmdhd.100.10.315.x/dhd_linux.h b/bcmdhd.100.10.545.x/dhd_linux.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_linux.h rename to bcmdhd.100.10.545.x/dhd_linux.h diff --git a/bcmdhd.100.10.315.x/dhd_linux_exportfs.c b/bcmdhd.100.10.545.x/dhd_linux_exportfs.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_linux_exportfs.c rename to bcmdhd.100.10.545.x/dhd_linux_exportfs.c diff --git a/bcmdhd.100.10.315.x/dhd_linux_lb.c b/bcmdhd.100.10.545.x/dhd_linux_lb.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_linux_lb.c rename to bcmdhd.100.10.545.x/dhd_linux_lb.c diff --git a/bcmdhd.100.10.315.x/dhd_linux_pktdump.c b/bcmdhd.100.10.545.x/dhd_linux_pktdump.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_linux_pktdump.c rename to bcmdhd.100.10.545.x/dhd_linux_pktdump.c diff --git a/bcmdhd.100.10.315.x/dhd_linux_pktdump.h b/bcmdhd.100.10.545.x/dhd_linux_pktdump.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_linux_pktdump.h rename to bcmdhd.100.10.545.x/dhd_linux_pktdump.h diff --git a/bcmdhd.100.10.315.x/dhd_linux_platdev.c b/bcmdhd.100.10.545.x/dhd_linux_platdev.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_linux_platdev.c rename to bcmdhd.100.10.545.x/dhd_linux_platdev.c diff --git a/bcmdhd.100.10.315.x/dhd_linux_priv.h b/bcmdhd.100.10.545.x/dhd_linux_priv.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_linux_priv.h rename to bcmdhd.100.10.545.x/dhd_linux_priv.h diff --git a/bcmdhd.100.10.315.x/dhd_linux_sched.c b/bcmdhd.100.10.545.x/dhd_linux_sched.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_linux_sched.c rename to bcmdhd.100.10.545.x/dhd_linux_sched.c diff --git a/bcmdhd.100.10.315.x/dhd_linux_wq.c b/bcmdhd.100.10.545.x/dhd_linux_wq.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_linux_wq.c rename to bcmdhd.100.10.545.x/dhd_linux_wq.c diff --git a/bcmdhd.100.10.315.x/dhd_linux_wq.h b/bcmdhd.100.10.545.x/dhd_linux_wq.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_linux_wq.h rename to bcmdhd.100.10.545.x/dhd_linux_wq.h diff --git a/bcmdhd.100.10.315.x/dhd_mschdbg.c b/bcmdhd.100.10.545.x/dhd_mschdbg.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_mschdbg.c rename to bcmdhd.100.10.545.x/dhd_mschdbg.c diff --git a/bcmdhd.100.10.315.x/dhd_mschdbg.h b/bcmdhd.100.10.545.x/dhd_mschdbg.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_mschdbg.h rename to bcmdhd.100.10.545.x/dhd_mschdbg.h diff --git a/bcmdhd.100.10.315.x/dhd_msgbuf.c b/bcmdhd.100.10.545.x/dhd_msgbuf.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_msgbuf.c rename to bcmdhd.100.10.545.x/dhd_msgbuf.c diff --git a/bcmdhd.100.10.315.x/dhd_pcie.c b/bcmdhd.100.10.545.x/dhd_pcie.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_pcie.c rename to bcmdhd.100.10.545.x/dhd_pcie.c diff --git a/bcmdhd.100.10.315.x/dhd_pcie.h b/bcmdhd.100.10.545.x/dhd_pcie.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_pcie.h rename to bcmdhd.100.10.545.x/dhd_pcie.h diff --git a/bcmdhd.100.10.315.x/dhd_pcie_linux.c b/bcmdhd.100.10.545.x/dhd_pcie_linux.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_pcie_linux.c rename to bcmdhd.100.10.545.x/dhd_pcie_linux.c diff --git a/bcmdhd.100.10.315.x/dhd_pno.c b/bcmdhd.100.10.545.x/dhd_pno.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_pno.c rename to bcmdhd.100.10.545.x/dhd_pno.c diff --git a/bcmdhd.100.10.315.x/dhd_pno.h b/bcmdhd.100.10.545.x/dhd_pno.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_pno.h rename to bcmdhd.100.10.545.x/dhd_pno.h diff --git a/bcmdhd.100.10.315.x/dhd_proto.h b/bcmdhd.100.10.545.x/dhd_proto.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_proto.h rename to bcmdhd.100.10.545.x/dhd_proto.h diff --git a/bcmdhd.100.10.315.x/dhd_rtt.c b/bcmdhd.100.10.545.x/dhd_rtt.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_rtt.c rename to bcmdhd.100.10.545.x/dhd_rtt.c diff --git a/bcmdhd.100.10.315.x/dhd_rtt.h b/bcmdhd.100.10.545.x/dhd_rtt.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_rtt.h rename to bcmdhd.100.10.545.x/dhd_rtt.h diff --git a/bcmdhd.100.10.315.x/dhd_sdio.c b/bcmdhd.100.10.545.x/dhd_sdio.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_sdio.c rename to bcmdhd.100.10.545.x/dhd_sdio.c diff --git a/bcmdhd.100.10.315.x/dhd_static_buf.c b/bcmdhd.100.10.545.x/dhd_static_buf.c similarity index 96% rename from bcmdhd.100.10.315.x/dhd_static_buf.c rename to bcmdhd.100.10.545.x/dhd_static_buf.c index fb68b01..584b8f2 100644 --- a/bcmdhd.100.10.315.x/dhd_static_buf.c +++ b/bcmdhd.100.10.545.x/dhd_static_buf.c @@ -1,585 +1,585 @@ -#include -#include -#include -#include -#include -#include -#include - -#define DHD_STATIC_VERSION_STR "100.10.545.7 (r826445-20200110-2)" - -#define BCMDHD_SDIO -#define BCMDHD_PCIE - -enum dhd_prealloc_index { - DHD_PREALLOC_PROT = 0, -#if defined(BCMDHD_SDIO) - DHD_PREALLOC_RXBUF = 1, - DHD_PREALLOC_DATABUF = 2, -#endif - DHD_PREALLOC_OSL_BUF = 3, - DHD_PREALLOC_SKB_BUF = 4, - DHD_PREALLOC_WIPHY_ESCAN0 = 5, - DHD_PREALLOC_WIPHY_ESCAN1 = 6, - DHD_PREALLOC_DHD_INFO = 7, - DHD_PREALLOC_DHD_WLFC_INFO = 8, -#ifdef BCMDHD_PCIE - DHD_PREALLOC_IF_FLOW_LKUP = 9, -#endif - DHD_PREALLOC_MEMDUMP_BUF = 10, - DHD_PREALLOC_MEMDUMP_RAM = 11, - DHD_PREALLOC_DHD_WLFC_HANGER = 12, - DHD_PREALLOC_PKTID_MAP = 13, - DHD_PREALLOC_PKTID_MAP_IOCTL = 14, - DHD_PREALLOC_DHD_LOG_DUMP_BUF = 15, - DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX = 16, - DHD_PREALLOC_DHD_PKTLOG_DUMP_BUF = 17, - DHD_PREALLOC_STAT_REPORT_BUF = 18, - DHD_PREALLOC_WL_ESCAN = 19, - DHD_PREALLOC_FW_VERBOSE_RING = 20, - DHD_PREALLOC_FW_EVENT_RING = 21, - DHD_PREALLOC_DHD_EVENT_RING = 22, - DHD_PREALLOC_NAN_EVENT_RING = 23, - DHD_PREALLOC_MAX -}; - -#define STATIC_BUF_MAX_NUM 20 -#define STATIC_BUF_SIZE (PAGE_SIZE*2) - -#ifndef CUSTOM_LOG_DUMP_BUFSIZE_MB -#define CUSTOM_LOG_DUMP_BUFSIZE_MB 4 /* DHD_LOG_DUMP_BUF_SIZE 4 MB static memory in kernel */ -#endif /* CUSTOM_LOG_DUMP_BUFSIZE_MB */ - -#define DHD_PREALLOC_PROT_SIZE (16 * 1024) -#define DHD_PREALLOC_RXBUF_SIZE (24 * 1024) -#define DHD_PREALLOC_DATABUF_SIZE (64 * 1024) -#define DHD_PREALLOC_OSL_BUF_SIZE (STATIC_BUF_MAX_NUM * STATIC_BUF_SIZE) -#define DHD_PREALLOC_WIPHY_ESCAN0_SIZE (64 * 1024) -#define DHD_PREALLOC_DHD_INFO_SIZE (32 * 1024) -#define DHD_PREALLOC_MEMDUMP_RAM_SIZE (1290 * 1024) -#define DHD_PREALLOC_DHD_WLFC_HANGER_SIZE (73 * 1024) -#define DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE (1024 * 1024 * CUSTOM_LOG_DUMP_BUFSIZE_MB) -#define DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE (8 * 1024) -#define DHD_PREALLOC_WL_ESCAN_SIZE (70 * 1024) -#ifdef CONFIG_64BIT -#define DHD_PREALLOC_IF_FLOW_LKUP_SIZE (20 * 1024 * 2) -#else -#define DHD_PREALLOC_IF_FLOW_LKUP_SIZE (20 * 1024) -#endif -#define FW_VERBOSE_RING_SIZE (256 * 1024) -#define FW_EVENT_RING_SIZE (64 * 1024) -#define DHD_EVENT_RING_SIZE (64 * 1024) -#define NAN_EVENT_RING_SIZE (64 * 1024) - -#if defined(CONFIG_64BIT) -#define WLAN_DHD_INFO_BUF_SIZE (24 * 1024) -#define WLAN_DHD_WLFC_BUF_SIZE (64 * 1024) -#define WLAN_DHD_IF_FLOW_LKUP_SIZE (64 * 1024) -#else -#define WLAN_DHD_INFO_BUF_SIZE (16 * 1024) -#define WLAN_DHD_WLFC_BUF_SIZE (64 * 1024) -#define WLAN_DHD_IF_FLOW_LKUP_SIZE (20 * 1024) -#endif /* CONFIG_64BIT */ -#define WLAN_DHD_MEMDUMP_SIZE (800 * 1024) - -#define DHD_SKB_1PAGE_BUFSIZE (PAGE_SIZE*1) -#define DHD_SKB_2PAGE_BUFSIZE (PAGE_SIZE*2) -#define DHD_SKB_4PAGE_BUFSIZE (PAGE_SIZE*4) - -#define DHD_SKB_1PAGE_BUF_NUM 8 -#ifdef BCMDHD_PCIE -#define DHD_SKB_2PAGE_BUF_NUM 64 -#elif defined(BCMDHD_SDIO) -#define DHD_SKB_2PAGE_BUF_NUM 8 -#endif -#define DHD_SKB_4PAGE_BUF_NUM 1 - -/* The number is defined in linux_osl.c - * WLAN_SKB_1_2PAGE_BUF_NUM => STATIC_PKT_1_2PAGE_NUM - * WLAN_SKB_BUF_NUM => STATIC_PKT_MAX_NUM - */ -#define WLAN_SKB_1_2PAGE_BUF_NUM ((DHD_SKB_1PAGE_BUF_NUM) + \ - (DHD_SKB_2PAGE_BUF_NUM)) -#define WLAN_SKB_BUF_NUM ((WLAN_SKB_1_2PAGE_BUF_NUM) + (DHD_SKB_4PAGE_BUF_NUM)) - -void *wlan_static_prot = NULL; -void *wlan_static_rxbuf = NULL; -void *wlan_static_databuf = NULL; -void *wlan_static_osl_buf = NULL; -void *wlan_static_scan_buf0 = NULL; -void *wlan_static_scan_buf1 = NULL; -void *wlan_static_dhd_info_buf = NULL; -void *wlan_static_dhd_wlfc_info_buf = NULL; -void *wlan_static_if_flow_lkup = NULL; -void *wlan_static_dhd_memdump_ram_buf = NULL; -void *wlan_static_dhd_wlfc_hanger_buf = NULL; -void *wlan_static_dhd_log_dump_buf = NULL; -void *wlan_static_dhd_log_dump_buf_ex = NULL; -void *wlan_static_wl_escan_info_buf = NULL; -void *wlan_static_fw_verbose_ring_buf = NULL; -void *wlan_static_fw_event_ring_buf = NULL; -void *wlan_static_dhd_event_ring_buf = NULL; -void *wlan_static_nan_event_ring_buf = NULL; - -static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM]; - -void *dhd_wlan_mem_prealloc(int section, unsigned long size) -{ - pr_err("%s: sectoin %d, %ld\n", __func__, section, size); - if (section == DHD_PREALLOC_PROT) - return wlan_static_prot; - -#if defined(BCMDHD_SDIO) - if (section == DHD_PREALLOC_RXBUF) - return wlan_static_rxbuf; - - if (section == DHD_PREALLOC_DATABUF) - return wlan_static_databuf; -#endif /* BCMDHD_SDIO */ - - if (section == DHD_PREALLOC_SKB_BUF) - return wlan_static_skb; - - if (section == DHD_PREALLOC_WIPHY_ESCAN0) - return wlan_static_scan_buf0; - - if (section == DHD_PREALLOC_WIPHY_ESCAN1) - return wlan_static_scan_buf1; - - if (section == DHD_PREALLOC_OSL_BUF) { - if (size > DHD_PREALLOC_OSL_BUF_SIZE) { - pr_err("request OSL_BUF(%lu) > %ld\n", - size, DHD_PREALLOC_OSL_BUF_SIZE); - return NULL; - } - return wlan_static_osl_buf; - } - - if (section == DHD_PREALLOC_DHD_INFO) { - if (size > DHD_PREALLOC_DHD_INFO_SIZE) { - pr_err("request DHD_INFO size(%lu) > %d\n", - size, DHD_PREALLOC_DHD_INFO_SIZE); - return NULL; - } - return wlan_static_dhd_info_buf; - } - if (section == DHD_PREALLOC_DHD_WLFC_INFO) { - if (size > WLAN_DHD_WLFC_BUF_SIZE) { - pr_err("request DHD_WLFC_INFO size(%lu) > %d\n", - size, WLAN_DHD_WLFC_BUF_SIZE); - return NULL; - } - return wlan_static_dhd_wlfc_info_buf; - } -#ifdef BCMDHD_PCIE - if (section == DHD_PREALLOC_IF_FLOW_LKUP) { - if (size > DHD_PREALLOC_IF_FLOW_LKUP_SIZE) { - pr_err("request DHD_IF_FLOW_LKUP size(%lu) > %d\n", - size, DHD_PREALLOC_IF_FLOW_LKUP_SIZE); - return NULL; - } - - return wlan_static_if_flow_lkup; - } -#endif /* BCMDHD_PCIE */ - if (section == DHD_PREALLOC_MEMDUMP_RAM) { - if (size > DHD_PREALLOC_MEMDUMP_RAM_SIZE) { - pr_err("request DHD_PREALLOC_MEMDUMP_RAM_SIZE(%lu) > %d\n", - size, DHD_PREALLOC_MEMDUMP_RAM_SIZE); - return NULL; - } - - return wlan_static_dhd_memdump_ram_buf; - } - if (section == DHD_PREALLOC_DHD_WLFC_HANGER) { - if (size > DHD_PREALLOC_DHD_WLFC_HANGER_SIZE) { - pr_err("request DHD_WLFC_HANGER size(%lu) > %d\n", - size, DHD_PREALLOC_DHD_WLFC_HANGER_SIZE); - return NULL; - } - return wlan_static_dhd_wlfc_hanger_buf; - } - if (section == DHD_PREALLOC_DHD_LOG_DUMP_BUF) { - if (size > DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE) { - pr_err("request DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE(%lu) > %d\n", - size, DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE); - return NULL; - } - - return wlan_static_dhd_log_dump_buf; - } - if (section == DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX) { - if (size > DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE) { - pr_err("request DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE(%lu) > %d\n", - size, DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE); - return NULL; - } - - return wlan_static_dhd_log_dump_buf_ex; - } - if (section == DHD_PREALLOC_WL_ESCAN) { - if (size > DHD_PREALLOC_WL_ESCAN_SIZE) { - pr_err("request DHD_PREALLOC_WL_ESCAN_SIZE(%lu) > %d\n", - size, DHD_PREALLOC_WL_ESCAN_SIZE); - return NULL; - } - - return wlan_static_wl_escan_info_buf; - } - if (section == DHD_PREALLOC_FW_VERBOSE_RING) { - if (size > FW_VERBOSE_RING_SIZE) { - pr_err("request DHD_PREALLOC_FW_VERBOSE_RING(%lu) > %d\n", - size, FW_VERBOSE_RING_SIZE); - return NULL; - } - - return wlan_static_fw_verbose_ring_buf; - } - if (section == DHD_PREALLOC_FW_EVENT_RING) { - if (size > FW_EVENT_RING_SIZE) { - pr_err("request DHD_PREALLOC_FW_EVENT_RING(%lu) > %d\n", - size, FW_EVENT_RING_SIZE); - return NULL; - } - - return wlan_static_fw_event_ring_buf; - } - if (section == DHD_PREALLOC_DHD_EVENT_RING) { - if (size > DHD_EVENT_RING_SIZE) { - pr_err("request DHD_PREALLOC_DHD_EVENT_RING(%lu) > %d\n", - size, DHD_EVENT_RING_SIZE); - return NULL; - } - - return wlan_static_dhd_event_ring_buf; - } - if (section == DHD_PREALLOC_NAN_EVENT_RING) { - if (size > NAN_EVENT_RING_SIZE) { - pr_err("request DHD_PREALLOC_NAN_EVENT_RING(%lu) > %d\n", - size, NAN_EVENT_RING_SIZE); - return NULL; - } - - return wlan_static_nan_event_ring_buf; - } - if ((section < 0) || (section > DHD_PREALLOC_MAX)) - pr_err("request section id(%d) is out of max index %d\n", - section, DHD_PREALLOC_MAX); - - pr_err("%s: failed to alloc section %d, size=%ld\n", - __func__, section, size); - - return NULL; -} -EXPORT_SYMBOL(dhd_wlan_mem_prealloc); - -static int dhd_init_wlan_mem(void) -{ - int i; - int j; - printk(KERN_ERR "%s(): %s\n", __func__, DHD_STATIC_VERSION_STR); - - for (i = 0; i < DHD_SKB_1PAGE_BUF_NUM; i++) { - wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_1PAGE_BUFSIZE); - if (!wlan_static_skb[i]) { - goto err_skb_alloc; - } - pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__, - DHD_PREALLOC_SKB_BUF, i, DHD_SKB_1PAGE_BUFSIZE); - } - - for (i = DHD_SKB_1PAGE_BUF_NUM; i < WLAN_SKB_1_2PAGE_BUF_NUM; i++) { - wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_2PAGE_BUFSIZE); - if (!wlan_static_skb[i]) { - goto err_skb_alloc; - } - pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__, - DHD_PREALLOC_SKB_BUF, i, DHD_SKB_2PAGE_BUFSIZE); - } - -#if defined(BCMDHD_SDIO) - wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_4PAGE_BUFSIZE); - if (!wlan_static_skb[i]) - goto err_skb_alloc; - pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__, - DHD_PREALLOC_SKB_BUF, i, DHD_SKB_4PAGE_BUFSIZE); -#endif /* BCMDHD_SDIO */ - - wlan_static_prot = kmalloc(DHD_PREALLOC_PROT_SIZE, GFP_KERNEL); - if (!wlan_static_prot) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_PROT, DHD_PREALLOC_PROT_SIZE); - -#if defined(BCMDHD_SDIO) - wlan_static_rxbuf = kmalloc(DHD_PREALLOC_RXBUF_SIZE, GFP_KERNEL); - if (!wlan_static_rxbuf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_RXBUF, DHD_PREALLOC_RXBUF_SIZE); - - wlan_static_databuf = kmalloc(DHD_PREALLOC_DATABUF_SIZE, GFP_KERNEL); - if (!wlan_static_databuf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_DATABUF, DHD_PREALLOC_DATABUF_SIZE); -#endif /* BCMDHD_SDIO */ - - wlan_static_osl_buf = kmalloc(DHD_PREALLOC_OSL_BUF_SIZE, GFP_KERNEL); - if (!wlan_static_osl_buf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%ld\n", __func__, - DHD_PREALLOC_OSL_BUF, DHD_PREALLOC_OSL_BUF_SIZE); - - wlan_static_scan_buf0 = kmalloc(DHD_PREALLOC_WIPHY_ESCAN0_SIZE, GFP_KERNEL); - if (!wlan_static_scan_buf0) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_WIPHY_ESCAN0, DHD_PREALLOC_WIPHY_ESCAN0_SIZE); - - wlan_static_dhd_info_buf = kmalloc(DHD_PREALLOC_DHD_INFO_SIZE, GFP_KERNEL); - if (!wlan_static_dhd_info_buf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_DHD_INFO, DHD_PREALLOC_DHD_INFO_SIZE); - - wlan_static_dhd_wlfc_info_buf = kmalloc(WLAN_DHD_WLFC_BUF_SIZE, GFP_KERNEL); - if (!wlan_static_dhd_wlfc_info_buf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_DHD_WLFC_INFO, WLAN_DHD_WLFC_BUF_SIZE); - -#ifdef BCMDHD_PCIE - wlan_static_if_flow_lkup = kmalloc(DHD_PREALLOC_IF_FLOW_LKUP_SIZE, GFP_KERNEL); - if (!wlan_static_if_flow_lkup) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_IF_FLOW_LKUP, DHD_PREALLOC_IF_FLOW_LKUP_SIZE); -#endif /* BCMDHD_PCIE */ - - wlan_static_dhd_memdump_ram_buf = kmalloc(DHD_PREALLOC_MEMDUMP_RAM_SIZE, GFP_KERNEL); - if (!wlan_static_dhd_memdump_ram_buf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_MEMDUMP_RAM, DHD_PREALLOC_MEMDUMP_RAM_SIZE); - - wlan_static_dhd_wlfc_hanger_buf = kmalloc(DHD_PREALLOC_DHD_WLFC_HANGER_SIZE, GFP_KERNEL); - if (!wlan_static_dhd_wlfc_hanger_buf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_DHD_WLFC_HANGER, DHD_PREALLOC_DHD_WLFC_HANGER_SIZE); - - wlan_static_dhd_log_dump_buf = kmalloc(DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE, GFP_KERNEL); - if (!wlan_static_dhd_log_dump_buf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_DHD_LOG_DUMP_BUF, DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE); - - wlan_static_dhd_log_dump_buf_ex = kmalloc(DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE, GFP_KERNEL); - if (!wlan_static_dhd_log_dump_buf_ex) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX, DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE); - - wlan_static_wl_escan_info_buf = kmalloc(DHD_PREALLOC_WL_ESCAN_SIZE, GFP_KERNEL); - if (!wlan_static_wl_escan_info_buf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_WL_ESCAN, DHD_PREALLOC_WL_ESCAN_SIZE); - - wlan_static_fw_verbose_ring_buf = kmalloc(FW_VERBOSE_RING_SIZE, GFP_KERNEL); - if (!wlan_static_fw_verbose_ring_buf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_FW_VERBOSE_RING, FW_VERBOSE_RING_SIZE); - - wlan_static_fw_event_ring_buf = kmalloc(FW_EVENT_RING_SIZE, GFP_KERNEL); - if (!wlan_static_fw_event_ring_buf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_FW_EVENT_RING, FW_EVENT_RING_SIZE); - - wlan_static_dhd_event_ring_buf = kmalloc(DHD_EVENT_RING_SIZE, GFP_KERNEL); - if (!wlan_static_dhd_event_ring_buf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_DHD_EVENT_RING, DHD_EVENT_RING_SIZE); - - wlan_static_nan_event_ring_buf = kmalloc(NAN_EVENT_RING_SIZE, GFP_KERNEL); - if (!wlan_static_nan_event_ring_buf) - goto err_mem_alloc; - pr_err("%s: sectoin %d, size=%d\n", __func__, - DHD_PREALLOC_NAN_EVENT_RING, NAN_EVENT_RING_SIZE); - - return 0; - -err_mem_alloc: - - if (wlan_static_prot) - kfree(wlan_static_prot); - -#if defined(BCMDHD_SDIO) - if (wlan_static_rxbuf) - kfree(wlan_static_rxbuf); - - if (wlan_static_databuf) - kfree(wlan_static_databuf); -#endif /* BCMDHD_SDIO */ - - if (wlan_static_osl_buf) - kfree(wlan_static_osl_buf); - - if (wlan_static_scan_buf0) - kfree(wlan_static_scan_buf0); - - if (wlan_static_scan_buf1) - kfree(wlan_static_scan_buf1); - - if (wlan_static_dhd_info_buf) - kfree(wlan_static_dhd_info_buf); - - if (wlan_static_dhd_wlfc_info_buf) - kfree(wlan_static_dhd_wlfc_info_buf); - -#ifdef BCMDHD_PCIE - if (wlan_static_if_flow_lkup) - kfree(wlan_static_if_flow_lkup); -#endif /* BCMDHD_PCIE */ - - if (wlan_static_dhd_memdump_ram_buf) - kfree(wlan_static_dhd_memdump_ram_buf); - - if (wlan_static_dhd_wlfc_hanger_buf) - kfree(wlan_static_dhd_wlfc_hanger_buf); - - if (wlan_static_dhd_log_dump_buf) - kfree(wlan_static_dhd_log_dump_buf); - - if (wlan_static_dhd_log_dump_buf_ex) - kfree(wlan_static_dhd_log_dump_buf_ex); - - if (wlan_static_wl_escan_info_buf) - kfree(wlan_static_wl_escan_info_buf); - -#ifdef BCMDHD_PCIE - if (wlan_static_fw_verbose_ring_buf) - kfree(wlan_static_fw_verbose_ring_buf); - - if (wlan_static_fw_event_ring_buf) - kfree(wlan_static_fw_event_ring_buf); - - if (wlan_static_dhd_event_ring_buf) - kfree(wlan_static_dhd_event_ring_buf); - - if (wlan_static_nan_event_ring_buf) - kfree(wlan_static_nan_event_ring_buf); -#endif /* BCMDHD_PCIE */ - - pr_err("%s: Failed to mem_alloc for WLAN\n", __func__); - - i = WLAN_SKB_BUF_NUM; - -err_skb_alloc: - pr_err("%s: Failed to skb_alloc for WLAN\n", __func__); - for (j = 0; j < i; j++) - dev_kfree_skb(wlan_static_skb[j]); - - return -ENOMEM; -} - -static int __init -dhd_static_buf_init(void) -{ - dhd_init_wlan_mem(); - - return 0; -} - -static void __exit -dhd_static_buf_exit(void) -{ - int i; - - pr_err("%s()\n", __FUNCTION__); - - for (i = 0; i < DHD_SKB_1PAGE_BUF_NUM; i++) { - if (wlan_static_skb[i]) - dev_kfree_skb(wlan_static_skb[i]); - } - - for (i = DHD_SKB_1PAGE_BUF_NUM; i < WLAN_SKB_1_2PAGE_BUF_NUM; i++) { - if (wlan_static_skb[i]) - dev_kfree_skb(wlan_static_skb[i]); - } - -#if defined(BCMDHD_SDIO) - if (wlan_static_skb[i]) - dev_kfree_skb(wlan_static_skb[i]); -#endif /* BCMDHD_SDIO */ - - if (wlan_static_prot) - kfree(wlan_static_prot); - -#if defined(BCMDHD_SDIO) - if (wlan_static_rxbuf) - kfree(wlan_static_rxbuf); - - if (wlan_static_databuf) - kfree(wlan_static_databuf); -#endif /* BCMDHD_SDIO */ - - if (wlan_static_osl_buf) - kfree(wlan_static_osl_buf); - - if (wlan_static_scan_buf0) - kfree(wlan_static_scan_buf0); - - if (wlan_static_scan_buf1) - kfree(wlan_static_scan_buf1); - - if (wlan_static_dhd_info_buf) - kfree(wlan_static_dhd_info_buf); - - if (wlan_static_dhd_wlfc_info_buf) - kfree(wlan_static_dhd_wlfc_info_buf); - -#ifdef BCMDHD_PCIE - if (wlan_static_if_flow_lkup) - kfree(wlan_static_if_flow_lkup); -#endif /* BCMDHD_PCIE */ - - if (wlan_static_dhd_memdump_ram_buf) - kfree(wlan_static_dhd_memdump_ram_buf); - - if (wlan_static_dhd_wlfc_hanger_buf) - kfree(wlan_static_dhd_wlfc_hanger_buf); - - if (wlan_static_dhd_log_dump_buf) - kfree(wlan_static_dhd_log_dump_buf); - - if (wlan_static_dhd_log_dump_buf_ex) - kfree(wlan_static_dhd_log_dump_buf_ex); - - if (wlan_static_wl_escan_info_buf) - kfree(wlan_static_wl_escan_info_buf); - -#ifdef BCMDHD_PCIE - if (wlan_static_fw_verbose_ring_buf) - kfree(wlan_static_fw_verbose_ring_buf); - - if (wlan_static_fw_event_ring_buf) - kfree(wlan_static_fw_event_ring_buf); - - if (wlan_static_dhd_event_ring_buf) - kfree(wlan_static_dhd_event_ring_buf); - - if (wlan_static_nan_event_ring_buf) - kfree(wlan_static_nan_event_ring_buf); -#endif - - return; -} - -module_init(dhd_static_buf_init); - -module_exit(dhd_static_buf_exit); +#include +#include +#include +#include +#include +#include +#include + +#define DHD_STATIC_VERSION_STR "100.10.545.7 (r826445-20200110-2)" + +#define BCMDHD_SDIO +#define BCMDHD_PCIE + +enum dhd_prealloc_index { + DHD_PREALLOC_PROT = 0, +#if defined(BCMDHD_SDIO) + DHD_PREALLOC_RXBUF = 1, + DHD_PREALLOC_DATABUF = 2, +#endif + DHD_PREALLOC_OSL_BUF = 3, + DHD_PREALLOC_SKB_BUF = 4, + DHD_PREALLOC_WIPHY_ESCAN0 = 5, + DHD_PREALLOC_WIPHY_ESCAN1 = 6, + DHD_PREALLOC_DHD_INFO = 7, + DHD_PREALLOC_DHD_WLFC_INFO = 8, +#ifdef BCMDHD_PCIE + DHD_PREALLOC_IF_FLOW_LKUP = 9, +#endif + DHD_PREALLOC_MEMDUMP_BUF = 10, + DHD_PREALLOC_MEMDUMP_RAM = 11, + DHD_PREALLOC_DHD_WLFC_HANGER = 12, + DHD_PREALLOC_PKTID_MAP = 13, + DHD_PREALLOC_PKTID_MAP_IOCTL = 14, + DHD_PREALLOC_DHD_LOG_DUMP_BUF = 15, + DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX = 16, + DHD_PREALLOC_DHD_PKTLOG_DUMP_BUF = 17, + DHD_PREALLOC_STAT_REPORT_BUF = 18, + DHD_PREALLOC_WL_ESCAN = 19, + DHD_PREALLOC_FW_VERBOSE_RING = 20, + DHD_PREALLOC_FW_EVENT_RING = 21, + DHD_PREALLOC_DHD_EVENT_RING = 22, + DHD_PREALLOC_NAN_EVENT_RING = 23, + DHD_PREALLOC_MAX +}; + +#define STATIC_BUF_MAX_NUM 20 +#define STATIC_BUF_SIZE (PAGE_SIZE*2) + +#ifndef CUSTOM_LOG_DUMP_BUFSIZE_MB +#define CUSTOM_LOG_DUMP_BUFSIZE_MB 4 /* DHD_LOG_DUMP_BUF_SIZE 4 MB static memory in kernel */ +#endif /* CUSTOM_LOG_DUMP_BUFSIZE_MB */ + +#define DHD_PREALLOC_PROT_SIZE (16 * 1024) +#define DHD_PREALLOC_RXBUF_SIZE (24 * 1024) +#define DHD_PREALLOC_DATABUF_SIZE (64 * 1024) +#define DHD_PREALLOC_OSL_BUF_SIZE (STATIC_BUF_MAX_NUM * STATIC_BUF_SIZE) +#define DHD_PREALLOC_WIPHY_ESCAN0_SIZE (64 * 1024) +#define DHD_PREALLOC_DHD_INFO_SIZE (32 * 1024) +#define DHD_PREALLOC_MEMDUMP_RAM_SIZE (1290 * 1024) +#define DHD_PREALLOC_DHD_WLFC_HANGER_SIZE (73 * 1024) +#define DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE (1024 * 1024 * CUSTOM_LOG_DUMP_BUFSIZE_MB) +#define DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE (8 * 1024) +#define DHD_PREALLOC_WL_ESCAN_SIZE (70 * 1024) +#ifdef CONFIG_64BIT +#define DHD_PREALLOC_IF_FLOW_LKUP_SIZE (20 * 1024 * 2) +#else +#define DHD_PREALLOC_IF_FLOW_LKUP_SIZE (20 * 1024) +#endif +#define FW_VERBOSE_RING_SIZE (256 * 1024) +#define FW_EVENT_RING_SIZE (64 * 1024) +#define DHD_EVENT_RING_SIZE (64 * 1024) +#define NAN_EVENT_RING_SIZE (64 * 1024) + +#if defined(CONFIG_64BIT) +#define WLAN_DHD_INFO_BUF_SIZE (24 * 1024) +#define WLAN_DHD_WLFC_BUF_SIZE (64 * 1024) +#define WLAN_DHD_IF_FLOW_LKUP_SIZE (64 * 1024) +#else +#define WLAN_DHD_INFO_BUF_SIZE (16 * 1024) +#define WLAN_DHD_WLFC_BUF_SIZE (64 * 1024) +#define WLAN_DHD_IF_FLOW_LKUP_SIZE (20 * 1024) +#endif /* CONFIG_64BIT */ +#define WLAN_DHD_MEMDUMP_SIZE (800 * 1024) + +#define DHD_SKB_1PAGE_BUFSIZE (PAGE_SIZE*1) +#define DHD_SKB_2PAGE_BUFSIZE (PAGE_SIZE*2) +#define DHD_SKB_4PAGE_BUFSIZE (PAGE_SIZE*4) + +#define DHD_SKB_1PAGE_BUF_NUM 8 +#ifdef BCMDHD_PCIE +#define DHD_SKB_2PAGE_BUF_NUM 64 +#elif defined(BCMDHD_SDIO) +#define DHD_SKB_2PAGE_BUF_NUM 8 +#endif +#define DHD_SKB_4PAGE_BUF_NUM 1 + +/* The number is defined in linux_osl.c + * WLAN_SKB_1_2PAGE_BUF_NUM => STATIC_PKT_1_2PAGE_NUM + * WLAN_SKB_BUF_NUM => STATIC_PKT_MAX_NUM + */ +#define WLAN_SKB_1_2PAGE_BUF_NUM ((DHD_SKB_1PAGE_BUF_NUM) + \ + (DHD_SKB_2PAGE_BUF_NUM)) +#define WLAN_SKB_BUF_NUM ((WLAN_SKB_1_2PAGE_BUF_NUM) + (DHD_SKB_4PAGE_BUF_NUM)) + +void *wlan_static_prot = NULL; +void *wlan_static_rxbuf = NULL; +void *wlan_static_databuf = NULL; +void *wlan_static_osl_buf = NULL; +void *wlan_static_scan_buf0 = NULL; +void *wlan_static_scan_buf1 = NULL; +void *wlan_static_dhd_info_buf = NULL; +void *wlan_static_dhd_wlfc_info_buf = NULL; +void *wlan_static_if_flow_lkup = NULL; +void *wlan_static_dhd_memdump_ram_buf = NULL; +void *wlan_static_dhd_wlfc_hanger_buf = NULL; +void *wlan_static_dhd_log_dump_buf = NULL; +void *wlan_static_dhd_log_dump_buf_ex = NULL; +void *wlan_static_wl_escan_info_buf = NULL; +void *wlan_static_fw_verbose_ring_buf = NULL; +void *wlan_static_fw_event_ring_buf = NULL; +void *wlan_static_dhd_event_ring_buf = NULL; +void *wlan_static_nan_event_ring_buf = NULL; + +static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM]; + +void *dhd_wlan_mem_prealloc(int section, unsigned long size) +{ + pr_err("%s: sectoin %d, %ld\n", __func__, section, size); + if (section == DHD_PREALLOC_PROT) + return wlan_static_prot; + +#if defined(BCMDHD_SDIO) + if (section == DHD_PREALLOC_RXBUF) + return wlan_static_rxbuf; + + if (section == DHD_PREALLOC_DATABUF) + return wlan_static_databuf; +#endif /* BCMDHD_SDIO */ + + if (section == DHD_PREALLOC_SKB_BUF) + return wlan_static_skb; + + if (section == DHD_PREALLOC_WIPHY_ESCAN0) + return wlan_static_scan_buf0; + + if (section == DHD_PREALLOC_WIPHY_ESCAN1) + return wlan_static_scan_buf1; + + if (section == DHD_PREALLOC_OSL_BUF) { + if (size > DHD_PREALLOC_OSL_BUF_SIZE) { + pr_err("request OSL_BUF(%lu) > %ld\n", + size, DHD_PREALLOC_OSL_BUF_SIZE); + return NULL; + } + return wlan_static_osl_buf; + } + + if (section == DHD_PREALLOC_DHD_INFO) { + if (size > DHD_PREALLOC_DHD_INFO_SIZE) { + pr_err("request DHD_INFO size(%lu) > %d\n", + size, DHD_PREALLOC_DHD_INFO_SIZE); + return NULL; + } + return wlan_static_dhd_info_buf; + } + if (section == DHD_PREALLOC_DHD_WLFC_INFO) { + if (size > WLAN_DHD_WLFC_BUF_SIZE) { + pr_err("request DHD_WLFC_INFO size(%lu) > %d\n", + size, WLAN_DHD_WLFC_BUF_SIZE); + return NULL; + } + return wlan_static_dhd_wlfc_info_buf; + } +#ifdef BCMDHD_PCIE + if (section == DHD_PREALLOC_IF_FLOW_LKUP) { + if (size > DHD_PREALLOC_IF_FLOW_LKUP_SIZE) { + pr_err("request DHD_IF_FLOW_LKUP size(%lu) > %d\n", + size, DHD_PREALLOC_IF_FLOW_LKUP_SIZE); + return NULL; + } + + return wlan_static_if_flow_lkup; + } +#endif /* BCMDHD_PCIE */ + if (section == DHD_PREALLOC_MEMDUMP_RAM) { + if (size > DHD_PREALLOC_MEMDUMP_RAM_SIZE) { + pr_err("request DHD_PREALLOC_MEMDUMP_RAM_SIZE(%lu) > %d\n", + size, DHD_PREALLOC_MEMDUMP_RAM_SIZE); + return NULL; + } + + return wlan_static_dhd_memdump_ram_buf; + } + if (section == DHD_PREALLOC_DHD_WLFC_HANGER) { + if (size > DHD_PREALLOC_DHD_WLFC_HANGER_SIZE) { + pr_err("request DHD_WLFC_HANGER size(%lu) > %d\n", + size, DHD_PREALLOC_DHD_WLFC_HANGER_SIZE); + return NULL; + } + return wlan_static_dhd_wlfc_hanger_buf; + } + if (section == DHD_PREALLOC_DHD_LOG_DUMP_BUF) { + if (size > DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE) { + pr_err("request DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE(%lu) > %d\n", + size, DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE); + return NULL; + } + + return wlan_static_dhd_log_dump_buf; + } + if (section == DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX) { + if (size > DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE) { + pr_err("request DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE(%lu) > %d\n", + size, DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE); + return NULL; + } + + return wlan_static_dhd_log_dump_buf_ex; + } + if (section == DHD_PREALLOC_WL_ESCAN) { + if (size > DHD_PREALLOC_WL_ESCAN_SIZE) { + pr_err("request DHD_PREALLOC_WL_ESCAN_SIZE(%lu) > %d\n", + size, DHD_PREALLOC_WL_ESCAN_SIZE); + return NULL; + } + + return wlan_static_wl_escan_info_buf; + } + if (section == DHD_PREALLOC_FW_VERBOSE_RING) { + if (size > FW_VERBOSE_RING_SIZE) { + pr_err("request DHD_PREALLOC_FW_VERBOSE_RING(%lu) > %d\n", + size, FW_VERBOSE_RING_SIZE); + return NULL; + } + + return wlan_static_fw_verbose_ring_buf; + } + if (section == DHD_PREALLOC_FW_EVENT_RING) { + if (size > FW_EVENT_RING_SIZE) { + pr_err("request DHD_PREALLOC_FW_EVENT_RING(%lu) > %d\n", + size, FW_EVENT_RING_SIZE); + return NULL; + } + + return wlan_static_fw_event_ring_buf; + } + if (section == DHD_PREALLOC_DHD_EVENT_RING) { + if (size > DHD_EVENT_RING_SIZE) { + pr_err("request DHD_PREALLOC_DHD_EVENT_RING(%lu) > %d\n", + size, DHD_EVENT_RING_SIZE); + return NULL; + } + + return wlan_static_dhd_event_ring_buf; + } + if (section == DHD_PREALLOC_NAN_EVENT_RING) { + if (size > NAN_EVENT_RING_SIZE) { + pr_err("request DHD_PREALLOC_NAN_EVENT_RING(%lu) > %d\n", + size, NAN_EVENT_RING_SIZE); + return NULL; + } + + return wlan_static_nan_event_ring_buf; + } + if ((section < 0) || (section > DHD_PREALLOC_MAX)) + pr_err("request section id(%d) is out of max index %d\n", + section, DHD_PREALLOC_MAX); + + pr_err("%s: failed to alloc section %d, size=%ld\n", + __func__, section, size); + + return NULL; +} +EXPORT_SYMBOL(dhd_wlan_mem_prealloc); + +static int dhd_init_wlan_mem(void) +{ + int i; + int j; + printk(KERN_ERR "%s(): %s\n", __func__, DHD_STATIC_VERSION_STR); + + for (i = 0; i < DHD_SKB_1PAGE_BUF_NUM; i++) { + wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_1PAGE_BUFSIZE); + if (!wlan_static_skb[i]) { + goto err_skb_alloc; + } + pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__, + DHD_PREALLOC_SKB_BUF, i, DHD_SKB_1PAGE_BUFSIZE); + } + + for (i = DHD_SKB_1PAGE_BUF_NUM; i < WLAN_SKB_1_2PAGE_BUF_NUM; i++) { + wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_2PAGE_BUFSIZE); + if (!wlan_static_skb[i]) { + goto err_skb_alloc; + } + pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__, + DHD_PREALLOC_SKB_BUF, i, DHD_SKB_2PAGE_BUFSIZE); + } + +#if defined(BCMDHD_SDIO) + wlan_static_skb[i] = dev_alloc_skb(DHD_SKB_4PAGE_BUFSIZE); + if (!wlan_static_skb[i]) + goto err_skb_alloc; + pr_err("%s: sectoin %d skb[%d], size=%ld\n", __func__, + DHD_PREALLOC_SKB_BUF, i, DHD_SKB_4PAGE_BUFSIZE); +#endif /* BCMDHD_SDIO */ + + wlan_static_prot = kmalloc(DHD_PREALLOC_PROT_SIZE, GFP_KERNEL); + if (!wlan_static_prot) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_PROT, DHD_PREALLOC_PROT_SIZE); + +#if defined(BCMDHD_SDIO) + wlan_static_rxbuf = kmalloc(DHD_PREALLOC_RXBUF_SIZE, GFP_KERNEL); + if (!wlan_static_rxbuf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_RXBUF, DHD_PREALLOC_RXBUF_SIZE); + + wlan_static_databuf = kmalloc(DHD_PREALLOC_DATABUF_SIZE, GFP_KERNEL); + if (!wlan_static_databuf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_DATABUF, DHD_PREALLOC_DATABUF_SIZE); +#endif /* BCMDHD_SDIO */ + + wlan_static_osl_buf = kmalloc(DHD_PREALLOC_OSL_BUF_SIZE, GFP_KERNEL); + if (!wlan_static_osl_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%ld\n", __func__, + DHD_PREALLOC_OSL_BUF, DHD_PREALLOC_OSL_BUF_SIZE); + + wlan_static_scan_buf0 = kmalloc(DHD_PREALLOC_WIPHY_ESCAN0_SIZE, GFP_KERNEL); + if (!wlan_static_scan_buf0) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_WIPHY_ESCAN0, DHD_PREALLOC_WIPHY_ESCAN0_SIZE); + + wlan_static_dhd_info_buf = kmalloc(DHD_PREALLOC_DHD_INFO_SIZE, GFP_KERNEL); + if (!wlan_static_dhd_info_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_DHD_INFO, DHD_PREALLOC_DHD_INFO_SIZE); + + wlan_static_dhd_wlfc_info_buf = kmalloc(WLAN_DHD_WLFC_BUF_SIZE, GFP_KERNEL); + if (!wlan_static_dhd_wlfc_info_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_DHD_WLFC_INFO, WLAN_DHD_WLFC_BUF_SIZE); + +#ifdef BCMDHD_PCIE + wlan_static_if_flow_lkup = kmalloc(DHD_PREALLOC_IF_FLOW_LKUP_SIZE, GFP_KERNEL); + if (!wlan_static_if_flow_lkup) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_IF_FLOW_LKUP, DHD_PREALLOC_IF_FLOW_LKUP_SIZE); +#endif /* BCMDHD_PCIE */ + + wlan_static_dhd_memdump_ram_buf = kmalloc(DHD_PREALLOC_MEMDUMP_RAM_SIZE, GFP_KERNEL); + if (!wlan_static_dhd_memdump_ram_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_MEMDUMP_RAM, DHD_PREALLOC_MEMDUMP_RAM_SIZE); + + wlan_static_dhd_wlfc_hanger_buf = kmalloc(DHD_PREALLOC_DHD_WLFC_HANGER_SIZE, GFP_KERNEL); + if (!wlan_static_dhd_wlfc_hanger_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_DHD_WLFC_HANGER, DHD_PREALLOC_DHD_WLFC_HANGER_SIZE); + + wlan_static_dhd_log_dump_buf = kmalloc(DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE, GFP_KERNEL); + if (!wlan_static_dhd_log_dump_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_DHD_LOG_DUMP_BUF, DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE); + + wlan_static_dhd_log_dump_buf_ex = kmalloc(DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE, GFP_KERNEL); + if (!wlan_static_dhd_log_dump_buf_ex) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX, DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE); + + wlan_static_wl_escan_info_buf = kmalloc(DHD_PREALLOC_WL_ESCAN_SIZE, GFP_KERNEL); + if (!wlan_static_wl_escan_info_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_WL_ESCAN, DHD_PREALLOC_WL_ESCAN_SIZE); + + wlan_static_fw_verbose_ring_buf = kmalloc(FW_VERBOSE_RING_SIZE, GFP_KERNEL); + if (!wlan_static_fw_verbose_ring_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_FW_VERBOSE_RING, FW_VERBOSE_RING_SIZE); + + wlan_static_fw_event_ring_buf = kmalloc(FW_EVENT_RING_SIZE, GFP_KERNEL); + if (!wlan_static_fw_event_ring_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_FW_EVENT_RING, FW_EVENT_RING_SIZE); + + wlan_static_dhd_event_ring_buf = kmalloc(DHD_EVENT_RING_SIZE, GFP_KERNEL); + if (!wlan_static_dhd_event_ring_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_DHD_EVENT_RING, DHD_EVENT_RING_SIZE); + + wlan_static_nan_event_ring_buf = kmalloc(NAN_EVENT_RING_SIZE, GFP_KERNEL); + if (!wlan_static_nan_event_ring_buf) + goto err_mem_alloc; + pr_err("%s: sectoin %d, size=%d\n", __func__, + DHD_PREALLOC_NAN_EVENT_RING, NAN_EVENT_RING_SIZE); + + return 0; + +err_mem_alloc: + + if (wlan_static_prot) + kfree(wlan_static_prot); + +#if defined(BCMDHD_SDIO) + if (wlan_static_rxbuf) + kfree(wlan_static_rxbuf); + + if (wlan_static_databuf) + kfree(wlan_static_databuf); +#endif /* BCMDHD_SDIO */ + + if (wlan_static_osl_buf) + kfree(wlan_static_osl_buf); + + if (wlan_static_scan_buf0) + kfree(wlan_static_scan_buf0); + + if (wlan_static_scan_buf1) + kfree(wlan_static_scan_buf1); + + if (wlan_static_dhd_info_buf) + kfree(wlan_static_dhd_info_buf); + + if (wlan_static_dhd_wlfc_info_buf) + kfree(wlan_static_dhd_wlfc_info_buf); + +#ifdef BCMDHD_PCIE + if (wlan_static_if_flow_lkup) + kfree(wlan_static_if_flow_lkup); +#endif /* BCMDHD_PCIE */ + + if (wlan_static_dhd_memdump_ram_buf) + kfree(wlan_static_dhd_memdump_ram_buf); + + if (wlan_static_dhd_wlfc_hanger_buf) + kfree(wlan_static_dhd_wlfc_hanger_buf); + + if (wlan_static_dhd_log_dump_buf) + kfree(wlan_static_dhd_log_dump_buf); + + if (wlan_static_dhd_log_dump_buf_ex) + kfree(wlan_static_dhd_log_dump_buf_ex); + + if (wlan_static_wl_escan_info_buf) + kfree(wlan_static_wl_escan_info_buf); + +#ifdef BCMDHD_PCIE + if (wlan_static_fw_verbose_ring_buf) + kfree(wlan_static_fw_verbose_ring_buf); + + if (wlan_static_fw_event_ring_buf) + kfree(wlan_static_fw_event_ring_buf); + + if (wlan_static_dhd_event_ring_buf) + kfree(wlan_static_dhd_event_ring_buf); + + if (wlan_static_nan_event_ring_buf) + kfree(wlan_static_nan_event_ring_buf); +#endif /* BCMDHD_PCIE */ + + pr_err("%s: Failed to mem_alloc for WLAN\n", __func__); + + i = WLAN_SKB_BUF_NUM; + +err_skb_alloc: + pr_err("%s: Failed to skb_alloc for WLAN\n", __func__); + for (j = 0; j < i; j++) + dev_kfree_skb(wlan_static_skb[j]); + + return -ENOMEM; +} + +static int __init +dhd_static_buf_init(void) +{ + dhd_init_wlan_mem(); + + return 0; +} + +static void __exit +dhd_static_buf_exit(void) +{ + int i; + + pr_err("%s()\n", __FUNCTION__); + + for (i = 0; i < DHD_SKB_1PAGE_BUF_NUM; i++) { + if (wlan_static_skb[i]) + dev_kfree_skb(wlan_static_skb[i]); + } + + for (i = DHD_SKB_1PAGE_BUF_NUM; i < WLAN_SKB_1_2PAGE_BUF_NUM; i++) { + if (wlan_static_skb[i]) + dev_kfree_skb(wlan_static_skb[i]); + } + +#if defined(BCMDHD_SDIO) + if (wlan_static_skb[i]) + dev_kfree_skb(wlan_static_skb[i]); +#endif /* BCMDHD_SDIO */ + + if (wlan_static_prot) + kfree(wlan_static_prot); + +#if defined(BCMDHD_SDIO) + if (wlan_static_rxbuf) + kfree(wlan_static_rxbuf); + + if (wlan_static_databuf) + kfree(wlan_static_databuf); +#endif /* BCMDHD_SDIO */ + + if (wlan_static_osl_buf) + kfree(wlan_static_osl_buf); + + if (wlan_static_scan_buf0) + kfree(wlan_static_scan_buf0); + + if (wlan_static_scan_buf1) + kfree(wlan_static_scan_buf1); + + if (wlan_static_dhd_info_buf) + kfree(wlan_static_dhd_info_buf); + + if (wlan_static_dhd_wlfc_info_buf) + kfree(wlan_static_dhd_wlfc_info_buf); + +#ifdef BCMDHD_PCIE + if (wlan_static_if_flow_lkup) + kfree(wlan_static_if_flow_lkup); +#endif /* BCMDHD_PCIE */ + + if (wlan_static_dhd_memdump_ram_buf) + kfree(wlan_static_dhd_memdump_ram_buf); + + if (wlan_static_dhd_wlfc_hanger_buf) + kfree(wlan_static_dhd_wlfc_hanger_buf); + + if (wlan_static_dhd_log_dump_buf) + kfree(wlan_static_dhd_log_dump_buf); + + if (wlan_static_dhd_log_dump_buf_ex) + kfree(wlan_static_dhd_log_dump_buf_ex); + + if (wlan_static_wl_escan_info_buf) + kfree(wlan_static_wl_escan_info_buf); + +#ifdef BCMDHD_PCIE + if (wlan_static_fw_verbose_ring_buf) + kfree(wlan_static_fw_verbose_ring_buf); + + if (wlan_static_fw_event_ring_buf) + kfree(wlan_static_fw_event_ring_buf); + + if (wlan_static_dhd_event_ring_buf) + kfree(wlan_static_dhd_event_ring_buf); + + if (wlan_static_nan_event_ring_buf) + kfree(wlan_static_nan_event_ring_buf); +#endif + + return; +} + +module_init(dhd_static_buf_init); + +module_exit(dhd_static_buf_exit); diff --git a/bcmdhd.100.10.315.x/dhd_wlfc.c b/bcmdhd.100.10.545.x/dhd_wlfc.c similarity index 100% rename from bcmdhd.100.10.315.x/dhd_wlfc.c rename to bcmdhd.100.10.545.x/dhd_wlfc.c diff --git a/bcmdhd.100.10.315.x/dhd_wlfc.h b/bcmdhd.100.10.545.x/dhd_wlfc.h similarity index 100% rename from bcmdhd.100.10.315.x/dhd_wlfc.h rename to bcmdhd.100.10.545.x/dhd_wlfc.h diff --git a/bcmdhd.100.10.315.x/dngl_stats.h b/bcmdhd.100.10.545.x/dngl_stats.h similarity index 100% rename from bcmdhd.100.10.315.x/dngl_stats.h rename to bcmdhd.100.10.545.x/dngl_stats.h diff --git a/bcmdhd.100.10.315.x/dngl_wlhdr.h b/bcmdhd.100.10.545.x/dngl_wlhdr.h similarity index 100% rename from bcmdhd.100.10.315.x/dngl_wlhdr.h rename to bcmdhd.100.10.545.x/dngl_wlhdr.h diff --git a/bcmdhd.100.10.315.x/frag.c b/bcmdhd.100.10.545.x/frag.c similarity index 100% rename from bcmdhd.100.10.315.x/frag.c rename to bcmdhd.100.10.545.x/frag.c diff --git a/bcmdhd.100.10.315.x/frag.h b/bcmdhd.100.10.545.x/frag.h similarity index 100% rename from bcmdhd.100.10.315.x/frag.h rename to bcmdhd.100.10.545.x/frag.h diff --git a/bcmdhd.100.10.315.x/hnd_pktpool.c b/bcmdhd.100.10.545.x/hnd_pktpool.c similarity index 100% rename from bcmdhd.100.10.315.x/hnd_pktpool.c rename to bcmdhd.100.10.545.x/hnd_pktpool.c diff --git a/bcmdhd.100.10.315.x/hnd_pktq.c b/bcmdhd.100.10.545.x/hnd_pktq.c similarity index 100% rename from bcmdhd.100.10.315.x/hnd_pktq.c rename to bcmdhd.100.10.545.x/hnd_pktq.c diff --git a/bcmdhd.100.10.315.x/hndlhl.c b/bcmdhd.100.10.545.x/hndlhl.c similarity index 100% rename from bcmdhd.100.10.315.x/hndlhl.c rename to bcmdhd.100.10.545.x/hndlhl.c diff --git a/bcmdhd.100.10.315.x/hndmem.c b/bcmdhd.100.10.545.x/hndmem.c similarity index 100% rename from bcmdhd.100.10.315.x/hndmem.c rename to bcmdhd.100.10.545.x/hndmem.c diff --git a/bcmdhd.100.10.315.x/hndpmu.c b/bcmdhd.100.10.545.x/hndpmu.c similarity index 100% rename from bcmdhd.100.10.315.x/hndpmu.c rename to bcmdhd.100.10.545.x/hndpmu.c diff --git a/bcmdhd.100.10.315.x/include/802.11.h b/bcmdhd.100.10.545.x/include/802.11.h similarity index 100% rename from bcmdhd.100.10.315.x/include/802.11.h rename to bcmdhd.100.10.545.x/include/802.11.h diff --git a/bcmdhd.100.10.315.x/include/802.11e.h b/bcmdhd.100.10.545.x/include/802.11e.h similarity index 100% rename from bcmdhd.100.10.315.x/include/802.11e.h rename to bcmdhd.100.10.545.x/include/802.11e.h diff --git a/bcmdhd.100.10.315.x/include/802.11s.h b/bcmdhd.100.10.545.x/include/802.11s.h similarity index 100% rename from bcmdhd.100.10.315.x/include/802.11s.h rename to bcmdhd.100.10.545.x/include/802.11s.h diff --git a/bcmdhd.100.10.315.x/include/802.1d.h b/bcmdhd.100.10.545.x/include/802.1d.h similarity index 100% rename from bcmdhd.100.10.315.x/include/802.1d.h rename to bcmdhd.100.10.545.x/include/802.1d.h diff --git a/bcmdhd.100.10.315.x/include/802.3.h b/bcmdhd.100.10.545.x/include/802.3.h similarity index 100% rename from bcmdhd.100.10.315.x/include/802.3.h rename to bcmdhd.100.10.545.x/include/802.3.h diff --git a/bcmdhd.100.10.315.x/include/aidmp.h b/bcmdhd.100.10.545.x/include/aidmp.h similarity index 100% rename from bcmdhd.100.10.315.x/include/aidmp.h rename to bcmdhd.100.10.545.x/include/aidmp.h diff --git a/bcmdhd.100.10.315.x/include/bcm_cfg.h b/bcmdhd.100.10.545.x/include/bcm_cfg.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcm_cfg.h rename to bcmdhd.100.10.545.x/include/bcm_cfg.h diff --git a/bcmdhd.100.10.315.x/include/bcm_mpool_pub.h b/bcmdhd.100.10.545.x/include/bcm_mpool_pub.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcm_mpool_pub.h rename to bcmdhd.100.10.545.x/include/bcm_mpool_pub.h diff --git a/bcmdhd.100.10.315.x/include/bcm_ring.h b/bcmdhd.100.10.545.x/include/bcm_ring.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcm_ring.h rename to bcmdhd.100.10.545.x/include/bcm_ring.h diff --git a/bcmdhd.100.10.315.x/include/bcmarp.h b/bcmdhd.100.10.545.x/include/bcmarp.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmarp.h rename to bcmdhd.100.10.545.x/include/bcmarp.h diff --git a/bcmdhd.100.10.315.x/include/bcmbloom.h b/bcmdhd.100.10.545.x/include/bcmbloom.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmbloom.h rename to bcmdhd.100.10.545.x/include/bcmbloom.h diff --git a/bcmdhd.100.10.315.x/include/bcmcdc.h b/bcmdhd.100.10.545.x/include/bcmcdc.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmcdc.h rename to bcmdhd.100.10.545.x/include/bcmcdc.h diff --git a/bcmdhd.100.10.315.x/include/bcmdefs.h b/bcmdhd.100.10.545.x/include/bcmdefs.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmdefs.h rename to bcmdhd.100.10.545.x/include/bcmdefs.h diff --git a/bcmdhd.100.10.315.x/include/bcmdevs.h b/bcmdhd.100.10.545.x/include/bcmdevs.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmdevs.h rename to bcmdhd.100.10.545.x/include/bcmdevs.h diff --git a/bcmdhd.100.10.315.x/include/bcmdhcp.h b/bcmdhd.100.10.545.x/include/bcmdhcp.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmdhcp.h rename to bcmdhd.100.10.545.x/include/bcmdhcp.h diff --git a/bcmdhd.100.10.315.x/include/bcmendian.h b/bcmdhd.100.10.545.x/include/bcmendian.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmendian.h rename to bcmdhd.100.10.545.x/include/bcmendian.h diff --git a/bcmdhd.100.10.315.x/include/bcmeth.h b/bcmdhd.100.10.545.x/include/bcmeth.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmeth.h rename to bcmdhd.100.10.545.x/include/bcmeth.h diff --git a/bcmdhd.100.10.315.x/include/bcmevent.h b/bcmdhd.100.10.545.x/include/bcmevent.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmevent.h rename to bcmdhd.100.10.545.x/include/bcmevent.h diff --git a/bcmdhd.100.10.315.x/include/bcmicmp.h b/bcmdhd.100.10.545.x/include/bcmicmp.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmicmp.h rename to bcmdhd.100.10.545.x/include/bcmicmp.h diff --git a/bcmdhd.100.10.315.x/include/bcmiov.h b/bcmdhd.100.10.545.x/include/bcmiov.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmiov.h rename to bcmdhd.100.10.545.x/include/bcmiov.h diff --git a/bcmdhd.100.10.315.x/include/bcmip.h b/bcmdhd.100.10.545.x/include/bcmip.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmip.h rename to bcmdhd.100.10.545.x/include/bcmip.h diff --git a/bcmdhd.100.10.315.x/include/bcmipv6.h b/bcmdhd.100.10.545.x/include/bcmipv6.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmipv6.h rename to bcmdhd.100.10.545.x/include/bcmipv6.h diff --git a/bcmdhd.100.10.315.x/include/bcmmsgbuf.h b/bcmdhd.100.10.545.x/include/bcmmsgbuf.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmmsgbuf.h rename to bcmdhd.100.10.545.x/include/bcmmsgbuf.h diff --git a/bcmdhd.100.10.315.x/include/bcmnvram.h b/bcmdhd.100.10.545.x/include/bcmnvram.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmnvram.h rename to bcmdhd.100.10.545.x/include/bcmnvram.h diff --git a/bcmdhd.100.10.315.x/include/bcmpcie.h b/bcmdhd.100.10.545.x/include/bcmpcie.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmpcie.h rename to bcmdhd.100.10.545.x/include/bcmpcie.h diff --git a/bcmdhd.100.10.315.x/include/bcmpcispi.h b/bcmdhd.100.10.545.x/include/bcmpcispi.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmpcispi.h rename to bcmdhd.100.10.545.x/include/bcmpcispi.h diff --git a/bcmdhd.100.10.315.x/include/bcmperf.h b/bcmdhd.100.10.545.x/include/bcmperf.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmperf.h rename to bcmdhd.100.10.545.x/include/bcmperf.h diff --git a/bcmdhd.100.10.315.x/include/bcmsdbus.h b/bcmdhd.100.10.545.x/include/bcmsdbus.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmsdbus.h rename to bcmdhd.100.10.545.x/include/bcmsdbus.h diff --git a/bcmdhd.100.10.315.x/include/bcmsdh.h b/bcmdhd.100.10.545.x/include/bcmsdh.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmsdh.h rename to bcmdhd.100.10.545.x/include/bcmsdh.h diff --git a/bcmdhd.100.10.315.x/include/bcmsdh_sdmmc.h b/bcmdhd.100.10.545.x/include/bcmsdh_sdmmc.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmsdh_sdmmc.h rename to bcmdhd.100.10.545.x/include/bcmsdh_sdmmc.h diff --git a/bcmdhd.100.10.315.x/include/bcmsdpcm.h b/bcmdhd.100.10.545.x/include/bcmsdpcm.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmsdpcm.h rename to bcmdhd.100.10.545.x/include/bcmsdpcm.h diff --git a/bcmdhd.100.10.315.x/include/bcmsdspi.h b/bcmdhd.100.10.545.x/include/bcmsdspi.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmsdspi.h rename to bcmdhd.100.10.545.x/include/bcmsdspi.h diff --git a/bcmdhd.100.10.315.x/include/bcmsdstd.h b/bcmdhd.100.10.545.x/include/bcmsdstd.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmsdstd.h rename to bcmdhd.100.10.545.x/include/bcmsdstd.h diff --git a/bcmdhd.100.10.315.x/include/bcmspi.h b/bcmdhd.100.10.545.x/include/bcmspi.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmspi.h rename to bcmdhd.100.10.545.x/include/bcmspi.h diff --git a/bcmdhd.100.10.315.x/include/bcmspibrcm.h b/bcmdhd.100.10.545.x/include/bcmspibrcm.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmspibrcm.h rename to bcmdhd.100.10.545.x/include/bcmspibrcm.h diff --git a/bcmdhd.100.10.315.x/include/bcmsrom_fmt.h b/bcmdhd.100.10.545.x/include/bcmsrom_fmt.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmsrom_fmt.h rename to bcmdhd.100.10.545.x/include/bcmsrom_fmt.h diff --git a/bcmdhd.100.10.315.x/include/bcmsrom_tbl.h b/bcmdhd.100.10.545.x/include/bcmsrom_tbl.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmsrom_tbl.h rename to bcmdhd.100.10.545.x/include/bcmsrom_tbl.h diff --git a/bcmdhd.100.10.315.x/include/bcmstdlib_s.h b/bcmdhd.100.10.545.x/include/bcmstdlib_s.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmstdlib_s.h rename to bcmdhd.100.10.545.x/include/bcmstdlib_s.h diff --git a/bcmdhd.100.10.315.x/include/bcmtcp.h b/bcmdhd.100.10.545.x/include/bcmtcp.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmtcp.h rename to bcmdhd.100.10.545.x/include/bcmtcp.h diff --git a/bcmdhd.100.10.315.x/include/bcmtlv.h b/bcmdhd.100.10.545.x/include/bcmtlv.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmtlv.h rename to bcmdhd.100.10.545.x/include/bcmtlv.h diff --git a/bcmdhd.100.10.315.x/include/bcmudp.h b/bcmdhd.100.10.545.x/include/bcmudp.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmudp.h rename to bcmdhd.100.10.545.x/include/bcmudp.h diff --git a/bcmdhd.100.10.315.x/include/bcmutils.h b/bcmdhd.100.10.545.x/include/bcmutils.h similarity index 100% rename from bcmdhd.100.10.315.x/include/bcmutils.h rename to bcmdhd.100.10.545.x/include/bcmutils.h diff --git a/bcmdhd.100.10.315.x/include/brcm_nl80211.h b/bcmdhd.100.10.545.x/include/brcm_nl80211.h similarity index 100% rename from bcmdhd.100.10.315.x/include/brcm_nl80211.h rename to bcmdhd.100.10.545.x/include/brcm_nl80211.h diff --git a/bcmdhd.100.10.315.x/include/dbus.h b/bcmdhd.100.10.545.x/include/dbus.h similarity index 100% rename from bcmdhd.100.10.315.x/include/dbus.h rename to bcmdhd.100.10.545.x/include/dbus.h diff --git a/bcmdhd.100.10.315.x/include/dhd_daemon.h b/bcmdhd.100.10.545.x/include/dhd_daemon.h similarity index 100% rename from bcmdhd.100.10.315.x/include/dhd_daemon.h rename to bcmdhd.100.10.545.x/include/dhd_daemon.h diff --git a/bcmdhd.100.10.315.x/include/dhdioctl.h b/bcmdhd.100.10.545.x/include/dhdioctl.h similarity index 100% rename from bcmdhd.100.10.315.x/include/dhdioctl.h rename to bcmdhd.100.10.545.x/include/dhdioctl.h diff --git a/bcmdhd.100.10.315.x/include/dnglevent.h b/bcmdhd.100.10.545.x/include/dnglevent.h similarity index 100% rename from bcmdhd.100.10.315.x/include/dnglevent.h rename to bcmdhd.100.10.545.x/include/dnglevent.h diff --git a/bcmdhd.100.10.315.x/include/eapol.h b/bcmdhd.100.10.545.x/include/eapol.h similarity index 100% rename from bcmdhd.100.10.315.x/include/eapol.h rename to bcmdhd.100.10.545.x/include/eapol.h diff --git a/bcmdhd.100.10.315.x/include/epivers.h b/bcmdhd.100.10.545.x/include/epivers.h similarity index 100% rename from bcmdhd.100.10.315.x/include/epivers.h rename to bcmdhd.100.10.545.x/include/epivers.h diff --git a/bcmdhd.100.10.315.x/include/etd.h b/bcmdhd.100.10.545.x/include/etd.h similarity index 100% rename from bcmdhd.100.10.315.x/include/etd.h rename to bcmdhd.100.10.545.x/include/etd.h diff --git a/bcmdhd.100.10.315.x/include/ethernet.h b/bcmdhd.100.10.545.x/include/ethernet.h similarity index 100% rename from bcmdhd.100.10.315.x/include/ethernet.h rename to bcmdhd.100.10.545.x/include/ethernet.h diff --git a/bcmdhd.100.10.315.x/include/event_log.h b/bcmdhd.100.10.545.x/include/event_log.h similarity index 100% rename from bcmdhd.100.10.315.x/include/event_log.h rename to bcmdhd.100.10.545.x/include/event_log.h diff --git a/bcmdhd.100.10.315.x/include/event_log_payload.h b/bcmdhd.100.10.545.x/include/event_log_payload.h similarity index 100% rename from bcmdhd.100.10.315.x/include/event_log_payload.h rename to bcmdhd.100.10.545.x/include/event_log_payload.h diff --git a/bcmdhd.100.10.315.x/include/event_log_set.h b/bcmdhd.100.10.545.x/include/event_log_set.h similarity index 100% rename from bcmdhd.100.10.315.x/include/event_log_set.h rename to bcmdhd.100.10.545.x/include/event_log_set.h diff --git a/bcmdhd.100.10.315.x/include/event_log_tag.h b/bcmdhd.100.10.545.x/include/event_log_tag.h similarity index 100% rename from bcmdhd.100.10.315.x/include/event_log_tag.h rename to bcmdhd.100.10.545.x/include/event_log_tag.h diff --git a/bcmdhd.100.10.315.x/include/event_trace.h b/bcmdhd.100.10.545.x/include/event_trace.h similarity index 100% rename from bcmdhd.100.10.315.x/include/event_trace.h rename to bcmdhd.100.10.545.x/include/event_trace.h diff --git a/bcmdhd.100.10.315.x/include/fils.h b/bcmdhd.100.10.545.x/include/fils.h similarity index 100% rename from bcmdhd.100.10.315.x/include/fils.h rename to bcmdhd.100.10.545.x/include/fils.h diff --git a/bcmdhd.100.10.315.x/include/hnd_armtrap.h b/bcmdhd.100.10.545.x/include/hnd_armtrap.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hnd_armtrap.h rename to bcmdhd.100.10.545.x/include/hnd_armtrap.h diff --git a/bcmdhd.100.10.315.x/include/hnd_cons.h b/bcmdhd.100.10.545.x/include/hnd_cons.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hnd_cons.h rename to bcmdhd.100.10.545.x/include/hnd_cons.h diff --git a/bcmdhd.100.10.315.x/include/hnd_debug.h b/bcmdhd.100.10.545.x/include/hnd_debug.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hnd_debug.h rename to bcmdhd.100.10.545.x/include/hnd_debug.h diff --git a/bcmdhd.100.10.315.x/include/hnd_pktpool.h b/bcmdhd.100.10.545.x/include/hnd_pktpool.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hnd_pktpool.h rename to bcmdhd.100.10.545.x/include/hnd_pktpool.h diff --git a/bcmdhd.100.10.315.x/include/hnd_pktq.h b/bcmdhd.100.10.545.x/include/hnd_pktq.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hnd_pktq.h rename to bcmdhd.100.10.545.x/include/hnd_pktq.h diff --git a/bcmdhd.100.10.315.x/include/hnd_trap.h b/bcmdhd.100.10.545.x/include/hnd_trap.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hnd_trap.h rename to bcmdhd.100.10.545.x/include/hnd_trap.h diff --git a/bcmdhd.100.10.315.x/include/hndchipc.h b/bcmdhd.100.10.545.x/include/hndchipc.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hndchipc.h rename to bcmdhd.100.10.545.x/include/hndchipc.h diff --git a/bcmdhd.100.10.315.x/include/hndlhl.h b/bcmdhd.100.10.545.x/include/hndlhl.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hndlhl.h rename to bcmdhd.100.10.545.x/include/hndlhl.h diff --git a/bcmdhd.100.10.315.x/include/hndmem.h b/bcmdhd.100.10.545.x/include/hndmem.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hndmem.h rename to bcmdhd.100.10.545.x/include/hndmem.h diff --git a/bcmdhd.100.10.315.x/include/hndoobr.h b/bcmdhd.100.10.545.x/include/hndoobr.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hndoobr.h rename to bcmdhd.100.10.545.x/include/hndoobr.h diff --git a/bcmdhd.100.10.315.x/include/hndpmu.h b/bcmdhd.100.10.545.x/include/hndpmu.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hndpmu.h rename to bcmdhd.100.10.545.x/include/hndpmu.h diff --git a/bcmdhd.100.10.315.x/include/hndsoc.h b/bcmdhd.100.10.545.x/include/hndsoc.h similarity index 100% rename from bcmdhd.100.10.315.x/include/hndsoc.h rename to bcmdhd.100.10.545.x/include/hndsoc.h diff --git a/bcmdhd.100.10.315.x/include/linux_osl.h b/bcmdhd.100.10.545.x/include/linux_osl.h similarity index 100% rename from bcmdhd.100.10.315.x/include/linux_osl.h rename to bcmdhd.100.10.545.x/include/linux_osl.h diff --git a/bcmdhd.100.10.315.x/include/linux_pkt.h b/bcmdhd.100.10.545.x/include/linux_pkt.h similarity index 100% rename from bcmdhd.100.10.315.x/include/linux_pkt.h rename to bcmdhd.100.10.545.x/include/linux_pkt.h diff --git a/bcmdhd.100.10.315.x/include/linuxver.h b/bcmdhd.100.10.545.x/include/linuxver.h similarity index 100% rename from bcmdhd.100.10.315.x/include/linuxver.h rename to bcmdhd.100.10.545.x/include/linuxver.h diff --git a/bcmdhd.100.10.315.x/include/lpflags.h b/bcmdhd.100.10.545.x/include/lpflags.h similarity index 100% rename from bcmdhd.100.10.315.x/include/lpflags.h rename to bcmdhd.100.10.545.x/include/lpflags.h diff --git a/bcmdhd.100.10.315.x/include/mbo.h b/bcmdhd.100.10.545.x/include/mbo.h similarity index 100% rename from bcmdhd.100.10.315.x/include/mbo.h rename to bcmdhd.100.10.545.x/include/mbo.h diff --git a/bcmdhd.100.10.315.x/include/miniopt.h b/bcmdhd.100.10.545.x/include/miniopt.h similarity index 100% rename from bcmdhd.100.10.315.x/include/miniopt.h rename to bcmdhd.100.10.545.x/include/miniopt.h diff --git a/bcmdhd.100.10.315.x/include/msf.h b/bcmdhd.100.10.545.x/include/msf.h similarity index 100% rename from bcmdhd.100.10.315.x/include/msf.h rename to bcmdhd.100.10.545.x/include/msf.h diff --git a/bcmdhd.100.10.315.x/include/msgtrace.h b/bcmdhd.100.10.545.x/include/msgtrace.h similarity index 100% rename from bcmdhd.100.10.315.x/include/msgtrace.h rename to bcmdhd.100.10.545.x/include/msgtrace.h diff --git a/bcmdhd.100.10.315.x/include/nan.h b/bcmdhd.100.10.545.x/include/nan.h similarity index 100% rename from bcmdhd.100.10.315.x/include/nan.h rename to bcmdhd.100.10.545.x/include/nan.h diff --git a/bcmdhd.100.10.315.x/include/osl.h b/bcmdhd.100.10.545.x/include/osl.h similarity index 100% rename from bcmdhd.100.10.315.x/include/osl.h rename to bcmdhd.100.10.545.x/include/osl.h diff --git a/bcmdhd.100.10.315.x/include/osl_decl.h b/bcmdhd.100.10.545.x/include/osl_decl.h similarity index 100% rename from bcmdhd.100.10.315.x/include/osl_decl.h rename to bcmdhd.100.10.545.x/include/osl_decl.h diff --git a/bcmdhd.100.10.315.x/include/osl_ext.h b/bcmdhd.100.10.545.x/include/osl_ext.h similarity index 100% rename from bcmdhd.100.10.315.x/include/osl_ext.h rename to bcmdhd.100.10.545.x/include/osl_ext.h diff --git a/bcmdhd.100.10.315.x/include/p2p.h b/bcmdhd.100.10.545.x/include/p2p.h similarity index 100% rename from bcmdhd.100.10.315.x/include/p2p.h rename to bcmdhd.100.10.545.x/include/p2p.h diff --git a/bcmdhd.100.10.315.x/include/packed_section_end.h b/bcmdhd.100.10.545.x/include/packed_section_end.h similarity index 100% rename from bcmdhd.100.10.315.x/include/packed_section_end.h rename to bcmdhd.100.10.545.x/include/packed_section_end.h diff --git a/bcmdhd.100.10.315.x/include/packed_section_start.h b/bcmdhd.100.10.545.x/include/packed_section_start.h similarity index 100% rename from bcmdhd.100.10.315.x/include/packed_section_start.h rename to bcmdhd.100.10.545.x/include/packed_section_start.h diff --git a/bcmdhd.100.10.315.x/include/pcicfg.h b/bcmdhd.100.10.545.x/include/pcicfg.h similarity index 100% rename from bcmdhd.100.10.315.x/include/pcicfg.h rename to bcmdhd.100.10.545.x/include/pcicfg.h diff --git a/bcmdhd.100.10.315.x/include/pcie_core.h b/bcmdhd.100.10.545.x/include/pcie_core.h similarity index 100% rename from bcmdhd.100.10.315.x/include/pcie_core.h rename to bcmdhd.100.10.545.x/include/pcie_core.h diff --git a/bcmdhd.100.10.315.x/include/rte_ioctl.h b/bcmdhd.100.10.545.x/include/rte_ioctl.h similarity index 100% rename from bcmdhd.100.10.315.x/include/rte_ioctl.h rename to bcmdhd.100.10.545.x/include/rte_ioctl.h diff --git a/bcmdhd.100.10.315.x/include/sbchipc.h b/bcmdhd.100.10.545.x/include/sbchipc.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sbchipc.h rename to bcmdhd.100.10.545.x/include/sbchipc.h diff --git a/bcmdhd.100.10.315.x/include/sbconfig.h b/bcmdhd.100.10.545.x/include/sbconfig.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sbconfig.h rename to bcmdhd.100.10.545.x/include/sbconfig.h diff --git a/bcmdhd.100.10.315.x/include/sbgci.h b/bcmdhd.100.10.545.x/include/sbgci.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sbgci.h rename to bcmdhd.100.10.545.x/include/sbgci.h diff --git a/bcmdhd.100.10.315.x/include/sbhndarm.h b/bcmdhd.100.10.545.x/include/sbhndarm.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sbhndarm.h rename to bcmdhd.100.10.545.x/include/sbhndarm.h diff --git a/bcmdhd.100.10.315.x/include/sbhnddma.h b/bcmdhd.100.10.545.x/include/sbhnddma.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sbhnddma.h rename to bcmdhd.100.10.545.x/include/sbhnddma.h diff --git a/bcmdhd.100.10.315.x/include/sbpcmcia.h b/bcmdhd.100.10.545.x/include/sbpcmcia.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sbpcmcia.h rename to bcmdhd.100.10.545.x/include/sbpcmcia.h diff --git a/bcmdhd.100.10.315.x/include/sbsdio.h b/bcmdhd.100.10.545.x/include/sbsdio.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sbsdio.h rename to bcmdhd.100.10.545.x/include/sbsdio.h diff --git a/bcmdhd.100.10.315.x/include/sbsdpcmdev.h b/bcmdhd.100.10.545.x/include/sbsdpcmdev.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sbsdpcmdev.h rename to bcmdhd.100.10.545.x/include/sbsdpcmdev.h diff --git a/bcmdhd.100.10.315.x/include/sbsocram.h b/bcmdhd.100.10.545.x/include/sbsocram.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sbsocram.h rename to bcmdhd.100.10.545.x/include/sbsocram.h diff --git a/bcmdhd.100.10.315.x/include/sbsysmem.h b/bcmdhd.100.10.545.x/include/sbsysmem.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sbsysmem.h rename to bcmdhd.100.10.545.x/include/sbsysmem.h diff --git a/bcmdhd.100.10.315.x/include/sdio.h b/bcmdhd.100.10.545.x/include/sdio.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sdio.h rename to bcmdhd.100.10.545.x/include/sdio.h diff --git a/bcmdhd.100.10.315.x/include/sdioh.h b/bcmdhd.100.10.545.x/include/sdioh.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sdioh.h rename to bcmdhd.100.10.545.x/include/sdioh.h diff --git a/bcmdhd.100.10.315.x/include/sdiovar.h b/bcmdhd.100.10.545.x/include/sdiovar.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sdiovar.h rename to bcmdhd.100.10.545.x/include/sdiovar.h diff --git a/bcmdhd.100.10.315.x/include/sdspi.h b/bcmdhd.100.10.545.x/include/sdspi.h similarity index 100% rename from bcmdhd.100.10.315.x/include/sdspi.h rename to bcmdhd.100.10.545.x/include/sdspi.h diff --git a/bcmdhd.100.10.315.x/include/siutils.h b/bcmdhd.100.10.545.x/include/siutils.h similarity index 100% rename from bcmdhd.100.10.315.x/include/siutils.h rename to bcmdhd.100.10.545.x/include/siutils.h diff --git a/bcmdhd.100.10.315.x/include/spid.h b/bcmdhd.100.10.545.x/include/spid.h similarity index 100% rename from bcmdhd.100.10.315.x/include/spid.h rename to bcmdhd.100.10.545.x/include/spid.h diff --git a/bcmdhd.100.10.315.x/include/trxhdr.h b/bcmdhd.100.10.545.x/include/trxhdr.h similarity index 100% rename from bcmdhd.100.10.315.x/include/trxhdr.h rename to bcmdhd.100.10.545.x/include/trxhdr.h diff --git a/bcmdhd.100.10.315.x/include/typedefs.h b/bcmdhd.100.10.545.x/include/typedefs.h similarity index 100% rename from bcmdhd.100.10.315.x/include/typedefs.h rename to bcmdhd.100.10.545.x/include/typedefs.h diff --git a/bcmdhd.100.10.315.x/include/usbrdl.h b/bcmdhd.100.10.545.x/include/usbrdl.h similarity index 100% rename from bcmdhd.100.10.315.x/include/usbrdl.h rename to bcmdhd.100.10.545.x/include/usbrdl.h diff --git a/bcmdhd.100.10.315.x/include/vlan.h b/bcmdhd.100.10.545.x/include/vlan.h similarity index 100% rename from bcmdhd.100.10.315.x/include/vlan.h rename to bcmdhd.100.10.545.x/include/vlan.h diff --git a/bcmdhd.100.10.315.x/include/wlfc_proto.h b/bcmdhd.100.10.545.x/include/wlfc_proto.h similarity index 100% rename from bcmdhd.100.10.315.x/include/wlfc_proto.h rename to bcmdhd.100.10.545.x/include/wlfc_proto.h diff --git a/bcmdhd.100.10.315.x/include/wlioctl.h b/bcmdhd.100.10.545.x/include/wlioctl.h similarity index 100% rename from bcmdhd.100.10.315.x/include/wlioctl.h rename to bcmdhd.100.10.545.x/include/wlioctl.h diff --git a/bcmdhd.100.10.315.x/include/wlioctl_defs.h b/bcmdhd.100.10.545.x/include/wlioctl_defs.h similarity index 100% rename from bcmdhd.100.10.315.x/include/wlioctl_defs.h rename to bcmdhd.100.10.545.x/include/wlioctl_defs.h diff --git a/bcmdhd.100.10.315.x/include/wlioctl_utils.h b/bcmdhd.100.10.545.x/include/wlioctl_utils.h similarity index 100% rename from bcmdhd.100.10.315.x/include/wlioctl_utils.h rename to bcmdhd.100.10.545.x/include/wlioctl_utils.h diff --git a/bcmdhd.100.10.315.x/include/wpa.h b/bcmdhd.100.10.545.x/include/wpa.h similarity index 100% rename from bcmdhd.100.10.315.x/include/wpa.h rename to bcmdhd.100.10.545.x/include/wpa.h diff --git a/bcmdhd.100.10.315.x/include/wps.h b/bcmdhd.100.10.545.x/include/wps.h similarity index 100% rename from bcmdhd.100.10.315.x/include/wps.h rename to bcmdhd.100.10.545.x/include/wps.h diff --git a/bcmdhd.100.10.315.x/linux_osl.c b/bcmdhd.100.10.545.x/linux_osl.c similarity index 100% rename from bcmdhd.100.10.315.x/linux_osl.c rename to bcmdhd.100.10.545.x/linux_osl.c diff --git a/bcmdhd.100.10.315.x/linux_osl_priv.h b/bcmdhd.100.10.545.x/linux_osl_priv.h similarity index 100% rename from bcmdhd.100.10.315.x/linux_osl_priv.h rename to bcmdhd.100.10.545.x/linux_osl_priv.h diff --git a/bcmdhd.100.10.315.x/linux_pkt.c b/bcmdhd.100.10.545.x/linux_pkt.c similarity index 100% rename from bcmdhd.100.10.315.x/linux_pkt.c rename to bcmdhd.100.10.545.x/linux_pkt.c diff --git a/bcmdhd.100.10.315.x/otpdefs.h b/bcmdhd.100.10.545.x/otpdefs.h similarity index 100% rename from bcmdhd.100.10.315.x/otpdefs.h rename to bcmdhd.100.10.545.x/otpdefs.h diff --git a/bcmdhd.100.10.315.x/pcie_core.c b/bcmdhd.100.10.545.x/pcie_core.c similarity index 100% rename from bcmdhd.100.10.315.x/pcie_core.c rename to bcmdhd.100.10.545.x/pcie_core.c diff --git a/bcmdhd.100.10.315.x/sbutils.c b/bcmdhd.100.10.545.x/sbutils.c similarity index 100% rename from bcmdhd.100.10.315.x/sbutils.c rename to bcmdhd.100.10.545.x/sbutils.c diff --git a/bcmdhd.100.10.315.x/siutils.c b/bcmdhd.100.10.545.x/siutils.c similarity index 100% rename from bcmdhd.100.10.315.x/siutils.c rename to bcmdhd.100.10.545.x/siutils.c diff --git a/bcmdhd.100.10.315.x/siutils_priv.h b/bcmdhd.100.10.545.x/siutils_priv.h similarity index 100% rename from bcmdhd.100.10.315.x/siutils_priv.h rename to bcmdhd.100.10.545.x/siutils_priv.h diff --git a/bcmdhd.100.10.315.x/wl_android.c b/bcmdhd.100.10.545.x/wl_android.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_android.c rename to bcmdhd.100.10.545.x/wl_android.c diff --git a/bcmdhd.100.10.315.x/wl_android.h b/bcmdhd.100.10.545.x/wl_android.h similarity index 100% rename from bcmdhd.100.10.315.x/wl_android.h rename to bcmdhd.100.10.545.x/wl_android.h diff --git a/bcmdhd.100.10.315.x/wl_android_ext.c b/bcmdhd.100.10.545.x/wl_android_ext.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_android_ext.c rename to bcmdhd.100.10.545.x/wl_android_ext.c diff --git a/bcmdhd.100.10.315.x/wl_cfg80211.c b/bcmdhd.100.10.545.x/wl_cfg80211.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_cfg80211.c rename to bcmdhd.100.10.545.x/wl_cfg80211.c diff --git a/bcmdhd.100.10.315.x/wl_cfg80211.h b/bcmdhd.100.10.545.x/wl_cfg80211.h similarity index 100% rename from bcmdhd.100.10.315.x/wl_cfg80211.h rename to bcmdhd.100.10.545.x/wl_cfg80211.h diff --git a/bcmdhd.100.10.315.x/wl_cfg_btcoex.c b/bcmdhd.100.10.545.x/wl_cfg_btcoex.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_cfg_btcoex.c rename to bcmdhd.100.10.545.x/wl_cfg_btcoex.c diff --git a/bcmdhd.100.10.315.x/wl_cfgnan.c b/bcmdhd.100.10.545.x/wl_cfgnan.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_cfgnan.c rename to bcmdhd.100.10.545.x/wl_cfgnan.c diff --git a/bcmdhd.100.10.315.x/wl_cfgnan.h b/bcmdhd.100.10.545.x/wl_cfgnan.h similarity index 100% rename from bcmdhd.100.10.315.x/wl_cfgnan.h rename to bcmdhd.100.10.545.x/wl_cfgnan.h diff --git a/bcmdhd.100.10.315.x/wl_cfgp2p.c b/bcmdhd.100.10.545.x/wl_cfgp2p.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_cfgp2p.c rename to bcmdhd.100.10.545.x/wl_cfgp2p.c diff --git a/bcmdhd.100.10.315.x/wl_cfgp2p.h b/bcmdhd.100.10.545.x/wl_cfgp2p.h similarity index 100% rename from bcmdhd.100.10.315.x/wl_cfgp2p.h rename to bcmdhd.100.10.545.x/wl_cfgp2p.h diff --git a/bcmdhd.100.10.315.x/wl_cfgscan.c b/bcmdhd.100.10.545.x/wl_cfgscan.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_cfgscan.c rename to bcmdhd.100.10.545.x/wl_cfgscan.c diff --git a/bcmdhd.100.10.315.x/wl_cfgscan.h b/bcmdhd.100.10.545.x/wl_cfgscan.h similarity index 100% rename from bcmdhd.100.10.315.x/wl_cfgscan.h rename to bcmdhd.100.10.545.x/wl_cfgscan.h diff --git a/bcmdhd.100.10.315.x/wl_cfgvendor.c b/bcmdhd.100.10.545.x/wl_cfgvendor.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_cfgvendor.c rename to bcmdhd.100.10.545.x/wl_cfgvendor.c diff --git a/bcmdhd.100.10.315.x/wl_cfgvendor.h b/bcmdhd.100.10.545.x/wl_cfgvendor.h similarity index 100% rename from bcmdhd.100.10.315.x/wl_cfgvendor.h rename to bcmdhd.100.10.545.x/wl_cfgvendor.h diff --git a/bcmdhd.100.10.315.x/wl_dbg.h b/bcmdhd.100.10.545.x/wl_dbg.h similarity index 100% rename from bcmdhd.100.10.315.x/wl_dbg.h rename to bcmdhd.100.10.545.x/wl_dbg.h diff --git a/bcmdhd.100.10.315.x/wl_escan.c b/bcmdhd.100.10.545.x/wl_escan.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_escan.c rename to bcmdhd.100.10.545.x/wl_escan.c diff --git a/bcmdhd.100.10.315.x/wl_escan.h b/bcmdhd.100.10.545.x/wl_escan.h similarity index 96% rename from bcmdhd.100.10.315.x/wl_escan.h rename to bcmdhd.100.10.545.x/wl_escan.h index 080f333..9bc0e1b 100644 --- a/bcmdhd.100.10.315.x/wl_escan.h +++ b/bcmdhd.100.10.545.x/wl_escan.h @@ -1,77 +1,77 @@ - -#ifndef _wl_escan_ -#define _wl_escan_ -#include -#include - -#define ESCAN_BUF_SIZE (64 * 1024) - -#define WL_ESCAN_TIMER_INTERVAL_MS 10000 /* Scan timeout */ - -/* donlge escan state */ -enum escan_state { - ESCAN_STATE_DOWN, - ESCAN_STATE_IDLE, - ESCAN_STATE_SCANING -}; - -typedef struct wl_escan_info { - struct net_device *dev; - dhd_pub_t *pub; - timer_list_compat_t scan_timeout; /* Timer for catch scan event timeout */ - int escan_state; - int ioctl_ver; - u8 escan_buf[ESCAN_BUF_SIZE]; - struct wl_scan_results *bss_list; - struct ether_addr disconnected_bssid; - u8 *escan_ioctl_buf; - struct mutex usr_sync; /* maily for up/down synchronization */ - int autochannel; - int best_2g_ch; - int best_5g_ch; -#if defined(RSSIAVG) - wl_rssi_cache_ctrl_t g_rssi_cache_ctrl; - wl_rssi_cache_ctrl_t g_connected_rssi_cache_ctrl; -#endif -#if defined(BSSCACHE) - wl_bss_cache_ctrl_t g_bss_cache_ctrl; -#endif -} wl_escan_info_t; - -#if defined(WLMESH) -enum mesh_info_id { - MESH_INFO_MASTER_BSSID = 1, - MESH_INFO_MASTER_CHANNEL, - MESH_INFO_HOP_CNT, - MESH_INFO_PEER_BSSID -}; - -#define MAX_HOP_LIST 10 -typedef struct wl_mesh_params { - struct ether_addr master_bssid; - uint16 master_channel; - uint hop_cnt; - struct ether_addr peer_bssid[MAX_HOP_LIST]; - uint16 scan_channel; -} wl_mesh_params_t; -bool wl_escan_mesh_info(struct net_device *dev, - struct wl_escan_info *escan, struct ether_addr *peer_bssid, - struct wl_mesh_params *mesh_info); -bool wl_escan_mesh_peer(struct net_device *dev, - struct wl_escan_info *escan, wlc_ssid_t *cur_ssid, uint16 cur_chan, bool sae, - struct wl_mesh_params *mesh_info); -#endif /* WLMESH */ - -int wl_escan_set_scan(struct net_device *dev, dhd_pub_t *dhdp, - wlc_ssid_t *ssid, uint16 channel, bool bcast); -int wl_escan_get_scan(struct net_device *dev, dhd_pub_t *dhdp, - struct iw_request_info *info, struct iw_point *dwrq, char *extra); -int wl_escan_attach(struct net_device *dev, dhd_pub_t *dhdp); -void wl_escan_detach(struct net_device *dev, dhd_pub_t *dhdp); -int wl_escan_event_attach(struct net_device *dev, dhd_pub_t *dhdp); -int wl_escan_event_dettach(struct net_device *dev, dhd_pub_t *dhdp); -int wl_escan_up(struct net_device *dev, dhd_pub_t *dhdp); -void wl_escan_down(struct net_device *dev, dhd_pub_t *dhdp); - -#endif /* _wl_escan_ */ - + +#ifndef _wl_escan_ +#define _wl_escan_ +#include +#include + +#define ESCAN_BUF_SIZE (64 * 1024) + +#define WL_ESCAN_TIMER_INTERVAL_MS 10000 /* Scan timeout */ + +/* donlge escan state */ +enum escan_state { + ESCAN_STATE_DOWN, + ESCAN_STATE_IDLE, + ESCAN_STATE_SCANING +}; + +typedef struct wl_escan_info { + struct net_device *dev; + dhd_pub_t *pub; + timer_list_compat_t scan_timeout; /* Timer for catch scan event timeout */ + int escan_state; + int ioctl_ver; + u8 escan_buf[ESCAN_BUF_SIZE]; + struct wl_scan_results *bss_list; + struct ether_addr disconnected_bssid; + u8 *escan_ioctl_buf; + struct mutex usr_sync; /* maily for up/down synchronization */ + int autochannel; + int best_2g_ch; + int best_5g_ch; +#if defined(RSSIAVG) + wl_rssi_cache_ctrl_t g_rssi_cache_ctrl; + wl_rssi_cache_ctrl_t g_connected_rssi_cache_ctrl; +#endif +#if defined(BSSCACHE) + wl_bss_cache_ctrl_t g_bss_cache_ctrl; +#endif +} wl_escan_info_t; + +#if defined(WLMESH) +enum mesh_info_id { + MESH_INFO_MASTER_BSSID = 1, + MESH_INFO_MASTER_CHANNEL, + MESH_INFO_HOP_CNT, + MESH_INFO_PEER_BSSID +}; + +#define MAX_HOP_LIST 10 +typedef struct wl_mesh_params { + struct ether_addr master_bssid; + uint16 master_channel; + uint hop_cnt; + struct ether_addr peer_bssid[MAX_HOP_LIST]; + uint16 scan_channel; +} wl_mesh_params_t; +bool wl_escan_mesh_info(struct net_device *dev, + struct wl_escan_info *escan, struct ether_addr *peer_bssid, + struct wl_mesh_params *mesh_info); +bool wl_escan_mesh_peer(struct net_device *dev, + struct wl_escan_info *escan, wlc_ssid_t *cur_ssid, uint16 cur_chan, bool sae, + struct wl_mesh_params *mesh_info); +#endif /* WLMESH */ + +int wl_escan_set_scan(struct net_device *dev, dhd_pub_t *dhdp, + wlc_ssid_t *ssid, uint16 channel, bool bcast); +int wl_escan_get_scan(struct net_device *dev, dhd_pub_t *dhdp, + struct iw_request_info *info, struct iw_point *dwrq, char *extra); +int wl_escan_attach(struct net_device *dev, dhd_pub_t *dhdp); +void wl_escan_detach(struct net_device *dev, dhd_pub_t *dhdp); +int wl_escan_event_attach(struct net_device *dev, dhd_pub_t *dhdp); +int wl_escan_event_dettach(struct net_device *dev, dhd_pub_t *dhdp); +int wl_escan_up(struct net_device *dev, dhd_pub_t *dhdp); +void wl_escan_down(struct net_device *dev, dhd_pub_t *dhdp); + +#endif /* _wl_escan_ */ + diff --git a/bcmdhd.100.10.315.x/wl_event.c b/bcmdhd.100.10.545.x/wl_event.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_event.c rename to bcmdhd.100.10.545.x/wl_event.c diff --git a/bcmdhd.100.10.315.x/wl_iw.c b/bcmdhd.100.10.545.x/wl_iw.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_iw.c rename to bcmdhd.100.10.545.x/wl_iw.c diff --git a/bcmdhd.100.10.315.x/wl_iw.h b/bcmdhd.100.10.545.x/wl_iw.h similarity index 100% rename from bcmdhd.100.10.315.x/wl_iw.h rename to bcmdhd.100.10.545.x/wl_iw.h diff --git a/bcmdhd.100.10.315.x/wl_linux_mon.c b/bcmdhd.100.10.545.x/wl_linux_mon.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_linux_mon.c rename to bcmdhd.100.10.545.x/wl_linux_mon.c diff --git a/bcmdhd.100.10.315.x/wl_roam.c b/bcmdhd.100.10.545.x/wl_roam.c similarity index 100% rename from bcmdhd.100.10.315.x/wl_roam.c rename to bcmdhd.100.10.545.x/wl_roam.c diff --git a/bcmdhd.100.10.315.x/wldev_common.c b/bcmdhd.100.10.545.x/wldev_common.c similarity index 100% rename from bcmdhd.100.10.315.x/wldev_common.c rename to bcmdhd.100.10.545.x/wldev_common.c diff --git a/bcmdhd.100.10.315.x/wldev_common.h b/bcmdhd.100.10.545.x/wldev_common.h similarity index 100% rename from bcmdhd.100.10.315.x/wldev_common.h rename to bcmdhd.100.10.545.x/wldev_common.h -- 2.20.1